Files
CalamityModPublic/Projectiles/Melee/LightningThing.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

43 lines
1.4 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items.Weapons.Melee;
namespace CalamityMod.Projectiles.Melee
{
public class LightningThing : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Lightning");
}
public override void SetDefaults()
{
projectile.width = 2;
projectile.height = 2;
projectile.friendly = true;
projectile.timeLeft = 90;
projectile.melee = true;
}
public override void Kill(int timeLeft)
{
int damage = (int)(GaelsGreatsword.BaseDamage * Main.player[projectile.owner].MeleeDamage());
for (int i = 0; i < 3; i++)
{
int idx = Projectile.NewProjectile(projectile.Center + new Vector2(Main.rand.NextFloat(-35f, 35f), -1600f), Vector2.UnitY * 12f,
ProjectileID.CultistBossLightningOrbArc, damage, 0f, projectile.owner,
MathHelper.PiOver2, Main.rand.Next(100));
if (idx.WithinBounds(Main.maxProjectiles))
{
Main.projectile[idx].Calamity().forceMelee = true;
Main.projectile[idx].usesLocalNPCImmunity = true;
Main.projectile[idx].localNPCHitCooldown = GaelsGreatsword.ImmunityFrames;
}
}
}
}
}