Files
CalamityModPublic/Items/Weapons/Rogue/MythrilKnife.cs
T

60 lines
1.7 KiB
C#

using CalamityMod.Projectiles.Rogue;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Rogue
{
public class MythrilKnife : RogueWeapon
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mythril Knife");
Tooltip.SetDefault("Stealth strikes inflict a wide assortment of debuffs");
}
public override void SafeSetDefaults()
{
item.width = 12;
item.damage = 40;
item.noMelee = true;
item.consumable = true;
item.noUseGraphic = true;
item.useAnimation = 10;
item.useStyle = ItemUseStyleID.SwingThrow;
item.useTime = 10;
item.knockBack = 1.75f;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.height = 30;
item.maxStack = 999;
item.value = 1100;
item.rare = ItemRarityID.LightRed;
item.shoot = ModContent.ProjectileType<MythrilKnifeProjectile>();
item.shootSpeed = 12f;
item.Calamity().rogue = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (player.Calamity().StealthStrikeAvailable())
{
int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
if (stealth.WithinBounds(Main.maxProjectiles))
Main.projectile[stealth].Calamity().stealthStrike = true;
return false;
}
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.MythrilBar);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this, 100);
recipe.AddRecipe();
}
}
}