using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class AstrageldonLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 3; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; Projectile.minion = true; Projectile.ignoreWater = true; Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -2; Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Summon; } public override void AI() { Projectile.frameCounter++; if (Projectile.frameCounter > 4) { Projectile.frame++; Projectile.frameCounter = 0; } if (Projectile.frame >= 3) { Projectile.frame = 0; } if (Projectile.ai[0] == 0f) { Projectile.ai[0] = 1f; SoundEngine.PlaySound(SoundID.Item12, Projectile.position); } if (Projectile.alpha > 0) { Projectile.alpha -= 25; } if (Projectile.alpha < 0) { Projectile.alpha = 0; } Projectile.rotation = Projectile.velocity.ToRotation(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 120); } public override Color? GetAlpha(Color lightColor) { return new Color(255, 255, 255, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } }