using CalamityMod.Dusts; using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { public class SeethingDischargeBrimstoneHellblast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; private bool initialized = false; public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellblast"; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { Projectile.width = 40; Projectile.height = 40; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = 4; Projectile.timeLeft = 255; Projectile.alpha = 0; } public override void AI() { if (!initialized) { if (Projectile.npcProj) { Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 5; Projectile.penetrate = 10; } initialized = true; } Projectile.frameCounter++; if (Projectile.frameCounter >= 10) { Projectile.frame++; Projectile.frameCounter = 0; } if (Projectile.frame >= 4) { Projectile.frame = 0; } Projectile.alpha += 1; Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0f); if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } Projectile.velocity.X *= 1.03f; Projectile.velocity.Y *= 1.03f; 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); } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override Color? GetAlpha(Color lightColor) { return new Color(250, 50, 50, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int dust = 0; dust <= 5; dust++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); } } } }