using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DoGFire : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Death Fire"); Main.projFrames[projectile.type] = 6; ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { projectile.Calamity().canBreakPlayerDefense = true; projectile.width = 34; projectile.height = 34; projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.alpha = 255; projectile.extraUpdates = 1; projectile.penetrate = -1; projectile.timeLeft = 480; cooldownSlot = 1; projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { if (projectile.localAI[0] == 0f && projectile.ai[1] == 0f) { projectile.localAI[0] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); } projectile.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame > 5) projectile.frame = 0; if (projectile.alpha > 0) projectile.alpha -= 25; if (projectile.alpha < 0) projectile.alpha = 0; int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 173, projectile.velocity.X, projectile.velocity.Y, 100, default, 0.8f); Main.dust[dust].noGravity = true; projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; if (projectile.ai[1] > 0f) { if (projectile.velocity.Length() < projectile.ai[1]) projectile.velocity *= projectile.ai[0]; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 240); } public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item74, (int)projectile.Center.X, (int)projectile.Center.Y); projectile.position = projectile.Center; projectile.width = projectile.height = 64; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 10; num623++) { int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } projectile.Damage(); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } } }