using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TemporalFloeNumberTwo : ModProjectile { public override string Texture => "CalamityMod/Projectiles/Melee/TemporalFloeSwordProjectile"; public override void SetStaticDefaults() { DisplayName.SetDefault("Floe"); } public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.aiStyle = 27; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = -1; Projectile.timeLeft = 60; Projectile.coldDamage = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.tileCollide = false; } public override void AI() { Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); if (Main.rand.NextBool(2)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, 0f, 0f); } } public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } public override Color? GetAlpha(Color lightColor) { return new Color(50, 50, 255, Projectile.alpha); } public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int num795 = 0; num795 < 27; num795++) { float num796 = Projectile.oldVelocity.X * (30f / (float)num795); float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Dust dust = Main.dust[num798]; dust.noGravity = true; dust.velocity *= 0.5f; num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust.velocity *= 0.05f; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 30); target.AddBuff(BuffID.Frostburn, 120); } } }