69 lines
2.3 KiB
C#
69 lines
2.3 KiB
C#
using Terraria.DataStructures;
|
|
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Rogue;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Rogue
|
|
{
|
|
public class FeatherKnife : RogueWeapon
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Item.ResearchUnlockCount = 99;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 18;
|
|
Item.height = 32;
|
|
Item.noMelee = true;
|
|
Item.noUseGraphic = true;
|
|
|
|
Item.damage = 16;
|
|
Item.useAnimation = Item.useTime = 20;
|
|
Item.knockBack = 2f;
|
|
Item.autoReuse = true;
|
|
Item.consumable = true;
|
|
Item.useStyle = ItemUseStyleID.Swing;
|
|
Item.UseSound = SoundID.Item1;
|
|
Item.maxStack = 9999;
|
|
Item.shoot = ModContent.ProjectileType<FeatherKnifeProjectile>();
|
|
Item.shootSpeed = 25f;
|
|
Item.DamageType = RogueDamageClass.Instance;
|
|
|
|
Item.value = Item.sellPrice(copper: 60);
|
|
Item.rare = ItemRarityID.Orange;
|
|
}
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike
|
|
{
|
|
int spread = 6;
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread));
|
|
int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI);
|
|
if (proj.WithinBounds(Main.maxProjectiles))
|
|
Main.projectile[proj].Calamity().stealthStrike = true;
|
|
|
|
spread -= Main.rand.Next(2, 6);
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe(100).
|
|
AddIngredient<AerialiteBar>().
|
|
AddTile(TileID.SkyMill).
|
|
Register();
|
|
}
|
|
}
|
|
}
|