Files

74 lines
3.0 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using ForgottenWawiTech.Content.Items.Materials;
using ForgottenWawiTech.Content.Projectiles.Transcendent;
using ForgottenWawiTech.Content.Rarities;
using ForgottenWawiTech.Content.Tiles.CraftingStations;
namespace ForgottenWawiTech.Content.Items.Weapons.Melee
{
public class TranscendentBlade : ModItem
{
public override void SetDefaults()
{
Item.width = 68;
Item.height = 68;
Item.damage = 5000;
Item.DamageType = DamageClass.Melee;
Item.knockBack = 8f;
Item.crit = 24;
Item.useTime = 14;
Item.useAnimation = 14;
Item.useStyle = ItemUseStyleID.Swing;
Item.autoReuse = true;
Item.UseSound = SoundID.Item1;
Item.value = Item.sellPrice(platinum: 300);
Item.rare = ModContent.RarityType<TranscendentItem>();
Item.shoot = ModContent.ProjectileType<TranscendentBladeShard>();
Item.shootSpeed = 19f;
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.NextBool(3))
{
Vector2 spawnPosition = new Vector2(hitbox.X, hitbox.Y);
Dust dust = Dust.NewDustDirect(spawnPosition, hitbox.Width, hitbox.Height, DustID.RainbowTorch, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 150, default, 1.3f);
dust.noGravity = true;
}
}
public override bool Shoot(Player player, Terraria.DataStructures.EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Vector2 baseVelocity = Vector2.Normalize(velocity) * Item.shootSpeed;
for (int i = 0; i < 3; i++)
{
Vector2 perturbedVelocity = baseVelocity.RotatedByRandom(MathHelper.ToRadians(22f)) * Main.rand.NextFloat(0.8f, 1.1f);
Projectile.NewProjectile(source, player.Center, perturbedVelocity, type, (int)(damage * 0.8f), knockback * 0.6f, player.whoAmI);
}
return false;
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.Daybreak, 420);
target.AddBuff(BuffID.BetsysCurse, 300);
}
public override void AddRecipes()
{
CreateRecipe()
.AddIngredient(ModContent.ItemType<ControlledSingularity>(), 8)
.AddIngredient(ModContent.ItemType<SingularityAlloy>(), 12)
.AddIngredient(ModContent.ItemType<EnergyCore>(), 14)
.AddIngredient(ModContent.ItemType<MalfunctioningNanites>(), 20)
.AddIngredient(ModContent.ItemType<UnstableMatter>(), 8)
.AddTile(ModContent.TileType<SingularitySealingUnit>())
.Register();
}
}
}