using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class EventHorizonBlackhole : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public int killCounter = 21; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { Projectile.width = 40; Projectile.height = 40; Projectile.friendly = true; Projectile.penetrate = 3; Projectile.timeLeft = 90; Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; } public override bool? CanHitNPC(NPC target) { if (Projectile.timeLeft < 60) return false; return null; } public override void AI() { if (Projectile.frame == 8) return; // Update animation Projectile.frameCounter++; if (Projectile.frameCounter > 5) { Projectile.frame++; Projectile.frameCounter = 0; } if (Projectile.timeLeft > 15) { if (Projectile.frame >= 4) Projectile.frame = 0; } else { if (Projectile.frame < 4) Projectile.frame = 4; if (Projectile.frame >= 8) Projectile.frame = 4; } } public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } }