Files
CalamityModPublic/Items/Weapons/Melee/AbyssBlade.cs
T

79 lines
2.8 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class AbyssBlade : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Abyss Blade");
Tooltip.SetDefault("Fires short-range tridents\n" +
"Hitting enemies will inflict the crush depth debuff\n" +
"The lower the enemies' defense, the more damage they take from this debuff");
}
public override void SetDefaults()
{
item.width = 74;
item.height = 74;
item.damage = 90;
item.melee = true;
item.useAnimation = 26;
item.useTime = 26;
item.useTurn = true;
item.useStyle = ItemUseStyleID.SwingThrow;
item.knockBack = 8f;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.value = Item.buyPrice(0, 60, 0, 0);
item.rare = ItemRarityID.Lime;
item.shoot = ModContent.ProjectileType<DepthOrb>();
item.shootSpeed = 9f;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.75), knockBack, player.whoAmI);
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<DepthBlade>());
recipe.AddIngredient(ItemID.BrokenHeroSword);
recipe.AddIngredient(ModContent.ItemType<DepthCells>(), 15);
recipe.AddIngredient(ModContent.ItemType<Lumenite>(), 10);
recipe.AddIngredient(ModContent.ItemType<Tenebris>(), 5);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this);
recipe.AddRecipe();
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.NextBool(3))
{
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33);
}
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 300);
}
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 300);
}
}
}