using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class IceBomb : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Bomb"); } public override void SetDefaults() { projectile.width = 30; projectile.height = 30; projectile.hostile = true; projectile.penetrate = 1; projectile.timeLeft = 300; } public override void AI() { projectile.velocity *= 0.99f; if (projectile.localAI[0] == 0f) { projectile.scale += 0.01f; projectile.alpha -= 50; if (projectile.alpha <= 0) { projectile.localAI[0] = 1f; projectile.alpha = 0; } } else { projectile.scale -= 0.01f; projectile.alpha += 50; if (projectile.alpha >= 255) { projectile.localAI[0] = 0f; projectile.alpha = 255; } } } public override Color? GetAlpha(Color lightColor) { return Main.dayTime ? new Color(50, 50, 255, projectile.alpha) : new Color(255, 255, 255, projectile.alpha); } public override void Kill(int timeLeft) { Lighting.AddLight((int)((projectile.position.X + (projectile.width / 2)) / 16f), (int)((projectile.position.Y + (projectile.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); Main.PlaySound(SoundID.Item27, projectile.position); float spread = 60f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; if (projectile.owner == Main.myPlayer) { for (i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); } } for (int k = 0; k < 3; k++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(BuffID.Frostburn, 120, true); target.AddBuff(BuffID.Chilled, 90, true); target.AddBuff(ModContent.BuffType(), 60); } } }