Files
CalamityModPublic/Items/Weapons/Rogue/TheReaper.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

61 lines
2.1 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 TheReaper : RogueWeapon
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Reaper");
Tooltip.SetDefault("Slice 'n dice\n" +
"Stealth strikes throw four at once");
}
public override void SafeSetDefaults()
{
item.width = 80;
item.damage = 150;
item.noMelee = true;
item.noUseGraphic = true;
item.useAnimation = 22;
item.useTime = 22;
item.useStyle = ItemUseStyleID.SwingThrow;
item.knockBack = 4f;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.height = 64;
item.value = Item.buyPrice(1, 40, 0, 0);
item.rare = 10;
item.shoot = ModContent.ProjectileType<ReaperProjectile>();
item.shootSpeed = 20f;
item.Calamity().rogue = true;
item.Calamity().customRarity = CalamityRarity.RareVariant;
}
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()) //setting the stealth strike
{
int spread = 10;
for (int i = 0; i < 4; i++)
{
Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread));
int proj = Projectile.NewProjectile(position, perturbedspeed, type, damage / 2, knockBack, player.whoAmI);
if (proj.WithinBounds(Main.maxProjectiles))
{
Main.projectile[proj].Calamity().stealthStrike = true;
Main.projectile[proj].penetrate = 6;
}
spread -= Main.rand.Next(5,8);
}
return false;
}
return true;
}
}
}