Files
CalamityModPublic/Projectiles/Rogue/BileExplosion.cs
T
DominicKarma42 55e89c9b98 Replaced (hopefully) every magic number with a constant
Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
2020-05-30 17:56:36 -04:00

59 lines
1.9 KiB
C#

using CalamityMod.Dusts;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class BileExplosion : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Bile");
}
public override void SetDefaults()
{
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
projectile.timeLeft = 60;
projectile.Calamity().rogue = true;
}
public override void AI()
{
//projectile.ai[0] == 1f means spawned by Skyfin Bombers SS
projectile.position = projectile.Center;
if (projectile.Calamity().stealthStrike || projectile.ai[0] == 1f)
projectile.width = projectile.height = 120;
else
projectile.width = projectile.height = 70;
projectile.position -= projectile.Size / 2f;
for (int i = 0; i < 15; i++)
{
Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid);
dust.velocity = projectile.width / 33.333f * Vector2.One.RotatedByRandom(MathHelper.TwoPi);
dust.scale = projectile.width == 120 ? 3.1f : 2.2f;
dust.noGravity = true;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (projectile.ai[0] != 1f)
{
target.immune[projectile.owner] = 9;
}
target.AddBuff(ModContent.BuffType<Irradiated>(), 180);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 180);
}
}
}