diff --git a/Projectiles/Magic/AbyssBall.cs b/Projectiles/Magic/AbyssBall.cs index f233bc9fdb..be7d0bb39e 100644 --- a/Projectiles/Magic/AbyssBall.cs +++ b/Projectiles/Magic/AbyssBall.cs @@ -42,23 +42,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int num621 = 0; num621 < 30; num621++) + for (int i = 0; i < 30; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int abyssal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[abyssal].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[abyssal].scale = 0.5f; + Main.dust[abyssal].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 60; num623++) + for (int j = 0; j < 60; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int abyssal2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); + Main.dust[abyssal2].noGravity = true; + Main.dust[abyssal2].velocity *= 5f; + abyssal2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[abyssal2].velocity *= 2f; } } } diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs index 0d2cbd1a27..bbe7b4eae8 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -50,11 +50,11 @@ namespace CalamityMod.Projectiles.Magic if (counter >= 120f) { counter = 0f; - Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; + Vector2 mistRandDirection = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + mistRandDirection.Normalize(); + mistRandDirection *= (float)Main.rand.Next(50, 401) * 0.01f; int damage = (int)Main.player[Projectile.owner].GetTotalDamage().ApplyTo(BelchingSaxophone.BaseDamage); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), damage, 1f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, mistRandDirection.X, mistRandDirection.Y, ModContent.ProjectileType(), damage, 1f, Projectile.owner, 0f, 0f); } else counter += 1f; @@ -64,10 +64,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[1] += 1f; if (Projectile.ai[1] >= 6f) { - int num982 = 20; if (Projectile.alpha > 0) { - Projectile.alpha -= num982; + Projectile.alpha -= 20; } if (Projectile.alpha < 80) { @@ -129,9 +128,9 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -152,17 +151,17 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); - int num3; - for (int num246 = 0; num246 < 25; num246 = num3 + 1) + int inc; + for (int i = 0; i < 25; i = inc + 1) { - int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 0, default, 1f); - Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; - Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - Main.dust[num247].velocity.Normalize(); - Dust dust = Main.dust[num247]; + int toxicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 0, default, 1f); + Main.dust[toxicDust].position = (Main.dust[toxicDust].position + Projectile.position) / 2f; + Main.dust[toxicDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[toxicDust].velocity.Normalize(); + Dust dust = Main.dust[toxicDust]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = Projectile.alpha; - num3 = num246; + Main.dust[toxicDust].alpha = Projectile.alpha; + inc = i; } Projectile.maxPenetrate = -1; Projectile.penetrate = -1; diff --git a/Projectiles/Magic/AquamarineBolt.cs b/Projectiles/Magic/AquamarineBolt.cs index e3744e47fb..2d4c0481b6 100644 --- a/Projectiles/Magic/AquamarineBolt.cs +++ b/Projectiles/Magic/AquamarineBolt.cs @@ -26,17 +26,15 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - int num154 = 14; - int num155 = Dust.NewDust(Projectile.Center, Projectile.width - num154 * 2, Projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1.5f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; + int aquaDust = Dust.NewDust(Projectile.Center, Projectile.width - 28, Projectile.height - 28, 68, 0f, 0f, 100, default, 1.5f); + Main.dust[aquaDust].noGravity = true; + Main.dust[aquaDust].velocity *= 0.1f; + Main.dust[aquaDust].velocity += Projectile.velocity * 0.5f; if (Main.rand.NextBool(16)) { - int num156 = 16; - int num157 = Dust.NewDust(Projectile.Center, Projectile.width - num156 * 2, Projectile.height - num156 * 2, 68, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; + int aquaticDust = Dust.NewDust(Projectile.Center, Projectile.width - 32, Projectile.height - 32, 68, 0f, 0f, 100, default, 1f); + Main.dust[aquaticDust].velocity *= 0.25f; + Main.dust[aquaticDust].velocity += Projectile.velocity * 0.5f; } Projectile.rotation += 0.3f * (float)Projectile.direction; } diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 86230b40c3..18011bb5ab 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -38,26 +38,24 @@ namespace CalamityMod.Projectiles.Magic Projectile.scale = Projectile.ai[1]; Projectile.rotation += Projectile.velocity.X * 2f; Vector2 position = Projectile.Center + Vector2.Normalize(Projectile.velocity) * 10f; - Dust dust20 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f)]; - dust20.position = position; - dust20.velocity = Projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; - dust20.position += Projectile.velocity.RotatedBy(1.5707963705062866, default); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - dust20 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f)]; - dust20.position = position; - dust20.velocity = Projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; - dust20.position += Projectile.velocity.RotatedBy(-1.5707963705062866, default); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - for (int num189 = 0; num189 < 1; num189++) - { - int num190 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f); - Main.dust[num190].velocity *= 0.5f; - Main.dust[num190].scale *= 1.3f; - Main.dust[num190].fadeIn = 1f; - Main.dust[num190].noGravity = true; - } + Dust greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f)]; + greenDust.position = position; + greenDust.velocity = Projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; + greenDust.position += Projectile.velocity.RotatedBy(1.5707963705062866, default); + greenDust.fadeIn = 0.5f; + greenDust.noGravity = true; + greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f)]; + greenDust.position = position; + greenDust.velocity = Projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; + greenDust.position += Projectile.velocity.RotatedBy(-1.5707963705062866, default); + greenDust.fadeIn = 0.5f; + greenDust.noGravity = true; + + int moreGreen = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f); + Main.dust[moreGreen].velocity *= 0.5f; + Main.dust[moreGreen].scale *= 1.3f; + Main.dust[moreGreen].fadeIn = 1f; + Main.dust[moreGreen].noGravity = true; } public override void OnKill(int timeLeft) @@ -69,25 +67,25 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = (int)(128f * Projectile.scale); Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num336 = 0; num336 < 4; num336++) + for (int i = 0; i < 4; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); } - for (int num337 = 0; num337 < 16; num337++) + for (int j = 0; j < 16; j++) { - int num338 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 2.5f); - Main.dust[num338].noGravity = true; - Main.dust[num338].velocity *= 3f; - num338 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 1.5f); - Main.dust[num338].velocity *= 2f; - Main.dust[num338].noGravity = true; + int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 2.5f); + Main.dust[killDust].noGravity = true; + Main.dust[killDust].velocity *= 3f; + killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 1.5f); + Main.dust[killDust].velocity *= 2f; + Main.dust[killDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) { - for (int num339 = 0; num339 < 2; num339++) + for (int k = 0; k < 2; k++) { - int num340 = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position + new Vector2((float)(Projectile.width * Main.rand.Next(100)) / 100f, (float)(Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num340]; + int gored = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position + new Vector2((float)(Projectile.width * Main.rand.Next(100)) / 100f, (float)(Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[gored]; gore.velocity *= 0.3f; gore.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; @@ -99,18 +97,18 @@ namespace CalamityMod.Projectiles.Magic Projectile.maxPenetrate = 0; Projectile.Damage(); } - for (int num341 = 0; num341 < 5; num341++) + for (int l = 0; l < 5; l++) { - int num342 = Utils.SelectRandom(Main.rand, new int[] + int dustType = Utils.SelectRandom(Main.rand, new int[] { 107, 259, 158 }); - int num343 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num342, 2.5f * (float)Projectile.direction, -2.5f, 0, default, 1f); - Main.dust[num343].alpha = 200; - Main.dust[num343].velocity *= 2.4f; - Main.dust[num343].scale += Main.rand.NextFloat(); + int exploding = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 2.5f * (float)Projectile.direction, -2.5f, 0, default, 1f); + Main.dust[exploding].alpha = 200; + Main.dust[exploding].velocity *= 2.4f; + Main.dust[exploding].scale += Main.rand.NextFloat(); } } diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index 0177e8edc7..8046e5fdf2 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -39,26 +39,24 @@ namespace CalamityMod.Projectiles.Magic Projectile.scale = Projectile.ai[1]; Projectile.rotation += Projectile.velocity.X * 2f; Vector2 position = Projectile.Center + Vector2.Normalize(Projectile.velocity) * 10f; - Dust dust20 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; - dust20.position = position; - dust20.velocity = Projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; - dust20.position += Projectile.velocity.RotatedBy(1.5707963705062866, default); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - dust20 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; - dust20.position = position; - dust20.velocity = Projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; - dust20.position += Projectile.velocity.RotatedBy(-1.5707963705062866, default); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - for (int num189 = 0; num189 < 1; num189++) - { - int num190 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); - Main.dust[num190].velocity *= 0.5f; - Main.dust[num190].scale *= 1.3f; - Main.dust[num190].fadeIn = 1f; - Main.dust[num190].noGravity = true; - } + Dust flaming = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + flaming.position = position; + flaming.velocity = Projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; + flaming.position += Projectile.velocity.RotatedBy(1.5707963705062866, default); + flaming.fadeIn = 0.5f; + flaming.noGravity = true; + flaming = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + flaming.position = position; + flaming.velocity = Projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; + flaming.position += Projectile.velocity.RotatedBy(-1.5707963705062866, default); + flaming.fadeIn = 0.5f; + flaming.noGravity = true; + + int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); + Main.dust[fiery].velocity *= 0.5f; + Main.dust[fiery].scale *= 1.3f; + Main.dust[fiery].fadeIn = 1f; + Main.dust[fiery].noGravity = true; } public override void OnKill(int timeLeft) @@ -70,25 +68,25 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = (int)(128f * Projectile.scale); Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num336 = 0; num336 < 8; num336++) + for (int i = 0; i < 8; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); } - for (int num337 = 0; num337 < 32; num337++) + for (int j = 0; j < 32; j++) { - int num338 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); - Main.dust[num338].noGravity = true; - Main.dust[num338].velocity *= 3f; - num338 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); - Main.dust[num338].velocity *= 2f; - Main.dust[num338].noGravity = true; + int killFire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); + Main.dust[killFire].noGravity = true; + Main.dust[killFire].velocity *= 3f; + killFire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); + Main.dust[killFire].velocity *= 2f; + Main.dust[killFire].noGravity = true; } if (Main.netMode != NetmodeID.Server) { - for (int num339 = 0; num339 < 2; num339++) + for (int k = 0; k < 2; k++) { - int num340 = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position + new Vector2((float)(Projectile.width * Main.rand.Next(100)) / 100f, (float)(Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num340]; + int gored = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position + new Vector2((float)(Projectile.width * Main.rand.Next(100)) / 100f, (float)(Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[gored]; gore.velocity *= 0.3f; gore.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; @@ -100,18 +98,18 @@ namespace CalamityMod.Projectiles.Magic Projectile.maxPenetrate = 0; Projectile.Damage(); } - for (int num341 = 0; num341 < 5; num341++) + for (int l = 0; l < 5; l++) { - int num342 = Utils.SelectRandom(Main.rand, new int[] + int dustType = Utils.SelectRandom(Main.rand, new int[] { 244, 259, 158 }); - int num343 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num342, 2.5f * (float)Projectile.direction, -2.5f, 0, new Color(255, Main.DiscoG, 0), 1f); - Main.dust[num343].alpha = 200; - Main.dust[num343].velocity *= 2.4f; - Main.dust[num343].scale += Main.rand.NextFloat(); + int exploding = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 2.5f * (float)Projectile.direction, -2.5f, 0, new Color(255, Main.DiscoG, 0), 1f); + Main.dust[exploding].alpha = 200; + Main.dust[exploding].velocity *= 2.4f; + Main.dust[exploding].scale += Main.rand.NextFloat(); } } diff --git a/Projectiles/Magic/BeastScythe.cs b/Projectiles/Magic/BeastScythe.cs index 0d91011c7a..bcbf924648 100644 --- a/Projectiles/Magic/BeastScythe.cs +++ b/Projectiles/Magic/BeastScythe.cs @@ -60,70 +60,69 @@ namespace CalamityMod.Projectiles.Magic { if (Main.player[Projectile.owner].channel) { - float num115 = 20f; + float projDelay = 20f; Vector2 vector10 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; + float projXDirection = (float)Main.mouseX + Main.screenPosition.X - vector10.X; + float projYDirection = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; if (Main.player[Projectile.owner].gravDir == -1f) { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; + projYDirection = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; } - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (num118 > num115) + float projDistance = (float)Math.Sqrt((double)(projXDirection * projXDirection + projYDirection * projYDirection)); + projDistance = (float)Math.Sqrt((double)(projXDirection * projXDirection + projYDirection * projYDirection)); + if (projDistance > projDelay) { - num118 = num115 / num118; - num116 *= num118; - num117 *= num118; - int num119 = (int)(num116 * 1000f); - int num120 = (int)(Projectile.velocity.X * 1000f); - int num121 = (int)(num117 * 1000f); - int num122 = (int)(Projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) + projDistance = projDelay / projDistance; + projXDirection *= projDistance; + projYDirection *= projDistance; + int projXSpeed = (int)(projXDirection * 1000f); + int projXSpeedMagnified = (int)(Projectile.velocity.X * 1000f); + int projYSpeed = (int)(projYDirection * 1000f); + int projYSpeedMagnified = (int)(Projectile.velocity.Y * 1000f); + if (projXSpeed != projXSpeedMagnified || projYSpeed != projYSpeedMagnified) { Projectile.netUpdate = true; } - Projectile.velocity.X = num116; - Projectile.velocity.Y = num117; + Projectile.velocity.X = projXDirection; + Projectile.velocity.Y = projYDirection; } else { - int num123 = (int)(num116 * 1000f); - int num124 = (int)(Projectile.velocity.X * 1000f); - int num125 = (int)(num117 * 1000f); - int num126 = (int)(Projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) + int projXSpeedElse = (int)(projXDirection * 1000f); + int projXSpeedMagnifiedElse = (int)(Projectile.velocity.X * 1000f); + int projYSpeedElse = (int)(projYDirection * 1000f); + int projYSpeedMagnifiedElse = (int)(Projectile.velocity.Y * 1000f); + if (projXSpeedElse != projXSpeedMagnifiedElse || projYSpeedElse != projYSpeedMagnifiedElse) { Projectile.netUpdate = true; } - Projectile.velocity.X = num116; - Projectile.velocity.Y = num117; + Projectile.velocity.X = projXDirection; + Projectile.velocity.Y = projYDirection; } } else { Projectile.netUpdate = true; - float num127 = 20f; - Vector2 vector11 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float projXDir = (float)Main.mouseX + Main.screenPosition.X - projDirection.X; + float projYDir = (float)Main.mouseY + Main.screenPosition.Y - projDirection.Y; if (Main.player[Projectile.owner].gravDir == -1f) { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + projYDir = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projDirection.Y; } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || Projectile.ai[0] < 0f) + float projDistancing = (float)Math.Sqrt((double)(projXDir * projXDir + projYDir * projYDir)); + if (projDistancing == 0f || Projectile.ai[0] < 0f) { - vector11 = new Vector2(Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2), Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2)); - num128 = Projectile.position.X + (float)Projectile.width * 0.5f - vector11.X; - num129 = Projectile.position.Y + (float)Projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + projDirection = new Vector2(Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2), Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2)); + projXDir = Projectile.position.X + (float)Projectile.width * 0.5f - projDirection.X; + projYDir = Projectile.position.Y + (float)Projectile.height * 0.5f - projDirection.Y; + projDistancing = (float)Math.Sqrt((double)(projXDir * projXDir + projYDir * projYDir)); } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - Projectile.velocity.X = num128; - Projectile.velocity.Y = num129; + projDistancing = 20f / projDistancing; + projXDir *= projDistancing; + projYDir *= projDistancing; + Projectile.velocity.X = projXDir; + Projectile.velocity.Y = projYDir; } } if (Projectile.ai[0] >= 30f) @@ -147,26 +146,26 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; Projectile.damage /= 2; Projectile.Damage(); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) + int beastial = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 2.5f); + Main.dust[beastial].noGravity = true; + Main.dust[beastial].velocity *= 3f; + if (isInTile) { - Main.dust[num10].noLight = true; + Main.dust[beastial].noLight = true; } - num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) + beastial = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Main.dust[beastial].velocity *= 2f; + Main.dust[beastial].noGravity = true; + if (isInTile) { - Main.dust[num10].noLight = true; + Main.dust[beastial].noLight = true; } } } diff --git a/Projectiles/Magic/BigBeamofDeath.cs b/Projectiles/Magic/BigBeamofDeath.cs index cb3ab8efb0..c56ea64535 100644 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ b/Projectiles/Magic/BigBeamofDeath.cs @@ -41,11 +41,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 3f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * 0.25f; + int beamDust = Dust.NewDust(projPos, 1, 1, 206, 0f, 0f, 0, default, 3f); + Main.dust[beamDust].position = projPos; + Main.dust[beamDust].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/BigBeamofDeath2.cs b/Projectiles/Magic/BigBeamofDeath2.cs index bd60986769..0670ca4928 100644 --- a/Projectiles/Magic/BigBeamofDeath2.cs +++ b/Projectiles/Magic/BigBeamofDeath2.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 3f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * 0.25f; + int beamDust = Dust.NewDust(projPos, 1, 1, 206, 0f, 0f, 0, default, 3f); + Main.dust[beamDust].position = projPos; + Main.dust[beamDust].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/BlackAnurianBubble.cs b/Projectiles/Magic/BlackAnurianBubble.cs index efff9c9206..e7357805fb 100644 --- a/Projectiles/Magic/BlackAnurianBubble.cs +++ b/Projectiles/Magic/BlackAnurianBubble.cs @@ -63,17 +63,17 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item54, Projectile.position); - int num3; - for (int num246 = 0; num246 < 25; num246 = num3 + 1) + int inc; + for (int i = 0; i < 25; i = inc + 1) { - int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); - Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; - Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - Main.dust[num247].velocity.Normalize(); - Dust dust = Main.dust[num247]; + int blackDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); + Main.dust[blackDust].position = (Main.dust[blackDust].position + Projectile.position) / 2f; + Main.dust[blackDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[blackDust].velocity.Normalize(); + Dust dust = Main.dust[blackDust]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = Projectile.alpha; - num3 = num246; + Main.dust[blackDust].alpha = Projectile.alpha; + inc = i; } } } diff --git a/Projectiles/Magic/BlackAnurianPlankton.cs b/Projectiles/Magic/BlackAnurianPlankton.cs index 6120d9cb76..e60b867d46 100644 --- a/Projectiles/Magic/BlackAnurianPlankton.cs +++ b/Projectiles/Magic/BlackAnurianPlankton.cs @@ -49,76 +49,75 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; } Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - float num373 = Projectile.position.X; - float num374 = Projectile.position.Y; - float num375 = 100000f; - bool flag10 = false; + float projX = Projectile.position.X; + float projY = Projectile.position.Y; + float homingRange = 100000f; + bool isHoming = false; Projectile.ai[0] += 1f; if (Projectile.ai[0] > 30f) { Projectile.ai[0] = 30f; - for (int num376 = 0; num376 < Main.maxNPCs; num376++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num376].CanBeChasedBy(Projectile, false) && !Main.npc[num376].wet) + if (Main.npc[i].CanBeChasedBy(Projectile, false) && !Main.npc[i].wet) { - float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); - float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); - float num379 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num377) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) + float npcX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float npcY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); + if (npcDist < 800f && npcDist < homingRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; + homingRange = npcDist; + projX = npcX; + projY = npcY; + isHoming = true; } } } } - if (!flag10) + if (!isHoming) { - num373 = Projectile.position.X + (float)(Projectile.width / 2) + Projectile.velocity.X * 100f; - num374 = Projectile.position.Y + (float)(Projectile.height / 2) + Projectile.velocity.Y * 100f; + projX = Projectile.position.X + (float)(Projectile.width / 2) + Projectile.velocity.X * 100f; + projY = Projectile.position.Y + (float)(Projectile.height / 2) + Projectile.velocity.Y * 100f; } - float num380 = 6f; - float num381 = 0.1f; - Vector2 vector30 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num382 = num373 - vector30.X; - float num383 = num374 - vector30.Y; - float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); - num384 = num380 / num384; - num382 *= num384; - num383 *= num384; - if (Projectile.velocity.X < num382) + float projVelModifier = 0.1f; + Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float xDest = projX - projDirection.X; + float yDest = projY - projDirection.Y; + float destinationDist = (float)Math.Sqrt((double)(xDest * xDest + yDest * yDest)); + destinationDist = 6f / destinationDist; + xDest *= destinationDist; + yDest *= destinationDist; + if (Projectile.velocity.X < xDest) { - Projectile.velocity.X = Projectile.velocity.X + num381; - if (Projectile.velocity.X < 0f && num382 > 0f) + Projectile.velocity.X = Projectile.velocity.X + projVelModifier; + if (Projectile.velocity.X < 0f && xDest > 0f) { - Projectile.velocity.X = Projectile.velocity.X + num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X + projVelModifier * 2f; } } - else if (Projectile.velocity.X > num382) + else if (Projectile.velocity.X > xDest) { - Projectile.velocity.X = Projectile.velocity.X - num381; - if (Projectile.velocity.X > 0f && num382 < 0f) + Projectile.velocity.X = Projectile.velocity.X - projVelModifier; + if (Projectile.velocity.X > 0f && xDest < 0f) { - Projectile.velocity.X = Projectile.velocity.X - num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X - projVelModifier * 2f; } } - if (Projectile.velocity.Y < num383) + if (Projectile.velocity.Y < yDest) { - Projectile.velocity.Y = Projectile.velocity.Y + num381; - if (Projectile.velocity.Y < 0f && num383 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier; + if (Projectile.velocity.Y < 0f && yDest > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier * 2f; } } - else if (Projectile.velocity.Y > num383) + else if (Projectile.velocity.Y > yDest) { - Projectile.velocity.Y = Projectile.velocity.Y - num381; - if (Projectile.velocity.Y > 0f && num383 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier; + if (Projectile.velocity.Y > 0f && yDest < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier * 2f; } } } diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index 8d0adf5fb2..c7e058c507 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.cs @@ -25,25 +25,25 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(Projectile.Center, 0.5f, 0f, 0f); - for (int num92 = 0; num92 < 2; num92++) + for (int i = 0; i < 2; i++) { - float num93 = Projectile.velocity.X / 3f * (float)num92; - float num94 = Projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, 5, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[num96]; + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int fourConst = 4; + int bloody = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 5, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[bloody]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= num93; - dust.position.Y -= num94; + dust.position.X -= shortXVel; + dust.position.Y -= shortYVel; } if (Main.rand.NextBool(5)) { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num97, Projectile.position.Y + (float)num97), Projectile.width - num97 * 2, Projectile.height - num97 * 2, 5, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += Projectile.velocity * 0.5f; + int otherFourConst = 4; + int graphicContent = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 5, 0f, 0f, 100, default, 0.6f); + Main.dust[graphicContent].velocity *= 0.25f; + Main.dust[graphicContent].velocity += Projectile.velocity * 0.5f; } if (Projectile.ai[1] >= 20f) { diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index 78dfc934b6..342bfd69d2 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -36,13 +36,13 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; Vector2 v2 = Projectile.ai[0].ToRotationVector2(); - float num743 = Projectile.velocity.ToRotation(); - float num744 = v2.ToRotation(); - double num745 = num744 - num743; - if (num745 > MathHelper.Pi) - num745 -= MathHelper.TwoPi; - if (num745 < -MathHelper.Pi) - num745 += MathHelper.TwoPi; + float projRotate = Projectile.velocity.ToRotation(); + float aiRotation = v2.ToRotation(); + double projAngle = aiRotation - projRotate; + if (projAngle > MathHelper.Pi) + projAngle -= MathHelper.TwoPi; + if (projAngle < -MathHelper.Pi) + projAngle += MathHelper.TwoPi; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; @@ -54,12 +54,12 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) + for (int i = 0; i < num190; i++) { - int num192 = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; + int bubbly = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + Main.dust[bubbly].velocity *= 0.8f; + Main.dust[bubbly].position = Vector2.Lerp(Main.dust[bubbly].position, Projectile.Center, 0.5f); + Main.dust[bubbly].noGravity = true; } } } diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index 33ed6e693c..dff62e6cec 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -55,10 +55,10 @@ namespace CalamityMod.Projectiles.Magic Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * Projectile.direction; - int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); + Main.dust[brimDust].noGravity = true; + Main.dust[brimDust].velocity *= 0.5f; + Main.dust[brimDust].velocity += Projectile.velocity * 0.1f; Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); if (Projectile.localAI[0] == 0f) diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs index 08069f6878..3e243f00b8 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -75,17 +75,17 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[1] *= 1.05f; if (Projectile.scale < 1f && Projectile.localAI[1] > 5f) { - int num897 = 0; - while ((float)num897 < Projectile.scale * 10f) + int scaleLoopCheck = 0; + while ((float)scaleLoopCheck < Projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.5f); - Main.dust[num898].position = (Main.dust[num898].position + Projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= Projectile.velocity * (1.3f - Projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + Projectile.owner); - Main.dust[num898].scale += Projectile.scale * 0.75f; - num897++; + int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.5f); + Main.dust[brimDust].position = (Main.dust[brimDust].position + Projectile.Center) / 2f; + Main.dust[brimDust].noGravity = true; + Main.dust[brimDust].velocity *= 0.1f; + Main.dust[brimDust].velocity -= Projectile.velocity * (1.3f - Projectile.scale); + Main.dust[brimDust].fadeIn = (float)(100 + Projectile.owner); + Main.dust[brimDust].scale += Projectile.scale * 0.75f; + scaleLoopCheck++; } } } diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index c4e7558dcc..fac42d9be0 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -63,27 +63,27 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int brightDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.2f); + Main.dust[brightDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[brightDust].scale = 0.5f; + Main.dust[brightDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 30; num623++) + for (int j = 0; j < 30; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int brightDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.7f); + Main.dust[brightDust2].noGravity = true; + Main.dust[brightDust2].velocity *= 5f; + brightDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1f); + Main.dust[brightDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) { - for (int num480 = 0; num480 < 3; num480++) + for (int k = 0; k < 3; k++) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index 7c41edfe75..95d13c8bf5 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * 0.25f; + int boltDust = Dust.NewDust(projPos, 1, 1, 206, 0f, 0f, 0, default, 1.25f); + Main.dust[boltDust].position = projPos; + Main.dust[boltDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[boltDust].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index 76299da1d8..fe5efdc6fc 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -60,8 +60,8 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.timeLeft < 30) { - float num7 = Projectile.timeLeft / 30f; - Projectile.alpha = (int)(255f - 255f * num7); + float alphaTimer = Projectile.timeLeft / 30f; + Projectile.alpha = (int)(255f - 255f * alphaTimer); } return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } @@ -69,9 +69,9 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 58c85e7690..ac18c8d0d9 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -45,12 +45,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); } } - Vector2 center10 = Projectile.Center; + Vector2 projCenter = Projectile.Center; Projectile.scale = 1f - Projectile.localAI[0]; Projectile.width = (int)(20f * Projectile.scale); Projectile.height = Projectile.width; - Projectile.position.X = center10.X - (float)(Projectile.width / 2); - Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); + Projectile.position.X = projCenter.X - (float)(Projectile.width / 2); + Projectile.position.Y = projCenter.Y - (float)(Projectile.height / 2); if (Projectile.localAI[0] < 0.1f) { Projectile.localAI[0] += 0.01f; @@ -74,17 +74,17 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[1] *= 1.05f; if (Projectile.scale < 1f && Projectile.localAI[1] > 5f) { - int num897 = 0; - while ((float)num897 < Projectile.scale * 10f) + int scaleLoopCheck = 0; + while ((float)scaleLoopCheck < Projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + Projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= Projectile.velocity * (1.3f - Projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + Projectile.owner); - Main.dust[num898].scale += Projectile.scale * 0.75f; - num897++; + int purpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + Main.dust[purpleDust].position = (Main.dust[purpleDust].position + Projectile.Center) / 2f; + Main.dust[purpleDust].noGravity = true; + Main.dust[purpleDust].velocity *= 0.1f; + Main.dust[purpleDust].velocity -= Projectile.velocity * (1.3f - Projectile.scale); + Main.dust[purpleDust].fadeIn = (float)(100 + Projectile.owner); + Main.dust[purpleDust].scale += Projectile.scale * 0.75f; + scaleLoopCheck++; } } } diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index ee9196799f..246baa1deb 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2? vector71 = null; + Vector2? chargeUpCenter = null; if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) Projectile.velocity = -Vector2.UnitY; @@ -53,11 +53,11 @@ namespace CalamityMod.Projectiles.Magic } float laserPosition = (int)Projectile.ai[0] - 2.5f; - Vector2 value36 = Vector2.Normalize(Main.projectile[(int)Projectile.ai[1]].velocity); + Vector2 aimDirection = Vector2.Normalize(Main.projectile[(int)Projectile.ai[1]].velocity); Projectile projectile2 = Main.projectile[(int)Projectile.ai[1]]; - float num811; - Vector2 value37 = Vector2.Zero; - float num812; + float laserNormalize; + Vector2 projDirection = Vector2.Zero; + float laserTimer; float y; float laserRotationSpeed; float scaleFactor6; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic if (projectile2.ai[0] < 720f) { - num812 = projectile2.ai[0] / 1440f; + laserTimer = projectile2.ai[0] / 1440f; y = 6f + projectile2.ai[0] / 720f * 7f; if (projectile2.ai[0] > 360f) { @@ -112,20 +112,20 @@ namespace CalamityMod.Projectiles.Magic break; } - num812 = 0.5f; + laserTimer = 0.5f; laserRotationSpeed = 10.875f; y = 13f; scaleFactor6 = -7f; } - float num814 = (projectile2.ai[0] + laserPosition * laserRotationSpeed) / (laserRotationSpeed * 6f) * MathHelper.TwoPi; - num811 = Vector2.UnitY.RotatedBy(num814).Y * (MathHelper.Pi / 6) * num812 * 0.33f; - value37 = (Vector2.UnitY.RotatedBy(num814) * new Vector2(4f, y)).RotatedBy(projectile2.velocity.ToRotation()); - Projectile.position = projectile2.Center + value36 * 16f - Projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)Projectile.ai[1]].gfxOffY); + float laserDirection = (projectile2.ai[0] + laserPosition * laserRotationSpeed) / (laserRotationSpeed * 6f) * MathHelper.TwoPi; + laserNormalize = Vector2.UnitY.RotatedBy(laserDirection).Y * (MathHelper.Pi / 6) * laserTimer * 0.33f; + projDirection = (Vector2.UnitY.RotatedBy(laserDirection) * new Vector2(4f, y)).RotatedBy(projectile2.velocity.ToRotation()); + Projectile.position = projectile2.Center + aimDirection * 16f - Projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)Projectile.ai[1]].gfxOffY); Projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; - Projectile.position += value37; - Projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(num811); - Projectile.scale = 1.5f * (1.5f - num812); + Projectile.position += projDirection; + Projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(laserNormalize); + Projectile.scale = 1.5f * (1.5f - laserTimer); // Takes 360 frames to reach normal damage float amount = projectile2.ai[0] / 1200f; @@ -134,75 +134,71 @@ namespace CalamityMod.Projectiles.Magic Projectile.damage = (int)(projectile2.damage * MathHelper.Lerp(0.25f, 2.2f, amount)); if (projectile2.ai[0] >= 720f) - vector71 = new Vector2?(projectile2.Center); + chargeUpCenter = new Vector2?(projectile2.Center); if (!Collision.CanHitLine(Main.player[Projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) - vector71 = new Vector2?(Main.player[Projectile.owner].Center); + chargeUpCenter = new Vector2?(Main.player[Projectile.owner].Center); if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) Projectile.velocity = -Vector2.UnitY; - float num818 = Projectile.velocity.ToRotation(); - Projectile.rotation = num818 - MathHelper.PiOver2; - Projectile.velocity = num818.ToRotationVector2(); + float laserRotate = Projectile.velocity.ToRotation(); + Projectile.rotation = laserRotate - MathHelper.PiOver2; + Projectile.velocity = laserRotate.ToRotationVector2(); - float num819 = 2f; - float num820 = 0f; Vector2 samplingPoint = Projectile.Center; - if (vector71.HasValue) - samplingPoint = vector71.Value; + if (chargeUpCenter.HasValue) + samplingPoint = chargeUpCenter.Value; - float[] array3 = new float[(int)num819]; - Collision.LaserScan(samplingPoint, Projectile.velocity, num820 * Projectile.scale, 2400f, array3); - float num821 = 0f; - for (int num822 = 0; num822 < array3.Length; num822++) - num821 += array3[num822]; - num821 /= num819; + float[] array3 = new float[2]; + Collision.LaserScan(samplingPoint, Projectile.velocity, 0f * Projectile.scale, 2400f, array3); + float beamSeparation = 0f; + for (int i = 0; i < array3.Length; i++) + beamSeparation += array3[i]; + beamSeparation /= 2f; - float amount2 = 0.75f; - Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num821, amount2); - if (Math.Abs(Projectile.localAI[1] - num821) < 100f && Projectile.scale > 0.15f) + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], beamSeparation, 0.75f); + if (Math.Abs(Projectile.localAI[1] - beamSeparation) < 100f && Projectile.scale > 0.15f) { - Vector2 vector80 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14.5f * Projectile.scale); - for (int num843 = 0; num843 < 2; num843++) + Vector2 dustSpawn = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14.5f * Projectile.scale); + for (int j = 0; j < 2; j++) { - float num844 = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; - float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; - Vector2 vector81 = new Vector2((float)Math.Cos(num844) * num845, (float)Math.Sin(num844) * num845); - int num846 = Dust.NewDust(vector80, 0, 0, 267, vector81.X, vector81.Y, 0, color, 3.3f); - Main.dust[num846].color = color; - Main.dust[num846].scale = 1.2f; + float dustRotate = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustRandom = (float)Main.rand.NextDouble() * 0.8f + 1f; + Vector2 randomRotate = new Vector2((float)Math.Cos(dustRotate) * dustRandom, (float)Math.Sin(dustRotate) * dustRandom); + int rainbowDust = Dust.NewDust(dustSpawn, 0, 0, 267, randomRotate.X, randomRotate.Y, 0, color, 3.3f); + Main.dust[rainbowDust].color = color; + Main.dust[rainbowDust].scale = 1.2f; if (Projectile.scale > 1f) { - Main.dust[num846].velocity *= Projectile.scale; - Main.dust[num846].scale *= Projectile.scale; + Main.dust[rainbowDust].velocity *= Projectile.scale; + Main.dust[rainbowDust].scale *= Projectile.scale; } - Main.dust[num846].noGravity = true; + Main.dust[rainbowDust].noGravity = true; if (Projectile.scale != 1.4f) { - Dust dust9 = Dust.CloneDust(num846); - dust9.color = color; - dust9.scale /= 2f; - dust9.noGravity = true; + Dust rainbowClone = Dust.CloneDust(rainbowDust); + rainbowClone.color = color; + rainbowClone.scale /= 2f; + rainbowClone.noGravity = true; } - Main.dust[num846].color = color; + Main.dust[rainbowDust].color = color; } if (Main.rand.NextBool(5)) { - Vector2 value42 = Projectile.velocity.RotatedBy(MathHelper.PiOver2) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; - int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 267, 0f, 0f, 100, color, 5f); - Main.dust[num847].velocity *= 0.5f; - Main.dust[num847].noGravity = true; - Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); + Vector2 extraDustSpawn = Projectile.velocity.RotatedBy(MathHelper.PiOver2) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; + int extraRainbows = Dust.NewDust(dustSpawn + extraDustSpawn - Vector2.One * 4f, 8, 8, 267, 0f, 0f, 100, color, 5f); + Main.dust[extraRainbows].velocity *= 0.5f; + Main.dust[extraRainbows].noGravity = true; + Main.dust[extraRainbows].velocity.Y = -Math.Abs(Main.dust[extraRainbows].velocity.Y); } DelegateMethods.v3_1 = color.ToVector3() * 0.3f; - float value43 = 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f); Vector2 size = new Vector2(Projectile.velocity.Length() * Projectile.localAI[1], Projectile.width * Projectile.scale); - float num848 = Projectile.velocity.ToRotation(); + float shaderLength = Projectile.velocity.ToRotation(); if (Main.netMode != NetmodeID.Server) - ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(Projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy(num848), color, size, RippleShape.Square, num848); + ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(Projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy(shaderLength), color, size, RippleShape.Square, shaderLength); Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, DelegateMethods.CastLight); } @@ -214,7 +210,7 @@ namespace CalamityMod.Projectiles.Magic return false; Texture2D tex = ModContent.Request(Texture).Value; - float num228 = Projectile.localAI[1]; + float drawArea = Projectile.localAI[1]; Projectile projectile2 = Main.projectile[(int)Projectile.ai[1]]; Color color = new Color(1, 1, 1, 127); if (projectile2.ai[0] < 720f) @@ -259,17 +255,17 @@ namespace CalamityMod.Projectiles.Magic } Color value25 = color; - Vector2 value26 = Projectile.Center.Floor(); - value26 += Projectile.velocity * Projectile.scale * 10.5f; - num228 -= Projectile.scale * 14.5f * Projectile.scale; - Vector2 vector29 = new Vector2(Projectile.scale); + Vector2 drawStart = Projectile.Center.Floor(); + drawStart += Projectile.velocity * Projectile.scale * 10.5f; + drawArea -= Projectile.scale * 14.5f * Projectile.scale; + Vector2 drawScale = new Vector2(Projectile.scale); DelegateMethods.f_1 = 1f; DelegateMethods.c_1 = value25 * 0.75f * Projectile.Opacity; Vector2 projPos = Projectile.oldPos[0]; projPos = new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + Projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + Utils.DrawLaser(Main.spriteBatch, tex, drawStart - Main.screenPosition, drawStart + Projectile.velocity * drawArea - Main.screenPosition, drawScale, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); DelegateMethods.c_1 = color * 0.75f * Projectile.Opacity; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + Projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + Utils.DrawLaser(Main.spriteBatch, tex, drawStart - Main.screenPosition, drawStart + Projectile.velocity * drawArea - Main.screenPosition, drawScale / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); return false; } @@ -285,8 +281,7 @@ namespace CalamityMod.Projectiles.Magic if (projHitbox.Intersects(targetHitbox)) return true; - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref num6)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref 0f)) return true; return false; diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index 63057334fa..47c4b5985e 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -47,17 +47,17 @@ namespace CalamityMod.Projectiles.Magic { Player player = Main.player[Projectile.owner]; - float num = 0f; + float piConditional = 0f; if (Projectile.spriteDirection == -1) - num = MathHelper.Pi; + piConditional = MathHelper.Pi; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter); + Vector2 playerRotation = player.RotatedRelativePoint(player.MountedCenter); - float num26 = 30f; + float hitCooldown = 30f; if (Projectile.ai[0] > 360f) - num26 = 15f; + hitCooldown = 15f; if (Projectile.ai[0] > 480f) - num26 = 5f; + hitCooldown = 5f; Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); @@ -73,44 +73,43 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.localAI[1] > 0f) Projectile.localAI[1] -= 1f; - bool flag9 = false; - if (Projectile.ai[0] % num26 == 0f) - flag9 = true; + bool shouldHitNotCharged = false; + if (Projectile.ai[0] % hitCooldown == 0f) + shouldHitNotCharged = true; - int num27 = 10; - bool flag10 = false; - if (Projectile.ai[0] % num26 == 0f) - flag10 = true; + bool shouldHitChargedUp = false; + if (Projectile.ai[0] % hitCooldown == 0f) + shouldHitChargedUp = true; if (Projectile.ai[1] >= 1f) { Projectile.ai[1] = 0f; - flag10 = true; + shouldHitChargedUp = true; if (Main.myPlayer == Projectile.owner) { float scaleFactor5 = player.ActiveItem().shootSpeed * Projectile.scale; - Vector2 value12 = vector; - Vector2 value13 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - value12; + Vector2 projRotation = playerRotation; + Vector2 gravityAdjustedRotation = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - projRotation; if (player.gravDir == -1f) - value13.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - value12.Y; + gravityAdjustedRotation.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - projRotation.Y; - Vector2 vector11 = Vector2.Normalize(value13); - if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) - vector11 = -Vector2.UnitY; + Vector2 prismDirection = Vector2.Normalize(gravityAdjustedRotation); + if (float.IsNaN(prismDirection.X) || float.IsNaN(prismDirection.Y)) + prismDirection = -Vector2.UnitY; - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(Projectile.velocity), 0.92f)); - vector11 *= scaleFactor5; - if (vector11.X != Projectile.velocity.X || vector11.Y != Projectile.velocity.Y) + prismDirection = Vector2.Normalize(Vector2.Lerp(prismDirection, Vector2.Normalize(Projectile.velocity), 0.92f)); + prismDirection *= scaleFactor5; + if (prismDirection.X != Projectile.velocity.X || prismDirection.Y != Projectile.velocity.Y) Projectile.netUpdate = true; - Projectile.velocity = vector11; + Projectile.velocity = prismDirection; } } Projectile.frameCounter++; - int num28 = (Projectile.ai[0] < 480f) ? 3 : 1; - if (Projectile.frameCounter >= num28) + int framing = (Projectile.ai[0] < 480f) ? 3 : 1; + if (Projectile.frameCounter >= framing) { Projectile.frameCounter = 0; if (++Projectile.frame >= 4) @@ -118,28 +117,27 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.soundDelay <= 0) { - Projectile.soundDelay = num27; + Projectile.soundDelay = 10; Projectile.soundDelay *= 2; if (Projectile.ai[0] != 1f) SoundEngine.PlaySound(SoundID.Item15, Projectile.position); } - if (flag10 && Main.myPlayer == Projectile.owner) + if (shouldHitChargedUp && Main.myPlayer == Projectile.owner) { - bool flag11 = !flag9 || player.CheckMana(player.ActiveItem(), -1, true, false); - bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; - if (flag12) + bool hasMana = !shouldHitNotCharged || player.CheckMana(player.ActiveItem(), -1, true, false); + bool canUseItem = player.channel && hasMana && !player.noItems && !player.CCed; + if (canUseItem) { if (Projectile.ai[0] == 1f) { - Vector2 center3 = Projectile.Center; - Vector2 vector12 = Vector2.Normalize(Projectile.velocity); - if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) - vector12 = -Vector2.UnitY; + Vector2 projCenter = Projectile.Center; + Vector2 beamDirection = Vector2.Normalize(Projectile.velocity); + if (float.IsNaN(beamDirection.X) || float.IsNaN(beamDirection.Y)) + beamDirection = -Vector2.UnitY; - int num29 = Projectile.damage; for (int l = 0; l < 7; l++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), center3, vector12, ModContent.ProjectileType(), num29, Projectile.knockBack, Projectile.owner, l, Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), projCenter, beamDirection, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, l, Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI)); Projectile.netUpdate = true; } @@ -149,7 +147,7 @@ namespace CalamityMod.Projectiles.Magic } Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.rotation = Projectile.velocity.ToRotation() + piConditional; Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; player.ChangeDir(Projectile.direction); @@ -162,10 +160,10 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Color prismColorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + prismColorArea = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); } SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) @@ -173,38 +171,38 @@ namespace CalamityMod.Projectiles.Magic spriteEffects = SpriteEffects.FlipHorizontally; } Texture2D texture2D14 = ModContent.Request(Texture).Value; - int num215 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y7 = num215 * Projectile.frame; - Vector2 vector27 = (Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition).Floor(); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y7 = framing * Projectile.frame; + Vector2 drawStart = (Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition).Floor(); if (Main.player[Projectile.owner].shroomiteStealth && Main.player[Projectile.owner].inventory[Main.player[Projectile.owner].selectedItem].CountsAsClass()) { - float num216 = Main.player[Projectile.owner].stealth; - if ((double)num216 < 0.03) + float playerStealth = Main.player[Projectile.owner].stealth; + if ((double)playerStealth < 0.03) { - num216 = 0.03f; + playerStealth = 0.03f; } - float arg_97B3_0 = (1f + num216 * 10f) / 11f; - color25 *= num216; + float arg_97B3_0 = (1f + playerStealth * 10f) / 11f; + prismColorArea *= playerStealth; } if (Main.player[Projectile.owner].setVortex && Main.player[Projectile.owner].inventory[Main.player[Projectile.owner].selectedItem].CountsAsClass()) { - float num217 = Main.player[Projectile.owner].stealth; - if ((double)num217 < 0.03) + float playerStealthAgain = Main.player[Projectile.owner].stealth; + if ((double)playerStealthAgain < 0.03) { - num217 = 0.03f; + playerStealthAgain = 0.03f; } - float arg_9854_0 = (1f + num217 * 10f) / 11f; - color25 = color25.MultiplyRGBA(new Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); + float arg_9854_0 = (1f + playerStealthAgain * 10f) / 11f; + prismColorArea = prismColorArea.MultiplyRGBA(new Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - playerStealthAgain))); } - Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y7, texture2D14.Width, num215)), Projectile.GetAlpha(color25), Projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), Projectile.scale, spriteEffects, 0); + Main.spriteBatch.Draw(texture2D14, drawStart, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y7, texture2D14.Width, framing)), Projectile.GetAlpha(prismColorArea), Projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (Projectile.ai[0] / 120f))) * 2f + 2f; if (Projectile.ai[0] > 480f) { scaleFactor2 = 4f; } - for (float num218 = 0f; num218 < 4f; num218 += 1f) + for (float i = 0f; i < 4f; i += 1f) { - Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y7, texture2D14.Width, num215)), Projectile.GetAlpha(color25).MultiplyRGBA(new Color(255, 255, 255, 0)) * 0.03f, Projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), Projectile.scale, spriteEffects, 0); + Main.spriteBatch.Draw(texture2D14, drawStart + Vector2.UnitY.RotatedBy((double)(i * 6.28318548f / 4f), default) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y7, texture2D14.Width, framing)), Projectile.GetAlpha(prismColorArea).MultiplyRGBA(new Color(255, 255, 255, 0)) * 0.03f, Projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); } return false; } diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index c93a3dbb21..37658c254d 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -32,9 +32,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float num953 = 25f * Projectile.ai[1]; //100 - float scaleFactor12 = 5f * Projectile.ai[1]; //5 - float num954 = 1000f; + float aiVelocityMult = 25f * Projectile.ai[1]; //100 + float scaleFactor = 5f * Projectile.ai[1]; //5 + float homingRange = 1000f; if (Projectile.velocity.X < 0f) { @@ -50,10 +50,10 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f); if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingRange) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Projectile.velocity = (Projectile.velocity * (aiVelocityMult - 1f) + moveDirection * scaleFactor) / aiVelocityMult; return; } @@ -90,18 +90,18 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - for (int num193 = 0; num193 < 6; num193++) + for (int i = 0; i < 6; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); } - for (int num194 = 0; num194 < 10; num194++) + for (int j = 0; j < 10; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int divinity = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); + Main.dust[divinity].noGravity = true; + Main.dust[divinity].velocity *= 3f; + divinity = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); + Main.dust[divinity].velocity *= 2f; + Main.dust[divinity].noGravity = true; } } } diff --git a/Projectiles/Magic/EldritchTentacle.cs b/Projectiles/Magic/EldritchTentacle.cs index 765a05643b..33e69041c7 100644 --- a/Projectiles/Magic/EldritchTentacle.cs +++ b/Projectiles/Magic/EldritchTentacle.cs @@ -43,12 +43,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); } } - Vector2 center10 = Projectile.Center; + Vector2 projCenter = Projectile.Center; Projectile.scale = 1f - Projectile.localAI[0]; Projectile.width = (int)(20f * Projectile.scale); Projectile.height = Projectile.width; - Projectile.position.X = center10.X - (float)(Projectile.width / 2); - Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); + Projectile.position.X = projCenter.X - (float)(Projectile.width / 2); + Projectile.position.Y = projCenter.Y - (float)(Projectile.height / 2); if ((double)Projectile.localAI[0] < 0.1) { Projectile.localAI[0] += 0.01f; @@ -72,17 +72,17 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[1] *= 1.05f; if (Projectile.scale < 1f) { - int num897 = 0; - while ((float)num897 < Projectile.scale * 10f) + int scaleLoopCheck = 0; + while ((float)scaleLoopCheck < Projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + Projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= Projectile.velocity * (1.3f - Projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + Projectile.owner); - Main.dust[num898].scale += Projectile.scale * 0.75f; - num897++; + int eldritchRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + Main.dust[eldritchRed].position = (Main.dust[eldritchRed].position + Projectile.Center) / 2f; + Main.dust[eldritchRed].noGravity = true; + Main.dust[eldritchRed].velocity *= 0.1f; + Main.dust[eldritchRed].velocity -= Projectile.velocity * (1.3f - Projectile.scale); + Main.dust[eldritchRed].fadeIn = (float)(100 + Projectile.owner); + Main.dust[eldritchRed].scale += Projectile.scale * 0.75f; + scaleLoopCheck++; } } } diff --git a/Projectiles/Magic/ElementTentacle.cs b/Projectiles/Magic/ElementTentacle.cs index 09856a2bff..76ba460e0c 100644 --- a/Projectiles/Magic/ElementTentacle.cs +++ b/Projectiles/Magic/ElementTentacle.cs @@ -46,12 +46,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); } } - Vector2 center10 = Projectile.Center; + Vector2 projCenter = Projectile.Center; Projectile.scale = 1f - Projectile.localAI[0]; Projectile.width = (int)(20f * Projectile.scale); Projectile.height = Projectile.width; - Projectile.position.X = center10.X - (float)(Projectile.width / 2); - Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); + Projectile.position.X = projCenter.X - (float)(Projectile.width / 2); + Projectile.position.Y = projCenter.Y - (float)(Projectile.height / 2); if ((double)Projectile.localAI[0] < 0.1) { Projectile.localAI[0] += 0.01f; @@ -75,16 +75,16 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[1] *= 1.05f; if (Projectile.scale < 1f) { - int num897 = 0; - while ((float)num897 < Projectile.scale * 10f) + int scaleLoopCheck = 0; + while ((float)scaleLoopCheck < Projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + Projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= Projectile.velocity * (1.3f - Projectile.scale); - Main.dust[num898].scale += Projectile.scale * 0.75f; - num897++; + int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); + Main.dust[rainbow].position = (Main.dust[rainbow].position + Projectile.Center) / 2f; + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].velocity *= 0.1f; + Main.dust[rainbow].velocity -= Projectile.velocity * (1.3f - Projectile.scale); + Main.dust[rainbow].scale += Projectile.scale * 0.75f; + scaleLoopCheck++; } } } diff --git a/Projectiles/Magic/EvergladeSprayProjectile.cs b/Projectiles/Magic/EvergladeSprayProjectile.cs index 81212fa2c0..8d3992e0a8 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -38,23 +38,23 @@ namespace CalamityMod.Projectiles.Magic return; } Projectile.velocity.Y = Projectile.velocity.Y + 0.075f; - for (int num151 = 0; num151 < 3; num151++) + for (int i = 0; i < 3; i++) { - float num152 = Projectile.velocity.X / 3f * (float)num151; - float num153 = Projectile.velocity.Y / 3f * (float)num151; - int num155 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 157, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num155]; + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int natureDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 157, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[natureDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.5f; - dust.position.X -= num152; - dust.position.Y -= num153; + dust.position.X -= shortXVel; + dust.position.Y -= shortYVel; } if (Main.rand.NextBool(8)) { - int num157 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 157, 0f, 0f, 100, default, 0.5f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; + int natual = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 157, 0f, 0f, 100, default, 0.5f); + Main.dust[natual].velocity *= 0.25f; + Main.dust[natual].velocity += Projectile.velocity * 0.5f; } } diff --git a/Projectiles/Magic/FatesRevealFlame.cs b/Projectiles/Magic/FatesRevealFlame.cs index 4bfcd0d590..b3e94ed397 100644 --- a/Projectiles/Magic/FatesRevealFlame.cs +++ b/Projectiles/Magic/FatesRevealFlame.cs @@ -28,9 +28,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float num949 = 10f; - float scaleFactor11 = 15f; - float num950 = 160f; + float scaleFactor = 15f; if (Projectile.timeLeft > 30 && Projectile.alpha > 0) { Projectile.alpha -= 25; @@ -43,46 +41,45 @@ namespace CalamityMod.Projectiles.Magic { Projectile.alpha = 0; } - int num3 = Projectile.frameCounter + 1; - Projectile.frameCounter = num3; - if (num3 > 4) + int inc = Projectile.frameCounter + 1; + Projectile.frameCounter = inc; + if (inc > 4) { Projectile.frameCounter = 0; - num3 = Projectile.frame + 1; - Projectile.frame = num3; - if (num3 >= 4) + inc = Projectile.frame + 1; + Projectile.frame = inc; + if (inc >= 4) { Projectile.frame = 0; } } - float num951 = 0.5f; + float dustScale = 0.5f; if (Projectile.timeLeft < 120) { - num951 = 1.1f; + dustScale = 1.1f; } if (Projectile.timeLeft < 60) { - num951 = 1.6f; + dustScale = 1.6f; } float[] var_2_2A211_cp_0 = Projectile.ai; int var_2_2A211_cp_1 = 1; - float num73 = var_2_2A211_cp_0[var_2_2A211_cp_1]; - var_2_2A211_cp_0[var_2_2A211_cp_1] = num73 + 1f; - float num952 = Projectile.ai[1] / 180f * 6.28318548f; - for (float num953 = 0f; num953 < 3f; num953 = num73 + 1f) + float dustIncr = var_2_2A211_cp_0[var_2_2A211_cp_1]; + var_2_2A211_cp_0[var_2_2A211_cp_1] = dustIncr + 1f; + for (float j = 0f; j < 3f; j = dustIncr + 1f) { if (Main.rand.Next(3) != 0) { return; } - Dust dust13 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, -2f, 0, default, 1f)]; - dust13.position = Projectile.Center + Vector2.UnitY.RotatedBy((double)(num953 * 6.28318548f / 3f + Projectile.ai[1]), default) * 10f; - dust13.noGravity = true; - dust13.velocity = Projectile.DirectionFrom(dust13.position); - dust13.scale = num951; - dust13.fadeIn = 0.5f; - dust13.alpha = 200; - num73 = num953; + Dust fateful = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, -2f, 0, default, 1f)]; + fateful.position = Projectile.Center + Vector2.UnitY.RotatedBy((double)(j * 6.28318548f / 3f + Projectile.ai[1]), default) * 10f; + fateful.noGravity = true; + fateful.velocity = Projectile.DirectionFrom(fateful.position); + fateful.scale = dustScale; + fateful.fadeIn = 0.5f; + fateful.alpha = 200; + dustIncr = j; } if (Projectile.timeLeft < 4) { @@ -91,22 +88,22 @@ namespace CalamityMod.Projectiles.Magic Projectile.Center = Projectile.position; // Ozzatron 15FEB2021 -- What the actual fuck is this // projectile.damage = 800; - for (int num955 = 0; num955 < 10; num955 = num3 + 1) + for (int i = 0; i < 10; i = inc + 1) { - Dust dust13 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, -2f, 0, default, 1f)]; - dust13.noGravity = true; - if (dust13.position != Projectile.Center) - dust13.velocity = Projectile.SafeDirectionTo(dust13.position) * 3f; + Dust fateful = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, -2f, 0, default, 1f)]; + fateful.noGravity = true; + if (fateful.position != Projectile.Center) + fateful.velocity = Projectile.SafeDirectionTo(fateful.position) * 3f; - num3 = num955; + inc = i; } } if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > num950) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > 160f) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (num949 - 1f) + moveDirection * scaleFactor11) / num949; + Projectile.velocity = (Projectile.velocity * 9f + moveDirection * scaleFactor) / 10f; } } else @@ -122,8 +119,8 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.timeLeft < 30) { - float num4 = (float)Projectile.timeLeft / 30f; - Projectile.alpha = (int)(255f - 255f * num4); + float aboutToDieAlpha = (float)Projectile.timeLeft / 30f; + Projectile.alpha = (int)(255f - 255f * aboutToDieAlpha); } return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 128 - Projectile.alpha / 2); } @@ -143,30 +140,30 @@ namespace CalamityMod.Projectiles.Magic Projectile.Damage(); // Dust code - int num3; - for (int num122 = 0; num122 < 3; num122 = num3 + 1) + int inc; + for (int i = 0; i < 3; i = inc + 1) { - int num123 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num123].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - num3 = num122; + int redFate = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[redFate].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + inc = i; } - for (int num124 = 0; num124 < 10; num124 = num3 + 1) + for (int j = 0; j < 10; j = inc + 1) { - int num125 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); - Main.dust[num125].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num125].noGravity = true; - Dust dust = Main.dust[num125]; + int redFate2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); + Main.dust[redFate2].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[redFate2].noGravity = true; + Dust dust = Main.dust[redFate2]; dust.velocity *= 2f; - num3 = num124; + inc = j; } - for (int num126 = 0; num126 < 5; num126 = num3 + 1) + for (int k = 0; k < 5; k = inc + 1) { - int num127 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1.5f); - Main.dust[num127].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; - Main.dust[num127].noGravity = true; - Dust dust = Main.dust[num127]; + int redFate3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1.5f); + Main.dust[redFate3].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; + Main.dust[redFate3].noGravity = true; + Dust dust = Main.dust[redFate3]; dust.velocity *= 2f; - num3 = num126; + inc = k; } } } diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index 2fb1353dc1..9b0232fb20 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -37,23 +37,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.45f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.1f / 255f); - for (int num92 = 0; num92 < 2; num92++) + for (int i = 0; i < 2; i++) { - float num93 = Projectile.velocity.X / 3f * (float)num92; - float num94 = Projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int fourConst = 4; + int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 174, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[fireDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= num93; - dust.position.Y -= num94; + dust.position.X -= shortXVel; + dust.position.Y -= shortYVel; } if (Main.rand.NextBool(10)) { - int num97 = 4; - int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)num97, Projectile.position.Y + (float)num97), Projectile.width - num97 * 2, Projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); + int otherFourConst = 4; + int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 174, 0f, 0f, 100, default, 0.6f); Main.dust[fireDustSmol].velocity *= 0.25f; Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; } diff --git a/Projectiles/Magic/ForbiddenSunProjectile.cs b/Projectiles/Magic/ForbiddenSunProjectile.cs index c2fe1d1929..6f673e29b3 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -48,9 +48,9 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(4)) { - int num469 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int forbid = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); + Main.dust[forbid].noGravity = true; + Main.dust[forbid].velocity *= 0f; } } diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index 1930749d84..5db1149a09 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -38,38 +38,38 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.localAI[0] += 1f; } - float num461 = 25f; + float projTimer = 25f; if (Projectile.ai[0] > 180f) { - num461 -= (Projectile.ai[0] - 180f) / 2f; + projTimer -= (Projectile.ai[0] - 180f) / 2f; } - if (num461 <= 0f) + if (projTimer <= 0f) { - num461 = 0f; + projTimer = 0f; Projectile.Kill(); } - num461 *= 0.7f; + projTimer *= 0.7f; Projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) + int timerCounter = 0; + while ((float)timerCounter < projTimer) { - float num463 = (float)Main.rand.Next(-25, 26); - float num464 = (float)Main.rand.Next(-25, 26); - float num465 = (float)Main.rand.Next(9, 24); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 2.5f); - Dust dust = Main.dust[num467]; + float rando1 = (float)Main.rand.Next(-25, 26); + float rando2 = (float)Main.rand.Next(-25, 26); + float rando3 = (float)Main.rand.Next(9, 24); + float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjuster = rando3 / randoAdjuster; + rando1 *= randoAdjuster; + rando2 *= randoAdjuster; + int orngDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 2.5f); + Dust dust = Main.dust[orngDust]; 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; - num462++; + dust.velocity.X = rando1; + dust.velocity.Y = rando2; + timerCounter++; } } diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index eb61c29906..8949b8a4b5 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -37,43 +37,43 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - for (int num92 = 0; num92 < 2; num92++) + for (int i = 0; i < 2; i++) { - float num93 = Projectile.velocity.X / 3f * (float)num92; - float num94 = Projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int fourConst = 4; + int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 174, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[fireDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= num93; - dust.position.Y -= num94; + dust.position.X -= shortXVel; + dust.position.Y -= shortYVel; } if (Main.rand.NextBool(10)) { - int num97 = 4; - int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)num97, Projectile.position.Y + (float)num97), Projectile.width - num97 * 2, Projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); + int otherFourConst = 4; + int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 174, 0f, 0f, 100, default, 0.6f); Main.dust[fireDustSmol].velocity *= 0.25f; Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; } - for (int num105 = 0; num105 < 2; num105++) + for (int j = 0; j < 2; j++) { - float num99 = Projectile.velocity.X / 3f * (float)num105; - float num100 = Projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + float shortyX = Projectile.velocity.X / 3f * (float)j; + float shortyY = Projectile.velocity.Y / 3f * (float)j; + int itsAFour = 4; + int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)itsAFour, Projectile.position.Y + (float)itsAFour), Projectile.width - itsAFour * 2, Projectile.height - itsAFour * 2, 92, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[frostDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= num99; - dust.position.Y -= num100; + dust.position.X -= shortyX; + dust.position.Y -= shortyY; } if (Main.rand.NextBool(10)) { - int num103 = 4; - int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)num103, Projectile.position.Y + (float)num103), Projectile.width - num103 * 2, Projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + int itsStillAFour = 4; + int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)itsStillAFour, Projectile.position.Y + (float)itsStillAFour), Projectile.width - itsStillAFour * 2, Projectile.height - itsStillAFour * 2, 92, 0f, 0f, 100, default, 0.6f); Main.dust[frostDustSmol].velocity *= 0.25f; Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index 908408dd8a..3c0d3e3678 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -38,23 +38,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.45f / 255f); - for (int num105 = 0; num105 < 2; num105++) + for (int i = 0; i < 2; i++) { - float num99 = Projectile.velocity.X / 3f * (float)num105; - float num100 = Projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int fourConst = 4; + int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 92, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[frostDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= num99; - dust.position.Y -= num100; + dust.position.X -= shortXVel; + dust.position.Y -= shortYVel; } if (Main.rand.NextBool(10)) { - int num103 = 4; - int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)num103, Projectile.position.Y + (float)num103), Projectile.width - num103 * 2, Projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + int otherFourConst = 4; + int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 92, 0f, 0f, 100, default, 0.6f); Main.dust[frostDustSmol].velocity *= 0.25f; Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; } diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index 0cec3b9bf0..e14eaeca67 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -59,24 +59,24 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool()) { Vector2 vector140 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust28 = Main.dust[Dust.NewDust(Projectile.Center - vector140 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; - dust28.noGravity = true; - dust28.position = Projectile.Center - vector140 * Main.rand.Next(10, 21); - dust28.velocity = vector140.RotatedBy(MathHelper.PiOver2) * 6f; - dust28.scale = 0.5f + Main.rand.NextFloat(); - dust28.fadeIn = 0.5f; - dust28.customData = Projectile; + Dust ghostlyRed = Main.dust[Dust.NewDust(Projectile.Center - vector140 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + ghostlyRed.noGravity = true; + ghostlyRed.position = Projectile.Center - vector140 * Main.rand.Next(10, 21); + ghostlyRed.velocity = vector140.RotatedBy(MathHelper.PiOver2) * 6f; + ghostlyRed.scale = 0.5f + Main.rand.NextFloat(); + ghostlyRed.fadeIn = 0.5f; + ghostlyRed.customData = Projectile; } else { Vector2 vector141 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust29 = Main.dust[Dust.NewDust(Projectile.Center - vector141 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; - dust29.noGravity = true; - dust29.position = Projectile.Center - vector141 * 30f; - dust29.velocity = vector141.RotatedBy(-MathHelper.PiOver2) * 3f; - dust29.scale = 0.5f + Main.rand.NextFloat(); - dust29.fadeIn = 0.5f; - dust29.customData = Projectile; + Dust ghostlyRedder = Main.dust[Dust.NewDust(Projectile.Center - vector141 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + ghostlyRedder.noGravity = true; + ghostlyRedder.position = Projectile.Center - vector141 * 30f; + ghostlyRedder.velocity = vector141.RotatedBy(-MathHelper.PiOver2) * 3f; + ghostlyRedder.scale = 0.5f + Main.rand.NextFloat(); + ghostlyRedder.fadeIn = 0.5f; + ghostlyRedder.customData = Projectile; } } @@ -108,106 +108,107 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation -= 0.104719758f; // Excessively complicated dust - int num3; - for (int num1014 = 0; num1014 < 1; num1014 = num3 + 1) + int inc; + for (int i = 0; i < 1; i = inc + 1) { if (Main.rand.NextBool()) { - Vector2 vector142 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust30 = Main.dust[Dust.NewDust(Projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; - dust30.noGravity = true; - dust30.position = Projectile.Center - vector142 * Main.rand.Next(10, 21); - dust30.velocity = vector142.RotatedBy(MathHelper.PiOver2) * 6f; - dust30.scale = 0.9f + Main.rand.NextFloat(); - dust30.fadeIn = 0.5f; - dust30.customData = Projectile; - vector142 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - dust30.noGravity = true; - dust30.position = Projectile.Center - vector142 * Main.rand.Next(10, 21); - dust30.velocity = vector142.RotatedBy(MathHelper.PiOver2) * 6f; - dust30.scale = 0.9f + Main.rand.NextFloat(); - dust30.fadeIn = 0.5f; - dust30.customData = Projectile; - dust30.color = Color.Crimson; + Vector2 dustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust complexDust = Main.dust[Dust.NewDust(Projectile.Center - dustRotate * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + complexDust.noGravity = true; + complexDust.position = Projectile.Center - dustRotate * Main.rand.Next(10, 21); + complexDust.velocity = dustRotate.RotatedBy(MathHelper.PiOver2) * 6f; + complexDust.scale = 0.9f + Main.rand.NextFloat(); + complexDust.fadeIn = 0.5f; + complexDust.customData = Projectile; + dustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + complexDust.noGravity = true; + complexDust.position = Projectile.Center - dustRotate * Main.rand.Next(10, 21); + complexDust.velocity = dustRotate.RotatedBy(MathHelper.PiOver2) * 6f; + complexDust.scale = 0.9f + Main.rand.NextFloat(); + complexDust.fadeIn = 0.5f; + complexDust.customData = Projectile; + complexDust.color = Color.Crimson; } else { - Vector2 vector143 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust31 = Main.dust[Dust.NewDust(Projectile.Center - vector143 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; - dust31.noGravity = true; - dust31.position = Projectile.Center - vector143 * Main.rand.Next(20, 31); - dust31.velocity = vector143.RotatedBy(-MathHelper.PiOver2) * 5f; - dust31.scale = 0.9f + Main.rand.NextFloat(); - dust31.fadeIn = 0.5f; - dust31.customData = Projectile; + Vector2 moreDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust complicatedDust = Main.dust[Dust.NewDust(Projectile.Center - moreDustRotate * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + complicatedDust.noGravity = true; + complicatedDust.position = Projectile.Center - moreDustRotate * Main.rand.Next(20, 31); + complicatedDust.velocity = moreDustRotate.RotatedBy(-MathHelper.PiOver2) * 5f; + complicatedDust.scale = 0.9f + Main.rand.NextFloat(); + complicatedDust.fadeIn = 0.5f; + complicatedDust.customData = Projectile; } - num3 = num1014; + inc = i; } // Every so many frames, spawn a sub blast. if (Projectile.ai[0] % 30f == 0f && Projectile.ai[0] < 241f && Main.myPlayer == Projectile.owner) { - Vector2 vector144 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 12f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector144.X, vector144.Y, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, Projectile.whoAmI); + Vector2 randomSubBlastOffset = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, randomSubBlastOffset.X, randomSubBlastOffset.Y, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, Projectile.whoAmI); } // Undocumented, unrefactored homing. Will not home through walls. // Apparently has two different homing distances. - Vector2 vector145 = Projectile.Center; - float num1015 = 500f; - bool flag59 = false; - int num1016 = 0; + // ^ See, this is why num variables are EVIL.... -CIT + Vector2 projCenter = Projectile.Center; + float homingRange = 500f; + bool isHoming = false; + int npcTracker = 0; if (Projectile.ai[1] == 0f) { - for (int num1017 = 0; num1017 < Main.maxNPCs; num1017 = num3 + 1) + for (int i = 0; i < Main.maxNPCs; i = inc + 1) { - if (Main.npc[num1017].CanBeChasedBy(Projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { - Vector2 center13 = Main.npc[num1017].Center; - if (Projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(Projectile.position.X + (float)(Projectile.width / 2), Projectile.position.Y + (float)(Projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) + Vector2 npcCenter = Main.npc[i].Center; + if (Projectile.Distance(npcCenter) < homingRange && Collision.CanHit(new Vector2(Projectile.position.X + (float)(Projectile.width / 2), Projectile.position.Y + (float)(Projectile.height / 2)), 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) { - num1015 = Projectile.Distance(center13); - vector145 = center13; - flag59 = true; - num1016 = num1017; + homingRange = Projectile.Distance(npcCenter); + projCenter = npcCenter; + isHoming = true; + npcTracker = i; } } - num3 = num1017; + inc = i; } - if (flag59) + if (isHoming) { - if (Projectile.ai[1] != (float)(num1016 + 1)) + if (Projectile.ai[1] != (float)(npcTracker + 1)) { Projectile.netUpdate = true; } - Projectile.ai[1] = (float)(num1016 + 1); + Projectile.ai[1] = (float)(npcTracker + 1); } - flag59 = false; + isHoming = false; } if (Projectile.ai[1] != 0f) { - int num1018 = (int)(Projectile.ai[1] - 1f); - if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(Projectile, true) && Projectile.Distance(Main.npc[num1018].Center) < 1000f) + int target = (int)(Projectile.ai[1] - 1f); + if (Main.npc[target].active && Main.npc[target].CanBeChasedBy(Projectile, true) && Projectile.Distance(Main.npc[target].Center) < 1000f) { - flag59 = true; - vector145 = Main.npc[num1018].Center; + isHoming = true; + projCenter = Main.npc[target].Center; } } if (!Projectile.friendly) { - flag59 = false; + isHoming = false; } if (Projectile.localAI[0] < 60f) { Projectile.localAI[0] += 1f; } - if (flag59 && Projectile.localAI[0] >= 60f) + if (isHoming && Projectile.localAI[0] >= 60f) { float HomingVelocity = 24f; int HomingN = 8; - Vector2 vector146 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float dx = vector145.X - vector146.X; - float dy = vector145.Y - vector146.Y; + Vector2 projDistance = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float dx = projCenter.X - projDistance.X; + float dy = projCenter.Y - projDistance.Y; float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy)); dist = HomingVelocity / dist; dx *= dist; @@ -250,89 +251,87 @@ namespace CalamityMod.Projectiles.Magic Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num95 = 0; num95 < 4; num95++) + for (int i = 0; i < 4; i++) { - int num96 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num96].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + int killRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[killRed].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; } - for (int num97 = 0; num97 < 30; num97++) + for (int j = 0; j < 30; j++) { - int num98 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 200, default, 3.7f); - Dust dust = Main.dust[num98]; + int killRed2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 200, default, 3.7f); + Dust dust = Main.dust[killRed2]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; - num98 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + killRed2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; dust.color = Color.Crimson * 0.5f; } - for (int num99 = 0; num99 < 10; num99++) + for (int k = 0; k < 10; k++) { - int num100 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.7f); - Dust dust = Main.dust[num100]; + int killRed3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.7f); + Dust dust = Main.dust[killRed3]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; } - for (int num101 = 0; num101 < 10; num101++) + for (int l = 0; l < 10; l++) { - int num102 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1.5f); - Dust dust = Main.dust[num102]; + int killRed4 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1.5f); + Dust dust = Main.dust[killRed4]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; } if (Main.myPlayer == Projectile.owner) { - for (int num105 = 0; num105 < Main.maxProjectiles; num105++) + for (int numSubBlasts = 0; numSubBlasts < Main.maxProjectiles; numSubBlasts++) { - if (Main.projectile[num105].active && Main.projectile[num105].type == ModContent.ProjectileType() && Main.projectile[num105].ai[1] == Projectile.whoAmI) + if (Main.projectile[numSubBlasts].active && Main.projectile[numSubBlasts].type == ModContent.ProjectileType() && Main.projectile[numSubBlasts].ai[1] == Projectile.whoAmI) { - Main.projectile[num105].Kill(); + Main.projectile[numSubBlasts].Kill(); } } - int num106 = 5; - int num107 = 5; - int num108 = Utils.SelectRandom(Main.rand, new int[] + int dustType = Utils.SelectRandom(Main.rand, new int[] { 60, 180 }); - int num109 = (num108 == 60) ? 180 : 60; - for (int num110 = 0; num110 < num106; num110++) + int subBlastAI = (dustType == 60) ? 180 : 60; + for (int r = 0; r < 5; r++) { - Vector2 vector4 = Projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); - Vector2 vector5 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - while (vector5.X == 0f && vector5.Y == 0f) + Vector2 randShardRotate = Projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); + Vector2 randShardVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + while (randShardVel.X == 0f && randShardVel.Y == 0f) { - vector5 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randShardVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); } - vector5.Normalize(); - if (vector5.Y > 0.2f) + randShardVel.Normalize(); + if (randShardVel.Y > 0.2f) { - vector5.Y *= -1f; + randShardVel.Y *= -1f; } - vector5 *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector4.X, vector4.Y, vector5.X, vector5.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Projectile.owner, num108, 0f); + randShardVel *= Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), randShardRotate.X, randShardRotate.Y, randShardVel.X, randShardVel.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Projectile.owner, dustType, 0f); } - for (int num111 = 0; num111 < num107; num111++) + for (int s = 0; s < 5; s++) { - Vector2 vector6 = Projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); - Vector2 vector7 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - while (vector7.X == 0f && vector7.Y == 0f) + Vector2 randExplodeRotate = Projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); + Vector2 randExplodeVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + while (randExplodeVel.X == 0f && randExplodeVel.Y == 0f) { - vector7 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randExplodeVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); } - vector7.Normalize(); - if (vector7.Y > 0.4f) + randExplodeVel.Normalize(); + if (randExplodeVel.Y > 0.4f) { - vector7.Y *= -1f; + randExplodeVel.Y *= -1f; } - vector7 *= Main.rand.Next(40, 81) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector6.X, vector6.Y, vector7.X, vector7.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Projectile.owner, num109, 0f); + randExplodeVel *= Main.rand.Next(40, 81) * 0.1f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), randExplodeRotate.X, randExplodeRotate.Y, randExplodeVel.X, randExplodeVel.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Projectile.owner, subBlastAI, 0f); } } } diff --git a/Projectiles/Magic/GhastlyExplosion.cs b/Projectiles/Magic/GhastlyExplosion.cs index b746faa7a2..265bd0bd31 100644 --- a/Projectiles/Magic/GhastlyExplosion.cs +++ b/Projectiles/Magic/GhastlyExplosion.cs @@ -23,33 +23,33 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - int num3; - int num328 = (int)Projectile.ai[0]; - for (int num329 = 0; num329 < 3; num329 = num3 + 1) + int inc; + int dustType = (int)Projectile.ai[0]; + for (int i = 0; i < 3; i = inc + 1) { - int num330 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, num328, default, 1.2f); - Main.dust[num330].position = (Main.dust[num330].position + Projectile.Center) / 2f; - Main.dust[num330].noGravity = true; - Dust dust = Main.dust[num330]; + int ghostlyRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, dustType, default, 1.2f); + Main.dust[ghostlyRed].position = (Main.dust[ghostlyRed].position + Projectile.Center) / 2f; + Main.dust[ghostlyRed].noGravity = true; + Dust dust = Main.dust[ghostlyRed]; dust.velocity *= 0.5f; - num3 = num329; + inc = i; } - for (int num331 = 0; num331 < 2; num331 = num3 + 1) + for (int j = 0; j < 2; j = inc + 1) { - int num330 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, num328, default, 0.4f); - if (num331 == 0) + int ghostlyRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, dustType, default, 0.4f); + if (j == 0) { - Main.dust[num330].position = (Main.dust[num330].position + Projectile.Center * 5f) / 6f; + Main.dust[ghostlyRed].position = (Main.dust[ghostlyRed].position + Projectile.Center * 5f) / 6f; } - else if (num331 == 1) + else if (j == 1) { - Main.dust[num330].position = (Main.dust[num330].position + (Projectile.Center + Projectile.velocity / 2f) * 5f) / 6f; + Main.dust[ghostlyRed].position = (Main.dust[ghostlyRed].position + (Projectile.Center + Projectile.velocity / 2f) * 5f) / 6f; } - Dust dust = Main.dust[num330]; + Dust dust = Main.dust[ghostlyRed]; dust.velocity *= 0.1f; - Main.dust[num330].noGravity = true; - Main.dust[num330].fadeIn = 1f; - num3 = num331; + Main.dust[ghostlyRed].noGravity = true; + Main.dust[ghostlyRed].fadeIn = 1f; + inc = j; } return; } @@ -57,33 +57,32 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item50, Projectile.position); - int num3; - for (int num116 = 0; num116 < 20; num116 = num3 + 1) + int inc; + for (int i = 0; i < 20; i = inc + 1) { - int num117 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); + int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); Dust dust; - Main.dust[num117].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; - Main.dust[num117].noGravity = true; - dust = Main.dust[num117]; + Main.dust[killDust].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; + Main.dust[killDust].noGravity = true; + dust = Main.dust[killDust]; dust.velocity *= 2.5f; - dust = Main.dust[num117]; + dust = Main.dust[killDust]; dust.velocity -= Projectile.oldVelocity / 10f; - num3 = num116; + inc = i; } if (Main.myPlayer == Projectile.owner) { - int num118 = 3; - for (int num119 = 0; num119 < num118; num119 = num3 + 1) + for (int j = 0; j < 3; j = inc + 1) { - Vector2 vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (vector8.X == 0f && vector8.Y == 0f) + Vector2 randShardRotation = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (randShardRotation.X == 0f && randShardRotation.Y == 0f) { - vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + randShardRotation = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } - vector8.Normalize(); - vector8 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), vector8.X, vector8.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Projectile.owner, Projectile.ai[0], 0f); - num3 = num119; + randShardRotation.Normalize(); + randShardRotation *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), randShardRotation.X, randShardRotation.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Projectile.owner, Projectile.ai[0], 0f); + inc = j; } } } diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index f65b51b6fa..2542eb568f 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - int num332 = (int)Projectile.ai[0]; + int dustType = (int)Projectile.ai[0]; Projectile.ai[1] += 1f; - float num333 = (120f - Projectile.ai[1]) / 120f; + float dustScale = (120f - Projectile.ai[1]) / 120f; if (Projectile.ai[1] > 120f) Projectile.Kill(); @@ -37,30 +37,30 @@ namespace CalamityMod.Projectiles.Magic Projectile.velocity.X *= 0.98f; - int num3; - for (int num334 = 0; num334 < 2; num334 = num3 + 1) + int inc; + for (int i = 0; i < 2; i = inc + 1) { - int num335 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num332, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1.1f); - Main.dust[num335].position = (Main.dust[num335].position + Projectile.Center) / 2f; - Main.dust[num335].noGravity = true; - Dust dust = Main.dust[num335]; + int explodeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1.1f); + Main.dust[explodeDust].position = (Main.dust[explodeDust].position + Projectile.Center) / 2f; + Main.dust[explodeDust].noGravity = true; + Dust dust = Main.dust[explodeDust]; dust.velocity *= 0.3f; - dust = Main.dust[num335]; - dust.scale *= num333; - num3 = num334; + dust = Main.dust[explodeDust]; + dust.scale *= dustScale; + inc = i; } - for (int num336 = 0; num336 < 1; num336 = num3 + 1) + for (int j = 0; j < 1; j = inc + 1) { - int num335 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num332, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); - Main.dust[num335].position = (Main.dust[num335].position + Projectile.Center * 5f) / 6f; - Dust dust = Main.dust[num335]; + int explodeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + Main.dust[explodeDust].position = (Main.dust[explodeDust].position + Projectile.Center * 5f) / 6f; + Dust dust = Main.dust[explodeDust]; dust.velocity *= 0.1f; - Main.dust[num335].noGravity = true; - Main.dust[num335].fadeIn = 0.9f * num333; - dust = Main.dust[num335]; - dust.scale *= num333; - num3 = num336; + Main.dust[explodeDust].noGravity = true; + Main.dust[explodeDust].fadeIn = 0.9f * dustScale; + dust = Main.dust[explodeDust]; + dust.scale *= dustScale; + inc = j; } if (Projectile.timeLeft < 90) @@ -69,18 +69,18 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - int num3; - for (int num114 = 0; num114 < 10; num114 = num3 + 1) + int inc; + for (int i = 0; i < 10; i = inc + 1) { - int num115 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); + int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); Dust dust; - Main.dust[num115].scale = 1f + Main.rand.Next(-10, 11) * 0.01f; - Main.dust[num115].noGravity = true; - dust = Main.dust[num115]; + Main.dust[killDust].scale = 1f + Main.rand.Next(-10, 11) * 0.01f; + Main.dust[killDust].noGravity = true; + dust = Main.dust[killDust]; dust.velocity *= 1.25f; - dust = Main.dust[num115]; + dust = Main.dust[killDust]; dust.velocity -= Projectile.oldVelocity / 10f; - num3 = num114; + inc = i; } } } diff --git a/Projectiles/Magic/GhastlySubBlast.cs b/Projectiles/Magic/GhastlySubBlast.cs index 2a506ec8a6..56147fae13 100644 --- a/Projectiles/Magic/GhastlySubBlast.cs +++ b/Projectiles/Magic/GhastlySubBlast.cs @@ -23,17 +23,14 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - bool flag60 = false; - bool flag61 = false; - int num3 = Projectile.type; - int num1024 = ModContent.ProjectileType(); - float num1025 = 420f; + bool unusedBool = false; // yeah idk -CIT + int projType = ModContent.ProjectileType(); float x3 = 0.15f; float y3 = 0.15f; - if (flag61) + if (unusedBool) { - int num1026 = (int)Projectile.ai[1]; - if (!Main.projectile[num1026].active || Main.projectile[num1026].type != num1024) + int projID = (int)Projectile.ai[1]; + if (!Main.projectile[projID].active || Main.projectile[projID].type != projType) { Projectile.Kill(); return; @@ -41,15 +38,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 2; } Projectile.ai[0] += 1f; - if (Projectile.ai[0] < num1025) + if (Projectile.ai[0] < 420f) { - bool flag62 = true; - int num1027 = (int)Projectile.ai[1]; - if (Main.projectile[num1027].active && Main.projectile[num1027].type == num1024) + bool isActive = true; + int preHomingProjID = (int)Projectile.ai[1]; + if (Main.projectile[preHomingProjID].active && Main.projectile[preHomingProjID].type == projType) { - if (!flag60 && Main.projectile[num1027].oldPos[1] != Vector2.Zero) + if (Main.projectile[preHomingProjID].oldPos[1] != Vector2.Zero) { - Projectile.position += Main.projectile[num1027].position - Main.projectile[num1027].oldPos[1]; + Projectile.position += Main.projectile[preHomingProjID].position - Main.projectile[preHomingProjID].oldPos[1]; } if (Projectile.Center.HasNaNs()) { @@ -59,13 +56,13 @@ namespace CalamityMod.Projectiles.Magic } else { - Projectile.ai[0] = num1025; - flag62 = false; + Projectile.ai[0] = 420f; + isActive = false; Projectile.Kill(); } - if (flag62 && !flag60) + if (isActive) { - Projectile.velocity += new Vector2((float)Math.Sign(Main.projectile[num1027].Center.X - Projectile.Center.X), (float)Math.Sign(Main.projectile[num1027].Center.Y - Projectile.Center.Y)) * new Vector2(x3, y3); + Projectile.velocity += new Vector2((float)Math.Sign(Main.projectile[preHomingProjID].Center.X - Projectile.Center.X), (float)Math.Sign(Main.projectile[preHomingProjID].Center.Y - Projectile.Center.Y)) * new Vector2(x3, y3); if (Projectile.velocity.Length() > 6f) { Projectile.velocity *= 6f / Projectile.velocity.Length(); @@ -73,14 +70,14 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool()) { - int num1028 = Dust.NewDust(Projectile.Center, 8, 8, 60, 0f, 0f, 0, default, 1f); - Main.dust[num1028].position = Projectile.Center; - Main.dust[num1028].velocity = Projectile.velocity; - Main.dust[num1028].noGravity = true; - Main.dust[num1028].scale = 1.5f; - if (flag62) + int ghostlyRed = Dust.NewDust(Projectile.Center, 8, 8, 60, 0f, 0f, 0, default, 1f); + Main.dust[ghostlyRed].position = Projectile.Center; + Main.dust[ghostlyRed].velocity = Projectile.velocity; + Main.dust[ghostlyRed].noGravity = true; + Main.dust[ghostlyRed].scale = 1.5f; + if (isActive) { - Main.dust[num1028].customData = Main.projectile[(int)Projectile.ai[1]]; + Main.dust[ghostlyRed].customData = Main.projectile[(int)Projectile.ai[1]]; } } Projectile.alpha = 255; @@ -91,15 +88,15 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { Projectile.ai[0] = 60f; - for (int num114 = 0; num114 < 10; num114++) + for (int i = 0; i < 10; i++) { - int num115 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); Dust dust; - Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - Main.dust[num115].noGravity = true; - dust = Main.dust[num115]; + Main.dust[killDust].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + Main.dust[killDust].noGravity = true; + dust = Main.dust[killDust]; dust.velocity *= 1.25f; - dust = Main.dust[num115]; + dust = Main.dust[killDust]; dust.velocity -= Projectile.oldVelocity / 10f; } } diff --git a/Projectiles/Magic/GhastlyVisageProj.cs b/Projectiles/Magic/GhastlyVisageProj.cs index 636d0f182c..5ac1b0be89 100644 --- a/Projectiles/Magic/GhastlyVisageProj.cs +++ b/Projectiles/Magic/GhastlyVisageProj.cs @@ -33,11 +33,11 @@ namespace CalamityMod.Projectiles.Magic { Lighting.AddLight(Projectile.Center, 0.65f, 0f, 0.1f); Player player = Main.player[Projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float piConditional = 0f; + Vector2 playerRotate = player.RotatedRelativePoint(player.MountedCenter, true); if (Projectile.spriteDirection == -1) { - num = MathHelper.Pi; + piConditional = MathHelper.Pi; } Projectile.frameCounter++; if (Projectile.frameCounter > 4) @@ -50,25 +50,25 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame = 0; } Projectile.ai[0] += 1f; - int num39 = 0; + int aiSoundDelay = 0; if (Projectile.ai[0] >= 240f) { - num39++; + aiSoundDelay++; } if (Projectile.ai[0] >= 480f) { - num39++; + aiSoundDelay++; } - int num40 = 40; - int num41 = 2; + int soundDelayer = 40; + int soundDelayMult = 2; Projectile.ai[1] -= 1f; - bool flag15 = false; + bool isActive = false; if (Projectile.ai[1] <= 0f) { - Projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; + Projectile.ai[1] = (float)(soundDelayer - soundDelayMult * aiSoundDelay); + isActive = true; } - bool flag16 = player.channel && !player.noItems && !player.CCed; + bool canUseItem = player.channel && !player.noItems && !player.CCed; if (Projectile.localAI[0] > 0f) { Projectile.localAI[0] -= 1f; @@ -89,13 +89,13 @@ namespace CalamityMod.Projectiles.Magic else { Projectile.Kill(); - flag15 = false; + isActive = false; } } else { Projectile.Kill(); - flag15 = false; + isActive = false; } } else @@ -107,12 +107,12 @@ namespace CalamityMod.Projectiles.Magic } } Projectile.localAI[1] += 1f; - Projectile.soundDelay = num40 - num41 * num39; + Projectile.soundDelay = soundDelayer - soundDelayMult * aiSoundDelay; - if (flag15) + if (isActive) SoundEngine.PlaySound(SoundID.Item117, Projectile.position); } - else if (Projectile.soundDelay <= 0 && flag16) + else if (Projectile.soundDelay <= 0 && canUseItem) { if (player.statMana < manaCost) { @@ -127,13 +127,13 @@ namespace CalamityMod.Projectiles.Magic else { Projectile.Kill(); - flag15 = false; + isActive = false; } } else { Projectile.Kill(); - flag15 = false; + isActive = false; } } else @@ -144,47 +144,46 @@ namespace CalamityMod.Projectiles.Magic player.manaRegenDelay = (int)player.maxRegenDelay; } } - Projectile.soundDelay = num40 - num41 * num39; - if (Projectile.ai[0] != 1f && flag15) + Projectile.soundDelay = soundDelayer - soundDelayMult * aiSoundDelay; + if (Projectile.ai[0] != 1f && isActive) { SoundEngine.PlaySound(SoundID.Item117, Projectile.position); } Projectile.localAI[0] = 12f; } - if (flag15 && Main.myPlayer == Projectile.owner) + if (isActive && Main.myPlayer == Projectile.owner) { - int num42 = ModContent.ProjectileType(); float coreVelocity = 11.5f; int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); float weaponKnockback2 = player.ActiveItem().knockBack; - if (flag16) + if (canUseItem) { weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); float scaleFactor12 = player.ActiveItem().shootSpeed * Projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + Vector2 playerRotateCopy = playerRotate; + Vector2 projSpawnDirection = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - playerRotateCopy; if (player.gravDir == -1f) { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + projSpawnDirection.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerRotateCopy.Y; } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + Vector2 projSpawnDirectNormalize = Vector2.Normalize(projSpawnDirection); + if (float.IsNaN(projSpawnDirectNormalize.X) || float.IsNaN(projSpawnDirectNormalize.Y)) { - value19 = -Vector2.UnitY; + projSpawnDirectNormalize = -Vector2.UnitY; } - value19 *= scaleFactor12; - if (value19.X != Projectile.velocity.X || value19.Y != Projectile.velocity.Y) + projSpawnDirectNormalize *= scaleFactor12; + if (projSpawnDirectNormalize.X != Projectile.velocity.X || projSpawnDirectNormalize.Y != Projectile.velocity.Y) { Projectile.netUpdate = true; } - Projectile.velocity = value19 * 0.55f; - Vector2 vector20 = Vector2.Normalize(Projectile.velocity) * coreVelocity; - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + Projectile.velocity = projSpawnDirectNormalize * 0.55f; + Vector2 normalCoreVel = Vector2.Normalize(Projectile.velocity) * coreVelocity; + if (float.IsNaN(normalCoreVel.X) || float.IsNaN(normalCoreVel.Y)) { - vector20 = -Vector2.UnitY; + normalCoreVel = -Vector2.UnitY; } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -10f, 10f); - int num44 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, Projectile.owner, 0f, 0f); + Vector2 randomSpawnOffset = playerRotateCopy + Utils.RandomVector2(Main.rand, -10f, 10f); + int blastProj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), randomSpawnOffset.X, randomSpawnOffset.Y, normalCoreVel.X, normalCoreVel.Y, ModContent.ProjectileType(), weaponDamage2, weaponKnockback2, Projectile.owner, 0f, 0f); } else { @@ -192,7 +191,7 @@ namespace CalamityMod.Projectiles.Magic } } Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.rotation = Projectile.velocity.ToRotation() + piConditional; Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; player.ChangeDir(Projectile.direction); @@ -205,14 +204,14 @@ namespace CalamityMod.Projectiles.Magic public override void PostDraw(Color lightColor) { Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; Vector2 origin = new Vector2(13f, 16f); SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Magic/GhastlyVisageProjGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Magic/GhastlyVisageProjGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); } public override bool? CanDamage() => false; diff --git a/Projectiles/Magic/HadalUrnIsopod.cs b/Projectiles/Magic/HadalUrnIsopod.cs index dc864522fb..6ecee1d2a5 100644 --- a/Projectiles/Magic/HadalUrnIsopod.cs +++ b/Projectiles/Magic/HadalUrnIsopod.cs @@ -58,17 +58,17 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); //Black Anurian bubble dust - int num3; - for (int num246 = 0; num246 < 25; num246 = num3 + 1) + int inc; + for (int i = 0; i < 25; i = inc + 1) { - int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); - Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; - Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - Main.dust[num247].velocity.Normalize(); - Dust dust = Main.dust[num247]; + int hadalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); + Main.dust[hadalDust].position = (Main.dust[hadalDust].position + Projectile.position) / 2f; + Main.dust[hadalDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[hadalDust].velocity.Normalize(); + Dust dust = Main.dust[hadalDust]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = Projectile.alpha; - num3 = num246; + Main.dust[hadalDust].alpha = Projectile.alpha; + inc = i; } } diff --git a/Projectiles/Magic/HadalUrnLamprey.cs b/Projectiles/Magic/HadalUrnLamprey.cs index 98b8ed3135..8a1007c8b2 100644 --- a/Projectiles/Magic/HadalUrnLamprey.cs +++ b/Projectiles/Magic/HadalUrnLamprey.cs @@ -108,17 +108,17 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { //Black Anurian bubble dust - int num3; - for (int num246 = 0; num246 < 25; num246 = num3 + 1) + int inc; + for (int i = 0; i < 25; i = inc + 1) { - int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); - Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; - Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - Main.dust[num247].velocity.Normalize(); - Dust dust = Main.dust[num247]; + int hadalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); + Main.dust[hadalDust].position = (Main.dust[hadalDust].position + Projectile.position) / 2f; + Main.dust[hadalDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[hadalDust].velocity.Normalize(); + Dust dust = Main.dust[hadalDust]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = Projectile.alpha; - num3 = num246; + Main.dust[hadalDust].alpha = Projectile.alpha; + inc = i; } } diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs index f590b24f4c..f1a07045f4 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly.cs @@ -35,38 +35,38 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.localAI[0] += 1f; } - float num461 = 25f; + float projTimer = 25f; if (Projectile.ai[0] > 180f) { - num461 -= (Projectile.ai[0] - 180f) / 2f; + projTimer -= (Projectile.ai[0] - 180f) / 2f; } - if (num461 <= 0f) + if (projTimer <= 0f) { - num461 = 0f; + projTimer = 0f; Projectile.Kill(); } - num461 *= 0.7f; + projTimer *= 0.7f; Projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) + int timerCounter = 0; + while ((float)timerCounter < projTimer) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(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, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num467]; + float rando1 = (float)Main.rand.Next(-10, 11); + float rando2 = (float)Main.rand.Next(-10, 11); + float rando3 = (float)Main.rand.Next(3, 9); + float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjuster = rando3 / randoAdjuster; + rando1 *= randoAdjuster; + rando2 *= randoAdjuster; + int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[brimDust]; 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; - num462++; + dust.velocity.X = rando1; + dust.velocity.Y = rando2; + timerCounter++; } } diff --git a/Projectiles/Magic/HellwingPillar.cs b/Projectiles/Magic/HellwingPillar.cs index b95bea5926..40a84f7224 100644 --- a/Projectiles/Magic/HellwingPillar.cs +++ b/Projectiles/Magic/HellwingPillar.cs @@ -58,11 +58,10 @@ namespace CalamityMod.Projectiles.Magic scalar = 0.75f; } Projectile.ai[0] += 1f; - int num297 = 127; if (Main.rand.NextBool(3)) { - int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[num299]; + int flareDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[flareDust]; if (Main.rand.NextBool(3)) { dust.noGravity = true; diff --git a/Projectiles/Magic/HolyFlame.cs b/Projectiles/Magic/HolyFlame.cs index 0bf44176e0..11dd7cc85a 100644 --- a/Projectiles/Magic/HolyFlame.cs +++ b/Projectiles/Magic/HolyFlame.cs @@ -55,23 +55,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 50; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num621 = 0; num621 < 20; num621++) + for (int i = 0; i < 20; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[holyDust].scale = 0.5f; + Main.dust[holyDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 35; num623++) + for (int j = 0; j < 35; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); + Main.dust[holyDust2].noGravity = true; + Main.dust[holyDust2].velocity *= 5f; + holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[holyDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index 259ce46885..d804f3c477 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -29,21 +29,21 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { - int num249 = Main.rand.Next(2); - if (num249 == 0) + int dustType = Main.rand.Next(2); + if (dustType == 0) { - num249 = 244; + dustType = 244; } else { - num249 = 246; + dustType = 246; } - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 0.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * 0.25f; + int holyDust = Dust.NewDust(projPos, 1, 1, dustType, 0f, 0f, 0, default, 0.25f); + Main.dust[holyDust].position = projPos; + Main.dust[holyDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[holyDust].velocity *= 0.1f; } } diff --git a/Projectiles/Magic/IcicleStaffProj.cs b/Projectiles/Magic/IcicleStaffProj.cs index df95aabe6e..e9057dda96 100644 --- a/Projectiles/Magic/IcicleStaffProj.cs +++ b/Projectiles/Magic/IcicleStaffProj.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 3; num468++) + for (int i = 0; i < 3; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 0.75f); + Main.dust[icyDust].noGravity = true; + Main.dust[icyDust].velocity *= 0f; } } } diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index f3f9b60c5d..3e0901e896 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -98,8 +98,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.netUpdate = true; Vector2 center = Projectile.Center; center.Y -= baseHeight * Projectile.scale / 2f; - float num618 = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; - center.Y -= baseHeight * num618 / 2f; + float nextSegmentHeight = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; + center.Y -= baseHeight * nextSegmentHeight / 2f; center.Y += 2f; Projectile segment = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 10f, Projectile.ai[1] - 1f); @@ -114,14 +114,14 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.ai[0] <= 0f) { - float num622 = 0.104719758f; - float num623 = (float)Projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; - Projectile.position.X -= num624 * -Projectile.direction; + float swaySize = 0.104719758f; + float smolWidth = (float)Projectile.width / 5f; + smolWidth *= 2f; + float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; + Projectile.position.X -= projXChange * -Projectile.direction; Projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; - Projectile.position.X += num624 * -Projectile.direction; + projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; + Projectile.position.X += projXChange * -Projectile.direction; return; } } @@ -143,9 +143,9 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Magic/InfernadoMarkFriendly.cs b/Projectiles/Magic/InfernadoMarkFriendly.cs index cf15364bf6..9bb73962b2 100644 --- a/Projectiles/Magic/InfernadoMarkFriendly.cs +++ b/Projectiles/Magic/InfernadoMarkFriendly.cs @@ -30,23 +30,23 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.ai[1] > 0f) { - int num625 = (int)Projectile.ai[1] - 1; - if (num625 < 255) + int playerTrack = (int)Projectile.ai[1] - 1; + if (playerTrack < 255) { Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 10f) { - int num626 = 6; - for (int num627 = 0; num627 < num626; num627++) + int dustAmt = 6; + for (int i = 0; i < dustAmt; i++) { - Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + Projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= Projectile.velocity; + Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustRotate = dustRotate.RotatedBy((double)(i - (dustAmt / 2 - 1)) * 3.1415926535897931 / (double)(float)dustAmt, default) + Projectile.Center; + Vector2 randDustOffset = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int fiery = Dust.NewDust(dustRotate + randDustOffset, 0, 0, 244, randDustOffset.X * 2f, randDustOffset.Y * 2f, 100, default, 1.4f); + Main.dust[fiery].noGravity = true; + Main.dust[fiery].noLight = true; + Main.dust[fiery].velocity /= 4f; + Main.dust[fiery].velocity -= Projectile.velocity; } Projectile.alpha -= 5; if (Projectile.alpha < 100) @@ -54,11 +54,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 100; } } - Vector2 value16 = Main.player[num625].Center - Projectile.Center; - float num629 = 4f; - num629 += Projectile.localAI[0] / 20f; - Projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) + Vector2 projDirection = Main.player[playerTrack].Center - Projectile.Center; + float velocityMult = 4f; + velocityMult += Projectile.localAI[0] / 20f; + Projectile.velocity = Vector2.Normalize(projDirection) * velocityMult; + if (projDirection.Length() < 50f) { Projectile.Kill(); } @@ -66,13 +66,13 @@ namespace CalamityMod.Projectiles.Magic } else { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; - Projectile.velocity.Y = Projectile.velocity.Y - num632; + float swaySize = 0.209439516f; + float XChangeMult = 4f; + float projXChange = (float)(Math.Cos((double)(swaySize * Projectile.ai[0])) - 0.5) * XChangeMult; + Projectile.velocity.Y = Projectile.velocity.Y - projXChange; Projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; - Projectile.velocity.Y = Projectile.velocity.Y + num632; + projXChange = (float)(Math.Cos((double)(swaySize * Projectile.ai[0])) - 0.5) * XChangeMult; + Projectile.velocity.Y = Projectile.velocity.Y + projXChange; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 10f) { @@ -94,49 +94,49 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { SoundEngine.PlaySound(FlareSound, Projectile.position); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int infernadoDust = Dust.NewDust(rotate + faceDirection, 0, 0, 244, faceDirection.X * 2f, faceDirection.Y * 2f, 100, default, 1.4f); + Main.dust[infernadoDust].noGravity = true; + Main.dust[infernadoDust].noLight = true; + Main.dust[infernadoDust].velocity = faceDirection; } if (Projectile.owner == Main.myPlayer) { - int num231 = (int)(Projectile.Center.Y / 16f); - int num232 = (int)(Projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) + int projTileY = (int)(Projectile.Center.Y / 16f); + int projTileX = (int)(Projectile.Center.X / 16f); + int offsetUpwards = 100; + if (projTileX < 10) { - num232 = 10; + projTileX = 10; } - if (num232 > Main.maxTilesX - 10) + if (projTileX > Main.maxTilesX - 10) { - num232 = Main.maxTilesX - 10; + projTileX = Main.maxTilesX - 10; } - if (num231 < 10) + if (projTileY < 10) { - num231 = 10; + projTileY = 10; } - if (num231 > Main.maxTilesY - num233 - 10) + if (projTileY > Main.maxTilesY - offsetUpwards - 10) { - num231 = Main.maxTilesY - num233 - 10; + projTileY = Main.maxTilesY - offsetUpwards - 10; } - for (int num234 = num231; num234 < num231 + num233; num234++) + for (int j = projTileY; j < projTileY + offsetUpwards; j++) { - Tile tile = Main.tile[num232, num234]; + Tile tile = Main.tile[projTileX, j]; if (tile.HasTile && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0)) { - num231 = num234; + projTileY = j; break; } } - int num236 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 30f, Main.myPlayer, 16f, 16f); - Main.projectile[num236].netUpdate = true; + int infernado = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileX * 16 + 8), (float)(projTileY * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 30f, Main.myPlayer, 16f, 16f); + Main.projectile[infernado].netUpdate = true; } } } diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index 7dcf1e0a59..3ff465d10d 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -33,19 +33,19 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; Projectile.scale = 1.1f; Projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) + float dustLoopcheck = 16f; + int dustIncr = 0; + while ((float)dustIncr < dustLoopcheck) { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = Projectile.Center + vector11; - Main.dust[num100].velocity = Projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; + Vector2 dustRotate = Vector2.UnitX * 0f; + dustRotate += -Vector2.UnitY.RotatedBy((double)((float)dustIncr * (6.28318548f / dustLoopcheck)), default) * new Vector2(1f, 4f); + dustRotate = dustRotate.RotatedBy((double)Projectile.velocity.ToRotation(), default); + int deepRed = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); + Main.dust[deepRed].scale = 1.5f; + Main.dust[deepRed].noGravity = true; + Main.dust[deepRed].position = Projectile.Center + dustRotate; + Main.dust[deepRed].velocity = Projectile.velocity * 0f + dustRotate.SafeNormalize(Vector2.UnitY) * 1f; + dustIncr++; } } Projectile.rotation = Projectile.velocity.ToRotation() + 0.7853982f; @@ -78,35 +78,31 @@ namespace CalamityMod.Projectiles.Magic { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Texture2D texture2D3 = ModContent.Request(Texture).Value; - int num155 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y3 = num155 * Projectile.frame; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; + int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y3 = textureArea * Projectile.frame; + Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); + Vector2 halfRect = rectangle.Size() / 2f; rectangle = new Rectangle(38 * Projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) + halfRect = rectangle.Size() / 2f; + for (int i = 1; i < 3; i += 1) { - Color color26 = color25; - color26 = Projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); - Vector2 value5 = Projectile.oldPos[num159]; - float num160 = Projectile.rotation; + Color alphaColor = colorArea; + alphaColor = Projectile.GetAlpha(alphaColor); + alphaColor *= (float)(3 - i) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 oldPosition = Projectile.oldPos[i]; + float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) { - num160 = Projectile.oldRot[num159]; - effects = (Projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + projRotation = Projectile.oldRot[i]; + effects = (Projectile.oldSpriteDirection[i] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } - Main.spriteBatch.Draw(texture2D3, value5 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + Projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(Projectile.scale, value4, (float)num159 / 15f), effects, 0f); + Main.spriteBatch.Draw(texture2D3, oldPosition + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, projRotation + Projectile.rotation * 0f * (float)(i - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), halfRect, MathHelper.Lerp(Projectile.scale, 8f, (float)i / 15f), effects, 0f); } - Color color28 = Projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, Projectile.rotation, origin2, Projectile.scale, SpriteEffects.None, 0); + Color alphaColorAgain = Projectile.GetAlpha(colorArea); + Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColorAgain, Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 16e34a343e..5e9cb88dcf 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -35,19 +35,19 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; Projectile.scale = 1.1f; Projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) + float dustLoopCheck = 16f; + int dustIncr = 0; + while ((float)dustIncr < dustLoopCheck) { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = Projectile.Center + vector11; - Main.dust[num100].velocity = Projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; + Vector2 dustRotate = Vector2.UnitX * 0f; + dustRotate += -Vector2.UnitY.RotatedBy((double)((float)dustIncr * (6.28318548f / dustLoopCheck)), default) * new Vector2(1f, 4f); + dustRotate = dustRotate.RotatedBy((double)Projectile.velocity.ToRotation(), default); + int deepRed = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); + Main.dust[deepRed].scale = 1.5f; + Main.dust[deepRed].noGravity = true; + Main.dust[deepRed].position = Projectile.Center + dustRotate; + Main.dust[deepRed].velocity = Projectile.velocity * 0f + dustRotate.SafeNormalize(Vector2.UnitY) * 1f; + dustIncr++; } } Projectile.rotation = Projectile.velocity.ToRotation() + 0.7853982f; @@ -57,17 +57,17 @@ namespace CalamityMod.Projectiles.Magic { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) + int randDustAmt = Main.rand.Next(4, 10); + for (int i = 0; i < randDustAmt; i++) { - int num489 = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; + int killDeepRed = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); + Main.dust[killDeepRed].velocity *= 1.6f; + Dust expr_FEDF_cp_0 = Main.dust[killDeepRed]; expr_FEDF_cp_0.velocity.Y -= 1f; - Main.dust[num489].velocity += -Projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; + Main.dust[killDeepRed].velocity += -Projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[killDeepRed].scale = 2f; + Main.dust[killDeepRed].fadeIn = 0.5f; + Main.dust[killDeepRed].noGravity = true; } } @@ -83,35 +83,31 @@ namespace CalamityMod.Projectiles.Magic { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Texture2D texture2D3 = ModContent.Request(Texture).Value; - int num155 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y3 = num155 * Projectile.frame; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; + int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y3 = textureArea * Projectile.frame; + Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); + Vector2 halfRect = rectangle.Size() / 2f; rectangle = new Rectangle(38 * Projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) + halfRect = rectangle.Size() / 2f; + for (int j = 1; j < 3; j += 1) { - Color color26 = color25; - color26 = Projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); - Vector2 value5 = Projectile.oldPos[num159]; - float num160 = Projectile.rotation; + Color alphaColor = colorArea; + alphaColor = Projectile.GetAlpha(alphaColor); + alphaColor *= (float)(3 - j) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 oldPosition = Projectile.oldPos[j]; + float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) { - num160 = Projectile.oldRot[num159]; - effects = (Projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + projRotation = Projectile.oldRot[j]; + effects = (Projectile.oldSpriteDirection[j] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } - Main.spriteBatch.Draw(texture2D3, value5 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + Projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(Projectile.scale, value4, (float)num159 / 15f), effects, 0f); + Main.spriteBatch.Draw(texture2D3, oldPosition + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, projRotation + Projectile.rotation * 0f * (float)(j - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), halfRect, MathHelper.Lerp(Projectile.scale, 8f, (float)j / 15f), effects, 0f); } - Color color28 = Projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, Projectile.rotation, origin2, Projectile.scale, SpriteEffects.None, 0); + Color alphaColorAgain = Projectile.GetAlpha(colorArea); + Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColorAgain, Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index 54c505d358..ecab146b29 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -42,19 +42,19 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; } Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f, 0f, 0.2f); - float num55 = 100f; - float num56 = 3f; + float projTimer = 100f; + float timerIncr = 3f; if (Projectile.ai[1] == 0f) { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) + Projectile.localAI[0] += timerIncr; + if (Projectile.localAI[0] > projTimer) { - Projectile.localAI[0] = num55; + Projectile.localAI[0] = projTimer; } } else { - Projectile.localAI[0] -= num56; + Projectile.localAI[0] -= timerIncr; if (Projectile.localAI[0] <= 0f) { Projectile.Kill(); @@ -74,12 +74,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); - int num212 = Main.rand.Next(15, 30); - for (int num213 = 0; num213 < num212; num213++) + int randDustAmt = Main.rand.Next(15, 30); + for (int i = 0; i < randDustAmt; i++) { - int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 130, 0f, 0f, 100, default, 1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; + int reddish = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 130, 0f, 0f, 100, default, 1f); + Main.dust[reddish].velocity *= 2f; + Main.dust[reddish].noGravity = true; } } diff --git a/Projectiles/Magic/LazharSolarBeam.cs b/Projectiles/Magic/LazharSolarBeam.cs index 34f5798633..0cb34d1d67 100644 --- a/Projectiles/Magic/LazharSolarBeam.cs +++ b/Projectiles/Magic/LazharSolarBeam.cs @@ -26,15 +26,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num447 = 0; num447 < 4; num447++) + for (int i = 0; i < 4; i++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default, 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; + int heatGold = Dust.NewDust(projPos, 1, 1, 246, 0f, 0f, 0, default, 1f); + Main.dust[heatGold].position = projPos; + Main.dust[heatGold].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[heatGold].velocity *= 0.2f; } } } diff --git a/Projectiles/Magic/LightBall.cs b/Projectiles/Magic/LightBall.cs index 11cb215f48..a55997a16c 100644 --- a/Projectiles/Magic/LightBall.cs +++ b/Projectiles/Magic/LightBall.cs @@ -42,23 +42,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int lightDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.2f); + Main.dust[lightDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[lightDust].scale = 0.5f; + Main.dust[lightDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 20; num623++) + for (int j = 0; j < 20; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int lightDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.7f); + Main.dust[lightDust2].noGravity = true; + Main.dust[lightDust2].velocity *= 5f; + lightDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[lightDust2].velocity *= 2f; } } } diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index 9dc075c329..f5d449a3cd 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -37,19 +37,19 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; Projectile.scale = 1.1f; Projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) + float dustLoopCheck = 16f; + int dustIncr = 0; + while ((float)dustIncr < dustLoopCheck) { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = Projectile.Center + vector11; - Main.dust[num100].velocity = Projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; + Vector2 dustRotate = Vector2.UnitX * 0f; + dustRotate += -Vector2.UnitY.RotatedBy((double)((float)dustIncr * (6.28318548f / dustLoopCheck)), default) * new Vector2(1f, 4f); + dustRotate = dustRotate.RotatedBy((double)Projectile.velocity.ToRotation(), default); + int rainbow = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[rainbow].scale = 1.5f; + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].position = Projectile.Center + dustRotate; + Main.dust[rainbow].velocity = Projectile.velocity * 0f + dustRotate.SafeNormalize(Vector2.UnitY) * 1f; + dustIncr++; } } Projectile.rotation = Projectile.velocity.ToRotation() + 0.7853982f; @@ -59,11 +59,11 @@ namespace CalamityMod.Projectiles.Magic { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) + int randDustAmt = Main.rand.Next(4, 10); + for (int j = 0; j < randDustAmt; j++) { - int num489 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Dust dust = Main.dust[num489]; + int rainbowDeath = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Dust dust = Main.dust[rainbowDeath]; dust.velocity *= 1.6f; dust.velocity.Y -= 1f; dust.velocity += -Projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; @@ -85,35 +85,31 @@ namespace CalamityMod.Projectiles.Magic { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Texture2D texture2D3 = ModContent.Request(Texture).Value; - int num155 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y3 = num155 * Projectile.frame; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; + int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y3 = textureArea * Projectile.frame; + Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); + Vector2 halfRect = rectangle.Size() / 2f; rectangle = new Rectangle(38 * Projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) + halfRect = rectangle.Size() / 2f; + for (int i = 1; i < 3; i += 1) { - Color color26 = color25; - color26 = Projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); - Vector2 value5 = Projectile.oldPos[num159]; - float num160 = Projectile.rotation; + Color alphaColor = colorArea; + alphaColor = Projectile.GetAlpha(alphaColor); + alphaColor *= (float)(num156 - i) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 oldPosition = Projectile.oldPos[i]; + float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) { - num160 = Projectile.oldRot[num159]; - effects = (Projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + projRotation = Projectile.oldRot[i]; + effects = (Projectile.oldSpriteDirection[i] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } - Main.spriteBatch.Draw(texture2D3, value5 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + Projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(Projectile.scale, value4, (float)num159 / 15f), effects, 0f); + Main.spriteBatch.Draw(texture2D3, oldPosition + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, projRotation + Projectile.rotation * 0f * (float)(i - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), halfRect, MathHelper.Lerp(Projectile.scale, 8f, (float)i / 15f), effects, 0f); } - Color color28 = Projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, Projectile.rotation, origin2, Projectile.scale, SpriteEffects.None, 0); + Color alphaColorAgain = Projectile.GetAlpha(colorArea); + Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColorAgain, Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index 29be60a1db..17101ae26c 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -37,19 +37,19 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; Projectile.scale = 1.1f; Projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) + float dustLoopCheck = 16f; + int dustIncr = 0; + while ((float)dustIncr < dustLoopCheck) { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = Projectile.Center + vector11; - Main.dust[num100].velocity = Projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; + Vector2 dustRotate = Vector2.UnitX * 0f; + dustRotate += -Vector2.UnitY.RotatedBy((double)((float)dustIncr * (6.28318548f / dustLoopCheck)), default) * new Vector2(1f, 4f); + dustRotate = dustRotate.RotatedBy((double)Projectile.velocity.ToRotation(), default); + int rainbow = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[rainbow].scale = 1.5f; + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].position = Projectile.Center + dustRotate; + Main.dust[rainbow].velocity = Projectile.velocity * 0f + dustRotate.SafeNormalize(Vector2.UnitY) * 1f; + dustIncr++; } } Projectile.rotation = Projectile.velocity.ToRotation() + 0.7853982f; @@ -59,11 +59,11 @@ namespace CalamityMod.Projectiles.Magic { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) + int randDustAmt = Main.rand.Next(4, 10); + for (int i = 0; i < randDustAmt; i++) { - int num489 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Dust dust = Main.dust[num489]; + int rainbowDeath = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Dust dust = Main.dust[rainbowDeath]; dust.velocity *= 1.6f; dust.velocity.Y -= 1f; dust.velocity += -Projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; @@ -85,35 +85,31 @@ namespace CalamityMod.Projectiles.Magic { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Texture2D texture2D3 = ModContent.Request(Texture).Value; - int num155 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y3 = num155 * Projectile.frame; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; + int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y3 = textureArea * Projectile.frame; + Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); + Vector2 halfRect = rectangle.Size() / 2f; rectangle = new Rectangle(38 * Projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) + halfRect = rectangle.Size() / 2f; + for (int j = 1; j < 3; j += 1) { - Color color26 = color25; - color26 = Projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); - Vector2 value5 = Projectile.oldPos[num159]; - float num160 = Projectile.rotation; + Color alphaColor = colorArea; + alphaColor = Projectile.GetAlpha(alphaColor); + alphaColor *= (float)(num156 - j) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 oldPosition = Projectile.oldPos[j]; + float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) { - num160 = Projectile.oldRot[num159]; - effects = (Projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + projRotation = Projectile.oldRot[j]; + effects = (Projectile.oldSpriteDirection[j] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } - Main.spriteBatch.Draw(texture2D3, value5 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + Projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(Projectile.scale, value4, (float)num159 / 15f), effects, 0f); + Main.spriteBatch.Draw(texture2D3, oldPosition + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, projRotation + Projectile.rotation * 0f * (float)(j - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), halfRect, MathHelper.Lerp(Projectile.scale, 8f, (float)j / 15f), effects, 0f); } - Color color28 = Projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, Projectile.rotation, origin2, Projectile.scale, SpriteEffects.None, 0); + Color alphaColorAgain = Projectile.GetAlpha(colorArea); + Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColorAgain, Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Magic/LuxorsGiftMagic.cs b/Projectiles/Magic/LuxorsGiftMagic.cs index 2f4b809d03..8be8db8a32 100644 --- a/Projectiles/Magic/LuxorsGiftMagic.cs +++ b/Projectiles/Magic/LuxorsGiftMagic.cs @@ -56,15 +56,15 @@ namespace CalamityMod.Projectiles.Magic { for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(Projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = Projectile.Center + vector3; - Main.dust[num9].velocity = Projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Vector2 dustRotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + dustRotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + dustRotate = dustRotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int dusty = Dust.NewDust(Projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + Main.dust[dusty].scale = 1.1f; + Main.dust[dusty].noGravity = true; + Main.dust[dusty].position = Projectile.Center + dustRotate; + Main.dust[dusty].velocity = Projectile.velocity * 0.1f; + Main.dust[dusty].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[dusty].position) * 1.25f; } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs index 1d889fb007..147f7ba1af 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -69,46 +69,45 @@ namespace CalamityMod.Projectiles.Magic Projectile.Damage(); // I don't even know what this dust code does - float num51 = 1.8f; - float num52 = 2.5f; - Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) + // So true bestie! -CIT + Vector2 dustRotation = (0f - 1.57079637f).ToRotationVector2(); + Vector2 dustVelocity = dustRotation * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + int inc; + for (int i = 0; i < 40; i = inc + 1) { - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 200, default, num52); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; + int alchDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 200, default, 2.5f); + Main.dust[alchDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[alchDust].noGravity = true; + Dust dust = Main.dust[alchDust]; dust.velocity *= 4f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[num54]; + dust = Main.dust[alchDust]; + dust.velocity += dustVelocity * Main.rand.NextFloat(); + alchDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, 1.8f); + Main.dust[alchDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust = Main.dust[alchDust]; dust.velocity *= 3f; - Main.dust[num54].noGravity = true; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, num51); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[num54]; + Main.dust[alchDust].noGravity = true; + alchDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 1.8f); + Main.dust[alchDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust = Main.dust[alchDust]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Green * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; + Main.dust[alchDust].noGravity = true; + Main.dust[alchDust].fadeIn = 1f; + Main.dust[alchDust].color = Color.Green * 0.5f; + dust = Main.dust[alchDust]; + dust.velocity += dustVelocity * Main.rand.NextFloat(); + inc = i; } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) + for (int j = 0; j < 20; j = inc + 1) { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 0, default, num52); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; + int alchDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 0, default, 2.5f); + Main.dust[alchDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; + Main.dust[alchDust2].noGravity = true; + Dust dust = Main.dust[alchDust2]; dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; + dust = Main.dust[alchDust2]; + dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); + inc = j; } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs index e6265e1b5e..fe9ae63c68 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs @@ -51,18 +51,17 @@ namespace CalamityMod.Projectiles.Magic float x = Projectile.position.X + (float)Main.rand.Next(-100, 100); float y = Projectile.position.Y - (float)Main.rand.Next(500, 600); Vector2 vector = new Vector2(x, y); - float num15 = Projectile.position.X + (float)(Projectile.width / 2) - vector.X; - float num16 = Projectile.position.Y + (float)(Projectile.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; + float projSpawnX = Projectile.position.X + (float)(Projectile.width / 2) - vector.X; + float projSpawnY = Projectile.position.Y + (float)(Projectile.height / 2) - vector.Y; + projSpawnX += (float)Main.rand.Next(-100, 101); + float projSpawnDist = (float)Math.Sqrt((double)(projSpawnX * projSpawnX + projSpawnY * projSpawnY)); + projSpawnDist = 25f / projSpawnDist; + projSpawnX *= projSpawnDist; + projSpawnY *= projSpawnDist; - float ai2 = num16 + Projectile.position.Y; + float flareAI = projSpawnY + Projectile.position.Y; if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, num15, num16, ProjectileID.LunarFlare, Projectile.damage / 2, 5f, Projectile.owner, 0f, ai2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, projSpawnX, projSpawnY, ProjectileID.LunarFlare, Projectile.damage / 2, 5f, Projectile.owner, 0f, flareAI); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs index cb4474fb96..21be9804fc 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs @@ -51,10 +51,10 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < numShrapnel; 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.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), shrapnelDamage, 0f, Projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Vector2 randProjSpawn = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + randProjSpawn.Normalize(); + randProjSpawn *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, randProjSpawn.X, randProjSpawn.Y, ModContent.ProjectileType(), shrapnelDamage, 0f, Projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailRed.cs b/Projectiles/Magic/MadAlchemistsCocktailRed.cs index b2ada56d4d..a1d38bc5f8 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailRed.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailRed.cs @@ -60,60 +60,58 @@ namespace CalamityMod.Projectiles.Magic Projectile.Damage(); // I don't even know what this dust code does - float num50 = 3f; - float num51 = 2.4f; - float num52 = 3.8f; - Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; - int num3; - for (int num53 = 0; num53 < 60; num53 = num3 + 1) + float dustAI = 2.4f; + Vector2 dustRotation = (0f - 1.57079637f).ToRotationVector2(); + Vector2 dustVelocity = dustRotation * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + int inc; + for (int i = 0; i < 60; i = inc + 1) { - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 200, default, num50); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; + int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 200, default, 3f); + Main.dust[fiery].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[fiery].noGravity = true; + Dust dust = Main.dust[fiery]; dust.velocity *= 8f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[num54]; + dust = Main.dust[fiery]; + dust.velocity += dustVelocity * Main.rand.NextFloat(); + fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, dustAI); + Main.dust[fiery].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust = Main.dust[fiery]; dust.velocity *= 6f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[num54]; + Main.dust[fiery].noGravity = true; + Main.dust[fiery].fadeIn = 1f; + Main.dust[fiery].color = Color.Crimson * 0.5f; + dust = Main.dust[fiery]; + dust.velocity += dustVelocity * Main.rand.NextFloat(); + fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, dustAI); + Main.dust[fiery].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust = Main.dust[fiery]; dust.velocity *= 4f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[num54]; + Main.dust[fiery].noGravity = true; + Main.dust[fiery].fadeIn = 1f; + Main.dust[fiery].color = Color.Crimson * 0.5f; + dust = Main.dust[fiery]; + dust.velocity += dustVelocity * Main.rand.NextFloat(); + fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, dustAI); + Main.dust[fiery].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust = Main.dust[fiery]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; + Main.dust[fiery].noGravity = true; + Main.dust[fiery].fadeIn = 1f; + Main.dust[fiery].color = Color.Crimson * 0.5f; + dust = Main.dust[fiery]; + dust.velocity += dustVelocity * Main.rand.NextFloat(); + inc = i; } - for (int num55 = 0; num55 < 30; num55 = num3 + 1) + for (int j = 0; j < 30; j = inc + 1) { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 0, default, num52); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; + int fiery2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 0, default, 3.8f); + Main.dust[fiery2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; + Main.dust[fiery2].noGravity = true; + Dust dust = Main.dust[fiery2]; dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; + dust = Main.dust[fiery2]; + dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); + inc = j; } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs index c9f62ef33c..9fc5bfe392 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2 value7 = new Vector2(6f, 12f); + Vector2 rotationMult = new Vector2(6f, 12f); Projectile.localAI[0] += 1f; if (Projectile.localAI[0] == 48f) { @@ -32,19 +32,19 @@ namespace CalamityMod.Projectiles.Magic } else { - for (int num41 = 0; num41 < 2; num41++) + for (int i = 0; i < 2; i++) { - Vector2 value8 = Vector2.UnitX * -15f; - value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 0.75f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 0.75f); - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; + Vector2 dustRotation = Vector2.UnitX * -15f; + dustRotation = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotationMult * 0.75f; + int shrapnelDust = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 0.75f); + Main.dust[shrapnelDust].noGravity = true; + Main.dust[shrapnelDust].position = Projectile.Center + dustRotation; + Main.dust[shrapnelDust].velocity = Projectile.velocity; } } - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; + int extraDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[extraDust].noGravity = true; if (Projectile.timeLeft < 150) CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 12f, 20f); diff --git a/Projectiles/Magic/MagneticBeam.cs b/Projectiles/Magic/MagneticBeam.cs index 1189876c46..79bffa3f90 100644 --- a/Projectiles/Magic/MagneticBeam.cs +++ b/Projectiles/Magic/MagneticBeam.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * 0.25f; + int dust = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 1.25f); + Main.dust[dust].position = projPos; + Main.dust[dust].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[dust].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index 97237d90e0..b24092abef 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -69,8 +69,8 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.timeLeft < 30) { - float num7 = (float)Projectile.timeLeft / 30f; - Projectile.alpha = (int)(255f - 255f * num7); + float timeAlpha = (float)Projectile.timeLeft / 30f; + Projectile.alpha = (int)(255f - 255f * timeAlpha); } return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } @@ -78,9 +78,9 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Magic/MelterAmp.cs b/Projectiles/Magic/MelterAmp.cs index ebf1fb5118..4623c92bb4 100644 --- a/Projectiles/Magic/MelterAmp.cs +++ b/Projectiles/Magic/MelterAmp.cs @@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isProjectile = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; - if (flag64) + if (isProjectile) { if (player.dead) { @@ -64,29 +64,28 @@ namespace CalamityMod.Projectiles.Magic int Damage = Projectile.damage; int type; Projectile.netUpdate = true; - float num127 = 20f; - Vector2 vector11 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + Vector2 projAimDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float ampXDirection = (float)Main.mouseX + Main.screenPosition.X - projAimDirection.X; + float ampYDirection = (float)Main.mouseY + Main.screenPosition.Y - projAimDirection.Y; if (player.gravDir == -1f) { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + ampYDirection = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projAimDirection.Y; } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f) + float ampAimDistance = (float)Math.Sqrt((double)(ampXDirection * ampXDirection + ampYDirection * ampYDirection)); + if (ampAimDistance == 0f) { - vector11 = new Vector2(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2)); - num128 = Projectile.position.X + (float)Projectile.width * 0.5f - vector11.X; - num129 = Projectile.position.Y + (float)Projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + projAimDirection = new Vector2(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2)); + ampXDirection = Projectile.position.X + (float)Projectile.width * 0.5f - projAimDirection.X; + ampYDirection = Projectile.position.Y + (float)Projectile.height * 0.5f - projAimDirection.Y; + ampAimDistance = (float)Math.Sqrt((double)(ampXDirection * ampXDirection + ampYDirection * ampYDirection)); } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - float VelocityX = num128; - float VelocityY = num129; - int note = Main.rand.Next(0, 2); - if (note == 0) + ampAimDistance = 20f / ampAimDistance; + ampXDirection *= ampAimDistance; + ampYDirection *= ampAimDistance; + float VelocityX = ampXDirection; + float VelocityY = ampYDirection; + int noteType = Main.rand.Next(0, 2); + if (noteType == 0) { Damage = (int)(Projectile.damage * 1.5f); type = ModContent.ProjectileType(); diff --git a/Projectiles/Magic/NebulaCloud.cs b/Projectiles/Magic/NebulaCloud.cs index a2aac10fbe..9e97e763f2 100644 --- a/Projectiles/Magic/NebulaCloud.cs +++ b/Projectiles/Magic/NebulaCloud.cs @@ -32,17 +32,14 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - int num925 = ModContent.ProjectileType(); - float num926 = 720f; - float x5 = 0.15f; - float y4 = 0.15f; - bool flag50 = false; - bool flag51 = false; + int mainProjType = ModContent.ProjectileType(); + float projTimer = 720f; + bool unusedFlag = false; - if (flag51) + if (unusedFlag) { - int num927 = (int)Projectile.ai[1]; - if (!Main.projectile[num927].active || Main.projectile[num927].type != num925) + int mainProj = (int)Projectile.ai[1]; + if (!Main.projectile[mainProj].active || Main.projectile[mainProj].type != mainProjType) { Projectile.Kill(); return; @@ -52,15 +49,15 @@ namespace CalamityMod.Projectiles.Magic } Projectile.ai[0]++; - if (!(Projectile.ai[0] < num926)) + if (!(Projectile.ai[0] < projTimer)) return; - bool flag52 = true; - int num928 = (int)Projectile.ai[1]; - if (Main.projectile[num928].active && Main.projectile[num928].type == num925) + bool isActive = true; + int mainProjID = (int)Projectile.ai[1]; + if (Main.projectile[mainProjID].active && Main.projectile[mainProjID].type == mainProjType) { - if (!flag50 && Main.projectile[num928].oldPos[1] != Vector2.Zero) - Projectile.position += Main.projectile[num928].position - Main.projectile[num928].oldPos[1]; + if (Main.projectile[mainProjID].oldPos[1] != Vector2.Zero) + Projectile.position += Main.projectile[mainProjID].position - Main.projectile[mainProjID].oldPos[1]; if (Projectile.Center.HasNaNs()) { @@ -70,28 +67,28 @@ namespace CalamityMod.Projectiles.Magic } else { - Projectile.ai[0] = num926; - flag52 = false; + Projectile.ai[0] = projTimer; + isActive = false; Projectile.Kill(); } - if (flag52 && !flag50) + if (isActive) { - Projectile.velocity += new Vector2(Math.Sign(Main.projectile[num928].Center.X - Projectile.Center.X), Math.Sign(Main.projectile[num928].Center.Y - Projectile.Center.Y)) * new Vector2(x5, y4); + Projectile.velocity += new Vector2(Math.Sign(Main.projectile[mainProjID].Center.X - Projectile.Center.X), Math.Sign(Main.projectile[mainProjID].Center.Y - Projectile.Center.Y)) * new Vector2(0.15f, 0.15f); if (Projectile.velocity.Length() > 6f) Projectile.velocity *= 6f / Projectile.velocity.Length(); } if (Main.rand.NextBool()) { - int num929 = Dust.NewDust(Projectile.Center, 8, 8, 86); - Main.dust[num929].position = Projectile.Center; - Main.dust[num929].velocity = Projectile.velocity; - Main.dust[num929].noGravity = true; - Main.dust[num929].scale = 1.75f; + int purpleDust = Dust.NewDust(Projectile.Center, 8, 8, 86); + Main.dust[purpleDust].position = Projectile.Center; + Main.dust[purpleDust].velocity = Projectile.velocity; + Main.dust[purpleDust].noGravity = true; + Main.dust[purpleDust].scale = 1.75f; - if (flag52) - Main.dust[num929].customData = Main.projectile[(int)Projectile.ai[1]]; + if (isActive) + Main.dust[purpleDust].customData = Main.projectile[(int)Projectile.ai[1]]; } } @@ -99,24 +96,24 @@ namespace CalamityMod.Projectiles.Magic { Projectile.ai[0] = 86f; - for (int num164 = 0; num164 < 15; num164++) + for (int i = 0; i < 15; i++) { - int num165 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default(Color), 0.75f); + int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default(Color), 0.75f); Dust dust; if (Main.rand.NextBool(3)) { - Main.dust[num165].fadeIn = 0.75f + Main.rand.Next(-10, 11) * 0.015f; - Main.dust[num165].scale = 0.325f + Main.rand.Next(-10, 11) * 0.0075f; - dust = Main.dust[num165]; + Main.dust[killDust].fadeIn = 0.75f + Main.rand.Next(-10, 11) * 0.015f; + Main.dust[killDust].scale = 0.325f + Main.rand.Next(-10, 11) * 0.0075f; + dust = Main.dust[killDust]; dust.type++; } else - Main.dust[num165].scale = 1.5f + Main.rand.Next(-10, 11) * 0.015f; + Main.dust[killDust].scale = 1.5f + Main.rand.Next(-10, 11) * 0.015f; - Main.dust[num165].noGravity = true; - dust = Main.dust[num165]; + Main.dust[killDust].noGravity = true; + dust = Main.dust[killDust]; dust.velocity *= 1.375f; - dust = Main.dust[num165]; + dust = Main.dust[killDust]; dust.velocity -= Projectile.oldVelocity / 20f; } } diff --git a/Projectiles/Magic/NebulaCloudCore.cs b/Projectiles/Magic/NebulaCloudCore.cs index e91c6bbc49..d6666420d1 100644 --- a/Projectiles/Magic/NebulaCloudCore.cs +++ b/Projectiles/Magic/NebulaCloudCore.cs @@ -73,25 +73,25 @@ namespace CalamityMod.Projectiles.Magic { if (Main.rand.NextBool()) { - Vector2 vector93 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust45 = Main.dust[Dust.NewDust(Projectile.Center - vector93 * 45f, 0, 0, Utils.SelectRandom(Main.rand, 86, 90))]; - dust45.noGravity = true; - dust45.position = Projectile.Center - vector93 * Main.rand.Next(20, 31); - dust45.velocity = vector93.RotatedBy(MathHelper.PiOver2) * 9f; - dust45.scale = 0.7f + Main.rand.NextFloat(); - dust45.fadeIn = 0.5f; - dust45.customData = this; + Vector2 prettyDustDirect = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust prettyDust = Main.dust[Dust.NewDust(Projectile.Center - prettyDustDirect * 45f, 0, 0, Utils.SelectRandom(Main.rand, 86, 90))]; + prettyDust.noGravity = true; + prettyDust.position = Projectile.Center - prettyDustDirect * Main.rand.Next(20, 31); + prettyDust.velocity = prettyDustDirect.RotatedBy(MathHelper.PiOver2) * 9f; + prettyDust.scale = 0.7f + Main.rand.NextFloat(); + prettyDust.fadeIn = 0.5f; + prettyDust.customData = this; } else { - Vector2 vector94 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust46 = Main.dust[Dust.NewDust(Projectile.Center - vector94 * 45f, 0, 0, 240)]; - dust46.noGravity = true; - dust46.position = Projectile.Center - vector94 * 45f; - dust46.velocity = vector94.RotatedBy(-MathHelper.PiOver2) * 4f; - dust46.scale = 0.7f + Main.rand.NextFloat(); - dust46.fadeIn = 0.5f; - dust46.customData = this; + Vector2 prettyDustDirect2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust prettyDust2 = Main.dust[Dust.NewDust(Projectile.Center - prettyDustDirect2 * 45f, 0, 0, 240)]; + prettyDust2.noGravity = true; + prettyDust2.position = Projectile.Center - prettyDustDirect2 * 45f; + prettyDust2.velocity = prettyDustDirect2.RotatedBy(-MathHelper.PiOver2) * 4f; + prettyDust2.scale = 0.7f + Main.rand.NextFloat(); + prettyDust2.fadeIn = 0.5f; + prettyDust2.customData = this; } } @@ -125,99 +125,99 @@ namespace CalamityMod.Projectiles.Magic // Emit pretty as fuck dust. if (Main.rand.NextBool()) { - Vector2 vector88 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust43 = Main.dust[Dust.NewDust(Projectile.Center - vector88 * 45f, 0, 0, 86)]; - dust43.noGravity = true; - dust43.position = Projectile.Center - vector88 * Main.rand.Next(20, 31); - dust43.velocity = vector88.RotatedBy(MathHelper.PiOver2) * 9f; - dust43.scale = 1.2f + Main.rand.NextFloat(); - dust43.fadeIn = 0.5f; - dust43.customData = this; - vector88 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - dust43 = Main.dust[Dust.NewDust(Projectile.Center - vector88 * 45f, 0, 0, 90)]; - dust43.noGravity = true; - dust43.position = Projectile.Center - vector88 * Main.rand.Next(20, 31); - dust43.velocity = vector88.RotatedBy(MathHelper.PiOver2) * 9f; - dust43.scale = 1.2f + Main.rand.NextFloat(); - dust43.fadeIn = 0.5f; - dust43.customData = this; - dust43.color = Color.Purple; + Vector2 slowPrettyDustDirect = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust slowPrettyDust = Main.dust[Dust.NewDust(Projectile.Center - slowPrettyDustDirect * 45f, 0, 0, 86)]; + slowPrettyDust.noGravity = true; + slowPrettyDust.position = Projectile.Center - slowPrettyDustDirect * Main.rand.Next(20, 31); + slowPrettyDust.velocity = slowPrettyDustDirect.RotatedBy(MathHelper.PiOver2) * 9f; + slowPrettyDust.scale = 1.2f + Main.rand.NextFloat(); + slowPrettyDust.fadeIn = 0.5f; + slowPrettyDust.customData = this; + slowPrettyDustDirect = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + slowPrettyDust = Main.dust[Dust.NewDust(Projectile.Center - slowPrettyDustDirect * 45f, 0, 0, 90)]; + slowPrettyDust.noGravity = true; + slowPrettyDust.position = Projectile.Center - slowPrettyDustDirect * Main.rand.Next(20, 31); + slowPrettyDust.velocity = slowPrettyDustDirect.RotatedBy(MathHelper.PiOver2) * 9f; + slowPrettyDust.scale = 1.2f + Main.rand.NextFloat(); + slowPrettyDust.fadeIn = 0.5f; + slowPrettyDust.customData = this; + slowPrettyDust.color = Color.Purple; } else { - Vector2 vector89 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust44 = Main.dust[Dust.NewDust(Projectile.Center - vector89 * 45f, 0, 0, 240)]; - dust44.noGravity = true; - dust44.position = Projectile.Center - vector89 * Main.rand.Next(30, 41); - dust44.velocity = vector89.RotatedBy(-MathHelper.PiOver2) * 6f; - dust44.scale = 1.2f + Main.rand.NextFloat(); - dust44.fadeIn = 0.5f; - dust44.customData = this; + Vector2 slowPrettyDustDirect2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust slowPrettyDust2 = Main.dust[Dust.NewDust(Projectile.Center - slowPrettyDustDirect2 * 45f, 0, 0, 240)]; + slowPrettyDust2.noGravity = true; + slowPrettyDust2.position = Projectile.Center - slowPrettyDustDirect2 * Main.rand.Next(30, 41); + slowPrettyDust2.velocity = slowPrettyDustDirect2.RotatedBy(-MathHelper.PiOver2) * 6f; + slowPrettyDust2.scale = 1.2f + Main.rand.NextFloat(); + slowPrettyDust2.fadeIn = 0.5f; + slowPrettyDust2.customData = this; } // Create the vortexes. if (Projectile.ai[0] % 30f == 0f && Projectile.ai[0] < 241f && Main.myPlayer == Projectile.owner) { - Vector2 vector90 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 12f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector90, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner, 0f, Projectile.whoAmI); + Vector2 randomProjRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randomProjRotate, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner, 0f, Projectile.whoAmI); } // Homing. - Vector2 vector91 = Projectile.Center; - float num915 = 1200f; - bool flag49 = false; - int num916 = 0; + Vector2 projCenter = Projectile.Center; + float homingRange = 1200f; + bool isHoming = false; + int npcTrack = 0; if (Projectile.ai[1] == 0f) { for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(this)) { - Vector2 center12 = Main.npc[i].Center; - if (Projectile.Distance(center12) < num915 && Collision.CanHit(new Vector2(Projectile.position.X + Projectile.width / 2, Projectile.position.Y + Projectile.height / 2), 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) + Vector2 npcCenter = Main.npc[i].Center; + if (Projectile.Distance(npcCenter) < homingRange && Collision.CanHit(new Vector2(Projectile.position.X + Projectile.width / 2, Projectile.position.Y + Projectile.height / 2), 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) { - num915 = Projectile.Distance(center12); - vector91 = center12; - flag49 = true; - num916 = i; + homingRange = Projectile.Distance(npcCenter); + projCenter = npcCenter; + isHoming = true; + npcTrack = i; } } } - if (flag49) + if (isHoming) { - if (Projectile.ai[1] != num916 + 1) + if (Projectile.ai[1] != npcTrack + 1) Projectile.netUpdate = true; - Projectile.ai[1] = num916 + 1; + Projectile.ai[1] = npcTrack + 1; } - flag49 = false; + isHoming = false; } if (Projectile.ai[1] != 0f) { - int num918 = (int)(Projectile.ai[1] - 1f); - if (Main.npc[num918].active && Main.npc[num918].CanBeChasedBy(this, ignoreDontTakeDamage: true) && Projectile.Distance(Main.npc[num918].Center) < 1000f) + int npcID = (int)(Projectile.ai[1] - 1f); + if (Main.npc[npcID].active && Main.npc[npcID].CanBeChasedBy(this, ignoreDontTakeDamage: true) && Projectile.Distance(Main.npc[npcID].Center) < 1000f) { - flag49 = true; - vector91 = Main.npc[num918].Center; + isHoming = true; + projCenter = Main.npc[npcID].Center; } } - if (flag49) + if (isHoming) { - float num919 = IntendedVelocity; + float intendedSpeed = IntendedVelocity; int inertia = 12; - Vector2 vector92 = Projectile.Center; - float num921 = vector91.X - vector92.X; - float num922 = vector91.Y - vector92.Y; - float num923 = (float)Math.Sqrt(num921 * num921 + num922 * num922); - num923 = num919 / num923; - num921 *= num923; - num922 *= num923; - Projectile.velocity.X = (Projectile.velocity.X * (inertia - 1) + num921) / inertia; - Projectile.velocity.Y = (Projectile.velocity.Y * (inertia - 1) + num922) / inertia; + Vector2 projCenterHome = Projectile.Center; + float projXDirection = projCenter.X - projCenterHome.X; + float projYDirection = projCenter.Y - projCenterHome.Y; + float projDistance = (float)Math.Sqrt(projXDirection * projXDirection + projYDirection * projYDirection); + projDistance = intendedSpeed / projDistance; + projXDirection *= projDistance; + projYDirection *= projDistance; + Projectile.velocity.X = (Projectile.velocity.X * (inertia - 1) + projXDirection) / inertia; + Projectile.velocity.Y = (Projectile.velocity.Y * (inertia - 1) + projYDirection) / inertia; } break; @@ -289,62 +289,62 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num145 = 0; num145 < 6; num145++) + for (int i = 0; i < 6; i++) { - int num146 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 240, 0f, 0f, 100, default(Color), 1.75f); - Main.dust[num146].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + int blackDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 240, 0f, 0f, 100, default(Color), 1.75f); + Main.dust[blackDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; } - for (int num147 = 0; num147 < 45; num147++) + for (int j = 0; j < 45; j++) { - int num148 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 200, default(Color), 5.05f); - Main.dust[num148].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num148].noGravity = true; - Dust dust = Main.dust[num148]; + int purpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 200, default(Color), 5.05f); + Main.dust[purpleDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[purpleDust].noGravity = true; + Dust dust = Main.dust[purpleDust]; dust.velocity *= 4f; - num148 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 90, 0f, 0f, 100, default(Color), 1.75f); - Main.dust[num148].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust = Main.dust[num148]; + purpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 90, 0f, 0f, 100, default(Color), 1.75f); + Main.dust[purpleDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + dust = Main.dust[purpleDust]; dust.velocity *= 2.5f; - Main.dust[num148].noGravity = true; - Main.dust[num148].fadeIn = 1f; - Main.dust[num148].color = Color.Purple * 0.5f; + Main.dust[purpleDust].noGravity = true; + Main.dust[purpleDust].fadeIn = 1f; + Main.dust[purpleDust].color = Color.Purple * 0.5f; } - for (int num149 = 0; num149 < 15; num149++) + for (int k = 0; k < 15; k++) { - int num150 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 0, default(Color), 3.55f); - Main.dust[num150].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; - Main.dust[num150].noGravity = true; - Dust dust = Main.dust[num150]; + int purpleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 0, default(Color), 3.55f); + Main.dust[purpleDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; + Main.dust[purpleDust2].noGravity = true; + Dust dust = Main.dust[purpleDust2]; dust.velocity *= 4f; } - for (int num151 = 0; num151 < 15; num151++) + for (int l = 0; l < 15; l++) { - int num152 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 240, 0f, 0f, 0, default(Color), 1.75f); - Main.dust[num152].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; - Main.dust[num152].noGravity = true; - Dust dust = Main.dust[num152]; + int blackDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 240, 0f, 0f, 0, default(Color), 1.75f); + Main.dust[blackDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; + Main.dust[blackDust2].noGravity = true; + Dust dust = Main.dust[blackDust2]; dust.velocity *= 4f; } - for (int num153 = 0; num153 < 3; num153++) + for (int m = 0; m < 3; m++) { - int num154 = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position + new Vector2(Projectile.width * Main.rand.Next(100) / 100f, Projectile.height * Main.rand.Next(100) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64)); - Main.gore[num154].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Gore gore = Main.gore[num154]; + int gored = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position + new Vector2(Projectile.width * Main.rand.Next(100) / 100f, Projectile.height * Main.rand.Next(100) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gored].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Gore gore = Main.gore[gored]; gore.velocity *= 0.5f; - Main.gore[num154].velocity.X += Main.rand.Next(-10, 11) * 0.075f; - Main.gore[num154].velocity.Y += Main.rand.Next(-10, 11) * 0.075f; + Main.gore[gored].velocity.X += Main.rand.Next(-10, 11) * 0.075f; + Main.gore[gored].velocity.Y += Main.rand.Next(-10, 11) * 0.075f; } if (Main.myPlayer == Projectile.owner) { - for (int num155 = 0; num155 < Main.maxProjectiles; num155++) + for (int r = 0; r < Main.maxProjectiles; r++) { - if (Main.projectile[num155].active && Main.projectile[num155].type == ModContent.ProjectileType() && Main.projectile[num155].ai[1] == Projectile.whoAmI) - Main.projectile[num155].Kill(); + if (Main.projectile[r].active && Main.projectile[r].type == ModContent.ProjectileType() && Main.projectile[r].ai[1] == Projectile.whoAmI) + Main.projectile[r].Kill(); } int totalProjectiles = Main.rand.Next(6, 9); diff --git a/Projectiles/Magic/NightBolt.cs b/Projectiles/Magic/NightBolt.cs index 7fc9720094..e151d3486d 100644 --- a/Projectiles/Magic/NightBolt.cs +++ b/Projectiles/Magic/NightBolt.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - for (int num447 = 0; num447 < 2; num447++) + for (int i = 0; i < 2; i++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * ((float)i * 0.25f); + int nightDust = Dust.NewDust(projPos, 1, 1, 27, 0f, 0f, 0, default, 1.25f); + Main.dust[nightDust].position = projPos; + Main.dust[nightDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[nightDust].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 353fae39e1..dcf6e13564 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -35,13 +35,13 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 10f && Main.rand.NextBool(3)) { - int num = 6; - for (int index1 = 0; index1 < num; ++index1) + int dustAmt = 6; + for (int i = 0; i < dustAmt; ++i) { - Vector2 vector2_1 = (Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width, (float)Projectile.height) / 2f).RotatedBy((double)(index1 - (num / 2 - 1)) * Math.PI / (double)num, new Vector2()) + Projectile.Center; - Vector2 vector2_2 = ((Main.rand.NextFloat() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int index2 = Dust.NewDust(vector2_1 + vector2_2, 0, 0, 217, vector2_2.X * 2f, vector2_2.Y * 2f, 100, new Color(), 1.4f); - Dust dust = Main.dust[index2]; + Vector2 dustRotation = (Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width, (float)Projectile.height) / 2f).RotatedBy((double)(i - (dustAmt / 2 - 1)) * Math.PI / (double)dustAmt, new Vector2()) + Projectile.Center; + Vector2 randomRotation = ((Main.rand.NextFloat() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int nuclearDust = Dust.NewDust(dustRotation + randomRotation, 0, 0, 217, randomRotation.X * 2f, randomRotation.Y * 2f, 100, new Color(), 1.4f); + Dust dust = Main.dust[nuclearDust]; dust.noGravity = true; dust.noLight = true; dust.velocity /= 4f; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic } Projectile.rotation += Projectile.velocity.X * 0.1f; Projectile.rotation += Projectile.velocity.Y * 0.1f; - int num1 = -1; + int npcID = -1; Vector2 targetVec = Projectile.Center; float maxDistance = 500f; if (Projectile.localAI[0] > 0f) @@ -79,19 +79,19 @@ namespace CalamityMod.Projectiles.Magic { maxDistance = npcDist; targetVec = npc.Center; - num1 = index; + npcID = index; } } } - if (num1 >= 0) + if (npcID >= 0) { - Projectile.ai[0] = num1 + 1f; + Projectile.ai[0] = npcID + 1f; Projectile.netUpdate = true; } } if (Projectile.localAI[0] == 0f && Projectile.ai[0] == 0f) Projectile.localAI[0] = 30f; - bool flag = false; + bool isHoming = false; if (Projectile.ai[0] != 0f) { int index = (int)(Projectile.ai[0] - 1); @@ -99,29 +99,29 @@ namespace CalamityMod.Projectiles.Magic { if ((Math.Abs(Projectile.Center.X - Main.npc[index].Center.X) + Math.Abs(Projectile.Center.Y - Main.npc[index].Center.Y)) < 1000f) { - flag = true; + isHoming = true; targetVec = Main.npc[index].Center; } } else { Projectile.ai[0] = 0f; - flag = false; + isHoming = false; Projectile.netUpdate = true; } } - if (flag) + if (isHoming) { - double num3 = (double)(targetVec - Projectile.Center).ToRotation() - (double)Projectile.velocity.ToRotation(); - if (num3 > Math.PI) - num3 -= 2.0 * Math.PI; - if (num3 < -1.0 * Math.PI) - num3 += 2.0 * Math.PI; - Projectile.velocity = Projectile.velocity.RotatedBy(num3 * 0.1, new Vector2()); + double homeVelocity = (double)(targetVec - Projectile.Center).ToRotation() - (double)Projectile.velocity.ToRotation(); + if (homeVelocity > Math.PI) + homeVelocity -= 2.0 * Math.PI; + if (homeVelocity < -1.0 * Math.PI) + homeVelocity += 2.0 * Math.PI; + Projectile.velocity = Projectile.velocity.RotatedBy(homeVelocity * 0.1, new Vector2()); } - float num4 = Projectile.velocity.Length(); + float projSpeed = Projectile.velocity.Length(); Projectile.velocity.Normalize(); - Projectile.velocity = Projectile.velocity * (num4 + 1f / 400f); + Projectile.velocity = Projectile.velocity * (projSpeed + 1f / 400f); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Magic/ParticleBeamofDoom.cs b/Projectiles/Magic/ParticleBeamofDoom.cs index 3074764e13..9f9892d94d 100644 --- a/Projectiles/Magic/ParticleBeamofDoom.cs +++ b/Projectiles/Magic/ParticleBeamofDoom.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 2.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * 0.25f; + int particleDust = Dust.NewDust(projPos, 1, 1, 206, 0f, 0f, 0, default, 2.5f); + Main.dust[particleDust].position = projPos; + Main.dust[particleDust].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 6e656852a9..8cb79d5db9 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -50,12 +50,12 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0.25f); - for (int num457 = 0; num457 < 3; num457++) + for (int i = 0; i < 3; i++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int spectre = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 2f); + Main.dust[spectre].noGravity = true; + Main.dust[spectre].velocity *= 0.5f; + Main.dust[spectre].velocity += Projectile.velocity * 0.1f; } Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index df91d37233..17efcbd8a3 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); - for (int num457 = 0; num457 < 2; num457++) + for (int i = 0; i < 2; i++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; + int spectre = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1f); + Main.dust[spectre].noGravity = true; } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index 3db5038dab..e30b11763e 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -37,15 +37,15 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.alpha == 0) { - int num159 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 163, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); - Main.dust[num159].noGravity = true; - Main.dust[num159].velocity *= 0.6f; - Main.dust[num159].velocity -= Projectile.velocity * 0.4f; + int plagued = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 163, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); + Main.dust[plagued].noGravity = true; + Main.dust[plagued].velocity *= 0.6f; + Main.dust[plagued].velocity -= Projectile.velocity * 0.4f; - int num160 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 205, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); - Main.dust[num160].noGravity = true; - Main.dust[num160].velocity *= 0.2f; - Main.dust[num160].velocity -= Projectile.velocity * 0.4f; + int venomed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 205, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); + Main.dust[venomed].noGravity = true; + Main.dust[venomed].velocity *= 0.2f; + Main.dust[venomed].velocity -= Projectile.velocity * 0.4f; } } @@ -61,15 +61,15 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - for (int num301 = 0; num301 < 7; num301++) + for (int i = 0; i < 7; i++) { - int num302 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 163, 0f, 0f, 100, default, 1f); - Main.dust[num302].noGravity = true; - Main.dust[num302].velocity *= 1.2f; - Main.dust[num302].velocity -= Projectile.oldVelocity * 0.3f; + int killPlague = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 163, 0f, 0f, 100, default, 1f); + Main.dust[killPlague].noGravity = true; + Main.dust[killPlague].velocity *= 1.2f; + Main.dust[killPlague].velocity -= Projectile.oldVelocity * 0.3f; - int num402 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 205, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num402]; + int killVenom = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 205, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[killVenom]; dust.noGravity = true; dust.velocity *= 1.2f; dust.velocity -= Projectile.oldVelocity * 0.3f; diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index 8a4b6da295..2c90f26dfb 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -38,15 +38,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { - for (int num447 = 0; num447 < 4; num447++) + for (int i = 0; i < 4; i++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.75f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; + int purpDust = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 0.75f); + Main.dust[purpDust].position = projPos; + Main.dust[purpDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[purpDust].velocity *= 0.2f; } } } diff --git a/Projectiles/Magic/PlasmaRay2.cs b/Projectiles/Magic/PlasmaRay2.cs index c5dde3aa01..b055d0643a 100644 --- a/Projectiles/Magic/PlasmaRay2.cs +++ b/Projectiles/Magic/PlasmaRay2.cs @@ -36,15 +36,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { - for (int num447 = 0; num447 < 4; num447++) + for (int i = 0; i < 4; i++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; + int purpDust = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 0.25f); + Main.dust[purpDust].position = projPos; + Main.dust[purpDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[purpDust].velocity *= 0.2f; } } } diff --git a/Projectiles/Magic/RougeSlashLarge.cs b/Projectiles/Magic/RougeSlashLarge.cs index 766bd2f43c..f20b716ac9 100644 --- a/Projectiles/Magic/RougeSlashLarge.cs +++ b/Projectiles/Magic/RougeSlashLarge.cs @@ -43,15 +43,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - int num9 = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = Projectile.Center + vector3; - Main.dust[num9].velocity = Projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f; + dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); + dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + int rougeDust = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + Main.dust[rougeDust].scale = 1.1f; + Main.dust[rougeDust].noGravity = true; + Main.dust[rougeDust].position = Projectile.Center + dustRotation; + Main.dust[rougeDust].velocity = Projectile.velocity * 0.1f; + Main.dust[rougeDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[rougeDust].position) * 1.25f; } } } diff --git a/Projectiles/Magic/RougeSlashMedium.cs b/Projectiles/Magic/RougeSlashMedium.cs index 41dc229957..a2cdc52869 100644 --- a/Projectiles/Magic/RougeSlashMedium.cs +++ b/Projectiles/Magic/RougeSlashMedium.cs @@ -43,15 +43,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - int num9 = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = Projectile.Center + vector3; - Main.dust[num9].velocity = Projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f; + dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); + dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + int rougeDust = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + Main.dust[rougeDust].scale = 1.1f; + Main.dust[rougeDust].noGravity = true; + Main.dust[rougeDust].position = Projectile.Center + dustRotation; + Main.dust[rougeDust].velocity = Projectile.velocity * 0.1f; + Main.dust[rougeDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[rougeDust].position) * 1.25f; } } } diff --git a/Projectiles/Magic/RougeSlashSmall.cs b/Projectiles/Magic/RougeSlashSmall.cs index c1236edf92..be03e06883 100644 --- a/Projectiles/Magic/RougeSlashSmall.cs +++ b/Projectiles/Magic/RougeSlashSmall.cs @@ -43,15 +43,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - int num9 = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = Projectile.Center + vector3; - Main.dust[num9].velocity = Projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f; + dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); + dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + int rougeDust = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + Main.dust[rougeDust].scale = 1.1f; + Main.dust[rougeDust].noGravity = true; + Main.dust[rougeDust].position = Projectile.Center + dustRotation; + Main.dust[rougeDust].velocity = Projectile.velocity * 0.1f; + Main.dust[rougeDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[rougeDust].position) * 1.25f; } } } diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index f42e51aeca..0e15e88b72 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(Projectile.Center, 1f * num, 0.2f * num, 0.75f * num); + float lights = (float)Main.rand.Next(90, 111) * 0.01f; + lights *= Main.essScale; + Lighting.AddLight(Projectile.Center, 1f * lights, 0.2f * lights, 0.75f * lights); Projectile.alpha -= 2; Projectile.frameCounter++; if (Projectile.frameCounter > 4) @@ -64,25 +64,25 @@ namespace CalamityMod.Projectiles.Magic } Projectile.velocity.X *= 0.985f; Projectile.velocity.Y *= 0.985f; - float num472 = Projectile.Center.X; - float num473 = Projectile.Center.Y; - float num474 = 250f; - bool flag17 = false; - for (int num475 = 0; num475 < Main.maxNPCs; num475++) + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + float explodeRange = 250f; + bool canExplode = false; + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num475].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + if (Main.npc[i].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num476) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num477); - if (num478 < num474) + float npcX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float npcY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); + if (npcDist < explodeRange) { - num474 = num478; - flag17 = true; + explodeRange = npcDist; + canExplode = true; } } } - if (flag17) + if (canExplode) { explosionTimer--; if (explosionTimer <= 0) @@ -100,9 +100,9 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/SHPExplosion.cs b/Projectiles/Magic/SHPExplosion.cs index 50782c0b7e..1534873dc1 100644 --- a/Projectiles/Magic/SHPExplosion.cs +++ b/Projectiles/Magic/SHPExplosion.cs @@ -25,31 +25,31 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(Projectile.Center, 5f * num, 1f * num, 4f * num); - float num461 = 25f; + float lights = (float)Main.rand.Next(90, 111) * 0.01f; + lights *= Main.essScale; + Lighting.AddLight(Projectile.Center, 5f * lights, 1f * lights, 4f * lights); + float projTimer = 25f; if (Projectile.ai[0] > 180f) { - num461 -= (Projectile.ai[0] - 180f) / 2f; + projTimer -= (Projectile.ai[0] - 180f) / 2f; } - if (num461 <= 0f) + if (projTimer <= 0f) { - num461 = 0f; + projTimer = 0f; Projectile.Kill(); } - num461 *= 0.7f; + projTimer *= 0.7f; Projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) + int timerCounter = 0; + while ((float)timerCounter < projTimer) { - float num463 = (float)Main.rand.Next(-40, 41); - float num464 = (float)Main.rand.Next(-40, 41); - float num465 = (float)Main.rand.Next(12, 36); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; + float rando1 = (float)Main.rand.Next(-40, 41); + float rando2 = (float)Main.rand.Next(-40, 41); + float rando3 = (float)Main.rand.Next(12, 36); + float randoAdjust = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjust = rando3 / randoAdjust; + rando1 *= randoAdjust; + rando2 *= randoAdjust; int randomDust = Main.rand.Next(3); if (randomDust == 0) { @@ -63,17 +63,17 @@ namespace CalamityMod.Projectiles.Magic { randomDust = 187; } - int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = Projectile.Center.X; - Main.dust[num467].position.Y = Projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; + int EXPLODE = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 2f); + Main.dust[EXPLODE].noGravity = true; + Main.dust[EXPLODE].position.X = Projectile.Center.X; + Main.dust[EXPLODE].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[EXPLODE]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; + Dust expr_14A09_cp_0 = Main.dust[EXPLODE]; expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; + Main.dust[EXPLODE].velocity.X = rando1; + Main.dust[EXPLODE].velocity.Y = rando2; + timerCounter++; } } } diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index 018a0d42a2..db74a57ca1 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -31,19 +31,18 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; } Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0.5f, 0.2f, 0.5f); - float num55 = 100f; - float num56 = 3f; + float timerIncr = 3f; if (Projectile.ai[1] == 0f) { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) + Projectile.localAI[0] += timerIncr; + if (Projectile.localAI[0] > 100f) { - Projectile.localAI[0] = num55; + Projectile.localAI[0] = 100f; } } else { - Projectile.localAI[0] -= num56; + Projectile.localAI[0] -= timerIncr; if (Projectile.localAI[0] <= 0f) { Projectile.Kill(); diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 73fe0a05ce..6d55863898 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -66,23 +66,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 10; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num621 = 0; num621 < 3; num621++) + for (int i = 0; i < 3; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.2f); + Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[brimDust].scale = 0.5f; + Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 6; num623++) + for (int j = 0; j < 6; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.7f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Main.dust[brimDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/SerpentineBody.cs b/Projectiles/Magic/SerpentineBody.cs index 010583229c..297b1838a2 100644 --- a/Projectiles/Magic/SerpentineBody.cs +++ b/Projectiles/Magic/SerpentineBody.cs @@ -30,36 +30,35 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.55f / 255f, (255 - Projectile.alpha) * 0.55f / 255f); - int num1051 = 10; - Vector2 value68 = Vector2.Zero; + Vector2 zeroing = Vector2.Zero; if (Projectile.ai[1] == 1f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; } int chase = Projectile.GetByUUID(Projectile.owner, (int)Projectile.ai[0]); - float num1064; - float scaleFactor17; - float scaleFactor18; + float projRotation; + float sixteenScale; + float projScale; if (chase >= 0 && Main.projectile[chase].active) { - value68 = Main.projectile[chase].Center; + zeroing = Main.projectile[chase].Center; Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; + projRotation = Main.projectile[chase].rotation; + projScale = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + sixteenScale = 16f; Main.projectile[chase].localAI[0] = Projectile.localAI[0] + 1f; } else { for (int k = 0; k < 8; k++) { - int num114 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num114]; + int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); + Dust dust = Main.dust[seaDust]; dust.velocity *= 0.3f; - Main.dust[num114].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; + Main.dust[seaDust].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[seaDust].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[seaDust].noGravity = true; } Projectile.active = false; Projectile.Kill(); @@ -74,22 +73,22 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; } Projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - Projectile.Center; - if (num1064 != Projectile.rotation) + Vector2 rotateInLine = zeroing - Projectile.Center; + if (projRotation != Projectile.rotation) { - float num1068 = MathHelper.WrapAngle(num1064 - Projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); + float angleWrap = MathHelper.WrapAngle(projRotation - Projectile.rotation); + rotateInLine = rotateInLine.RotatedBy((double)(angleWrap * 0.1f), default); } - Projectile.rotation = vector134.ToRotation() + 1.57079637f; + Projectile.rotation = rotateInLine.ToRotation() + 1.57079637f; Projectile.position = Projectile.Center; - Projectile.scale = scaleFactor18; - Projectile.width = Projectile.height = (int)((float)num1051 * Projectile.scale); + Projectile.scale = projScale; + Projectile.width = Projectile.height = (int)(10f * Projectile.scale); Projectile.Center = Projectile.position; - if (vector134 != Vector2.Zero) + if (rotateInLine != Vector2.Zero) { - Projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + Projectile.Center = zeroing - Vector2.Normalize(rotateInLine) * sixteenScale * projScale; } - Projectile.spriteDirection = (vector134.X > 0f) ? 1 : -1; + Projectile.spriteDirection = (rotateInLine.X > 0f) ? 1 : -1; return; } } diff --git a/Projectiles/Magic/SerpentineHead.cs b/Projectiles/Magic/SerpentineHead.cs index b71004de06..5c3a143011 100644 --- a/Projectiles/Magic/SerpentineHead.cs +++ b/Projectiles/Magic/SerpentineHead.cs @@ -40,12 +40,12 @@ namespace CalamityMod.Projectiles.Magic { Projectile.alpha = 0; } - int num114 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num114]; + int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); + Dust dust = Main.dust[seaDust]; dust.velocity *= 0.3f; - Main.dust[num114].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; + Main.dust[seaDust].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[seaDust].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[seaDust].noGravity = true; Projectile.rotation = Projectile.velocity.ToRotation() + 1.57079637f; int direction = Projectile.direction; Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0f) ? 1 : -1; @@ -53,9 +53,9 @@ namespace CalamityMod.Projectiles.Magic { Projectile.netUpdate = true; } - float num1061 = MathHelper.Clamp(Projectile.localAI[0], 0f, 50f); + float scaleClamp = MathHelper.Clamp(Projectile.localAI[0], 0f, 50f); Projectile.position = Projectile.Center; - Projectile.scale = 1f + num1061 * 0.01f; + Projectile.scale = 1f + scaleClamp * 0.01f; Projectile.width = Projectile.height = (int)(10 * Projectile.scale); Projectile.Center = Projectile.position; @@ -76,70 +76,69 @@ namespace CalamityMod.Projectiles.Magic { if (Main.player[Projectile.owner].channel) { - float num115 = 18f; - Vector2 vector10 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; + float chaseMouseDist = 18f; + Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float mouseX = (float)Main.mouseX + Main.screenPosition.X - projDirection.X; + float mouseY = (float)Main.mouseY + Main.screenPosition.Y - projDirection.Y; if (Main.player[Projectile.owner].gravDir == -1f) { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; + mouseY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projDirection.Y; } - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (num118 > num115) + float mouseDist = (float)Math.Sqrt((double)(mouseX * mouseX + mouseY * mouseY)); + mouseDist = (float)Math.Sqrt((double)(mouseX * mouseX + mouseY * mouseY)); + if (mouseDist > chaseMouseDist) { - num118 = num115 / num118; - num116 *= num118; - num117 *= num118; - int num119 = (int)(num116 * 1000f); - int num120 = (int)(Projectile.velocity.X * 1000f); - int num121 = (int)(num117 * 1000f); - int num122 = (int)(Projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) + mouseDist = chaseMouseDist / mouseDist; + mouseX *= mouseDist; + mouseY *= mouseDist; + int xVelocity = (int)(mouseX * 1000f); + int exaggeratedXVelocity = (int)(Projectile.velocity.X * 1000f); + int yVelocity = (int)(mouseY * 1000f); + int exaggeratedYVelocity = (int)(Projectile.velocity.Y * 1000f); + if (xVelocity != exaggeratedXVelocity || yVelocity != exaggeratedYVelocity) { Projectile.netUpdate = true; } - Projectile.velocity.X = num116; - Projectile.velocity.Y = num117; + Projectile.velocity.X = mouseX; + Projectile.velocity.Y = mouseY; } else { - int num123 = (int)(num116 * 1000f); - int num124 = (int)(Projectile.velocity.X * 1000f); - int num125 = (int)(num117 * 1000f); - int num126 = (int)(Projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) + int xVel = (int)(mouseX * 1000f); + int exagXVel = (int)(Projectile.velocity.X * 1000f); + int yVel = (int)(mouseY * 1000f); + int exagYVel = (int)(Projectile.velocity.Y * 1000f); + if (xVel != exagXVel || yVel != exagYVel) { Projectile.netUpdate = true; } - Projectile.velocity.X = num116; - Projectile.velocity.Y = num117; + Projectile.velocity.X = mouseX; + Projectile.velocity.Y = mouseY; } } else if (Projectile.ai[0] <= 0f) { Projectile.netUpdate = true; - float num127 = 12f; - Vector2 vector11 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + Vector2 faceDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float miceX = (float)Main.mouseX + Main.screenPosition.X - faceDirection.X; + float miceY = (float)Main.mouseY + Main.screenPosition.Y - faceDirection.Y; if (Main.player[Projectile.owner].gravDir == -1f) { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + miceY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - faceDirection.Y; } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || Projectile.ai[0] < 0f) + float miceDist = (float)Math.Sqrt((double)(miceX * miceX + miceY * miceY)); + if (miceDist == 0f || Projectile.ai[0] < 0f) { - vector11 = new Vector2(Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2), Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2)); - num128 = Projectile.position.X + (float)Projectile.width * 0.5f - vector11.X; - num129 = Projectile.position.Y + (float)Projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + faceDirection = new Vector2(Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2), Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2)); + miceX = Projectile.position.X + (float)Projectile.width * 0.5f - faceDirection.X; + miceY = Projectile.position.Y + (float)Projectile.height * 0.5f - faceDirection.Y; + miceDist = (float)Math.Sqrt((double)(miceX * miceX + miceY * miceY)); } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - Projectile.velocity.X = num128; - Projectile.velocity.Y = num129; + miceDist = 12f / miceDist; + miceX *= miceDist; + miceY *= miceDist; + Projectile.velocity.X = miceX; + Projectile.velocity.Y = miceY; if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { Projectile.Kill(); @@ -162,12 +161,12 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 8; k++) { - int num114 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num114]; + int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); + Dust dust = Main.dust[seaDust]; dust.velocity *= 0.3f; - Main.dust[num114].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; + Main.dust[seaDust].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[seaDust].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[seaDust].noGravity = true; } } } diff --git a/Projectiles/Magic/SerpentineTail.cs b/Projectiles/Magic/SerpentineTail.cs index e4b3dd6d90..d6e384de5a 100644 --- a/Projectiles/Magic/SerpentineTail.cs +++ b/Projectiles/Magic/SerpentineTail.cs @@ -30,36 +30,35 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - int num1051 = 10; - Vector2 value68 = Vector2.Zero; + Vector2 zeroing = Vector2.Zero; if (Projectile.ai[1] == 1f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; } int chase = Projectile.GetByUUID(Projectile.owner, (int)Projectile.ai[0]); - float num1064; - float scaleFactor17; - float scaleFactor18; + float projRotation; + float sixteenScale; + float projScale; if (chase >= 0 && Main.projectile[chase].active) { - value68 = Main.projectile[chase].Center; + zeroing = Main.projectile[chase].Center; Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; + projRotation = Main.projectile[chase].rotation; + projScale = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + sixteenScale = 16f; Main.projectile[chase].localAI[0] = Projectile.localAI[0] + 1f; } else { for (int k = 0; k < 8; k++) { - int num114 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num114]; + int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); + Dust dust = Main.dust[seaDust]; dust.velocity *= 0.3f; - Main.dust[num114].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; + Main.dust[seaDust].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[seaDust].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[seaDust].noGravity = true; } Projectile.active = false; Projectile.Kill(); @@ -74,22 +73,22 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 0; } Projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - Projectile.Center; - if (num1064 != Projectile.rotation) + Vector2 rotateInLine = zeroing - Projectile.Center; + if (projRotation != Projectile.rotation) { - float num1068 = MathHelper.WrapAngle(num1064 - Projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); + float angleWrap = MathHelper.WrapAngle(projRotation - Projectile.rotation); + rotateInLine = rotateInLine.RotatedBy((double)(angleWrap * 0.1f), default); } - Projectile.rotation = vector134.ToRotation() + 1.57079637f; + Projectile.rotation = rotateInLine.ToRotation() + 1.57079637f; Projectile.position = Projectile.Center; - Projectile.scale = scaleFactor18; - Projectile.width = Projectile.height = (int)((float)num1051 * Projectile.scale); + Projectile.scale = projScale; + Projectile.width = Projectile.height = (int)(10f * Projectile.scale); Projectile.Center = Projectile.position; - if (vector134 != Vector2.Zero) + if (rotateInLine != Vector2.Zero) { - Projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + Projectile.Center = zeroing - Vector2.Normalize(rotateInLine) * sixteenScale * projScale; } - Projectile.spriteDirection = (vector134.X > 0f) ? 1 : -1; + Projectile.spriteDirection = (rotateInLine.X > 0f) ? 1 : -1; return; } } diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs index 7f2a1bdea8..9bf3b72a10 100644 --- a/Projectiles/Magic/ShadeNimbus.cs +++ b/Projectiles/Magic/ShadeNimbus.cs @@ -53,9 +53,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[0] = 0f; if (Projectile.owner == Main.myPlayer) { - int num414 = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); - int num415 = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); + int rainX = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int rainY = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)rainX, (float)rainY, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index 7027bd4cae..f224c93e2e 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -28,10 +28,10 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(4)) { - int num300 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 70, 0f, 0f, 0, default, 1f); - Main.dust[num300].noGravity = true; - Main.dust[num300].velocity *= 0.2f; - Main.dust[num300].scale *= 0.8f; + int crystalDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 70, 0f, 0f, 0, default, 1f); + Main.dust[crystalDust].noGravity = true; + Main.dust[crystalDust].velocity *= 0.2f; + Main.dust[crystalDust].scale *= 0.8f; } Projectile.velocity *= 0.99f; diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index fd49a0a11a..6fee215392 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -55,15 +55,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { - for (int num447 = 0; num447 < 4; num447++) + for (int i = 0; i < 4; i++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; + int shadowDust = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 1f); + Main.dust[shadowDust].position = projPos; + Main.dust[shadowDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[shadowDust].velocity *= 0.2f; } } } diff --git a/Projectiles/Magic/Snowball.cs b/Projectiles/Magic/Snowball.cs index 5e776b8acd..cf0c9f0d3c 100644 --- a/Projectiles/Magic/Snowball.cs +++ b/Projectiles/Magic/Snowball.cs @@ -38,15 +38,15 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(SoundID.Item27, Projectile.position); //crystal bullet shards - for (int index1 = 0; index1 < 10; ++index1) + for (int i = 0; i < 10; ++i) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1f); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 2f; + int snow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + Main.dust[snow].noGravity = true; + Main.dust[snow].velocity *= 2f; } if (Projectile.owner == Main.myPlayer) { - for (int index = 0; index < 6; ++index) + for (int j = 0; j < 6; ++j) { float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; diff --git a/Projectiles/Magic/SoulPiercerBeam.cs b/Projectiles/Magic/SoulPiercerBeam.cs index 27bc43185f..32865cc081 100644 --- a/Projectiles/Magic/SoulPiercerBeam.cs +++ b/Projectiles/Magic/SoulPiercerBeam.cs @@ -28,13 +28,13 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity; Projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.014f; - Main.dust[num448].velocity *= 0.2f; + int godSlay = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 0.5f); + Main.dust[godSlay].position = projPos; + Main.dust[godSlay].scale = Main.rand.Next(70, 110) * 0.014f; + Main.dust[godSlay].velocity *= 0.2f; } } diff --git a/Projectiles/Magic/SoulPiercerBolt.cs b/Projectiles/Magic/SoulPiercerBolt.cs index bef8d1b01c..6d7e9ad409 100644 --- a/Projectiles/Magic/SoulPiercerBolt.cs +++ b/Projectiles/Magic/SoulPiercerBolt.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.014f; - Main.dust[num448].velocity *= 0.2f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity; + int godSlay = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 0.5f); + Main.dust[godSlay].position = projPos; + Main.dust[godSlay].scale = Main.rand.Next(70, 110) * 0.014f; + Main.dust[godSlay].velocity *= 0.2f; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Magic/Starblast.cs b/Projectiles/Magic/Starblast.cs index 53e54487b9..fe398010f4 100644 --- a/Projectiles/Magic/Starblast.cs +++ b/Projectiles/Magic/Starblast.cs @@ -38,21 +38,21 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(4)) { - int num193 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); - Main.dust[num193].position = Projectile.Center; - Main.dust[num193].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num193].noGravity = true; - Dust expr_835F_cp_0 = Main.dust[num193]; + int stardust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + Main.dust[stardust].position = Projectile.Center; + Main.dust[stardust].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[stardust].noGravity = true; + Dust expr_835F_cp_0 = Main.dust[stardust]; expr_835F_cp_0.velocity.Y -= 2f; } if (Main.rand.NextBool(6)) { - int num194 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 176, 0f, 0f, 100, default, 1f); - Main.dust[num194].position = Projectile.Center; - Main.dust[num194].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num194].noGravity = true; - Main.dust[num194].velocity *= 0.1f; + int stardustier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 176, 0f, 0f, 100, default, 1f); + Main.dust[stardustier].position = Projectile.Center; + Main.dust[stardustier].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[stardustier].noGravity = true; + Main.dust[stardustier].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index ec8cc0d3e1..4bff0a1df1 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -49,23 +49,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 50; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int blueDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.2f); + Main.dust[blueDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[blueDust].scale = 0.5f; + Main.dust[blueDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 30; num623++) + for (int j = 0; j < 30; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int blueDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.7f); + Main.dust[blueDust2].noGravity = true; + Main.dust[blueDust2].velocity *= 5f; + blueDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + Main.dust[blueDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/SupremeDustFlakProjectile.cs b/Projectiles/Magic/SupremeDustFlakProjectile.cs index 2fdfceee12..3da2e15002 100644 --- a/Projectiles/Magic/SupremeDustFlakProjectile.cs +++ b/Projectiles/Magic/SupremeDustFlakProjectile.cs @@ -25,25 +25,25 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); if (Projectile.ai[0] > 7f) { - float num296 = 1f; + float dustScale = 1f; if (Projectile.ai[0] == 8f) { - num296 = 0.25f; + dustScale = 0.25f; } else if (Projectile.ai[0] == 9f) { - num296 = 0.5f; + dustScale = 0.5f; } else if (Projectile.ai[0] == 10f) { - num296 = 0.75f; + dustScale = 0.75f; } Projectile.ai[0] += 1f; - int num297 = 32; - for (int num298 = 0; num298 < 2; num298++) + int dustType = 32; + for (int i = 0; i < 2; i++) { - int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[num299]; + int earthyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[earthyDust]; if (Main.rand.NextBool(3)) { dust.noGravity = false; @@ -57,12 +57,12 @@ namespace CalamityMod.Projectiles.Magic } dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; - dust.scale *= num296; + dust.scale *= dustScale; } - for (int num298 = 0; num298 < 2; num298++) + for (int i = 0; i < 2; i++) { - int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[num299]; + int earthyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[earthyDust]; if (Main.rand.NextBool(3)) { dust.noGravity = false; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Magic } dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; - dust.scale *= num296; + dust.scale *= dustScale; } } else diff --git a/Projectiles/Magic/SupremeDustProjectile.cs b/Projectiles/Magic/SupremeDustProjectile.cs index 1cf678f1eb..4eb19e2b62 100644 --- a/Projectiles/Magic/SupremeDustProjectile.cs +++ b/Projectiles/Magic/SupremeDustProjectile.cs @@ -27,23 +27,23 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.95f / 255f, (255 - Projectile.alpha) * 0.85f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); if (Projectile.ai[0] > 7f) { - float num296 = 1f; + float dustScale = 1f; if (Projectile.ai[0] == 8f) { - num296 = 0.25f; + dustScale = 0.25f; } else if (Projectile.ai[0] == 9f) { - num296 = 0.5f; + dustScale = 0.5f; } else if (Projectile.ai[0] == 10f) { - num296 = 0.75f; + dustScale = 0.75f; } Projectile.ai[0] += 1f; - int num297 = 32; - int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[num299]; + int dustType = 32; + int earthyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[earthyDust]; if (Main.rand.NextBool()) { dust.noGravity = true; @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Magic } dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; - dust.scale *= num296; - int num399 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust2 = Main.dust[num399]; + dust.scale *= dustScale; + int earthyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust2 = Main.dust[earthyDust2]; if (Main.rand.NextBool(3)) { dust2.noGravity = true; @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Magic } dust2.velocity.X *= 1.2f; dust2.velocity.Y *= 1.2f; - dust2.scale *= num296; + dust2.scale *= dustScale; } else { diff --git a/Projectiles/Magic/ThunderstormShot.cs b/Projectiles/Magic/ThunderstormShot.cs index baa325157d..b023cbf19a 100644 --- a/Projectiles/Magic/ThunderstormShot.cs +++ b/Projectiles/Magic/ThunderstormShot.cs @@ -27,18 +27,18 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[0] += 1f; if (Projectile.ai[0] > 9f) { - for (int num121 = 0; num121 < 5; num121++) + for (int i = 0; i < 5; i++) { - 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.noGravity = true; - dust.noLight = true; - Dust dust2 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; - dust2.velocity = Vector2.Zero; - dust2.position -= Projectile.velocity / 5f * (float)num121; - dust2.noGravity = true; - dust2.noLight = true; + Dust greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + greenDust.velocity = Vector2.Zero; + greenDust.position -= Projectile.velocity / 5f * (float)i; + greenDust.noGravity = true; + greenDust.noLight = true; + Dust lightningDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + lightningDust.velocity = Vector2.Zero; + lightningDust.position -= Projectile.velocity / 5f * (float)i; + lightningDust.noGravity = true; + lightningDust.noLight = true; } } } @@ -52,26 +52,26 @@ namespace CalamityMod.Projectiles.Magic CalamityUtils.ProjectileRain(source, Projectile.Center, 200f, 100f, 1500f, 1500f, 29f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } Projectile.ExpandHitboxBy(36); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int j = 0; j < dustAmt; j++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 1f; //0.75 - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default, 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 1f; //0.75 + dustRotate = dustRotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 dustDirection = dustRotate - Projectile.Center; + int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 229, dustDirection.X, dustDirection.Y, 100, default, 1.2f); + Main.dust[killDust].noGravity = true; + Main.dust[killDust].noLight = true; + Main.dust[killDust].velocity = dustDirection; } - for (int num227 = 0; num227 < num226; num227++) + for (int j = 0; j < dustAmt; j++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default, 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustRotate = dustRotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 dustDirection = dustRotate - Projectile.Center; + int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 107, dustDirection.X, dustDirection.Y, 100, default, 1.2f); + Main.dust[killDust].noGravity = true; + Main.dust[killDust].noLight = true; + Main.dust[killDust].velocity = dustDirection; } Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; diff --git a/Projectiles/Magic/ThunderstormShotSplit.cs b/Projectiles/Magic/ThunderstormShotSplit.cs index ed237b15f7..6fbee3472d 100644 --- a/Projectiles/Magic/ThunderstormShotSplit.cs +++ b/Projectiles/Magic/ThunderstormShotSplit.cs @@ -32,16 +32,16 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[0] += 1f; if (Projectile.ai[0] > 6f) { - for (int num121 = 0; num121 < 5; num121++) + for (int i = 0; i < 5; i++) { Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.5f)]; dust.velocity = Vector2.Zero; - dust.position -= Projectile.velocity / 5f * (float)num121; + dust.position -= Projectile.velocity / 5f * (float)i; dust.noGravity = true; dust.noLight = true; Dust dust2 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.5f)]; dust2.velocity = Vector2.Zero; - dust2.position -= Projectile.velocity / 5f * (float)num121; + dust2.position -= Projectile.velocity / 5f * (float)i; dust2.noGravity = true; dust2.noLight = true; } @@ -55,26 +55,26 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = Projectile.height = 16; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int j = 0; j < dustAmt; j++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; //0.75 - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default, 0.6f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; //0.75 + dustRotate = dustRotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 dustDirection = dustRotate - Projectile.Center; + int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 229, dustDirection.X, dustDirection.Y, 100, default, 0.6f); + Main.dust[killDust].noGravity = true; + Main.dust[killDust].noLight = true; + Main.dust[killDust].velocity = dustDirection; } - for (int num227 = 0; num227 < num226; num227++) + for (int j = 0; j < dustAmt; j++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default, 0.6f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; + dustRotate = dustRotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 dustDirection = dustRotate - Projectile.Center; + int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 107, dustDirection.X, dustDirection.Y, 100, default, 0.6f); + Main.dust[killDust].noGravity = true; + Main.dust[killDust].noLight = true; + Main.dust[killDust].velocity = dustDirection; } Projectile.Damage(); } diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index 5f0f16aba1..b0f20140a9 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.alpha < 0) Projectile.alpha = 0; - Vector2 v2 = Projectile.ai[0].ToRotationVector2(); - float num743 = Projectile.velocity.ToRotation(); - float num744 = v2.ToRotation(); - double num745 = num744 - num743; - if (num745 > MathHelper.Pi) - num745 -= MathHelper.TwoPi; - if (num745 < -MathHelper.Pi) - num745 -= -MathHelper.TwoPi; + Vector2 uber = Projectile.ai[0].ToRotationVector2(); + float projRotation = Projectile.velocity.ToRotation(); + float aiRotation = uber.ToRotation(); + double rotationClamp = aiRotation - projRotation; + if (rotationClamp > MathHelper.Pi) + rotationClamp -= MathHelper.TwoPi; + if (rotationClamp < -MathHelper.Pi) + rotationClamp -= -MathHelper.TwoPi; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } @@ -45,13 +45,13 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item96, Projectile.position); - int num190 = Main.rand.Next(4, 6); - for (int num191 = 0; num191 < num190; num191++) + int randDustAmt = Main.rand.Next(4, 6); + for (int i = 0; i < randDustAmt; i++) { - int num192 = Dust.NewDust(Projectile.Center, 0, 0, 171, 0f, 0f, 100, default, 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; + int purpleDust = Dust.NewDust(Projectile.Center, 0, 0, 171, 0f, 0f, 100, default, 1.4f); + Main.dust[purpleDust].velocity *= 0.8f; + Main.dust[purpleDust].position = Vector2.Lerp(Main.dust[purpleDust].position, Projectile.Center, 0.5f); + Main.dust[purpleDust].noGravity = true; } if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Magic/UndinesRetributionSpear.cs b/Projectiles/Magic/UndinesRetributionSpear.cs index dc4918a154..fbd5a1bc29 100644 --- a/Projectiles/Magic/UndinesRetributionSpear.cs +++ b/Projectiles/Magic/UndinesRetributionSpear.cs @@ -43,9 +43,9 @@ namespace CalamityMod.Projectiles.Magic { Projectile.frame = 0; } - float num953 = 25f * Projectile.ai[1]; //100 - float scaleFactor12 = 5f * Projectile.ai[1]; //5 - float num954 = 500f; + float velocityMult = 25f * Projectile.ai[1]; //100 + float velocityScale = 5f * Projectile.ai[1]; //5 + float homingRange = 500f; if (Projectile.velocity.X < 0f) { Projectile.spriteDirection = -1; @@ -59,10 +59,10 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingRange) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Projectile.velocity = (Projectile.velocity * (velocityMult - 1f) + moveDirection * velocityScale) / velocityMult; return; } @@ -101,18 +101,18 @@ namespace CalamityMod.Projectiles.Magic Projectile.damage /= 2; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item21, Projectile.position); - for (int num193 = 0; num193 < 4; num193++) + for (int i = 0; i < 4; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 6; num194++) + for (int j = 0; j < 6; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int undust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[undust].noGravity = true; + Main.dust[undust].velocity *= 3f; + undust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[undust].velocity *= 2f; + Main.dust[undust].noGravity = true; } } } diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 8f4959156a..8e94a8b96f 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -40,12 +40,12 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item73, Projectile.position); Projectile.localAI[0] += 1f; } - for (int num457 = 0; num457 < 3; num457++) + for (int i = 0; i < 3; i++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int venusDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.2f); + Main.dust[venusDust].noGravity = true; + Main.dust[venusDust].velocity *= 0.5f; + Main.dust[venusDust].velocity += Projectile.velocity * 0.1f; } } diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index 197b8b7ffc..1259f76777 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -34,38 +34,38 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item74, Projectile.position); Projectile.localAI[0] += 1f; } - float num461 = 25f; + float projTimer = 25f; if (Projectile.ai[0] > 180f) { - num461 -= (Projectile.ai[0] - 180f) / 2f; + projTimer -= (Projectile.ai[0] - 180f) / 2f; } - if (num461 <= 0f) + if (projTimer <= 0f) { - num461 = 0f; + projTimer = 0f; Projectile.Kill(); } - num461 *= 0.7f; + projTimer *= 0.7f; Projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) + int timerCounter = 0; + while ((float)timerCounter < projTimer) { - float num463 = (float)Main.rand.Next(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - float num466 = (float)Math.Sqrt((double)(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, 55, 0f, 0f, 100, default, 2.5f); - Dust dust = Main.dust[num467]; + float rando1 = (float)Main.rand.Next(-30, 31); + float rando2 = (float)Main.rand.Next(-30, 31); + float rando3 = (float)Main.rand.Next(9, 27); + float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjuster = rando3 / randoAdjuster; + rando1 *= randoAdjuster; + rando2 *= randoAdjuster; + int venusDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 2.5f); + Dust dust = Main.dust[venusDust]; 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; - num462++; + dust.velocity.X = rando1; + dust.velocity.Y = rando2; + timerCounter++; } return; } diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index e2d95e1df8..29f067287f 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -107,8 +107,8 @@ namespace CalamityMod.Projectiles.Magic //Dust if (Main.rand.NextBool(4)) { - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num199]; + int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[venusDust]; dust.position.X -= 2f; dust.position.Y += 2f; dust.scale += (float)Main.rand.Next(50) * 0.01f; @@ -117,8 +117,8 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(10)) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1f); - Dust dust2 = Main.dust[num200]; + int venusDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1f); + Dust dust2 = Main.dust[venusDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index d6af20bd9a..1af449b9f2 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -63,14 +63,14 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { - for (int num447 = 0; num447 < 4; num447++) + for (int i = 0; i < 4; i++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 5, 0f, 0f, 0, default, 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * ((float)i * 0.25f); + int bloody = Dust.NewDust(projPos, 1, 1, 5, 0f, 0f, 0, default, 1f); + Main.dust[bloody].position = projPos; + Main.dust[bloody].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[bloody].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/VividBolt.cs b/Projectiles/Magic/VividBolt.cs index ee89e008bb..dcb2e61d1e 100644 --- a/Projectiles/Magic/VividBolt.cs +++ b/Projectiles/Magic/VividBolt.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2 value7 = new Vector2(5f, 10f); + Vector2 rotateVector = new Vector2(5f, 10f); Projectile.ai[0] += 1f; if (Projectile.ai[0] == 48f) { @@ -33,29 +33,29 @@ namespace CalamityMod.Projectiles.Magic } else { - for (int num41 = 0; num41 < 2; num41++) + for (int i = 0; i < 2; i++) { - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num42].scale = 0.33f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; + Vector2 dustRotation = Vector2.UnitX * -12f; + dustRotation = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector - Projectile.rotation.ToRotationVector2() * 10f; + int exo = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[exo].scale = 0.33f; + Main.dust[exo].noGravity = true; + Main.dust[exo].position = Projectile.Center + dustRotation; + Main.dust[exo].velocity = Projectile.velocity; } } Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num447 = 0; num447 < 2; num447++) + for (int j = 0; j < 2; j++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.01f; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * ((float)j * 0.25f); + int exod = Dust.NewDust(projPos, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[exod].noGravity = true; + Main.dust[exod].position = projPos; + Main.dust[exod].scale = (float)Main.rand.Next(70, 110) * 0.01f; + Main.dust[exod].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/VividClarityBeam.cs b/Projectiles/Magic/VividClarityBeam.cs index 9828fe8c95..c1166dcde3 100644 --- a/Projectiles/Magic/VividClarityBeam.cs +++ b/Projectiles/Magic/VividClarityBeam.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2 value7 = new Vector2(5f, 10f); + Vector2 rotateVector = new Vector2(5f, 10f); Projectile.ai[0] += 1f; if (Projectile.ai[0] == 48f) { @@ -34,15 +34,15 @@ namespace CalamityMod.Projectiles.Magic } else { - for (int num41 = 0; num41 < 2; num41++) + for (int i = 0; i < 2; i++) { - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num42].scale = 0.75f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; + Vector2 dustRotation = Vector2.UnitX * -12f; + dustRotation = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector - Projectile.rotation.ToRotationVector2() * 10f; + int exo = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[exo].scale = 0.75f; + Main.dust[exo].noGravity = true; + Main.dust[exo].position = Projectile.Center + dustRotation; + Main.dust[exo].velocity = Projectile.velocity; } } @@ -56,15 +56,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num447 = 0; num447 < 2; num447++) + for (int j = 0; j < 2; j++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * ((float)j * 0.25f); + int exod = Dust.NewDust(projPos, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[exod].noGravity = true; + Main.dust[exod].position = projPos; + Main.dust[exod].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[exod].velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs index 1d38608d9c..ec6e500815 100644 --- a/Projectiles/Magic/VividLaser2.cs +++ b/Projectiles/Magic/VividLaser2.cs @@ -27,13 +27,13 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[1] += 1f; for (int dust = 0; dust < 2; dust++) { - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[1] * 0.1308997f + (float)dust * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num42].scale = 0.75f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; + Vector2 dustPosOffset = Vector2.UnitX * -12f; + dustPosOffset = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[1] * 0.1308997f + (float)dust * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; + int exo = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[exo].scale = 0.75f; + Main.dust[exo].noGravity = true; + Main.dust[exo].position = Projectile.Center + dustPosOffset; + Main.dust[exo].velocity = Projectile.velocity; } if (Projectile.timeLeft < 110) diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index c02572f62e..e233e503e0 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.timeLeft < 30) { - float num7 = Projectile.timeLeft / 30f; - Projectile.alpha = (int)(255f - 255f * num7); + float timerAlpha = Projectile.timeLeft / 30f; + Projectile.alpha = (int)(255f - 255f * timerAlpha); } return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } @@ -70,9 +70,9 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/WaterStream.cs b/Projectiles/Magic/WaterStream.cs index 4fd299cc10..1bf9eeb6e7 100644 --- a/Projectiles/Magic/WaterStream.cs +++ b/Projectiles/Magic/WaterStream.cs @@ -46,25 +46,25 @@ namespace CalamityMod.Projectiles.Magic return; } Projectile.velocity.Y = Projectile.velocity.Y + 0.075f; - for (int num151 = 0; num151 < 3; num151++) + for (int i = 0; i < 3; i++) { - float num152 = Projectile.velocity.X / 3f * (float)num151; - float num153 = Projectile.velocity.Y / 3f * (float)num151; - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num154, Projectile.position.Y + (float)num154), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); - Dust dust = Main.dust[num155]; + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int dustPosOffset = 14; + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosOffset, Projectile.position.Y + (float)dustPosOffset), Projectile.width - dustPosOffset * 2, Projectile.height - dustPosOffset * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust dust = Main.dust[waterDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.5f; - dust.position.X -= num152; - dust.position.Y -= num153; + dust.position.X -= shortXVel; + dust.position.Y -= shortYVel; } if (Main.rand.NextBool(8)) { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num156, Projectile.position.Y + (float)num156), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; + int extraDustPosOffset = 16; + int extraWaterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)extraDustPosOffset, Projectile.position.Y + (float)extraDustPosOffset), Projectile.width - extraDustPosOffset * 2, Projectile.height - extraDustPosOffset * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); + Main.dust[extraWaterDust].velocity *= 0.25f; + Main.dust[extraWaterDust].velocity += Projectile.velocity * 0.5f; } } } diff --git a/Projectiles/Magic/WaterStream2.cs b/Projectiles/Magic/WaterStream2.cs index b4b97c5fec..0a5f47897c 100644 --- a/Projectiles/Magic/WaterStream2.cs +++ b/Projectiles/Magic/WaterStream2.cs @@ -34,25 +34,25 @@ namespace CalamityMod.Projectiles.Magic return; } Projectile.velocity.Y = Projectile.velocity.Y + 0.075f; - for (int num151 = 0; num151 < 3; num151++) + for (int i = 0; i < 3; i++) { - float num152 = Projectile.velocity.X / 3f * (float)num151; - float num153 = Projectile.velocity.Y / 3f * (float)num151; - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num154, Projectile.position.Y + (float)num154), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); - Dust dust = Main.dust[num155]; + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int dustPosOffset = 14; + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosOffset, Projectile.position.Y + (float)dustPosOffset), Projectile.width - dustPosOffset * 2, Projectile.height - dustPosOffset * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust dust = Main.dust[waterDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.5f; - dust.position.X -= num152; - dust.position.Y -= num153; + dust.position.X -= shortXVel; + dust.position.Y -= shortYVel; } if (Main.rand.NextBool(8)) { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num156, Projectile.position.Y + (float)num156), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; + int extraDustPosOffset = 16; + int extraWaterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)extraDustPosOffset, Projectile.position.Y + (float)extraDustPosOffset), Projectile.width - extraDustPosOffset * 2, Projectile.height - extraDustPosOffset * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); + Main.dust[extraWaterDust].velocity *= 0.25f; + Main.dust[extraWaterDust].velocity += Projectile.velocity * 0.5f; } } } diff --git a/Projectiles/Magic/WaywasherProj.cs b/Projectiles/Magic/WaywasherProj.cs index ac620bd33a..aec8731d96 100644 --- a/Projectiles/Magic/WaywasherProj.cs +++ b/Projectiles/Magic/WaywasherProj.cs @@ -25,25 +25,25 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f * (float)Projectile.direction; Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); - for (int num105 = 0; num105 < 2; num105++) + for (int i = 0; i < 2; i++) { - float num99 = Projectile.velocity.X / 3f * (float)num105; - float num100 = Projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); - Dust dust = Main.dust[num102]; + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int fourConst = 4; + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); + Dust dust = Main.dust[waterDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= num99; - dust.position.Y -= num100; + dust.position.X -= shortXVel; + dust.position.Y -= shortYVel; } if (Main.rand.NextBool(5)) { - int num103 = 4; - int num104 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num103, Projectile.position.Y + (float)num103), Projectile.width - num103 * 2, Projectile.height - num103 * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += Projectile.velocity * 0.5f; + int otherFourConst = 4; + int otherWaterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); + Main.dust[otherWaterDust].velocity *= 0.25f; + Main.dust[otherWaterDust].velocity += Projectile.velocity * 0.5f; } if (Projectile.velocity.Y > 16f) { diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index 8264185eec..30d3a863a3 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -47,23 +47,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int greenDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1.2f); + Main.dust[greenDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[greenDust].scale = 0.5f; + Main.dust[greenDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 30; num623++) + for (int j = 0; j < 30; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int greenDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1.7f); + Main.dust[greenDust2].noGravity = true; + Main.dust[greenDust2].velocity *= 5f; + greenDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1f); + Main.dust[greenDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/WyvernFeatherPink.cs b/Projectiles/Magic/WyvernFeatherPink.cs index 7e7c0e9253..bf713571f4 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -46,23 +46,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int pinkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1.2f); + Main.dust[pinkDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[pinkDust].scale = 0.5f; + Main.dust[pinkDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 30; num623++) + for (int j = 0; j < 30; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int pinkDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1.7f); + Main.dust[pinkDust2].noGravity = true; + Main.dust[pinkDust2].velocity *= 5f; + pinkDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1f); + Main.dust[pinkDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index 0c78e19cd5..d0ac60594d 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -46,23 +46,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int purpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[purpleDust].scale = 0.5f; + Main.dust[purpleDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 30; num623++) + for (int j = 0; j < 30; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int purpleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); + Main.dust[purpleDust2].noGravity = true; + Main.dust[purpleDust2].velocity *= 5f; + purpleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[purpleDust2].velocity *= 2f; } }