using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class Shockblast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.timeLeft = 10; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 15; } public override void AI() { Lighting.AddLight(Projectile.Center, 0f, 0f, 0.25f); float num461 = 25f; if (Projectile.ai[0] > 180f) { num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; Projectile.Kill(); } num461 *= 0.7f; Projectile.ai[0] += 4f; int num462 = 0; while (num462 < num461) { float sizeMultiplier = (Projectile.ai[1] * 0.5f) + 1f; float num463 = Main.rand.Next(-10, 11) * sizeMultiplier; float num464 = Main.rand.Next(-10, 11) * sizeMultiplier; float num465 = Main.rand.Next(3, 9) * sizeMultiplier; float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 185); Dust dust = Main.dust[num467]; dust.scale = sizeMultiplier; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; dust.position.X += Main.rand.Next(-10, 11); dust.position.Y += Main.rand.Next(-10, 11); dust.velocity.X = num463; dust.velocity.Y = num464; num462++; } } } }