using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class AegisBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.timeLeft = 120; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Melee; } public override void AI() { Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0f); Projectile.rotation += 1f; Projectile.alpha -= 25; if (Projectile.alpha < 0) { Projectile.alpha = 0; } if (Projectile.localAI[0] == 0f) { SoundEngine.PlaySound(SoundID.Item73, Projectile.position); Projectile.localAI[0] += 1f; } int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += Projectile.velocity * 0.1f; } public override void Kill(int timeLeft) { 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); Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); for (int d = 0; d <= 30; d++) { float num463 = (float)Main.rand.Next(-10, 11); float num464 = (float)Main.rand.Next(-10, 11); float speed = (float)Main.rand.Next(3, 9); float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); num466 = speed / num466; num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); Dust dust = Main.dust[num467]; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; dust.velocity.Y = num464; } int flameAmt = Main.rand.Next(2, 4); if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < flameAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f); } } } } }