diff --git a/Projectiles/Magic/PlasmaBolt.cs b/Projectiles/Magic/PlasmaBolt.cs index 600a9f8e2c..e79c64fafe 100644 --- a/Projectiles/Magic/PlasmaBolt.cs +++ b/Projectiles/Magic/PlasmaBolt.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[0] += 1f; if (projectile.ai[0] > 6f) { - for (int num121 = 0; num121 < 5; num121++) + for (int d = 0; d < 5; d++) { Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * (float)num121; + dust.position -= projectile.velocity / 5f * d; dust.noGravity = true; dust.scale = 0.65f; dust.noLight = true; diff --git a/Projectiles/Magic/PlasmaShot.cs b/Projectiles/Magic/PlasmaShot.cs index b92b6586f9..0b20c5cdfa 100644 --- a/Projectiles/Magic/PlasmaShot.cs +++ b/Projectiles/Magic/PlasmaShot.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[0] += 1f; if (projectile.ai[0] > 6f) { - for (int num121 = 0; num121 < 10; num121++) + for (int d = 0; d < 10; d++) { Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * (float)num121; + dust.position -= projectile.velocity / 5f * d; dust.noGravity = true; dust.noLight = true; } @@ -42,15 +42,15 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item14, projectile.position); - int num220 = Main.rand.Next(20, 31); + int cloudAmt = Main.rand.Next(20, 31); if (projectile.owner == Main.myPlayer) { - for (int num221 = 0; num221 < num220; num221++) + for (int i = 0; i < cloudAmt; i++) { - Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value17.Normalize(); - value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, 511 + Main.rand.Next(3), projectile.damage, 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); + Projectile cloud = Projectile.NewProjectileDirect(projectile.Center, velocity, ProjectileID.ToxicCloud + Main.rand.Next(3), projectile.damage, 1f, projectile.owner, 0f, Main.rand.Next(-45, 1)); + cloud.usesIDStaticNPCImmunity = true; + cloud.idStaticNPCHitCooldown = 10; } } for (int k = 0; k < 5; k++) diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index 32ac41b268..d61ebad5c5 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -39,9 +39,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int index = 0; index < cloudAmt; index++) { - Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - velocity.Normalize(); - velocity *= (float)Main.rand.Next(10, 201) * 0.01f; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, projectile.knockBack * 0.5f, projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); } }