Files
CalamityModPublic/Items/Weapons/Rogue/IceStar.cs
T
termigator1359 bc20d3dc6b Fixed those stupid potential out of bounds errors,.,.,.,.........
Also fixed a few other bugs like with Web Balls, Jaws of Oblivion, Dune Hopper, Cobalt Kunai, Frostcrush Valari, Plaguenades, and Time Bolt
2020-12-11 16:17:45 -05:00

55 lines
1.9 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.width = 62;
item.damage = 45;
item.noMelee = true;
item.consumable = true;
item.noUseGraphic = true;
item.useAnimation = 12;
item.crit = 7;
item.useStyle = ItemUseStyleID.SwingThrow;
item.useTime = 12;
item.knockBack = 2.5f;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.height = 62;
item.maxStack = 999;
item.value = Item.buyPrice(0, 0, 5, 0);
item.rare = 5;
item.shoot = ModContent.ProjectileType<IceStarProjectile>();
item.shootSpeed = 14f;
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 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;
}
}
}