using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class PlaguedFuelPackCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetDefaults() { Projectile.width = 28; Projectile.height = 24; Projectile.friendly = true; Projectile.alpha = 0; Projectile.penetrate = -1; Projectile.tileCollide = true; Projectile.ignoreWater = true; Projectile.timeLeft = 100; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { if (Projectile.timeLeft < 50) Projectile.alpha += 5; if (Projectile.timeLeft < 75) Projectile.velocity *= 0.95f; if (Main.rand.NextBool(150)) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 240); public override void Kill(int timeLeft) { if (timeLeft != 0) { for (int i = 0; i < 5; i++) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; } } } } }