using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class FallenBlast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() => Main.projFrames[Type] = 8; private static float ExplosionRadius = 236f; public override void SetDefaults() { Projectile.width = 472; Projectile.height = 472; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 600; Projectile.timeLeft = 24; } public override void AI() { Projectile.frameCounter++; if (Projectile.frameCounter % 3 == 0) Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; if (Projectile.frame >= 8) Projectile.Kill(); Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2 * 1.5f; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.95f); if (Projectile.damage < 1) Projectile.damage = 1; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); } } }