using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { public class FlameLickedHellblast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellblast"; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { Projectile.width = 40; Projectile.height = 40; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = 5; Projectile.timeLeft = 255; Projectile.localNPCHitCooldown = -1; Projectile.usesLocalNPCImmunity = true; } public override void AI() { Projectile.frameCounter++; if (Projectile.frameCounter >= 10) { Projectile.frame++; Projectile.frameCounter = 0; } if (Projectile.frame > 3) Projectile.frame = 0; Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); if (Projectile.timeLeft < 51) Projectile.Opacity -= 0.02f; if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } if (Projectile.velocity.Length() < 18f) Projectile.velocity *= 1.03f; if (Projectile.velocity.X < 0f) { Projectile.spriteDirection = -1; Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); } else { Projectile.spriteDirection = 1; Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } } public override bool PreDraw(ref Color lightColor) { lightColor.R = (byte)(255 * Projectile.Opacity); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (target.creativeGodMode) return; target.AddBuff(ModContent.BuffType(), 90); } public override bool? CanDamage() => Projectile.timeLeft >= 51; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 90); } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); for (int dust = 0; dust <= 5; dust++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); } } } }