using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class AcidicSaxMist : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { Projectile.width = 30; Projectile.height = 30; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } public override void AI() { Projectile.frameCounter++; if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } if (Projectile.frame > 9) { Projectile.frame = 0; } if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item111, Projectile.position); } if (Projectile.velocity.X < 0f) { Projectile.spriteDirection = -1; Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { Projectile.spriteDirection = 1; Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 90f) { if (Projectile.alpha < 255) { Projectile.alpha += 5; if (Projectile.alpha > 255) { Projectile.alpha = 255; Projectile.Kill(); } } } else if (Projectile.alpha > 80) { Projectile.alpha -= 30; if (Projectile.alpha < 80) { Projectile.alpha = 80; } } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Venom, 180); } } }