using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SphereBlue : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; Projectile.extraUpdates = 1; } public override void AI() { Lighting.AddLight(Projectile.Center, 0f, 0f, 1f); if (Main.rand.NextBool(5)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); } Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 5f) { Projectile.tileCollide = true; } Projectile.rotation += Projectile.velocity.X * 0.02f; Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; Projectile.velocity.X = Projectile.velocity.X * 0.99f; CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); } public override void Kill(int timeLeft) { Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 192; 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.NPCDeath37, Projectile.position); if (Main.netMode != NetmodeID.Server) { for (int num625 = 0; num625 < 3; num625++) { float scaleFactor10 = 0.33f; if (num625 == 1) { scaleFactor10 = 0.66f; } if (num625 == 2) { scaleFactor10 = 1f; } int defectiveBruh = Gore.NewGore(Projectile.GetSource_Death(), new Vector2(Projectile.position.X + (float)(Projectile.width / 2) - 24f, Projectile.position.Y + (float)(Projectile.height / 2) - 24f), default, Main.rand.Next(660, 662), 1f); Main.gore[defectiveBruh].velocity *= scaleFactor10; Main.gore[defectiveBruh].velocity += Projectile.velocity; } } for (int num194 = 0; num194 < 25; num194++) { int dustType = Utils.SelectRandom(Main.rand, new int[] { 226, 229 }); int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 0f; } } public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } }