56 lines
2.0 KiB
C#
56 lines
2.0 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 IceStar : RogueWeapon
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Ice Star");
|
|
Tooltip.SetDefault("Throws homing ice stars\n" +
|
|
"Stealth strikes pierce infinitely and spawn ice shards on hit\n" +
|
|
"Ice Stars are too brittle to be recovered after being thrown");
|
|
}
|
|
|
|
public override void SafeSetDefaults()
|
|
{
|
|
item.damage = 45;
|
|
item.noMelee = true;
|
|
item.consumable = true;
|
|
item.noUseGraphic = true;
|
|
item.useAnimation = 12;
|
|
item.useStyle = ItemUseStyleID.SwingThrow;
|
|
item.useTime = 12;
|
|
item.knockBack = 2.5f;
|
|
item.UseSound = SoundID.Item1;
|
|
item.autoReuse = true;
|
|
item.width = item.height = 66;
|
|
item.maxStack = 999;
|
|
item.value = Item.buyPrice(0, 0, 5, 0);
|
|
item.rare = ItemRarityID.Pink;
|
|
item.shoot = ModContent.ProjectileType<IceStarProjectile>();
|
|
item.shootSpeed = 14f;
|
|
item.Calamity().rogue = true;
|
|
}
|
|
|
|
// Terraria seems to really dislike high crit values in SetDefaults
|
|
public override void GetWeaponCrit(Player player, ref int crit) => crit += 7;
|
|
|
|
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 proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
|
|
if (proj.WithinBounds(Main.maxProjectiles))
|
|
Main.projectile[proj].Calamity().stealthStrike = true;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|