From 50ba93cffa3621e1955c9963bfe125b7c3703100 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 18 Oct 2023 09:36:14 -0400 Subject: [PATCH 01/43] Brutally murdered a bunch of num variables in rogue projectiles --- Projectiles/Rogue/BallisticPoisonBombSpike.cs | 28 ++-- Projectiles/Rogue/BrackishWaterBlast.cs | 52 +++---- Projectiles/Rogue/CircletMark.cs | 86 +++++------ Projectiles/Rogue/CircletTornado.cs | 137 +++++++++--------- Projectiles/Rogue/CraniumSMASH.cs | 8 +- Projectiles/Rogue/CraniumSmasherExplosive.cs | 8 +- Projectiles/Rogue/CraniumSmasherStealth.cs | 8 +- Projectiles/Rogue/DeepSeaDumbbell1.cs | 66 ++++----- Projectiles/Rogue/DeepSeaDumbbell2.cs | 66 ++++----- Projectiles/Rogue/DeepSeaDumbbell3.cs | 66 ++++----- Projectiles/Rogue/DeepSeaDumbbellWeight.cs | 16 +- Projectiles/Rogue/DesecratedBubble.cs | 12 +- Projectiles/Rogue/DesecratedWaterProj.cs | 12 +- Projectiles/Rogue/DestructionBolt.cs | 76 +++++----- Projectiles/Rogue/DragonScalesInfernado.cs | 24 +-- Projectiles/Rogue/DukesDecapitatorBubble.cs | 12 +- Projectiles/Rogue/EGloveSpark.cs | 24 +-- Projectiles/Rogue/ElementalDiskSplit.cs | 6 +- Projectiles/Rogue/ExecutionersBladeProj.cs | 22 +-- .../Rogue/ExecutionersBladeStealthProj.cs | 22 +-- Projectiles/Rogue/ExplosiveSun.cs | 22 +-- .../Rogue/GraveGrimreaverProjectile.cs | 18 +-- Projectiles/Rogue/HeavenfallenEnergy.cs | 6 +- .../Rogue/HeavenfallenStardiskBoomerang.cs | 90 ++++++------ Projectiles/Rogue/HypothermiaShard.cs | 6 +- .../Rogue/LeonidProgenitorBombshell.cs | 6 +- Projectiles/Rogue/LunarKunaiProj.cs | 24 +-- Projectiles/Rogue/LuxorsGiftRogue.cs | 18 +-- Projectiles/Rogue/MalachiteBolt.cs | 74 +++++----- Projectiles/Rogue/MalachiteProj.cs | 30 ++-- Projectiles/Rogue/MalachiteStealth.cs | 8 +- Projectiles/Rogue/MoltenBlobThrown.cs | 16 +- Projectiles/Rogue/PrismallineProj.cs | 2 +- Projectiles/Rogue/RadiantExplosion.cs | 41 +++--- Projectiles/Rogue/RadiantStar2.cs | 30 ++-- Projectiles/Rogue/RadiantStarKnife.cs | 22 +-- Projectiles/Rogue/ReaperProjectile.cs | 22 +-- Projectiles/Rogue/RegulusEnergy.cs | 20 +-- Projectiles/Rogue/ScarletBlast.cs | 52 +++---- Projectiles/Rogue/SeafoamBubble.cs | 18 +-- Projectiles/Rogue/ShatteredSunKnife.cs | 49 +++---- .../Rogue/ShatteredSunScorchedBlade.cs | 100 +++++++------ Projectiles/Rogue/ShroomerangSpore.cs | 18 +-- Projectiles/Rogue/SnapClamProj.cs | 8 +- Projectiles/Rogue/SnapClamStealth.cs | 8 +- Projectiles/Rogue/SphereBladed.cs | 53 ++++--- Projectiles/Rogue/SphereBlue.cs | 14 +- Projectiles/Rogue/StealthNimbus.cs | 6 +- Projectiles/Rogue/StealthRain.cs | 4 +- Projectiles/Rogue/Stormfrontspark.cs | 8 +- Projectiles/Rogue/SupernovaBomb.cs | 6 +- Projectiles/Rogue/SupernovaHoming.cs | 21 ++- Projectiles/Rogue/SupernovaSpike.cs | 36 ++--- Projectiles/Rogue/TimeBoltKnife.cs | 24 +-- 54 files changed, 808 insertions(+), 823 deletions(-) diff --git a/Projectiles/Rogue/BallisticPoisonBombSpike.cs b/Projectiles/Rogue/BallisticPoisonBombSpike.cs index 5b33a8d45d..cf4b7624e4 100644 --- a/Projectiles/Rogue/BallisticPoisonBombSpike.cs +++ b/Projectiles/Rogue/BallisticPoisonBombSpike.cs @@ -34,9 +34,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 4f) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dustt = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 0.75f); + Main.dust[dustt].noGravity = true; + Main.dust[dustt].velocity *= 0f; } } @@ -56,23 +56,23 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 32; 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 < 2; num621++) + for (int i = 0; i < 2; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; + int smoke = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[smoke].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[smoke].scale = 0.5f; + Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 2; num623++) + for (int j = 0; j < 2; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 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, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; + int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[fire].velocity *= 2f; } } } diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index 036b32049c..7ffe7c14ff 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -37,60 +37,60 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item21, Projectile.position); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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; - float num462 = 0f; - while (num462 < num461) + float timerCompare = 0f; + while (timerCompare < 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, randomDust, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[num467]; + float random1 = (float)Main.rand.Next(-10, 11); + float random2 = (float)Main.rand.Next(-10, 11); + float random3 = (float)Main.rand.Next(3, 9); + float randomAdjust = (float)Math.Sqrt((double)(random1 * random1 + random2 * random2)); + randomAdjust = random3 / randomAdjust; + random1 *= randomAdjust; + random2 *= randomAdjust; + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[water]; 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 = random1; + dust.velocity.Y = random2; + timerCompare++; } } diff --git a/Projectiles/Rogue/CircletMark.cs b/Projectiles/Rogue/CircletMark.cs index 534532edc5..fe6813fcdc 100644 --- a/Projectiles/Rogue/CircletMark.cs +++ b/Projectiles/Rogue/CircletMark.cs @@ -37,34 +37,34 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.localAI[1] < 30f) { - for (int num1134 = 0; num1134 < 1; num1134++) + for (int i = 0; i < 1; i++) { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = Projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; + float lerpvalue1 = -0.5f; + float lerpvalue2 = 0.9f; + float randomLerp = Main.rand.NextFloat(); + Vector2 dustMovement = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(lerpvalue1, lerpvalue2, randomLerp)); + dustMovement.X *= MathHelper.Lerp(2.2f, 0.6f, randomLerp); + dustMovement.X *= -1f; + Vector2 dustMovement2 = new Vector2(2f, 10f); + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * dustMovement * 0.5f + dustMovement2; + Dust dust = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; + dust.position = position4; + dust.customData = Projectile.Center + dustMovement2; + dust.fadeIn = 1f; + dust.scale = 0.3f; if (value81.X > -1.2f) { - dust34.velocity.X = 1f + Main.rand.NextFloat(); + dust.velocity.X = 1f + Main.rand.NextFloat(); } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + dust.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 0.8f; Projectile.direction = 1; - Point point9 = Projectile.Center.ToTileCoordinates(); - Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Point projCenter = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(projCenter.X * 16 + 8), (float)(projCenter.Y * 16 + 8)); } Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; if (Projectile.localAI[1] < 33f) @@ -93,30 +93,30 @@ namespace CalamityMod.Projectiles.Rogue { Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } - for (int num1135 = 0; num1135 < 2; num1135++) + for (int j = 0; j < 2; j++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = Projectile.Opacity * Projectile.localAI[0]; - dust35.position = Projectile.Center; - dust35.velocity = value83 * 2.5f; + Vector2 dustVel = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dusty = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + dusty.noGravity = true; + dusty.noLight = true; + dusty.scale = Projectile.Opacity * Projectile.localAI[0]; + dusty.position = Projectile.Center; + dusty.velocity = dustVel * 2.5f; } } - for (int num1136 = 0; num1136 < 2; num1136++) + for (int k = 0; k < 2; k++) { if (Main.rand.NextBool(10)) { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = Projectile.Opacity * Projectile.localAI[0]; - dust36.position = Projectile.Center; - dust36.velocity = value84 * 2.5f; + Vector2 dustVel2 = Vector2.UnitY.RotatedBy((double)((float)k * 3.14159274f), default); + Dust dustier = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + dustier.noGravity = true; + dustier.noLight = true; + dustier.scale = Projectile.Opacity * Projectile.localAI[0]; + dustier.position = Projectile.Center; + dustier.velocity = dustVel2 * 2.5f; } } if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) @@ -138,21 +138,21 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - 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 originalColor = 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)); SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Vector2 drawPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D27 = ModContent.Request(Texture).Value; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0); + Rectangle rectangle = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alphaColor = Projectile.GetAlpha(originalColor); + Vector2 origin7 = rectangle.Size() / 2f; + Color sandyColor = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), sandyColor, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0); + Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0); + Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0); return false; } } diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index 7eac411e9b..1f74f15205 100644 --- a/Projectiles/Rogue/CircletTornado.cs +++ b/Projectiles/Rogue/CircletTornado.cs @@ -73,45 +73,43 @@ namespace CalamityMod.Projectiles.Rogue Projectile.damage = 0; if (Projectile.ai[0] < lifeSpan - 120f) { - float num1126 = Projectile.ai[0] % 60f; - Projectile.ai[0] = lifeSpan - 120f + num1126; + float aiDecrement = Projectile.ai[0] % 60f; + Projectile.ai[0] = lifeSpan - 120f + aiDecrement; Projectile.netUpdate = true; } } - float num1127 = 15f; - float num1128 = 15f; Point point8 = Projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - Projectile.width = (int)(value74.X * 0.65f); - Projectile.height = (int)value74.Y; - Projectile.Center = vector146; + int sizeMod; + int sizeMod2; + Collision.ExpandVertically(point8.X, point8.Y, out sizeMod, out sizeMod2, 15, 15); + sizeMod++; + sizeMod2--; + Vector2 sizeModVector = new Vector2((float)point8.X, (float)sizeMod) * 16f + new Vector2(8f); + Vector2 sizeModVector2 = new Vector2((float)point8.X, (float)sizeMod2) * 16f + new Vector2(8f); + Vector2 centering = Vector2.Lerp(sizeModVector, sizeModVector2, 0.5f); + Vector2 sizeModPos = new Vector2(0f, sizeModVector2.Y - sizeModVector.Y); + sizeModPos.X = sizeModPos.Y * 0.2f; + Projectile.width = (int)(sizeModPos.X * 0.65f); + Projectile.height = (int)sizeModPos.Y; + Projectile.Center = centering; if (Projectile.owner == Main.myPlayer) { - bool flag74 = false; - Vector2 center16 = Main.player[Projectile.owner].Center; + bool breakFlag = false; + Vector2 playerCenter = Main.player[Projectile.owner].Center; Vector2 top = Main.player[Projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + for (float i = 0f; i < 1f; i += 0.05f) { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + Vector2 position2 = Vector2.Lerp(sizeModVector, sizeModVector2, i); + if (Collision.CanHitLine(position2, 0, 0, playerCenter, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) { - flag74 = true; + breakFlag = true; break; } } - if (!flag74 && Projectile.ai[0] < lifeSpan - 120f) + if (!breakFlag && Projectile.ai[0] < lifeSpan - 120f) { - float num1132 = Projectile.ai[0] % 60f; - Projectile.ai[0] = lifeSpan - 120f + num1132; + float aiDecrement2 = Projectile.ai[0] % 60f; + Projectile.ai[0] = lifeSpan - 120f + aiDecrement2; Projectile.netUpdate = true; } } @@ -123,57 +121,54 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = Projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) + float aiTracker = Projectile.ai[0]; + float trackerClamp = MathHelper.Clamp(aiTracker / 30f, 0f, 1f); + if (aiTracker > 540f) { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + trackerClamp = MathHelper.Lerp(1f, 0f, (aiTracker - 540f) / 60f); } - Point point5 = Projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); + Point centerPoint = Projectile.Center.ToTileCoordinates(); + int sizeModding; + int sizeModding2; + Collision.ExpandVertically(centerPoint.X, centerPoint.Y, out sizeModding, out sizeModding2, 15, 15); + sizeModding++; + sizeModding2--; + float vectorMult = 0.2f; + Vector2 sizeModdingVector = new Vector2((float)centerPoint.X, (float)sizeModding) * 16f + new Vector2(8f); + Vector2 sizeModdingVector2 = new Vector2((float)centerPoint.X, (float)sizeModding2) * 16f + new Vector2(8f); + Vector2.Lerp(sizeModdingVector, sizeModdingVector2, 0.5f); + Vector2 sizeModdingPos = new Vector2(0f, sizeModdingVector2.Y - sizeModdingVector.Y); + sizeModdingPos.X = sizeModdingPos.Y * vectorMult; + new Vector2(sizeModdingVector.X - sizeModdingPos.X / 2f, sizeModdingVector.Y); Texture2D texture2D23 = ModContent.Request(Texture).Value; - Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Color value34 = new Color(225, 225, 100); - for (float num236 = (float)(int)value33.Y; num236 > (float)(int)value32.Y; num236 -= num235) + Rectangle drawRectangle = texture2D23.Frame(1, 1, 0, 0); + Vector2 smallRect = drawRectangle.Size() / 2f; + float aiTrackMult = -0.06283186f * aiTracker; + Vector2 spinningpoint = Vector2.UnitY.RotatedBy((double)(aiTracker * 0.1f), default); + float incrementStorage = 0f; + float increment = 5.1f; + Color sandYellow = new Color(225, 225, 100); + for (float k = (float)(int)sizeModdingVector2.Y; k > (float)(int)sizeModdingVector.Y; k -= increment) { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) + incrementStorage += increment; + float colorChanger = incrementStorage / sizeModdingPos.Y; + float incStorageMult = incrementStorage * 6.28318548f / -20f; + float lowerColorChanger = colorChanger - 0.15f; + Vector2 spinArea = spinningpoint.RotatedBy((double)incStorageMult, default); + Vector2 colorChangeVector = new Vector2(0f, colorChanger + 1f); + colorChangeVector.X = colorChangeVector.Y * vectorMult; + Color newSandYellow = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, sandYellow, colorChanger * 2f); + if (colorChanger > 0.5f) { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + newSandYellow = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, sandYellow, 2f - colorChanger * 2f); } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0); + newSandYellow.A = (byte)((float)newSandYellow.A * 0.5f); + newSandYellow *= trackerClamp; + spinArea *= colorChangeVector * 100f; + spinArea.Y = 0f; + spinArea.X = 0f; + spinArea += new Vector2(sizeModdingVector2.X, k) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(rectangle9), newSandYellow, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Rogue/CraniumSMASH.cs b/Projectiles/Rogue/CraniumSMASH.cs index f6c9f383e0..da28ef4f0f 100644 --- a/Projectiles/Rogue/CraniumSMASH.cs +++ b/Projectiles/Rogue/CraniumSMASH.cs @@ -81,11 +81,11 @@ namespace CalamityMod.Projectiles.Rogue } } - for (int num194 = 0; num194 < 25; num194++) + for (int i = 0; i < 25; i++) { - int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 0f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } } } diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 5b94edae9a..674eda9595 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -91,11 +91,11 @@ namespace CalamityMod.Projectiles.Rogue } } - for (int num194 = 0; num194 < 25; num194++) + for (int i = 0; i < 25; i++) { - int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 0f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } } } diff --git a/Projectiles/Rogue/CraniumSmasherStealth.cs b/Projectiles/Rogue/CraniumSmasherStealth.cs index de8bc689b0..1eedabc6b5 100644 --- a/Projectiles/Rogue/CraniumSmasherStealth.cs +++ b/Projectiles/Rogue/CraniumSmasherStealth.cs @@ -113,11 +113,11 @@ namespace CalamityMod.Projectiles.Rogue } } - for (int num194 = 0; num194 < 25; num194++) + for (int i = 0; i < 25; i++) { - int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 0f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } } diff --git a/Projectiles/Rogue/DeepSeaDumbbell1.cs b/Projectiles/Rogue/DeepSeaDumbbell1.cs index 31fb423a65..d90453c278 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell1.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell1.cs @@ -42,26 +42,26 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) + float randVel = (float)Main.rand.Next(-35, 36) * 0.01f; + float randVel2 = (float)Main.rand.Next(-35, 36) * 0.01f; + int inc; + for (int i = 0; i < 2; i = inc + 1) { - if (num627 == 1) + if (i == 1) { - num628 *= 10f; - num629 *= 10f; + randVel *= 10f; + randVel2 *= 10f; } else { - num628 *= -10f; - num629 *= -10f; + randVel *= -10f; + randVel2 *= -10f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randVel, randVel2, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; + inc = i; } } @@ -84,26 +84,26 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) + float randVel = (float)Main.rand.Next(-35, 36) * 0.01f; + float randVel2 = (float)Main.rand.Next(-35, 36) * 0.01f; + int inc; + for (int i = 0; i < 2; i = inc + 1) { - if (num627 == 1) + if (i == 1) { - num628 *= 10f; - num629 *= 10f; + randVel *= 10f; + randVel2 *= 10f; } else { - num628 *= -10f; - num629 *= -10f; + randVel *= -10f; + randVel2 *= -10f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randVel, randVel2, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; + inc = i; } } @@ -124,26 +124,26 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) + float randVel = (float)Main.rand.Next(-35, 36) * 0.01f; + float randVel2 = (float)Main.rand.Next(-35, 36) * 0.01f; + int inc; + for (int i = 0; i < 2; i = inc + 1) { - if (num627 == 1) + if (i == 1) { - num628 *= 10f; - num629 *= 10f; + randVel *= 10f; + randVel2 *= 10f; } else { - num628 *= -10f; - num629 *= -10f; + randVel *= -10f; + randVel2 *= -10f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randVel, randVel2, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; + inc = i; } } diff --git a/Projectiles/Rogue/DeepSeaDumbbell2.cs b/Projectiles/Rogue/DeepSeaDumbbell2.cs index c554f2f5b7..9922b73806 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell2.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell2.cs @@ -49,26 +49,26 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) + float randVel = (float)Main.rand.Next(-35, 36) * 0.01f; + float randVel2 = (float)Main.rand.Next(-35, 36) * 0.01f; + int inc; + for (int i = 0; i < 2; i = inc + 1) { - if (num627 == 1) + if (i == 1) { - num628 *= 10f; - num629 *= 10f; + randVel *= 10f; + randVel2 *= 10f; } else { - num628 *= -10f; - num629 *= -10f; + randVel *= -10f; + randVel2 *= -10f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randVel, randVel2, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; + inc = i; } } @@ -91,26 +91,26 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) + float randVel = (float)Main.rand.Next(-35, 36) * 0.01f; + float randVel2 = (float)Main.rand.Next(-35, 36) * 0.01f; + int inc; + for (int i = 0; i < 2; i = inc + 1) { - if (num627 == 1) + if (i == 1) { - num628 *= 10f; - num629 *= 10f; + randVel *= 10f; + randVel2 *= 10f; } else { - num628 *= -10f; - num629 *= -10f; + randVel *= -10f; + randVel2 *= -10f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randVel, randVel2, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; + inc = i; } } @@ -131,26 +131,26 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) + float randVel = (float)Main.rand.Next(-35, 36) * 0.01f; + float randVel2 = (float)Main.rand.Next(-35, 36) * 0.01f; + int inc; + for (int i = 0; i < 2; i = inc + 1) { - if (num627 == 1) + if (i == 1) { - num628 *= 10f; - num629 *= 10f; + randVel *= 10f; + randVel2 *= 10f; } else { - num628 *= -10f; - num629 *= -10f; + randVel *= -10f; + randVel2 *= -10f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randVel, randVel2, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; + inc = i; } } diff --git a/Projectiles/Rogue/DeepSeaDumbbell3.cs b/Projectiles/Rogue/DeepSeaDumbbell3.cs index 407fdb2b9f..35e4a9e04f 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell3.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell3.cs @@ -41,26 +41,26 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.owner == Main.myPlayer) { - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) + float randVel = (float)Main.rand.Next(-35, 36) * 0.01f; + float randVel2 = (float)Main.rand.Next(-35, 36) * 0.01f; + int inc; + for (int i = 0; i < 2; i = inc + 1) { - if (num627 == 1) + if (i == 1) { - num628 *= 10f; - num629 *= 10f; + randVel *= 10f; + randVel2 *= 10f; } else { - num628 *= -10f; - num629 *= -10f; + randVel *= -10f; + randVel2 *= -10f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randVel, randVel2, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; + inc = i; } } @@ -77,26 +77,26 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.owner == Main.myPlayer) { - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) + float randVel = (float)Main.rand.Next(-35, 36) * 0.01f; + float randVel2 = (float)Main.rand.Next(-35, 36) * 0.01f; + int inc; + for (int i = 0; i < 2; i = inc + 1) { - if (num627 == 1) + if (i == 1) { - num628 *= 10f; - num629 *= 10f; + randVel *= 10f; + randVel2 *= 10f; } else { - num628 *= -10f; - num629 *= -10f; + randVel *= -10f; + randVel2 *= -10f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randVel, randVel2, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; + inc = i; } } @@ -111,26 +111,26 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.owner == Main.myPlayer) { - float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; - int num3; - for (int num627 = 0; num627 < 2; num627 = num3 + 1) + float randVel = (float)Main.rand.Next(-35, 36) * 0.01f; + float randVel2 = (float)Main.rand.Next(-35, 36) * 0.01f; + int inc; + for (int i = 0; i < 2; i = inc + 1) { - if (num627 == 1) + if (i == 1) { - num628 *= 10f; - num629 *= 10f; + randVel *= 10f; + randVel2 *= 10f; } else { - num628 *= -10f; - num629 *= -10f; + randVel *= -10f; + randVel2 *= -10f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randVel, randVel2, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); - num3 = num627; + inc = i; } } diff --git a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs index 77d97c492f..3e872c44db 100644 --- a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs +++ b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs @@ -41,15 +41,15 @@ namespace CalamityMod.Projectiles.Rogue 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 constant = 36; + for (int i = 0; i < constant; i++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.25f; - 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, 33, vector7.X, vector7.Y, 100, default, 1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; + Vector2 weightVel = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.25f; + weightVel = weightVel.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 dustVel = weightVel - Projectile.Center; + int dusty = Dust.NewDust(weightVel + dustVel, 0, 0, 33, dustVel.X, dustVel.Y, 100, default, 1f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity = dustVel; } Projectile.Damage(); diff --git a/Projectiles/Rogue/DesecratedBubble.cs b/Projectiles/Rogue/DesecratedBubble.cs index c6c4d82789..aebcc9749a 100644 --- a/Projectiles/Rogue/DesecratedBubble.cs +++ b/Projectiles/Rogue/DesecratedBubble.cs @@ -51,13 +51,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item54, Projectile.position); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) + int rando = Main.rand.Next(5, 9); + for (int i = 0; i < rando; i++) { - int num192 = Dust.NewDust(Projectile.Center, 0, 0, 179, 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 dust = Dust.NewDust(Projectile.Center, 0, 0, 179, 0f, 0f, 100, default, 1.4f); + Main.dust[dust].velocity *= 0.8f; + Main.dust[dust].position = Vector2.Lerp(Main.dust[dust].position, Projectile.Center, 0.5f); + Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/DesecratedWaterProj.cs b/Projectiles/Rogue/DesecratedWaterProj.cs index c887049e40..31449c64a8 100644 --- a/Projectiles/Rogue/DesecratedWaterProj.cs +++ b/Projectiles/Rogue/DesecratedWaterProj.cs @@ -40,15 +40,15 @@ namespace CalamityMod.Projectiles.Rogue Dust dust2 = Main.dust[index3]; dust2.velocity = dust2.velocity * 3f; } - int num220 = (Projectile.Calamity().stealthStrike ? 12 : 5); + int numProj = (Projectile.Calamity().stealthStrike ? 12 : 5); if (Projectile.owner == Main.myPlayer) { - for (int num221 = 0; num221 < num220; num221++) + for (int j = 0; j < numProj; j++) { - 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(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.6f, Projectile.owner, (Projectile.Calamity().stealthStrike ? 1f : 0f), 1f); + Vector2 bubbleVel = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + bubbleVel.Normalize(); + bubbleVel *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, bubbleVel.X, bubbleVel.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.6f, Projectile.owner, (Projectile.Calamity().stealthStrike ? 1f : 0f), 1f); } } } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 166756383c..c92c67cfd2 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -41,11 +41,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - float num29 = 5f; - float num30 = 300f; + float constant = 5f; float scaleFactor = 6f; - Vector2 value7 = new Vector2(10f, 20f); - int num32 = 3 * Projectile.MaxUpdates; if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; @@ -55,39 +52,39 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.alpha < 128) { - int num35 = -1; - float num36 = num30; - for (int num37 = 0; num37 < Main.maxNPCs; num37++) + int index = -1; + float otherConstant = 300f; + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) + if (Main.npc[i].active && Main.npc[i].CanBeChasedBy(Projectile, false)) { - Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, Projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) + Vector2 npcCenter = Main.npc[i].Center; + float targetDist = Vector2.Distance(npcCenter, Projectile.Center); + if (targetDist < otherConstant && index == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) { - num36 = num38; - num35 = num37; + otherConstant = targetDist; + index = i; } } } - if (num36 < 4f) + if (otherConstant < 4f) { Projectile.Kill(); return; } - if (num35 != -1) + if (index != -1) { - Projectile.ai[1] = num29 + 1f; - Projectile.ai[0] = (float)num35; + Projectile.ai[1] = constant + 1f; + Projectile.ai[0] = (float)index; Projectile.netUpdate = true; } } } - else if (Projectile.ai[1] > num29) + else if (Projectile.ai[1] > constant) { Projectile.ai[1] += 1f; - int num39 = (int)Projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) + int otherIndex = (int)Projectile.ai[0]; + if (!Main.npc[otherIndex].active || !Main.npc[otherIndex].CanBeChasedBy(Projectile, false)) { Projectile.ai[1] = 1f; Projectile.ai[0] = 0f; @@ -96,25 +93,24 @@ namespace CalamityMod.Projectiles.Rogue else { Projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; - if (vector6.Length() < 10f) + Vector2 enemyCenterDist = Main.npc[otherIndex].Center - Projectile.Center; + if (enemyCenterDist.Length() < 10f) { Projectile.Kill(); return; } - if (vector6 != Vector2.Zero) + if (enemyCenterDist != Vector2.Zero) { - vector6.Normalize(); - vector6 *= scaleFactor; + enemyCenterDist.Normalize(); + enemyCenterDist *= scaleFactor; } - float num40 = 30f; - Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; + Projectile.velocity = (Projectile.velocity * 29f + enemyCenterDist) / 30f; } } - if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < constant) { Projectile.ai[1] += 1f; - if (Projectile.ai[1] == num29) + if (Projectile.ai[1] == constant) { Projectile.ai[1] = 1f; } @@ -149,23 +145,23 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 20; num621++) + for (int j = 0; j < 20; j++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 45; num623++) + for (int k = 0; k < 45; k++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 5f; + dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[dusty].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Rogue/DragonScalesInfernado.cs b/Projectiles/Rogue/DragonScalesInfernado.cs index 4a85b19d33..4c81ac6148 100644 --- a/Projectiles/Rogue/DragonScalesInfernado.cs +++ b/Projectiles/Rogue/DragonScalesInfernado.cs @@ -100,8 +100,8 @@ namespace CalamityMod.Projectiles.Rogue 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 baseChanger = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; + center.Y -= baseHeight * baseChanger / 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); @@ -116,14 +116,14 @@ namespace CalamityMod.Projectiles.Rogue } 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 constant = 0.104719758f; + float smallWidth = (float)Projectile.width / 5f; + smallWidth *= 2f; + float xFluctuation = (float)(Math.Cos((double)(constant * -(double)Projectile.ai[0])) - 0.5) * smallWidth; + Projectile.position.X -= xFluctuation * -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; + xFluctuation = (float)(Math.Cos((double)(constant * -(double)Projectile.ai[0])) - 0.5) * smallWidth; + Projectile.position.X += xFluctuation * -Projectile.direction; return; } } @@ -145,9 +145,9 @@ namespace CalamityMod.Projectiles.Rogue 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 frameDraw = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = frameDraw * 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, frameDraw)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)frameDraw / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Rogue/DukesDecapitatorBubble.cs b/Projectiles/Rogue/DukesDecapitatorBubble.cs index e1c9ff5617..936f2a1067 100644 --- a/Projectiles/Rogue/DukesDecapitatorBubble.cs +++ b/Projectiles/Rogue/DukesDecapitatorBubble.cs @@ -66,13 +66,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item54, Projectile.position); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) + int rando = Main.rand.Next(5, 9); + for (int i = 0; i < rando; 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 dust = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + Main.dust[dust].velocity *= 0.8f; + Main.dust[dust].position = Vector2.Lerp(Main.dust[dust].position, Projectile.Center, 0.5f); + Main.dust[dust].noGravity = true; } } } diff --git a/Projectiles/Rogue/EGloveSpark.cs b/Projectiles/Rogue/EGloveSpark.cs index a34b4fe176..6ab6183572 100644 --- a/Projectiles/Rogue/EGloveSpark.cs +++ b/Projectiles/Rogue/EGloveSpark.cs @@ -50,25 +50,25 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; + int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + Dust expr_8976_cp_0 = Main.dust[sparky]; expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; + Dust expr_8994_cp_0 = Main.dust[sparky]; expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; + Main.dust[sparky].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[sparky].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[sparky]; expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; + int sparky2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + Dust expr_8A4E_cp_0 = Main.dust[sparky2]; expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; + Dust expr_8A6C_cp_0 = Main.dust[sparky2]; expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; + Main.dust[sparky2].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[sparky2].noGravity = true; + Main.dust[sparky2].velocity *= 0.1f; } if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { diff --git a/Projectiles/Rogue/ElementalDiskSplit.cs b/Projectiles/Rogue/ElementalDiskSplit.cs index e71ed00c90..b4025ddb2a 100644 --- a/Projectiles/Rogue/ElementalDiskSplit.cs +++ b/Projectiles/Rogue/ElementalDiskSplit.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(10)) { - int num250 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } } diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index bd12da13ba..70185db87a 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -83,23 +83,23 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ExpandHitboxBy(128); SoundEngine.PlaySound(SoundID.Item74, Projectile.position); - 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int j = 0; j < 5; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs index d3c564b549..edaf5de4df 100644 --- a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs @@ -53,23 +53,23 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ExpandHitboxBy(128); SoundEngine.PlaySound(SoundID.Item74, Projectile.position); - 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int j = 0; j < 5; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Rogue/ExplosiveSun.cs b/Projectiles/Rogue/ExplosiveSun.cs index 68d1bd2c12..d68d4e7ae8 100644 --- a/Projectiles/Rogue/ExplosiveSun.cs +++ b/Projectiles/Rogue/ExplosiveSun.cs @@ -71,23 +71,23 @@ namespace CalamityMod.Projectiles.Rogue { SoundEngine.PlaySound(SoundID.Item14 with { Volume = SoundID.Item14.Volume * 0.5f}, Projectile.Center); } - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 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, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Rogue/GraveGrimreaverProjectile.cs b/Projectiles/Rogue/GraveGrimreaverProjectile.cs index bfd06237b9..4c29030444 100644 --- a/Projectiles/Rogue/GraveGrimreaverProjectile.cs +++ b/Projectiles/Rogue/GraveGrimreaverProjectile.cs @@ -98,13 +98,13 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < amount; i++) { - float num463 = (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); - float num464 = (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); - float num465 = (float)Main.rand.Next(minspeed, maxspeed); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; + float random1 = (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); + float random2 = (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); + float random3 = (float)Main.rand.Next(minspeed, maxspeed); + float randomAdjust = (float)Math.Sqrt((double)(random1 * random1 + random2 * random2)); + randomAdjust = random3 / randomAdjust; + random1 *= randomAdjust; + random2 *= randomAdjust; int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 75, 0, 0, 0, default, size); Dust dust = Main.dust[d]; dust.noGravity = true; @@ -112,8 +112,8 @@ namespace CalamityMod.Projectiles.Rogue dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); dust.position.Y += (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); - dust.velocity.X = num463; - dust.velocity.Y = num464; + dust.velocity.X = random1; + dust.velocity.Y = random2; } } } diff --git a/Projectiles/Rogue/HeavenfallenEnergy.cs b/Projectiles/Rogue/HeavenfallenEnergy.cs index d885ae765c..34e373a990 100644 --- a/Projectiles/Rogue/HeavenfallenEnergy.cs +++ b/Projectiles/Rogue/HeavenfallenEnergy.cs @@ -25,18 +25,18 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - int num154 = 14; + int constant = 14; int coolDust; Projectile.ai[0]++; if (Projectile.ai[0] % 2 == 0) { if (Projectile.ai[0] % 4 == 0) { - coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } else { - coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } Main.dust[coolDust].noGravity = true; Main.dust[coolDust].velocity *= 0.1f; diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs index c6efe1c907..b4eefeb60e 100644 --- a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs +++ b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs @@ -72,68 +72,68 @@ namespace CalamityMod.Projectiles.Rogue { if (Owner.channel) { - float num115 = 20f; - float num116 = (float)Main.mouseX + Main.screenPosition.X - Projectile.Center.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; + float constant = 20f; + float xfactor = (float)Main.mouseX + Main.screenPosition.X - Projectile.Center.X; + float yfactor = (float)Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; if (Owner.gravDir == -1f) { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - Projectile.Center.Y; + yfactor = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - Projectile.Center.Y; } - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (num118 > num115) + float factorAdjust = (float)Math.Sqrt((double)(xfactor * xfactor + yfactor * yfactor)); + if (factorAdjust > constant) { - 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) + factorAdjust = constant / factorAdjust; + xfactor *= factorAdjust; + yfactor *= factorAdjust; + int scaledX = (int)(xfactor * 1000f); + int scaledXVel = (int)(Projectile.velocity.X * 1000f); + int scaledY = (int)(yfactor * 1000f); + int scaledYVel = (int)(Projectile.velocity.Y * 1000f); + if (scaledX != scaledXVel || scaledY != scaledYVel) { Projectile.netUpdate = true; } - Projectile.velocity.X = num116; - Projectile.velocity.Y = num117; + Projectile.velocity.X = xfactor; + Projectile.velocity.Y = yfactor; } 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 scaledX2 = (int)(xfactor * 1000f); + int scaledXVel2 = (int)(Projectile.velocity.X * 1000f); + int scaledY2 = (int)(yfactor * 1000f); + int scaledYVel2 = (int)(Projectile.velocity.Y * 1000f); + if (scaledX2 != scaledXVel2 || scaledY2 != scaledYVel2) { Projectile.netUpdate = true; } - Projectile.velocity.X = num116; - Projectile.velocity.Y = num117; + Projectile.velocity.X = xfactor; + Projectile.velocity.Y = yfactor; } } else if (Projectile.ai[0] == 20f) { Projectile.netUpdate = true; - float num127 = 20f; - Vector2 vector11 = Projectile.Center; - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + float sameConstant = 20f; + Vector2 centerPoint = Projectile.Center; + float xfactor2 = (float)Main.mouseX + Main.screenPosition.X - centerPoint.X; + float yfactor2 = (float)Main.mouseY + Main.screenPosition.Y - centerPoint.Y; if (Owner.gravDir == -1f) { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + yfactor2 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - centerPoint.Y; } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || Projectile.ai[0] < 0f) + float factorAdjust2 = (float)Math.Sqrt((double)(xfactor2 * xfactor2 + yfactor2 * yfactor2)); + if (factorAdjust2 == 0f || Projectile.ai[0] < 0f) { - vector11 = Owner.Center; - num128 = Projectile.Center.X - vector11.X; - num129 = Projectile.Center.Y - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + centerPoint = Owner.Center; + xfactor2 = Projectile.Center.X - centerPoint.X; + yfactor2 = Projectile.Center.Y - centerPoint.Y; + factorAdjust2 = (float)Math.Sqrt((double)(xfactor2 * xfactor2 + yfactor2 * yfactor2)); } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - Projectile.velocity.X = num128; - Projectile.velocity.Y = num129; + factorAdjust2 = sameConstant / factorAdjust2; + xfactor2 *= factorAdjust2; + yfactor2 *= factorAdjust2; + Projectile.velocity.X = xfactor2; + Projectile.velocity.Y = yfactor2; } } } @@ -147,15 +147,15 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int i = 0; i < 10; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 0f; } for (int i = 0; i < 10; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 0f; } if (Projectile.owner == Main.myPlayer && Projectile.ai[1] > 0) diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs index 72f4f6dd96..2664df3b17 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Rogue counter += 0.25f; if (Main.rand.NextBool(10)) { - int num300 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 318, 0f, 0f, 0, default, 0.8f); - Main.dust[num300].noGravity = true; - Main.dust[num300].velocity *= 0.2f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 318, 0f, 0f, 0, default, 0.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.2f; } Projectile.velocity *= 0.996f; if (counter > 100f) diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.cs b/Projectiles/Rogue/LeonidProgenitorBombshell.cs index 349934e155..49ef7bcfe8 100644 --- a/Projectiles/Rogue/LeonidProgenitorBombshell.cs +++ b/Projectiles/Rogue/LeonidProgenitorBombshell.cs @@ -107,12 +107,12 @@ namespace CalamityMod.Projectiles.Rogue return; Vector2 spinningpoint = new Vector2(0f, 6f); - float num1 = MathHelper.ToRadians(45f); + float radian45 = MathHelper.ToRadians(45f); int cometAmt = 5; - float num3 = -(num1 * 2f) / (cometAmt - 1f); + float cometSpread = -(radian45 * 2f) / (cometAmt - 1f); for (int projIndex = 0; projIndex < cometAmt; ++projIndex) { - int index2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, spinningpoint.RotatedBy((double)num1 + (double)num3 * (double)projIndex, new Vector2()), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, -1f); + int index2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, spinningpoint.RotatedBy((double)radian45 + (double)cometSpread * (double)projIndex, new Vector2()), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, -1f); Projectile proj = Main.projectile[index2]; for (int index3 = 0; index3 < Projectile.localNPCImmunity.Length; ++index3) { diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index 83ffc1c7dd..ce87567720 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -63,25 +63,25 @@ namespace CalamityMod.Projectiles.Rogue Projectile.damage /= 4; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - for (int num194 = 0; num194 < 10; num194++) + for (int i = 0; i < 10; i++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 0, default, 1.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, 229, 0f, 0f, 100, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 0, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 3f; + dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 1f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].noGravity = true; } Projectile.Damage(); } else { - for (int i = 0; i < 5; i++) + for (int j = 0; j < 5; j++) { - int num304 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 265, 0f, 0f, 100, default, 1f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= Projectile.oldVelocity * 0.3f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 265, 0f, 0f, 100, default, 1f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 1.2f; + Main.dust[dusty].velocity -= Projectile.oldVelocity * 0.3f; } } } diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index b8e29aeb05..af4becd623 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -58,15 +58,15 @@ namespace CalamityMod.Projectiles.Rogue { 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, 173, 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 rotation = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + rotation += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + rotation = rotation.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int dusty = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); + Main.dust[dusty].scale = 1.1f; + Main.dust[dusty].noGravity = true; + Main.dust[dusty].position = Projectile.Center + rotation; + 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/Rogue/MalachiteBolt.cs b/Projectiles/Rogue/MalachiteBolt.cs index bb5ec00c1c..4b2421657b 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -43,11 +43,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 0f; } } } @@ -71,23 +71,23 @@ namespace CalamityMod.Projectiles.Rogue Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - for (int num621 = 0; num621 < 70; num621++) + for (int j = 0; j < 70; j++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 40; num623++) + for (int k = 0; k < 40; k++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[dust2].velocity *= 2f; } } } @@ -103,23 +103,23 @@ namespace CalamityMod.Projectiles.Rogue Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - for (int num621 = 0; num621 < 70; num621++) + for (int j = 0; j < 70; j++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 40; num623++) + for (int k = 0; k < 40; k++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[dust2].velocity *= 2f; } } } @@ -130,23 +130,23 @@ namespace CalamityMod.Projectiles.Rogue 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); - for (int num621 = 0; num621 < 7; num621++) + for (int j = 0; j < 7; j++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 3; num623++) + for (int k = 0; k < 3; k++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Rogue/MalachiteProj.cs b/Projectiles/Rogue/MalachiteProj.cs index 948b60818c..d1d092ed6e 100644 --- a/Projectiles/Rogue/MalachiteProj.cs +++ b/Projectiles/Rogue/MalachiteProj.cs @@ -41,11 +41,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 4f) { - for (int num468 = 0; num468 < 3; num468++) + for (int k = 0; k < 3; k++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 0f; } } } @@ -64,23 +64,23 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 48; 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 < 7; num621++) + for (int i = 0; i < 7; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int j = 0; j < 15; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Rogue/MalachiteStealth.cs b/Projectiles/Rogue/MalachiteStealth.cs index f7b4ecf6bb..871fb68e9a 100644 --- a/Projectiles/Rogue/MalachiteStealth.cs +++ b/Projectiles/Rogue/MalachiteStealth.cs @@ -42,11 +42,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 4f) { - for (int num468 = 0; num468 < 3; num468++) + for (int k = 0; k < 3; k++) { - int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } } } diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index 3cd2512d44..4759c6708d 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -80,20 +80,20 @@ namespace CalamityMod.Projectiles.Rogue 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, 244, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int j = 0; j < 5; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); } } } diff --git a/Projectiles/Rogue/PrismallineProj.cs b/Projectiles/Rogue/PrismallineProj.cs index 1250d97b01..e5f898961f 100644 --- a/Projectiles/Rogue/PrismallineProj.cs +++ b/Projectiles/Rogue/PrismallineProj.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue } else //stealth strike { - for (int num252 = 0; num252 < 5; num252++) + for (int j = 0; j < 5; j++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); diff --git a/Projectiles/Rogue/RadiantExplosion.cs b/Projectiles/Rogue/RadiantExplosion.cs index c2edfbca07..eb5a206d36 100644 --- a/Projectiles/Rogue/RadiantExplosion.cs +++ b/Projectiles/Rogue/RadiantExplosion.cs @@ -44,47 +44,46 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 0f; } for (int i = 0; i < 5; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 0f; } } if (Projectile.Calamity().stealthStrike) { - float num472 = Projectile.Center.X; - float num473 = Projectile.Center.Y; - float num474 = 600f; - for (int num475 = 0; num475 < Main.maxNPCs; num475++) + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[num475].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + if (Main.npc[j].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[j].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { - float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); - if (num478 < num474) + float npcCenterX = Main.npc[j].position.X + (float)(Main.npc[j].width / 2); + float npcCenterY = Main.npc[j].position.Y + (float)(Main.npc[j].height / 2); + float targetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); + if (targetDist < 600f) { - if (Main.npc[num475].position.X < num472) + if (Main.npc[j].position.X < projX) { - Main.npc[num475].velocity.X += 0.25f; + Main.npc[j].velocity.X += 0.25f; } else { - Main.npc[num475].velocity.X -= 0.25f; + Main.npc[j].velocity.X -= 0.25f; } - if (Main.npc[num475].position.Y < num473) + if (Main.npc[j].position.Y < projY) { - Main.npc[num475].velocity.Y += 0.25f; + Main.npc[j].velocity.Y += 0.25f; } else { - Main.npc[num475].velocity.Y -= 0.25f; + Main.npc[j].velocity.Y -= 0.25f; } } } diff --git a/Projectiles/Rogue/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index c1dc9e0a23..91ef243b35 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -37,34 +37,34 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (Projectile.ai[0] == 1f) { - float num472 = Projectile.Center.X; - float num473 = Projectile.Center.Y; - float num474 = Projectile.Calamity().stealthStrike ? 1800f : 600f; + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + float homeRange = Projectile.Calamity().stealthStrike ? 1800f : 600f; float homingSpeed = 0.25f; - for (int num475 = 0; num475 < Main.maxNPCs; num475++) + 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) && !CalamityPlayer.areThereAnyDamnBosses) + if (Main.npc[i].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { - float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); - if (num478 < num474) + float npcCenterX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float npcCenterY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float targetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); + if (targetDist < homeRange) { - if (Main.npc[num475].position.X < num472) + if (Main.npc[i].position.X < projX) { - Main.npc[num475].velocity.X += homingSpeed; + Main.npc[i].velocity.X += homingSpeed; } else { - Main.npc[num475].velocity.X -= homingSpeed; + Main.npc[i].velocity.X -= homingSpeed; } - if (Main.npc[num475].position.Y < num473) + if (Main.npc[i].position.Y < projY) { - Main.npc[num475].velocity.Y += homingSpeed; + Main.npc[i].velocity.Y += homingSpeed; } else { - Main.npc[num475].velocity.Y -= homingSpeed; + Main.npc[i].velocity.Y -= homingSpeed; } } } diff --git a/Projectiles/Rogue/RadiantStarKnife.cs b/Projectiles/Rogue/RadiantStarKnife.cs index 5a1c875fc8..2486e3c7eb 100644 --- a/Projectiles/Rogue/RadiantStarKnife.cs +++ b/Projectiles/Rogue/RadiantStarKnife.cs @@ -37,21 +37,21 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (Projectile.ai[0] == 1f) { - float num472 = Projectile.Center.X; - float num473 = Projectile.Center.Y; - float num474 = Projectile.Calamity().stealthStrike ? 1800f : 600f; + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + float homeRange = Projectile.Calamity().stealthStrike ? 1800f : 600f; float homingSpeed = 0.25f; - for (int num475 = 0; num475 < Main.npc.Length; num475++) + for (int i = 0; i < Main.npc.Length; i++) { - NPC npc = Main.npc[num475]; + NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !npc.boss) { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.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 = npc.position.X + (float)(npc.width / 2); + float npcY = npc.position.Y + (float)(npc.height / 2); + float targetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); + if (targetDist < homeRange) { - if (npc.position.X < num472) + if (npc.position.X < projX) { npc.velocity.X += homingSpeed; } @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue { npc.velocity.X -= homingSpeed; } - if (npc.position.Y < num473) + if (npc.position.Y < projY) { npc.velocity.Y += homingSpeed; } diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 06c5508b15..f716ff8824 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -178,23 +178,23 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 100; 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 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 8; num623++) + for (int j = 0; j < 8; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 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, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Rogue/RegulusEnergy.cs b/Projectiles/Rogue/RegulusEnergy.cs index 69444252da..abfca67bbe 100644 --- a/Projectiles/Rogue/RegulusEnergy.cs +++ b/Projectiles/Rogue/RegulusEnergy.cs @@ -24,18 +24,18 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - int num154 = 14; + int constant = 14; int coolDust; Projectile.ai[0] += 1; if (Projectile.ai[0] % 2 == 0) { if (Projectile.ai[0] % 4 == 0) { - coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } else { - coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } Main.dust[coolDust].noGravity = true; Main.dust[coolDust].velocity *= 0.1f; @@ -92,14 +92,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 24; 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 otherConstant = 36; + for (int j = 0; j < otherConstant; 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, ModContent.DustType(), vector7.X * 0.5f, vector7.Y * 0.5f, 100, default, 0.75f); - Main.dust[num228].noGravity = true; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(j - (otherConstant / 2 - 1)) * 6.28318548f / (float)otherConstant), default) + Projectile.Center; + Vector2 facingDirection = rotate - Projectile.Center; + int dusty = Dust.NewDust(rotate + facingDirection, 0, 0, ModContent.DustType(), facingDirection.X * 0.5f, facingDirection.Y * 0.5f, 100, default, 0.75f); + Main.dust[dusty].noGravity = true; } } diff --git a/Projectiles/Rogue/ScarletBlast.cs b/Projectiles/Rogue/ScarletBlast.cs index 01af47f5a2..f6d8265aef 100644 --- a/Projectiles/Rogue/ScarletBlast.cs +++ b/Projectiles/Rogue/ScarletBlast.cs @@ -33,60 +33,60 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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 timerCompare = 0; + while ((float)timerCompare < projTimer) { - float num463 = (float)Main.rand.Next(-30, 35); - float num464 = (float)Main.rand.Next(-30, 35); - float num465 = (float)Main.rand.Next(13, 18); - 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, 130, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num467]; + float random1 = (float)Main.rand.Next(-30, 35); + float random2 = (float)Main.rand.Next(-30, 35); + float random3 = (float)Main.rand.Next(13, 18); + float randomAdjust = (float)Math.Sqrt((double)(random1 * random1 + random2 * random2)); + randomAdjust = random3 / randomAdjust; + random1 *= randomAdjust; + random2 *= randomAdjust; + int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 130, 0f, 0f, 100, default, 1.25f); + Dust dust = Main.dust[redDust]; 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 = random1; + dust.velocity.Y = random2; + timerCompare++; } } } diff --git a/Projectiles/Rogue/SeafoamBubble.cs b/Projectiles/Rogue/SeafoamBubble.cs index 32aac6aa4c..926194bd0f 100644 --- a/Projectiles/Rogue/SeafoamBubble.cs +++ b/Projectiles/Rogue/SeafoamBubble.cs @@ -50,17 +50,17 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 60; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - 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.Center, Projectile.width, Projectile.height, 154, 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 waterDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 154, 0f, 0f, 0, default, 1f); + Main.dust[waterDust].position = (Main.dust[waterDust].position + Projectile.position) / 2f; + Main.dust[waterDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[waterDust].velocity.Normalize(); + Dust dust = Main.dust[waterDust]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = Projectile.alpha; - num3 = num246; + Main.dust[waterDust].alpha = Projectile.alpha; + inc = i; } } } diff --git a/Projectiles/Rogue/ShatteredSunKnife.cs b/Projectiles/Rogue/ShatteredSunKnife.cs index 76272ec2a9..e27b3b368d 100644 --- a/Projectiles/Rogue/ShatteredSunKnife.cs +++ b/Projectiles/Rogue/ShatteredSunKnife.cs @@ -66,55 +66,54 @@ namespace CalamityMod.Projectiles.Rogue } SoundEngine.PlaySound(SoundID.Item27, Projectile.position); Projectile.active = false; - for (int num621 = 0; num621 < 8; num621++) + for (int j = 0; j < 8; j++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + Main.dust[dusty].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 16; num623++) + for (int k = 0; k < 16; k++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 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, 127, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dusty2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 3f); + Main.dust[dusty2].noGravity = true; + Main.dust[dusty2].velocity *= 5f; + dusty2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + Main.dust[dusty2].velocity *= 2f; } } } if (Projectile.Calamity().stealthStrike) { - float num472 = Projectile.Center.X; - float num473 = Projectile.Center.Y; - float num474 = 600f; - for (int num475 = 0; num475 < Main.maxNPCs; num475++) + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + 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) && !CalamityPlayer.areThereAnyDamnBosses) + if (Main.npc[i].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { - float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); - if (num478 < num474) + float npcCenterX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float npcCenterY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float targetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); + if (targetDist < 600f) { - if (Main.npc[num475].position.X < num472) + if (Main.npc[i].position.X < projX) { - Main.npc[num475].velocity.X += 0.25f; + Main.npc[i].velocity.X += 0.25f; } else { - Main.npc[num475].velocity.X -= 0.25f; + Main.npc[i].velocity.X -= 0.25f; } - if (Main.npc[num475].position.Y < num473) + if (Main.npc[i].position.Y < projY) { - Main.npc[num475].velocity.Y += 0.25f; + Main.npc[i].velocity.Y += 0.25f; } else { - Main.npc[num475].velocity.Y -= 0.25f; + Main.npc[i].velocity.Y -= 0.25f; } } } diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index e67044e5ad..36deeca44d 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -61,11 +61,11 @@ namespace CalamityMod.Projectiles.Rogue int timesToSpawnDust = Projectile.Calamity().stealthStrike ? 2 : 1; for (int i = 0; i < timesToSpawnDust; i++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); - Main.dust[num624].velocity *= 2f; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 5f; + dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); + Main.dust[dusty].velocity *= 2f; } } @@ -73,71 +73,69 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f); CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); - float num633; - Vector2 vector46 = Projectile.position; - bool flag25 = false; - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + float targetDistStore; + Vector2 homingPos = Projectile.position; + bool isHoming = false; + for (int j = 0; j < Main.maxNPCs; j++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[j]; if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if (!flag25) + float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if (!isHoming) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; + targetDistStore = targetDist; + homingPos = nPC2.Center; + isHoming = true; } } } - if (flag25 && Projectile.ai[0] == 0f) + if (isHoming && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - Projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 homingDirection = homingPos - Projectile.Center; + float homingLength = homingDirection.Length(); + homingDirection.Normalize(); + if (homingLength > 200f) { float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + homingDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 40f + homingDirection) / 41f; } else { - float num649 = 4f; - vector47 *= -num649; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + homingDirection *= -4f; + Projectile.velocity = (Projectile.velocity * 40f + homingDirection) / 41f; } } if (Projectile.Calamity().stealthStrike) { - float num472 = Projectile.Center.X; - float num473 = Projectile.Center.Y; - float num474 = 600f; - for (int num475 = 0; num475 < Main.maxNPCs; num475++) + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + 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) && !CalamityPlayer.areThereAnyDamnBosses) + if (Main.npc[i].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { - float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); - if (num478 < num474) + float npcCenterX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float npcCenterY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float targetDistance = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); + if (targetDistance < 600f) { - if (Main.npc[num475].position.X < num472) + if (Main.npc[i].position.X < projX) { - Main.npc[num475].velocity.X += 0.25f; + Main.npc[i].velocity.X += 0.25f; } else { - Main.npc[num475].velocity.X -= 0.25f; + Main.npc[i].velocity.X -= 0.25f; } - if (Main.npc[num475].position.Y < num473) + if (Main.npc[i].position.Y < projY) { - Main.npc[num475].velocity.Y += 0.25f; + Main.npc[i].velocity.Y += 0.25f; } else { - Main.npc[num475].velocity.Y -= 0.25f; + Main.npc[i].velocity.Y -= 0.25f; } } } @@ -213,23 +211,23 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 200; 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 < 4; num621++) + for (int i = 0; i < 4; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 12; num623++) + for (int j = 0; j < 12; j++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 5f; + dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dusty].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Rogue/ShroomerangSpore.cs b/Projectiles/Rogue/ShroomerangSpore.cs index d7287db62f..d60932129d 100644 --- a/Projectiles/Rogue/ShroomerangSpore.cs +++ b/Projectiles/Rogue/ShroomerangSpore.cs @@ -39,16 +39,16 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { Projectile.ExpandHitboxBy(56); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int constant = 36; + for (int i = 0; i < constant; 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, 56, vector7.X, vector7.Y, 100, default, 0.5f); - 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 facingDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + facingDirection, 0, 0, 56, facingDirection.X, facingDirection.Y, 100, default, 0.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = facingDirection; } } } diff --git a/Projectiles/Rogue/SnapClamProj.cs b/Projectiles/Rogue/SnapClamProj.cs index c82ff2cc5f..237511ddad 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -80,11 +80,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num194 = 0; num194 < 20; num194++) + for (int i = 0; i < 20; i++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 2f; } } diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index bebad3c9d3..e7c64a5ca1 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -82,11 +82,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num194 = 0; num194 < 20; num194++) + for (int i = 0; i < 20; i++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 2f; } } diff --git a/Projectiles/Rogue/SphereBladed.cs b/Projectiles/Rogue/SphereBladed.cs index de299fbf1e..586c82452a 100644 --- a/Projectiles/Rogue/SphereBladed.cs +++ b/Projectiles/Rogue/SphereBladed.cs @@ -55,56 +55,55 @@ namespace CalamityMod.Projectiles.Rogue } else { - float num42 = 16f; - float num43 = 3.2f; + float acceleration = 3.2f; Vector2 vector2 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num44 = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) + float xdistance = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector2.X; + float ydistance = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector2.Y; + float totalDist = (float)Math.Sqrt((double)(xdistance * xdistance + ydistance * ydistance)); + if (totalDist > 3000f) { Projectile.Kill(); } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (Projectile.velocity.X < num44) + totalDist = 16f / totalDist; + xdistance *= totalDist; + ydistance *= totalDist; + if (Projectile.velocity.X < xdistance) { - Projectile.velocity.X = Projectile.velocity.X + num43; - if (Projectile.velocity.X < 0f && num44 > 0f) + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xdistance > 0f) { - Projectile.velocity.X = Projectile.velocity.X + num43; + Projectile.velocity.X = Projectile.velocity.X + acceleration; } } - else if (Projectile.velocity.X > num44) + else if (Projectile.velocity.X > xdistance) { - Projectile.velocity.X = Projectile.velocity.X - num43; - if (Projectile.velocity.X > 0f && num44 < 0f) + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xdistance < 0f) { - Projectile.velocity.X = Projectile.velocity.X - num43; + Projectile.velocity.X = Projectile.velocity.X - acceleration; } } - if (Projectile.velocity.Y < num45) + if (Projectile.velocity.Y < ydistance) { - Projectile.velocity.Y = Projectile.velocity.Y + num43; - if (Projectile.velocity.Y < 0f && num45 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && ydistance > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num43; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; } } - else if (Projectile.velocity.Y > num45) + else if (Projectile.velocity.Y > ydistance) { - Projectile.velocity.Y = Projectile.velocity.Y - num43; - if (Projectile.velocity.Y > 0f && num45 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && ydistance < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num43; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; } } if (Main.myPlayer == Projectile.owner) { Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); - if (rectangle.Intersects(value2)) + Rectangle playerPos = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); + if (rectangle.Intersects(playerPos)) { Projectile.Kill(); } diff --git a/Projectiles/Rogue/SphereBlue.cs b/Projectiles/Rogue/SphereBlue.cs index 1f648e1c91..d2b3baab45 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -59,14 +59,14 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.NPCDeath37, Projectile.position); if (Main.netMode != NetmodeID.Server) { - for (int num625 = 0; num625 < 3; num625++) + for (int i = 0; i < 3; i++) { float scaleFactor10 = 0.33f; - if (num625 == 1) + if (i == 1) { scaleFactor10 = 0.66f; } - if (num625 == 2) + if (i == 2) { scaleFactor10 = 1f; } @@ -75,16 +75,16 @@ namespace CalamityMod.Projectiles.Rogue Main.gore[defectiveBruh].velocity += Projectile.velocity; } } - for (int num194 = 0; num194 < 25; num194++) + for (int j = 0; j < 25; j++) { int dustType = Utils.SelectRandom(Main.rand, new int[] { 226, 229 }); - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 0f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 0f; } } diff --git a/Projectiles/Rogue/StealthNimbus.cs b/Projectiles/Rogue/StealthNimbus.cs index 6122769d21..1674c2f1f2 100644 --- a/Projectiles/Rogue/StealthNimbus.cs +++ b/Projectiles/Rogue/StealthNimbus.cs @@ -66,9 +66,9 @@ namespace CalamityMod.Projectiles.Rogue { 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, Projectile.ai[0], 0f); + int rainSpawnX = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int rainSpawnY = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)rainSpawnX, (float)rainSpawnY, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, Projectile.ai[0], 0f); } } } diff --git a/Projectiles/Rogue/StealthRain.cs b/Projectiles/Rogue/StealthRain.cs index 50d847212f..1e951130d1 100644 --- a/Projectiles/Rogue/StealthRain.cs +++ b/Projectiles/Rogue/StealthRain.cs @@ -46,8 +46,8 @@ namespace CalamityMod.Projectiles.Rogue { int dustType = Projectile.ai[0] == 0f ? 14 : 114; - int num310 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num310]; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[dusty]; dust.position.X -= 2f; dust.alpha = 38; dust.velocity *= 0.1f; diff --git a/Projectiles/Rogue/Stormfrontspark.cs b/Projectiles/Rogue/Stormfrontspark.cs index 054880e784..7ff2737dba 100644 --- a/Projectiles/Rogue/Stormfrontspark.cs +++ b/Projectiles/Rogue/Stormfrontspark.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); - Dust dust = Main.dust[num199]; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + Dust dust = Main.dust[dusty]; dust.position.X -= 1f; dust.position.Y -= 1f; dust.scale += (float)Main.rand.Next(50) * 0.01f; @@ -30,8 +30,8 @@ namespace CalamityMod.Projectiles.Rogue dust.velocity.Y += 1f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); - Dust dust2 = Main.dust[num200]; + int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + Dust dust2 = Main.dust[dusty2]; dust2.position.X += 1f; dust2.position.Y -= 1f; dust2.scale += 0.2f + (float)Main.rand.Next(50) * 0.01f; diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index 529ffe29c5..8c8905ade3 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -34,14 +34,14 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { //dust and lighting - int num298 = Main.rand.NextBool() ? 107 : 234; + int dustType = Main.rand.NextBool() ? 107 : 234; if (Main.rand.NextBool(4)) { - num298 = 269; + dustType = 269; } if (Main.rand.NextBool(6)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, num298, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); diff --git a/Projectiles/Rogue/SupernovaHoming.cs b/Projectiles/Rogue/SupernovaHoming.cs index 4b74d65aa0..a9793a17b9 100644 --- a/Projectiles/Rogue/SupernovaHoming.cs +++ b/Projectiles/Rogue/SupernovaHoming.cs @@ -22,16 +22,15 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - int num154 = 14; - int num298 = Main.rand.NextBool() ? 107 : 234; + int dustType = Main.rand.NextBool() ? 107 : 234; if (Main.rand.NextBool(4)) { - num298 = 269; + dustType = 269; } Projectile.ai[0] += 1; if (Projectile.ai[0] % 2 == 0) { - int coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, num298, 0f, 0f, 100, default, 1.5f); + int coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 28, Projectile.height - 28, dustType, 0f, 0f, 100, default, 1.5f); Main.dust[coolDust].noGravity = true; Main.dust[coolDust].velocity *= 0.1f; Main.dust[coolDust].velocity += Projectile.velocity * 0.5f; @@ -86,14 +85,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 24; 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 constant = 36; + for (int i = 0; i < constant; 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, 234, vector7.X * 0.5f, vector7.Y * 0.5f, 100, default, 0.75f); - Main.dust[num228].noGravity = true; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 234, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, default, 0.75f); + Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/SupernovaSpike.cs b/Projectiles/Rogue/SupernovaSpike.cs index 9ee03b2f62..d9c403468d 100644 --- a/Projectiles/Rogue/SupernovaSpike.cs +++ b/Projectiles/Rogue/SupernovaSpike.cs @@ -37,17 +37,17 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.alpha = 0; } - int num298 = Main.rand.NextBool() ? 107 : 234; + int dustType = Main.rand.NextBool() ? 107 : 234; if (Main.rand.NextBool(4)) { - num298 = 269; + dustType = 269; } Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 4f) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num298, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int theDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.75f); + Main.dust[theDust].noGravity = true; + Main.dust[theDust].velocity *= 0f; } if (currentColor == Color.Black) { @@ -94,28 +94,28 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 32; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int num298 = Main.rand.NextBool() ? 107 : 234; + int dustType = Main.rand.NextBool() ? 107 : 234; if (Main.rand.NextBool(4)) { - num298 = 269; + dustType = 269; } - for (int num621 = 0; num621 < 2; num621++) + for (int i = 0; i < 2; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num298, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 2; num623++) + for (int j = 0; j < 2; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 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, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Rogue/TimeBoltKnife.cs b/Projectiles/Rogue/TimeBoltKnife.cs index 5ed5f25a46..6f82034099 100644 --- a/Projectiles/Rogue/TimeBoltKnife.cs +++ b/Projectiles/Rogue/TimeBoltKnife.cs @@ -73,10 +73,10 @@ namespace CalamityMod.Projectiles.Rogue 229 }); Vector2 center = Projectile.Center; - Vector2 vector74 = new Vector2(-4f, 4f); - vector74 += new Vector2(-4f, 4f); - vector74 = vector74.RotatedBy((double)Projectile.rotation, default); - int dust = Dust.NewDust(center + vector74 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 1f); + Vector2 fourVector = new Vector2(-4f, 4f); + fourVector += new Vector2(-4f, 4f); + fourVector = fourVector.RotatedBy((double)Projectile.rotation, default); + int dust = Dust.NewDust(center + fourVector + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[dust]; dust2.velocity *= 0.1f; if (Main.rand.Next(6) != 0) @@ -166,10 +166,10 @@ namespace CalamityMod.Projectiles.Rogue 229 }); Vector2 center = Projectile.Center; - Vector2 vector75 = new Vector2(-4f, 4f); - vector75 += new Vector2(-4f, 4f); - vector75 = vector75.RotatedBy((double)Projectile.rotation, default); - int dust = Dust.NewDust(center + vector75 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); + Vector2 otherFourVector = new Vector2(-4f, 4f); + otherFourVector += new Vector2(-4f, 4f); + otherFourVector = otherFourVector.RotatedBy((double)Projectile.rotation, default); + int dust = Dust.NewDust(center + otherFourVector + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); Dust dust2 = Main.dust[dust]; dust2.velocity *= 0.1f; dust2.noGravity = true; @@ -208,10 +208,10 @@ namespace CalamityMod.Projectiles.Rogue 229 }); Vector2 center = Projectile.Center; - Vector2 vector76 = new Vector2(-4f, 4f); - vector76 += new Vector2(-4f, 4f); - vector76 = vector76.RotatedBy((double)Projectile.rotation, default); - int dust = Dust.NewDust(center + vector76 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); + Vector2 thirdFourVector = new Vector2(-4f, 4f); + thirdFourVector += new Vector2(-4f, 4f); + thirdFourVector = thirdFourVector.RotatedBy((double)Projectile.rotation, default); + int dust = Dust.NewDust(center + thirdFourVector + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); Dust dust2 = Main.dust[dust]; dust2.velocity *= 0.1f; dust2.noGravity = true; From a93820a622908587cdc6d8cb8f79d5857580c59c Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 18 Oct 2023 17:09:57 -0400 Subject: [PATCH 02/43] Ranged num murder Intentionally did not touch BloodBoilerFire, CorossiveFlames, DrizzlefishFire, DrizzlefishFireSplit, DrizzlefishFireball, ElementalFire, EssenceFire, PristineFire, PristineSecondary, ShadeFire, and TerraFireGreen --- Projectiles/Ranged/AquaBlast.cs | 8 +- Projectiles/Ranged/AquaBlastToxic.cs | 8 +- Projectiles/Ranged/ArcticArrowProj.cs | 10 +- Projectiles/Ranged/AstralCannonProjectile.cs | 16 +-- Projectiles/Ranged/AstrealFlame.cs | 22 ++-- Projectiles/Ranged/BeeRPG.cs | 91 ++++++++-------- Projectiles/Ranged/BigCoral.cs | 8 +- Projectiles/Ranged/BigNuke.cs | 48 ++++---- .../BlissfulBombardierDustProjectile.cs | 52 ++++----- Projectiles/Ranged/BloodClotFriendly.cs | 6 +- Projectiles/Ranged/BloodfireArrowProj.cs | 28 ++--- Projectiles/Ranged/BloodflareSoul.cs | 33 +++--- Projectiles/Ranged/Bolt.cs | 28 ++--- Projectiles/Ranged/BoltArrow.cs | 28 ++--- Projectiles/Ranged/BrimstoneBolt.cs | 14 +-- Projectiles/Ranged/BrimstoneFireFriendly.cs | 29 +++-- Projectiles/Ranged/BubonicRoundProj.cs | 8 +- Projectiles/Ranged/ButcherGun.cs | 6 +- Projectiles/Ranged/CardClub.cs | 6 +- Projectiles/Ranged/CardClubSplit.cs | 6 +- Projectiles/Ranged/CardDiamond.cs | 6 +- Projectiles/Ranged/CardHeart.cs | 6 +- Projectiles/Ranged/CardSpade.cs | 6 +- Projectiles/Ranged/ChargedBlast2.cs | 12 +- Projectiles/Ranged/ClamorRifleProj.cs | 11 +- Projectiles/Ranged/ClamorRifleProjSplit.cs | 9 +- Projectiles/Ranged/ContagionBall.cs | 6 +- Projectiles/Ranged/ContagionBow.cs | 42 +++---- .../Ranged/CorinthPrimeAirburstGrenade.cs | 42 +++---- Projectiles/Ranged/DWArrow.cs | 14 +-- Projectiles/Ranged/DaemonsFlameArrow.cs | 40 ++++--- Projectiles/Ranged/DaemonsFlameBow.cs | 91 ++++++++-------- Projectiles/Ranged/DrataliornusBow.cs | 16 +-- Projectiles/Ranged/DrataliornusExoArrow.cs | 11 +- Projectiles/Ranged/DrataliornusFlame.cs | 50 ++++----- Projectiles/Ranged/ElysianArrowProj.cs | 43 ++++---- Projectiles/Ranged/EnhancedNanoRoundProj.cs | 18 +-- Projectiles/Ranged/FeatherLarge.cs | 6 +- Projectiles/Ranged/FishronRPG.cs | 58 +++++----- Projectiles/Ranged/FlakKrakenGun.cs | 67 ++++++------ Projectiles/Ranged/FlakKrakenProj.cs | 50 ++++----- Projectiles/Ranged/FlareBat.cs | 18 +-- Projectiles/Ranged/Flash.cs | 52 ++++----- Projectiles/Ranged/FlashRoundProj.cs | 8 +- Projectiles/Ranged/FreedomStarHoldout.cs | 69 +++++------- Projectiles/Ranged/FungiOrb.cs | 6 +- Projectiles/Ranged/FungiOrb2.cs | 6 +- Projectiles/Ranged/GoliathRocket.cs | 91 ++++++++-------- Projectiles/Ranged/HiveBomb.cs | 91 ++++++++-------- Projectiles/Ranged/HiveMissile.cs | 91 ++++++++-------- Projectiles/Ranged/KarasawaShot.cs | 72 ++++++------ Projectiles/Ranged/LeafArrow.cs | 10 +- Projectiles/Ranged/MagnomalyBeam.cs | 11 +- Projectiles/Ranged/MeowFire.cs | 22 ++-- Projectiles/Ranged/MeowFire2.cs | 22 ++-- Projectiles/Ranged/MiniRocket.cs | 48 ++++---- Projectiles/Ranged/MistArrow.cs | 6 +- Projectiles/Ranged/Nanomachine.cs | 103 +++++++++--------- Projectiles/Ranged/NeedlerProj.cs | 30 ++--- Projectiles/Ranged/Nuke.cs | 18 +-- Projectiles/Ranged/NullShot.cs | 12 +- Projectiles/Ranged/NullShot2.cs | 12 +- Projectiles/Ranged/OnyxSharkBomb.cs | 26 ++--- Projectiles/Ranged/PhangasmBow.cs | 71 ++++++------ Projectiles/Ranged/PlagueArrow.cs | 25 ++--- Projectiles/Ranged/PlagueExplosionFriendly.cs | 52 ++++----- Projectiles/Ranged/PlagueTaintedDrone.cs | 22 ++-- Projectiles/Ranged/PlanarRipperBolt.cs | 10 +- Projectiles/Ranged/PlanarRipperExplosion.cs | 38 +++---- .../Ranged/PlanetaryAnnihilationProj.cs | 61 +++++------ Projectiles/Ranged/PlasmaBlast.cs | 38 +++---- Projectiles/Ranged/PlasmaExplosion.cs | 52 ++++----- Projectiles/Ranged/PolarStar.cs | 44 ++++---- Projectiles/Ranged/RainbowBlast.cs | 6 +- Projectiles/Ranged/RainbowFront.cs | 21 ++-- Projectiles/Ranged/SandstormBullet.cs | 24 ++-- Projectiles/Ranged/SandyWaifuShark.cs | 14 +-- Projectiles/Ranged/SeaDragonRocket.cs | 12 +- Projectiles/Ranged/SeasSearingBubble.cs | 24 ++-- Projectiles/Ranged/SeasSearingSecondary.cs | 14 +-- Projectiles/Ranged/SeasSearingSpout.cs | 46 ++++---- Projectiles/Ranged/SepticSkewerBacteria.cs | 86 +++++++-------- Projectiles/Ranged/SepticSkewerHarpoon.cs | 18 +-- Projectiles/Ranged/Shell.cs | 8 +- Projectiles/Ranged/Shockblast.cs | 38 +++---- Projectiles/Ranged/ShockblastRound.cs | 18 +-- Projectiles/Ranged/Sickness.cs | 52 ++++----- Projectiles/Ranged/SicknessRound.cs | 12 +- Projectiles/Ranged/SicknessRound2.cs | 12 +- Projectiles/Ranged/SlagRound.cs | 6 +- Projectiles/Ranged/SmallCoral.cs | 8 +- Projectiles/Ranged/SputterComet.cs | 10 +- Projectiles/Ranged/SputterCometBig.cs | 10 +- Projectiles/Ranged/SpykerProj.cs | 30 ++--- .../Ranged/StarmageddonBinaryStarCenter.cs | 18 +-- Projectiles/Ranged/StarmageddonStar.cs | 16 +-- Projectiles/Ranged/StarmageddonStar2.cs | 16 +-- Projectiles/Ranged/StormSurgeTornado.cs | 6 +- Projectiles/Ranged/SuperballBulletProj.cs | 8 +- Projectiles/Ranged/ThePackMinissile.cs | 2 +- Projectiles/Ranged/ThePackMissile.cs | 22 ++-- Projectiles/Ranged/TorrentialArrow.cs | 11 +- Projectiles/Ranged/TyphoonBubble.cs | 72 ++++++------ Projectiles/Ranged/Voidragon.cs | 38 +++---- Projectiles/Ranged/WaterSpout.cs | 46 ++++---- 105 files changed, 1493 insertions(+), 1527 deletions(-) diff --git a/Projectiles/Ranged/AquaBlast.cs b/Projectiles/Ranged/AquaBlast.cs index a08e4093ee..3121ce368d 100644 --- a/Projectiles/Ranged/AquaBlast.cs +++ b/Projectiles/Ranged/AquaBlast.cs @@ -44,12 +44,12 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); - for (int num457 = 0; num457 < 2; num457++) + for (int i = 0; i < 2; i++) { Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity = dspeed; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = dspeed; } } diff --git a/Projectiles/Ranged/AquaBlastToxic.cs b/Projectiles/Ranged/AquaBlastToxic.cs index c328cf36a3..02c421e595 100644 --- a/Projectiles/Ranged/AquaBlastToxic.cs +++ b/Projectiles/Ranged/AquaBlastToxic.cs @@ -45,12 +45,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.4f / 255f); - for (int num457 = 0; num457 < 2; num457++) + for (int i = 0; i < 2; i++) { Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity = dspeed; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = dspeed; } } diff --git a/Projectiles/Ranged/ArcticArrowProj.cs b/Projectiles/Ranged/ArcticArrowProj.cs index dae3dd6cf6..4b97875411 100644 --- a/Projectiles/Ranged/ArcticArrowProj.cs +++ b/Projectiles/Ranged/ArcticArrowProj.cs @@ -51,14 +51,14 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 20; 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 < 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, 67, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } } diff --git a/Projectiles/Ranged/AstralCannonProjectile.cs b/Projectiles/Ranged/AstralCannonProjectile.cs index 9cf4d1e46c..78acadcba9 100644 --- a/Projectiles/Ranged/AstralCannonProjectile.cs +++ b/Projectiles/Ranged/AstralCannonProjectile.cs @@ -92,18 +92,18 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.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, ModContent.DustType(), 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); + Main.dust[orangeDust].noGravity = true; + Main.dust[orangeDust].velocity *= 3f; + orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + Main.dust[orangeDust].velocity *= 2f; + Main.dust[orangeDust].noGravity = true; } } } diff --git a/Projectiles/Ranged/AstrealFlame.cs b/Projectiles/Ranged/AstrealFlame.cs index 415b2bef37..e51c266659 100644 --- a/Projectiles/Ranged/AstrealFlame.cs +++ b/Projectiles/Ranged/AstrealFlame.cs @@ -53,23 +53,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int j = 0; j < 15; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index a8f1249299..af07834a56 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -28,22 +28,22 @@ namespace CalamityMod.Projectiles.Ranged { if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int i = 0; i < 2; i++) { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) + float halfX = 0f; + float halfY = 0f; + if (i == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + halfX = Projectile.velocity.X * 0.5f; + halfY = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[dusty].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dusty].velocity *= 0.2f; + Main.dust[dusty].noGravity = true; + dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dusty].velocity *= 0.05f; } } if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) @@ -52,16 +52,16 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool()) { - int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); @@ -89,21 +89,20 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Damage(); if (Projectile.owner == Main.myPlayer) { - int num516 = 12; - for (int num517 = 0; num517 < num516; num517++) + for (int j = 0; j < 12; j++) { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) + if (j % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = Projectile.position; - Vector2 value21 = Projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += Projectile.oldVelocity.X / 6f; - num519 += Projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 4), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); + Vector2 projPos = Projectile.position; + Vector2 projVel = Projectile.oldVelocity; + projVel.Normalize(); + projVel *= 8f; + float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f; + float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f; + projPos -= projVel * (float)j; + beeVelX += Projectile.oldVelocity.X / 6f; + beeVelY += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 4), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; @@ -113,23 +112,23 @@ namespace CalamityMod.Projectiles.Ranged } } SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Ranged/BigCoral.cs b/Projectiles/Ranged/BigCoral.cs index 0b3fa19b43..e9594f0189 100644 --- a/Projectiles/Ranged/BigCoral.cs +++ b/Projectiles/Ranged/BigCoral.cs @@ -39,11 +39,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 32; 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 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 51, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 51, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 3f; } } diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index 4e1fea7831..df1ebf6d5b 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -44,22 +44,22 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.velocity.Length() >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int i = 0; i < 2; i++) { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) + float halfX = 0f; + float halfY = 0f; + if (i == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + halfX = Projectile.velocity.X * 0.5f; + halfY = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[dusty].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dusty].velocity *= 0.2f; + Main.dust[dusty].noGravity = true; + dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dusty].velocity *= 0.05f; } } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); @@ -87,23 +87,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int num621 = 0; num621 < 90; num621++) + for (int i = 0; i < 90; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 180; num623++) + for (int j = 0; j < 180; j++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs b/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs index 4c9a819ded..bb7d5149be 100644 --- a/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs +++ b/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs @@ -24,60 +24,60 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f); - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - float num461 = 25f; + float projTimer = 25f; if (Projectile.ai[0] > 60f) { - num461 -= (Projectile.ai[0] - 60f) / 2f; + projTimer -= (Projectile.ai[0] - 60f) / 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(-8, 9); - float num464 = (float)Main.rand.Next(-8, 9); - float num465 = (float)Main.rand.Next(2, 7); - 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, 244, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-8, 9); + float rand2 = (float)Main.rand.Next(-8, 9); + float rand3 = (float)Main.rand.Next(2, 7); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[dusty]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index 634f40f203..dea29f8651 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -34,11 +34,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 2; num468++) + for (int i = 0; i < 2; i++) { Vector2 dspeed = -Projectile.velocity * 0.7f; - int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, dspeed.X, dspeed.Y, 100, default, 2f); - Main.dust[num469].noGravity = true; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, dspeed.X, dspeed.Y, 100, default, 2f); + Main.dust[dust].noGravity = true; } } } diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index defacb8d8e..75e2311ff5 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -48,15 +48,15 @@ namespace CalamityMod.Projectiles.Ranged { 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, (int)CalamityDusts.Brimstone, 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 rotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + rotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + rotate = rotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int bloodDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); + Main.dust[bloodDust].scale = 1.1f; + Main.dust[bloodDust].noGravity = true; + Main.dust[bloodDust].position = Projectile.Center + rotate; + Main.dust[bloodDust].velocity = Projectile.velocity * 0.1f; + Main.dust[bloodDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[bloodDust].position) * 1.25f; } } } @@ -69,14 +69,14 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 20; 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 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 0.5f; + int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust].velocity *= 0.5f; 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; } } } diff --git a/Projectiles/Ranged/BloodflareSoul.cs b/Projectiles/Ranged/BloodflareSoul.cs index 6a15020a8d..4d4bf282de 100644 --- a/Projectiles/Ranged/BloodflareSoul.cs +++ b/Projectiles/Ranged/BloodflareSoul.cs @@ -43,22 +43,21 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.frame = 0; } - int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num822]; + int redDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[redDust]; dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - float num953 = 30f * Projectile.ai[1]; //100 + Main.dust[redDust].scale = 1.3f; + Main.dust[redDust].noGravity = true; + float velocityModifier = 30f * Projectile.ai[1]; //100 float scaleFactor12 = 6f * Projectile.ai[1]; //5 - float num954 = 600f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); 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) > 600f) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Projectile.velocity = (Projectile.velocity * (velocityModifier - 1f) + moveDirection * scaleFactor12) / velocityModifier; return; } CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 11f, 20f); @@ -96,16 +95,16 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = Projectile.height = 110; 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 constant = 36; + for (int i = 0; i < constant; 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, 60, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 2f); - 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 60, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = faceDirection; } Projectile.Damage(); } diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs index 483d0db5df..e228920f58 100644 --- a/Projectiles/Ranged/Bolt.cs +++ b/Projectiles/Ranged/Bolt.cs @@ -35,15 +35,15 @@ namespace CalamityMod.Projectiles.Ranged { 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, 221, 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 rotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + rotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + rotate = rotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int blueDust = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + Main.dust[blueDust].scale = 1.1f; + Main.dust[blueDust].noGravity = true; + Main.dust[blueDust].position = Projectile.Center + rotate; + Main.dust[blueDust].velocity = Projectile.velocity * 0.1f; + Main.dust[blueDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[blueDust].position) * 1.25f; } } } @@ -76,12 +76,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - int num212 = Main.rand.Next(4, 8); - for (int num213 = 0; num213 < num212; num213++) + int rando = Main.rand.Next(4, 8); + for (int i = 0; i < rando; i++) { - int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; + int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].noGravity = true; } } } diff --git a/Projectiles/Ranged/BoltArrow.cs b/Projectiles/Ranged/BoltArrow.cs index 020a3ec33e..a9c313d4d6 100644 --- a/Projectiles/Ranged/BoltArrow.cs +++ b/Projectiles/Ranged/BoltArrow.cs @@ -33,15 +33,15 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 0f; 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, 221, 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 rotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + rotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + rotate = rotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int blueDust = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + Main.dust[blueDust].scale = 1.1f; + Main.dust[blueDust].noGravity = true; + Main.dust[blueDust].position = Projectile.Center + rotate; + Main.dust[blueDust].velocity = Projectile.velocity * 0.1f; + Main.dust[blueDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[blueDust].position) * 1.25f; } } } @@ -66,12 +66,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile.damage = (int)(Projectile.damage * 0.6f); Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); - int num212 = Main.rand.Next(10, 20); - for (int num213 = 0; num213 < num212; num213++) + int rando = Main.rand.Next(10, 20); + for (int i = 0; i < rando; i++) { - int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; + int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].noGravity = true; } } } diff --git a/Projectiles/Ranged/BrimstoneBolt.cs b/Projectiles/Ranged/BrimstoneBolt.cs index 3c9e2a61bf..83e6d99bff 100644 --- a/Projectiles/Ranged/BrimstoneBolt.cs +++ b/Projectiles/Ranged/BrimstoneBolt.cs @@ -47,14 +47,14 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, 0.7f, 0f, 0f); if (Projectile.localAI[0] > 2f) { - for (int num121 = 0; num121 < 5; num121++) + for (int i = 0; i < 5; i++) { - Dust dust4 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= Projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; + Dust dusty = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + dusty.velocity = Vector2.Zero; + dusty.position -= Projectile.velocity / 5f * (float)i; + dusty.noGravity = true; + dusty.scale = 0.8f; + dusty.noLight = true; } } else diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index 5944635129..93ba70a87e 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -30,44 +30,43 @@ namespace CalamityMod.Projectiles.Ranged } 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 = 235; if (Main.rand.NextBool()) { - for (int num298 = 0; num298 < 1; num298++) + for (int i = 0; i < 1; 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); + int theDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 235, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); if (Main.rand.NextBool(3)) { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; + Main.dust[theDust].noGravity = true; + Main.dust[theDust].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[theDust]; expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; + Dust expr_DC0F_cp_0 = Main.dust[theDust]; expr_DC0F_cp_0.velocity.Y *= 2f; } else { - Main.dust[num299].scale *= 1.5f; + Main.dust[theDust].scale *= 1.5f; } - Dust expr_DC74_cp_0 = Main.dust[num299]; + Dust expr_DC74_cp_0 = Main.dust[theDust]; expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; + Dust expr_DC94_cp_0 = Main.dust[theDust]; expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; + Main.dust[theDust].scale *= dustScale; } } } diff --git a/Projectiles/Ranged/BubonicRoundProj.cs b/Projectiles/Ranged/BubonicRoundProj.cs index 3f12c64f31..ee35e71365 100644 --- a/Projectiles/Ranged/BubonicRoundProj.cs +++ b/Projectiles/Ranged/BubonicRoundProj.cs @@ -39,10 +39,10 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool()) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int greenDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); + Main.dust[greenDust].alpha = Projectile.alpha; + Main.dust[greenDust].velocity *= 0f; + Main.dust[greenDust].noGravity = true; } } } diff --git a/Projectiles/Ranged/ButcherGun.cs b/Projectiles/Ranged/ButcherGun.cs index 8f191fa560..f6282c1b7d 100644 --- a/Projectiles/Ranged/ButcherGun.cs +++ b/Projectiles/Ranged/ButcherGun.cs @@ -133,9 +133,9 @@ namespace CalamityMod.Projectiles.Ranged source += Utils.RandomVector2(Main.rand, -5f, 5f); bulletVel.X += (float)Main.rand.Next(-15, 16) * spreadMult; bulletVel.Y += (float)Main.rand.Next(-15, 16) * spreadMult; - int num44 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, bulletVel, projType, damage, kback, Projectile.owner, 0f, 0f); - Main.projectile[num44].noDropItem = true; - Main.projectile[num44].extraUpdates += incrementAmt / 2; //0 to 4 + int bullet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, bulletVel, projType, damage, kback, Projectile.owner, 0f, 0f); + Main.projectile[bullet].noDropItem = true; + Main.projectile[bullet].extraUpdates += incrementAmt / 2; //0 to 4 } } else diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index d0a9ce3438..8bda06015e 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Ranged/CardClubSplit.cs b/Projectiles/Ranged/CardClubSplit.cs index 425dc24493..7d840945f6 100644 --- a/Projectiles/Ranged/CardClubSplit.cs +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } if (Projectile.alpha < 128) diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index 5e581805d8..74c85383fe 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int num137 = Dust.NewDust(Projectile.position, 1, 1, 30, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(Projectile.position, 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index f28588438a..b0fcd02d3e 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs index 2129d1be98..d3599f3ee4 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Ranged/ChargedBlast2.cs b/Projectiles/Ranged/ChargedBlast2.cs index 21833c2fe9..4ba6bf958b 100644 --- a/Projectiles/Ranged/ChargedBlast2.cs +++ b/Projectiles/Ranged/ChargedBlast2.cs @@ -33,19 +33,19 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 0; } Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 30f; - float num56 = 1f; + float thirty = 30f; + float inc = 1f; if (Projectile.ai[1] == 0f) { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) + Projectile.localAI[0] += inc; + if (Projectile.localAI[0] > thirty) { - Projectile.localAI[0] = num55; + Projectile.localAI[0] = thirty; } } else { - Projectile.localAI[0] -= num56; + Projectile.localAI[0] -= inc; if (Projectile.localAI[0] <= 0f) { Projectile.Kill(); diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index 19840c0be1..d584a075d5 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -29,13 +29,12 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 3f) { Lighting.AddLight(Projectile.Center, new Vector3(44, 191, 232) * (1.3f / 255)); - for (int num151 = 0; num151 < 2; num151++) + for (int i = 0; i < 2; i++) { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; + int blueDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 28, Projectile.height - 28, 68, 0f, 0f, 100, default, 1f); + Main.dust[blueDust].noGravity = true; + Main.dust[blueDust].velocity *= 0.1f; + Main.dust[blueDust].velocity += Projectile.velocity * 0.5f; } } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 150f, 12f, 25f); diff --git a/Projectiles/Ranged/ClamorRifleProjSplit.cs b/Projectiles/Ranged/ClamorRifleProjSplit.cs index d8f5d21bb1..28c36bb2d7 100644 --- a/Projectiles/Ranged/ClamorRifleProjSplit.cs +++ b/Projectiles/Ranged/ClamorRifleProjSplit.cs @@ -30,11 +30,10 @@ namespace CalamityMod.Projectiles.Ranged for (int num151 = 0; num151 < 2; num151++) { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; + int blueDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 28, Projectile.height - 28, 68, 0f, 0f, 100, default, 1f); + Main.dust[blueDust].noGravity = true; + Main.dust[blueDust].velocity *= 0.1f; + Main.dust[blueDust].velocity += Projectile.velocity * 0.5f; } if (Projectile.timeLeft < 150) diff --git a/Projectiles/Ranged/ContagionBall.cs b/Projectiles/Ranged/ContagionBall.cs index 2570376153..243f195079 100644 --- a/Projectiles/Ranged/ContagionBall.cs +++ b/Projectiles/Ranged/ContagionBall.cs @@ -31,11 +31,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 44, 0f, 0f, 100, default, 0.15f); - Main.dust[num622].velocity *= 1.2f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 44, 0f, 0f, 100, default, 0.15f); + Main.dust[dust].velocity *= 1.2f; if (Main.rand.NextBool()) { - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } } diff --git a/Projectiles/Ranged/ContagionBow.cs b/Projectiles/Ranged/ContagionBow.cs index b8a30c38d7..9f3338c2ef 100644 --- a/Projectiles/Ranged/ContagionBow.cs +++ b/Projectiles/Ranged/ContagionBow.cs @@ -32,29 +32,29 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.type == ModContent.ProjectileType()) { Projectile.ai[0] += 1f; - int num2 = 0; + int fireSpeed = 0; if (Projectile.ai[0] >= 40f) { - num2++; + fireSpeed++; } if (Projectile.ai[0] >= 80f) { - num2++; + fireSpeed++; } if (Projectile.ai[0] >= 120f) { - num2++; + fireSpeed++; } - int num3 = 24; - int num4 = 6; + int delayCompare = 24; + int fireSpeedCompare = 6; Projectile.ai[1] += 1f; - bool flag = false; - if (Projectile.ai[1] >= (float)(num3 - num4 * num2)) + bool fullSpeed = false; + if (Projectile.ai[1] >= (float)(delayCompare - fireSpeedCompare * fireSpeed)) { Projectile.ai[1] = 0f; - flag = true; + fullSpeed = true; } - Projectile.frameCounter += 1 + num2; + Projectile.frameCounter += 1 + fireSpeed; if (Projectile.frameCounter >= 4) { Projectile.frameCounter = 0; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.soundDelay <= 0) { - Projectile.soundDelay = num3 - num4 * num2; + Projectile.soundDelay = delayCompare - fireSpeedCompare * fireSpeed; if (Projectile.ai[0] != 1f) { SoundEngine.PlaySound(SoundID.Item5, Projectile.Center); @@ -74,21 +74,21 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.ai[1] == 1f && Projectile.ai[0] != 1f) { - Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); - Vector2 value = Projectile.Center + vector2; + Vector2 rotate = Vector2.UnitX * 24f; + rotate = rotate.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); + Vector2 value = Projectile.Center + rotate; for (int i = 0; i < 2; i++) { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 44, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 100, default, 0.25f); - Main.dust[num5].velocity *= 0.66f; - Main.dust[num5].noGravity = true; - Main.dust[num5].scale = 1.4f; + int dust = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 44, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 100, default, 0.25f); + Main.dust[dust].velocity *= 0.66f; + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.4f; } } - if (flag && Main.myPlayer == Projectile.owner) + if (fullSpeed && Main.myPlayer == Projectile.owner) { - bool flag2 = player.channel && !player.noItems && !player.CCed; - if (flag2) + bool canUseItem = player.channel && !player.noItems && !player.CCed; + if (canUseItem) { float speed = player.ActiveItem().shootSpeed * Projectile.scale; Vector2 spawnPos = vector; diff --git a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs index 0f3d45ecdc..d426321caa 100644 --- a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs +++ b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs @@ -142,34 +142,34 @@ namespace CalamityMod.Projectiles.Ranged // Dust circles int totalDust = weakExplosion ? 100 : 400; - for (int num640 = 0; num640 < totalDust; num640++) + for (int i = 0; i < totalDust; i++) { int dustType = 206; - float num641 = 32f; - if (num640 < 300) + float circleSize = 32f; + if (i < 300) { dustType = 187; - num641 = 16f; + circleSize = 16f; } - if (num640 < 200) - num641 = 8f; - if (num640 < 100) - num641 = 4f; + if (i < 200) + circleSize = 8f; + if (i < 100) + circleSize = 4f; - int num643 = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); - float num644 = Main.dust[num643].velocity.X; - float num645 = Main.dust[num643].velocity.Y; + int dust = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); + float dustX = Main.dust[dust].velocity.X; + float dustY = Main.dust[dust].velocity.Y; - if (num644 == 0f && num645 == 0f) - num644 = 1f; + if (dustX == 0f && dustY == 0f) + dustX = 1f; - float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); - num646 = num641 / num646; - num644 *= num646; - num645 *= num646; + float dustCircle = (float)Math.Sqrt(dustX * dustX + dustY * dustY); + dustCircle = circleSize / dustCircle; + dustX *= dustCircle; + dustY *= dustCircle; float scale = 1f; - switch ((int)num641) + switch ((int)circleSize) { case 4: scale = 1.1f; @@ -187,10 +187,10 @@ namespace CalamityMod.Projectiles.Ranged break; } - Dust dust = Main.dust[num643]; + Dust dust = Main.dust[dust]; dust.velocity *= 0.5f; - dust.velocity.X += num644; - dust.velocity.Y += num645; + dust.velocity.X += dustX; + dust.velocity.Y += dustY; dust.scale = scale; dust.noGravity = true; } diff --git a/Projectiles/Ranged/DWArrow.cs b/Projectiles/Ranged/DWArrow.cs index 5c33a84398..376969fc5c 100644 --- a/Projectiles/Ranged/DWArrow.cs +++ b/Projectiles/Ranged/DWArrow.cs @@ -38,14 +38,14 @@ namespace CalamityMod.Projectiles.Ranged } Lighting.AddLight(Projectile.Center, 0.4f, 0.2f, 0.4f); - for (int num121 = 0; num121 < 2; num121++) + for (int i = 0; i < 2; i++) { - Dust dust4 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= Projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; + Dust dusty = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + dusty.velocity = Vector2.Zero; + dusty.position -= Projectile.velocity / 5f * (float)num121; + dusty.noGravity = true; + dusty.scale = 0.8f; + dusty.noLight = true; } } diff --git a/Projectiles/Ranged/DaemonsFlameArrow.cs b/Projectiles/Ranged/DaemonsFlameArrow.cs index 2191065834..29ee506641 100644 --- a/Projectiles/Ranged/DaemonsFlameArrow.cs +++ b/Projectiles/Ranged/DaemonsFlameArrow.cs @@ -34,20 +34,18 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.velocity.Y = (float)(((double)Projectile.ai[1]) * Math.Sin(x / 4)); } - for (int num151 = 0; num151 < 2; num151++) + for (int i = 0; i < 2; i++) { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 60, 0f, 0f, 100, default, 1.6f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; + int dusty = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 28, Projectile.height - 28, 60, 0f, 0f, 100, default, 1.6f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 0.1f; + Main.dust[dusty].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(13)) { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 60, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; + int dusty2 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 32, Projectile.height - 32, 60, 0f, 0f, 100, default, 1f); + Main.dust[dusty2].velocity *= 0.25f; + Main.dust[dusty2].velocity += Projectile.velocity * 0.5f; } } @@ -69,23 +67,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.idStaticNPCHitCooldown = 0; Projectile.Damage(); - 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, 60, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].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, 60, 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, 60, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Ranged/DaemonsFlameBow.cs b/Projectiles/Ranged/DaemonsFlameBow.cs index c322c7fabe..9bcaff3be6 100644 --- a/Projectiles/Ranged/DaemonsFlameBow.cs +++ b/Projectiles/Ranged/DaemonsFlameBow.cs @@ -33,11 +33,11 @@ namespace CalamityMod.Projectiles.Ranged { Lighting.AddLight(Projectile.Center, 0f, 0.7f, 0.5f); Player player = Main.player[Projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float pi = 0f; + Vector2 playerRotate = player.RotatedRelativePoint(player.MountedCenter, true); if (Projectile.spriteDirection == -1) { - num = 3.14159274f; + pi = 3.14159274f; } Projectile.frameCounter++; if (Projectile.frameCounter > 4) @@ -50,94 +50,93 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame = 0; } Projectile.ai[0] += 1f; - int num39 = 0; + int fireSpeed = 0; if (Projectile.ai[0] >= 30f) { - num39++; + fireSpeed++; } if (Projectile.ai[0] >= 60f) { - num39++; + fireSpeed++; } if (Projectile.ai[0] >= 90f) { - num39++; + fireSpeed++; } if (Projectile.ai[0] >= 120f) { - num39++; + fireSpeed++; } - int num40 = 24; - int num41 = 2; + int delayCompare = 24; + int fireSpeedCompare = 2; Projectile.ai[1] -= 1f; - bool flag15 = false; + bool fullSpeed = false; if (Projectile.ai[1] <= 0f) { - Projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - int arg_1EF4_0 = (int)Projectile.ai[0] / (num40 - num41 * num39); + Projectile.ai[1] = (float)(delayCompare - fireSpeedCompare * fireSpeed); + fullSpeed = true; + int arg_1EF4_0 = (int)Projectile.ai[0] / (delayCompare - fireSpeedCompare * fireSpeed); } - bool flag16 = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; + bool canUseItem = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; if (Projectile.localAI[0] > 0f) { Projectile.localAI[0] -= 1f; } - if (Projectile.soundDelay <= 0 && flag16) + if (Projectile.soundDelay <= 0 && canUseItem) { - Projectile.soundDelay = num40 - num41 * num39; + Projectile.soundDelay = delayCompare - fireSpeedCompare * fireSpeed; if (Projectile.ai[0] != 1f) { SoundEngine.PlaySound(SoundID.Item5, Projectile.position); } Projectile.localAI[0] = 12f; } - if (flag15 && Main.myPlayer == Projectile.owner) + if (fullSpeed && Main.myPlayer == Projectile.owner) { - int num42 = ProjectileID.WoodenArrowFriendly; + int ammoType = ProjectileID.WoodenArrowFriendly; float scaleFactor11 = 14f; int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); float weaponKnockback2 = player.ActiveItem().knockBack; - if (flag16) + if (canUseItem) { - player.PickAmmo(player.ActiveItem(), out num42, out scaleFactor11, out weaponDamage2, out weaponKnockback2, out _); + player.PickAmmo(player.ActiveItem(), out ammoType, out scaleFactor11, out weaponDamage2, out weaponKnockback2, out _); 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 shootDirection = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - playerRotate; if (player.gravDir == -1f) { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + shootDirection.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerRotate.Y; } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + Vector2 normalizeShoot = Vector2.Normalize(shootDirection); + if (float.IsNaN(normalizeShoot.X) || float.IsNaN(normalizeShoot.Y)) { - value19 = -Vector2.UnitY; + normalizeShoot = -Vector2.UnitY; } - value19 *= scaleFactor12; - if (value19.X != Projectile.velocity.X || value19.Y != Projectile.velocity.Y) + normalizeShoot *= scaleFactor12; + if (normalizeShoot.X != Projectile.velocity.X || normalizeShoot.Y != Projectile.velocity.Y) { Projectile.netUpdate = true; } - Projectile.velocity = value19 * 0.55f; - for (int num43 = 0; num43 < 4; num43++) + Projectile.velocity = normalizeShoot * 0.55f; + for (int i = 0; i < 4; i++) { - Vector2 vector20 = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + Vector2 randNormalize = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(randNormalize.X) || float.IsNaN(randNormalize.Y)) { - vector20 = -Vector2.UnitY; + randNormalize = -Vector2.UnitY; } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - int num44 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, Projectile.owner, 0f, 0f); - Main.projectile[num44].noDropItem = true; + Vector2 projRandomPos = playerRotate + Utils.RandomVector2(Main.rand, -15f, 15f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projRandomPos.X, projRandomPos.Y, randNormalize.X, randNormalize.Y, ammoType, weaponDamage2, weaponKnockback2, Projectile.owner, 0f, 0f); + Main.projectile[proj].noDropItem = true; } - Vector2 vector2 = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector2.X) || float.IsNaN(vector2.Y)) + Vector2 daemonNormalize = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(daemonNormalize.X) || float.IsNaN(daemonNormalize.Y)) { - vector2 = -Vector2.UnitY; + daemonNormalize = -Vector2.UnitY; } - float speedY = vector2.Y; - Vector2 vector3 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector3.X, vector3.Y, vector2.X, vector2.Y, ModContent.ProjectileType(), weaponDamage2, weaponKnockback2, Projectile.owner, 0.0f, speedY); + float speedY = daemonNormalize.Y; + Vector2 daemonRandomPos = playerRotate + Utils.RandomVector2(Main.rand, -15f, 15f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), daemonRandomPos.X, daemonRandomPos.Y, daemonNormalize.X, daemonNormalize.Y, ModContent.ProjectileType(), weaponDamage2, weaponKnockback2, Projectile.owner, 0.0f, speedY); } else { @@ -158,14 +157,14 @@ namespace CalamityMod.Projectiles.Ranged 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(27f, 58f); SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Ranged/DaemonsFlameBowGlow").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/Ranged/DaemonsFlameBowGlow").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/Ranged/DrataliornusBow.cs b/Projectiles/Ranged/DrataliornusBow.cs index a2d518423c..1f636193d9 100644 --- a/Projectiles/Ranged/DrataliornusBow.cs +++ b/Projectiles/Ranged/DrataliornusBow.cs @@ -54,15 +54,15 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0]++; Projectile.ai[0] = -1f; //fully spun up, don't need timer anymore - const int num226 = 36; //dusts indicate fully spun up - for (int num227 = 0; num227 < num226; num227++) + const int constant = 36; //dusts indicate fully spun up + for (int i = 0; i < constant; i++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * 9f; - vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * 6.28318548f / num226, default) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 127, 0f, 0f, 0, default, 4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * 9f; + rotate = rotate.RotatedBy((i - (constant / 2 - 1)) * 6.28318548f / constant, default) + player.Center; + Vector2 faceDirection = rotate - player.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 127, 0f, 0f, 0, default, 4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = faceDirection; } break; } diff --git a/Projectiles/Ranged/DrataliornusExoArrow.cs b/Projectiles/Ranged/DrataliornusExoArrow.cs index 44e73ce968..97ec9ede47 100644 --- a/Projectiles/Ranged/DrataliornusExoArrow.cs +++ b/Projectiles/Ranged/DrataliornusExoArrow.cs @@ -35,19 +35,18 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.alpha = 0; } - float num55 = 100f; - float num56 = 3f; + float inc = 3f; if (Projectile.ai[1] == 0f) { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) + Projectile.localAI[0] += inc; + if (Projectile.localAI[0] > 100f) { - Projectile.localAI[0] = num55; + Projectile.localAI[0] = 100f; } } else { - Projectile.localAI[0] -= num56; + Projectile.localAI[0] -= inc; if (Projectile.localAI[0] <= 0f) { Projectile.Kill(); diff --git a/Projectiles/Ranged/DrataliornusFlame.cs b/Projectiles/Ranged/DrataliornusFlame.cs index 43a8581e8e..c80e073847 100644 --- a/Projectiles/Ranged/DrataliornusFlame.cs +++ b/Projectiles/Ranged/DrataliornusFlame.cs @@ -158,10 +158,10 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.ai[0] != 0f && Projectile.owner == Main.myPlayer) //if empowered, make exo arrow and dragon dust { - Vector2 vector3 = Projectile.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); - Vector2 speed = Projectile.Center - vector3; + Vector2 randomAngle = Projectile.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); + Vector2 speed = Projectile.Center - randomAngle; speed /= 30f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), randomAngle.X, randomAngle.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 2f, Projectile.owner); } @@ -173,30 +173,30 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position.Y = Projectile.position.Y - 90; //just dusts - const int num226 = 24; + const int constant = 24; float modifier = 4f + 8f * Main.rand.NextFloat(); - for (int num227 = 0; num227 < num226; num227++) + for (int i = 0; i < constant; i++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * modifier; - vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * 6.28318548f / num226, default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 45, default, 2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * modifier; + rotate = rotate.RotatedBy((i - (constant / 2 - 1)) * 6.28318548f / constant, default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 174, 0f, 0f, 45, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = faceDirection; } - for (int num193 = 0; num193 < 4; num193++) + for (int j = 0; j < 4; j++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 174, 0f, 0f, 50, default, 1.5f); - int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 174, 0f, 0f, 50, default, 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 174, 0f, 0f, 50, default, 1f); + Main.dust[fieryDust].noGravity = true; + Main.dust[fieryDust].velocity *= 2f; } - for (int num194 = 0; num194 < 12; num194++) + for (int k = 0; k < 12; k++) { - int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 0, default, 3f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 0, default, 3f); + Main.dust[fieryDust].noGravity = true; + Main.dust[fieryDust].velocity *= 3f; } Projectile.timeLeft = 0; //should avoid infinite loop if a hit npc calls proj.Kill() @@ -217,10 +217,10 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.timeLeft != 0) //will not be called on npcs hit by explosion (only direct hits) { //make exo arrow, make meteor - Vector2 vector3 = target.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); - Vector2 speed = target.Center - vector3; + Vector2 randomAngle = target.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); + Vector2 speed = target.Center - randomAngle; speed /= 30f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), randomAngle.X, randomAngle.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); Vector2 vel = new Vector2(Main.rand.Next(-400, 401), Main.rand.Next(500, 801)); Vector2 pos = target.Center - vel; @@ -243,10 +243,10 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.timeLeft != 0) //will not be called on npcs hit by explosion (only direct hits) { //make exo arrow, make meteor - Vector2 vector3 = target.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); - Vector2 speed = target.Center - vector3; + Vector2 randomAngle = target.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); + Vector2 speed = target.Center - randomAngle; speed /= 30f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), randomAngle.X, randomAngle.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); Vector2 vel = new Vector2(Main.rand.Next(-400, 401), Main.rand.Next(500, 801)); Vector2 pos = target.Center - vel; diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 98c25f1290..f62deb3def 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -52,23 +52,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 2; num621++) + for (int i = 0; i < 2; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 6; num623++) + for (int j = 0; j < 6; j++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) @@ -117,19 +117,18 @@ namespace CalamityMod.Projectiles.Ranged float x = Projectile.position.X + Main.rand.Next(-400, 400); float y = Projectile.position.Y - Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = Projectile.position.X + (Projectile.width / 2) - vector.X; - float num16 = Projectile.position.Y + (Projectile.height / 2) - vector.Y; - num15 += Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt(num15 * num15 + num16 * num16); - num18 = num17 / num18; - num15 *= num18; - num16 *= num18; + Vector2 landSpot = new Vector2(x, y); + float meteorSpawnX = Projectile.position.X + (Projectile.width / 2) - landSpot.X; + float meteorSpawnY = Projectile.position.Y + (Projectile.height / 2) - landSpot.Y; + meteorSpawnX += Main.rand.Next(-100, 101); + float meteorSpawnAdjust = (float)Math.Sqrt(meteorSpawnX * meteorSpawnX + meteorSpawnY * meteorSpawnY); + meteorSpawnAdjust = 25 / meteorSpawnAdjust; + meteorSpawnX *= meteorSpawnAdjust; + meteorSpawnY *= meteorSpawnAdjust; if (Projectile.owner == Main.myPlayer) { - int num19 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, num15, num16, ModContent.ProjectileType(), Projectile.damage / 2, 5f, Projectile.owner, 0f, 0f); - Main.projectile[num19].ai[1] = Projectile.position.Y; + int meteor = Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, meteorSpawnX, meteorSpawnY, ModContent.ProjectileType(), Projectile.damage / 2, 5f, Projectile.owner, 0f, 0f); + Main.projectile[meteor].ai[1] = Projectile.position.Y; } } diff --git a/Projectiles/Ranged/EnhancedNanoRoundProj.cs b/Projectiles/Ranged/EnhancedNanoRoundProj.cs index 77d4baf300..6b4ba1b81a 100644 --- a/Projectiles/Ranged/EnhancedNanoRoundProj.cs +++ b/Projectiles/Ranged/EnhancedNanoRoundProj.cs @@ -39,10 +39,10 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } } } @@ -78,12 +78,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item93, Projectile.position); - int num212 = Main.rand.Next(5, 10); - for (int num213 = 0; num213 < num212; num213++) + int rando = Main.rand.Next(5, 10); + for (int i = 0; i < rando; i++) { - int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 229, 0f, 0f, 100, default, 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; + int dusty = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 229, 0f, 0f, 100, default, 2f); + Main.dust[dusty].velocity *= 2f; + Main.dust[dusty].noGravity = true; } } } diff --git a/Projectiles/Ranged/FeatherLarge.cs b/Projectiles/Ranged/FeatherLarge.cs index 44a114e1b7..0adfc6a767 100644 --- a/Projectiles/Ranged/FeatherLarge.cs +++ b/Projectiles/Ranged/FeatherLarge.cs @@ -47,11 +47,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - int num3; - for (int num611 = 0; num611 < 10; num611 = num3 + 1) + int inc; + for (int i = 0; i < 10; i = inc + 1) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 42, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); - num3 = num611; + inc = i; } } } diff --git a/Projectiles/Ranged/FishronRPG.cs b/Projectiles/Ranged/FishronRPG.cs index de3baac4e7..9efdf73da1 100644 --- a/Projectiles/Ranged/FishronRPG.cs +++ b/Projectiles/Ranged/FishronRPG.cs @@ -23,14 +23,14 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.ai[1] == 0f) { - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } Projectile.ai[1] = 1f; @@ -54,22 +54,22 @@ namespace CalamityMod.Projectiles.Ranged { if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int j = 0; j < 2; j++) { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) + float halfX = 0f; + float halfY = 0f; + if (j == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + halfX = Projectile.velocity.X * 0.5f; + halfY = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int fishDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 1f); + Main.dust[fishDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[fishDust].velocity *= 0.2f; + Main.dust[fishDust].noGravity = true; + fishDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + Main.dust[fishDust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[fishDust].velocity *= 0.05f; } } } @@ -95,23 +95,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item92, Projectile.position); - 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, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 20; num623++) + for (int i = 0; i < 20; i++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 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, 33, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 3f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 5f; + dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[dusty].velocity *= 2f; } } } diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index 4ce596ec78..ae9a3bbd5f 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -28,88 +28,85 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Player player = Main.player[Projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float pi = 0f; + Vector2 playerRotation = player.RotatedRelativePoint(player.MountedCenter, true); if (Projectile.spriteDirection == -1) { - num = 3.14159274f; + pi = 3.14159274f; } - float num26 = 30f; + float hitRate = 30f; if (Projectile.ai[0] > 90f) { - num26 = 15f; + hitRate = 15f; } if (Projectile.ai[0] > 120f) { - num26 = 5f; + hitRate = 5f; } Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); Projectile.ai[0] += 1f; Projectile.ai[1] += 1f; - int num27 = 10; - bool flag10 = false; - if (Projectile.ai[0] % num26 == 0f) + bool isUsing = false; + if (Projectile.ai[0] % hitRate == 0f) { - flag10 = true; + isUsing = true; } if (Projectile.ai[1] >= 1f) { Projectile.ai[1] = 0f; - flag10 = true; + isUsing = true; if (Main.myPlayer == Projectile.owner) { float scaleFactor5 = player.ActiveItem().shootSpeed * Projectile.scale; - Vector2 value12 = vector; - Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; + Vector2 shootDirection = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - playerRotation; if (player.gravDir == -1f) { - value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; + shootDirection.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerRotation.Y; } - Vector2 vector11 = Vector2.Normalize(value13); - if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) + Vector2 normalizeShoot = Vector2.Normalize(shootDirection); + if (float.IsNaN(normalizeShoot.X) || float.IsNaN(normalizeShoot.Y)) { - vector11 = -Vector2.UnitY; + normalizeShoot = -Vector2.UnitY; } - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(Projectile.velocity), 0.92f)); //0.92 - vector11 *= scaleFactor5; - if (vector11.X != Projectile.velocity.X || vector11.Y != Projectile.velocity.Y) + normalizeShoot = Vector2.Normalize(Vector2.Lerp(normalizeShoot, Vector2.Normalize(Projectile.velocity), 0.92f)); //0.92 + normalizeShoot *= scaleFactor5; + if (normalizeShoot.X != Projectile.velocity.X || normalizeShoot.Y != Projectile.velocity.Y) { Projectile.netUpdate = true; } - Projectile.velocity = vector11; + Projectile.velocity = normalizeShoot; } } if (Projectile.soundDelay <= 0) { - Projectile.soundDelay = num27; + Projectile.soundDelay = 10; Projectile.soundDelay *= 2; if (Projectile.ai[0] != 1f && Projectile.ai[0] <= 500f) { SoundEngine.PlaySound(SoundID.Item15, Projectile.position); } } - if (flag10 && Main.myPlayer == Projectile.owner) + if (isUsing && Main.myPlayer == Projectile.owner) { - bool flag12 = player.channel && !player.noItems && !player.CCed; - if (flag12) + bool canUseItem = player.channel && !player.noItems && !player.CCed; + if (canUseItem) { if (Projectile.ai[0] == 1f) { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + Vector2 projPos = player.RotatedRelativePoint(player.MountedCenter, true); + float projX = (float)Main.mouseX + Main.screenPosition.X - projPos.X; + float projY = (float)Main.mouseY + Main.screenPosition.Y - projPos.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + projY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projPos.Y; } - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + if ((float.IsNaN(projX) && float.IsNaN(projY)) || (projX == 0f && projY == 0f)) { - num78 = (float)player.direction; - num79 = 0f; + projX = (float)player.direction; + projY = 0f; } - vector2 += new Vector2(num78, num79); - int num29 = Projectile.damage; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector2.X, vector2.Y, 0f, 0f, ModContent.ProjectileType(), num29, Projectile.knockBack, Projectile.owner, 0f, (float)Projectile.whoAmI); + projPos += new Vector2(projX, projY); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, (float)Projectile.whoAmI); Projectile.netUpdate = true; } } diff --git a/Projectiles/Ranged/FlakKrakenProj.cs b/Projectiles/Ranged/FlakKrakenProj.cs index ced93ffe25..f2e3b7084b 100644 --- a/Projectiles/Ranged/FlakKrakenProj.cs +++ b/Projectiles/Ranged/FlakKrakenProj.cs @@ -61,71 +61,71 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = Projectile.height = 50; } Player player = Main.player[Projectile.owner]; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + Vector2 projPos = player.RotatedRelativePoint(player.MountedCenter, true); + float projX = (float)Main.mouseX + Main.screenPosition.X - projPos.X; + float projY = (float)Main.mouseY + Main.screenPosition.Y - projPos.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + projY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projPos.Y; } - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + if ((float.IsNaN(projX) && float.IsNaN(projY)) || (projX == 0f && projY == 0f)) { - num78 = (float)player.direction; - num79 = 0f; + projX = (float)player.direction; + projY = 0f; } - vector2 += new Vector2(num78, num79); + projPos += new Vector2(projX, projY); float speed = 30f; float speedScale = 3f; Vector2 vectorPos = Projectile.Center; - if (Vector2.Distance(vector2, vectorPos) < 90f) + if (Vector2.Distance(projPos, vectorPos) < 90f) { speed = 10f; speedScale = 1f; } - if (Vector2.Distance(vector2, vectorPos) < 30f) + if (Vector2.Distance(projPos, vectorPos) < 30f) { speed = 3f; speedScale = 0.3f; } - if (Vector2.Distance(vector2, vectorPos) < 10f) + if (Vector2.Distance(projPos, vectorPos) < 10f) { speed = 1f; speedScale = 0.1f; } - float num678 = vector2.X - vectorPos.X; - float num679 = vector2.Y - vectorPos.Y; - float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); - num680 = speed / num680; - num678 *= num680; - num679 *= num680; - if (Projectile.velocity.X < num678) + float projectileX = projPos.X - vectorPos.X; + float projectileY = projPos.Y - vectorPos.Y; + float projectileAdjust = (float)Math.Sqrt((double)(projectileX * projectileX + projectileY * projectileY)); + projectileAdjust = speed / projectileAdjust; + projectileX *= projectileAdjust; + projectileY *= projectileAdjust; + if (Projectile.velocity.X < projectileX) { Projectile.velocity.X = Projectile.velocity.X + speedScale; - if (Projectile.velocity.X < 0f && num678 > 0f) + if (Projectile.velocity.X < 0f && projectileX > 0f) { Projectile.velocity.X = Projectile.velocity.X + speedScale; } } - else if (Projectile.velocity.X > num678) + else if (Projectile.velocity.X > projectileX) { Projectile.velocity.X = Projectile.velocity.X - speedScale; - if (Projectile.velocity.X > 0f && num678 < 0f) + if (Projectile.velocity.X > 0f && projectileX < 0f) { Projectile.velocity.X = Projectile.velocity.X - speedScale; } } - if (Projectile.velocity.Y < num679) + if (Projectile.velocity.Y < projectileY) { Projectile.velocity.Y = Projectile.velocity.Y + speedScale; - if (Projectile.velocity.Y < 0f && num679 > 0f) + if (Projectile.velocity.Y < 0f && projectileY > 0f) { Projectile.velocity.Y = Projectile.velocity.Y + speedScale; } } - else if (Projectile.velocity.Y > num679) + else if (Projectile.velocity.Y > projectileY) { Projectile.velocity.Y = Projectile.velocity.Y - speedScale; - if (Projectile.velocity.Y > 0f && num679 < 0f) + if (Projectile.velocity.Y > 0f && projectileY < 0f) { Projectile.velocity.Y = Projectile.velocity.Y - speedScale; } diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index ca77612cc8..60fea41a64 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -29,15 +29,15 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - int num103 = (int)Player.FindClosest(Projectile.Center, 1, 1); + int originPlayer = (int)Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; if (Projectile.ai[1] < 110f && Projectile.ai[1] > 30f) { float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + Vector2 projDirection = Main.player[originPlayer].Center - Projectile.Center; + projDirection.Normalize(); + projDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + projDirection) / 25f; Projectile.velocity.Normalize(); Projectile.velocity *= scaleFactor2; } @@ -48,10 +48,10 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 1.02f; } } - int num192 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 1f); - Main.dust[num192].noGravity = true; - Main.dust[num192].velocity *= 0.2f; - Main.dust[num192].position = (Main.dust[num192].position + Projectile.Center) / 2f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].position = (Main.dust[dust].position + Projectile.Center) / 2f; Projectile.frameCounter++; if (Projectile.frameCounter >= 2) { diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index e07c0729ea..923c04e53a 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -28,60 +28,60 @@ namespace CalamityMod.Projectiles.Ranged { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); Color dustColor = Projectile.ai[1] == 1f ? CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f) : default; - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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, 264, 0f, 0f, 100, dustColor, 2f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-30, 31); + float rand2 = (float)Main.rand.Next(-30, 31); + float rand3 = (float)Main.rand.Next(9, 27); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int flashDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 264, 0f, 0f, 100, dustColor, 2f); + Dust dust = Main.dust[flashDust]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Ranged/FlashRoundProj.cs b/Projectiles/Ranged/FlashRoundProj.cs index 969c30540b..970e73351d 100644 --- a/Projectiles/Ranged/FlashRoundProj.cs +++ b/Projectiles/Ranged/FlashRoundProj.cs @@ -38,10 +38,10 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } } } diff --git a/Projectiles/Ranged/FreedomStarHoldout.cs b/Projectiles/Ranged/FreedomStarHoldout.cs index 367ce796af..c742913a0e 100644 --- a/Projectiles/Ranged/FreedomStarHoldout.cs +++ b/Projectiles/Ranged/FreedomStarHoldout.cs @@ -63,20 +63,20 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ai[1] = 0f; shootThisFrame = true; - float num21 = player.inventory[player.selectedItem].shootSpeed * Projectile.scale; - Vector2 value11 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - Projectile.Center; + float speedScale = player.inventory[player.selectedItem].shootSpeed * Projectile.scale; + Vector2 shootDirection = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - Projectile.Center; if (player.gravDir == -1f) - value11.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; + shootDirection.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; - Vector2 velocity2 = Vector2.Normalize(value11); - if (float.IsNaN(velocity2.X) || float.IsNaN(velocity2.Y)) - velocity2 = -Vector2.UnitY; + Vector2 shootVel = Vector2.Normalize(shootDirection); + if (float.IsNaN(shootVel.X) || float.IsNaN(shootVel.Y)) + shootVel = -Vector2.UnitY; - velocity2 *= num21; - if (velocity2.X != Projectile.velocity.X || velocity2.Y != Projectile.velocity.Y) + shootVel *= speedScale; + if (shootVel.X != Projectile.velocity.X || shootVel.Y != Projectile.velocity.Y) Projectile.netUpdate = true; - Projectile.velocity = velocity2; + Projectile.velocity = shootVel; } // Emit sounds. @@ -93,24 +93,20 @@ namespace CalamityMod.Projectiles.Ranged { Vector2 spinningpoint3 = Vector2.UnitX * 32f; spinningpoint3 = spinningpoint3.RotatedBy(Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f)); - Vector2 value12 = Projectile.Center + spinningpoint3; + Vector2 dustSpawn = Projectile.Center + spinningpoint3; for (int k = 0; k < chargeAmt + 1; k++) { - int num22 = 226; - float num23 = 0.4f; + float dustScale = 0.4f; if (k % 2 == 1) - { - num22 = 226; - num23 = 0.65f; - } + dustScale = 0.65f; - Vector2 vector3 = value12 + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (12f - chargeAmt * 2); - int num24 = Dust.NewDust(vector3 - Vector2.One * 8f, 16, 16, num22, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); - Main.dust[num24].velocity = Vector2.Normalize(value12 - vector3) * 1.5f * (10f - chargeAmt * 2f) / 10f; - Main.dust[num24].noGravity = true; - Main.dust[num24].scale = num23; - Main.dust[num24].customData = player; + Vector2 randDustSpawn = dustSpawn + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (12f - chargeAmt * 2); + int electricDust = Dust.NewDust(randDustSpawn - Vector2.One * 8f, 16, 16, 226, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); + Main.dust[electricDust].velocity = Vector2.Normalize(dustSpawn - randDustSpawn) * 1.5f * (10f - chargeAmt * 2f) / 10f; + Main.dust[electricDust].noGravity = true; + Main.dust[electricDust].scale = dustScale; + Main.dust[electricDust].customData = player; } } @@ -119,28 +115,23 @@ namespace CalamityMod.Projectiles.Ranged { Vector2 spinningpoint4 = Vector2.UnitX * 32f; spinningpoint4 = spinningpoint4.RotatedBy(Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f)); - Vector2 vector4 = Projectile.Center + spinningpoint4; + Vector2 dustSpawnLaser = Projectile.Center + spinningpoint4; for (int l = 0; l < 2; l++) { - int num25 = 226; - float num26 = 0.35f; + float dustScale = 0.35f; if (l % 2 == 1) - { - num25 = 226; - num26 = 0.45f; - } - num26 *= MathHelper.Lerp(1f, 3f, lerpAmtForCharge); + dustScale = 0.45f; + dustScale *= MathHelper.Lerp(1f, 3f, lerpAmtForCharge); - float num27 = Main.rand.NextFloatDirection(); - Vector2 value13 = vector4 + (Projectile.rotation + (Projectile.spriteDirection == -1 ? -MathHelper.PiOver2 : MathHelper.PiOver2) + num27 * ((float)Math.PI / 4f) * 0.8f - (float)Math.PI / 2f).ToRotationVector2() * 6f; - int num28 = 24; - int num29 = Dust.NewDust(value13 - Vector2.One * (num28 / 2), num28, num28, num25, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); - Main.dust[num29].velocity = (value13 - vector4).SafeNormalize(Vector2.Zero) * MathHelper.Lerp(1.5f, 9f, Utils.GetLerpValue(1f, 0f, Math.Abs(num27), clamped: true)); - Main.dust[num29].noGravity = true; - Main.dust[num29].scale = num26; - Main.dust[num29].customData = player; - Main.dust[num29].fadeIn = 0.5f; + float randFloat = Main.rand.NextFloatDirection(); + Vector2 randDustSpawnLaser = dustSpawnLaser + (Projectile.rotation + (Projectile.spriteDirection == -1 ? -MathHelper.PiOver2 : MathHelper.PiOver2) + randFloat * ((float)Math.PI / 4f) * 0.8f - (float)Math.PI / 2f).ToRotationVector2() * 6f; + int electric2 = Dust.NewDust(randDustSpawnLaser - Vector2.One * 12, 24, 24, 226, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); + Main.dust[electric2].velocity = (randDustSpawnLaser - dustSpawnLaser).SafeNormalize(Vector2.Zero) * MathHelper.Lerp(1.5f, 9f, Utils.GetLerpValue(1f, 0f, Math.Abs(randFloat), clamped: true)); + Main.dust[electric2].noGravity = true; + Main.dust[electric2].scale = dustScale; + Main.dust[electric2].customData = player; + Main.dust[electric2].fadeIn = 0.5f; } } diff --git a/Projectiles/Ranged/FungiOrb.cs b/Projectiles/Ranged/FungiOrb.cs index e1eafaceba..0f5fdf1a72 100644 --- a/Projectiles/Ranged/FungiOrb.cs +++ b/Projectiles/Ranged/FungiOrb.cs @@ -33,9 +33,9 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 4f) { Vector2 dspeed = -Projectile.velocity * 0.5f; - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity = dspeed; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = dspeed; } } diff --git a/Projectiles/Ranged/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index 477700d940..3a0ee56cec 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 4f) { Vector2 dspeed = -Projectile.velocity * 0.5f; - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity = dspeed; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = dspeed; } if (Projectile.timeLeft < 150) diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index db02bd2eea..1d70dec227 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -28,22 +28,22 @@ namespace CalamityMod.Projectiles.Ranged { if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int i = 0; i < 2; i++) { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) + float halfX = 0f; + float halfY = 0f; + if (i == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + halfX = Projectile.velocity.X * 0.5f; + halfY = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].noGravity = true; + dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust].velocity *= 0.05f; } } if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) @@ -52,16 +52,16 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool()) { - int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); @@ -89,21 +89,20 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Damage(); if (Projectile.owner == Main.myPlayer) { - int num516 = 2; - for (int num517 = 0; num517 < num516; num517++) + for (int j = 0; j < 2; j++) { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) + if (j % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = Projectile.position; - Vector2 value21 = Projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += Projectile.oldVelocity.X / 6f; - num519 += Projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); + Vector2 projPos = Projectile.position; + Vector2 projVel = Projectile.oldVelocity; + projVel.Normalize(); + projVel *= 8f; + float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f; + float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f; + projPos -= projVel * (float)j; + beeVelX += Projectile.oldVelocity.X / 6f; + beeVelY += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; @@ -113,23 +112,23 @@ namespace CalamityMod.Projectiles.Ranged } } SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 20; num621++) + for (int i = 0; i < 20; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[dusty].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[dusty].scale = 0.5f; + Main.dust[dusty].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(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[dusty2].noGravity = true; + Main.dust[dusty2].velocity *= 5f; + dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[dusty2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index 7a26fc0030..9d41dde679 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -28,22 +28,22 @@ namespace CalamityMod.Projectiles.Ranged { if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int i = 0; i < 2; i++) { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) + float halfX = 0f; + float halfY = 0f; + if (i == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + halfX = Projectile.velocity.X * 0.5f; + halfY = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].noGravity = true; + dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust].velocity *= 0.05f; } } if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) @@ -52,16 +52,16 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool()) { - int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); @@ -89,21 +89,20 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Damage(); if (Projectile.owner == Main.myPlayer) { - int num516 = 6; - for (int num517 = 0; num517 < num516; num517++) + for (int j = 0; j < 6; j++) { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) + if (j % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = Projectile.position; - Vector2 value21 = Projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += Projectile.oldVelocity.X / 6f; - num519 += Projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 3), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); + Vector2 projPos = Projectile.position; + Vector2 projVel = Projectile.oldVelocity; + projVel.Normalize(); + projVel *= 8f; + float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f; + float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f; + projPos -= projVel * (float)j; + beeVelX += Projectile.oldVelocity.X / 6f; + beeVelY += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 3), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; @@ -113,23 +112,23 @@ namespace CalamityMod.Projectiles.Ranged } } SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 20; num621++) + for (int i = 0; i < 20; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[dusty].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[dusty].scale = 0.5f; + Main.dust[dusty].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(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[dusty2].noGravity = true; + Main.dust[dusty2].velocity *= 5f; + dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[dusty2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 7973a03439..287f415416 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -28,22 +28,22 @@ namespace CalamityMod.Projectiles.Ranged { if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int i = 0; i < 2; i++) { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) + float halfX = 0f; + float halfY = 0f; + if (i == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + halfX = Projectile.velocity.X * 0.5f; + halfY = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].noGravity = true; + dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust].velocity *= 0.05f; } } if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) @@ -52,16 +52,16 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool()) { - int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); @@ -89,21 +89,20 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Damage(); if (Projectile.owner == Main.myPlayer) { - int num516 = 3; - for (int num517 = 0; num517 < num516; num517++) + for (int j = 0; j < 3; j++) { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) + if (j % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = Projectile.position; - Vector2 value21 = Projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += Projectile.oldVelocity.X / 6f; - num519 += Projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 2), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); + Vector2 projPos = Projectile.position; + Vector2 projVel = Projectile.oldVelocity; + projVel.Normalize(); + projVel *= 8f; + float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f; + float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f; + projPos -= projVel * (float)j; + beeVelX += Projectile.oldVelocity.X / 6f; + beeVelY += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 2), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; @@ -113,23 +112,23 @@ namespace CalamityMod.Projectiles.Ranged } } SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 20; num621++) + for (int i = 0; i < 20; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 2f); + Main.dust[dusty].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[dusty].scale = 0.5f; + Main.dust[dusty].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(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 3f); + Main.dust[dusty2].noGravity = true; + Main.dust[dusty2].velocity *= 5f; + dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 2f); + Main.dust[dusty2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Ranged/KarasawaShot.cs b/Projectiles/Ranged/KarasawaShot.cs index bdcaf53edd..d3e9248584 100644 --- a/Projectiles/Ranged/KarasawaShot.cs +++ b/Projectiles/Ranged/KarasawaShot.cs @@ -38,16 +38,16 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 15f) { - 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); + Vector2 dustPos = Projectile.position; + dustPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 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.2f; + int dusty = Dust.NewDust(dustPos, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 1f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].position = dustPos; + Main.dust[dusty].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[dusty].velocity *= 0.2f; } Projectile.ai[0] += 1f; if (Projectile.ai[0] == 48f) @@ -61,18 +61,18 @@ namespace CalamityMod.Projectiles.Ranged } else { - Vector2 value7 = new Vector2(5f, 10f); + Vector2 randVector = new Vector2(5f, 10f); - for (int num41 = 0; num41 < 2; num41++) + for (int j = 0; j < 2; j++) { - int dustType = num41 == 0 ? dust1 : dust2; - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 1.5f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 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; + int dustType = j == 0 ? dust1 : dust2; + Vector2 randDustPos = Vector2.UnitX * -12f; + randDustPos = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)j * 3.14159274f), default) * randVector * 1.5f; + int dusty2 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + Main.dust[dusty2].scale = 0.75f; + Main.dust[dusty2].noGravity = true; + Main.dust[dusty2].position = Projectile.Center + randDustPos; + Main.dust[dusty2].velocity = Projectile.velocity; } } } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged { float angleRandom = 0.1f; - for (int num53 = 0; num53 < 40; num53++) + for (int k = 0; k < 40; k++) { float dustSpeed = Main.rand.NextFloat(6.0f, 12.0f); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -89,14 +89,14 @@ namespace CalamityMod.Projectiles.Ranged dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? dust1 : dust2; - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Dust dust = Main.dust[num54]; + int newDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Dust dust = Main.dust[newDust]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= randomDustType == dust2 ? 2f : 4f; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + newDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= randomDustType == dust2 ? 1.33f : 2.66f; @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Ranged dust.fadeIn = 1f; dust.color = Color.Blue * 0.5f; } - for (int num55 = 0; num55 < 20; num55++) + for (int l = 0; l < 20; l++) { float dustSpeed = Main.rand.NextFloat(6.0f, 12.0f); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -113,8 +113,8 @@ namespace CalamityMod.Projectiles.Ranged dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? dust1 : dust2; - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Dust dust = Main.dust[num56]; + int newDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Dust dust = Main.dust[newDust2]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; dust.noGravity = true; @@ -138,21 +138,21 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) // 108 dusts + int constant = 36; + for (int i = 0; i < constant; i++) // 108 dusts { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.3f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.3f; + rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool() ? dust1 : dust2, vector7.X * 0.3f, vector7.Y * 0.3f, 100, default, 2f); - Main.dust[num228].noGravity = true; + int killDust = Dust.NewDust(rotate + faceDirection, 0, 0, Main.rand.NextBool() ? dust1 : dust2, faceDirection.X * 0.3f, faceDirection.Y * 0.3f, 100, default, 2f); + Main.dust[killDust].noGravity = true; - int num229 = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool() ? dust1 : dust2, vector7.X * 0.2f, vector7.Y * 0.2f, 100, default, 2f); - Main.dust[num229].noGravity = true; + int killDust2 = Dust.NewDust(rotate + faceDirection, 0, 0, Main.rand.NextBool() ? dust1 : dust2, faceDirection.X * 0.2f, faceDirection.Y * 0.2f, 100, default, 2f); + Main.dust[killDust2].noGravity = true; - int num230 = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool() ? dust1 : dust2, vector7.X * 0.1f, vector7.Y * 0.1f, 100, default, 2f); - Main.dust[num230].noGravity = true; + int killDust3 = Dust.NewDust(rotate + faceDirection, 0, 0, Main.rand.NextBool() ? dust1 : dust2, faceDirection.X * 0.1f, faceDirection.Y * 0.1f, 100, default, 2f); + Main.dust[killDust3].noGravity = true; } bool random = Main.rand.NextBool(); diff --git a/Projectiles/Ranged/LeafArrow.cs b/Projectiles/Ranged/LeafArrow.cs index 04a6fe0a54..9208340d8e 100644 --- a/Projectiles/Ranged/LeafArrow.cs +++ b/Projectiles/Ranged/LeafArrow.cs @@ -84,12 +84,12 @@ namespace CalamityMod.Projectiles.Ranged { SoundEngine.PlaySound(SoundID.Grass, Projectile.position); Projectile.localAI[1] += 1f; - for (int num407 = 0; num407 < 5; num407++) + for (int i = 0; i < 5; i++) { - int num408 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 3f; - Main.dust[num408].scale = 1.5f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 3f; + Main.dust[dust].scale = 1.5f; } } } diff --git a/Projectiles/Ranged/MagnomalyBeam.cs b/Projectiles/Ranged/MagnomalyBeam.cs index c42ae9746f..b8896edfe1 100644 --- a/Projectiles/Ranged/MagnomalyBeam.cs +++ b/Projectiles/Ranged/MagnomalyBeam.cs @@ -39,19 +39,18 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 0; } Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.25f / 255f, Main.DiscoG * 0.25f / 255f, Main.DiscoB * 0.25f / 255f); - float num55 = 100f; - float num56 = 2f; //3 + float inc = 2f; //3 if (Projectile.ai[1] == 0f) { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) + Projectile.localAI[0] += inc; + if (Projectile.localAI[0] > 100f) { - Projectile.localAI[0] = num55; + Projectile.localAI[0] = 100f; } } else { - Projectile.localAI[0] -= num56; + Projectile.localAI[0] -= inc; if (Projectile.localAI[0] <= 0f) { Projectile.Kill(); diff --git a/Projectiles/Ranged/MeowFire.cs b/Projectiles/Ranged/MeowFire.cs index 7871c8fe72..e8dadea34d 100644 --- a/Projectiles/Ranged/MeowFire.cs +++ b/Projectiles/Ranged/MeowFire.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ai[0] += 1f; for (int i = 0; i < 2; i++) { - int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[num299]; + int blueDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[blueDust]; if (Main.rand.NextBool(3)) { dust.noGravity = true; @@ -86,21 +86,21 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int j = 0; j < 10; j++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + int dustHit = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); + Main.dust[dustHit].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[dustHit].scale = 0.5f; + Main.dust[dustHit].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } for (int k = 0; k < 20; k++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f); - 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, 56, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int dustHit2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f); + Main.dust[dustHit2].noGravity = true; + Main.dust[dustHit2].velocity *= 5f; + dustHit2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); + Main.dust[dustHit2].velocity *= 2f; } } } diff --git a/Projectiles/Ranged/MeowFire2.cs b/Projectiles/Ranged/MeowFire2.cs index eca174f82f..5d4fab83d3 100644 --- a/Projectiles/Ranged/MeowFire2.cs +++ b/Projectiles/Ranged/MeowFire2.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ai[0] += 1f; for (int i = 0; i < 2; i++) { - int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[num299]; + int pinkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[pinkDust]; if (Main.rand.NextBool(3)) { dust.noGravity = true; @@ -86,21 +86,21 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int j = 0; j < 10; j++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + int dustHit = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); + Main.dust[dustHit].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[dustHit].scale = 0.5f; + Main.dust[dustHit].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } for (int k = 0; k < 20; k++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.5f); - 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, 73, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int dustHit2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.5f); + Main.dust[dustHit2].noGravity = true; + Main.dust[dustHit2].velocity *= 5f; + dustHit2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); + Main.dust[dustHit2].velocity *= 2f; } } } diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index 6e390a8584..a34793aa1a 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -44,22 +44,22 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.velocity.Length() >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int i = 0; i < 2; i++) { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) + float halfX = 0f; + float halfY = 0f; + if (i == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + halfX = Projectile.velocity.X * 0.5f; + halfY = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + Main.dust[dusty].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dusty].velocity *= 0.2f; + Main.dust[dusty].noGravity = true; + dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dusty].velocity *= 0.05f; } } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); @@ -80,23 +80,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 20; num621++) + for (int j = 0; j < 20; j++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 30; num623++) + for (int k = 0; k < 30; k++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index a61118564e..27a6539751 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 4f) { Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.6f); - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, new Color(237, 242, 242, 200), 1.2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity = dspeed; + int whiteDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, new Color(237, 242, 242, 200), 1.2f); + Main.dust[whiteDust].noGravity = true; + Main.dust[whiteDust].velocity = dspeed; } } diff --git a/Projectiles/Ranged/Nanomachine.cs b/Projectiles/Ranged/Nanomachine.cs index 9cd1ec45bf..75f9d5c6a7 100644 --- a/Projectiles/Ranged/Nanomachine.cs +++ b/Projectiles/Ranged/Nanomachine.cs @@ -63,63 +63,63 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f); float x2 = Projectile.Center.X - Projectile.velocity.X / 10f; float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default, 0.8f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity = dspeed; - Main.dust[num137].noGravity = true; + int nanoDust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default, 0.8f); + Main.dust[nanoDust].alpha = Projectile.alpha; + Main.dust[nanoDust].position.X = x2; + Main.dust[nanoDust].position.Y = y2; + Main.dust[nanoDust].velocity = dspeed; + Main.dust[nanoDust].noGravity = true; - float num138 = (float)Math.Sqrt((double)(Projectile.velocity.X * Projectile.velocity.X + Projectile.velocity.Y * Projectile.velocity.Y)); - float num139 = Projectile.localAI[0]; - if (num139 == 0f) + float velocityAdjust = (float)Math.Sqrt((double)(Projectile.velocity.X * Projectile.velocity.X + Projectile.velocity.Y * Projectile.velocity.Y)); + float aiTracker = Projectile.localAI[0]; + if (aiTracker == 0f) { - Projectile.localAI[0] = num138; - num139 = num138; + Projectile.localAI[0] = velocityAdjust; + aiTracker = velocityAdjust; } - float num140 = Projectile.position.X; - float num141 = Projectile.position.Y; - float num142 = 800f; - bool flag4 = false; - int num143 = 0; + float projX = Projectile.position.X; + float projY = Projectile.position.Y; + float constant = 800f; + bool canHit = false; + int targetID = 0; if (Projectile.ai[1] == 0f) { - for (int num144 = 0; num144 < Main.maxNPCs; num144++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num144].CanBeChasedBy(Projectile, false) && (Projectile.ai[1] == 0f || Projectile.ai[1] == (float)(num144 + 1))) + if (Main.npc[i].CanBeChasedBy(Projectile, false) && (Projectile.ai[1] == 0f || Projectile.ai[1] == (float)(i + 1))) { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num145) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(Projectile.position.X + (float)(Projectile.width / 2), Projectile.position.Y + (float)(Projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + float targetX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float targetY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float targetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - targetX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - targetY); + if (targetDist < constant && 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)) { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; + constant = targetDist; + projX = targetX; + projY = targetY; + canHit = true; + targetID = i; } } } - if (flag4) + if (canHit) { - Projectile.ai[1] = (float)(num143 + 1); + Projectile.ai[1] = (float)(targetID + 1); } - flag4 = false; + canHit = false; } if (Projectile.ai[1] > 0f) { - int num148 = (int)(Projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(Projectile, true) && !Main.npc[num148].dontTakeDamage) + int secondTargetID = (int)(Projectile.ai[1] - 1f); + if (Main.npc[secondTargetID].active && Main.npc[secondTargetID].CanBeChasedBy(Projectile, true) && !Main.npc[secondTargetID].dontTakeDamage) { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num149) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num150); - if (num151 < 1000f) + float secondTargetX = Main.npc[secondTargetID].position.X + (float)(Main.npc[secondTargetID].width / 2); + float secondTargetY = Main.npc[secondTargetID].position.Y + (float)(Main.npc[secondTargetID].height / 2); + float secondTargetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - secondTargetX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - secondTargetY); + if (secondTargetDist < 1000f) { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + canHit = true; + projX = Main.npc[secondTargetID].position.X + (float)(Main.npc[secondTargetID].width / 2); + projY = Main.npc[secondTargetID].position.Y + (float)(Main.npc[secondTargetID].height / 2); } } else @@ -129,21 +129,20 @@ namespace CalamityMod.Projectiles.Ranged } if (!Projectile.friendly) { - flag4 = false; + canHit = false; } - if (flag4) + if (canHit) { - float num152 = num139; - Vector2 vector13 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - Projectile.velocity.X = (Projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - Projectile.velocity.Y = (Projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + Vector2 projPos = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float projXSpeed = projX - projPos.X; + float projYSpeed = projY - projPos.Y; + float projSpeedAdjust = (float)Math.Sqrt((double)(projXSpeed * projXSpeed + projYSpeed * projYSpeed)); + projSpeedAdjust = aiTracker / projSpeedAdjust; + projXSpeed *= projSpeedAdjust; + projYSpeed *= projSpeedAdjust; + int projVelAdjust = 12; + Projectile.velocity.X = (Projectile.velocity.X * (float)(projVelAdjust - 1) + projXSpeed) / (float)projVelAdjust; + Projectile.velocity.Y = (Projectile.velocity.Y * (float)(projVelAdjust - 1) + projYSpeed) / (float)projVelAdjust; } } diff --git a/Projectiles/Ranged/NeedlerProj.cs b/Projectiles/Ranged/NeedlerProj.cs index 01ebd823a5..d01ef19e08 100644 --- a/Projectiles/Ranged/NeedlerProj.cs +++ b/Projectiles/Ranged/NeedlerProj.cs @@ -35,11 +35,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 4f) { - for (int num468 = 0; num468 < 2; num468++) + for (int i = 0; i < 2; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, default, 0.75f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity *= 0f; } } } @@ -54,23 +54,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = Projectile.height = 48; 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 j = 0; j < 3; j++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int k = 0; k < 5; k++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 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, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index e1c5a3eed4..5db379c665 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -64,15 +64,15 @@ namespace CalamityMod.Projectiles.Ranged if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { - float num247 = Projectile.velocity.X * 0.5f; - float num248 = Projectile.velocity.Y * 0.5f; - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + float halfX = Projectile.velocity.X * 0.5f; + float halfY = Projectile.velocity.Y * 0.5f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 1f); + Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].noGravity = true; + dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust].velocity *= 0.05f; } if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) diff --git a/Projectiles/Ranged/NullShot.cs b/Projectiles/Ranged/NullShot.cs index bb6596ff6d..13a6960350 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -31,12 +31,12 @@ namespace CalamityMod.Projectiles.Ranged { float x = Projectile.position.X - Projectile.velocity.X / 10f * (float)num134; float y = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default, 2f); - Main.dust[num135].alpha = Projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; + int dust = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default, 2f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].position.X = x; + Main.dust[dust].position.Y = y; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } } } diff --git a/Projectiles/Ranged/NullShot2.cs b/Projectiles/Ranged/NullShot2.cs index b644ec8077..caad64455d 100644 --- a/Projectiles/Ranged/NullShot2.cs +++ b/Projectiles/Ranged/NullShot2.cs @@ -32,12 +32,12 @@ namespace CalamityMod.Projectiles.Ranged { float x = Projectile.position.X - Projectile.velocity.X / 10f * (float)num134; float y = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num135].alpha = Projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; + int dust = Dust.NewDust(new Vector2(x, y), 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].position.X = x; + Main.dust[dust].position.Y = y; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } } } diff --git a/Projectiles/Ranged/OnyxSharkBomb.cs b/Projectiles/Ranged/OnyxSharkBomb.cs index 8980962e22..2c4aac70e6 100644 --- a/Projectiles/Ranged/OnyxSharkBomb.cs +++ b/Projectiles/Ranged/OnyxSharkBomb.cs @@ -33,22 +33,22 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int i = 0; i < 2; i++) { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) + float halfX = 0f; + float halfY = 0f; + if (i == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + halfX = Projectile.velocity.X * 0.5f; + halfY = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 109, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 159, 0f, 0f, 100, default, 0.25f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int onyxDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 109, 0f, 0f, 100, default, 0.5f); + Main.dust[onyxDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[onyxDust].velocity *= 0.2f; + Main.dust[onyxDust].noGravity = true; + onyxDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 159, 0f, 0f, 100, default, 0.25f); + Main.dust[onyxDust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[onyxDust].velocity *= 0.05f; } } } diff --git a/Projectiles/Ranged/PhangasmBow.cs b/Projectiles/Ranged/PhangasmBow.cs index 124758cf18..28c11d8355 100644 --- a/Projectiles/Ranged/PhangasmBow.cs +++ b/Projectiles/Ranged/PhangasmBow.cs @@ -30,44 +30,44 @@ namespace CalamityMod.Projectiles.Ranged { Lighting.AddLight(Projectile.Center, 0f, 0.7f, 0.5f); Player player = Main.player[Projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float pi = 0f; + Vector2 playerRotation = player.RotatedRelativePoint(player.MountedCenter, true); if (Projectile.spriteDirection == -1) { - num = MathHelper.Pi; + pi = MathHelper.Pi; } Projectile.ai[0] += 1f; - int num39 = 0; + int fireSpeed = 0; if (Projectile.ai[0] >= 90f) { - num39++; + fireSpeed++; } if (Projectile.ai[0] >= 180f) { - num39++; + fireSpeed++; } if (Projectile.ai[0] >= 270f) { - num39++; + fireSpeed++; } - int num40 = 24; - int num41 = 2; + int delayCompare = 24; + int fireSpeedCompare = 2; Projectile.ai[1] -= 1f; - bool flag15 = false; + bool fullSpeed = false; if (Projectile.ai[1] <= 0f) { - Projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - int arg_1EF4_0 = (int)Projectile.ai[0] / (num40 - num41 * num39); + Projectile.ai[1] = (float)(delayCompare - fireSpeedCompare * fireSpeed); + fullSpeed = true; + int arg_1EF4_0 = (int)Projectile.ai[0] / (delayCompare - fireSpeedCompare * fireSpeed); } - bool flag16 = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; + bool canUseItem = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; if (Projectile.localAI[0] > 0f) { Projectile.localAI[0] -= 1f; } - if (Projectile.soundDelay <= 0 && flag16) + if (Projectile.soundDelay <= 0 && canUseItem) { - Projectile.soundDelay = num40 - num41 * num39; + Projectile.soundDelay = delayCompare - fireSpeedCompare * fireSpeed; if (Projectile.ai[0] != 1f) { SoundEngine.PlaySound(SoundID.Item5, Projectile.position); @@ -75,44 +75,43 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 12f; } player.phantasmTime = 2; - if (flag15 && Main.myPlayer == Projectile.owner) + if (fullSpeed && Main.myPlayer == Projectile.owner) { - int num42 = ProjectileID.WoodenArrowFriendly; + int ammoType = ProjectileID.WoodenArrowFriendly; float scaleFactor11 = 14f; int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); float weaponKnockback2 = player.ActiveItem().knockBack; - if (flag16) + if (canUseItem) { - player.PickAmmo(player.ActiveItem(), out num42, out scaleFactor11, out weaponDamage2, out weaponKnockback2, out _); + player.PickAmmo(player.ActiveItem(), out ammoType, out scaleFactor11, out weaponDamage2, out weaponKnockback2, out _); 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 shootDirection = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - playerRotation; if (player.gravDir == -1f) { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + shootDirection.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerRotation.Y; } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + Vector2 normalizeShoot = Vector2.Normalize(shootDirection); + if (float.IsNaN(normalizeShoot.X) || float.IsNaN(normalizeShoot.Y)) { - value19 = -Vector2.UnitY; + normalizeShoot = -Vector2.UnitY; } - value19 *= scaleFactor12; - if (value19.X != Projectile.velocity.X || value19.Y != Projectile.velocity.Y) + normalizeShoot *= scaleFactor12; + if (normalizeShoot.X != Projectile.velocity.X || normalizeShoot.Y != Projectile.velocity.Y) { Projectile.netUpdate = true; } - Projectile.velocity = value19 * 0.55f; - for (int num43 = 0; num43 < 5; num43++) + Projectile.velocity = normalizeShoot * 0.55f; + for (int i = 0; i < 5; i++) { - Vector2 vector20 = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + Vector2 randNormalize = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(randNormalize.X) || float.IsNaN(randNormalize.Y)) { - vector20 = -Vector2.UnitY; + randNormalize = -Vector2.UnitY; } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - int num44 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector21, vector20, num42, weaponDamage2, weaponKnockback2, Projectile.owner); - Main.projectile[num44].noDropItem = true; + Vector2 projRandomPos = playerRotation + Utils.RandomVector2(Main.rand, -15f, 15f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projRandomPos, randNormalize, ammoType, weaponDamage2, weaponKnockback2, Projectile.owner); + Main.projectile[proj].noDropItem = true; } } else diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index 5f40b8d1b0..b9dfbbeb65 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -35,21 +35,20 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.owner == Main.myPlayer) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - int num516 = 6; - for (int num517 = 0; num517 < num516; num517++) + for (int i = 0; i < 6; i++) { - if (num517 % 2 != 1 || Main.rand.NextBool(3)) + if (i % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = Projectile.position; - Vector2 value21 = Projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - num518 += Projectile.oldVelocity.X / 6f; - num519 += Projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 2), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); + Vector2 projPos = Projectile.position; + Vector2 projVel = Projectile.oldVelocity; + projVel.Normalize(); + projVel *= 8f; + float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f; + float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f; + projPos -= projVel * (float)i; + beeVelX += Projectile.oldVelocity.X / 6f; + beeVelY += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 2), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; diff --git a/Projectiles/Ranged/PlagueExplosionFriendly.cs b/Projectiles/Ranged/PlagueExplosionFriendly.cs index efd63aca51..90976dae42 100644 --- a/Projectiles/Ranged/PlagueExplosionFriendly.cs +++ b/Projectiles/Ranged/PlagueExplosionFriendly.cs @@ -25,60 +25,60 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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, 89, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-10, 11); + float rand2 = (float)Main.rand.Next(-10, 11); + float rand3 = (float)Main.rand.Next(3, 9); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int greenDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[greenDust]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Ranged/PlagueTaintedDrone.cs b/Projectiles/Ranged/PlagueTaintedDrone.cs index b66b0b3767..5e48467eee 100644 --- a/Projectiles/Ranged/PlagueTaintedDrone.cs +++ b/Projectiles/Ranged/PlagueTaintedDrone.cs @@ -138,23 +138,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.damage = (int)(Projectile.damage * 0.4f); Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int num621 = 0; num621 < 20; num621++) + for (int i = 0; i < 20; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 40; num623++) + for (int j = 0; j < 40; j++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index d93e3f6d75..0b09ff859b 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -113,12 +113,12 @@ namespace CalamityMod.Projectiles.Ranged int dust = Dust.NewDust(Projectile.Center, 1, 1, 132, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 0.5f); Main.dust[dust].noGravity = true; } - int num212 = Main.rand.Next(10, 20); - for (int num213 = 0; num213 < num212; num213++) + int rando = Main.rand.Next(10, 20); + for (int i = 0; i < rando; i++) { - int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; + int dusty = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + Main.dust[dusty].velocity *= 2f; + Main.dust[dusty].noGravity = true; } } } diff --git a/Projectiles/Ranged/PlanarRipperExplosion.cs b/Projectiles/Ranged/PlanarRipperExplosion.cs index 7fdf54b981..5c2eb17c38 100644 --- a/Projectiles/Ranged/PlanarRipperExplosion.cs +++ b/Projectiles/Ranged/PlanarRipperExplosion.cs @@ -27,38 +27,38 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.15f / 255f); - 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, 132, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-10, 11); + float rand2 = (float)Main.rand.Next(-10, 11); + float rand3 = (float)Main.rand.Next(3, 9); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[dust]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index 642777be45..11e3d3efec 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Ranged dustType = 57; break; } - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2.2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int addedDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2.2f); + Main.dust[addedDust].noGravity = true; + Main.dust[addedDust].velocity *= 0f; CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } @@ -65,11 +65,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { int height = 40; - float num50 = 2.1f; - float num51 = 1.1f; - float num52 = 2.5f; - Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + Vector2 dustRotation = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 dustVel = dustRotation * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; SoundEngine.PlaySound(SoundID.Item14, Projectile.position); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = height; @@ -80,36 +77,36 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.damage /= 2; Projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 20; num53 = num3 + 1) + int inc; + for (int i = 0; i < 20; i = inc + 1) { - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 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 dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, 2.1f); + Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[dust].noGravity = true; + Dust dust = Main.dust[dust]; dust.velocity *= 3f; - 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, dustType, 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[dust]; + dust.velocity += dustVel * Main.rand.NextFloat(); + dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.1f); + Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust = Main.dust[dust]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + dust = Main.dust[dust]; + dust.velocity += dustVel * Main.rand.NextFloat(); + inc = i; } - for (int num55 = 0; num55 < 10; num55 = num3 + 1) + for (int j = 0; j < 10; j = inc + 1) { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 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 extraDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + Main.dust[extraDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; + Main.dust[extraDust].noGravity = true; + Dust dust = Main.dust[extraDust]; dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; + dust = Main.dust[extraDust]; + dust.velocity += dustVel * (0.6f + 0.6f * Main.rand.NextFloat()); + inc = j; } } } diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index 3fefe6e390..555c142e65 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -42,39 +42,39 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); - int num9 = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 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 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); + dustVel = dustVel.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); + int dust = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position = Projectile.Center + dustVel; + Main.dust[dust].velocity = Projectile.velocity * 0.1f; + Main.dust[dust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[dust].position) * 1.25f; } } Projectile.alpha -= 15; - int num58 = 150; + int alphaControl = 150; if (Projectile.Center.Y >= Projectile.ai[1]) - num58 = 0; - if (Projectile.alpha < num58) - Projectile.alpha = num58; + alphaControl = 0; + if (Projectile.alpha < alphaControl) + Projectile.alpha = alphaControl; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 221, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + Vector2 extraDustVel = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 221, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); + Main.dust[extraDust].velocity = extraDustVel * 0.66f; + Main.dust[extraDust].position = Projectile.Center + extraDustVel * 12f; } if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) { - int num60 = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += Projectile.velocity * 0.3f; + int gore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[gore].velocity *= 0.66f; + Main.gore[gore].velocity += Projectile.velocity * 0.3f; } if (Projectile.ai[1] == 1f) diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index 26dfc349c6..c579b5895d 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -33,61 +33,61 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item93, Projectile.position); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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(-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; - int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, + float rand1 = (float)Main.rand.Next(-40, 41); + float rand2 = (float)Main.rand.Next(-40, 41); + float rand3 = (float)Main.rand.Next(12, 36); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Projectile.ai[1] == 1f ? 173 : 221, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num467]; + Dust dust = Main.dust[dust]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } return; } diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs index 0ad3d75f32..7de53d1c2e 100644 --- a/Projectiles/Ranged/PolarStar.cs +++ b/Projectiles/Ranged/PolarStar.cs @@ -45,16 +45,16 @@ namespace CalamityMod.Projectiles.Ranged for (int d = 0; d < 2; d++) { int dustType = d == 0 ? dust1 : dust2; - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)d * MathHelper.Pi), default) * value7; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = dustType == dust1 ? 1.5f : 1f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; - int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0f; + Vector2 dustVel = Vector2.UnitX * -12f; + dustVel = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)d * MathHelper.Pi), default) * value7; + int typeDust = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + Main.dust[typeDust].scale = dustType == dust1 ? 1.5f : 1f; + Main.dust[typeDust].noGravity = true; + Main.dust[typeDust].position = Projectile.Center + dustVel; + Main.dust[typeDust].velocity = Projectile.velocity; + int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Main.dust[extraDust].noGravity = true; + Main.dust[extraDust].velocity *= 0f; } } } @@ -72,19 +72,19 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.alpha = 0; } - float num55 = 30f; - float num56 = 1f; + float boostLevel = 30f; + float inc = 1f; if (Projectile.ai[1] == 1f) { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) + Projectile.localAI[0] += inc; + if (Projectile.localAI[0] > boostLevel) { - Projectile.localAI[0] = num55; + Projectile.localAI[0] = boostLevel; } } else { - Projectile.localAI[0] -= num56; + Projectile.localAI[0] -= inc; if (Projectile.localAI[0] <= 0f) { Projectile.Kill(); @@ -101,19 +101,19 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.alpha = 0; } - float num55 = 40f; - float num56 = 1.5f; + float boostLevel = 40f; + float inc = 1.5f; if (Projectile.ai[1] == 0f) { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) + Projectile.localAI[0] += inc; + if (Projectile.localAI[0] > boostLevel) { - Projectile.localAI[0] = num55; + Projectile.localAI[0] = boostLevel; } } else { - Projectile.localAI[0] -= num56; + Projectile.localAI[0] -= inc; if (Projectile.localAI[0] <= 0f) { Projectile.Kill(); diff --git a/Projectiles/Ranged/RainbowBlast.cs b/Projectiles/Ranged/RainbowBlast.cs index 2920f18fa5..7891a7d5cf 100644 --- a/Projectiles/Ranged/RainbowBlast.cs +++ b/Projectiles/Ranged/RainbowBlast.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 5f) { Vector2 dspeed = -Projectile.velocity * 0.5f; - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, dspeed.X, dspeed.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity = dspeed; + int rainbowDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, dspeed.X, dspeed.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); + Main.dust[rainbowDust].noGravity = true; + Main.dust[rainbowDust].velocity = dspeed; } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); diff --git a/Projectiles/Ranged/RainbowFront.cs b/Projectiles/Ranged/RainbowFront.cs index 4d92dcf146..66c383c5ff 100644 --- a/Projectiles/Ranged/RainbowFront.cs +++ b/Projectiles/Ranged/RainbowFront.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - int num1 = 1200; if (Projectile.owner == Main.myPlayer) { Projectile.localAI[0] += 1f; @@ -29,13 +28,13 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 3f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * (1f / 1000f), Projectile.velocity.Y * (1f / 1000f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - if (Projectile.timeLeft > num1) - Projectile.timeLeft = num1; + if (Projectile.timeLeft > 1200) + Projectile.timeLeft = 1200; } - float num2 = 1f; + float gravityControl = 1f; if (Projectile.velocity.Y < 0f) - num2 -= Projectile.velocity.Y / 3f; - Projectile.ai[0] += num2; + gravityControl -= Projectile.velocity.Y / 3f; + Projectile.ai[0] += gravityControl; if (Projectile.ai[0] > 30f) { Projectile.velocity.Y += 0.5f; @@ -50,11 +49,11 @@ namespace CalamityMod.Projectiles.Ranged } float x = Projectile.velocity.X; float y = Projectile.velocity.Y; - float num3 = 15.95f * Projectile.scale / (float)Math.Sqrt((double)x * (double)x + (double)y * (double)y); - float num4 = x * num3; - float num5 = y * num3; - Projectile.velocity.X = num4; - Projectile.velocity.Y = num5; + float velocityMult = 15.95f * Projectile.scale / (float)Math.Sqrt((double)x * (double)x + (double)y * (double)y); + float xVel = x * velocityMult; + float yVel = y * velocityMult; + Projectile.velocity.X = xVel; + Projectile.velocity.Y = yVel; Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; } diff --git a/Projectiles/Ranged/SandstormBullet.cs b/Projectiles/Ranged/SandstormBullet.cs index bc25c7e9d2..76664ec6b3 100644 --- a/Projectiles/Ranged/SandstormBullet.cs +++ b/Projectiles/Ranged/SandstormBullet.cs @@ -43,9 +43,9 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.alpha = 0; } - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } } @@ -56,16 +56,16 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = Projectile.height = 32; 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 constant = 36; + for (int i = 0; i < constant; 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); - 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, 85, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 1.2f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].noLight = true; + Main.dust[dusty].velocity = faceDirection; } Projectile.maxPenetrate = -1; Projectile.penetrate = -1; diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs index d6f862ecb0..b83770dba8 100644 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ b/Projectiles/Ranged/SandyWaifuShark.cs @@ -30,10 +30,10 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - int num192 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 32, 0f, 0f, 0, default, 0.5f); - Main.dust[num192].noGravity = true; - Main.dust[num192].velocity *= 0.2f; - Main.dust[num192].position = (Main.dust[num192].position + Projectile.Center) / 2f; + int sandy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 32, 0f, 0f, 0, default, 0.5f); + Main.dust[sandy].noGravity = true; + Main.dust[sandy].velocity *= 0.2f; + Main.dust[sandy].position = (Main.dust[sandy].position + Projectile.Center) / 2f; Projectile.frameCounter++; if (Projectile.frameCounter > 6) @@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Ranged { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; 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, 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, 0); return false; } diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index 5df6e719b8..df62ddf822 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -55,18 +55,18 @@ namespace CalamityMod.Projectiles.Ranged { for (int j = 0; j < 2; j++) { - float num247 = 0f; - float num248 = 0f; + float halfX = 0f; + float halfY = 0f; if (j == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + halfX = Projectile.velocity.X * 0.5f; + halfY = Projectile.velocity.Y * 0.5f; } - int explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); Main.dust[explosion].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[explosion].velocity *= 0.2f; Main.dust[explosion].noGravity = true; - explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); Main.dust[explosion].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[explosion].velocity *= 0.05f; } diff --git a/Projectiles/Ranged/SeasSearingBubble.cs b/Projectiles/Ranged/SeasSearingBubble.cs index a2bfb0b4b8..ac4c5e9213 100644 --- a/Projectiles/Ranged/SeasSearingBubble.cs +++ b/Projectiles/Ranged/SeasSearingBubble.cs @@ -38,25 +38,25 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.timeLeft < 475) { - 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, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); - Dust dust = Main.dust[num102]; + float dustVelX = Projectile.velocity.X / 3f * (float)i; + float dustVelY = Projectile.velocity.Y / 3f * (float)i; + int four = 4; + int dust = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); + Dust dust = Main.dust[dust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= num99; - dust.position.Y -= num100; + dust.position.X -= dustVelX; + dust.position.Y -= dustVelY; } if (Main.rand.NextBool(10)) { - 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, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += Projectile.velocity * 0.5f; + int otherFour = 4; + int otherDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFour, Projectile.position.Y + (float)otherFour), Projectile.width - otherFour * 2, Projectile.height - otherFour * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 0.6f); + Main.dust[otherDust].velocity *= 0.25f; + Main.dust[otherDust].velocity += Projectile.velocity * 0.5f; } } } diff --git a/Projectiles/Ranged/SeasSearingSecondary.cs b/Projectiles/Ranged/SeasSearingSecondary.cs index 48571fb3d9..dfe4fc6006 100644 --- a/Projectiles/Ranged/SeasSearingSecondary.cs +++ b/Projectiles/Ranged/SeasSearingSecondary.cs @@ -32,14 +32,14 @@ namespace CalamityMod.Projectiles.Ranged 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, 217, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - int num470 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 202, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); - Main.dust[num470].noGravity = true; - Main.dust[num470].velocity *= 0f; + int aquaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 217, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); + Main.dust[aquaDust].noGravity = true; + Main.dust[aquaDust].velocity *= 0f; + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 202, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); + Main.dust[waterDust].noGravity = true; + Main.dust[waterDust].velocity *= 0f; } } } diff --git a/Projectiles/Ranged/SeasSearingSpout.cs b/Projectiles/Ranged/SeasSearingSpout.cs index bf6cd5e195..8e2d8310d5 100644 --- a/Projectiles/Ranged/SeasSearingSpout.cs +++ b/Projectiles/Ranged/SeasSearingSpout.cs @@ -32,11 +32,11 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - int num613 = 10; - int num614 = 15; - float num615 = 1f; - int num616 = 150; - int num617 = 42; + int projScale1 = 10; + int projScale2 = 15; + float thirdProjScale = 1f; + int projWidthScale = 150; + int projHeightScale = 42; if (Projectile.velocity.X != 0f) { Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); @@ -56,18 +56,18 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 1f; Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); - Projectile.width = (int)((float)num616 * Projectile.scale); - Projectile.height = (int)((float)num617 * Projectile.scale); + Projectile.scale = ((float)(projScale1 + projScale2) - Projectile.ai[1]) * thirdProjScale / (float)(projScale2 + projScale1); + Projectile.width = (int)((float)projWidthScale * Projectile.scale); + Projectile.height = (int)((float)projHeightScale * Projectile.scale); Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } if (Projectile.ai[1] != -1f) { - Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); - Projectile.width = (int)((float)num616 * Projectile.scale); - Projectile.height = (int)((float)num617 * Projectile.scale); + Projectile.scale = ((float)(projScale1 + projScale2) - Projectile.ai[1]) * thirdProjScale / (float)(projScale2 + projScale1); + Projectile.width = (int)((float)projWidthScale * Projectile.scale); + Projectile.height = (int)((float)projHeightScale * Projectile.scale); } if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { @@ -93,21 +93,21 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.netUpdate = true; Vector2 center = Projectile.Center; - center.Y -= (float)num617 * Projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - Projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; + center.Y -= (float)projHeightScale * Projectile.scale / 2f; + float projSpawn = ((float)(projScale1 + projScale2) - Projectile.ai[1] + 1f) * thirdProjScale / (float)(projScale2 + projScale1); + center.Y -= (float)projHeightScale * projSpawn / 2f; center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 10f, Projectile.ai[1] - 1f); } if (Projectile.ai[0] <= 0f) { - float num622 = 0.104719758f; - float num623 = (float)Projectile.width / 5f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; - Projectile.position.X = Projectile.position.X - num624 * (float)-(float)Projectile.direction; + float swaySize = 0.104719758f; + float smolWidth = (float)Projectile.width / 5f; + float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; + Projectile.position.X = Projectile.position.X - projXChange * (float)-(float)Projectile.direction; Projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; - Projectile.position.X = Projectile.position.X + num624 * (float)-(float)Projectile.direction; + projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; + Projectile.position.X = Projectile.position.X + projXChange * (float)-(float)Projectile.direction; } } @@ -119,9 +119,9 @@ namespace CalamityMod.Projectiles.Ranged 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/Ranged/SepticSkewerBacteria.cs b/Projectiles/Ranged/SepticSkewerBacteria.cs index ba79346b10..4986e8367c 100644 --- a/Projectiles/Ranged/SepticSkewerBacteria.cs +++ b/Projectiles/Ranged/SepticSkewerBacteria.cs @@ -26,15 +26,15 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - int num297 = 171; + int dustType = 171; if (Main.rand.Next(3) == 0) { - num297 = 46; + dustType = 46; } - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - float num944 = 1f - (float)Projectile.alpha / 255f; - num944 *= Projectile.scale; + int toxicDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[toxicDust].noGravity = true; + float scaleAlpha = 1f - (float)Projectile.alpha / 255f; + scaleAlpha *= Projectile.scale; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 90f) { @@ -49,28 +49,28 @@ namespace CalamityMod.Projectiles.Ranged Projectile.scale -= 0.003f; } Projectile.rotation += 0.0025f * Projectile.scale; - float num945 = 1f; - float num946 = 1f; + float yVelControl = 1f; + float xVelControl = 1f; if (Projectile.identity % 6 == 0) { - num946 *= -1f; + xVelControl *= -1f; } if (Projectile.identity % 6 == 1) { - num945 *= -1f; + yVelControl *= -1f; } if (Projectile.identity % 6 == 2) { - num946 *= -1f; - num945 *= -1f; + xVelControl *= -1f; + yVelControl *= -1f; } if (Projectile.identity % 6 == 3) { - num946 = 0f; + xVelControl = 0f; } if (Projectile.identity % 6 == 4) { - num945 = 0f; + yVelControl = 0f; } Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 60f) @@ -79,13 +79,13 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.localAI[1] >= -60f) { - Projectile.velocity.X = Projectile.velocity.X + 0.002f * num946; - Projectile.velocity.Y = Projectile.velocity.Y + 0.002f * num945; + Projectile.velocity.X = Projectile.velocity.X + 0.002f * xVelControl; + Projectile.velocity.Y = Projectile.velocity.Y + 0.002f * yVelControl; } else { - Projectile.velocity.X = Projectile.velocity.X - 0.002f * num946; - Projectile.velocity.Y = Projectile.velocity.Y - 0.002f * num945; + Projectile.velocity.X = Projectile.velocity.X - 0.002f * xVelControl; + Projectile.velocity.Y = Projectile.velocity.Y - 0.002f * yVelControl; } Projectile.ai[0] += 1f; if (Projectile.ai[0] > 5400f) @@ -107,36 +107,36 @@ namespace CalamityMod.Projectiles.Ranged } else { - float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (num947 > 4f) + float playerDist = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; + if (playerDist > 4f) { - num947 *= 1.1f; + playerDist *= 1.1f; } - if (num947 > 5f) + if (playerDist > 5f) { - num947 *= 1.2f; + playerDist *= 1.2f; } - if (num947 > 6f) + if (playerDist > 6f) { - num947 *= 1.3f; + playerDist *= 1.3f; } - if (num947 > 7f) + if (playerDist > 7f) { - num947 *= 1.4f; + playerDist *= 1.4f; } - if (num947 > 8f) + if (playerDist > 8f) { - num947 *= 1.5f; + playerDist *= 1.5f; } - if (num947 > 9f) + if (playerDist > 9f) { - num947 *= 1.6f; + playerDist *= 1.6f; } - if (num947 > 10f) + if (playerDist > 10f) { - num947 *= 1.7f; + playerDist *= 1.7f; } - Projectile.ai[0] += num947; + Projectile.ai[0] += playerDist; if (Projectile.alpha > 50) { Projectile.alpha -= 10; @@ -163,16 +163,16 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = Projectile.height = 56; 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 constant = 36; + for (int i = 0; i < constant; 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, 171, vector7.X, vector7.Y, 100, default, 0.5f); - 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 171, faceDirection.X, faceDirection.Y, 100, default, 0.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = faceDirection; } } } diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 059a36a043..001bf2a433 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 171, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - Vector2 vector62 = player.Center - Projectile.Center; + Vector2 playerDist = player.Center - Projectile.Center; Projectile.ai[1] += 1f; if (Projectile.ai[1] > 5f) { @@ -39,11 +39,11 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.ai[1] % 8f == 0f && Projectile.owner == Main.myPlayer && Main.rand.NextBool(5)) { - Vector2 vector63 = vector62 * -1f; - vector63.Normalize(); - vector63 *= Main.rand.Next(45, 65) * 0.1f; - vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver2); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.175), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); + Vector2 harpoonPos = playerDist * -1f; + harpoonPos.Normalize(); + harpoonPos *= Main.rand.Next(45, 65) * 0.1f; + harpoonPos = harpoonPos.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, harpoonPos.X, harpoonPos.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.175), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); } if (player.dead) { @@ -69,9 +69,9 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.extraUpdates = 3; } - Vector2 vector14 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float xDist = player.position.X + (float)(player.width / 2) - vector14.X; - float yDist = player.position.Y + (float)(player.height / 2) - vector14.Y; + Vector2 halfDist = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float xDist = player.position.X + (float)(player.width / 2) - halfDist.X; + float yDist = player.position.Y + (float)(player.height / 2) - halfDist.Y; float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (Projectile.ai[0] == 0f) { diff --git a/Projectiles/Ranged/Shell.cs b/Projectiles/Ranged/Shell.cs index bdb264fb45..bafa88139a 100644 --- a/Projectiles/Ranged/Shell.cs +++ b/Projectiles/Ranged/Shell.cs @@ -36,11 +36,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 18; 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 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 3f; } } } diff --git a/Projectiles/Ranged/Shockblast.cs b/Projectiles/Ranged/Shockblast.cs index 1b30da272c..95b8098c1d 100644 --- a/Projectiles/Ranged/Shockblast.cs +++ b/Projectiles/Ranged/Shockblast.cs @@ -26,40 +26,40 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(Projectile.Center, 0f, 0f, 0.25f); - 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 (num462 < num461) + int timerCounter = 0; + while (timerCounter < projTimer) { float sizeMultiplier = (Projectile.ai[1] * 0.5f) + 1f; - float num463 = Main.rand.Next(-10, 11) * sizeMultiplier; - float num464 = Main.rand.Next(-10, 11) * sizeMultiplier; - float num465 = Main.rand.Next(3, 9) * sizeMultiplier; - float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 185); - Dust dust = Main.dust[num467]; + float rand1 = Main.rand.Next(-10, 11) * sizeMultiplier; + float rand2 = Main.rand.Next(-10, 11) * sizeMultiplier; + float rand3 = Main.rand.Next(3, 9) * sizeMultiplier; + float randAdjust = (float)Math.Sqrt(rand1 * rand1 + rand2 * rand2); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 185); + Dust dust = Main.dust[dust]; dust.scale = sizeMultiplier; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; dust.position.X += Main.rand.Next(-10, 11); dust.position.Y += Main.rand.Next(-10, 11); - dust.velocity.X = num463; - dust.velocity.Y = num464; - num462++; + dust.velocity.X = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } } diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index b42fa38849..53c778ac36 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -55,17 +55,17 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num136 = 0; num136 < 2; num136++) + for (int i = 0; i < 2; i++) { Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.7f); - float x2 = Projectile.Center.X - Projectile.velocity.X / 10f * num136; - float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f * num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity = dspeed; - Main.dust[num137].noGravity = true; + float x2 = Projectile.Center.X - Projectile.velocity.X / 10f * i; + float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f * i; + int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default, 1f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].position.X = x2; + Main.dust[dust].position.Y = y2; + Main.dust[dust].velocity = dspeed; + Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Ranged/Sickness.cs b/Projectiles/Ranged/Sickness.cs index 487edd4241..ebe589bd6f 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -27,60 +27,60 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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, 107, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-10, 11); + float rand2 = (float)Main.rand.Next(-10, 11); + float rand3 = (float)Main.rand.Next(3, 9); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[dust]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index 95847ac1c4..db2e6c3e55 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -43,12 +43,12 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dspeed = -Projectile.velocity * 0.5f; float x2 = Projectile.Center.X - Projectile.velocity.X / 10f; float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 1f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity = dspeed; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 1f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].position.X = x2; + Main.dust[dust].position.Y = y2; + Main.dust[dust].velocity = dspeed; + Main.dust[dust].noGravity = true; } //Rotation diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 0eafc78361..a37f5e7ca3 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -41,12 +41,12 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dspeed = -Projectile.velocity * 0.5f; float x2 = Projectile.Center.X - Projectile.velocity.X / 10f; float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity = dspeed; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].position.X = x2; + Main.dust[dust].position.Y = y2; + Main.dust[dust].velocity = dspeed; + Main.dust[dust].noGravity = true; //Rotation Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index 70988f3cd6..692159f391 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -35,9 +35,9 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 4f) { Vector2 dspeed = -Projectile.velocity * 0.7f; - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity = dspeed; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = dspeed; } } diff --git a/Projectiles/Ranged/SmallCoral.cs b/Projectiles/Ranged/SmallCoral.cs index fa84464d40..9d41b75d69 100644 --- a/Projectiles/Ranged/SmallCoral.cs +++ b/Projectiles/Ranged/SmallCoral.cs @@ -37,11 +37,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 16; 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 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 51, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 51, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 2f; } } } diff --git a/Projectiles/Ranged/SputterComet.cs b/Projectiles/Ranged/SputterComet.cs index 7721de79eb..079b157173 100644 --- a/Projectiles/Ranged/SputterComet.cs +++ b/Projectiles/Ranged/SputterComet.cs @@ -35,10 +35,10 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, 0.1f, 0.3f, 0.8f); if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } if (Projectile.soundDelay == 0) { @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Main.netMode != NetmodeID.Server) { - for (int num480 = 0; num480 < 3; num480++) + for (int i = 0; i < 3; i++) { 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/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 8346322bad..6a6b18f70c 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -35,10 +35,10 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } if (Projectile.soundDelay == 0) { @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Main.netMode != NetmodeID.Server) { - for (int num480 = 0; num480 < 3; num480++) + for (int i = 0; i < 3; i++) { 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/Ranged/SpykerProj.cs b/Projectiles/Ranged/SpykerProj.cs index 80bb0fc9c0..4e9c7f5c90 100644 --- a/Projectiles/Ranged/SpykerProj.cs +++ b/Projectiles/Ranged/SpykerProj.cs @@ -42,11 +42,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 4f) { - for (int num468 = 0; num468 < 2; num468++) + for (int i = 0; i < 2; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int poisonDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, default, 0.75f); + Main.dust[poisonDust].noGravity = true; + Main.dust[poisonDust].velocity *= 0f; } } } @@ -75,23 +75,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); } } - for (int num621 = 0; num621 < 3; num621++) + for (int j = 0; j < 3; j++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int k = 0; k < 5; k++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs index 9c443cdf87..ad559d9775 100644 --- a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs +++ b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs @@ -154,11 +154,11 @@ namespace CalamityMod.Projectiles.Ranged if (npc.type == NPCID.SolarCrawltipedeTail) { Rectangle rect = npc.Hitbox; - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; + int rectSizeChange = 8; + rect.X -= rectSizeChange; + rect.Y -= rectSizeChange; + rect.Width += rectSizeChange * 2; + rect.Height += rectSizeChange * 2; stickingToNPC = Projectile.Colliding(myRect, rect); } else @@ -194,13 +194,13 @@ namespace CalamityMod.Projectiles.Ranged if (projCount >= array2.Length) { - int num30 = 0; + int maxProj = 0; for (int m = 1; m < array2.Length; m++) { - if (array2[m].Y < array2[num30].Y) - num30 = m; + if (array2[m].Y < array2[maxProj].Y) + maxProj = m; } - Main.projectile[array2[num30].X].Kill(); + Main.projectile[array2[maxProj].X].Kill(); } } } diff --git a/Projectiles/Ranged/StarmageddonStar.cs b/Projectiles/Ranged/StarmageddonStar.cs index 659416dca9..0073f789b5 100644 --- a/Projectiles/Ranged/StarmageddonStar.cs +++ b/Projectiles/Ranged/StarmageddonStar.cs @@ -123,14 +123,14 @@ namespace CalamityMod.Projectiles.Ranged for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(speed.ToRotation()), default); - int num9 = Dust.NewDust(position, 0, 0, 221, 0f, 0f, 0, default, 1f); - Main.dust[num9].noGravity = true; - Main.dust[num9].position = position + vector3; - Main.dust[num9].velocity = speed * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(position - speed * 3f - Main.dust[num9].position) * 1.25f; + Vector2 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); + dustVel = dustVel.RotatedBy((double)(speed.ToRotation()), default); + int starDust = Dust.NewDust(position, 0, 0, 221, 0f, 0f, 0, default, 1f); + Main.dust[starDust].noGravity = true; + Main.dust[starDust].position = position + dustVel; + Main.dust[starDust].velocity = speed * 0.1f; + Main.dust[starDust].velocity = Vector2.Normalize(position - speed * 3f - Main.dust[starDust].position) * 1.25f; } int type = Utils.SelectRandom(Main.rand, new int[] diff --git a/Projectiles/Ranged/StarmageddonStar2.cs b/Projectiles/Ranged/StarmageddonStar2.cs index b3c47abd6e..9ff6e176c5 100644 --- a/Projectiles/Ranged/StarmageddonStar2.cs +++ b/Projectiles/Ranged/StarmageddonStar2.cs @@ -123,14 +123,14 @@ namespace CalamityMod.Projectiles.Ranged for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(speed.ToRotation()), default); - int num9 = Dust.NewDust(position, 0, 0, 221, 0f, 0f, 0, default, 1f); - Main.dust[num9].noGravity = true; - Main.dust[num9].position = position + vector3; - Main.dust[num9].velocity = speed * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(position - speed * 3f - Main.dust[num9].position) * 1.25f; + Vector2 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); + dustVel = dustVel.RotatedBy((double)(speed.ToRotation()), default); + int starDust = Dust.NewDust(position, 0, 0, 221, 0f, 0f, 0, default, 1f); + Main.dust[starDust].noGravity = true; + Main.dust[starDust].position = position + dustVel; + Main.dust[starDust].velocity = speed * 0.1f; + Main.dust[starDust].velocity = Vector2.Normalize(position - speed * 3f - Main.dust[starDust].position) * 1.25f; } int type = Utils.SelectRandom(Main.rand, new int[] diff --git a/Projectiles/Ranged/StormSurgeTornado.cs b/Projectiles/Ranged/StormSurgeTornado.cs index cef40679e6..5fb3d959db 100644 --- a/Projectiles/Ranged/StormSurgeTornado.cs +++ b/Projectiles/Ranged/StormSurgeTornado.cs @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Ranged 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/Ranged/SuperballBulletProj.cs b/Projectiles/Ranged/SuperballBulletProj.cs index 70cf6abf54..c64b5b19d4 100644 --- a/Projectiles/Ranged/SuperballBulletProj.cs +++ b/Projectiles/Ranged/SuperballBulletProj.cs @@ -36,10 +36,10 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); + Main.dust[dust].alpha = Projectile.alpha; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; } } } diff --git a/Projectiles/Ranged/ThePackMinissile.cs b/Projectiles/Ranged/ThePackMinissile.cs index a6ed7c8af7..b4a5346673 100644 --- a/Projectiles/Ranged/ThePackMinissile.cs +++ b/Projectiles/Ranged/ThePackMinissile.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1f); + int DUST = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1f); } } diff --git a/Projectiles/Ranged/ThePackMissile.cs b/Projectiles/Ranged/ThePackMissile.cs index 537db21772..4275d0a5f7 100644 --- a/Projectiles/Ranged/ThePackMissile.cs +++ b/Projectiles/Ranged/ThePackMissile.cs @@ -89,23 +89,23 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 400; 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 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1.5f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1.5f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].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, 255, 0f, 0f, 0, default, 2f); - 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, 255, 0f, 0f, 0, default, 1.5f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 2f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1.5f); + Main.dust[dust2].velocity *= 2f; } Projectile.Damage(); } diff --git a/Projectiles/Ranged/TorrentialArrow.cs b/Projectiles/Ranged/TorrentialArrow.cs index ef1d951cee..5dcced44bc 100644 --- a/Projectiles/Ranged/TorrentialArrow.cs +++ b/Projectiles/Ranged/TorrentialArrow.cs @@ -34,19 +34,18 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.alpha = 0; } - float num55 = 40f; - float num56 = 1.5f; + float inc = 1.5f; if (Projectile.ai[1] == 0f) { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) + Projectile.localAI[0] += inc; + if (Projectile.localAI[0] > 40f) { - Projectile.localAI[0] = num55; + Projectile.localAI[0] = 40f; } } else { - Projectile.localAI[0] -= num56; + Projectile.localAI[0] -= inc; if (Projectile.localAI[0] <= 0f) { Projectile.Kill(); diff --git a/Projectiles/Ranged/TyphoonBubble.cs b/Projectiles/Ranged/TyphoonBubble.cs index 7cadb2c430..9eda039def 100644 --- a/Projectiles/Ranged/TyphoonBubble.cs +++ b/Projectiles/Ranged/TyphoonBubble.cs @@ -31,23 +31,23 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.ai[1] > 0f) { - int num625 = (int)Projectile.ai[1] - 1; - if (num625 < 255) + int playerOwner = (int)Projectile.ai[1] - 1; + if (playerOwner < 255) { Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 10f) { - int num626 = 6; - for (int num627 = 0; num627 < num626; num627++) + int six = 6; + for (int i = 0; i < six; 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, 172, 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 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)(i - (six / 2 - 1)) * 3.1415926535897931 / (double)(float)six, default) + Projectile.Center; + Vector2 dustPos = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int typhoonDust = Dust.NewDust(rotate + dustPos, 0, 0, 172, dustPos.X * 2f, dustPos.Y * 2f, 100, default, 1.4f); + Main.dust[typhoonDust].noGravity = true; + Main.dust[typhoonDust].noLight = true; + Main.dust[typhoonDust].velocity /= 4f; + Main.dust[typhoonDust].velocity -= Projectile.velocity; } Projectile.alpha -= 5; if (Projectile.alpha < 100) @@ -57,11 +57,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation += Projectile.velocity.X * 0.1f; Projectile.frame = (int)(Projectile.localAI[0] / 3f) % 3; } - 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 playerDist = Main.player[playerOwner].Center - Projectile.Center; + float velocityMult = 4f; + velocityMult += Projectile.localAI[0] / 20f; + Projectile.velocity = Vector2.Normalize(playerDist) * velocityMult; + if (playerDist.Length() < 50f) { Projectile.Kill(); } @@ -69,13 +69,13 @@ namespace CalamityMod.Projectiles.Ranged } 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 smolWidth = 4f; + float projXChange = (float)(Math.Cos((double)(swaySize * Projectile.ai[0])) - 0.5) * smolWidth; + 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) * smolWidth; + Projectile.velocity.Y = Projectile.velocity.Y + projXChange; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 10f) { @@ -98,16 +98,16 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int constant = 36; + for (int j = 0; j < constant; 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, 172, 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)(j - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int waterDust = Dust.NewDust(rotate + faceDirection, 0, 0, 172, faceDirection.X * 2f, faceDirection.Y * 2f, 100, default, 1.4f); + Main.dust[waterDust].noGravity = true; + Main.dust[waterDust].noLight = true; + Main.dust[waterDust].velocity = faceDirection; } if (Projectile.owner == Main.myPlayer) { @@ -115,13 +115,13 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.localAI[1] == 1f) { - int num230 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - (float)(Projectile.direction * 30), Projectile.Center.Y - 4f, (float)-(float)Projectile.direction * 0.01f, 0f, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, 16f, 8f); - Main.projectile[num230].netUpdate = true; + int nextSegment = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - (float)(Projectile.direction * 30), Projectile.Center.Y - 4f, (float)-(float)Projectile.direction * 0.01f, 0f, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, 16f, 8f); + Main.projectile[nextSegment].netUpdate = true; } else { - int num230 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - (float)(Projectile.direction * 30), Projectile.Center.Y - 4f, (float)-(float)Projectile.direction * 0.01f, 0f, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, 16f, 8f); - Main.projectile[num230].netUpdate = true; + int nextSegment = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - (float)(Projectile.direction * 30), Projectile.Center.Y - 4f, (float)-(float)Projectile.direction * 0.01f, 0f, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, 16f, 8f); + Main.projectile[nextSegment].netUpdate = true; } } } diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs index 8fbd68856a..9deeeba52c 100644 --- a/Projectiles/Ranged/Voidragon.cs +++ b/Projectiles/Ranged/Voidragon.cs @@ -41,40 +41,40 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 0f; 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, 173, 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 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + dustVel = dustVel.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int shadowDust = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); + Main.dust[shadowDust].scale = 1.1f; + Main.dust[shadowDust].noGravity = true; + Main.dust[shadowDust].position = Projectile.Center + dustVel; + Main.dust[shadowDust].velocity = Projectile.velocity * 0.1f; + Main.dust[shadowDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[shadowDust].position) * 1.25f; } } Projectile.alpha -= 15; - int num58 = 150; + int alphaControl = 150; if (Projectile.Center.Y >= Projectile.ai[1]) { - num58 = 0; + alphaControl = 0; } - if (Projectile.alpha < num58) + if (Projectile.alpha < alphaControl) { - Projectile.alpha = num58; + Projectile.alpha = alphaControl; } Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[extraDust].velocity = value3 * 0.66f; + Main.dust[extraDust].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) { - int num60 = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += Projectile.velocity * 0.3f; + int voidGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[voidGore].velocity *= 0.66f; + Main.gore[voidGore].velocity += Projectile.velocity * 0.3f; } if (Projectile.ai[1] == 1f) { diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index 58de50fb19..64606cf8f3 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -31,11 +31,11 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - int num613 = 10; - int num614 = 15; - float num615 = 1f; - int num616 = 150; - int num617 = 42; + int projScale1 = 10; + int projScale2 = 15; + float thirdProjScale = 1f; + int projWidthScale = 150; + int projHeightScale = 42; if (Projectile.velocity.X != 0f) { Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); @@ -55,18 +55,18 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 1f; Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); - Projectile.width = (int)((float)num616 * Projectile.scale); - Projectile.height = (int)((float)num617 * Projectile.scale); + Projectile.scale = ((float)(projScale1 + projScale2) - Projectile.ai[1]) * thirdProjScale / (float)(projScale2 + projScale1); + Projectile.width = (int)((float)projWidthScale * Projectile.scale); + Projectile.height = (int)((float)projHeightScale * Projectile.scale); Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } if (Projectile.ai[1] != -1f) { - Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); - Projectile.width = (int)((float)num616 * Projectile.scale); - Projectile.height = (int)((float)num617 * Projectile.scale); + Projectile.scale = ((float)(projScale1 + projScale2) - Projectile.ai[1]) * thirdProjScale / (float)(projScale2 + projScale1); + Projectile.width = (int)((float)projWidthScale * Projectile.scale); + Projectile.height = (int)((float)projHeightScale * Projectile.scale); } if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { @@ -92,30 +92,30 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.netUpdate = true; Vector2 center = Projectile.Center; - center.Y -= (float)num617 * Projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - Projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; + center.Y -= (float)projHeightScale * Projectile.scale / 2f; + float projSpawn = ((float)(projScale1 + projScale2) - Projectile.ai[1] + 1f) * thirdProjScale / (float)(projScale2 + projScale1); + center.Y -= (float)projHeightScale * projSpawn / 2f; center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 10f, Projectile.ai[1] - 1f); } if (Projectile.ai[0] <= 0f) { - float num622 = 0.104719758f; - float num623 = (float)Projectile.width / 5f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; - Projectile.position.X = Projectile.position.X - num624 * (float)-(float)Projectile.direction; + float swaySize = 0.104719758f; + float smolWidth = (float)Projectile.width / 5f; + float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; + Projectile.position.X = Projectile.position.X - projXChange * (float)-(float)Projectile.direction; Projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; - Projectile.position.X = Projectile.position.X + num624 * (float)-(float)Projectile.direction; + projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; + Projectile.position.X = Projectile.position.X + projXChange * (float)-(float)Projectile.direction; } } 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; } } From ae561d25bc0aa4a15376b9f8b46b7f0381531d75 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 19 Oct 2023 12:38:38 -0400 Subject: [PATCH 03/43] Summon HauntedDishes code can suffer in the icy depths of Treachery --- Projectiles/Summon/AngelBolt.cs | 16 +- Projectiles/Summon/ApexShark.cs | 128 ++++++------ Projectiles/Summon/AstrageldonSummon.cs | 47 +++-- Projectiles/Summon/AureusBomber.cs | 34 ++-- Projectiles/Summon/BabyBloodCrawler.cs | 22 +-- Projectiles/Summon/BabyPlaguebringer.cs | 122 ++++++------ .../Summon/BrimstoneElementalMinion.cs | 78 ++++---- .../Summon/BrimstoneExplosionMinion.cs | 38 ++-- Projectiles/Summon/BrimstoneFireballMinion.cs | 8 +- Projectiles/Summon/CausticStaffSummon.cs | 10 +- Projectiles/Summon/CorroslimeMinion.cs | 28 +-- .../Summon/CorruptionSlimeGodMinion.cs | 22 +-- Projectiles/Summon/CosmicBlast.cs | 30 +-- Projectiles/Summon/CosmicBlastBig.cs | 34 ++-- Projectiles/Summon/CosmicEnergySpiral.cs | 146 +++++++------- Projectiles/Summon/CosmicViperSummon.cs | 10 +- Projectiles/Summon/CrimslimeMinion.cs | 28 +-- Projectiles/Summon/CrimsonSlimeGodMinion.cs | 22 +-- Projectiles/Summon/DaedalusCrystal.cs | 92 ++++----- Projectiles/Summon/DaedalusCrystalShot.cs | 30 +-- Projectiles/Summon/DankCreeperMinion.cs | 126 ++++++------ Projectiles/Summon/Dreadmine.cs | 124 ++++++------ Projectiles/Summon/DreadmineTurret.cs | 53 +++-- Projectiles/Summon/ElementalAxeMinion.cs | 4 +- Projectiles/Summon/EndoCooperBody.cs | 14 +- Projectiles/Summon/EndoCooperLimbs.cs | 4 +- Projectiles/Summon/EndoFire.cs | 18 +- Projectiles/Summon/EnergyOrb.cs | 6 +- Projectiles/Summon/FieryDraconid.cs | 6 +- Projectiles/Summon/FlameBlast.cs | 28 +-- Projectiles/Summon/FlameBurst.cs | 28 +-- Projectiles/Summon/ForbiddenCircletEater.cs | 123 ++++++------ Projectiles/Summon/FrostMistFriendly.cs | 26 +-- Projectiles/Summon/GhostlyMine.cs | 44 ++--- .../Summon/GlacialEmbracePointyThing.cs | 24 +-- Projectiles/Summon/HauntedDishes.cs | 20 +- Projectiles/Summon/HermitCrabMinion.cs | 51 +++-- Projectiles/Summon/Hive.cs | 34 ++-- Projectiles/Summon/HowlsHeartHowl.cs | 10 +- Projectiles/Summon/HydrothermicVent.cs | 13 +- Projectiles/Summon/IceSentryFrostBolt.cs | 24 +-- Projectiles/Summon/IrradiatedAura.cs | 8 +- Projectiles/Summon/LanternFlame.cs | 22 +-- Projectiles/Summon/LuxorsGiftSummon.cs | 20 +- Projectiles/Summon/PhantomGuy.cs | 120 ++++++----- Projectiles/Summon/PhantomicDagger.cs | 24 +-- Projectiles/Summon/PinkButterfly.cs | 132 ++++++------- Projectiles/Summon/ProfanedEnergy.cs | 74 +++---- Projectiles/Summon/PurpleButterfly.cs | 24 +-- Projectiles/Summon/SakuraBullet.cs | 22 +-- Projectiles/Summon/SandElementalMinion.cs | 125 ++++++------ Projectiles/Summon/SandMark.cs | 88 ++++----- Projectiles/Summon/SandTornado.cs | 145 +++++++------- Projectiles/Summon/SilvaCrystal.cs | 95 +++++---- Projectiles/Summon/SilvaCrystalExplosion.cs | 186 +++++++++--------- Projectiles/Summon/SiriusBeam.cs | 8 +- Projectiles/Summon/SiriusExplosion.cs | 174 ++++++++-------- Projectiles/Summon/SolarBeam.cs | 14 +- Projectiles/Summon/Valkyrie.cs | 15 +- Projectiles/Summon/VileFeederProjectile.cs | 116 +++++------ Projectiles/Summon/VileFeederSummon.cs | 20 +- .../Summon/VoidConcentrationBlackhole.cs | 24 +-- Projectiles/Summon/VoidConcentrationOrb.cs | 24 +-- Projectiles/Summon/WaterElementalMinion.cs | 87 ++++---- Projectiles/Summon/WaterSpearFriendly.cs | 10 +- 65 files changed, 1629 insertions(+), 1673 deletions(-) diff --git a/Projectiles/Summon/AngelBolt.cs b/Projectiles/Summon/AngelBolt.cs index 1ff209a247..aaedab1f12 100644 --- a/Projectiles/Summon/AngelBolt.cs +++ b/Projectiles/Summon/AngelBolt.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Summon { if (Projectile.timeLeft % 2f == 0f) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, (int)CalamityDusts.ProfanedFire, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].noGravity = true; - Main.dust[num448].noLight = true; - Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + Vector2 dustPos = Projectile.position; + dustPos -= Projectile.velocity * 0.25f; + int dust = Dust.NewDust(dustPos, 1, 1, (int)CalamityDusts.ProfanedFire, 0f, 0f, 0, default, 1.25f); + Main.dust[dust].position = dustPos; + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].scale = Main.rand.Next(70, 110) * 0.013f; + Main.dust[dust].velocity *= 0.1f; } } diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index d0d08afa37..300cf4f7d7 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -48,15 +48,15 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; if (Projectile.localAI[0] == 0f) { - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int constant = 36; + for (int i = 0; i < constant; 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, 85, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int ancientDust = Dust.NewDust(rotate + faceDirection, 0, 0, 85, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); + Main.dust[ancientDust].noGravity = true; + Main.dust[ancientDust].velocity = faceDirection; } Projectile.localAI[0]++; } @@ -70,15 +70,12 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 0; } - float num633 = 1200f; - float num634 = 1500f; - float num635 = 2200f; - float num636 = 150f; - bool flag64 = Projectile.type == ModContent.ProjectileType(); + float maxTargetDist = 1200f; + bool isProjectile = Projectile.type == ModContent.ProjectileType(); CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isProjectile) { if (player.dead) { @@ -90,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon } } Projectile.MinionAntiClump(); - bool flag24 = false; + bool decelerate = false; if (Projectile.ai[0] == 2f) { Projectile.ai[1] += 1f; @@ -105,109 +102,108 @@ namespace CalamityMod.Projectiles.Summon } else { - flag24 = true; + decelerate = true; } } - if (flag24) + if (decelerate) { return; } - Vector2 vector46 = Projectile.position; - bool flag25 = false; + Vector2 projPos = Projectile.position; + bool canAttack = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!canAttack && targetDist < maxTargetDist) { - num633 = num646; - vector46 = npc.Center; - flag25 = true; + maxTargetDist = targetDist; + projPos = npc.Center; + canAttack = true; } } } - if (!flag25) + if (!canAttack) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[i]; if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if (!canAttack && targetDist < maxTargetDist) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; + maxTargetDist = targetDist; + projPos = nPC2.Center; + canAttack = true; } } } } - float num647 = num634; - if (flag25) + float separationAnxietyRange = 1500f; + if (canAttack) { - num647 = num635; + separationAnxietyRange = 2200f; } - if (Vector2.Distance(player.Center, Projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyRange) { Projectile.ai[0] = 1f; Projectile.netUpdate = true; } - if (flag25 && Projectile.ai[0] == 0f) + if (canAttack && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - Projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 projDirection = projPos - Projectile.Center; + float projDistance = projDirection.Length(); + projDirection.Normalize(); + if (projDistance > 200f) { float scaleFactor2 = 13f; //8 - vector47 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } else { - float num649 = 6f; - vector47 *= -num649; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= -6f; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } } else { - bool flag26 = false; - if (!flag26) + bool isReturning = false; + if (!isReturning) { - flag26 = Projectile.ai[0] == 1f; + isReturning = Projectile.ai[0] == 1f; } - float num650 = 10f; - if (flag26) + float returnSpeed = 10f; + if (isReturning) { - num650 = 21f; + returnSpeed = 21f; } Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) + Vector2 playerDirection = player.Center - center2 + new Vector2(0f, -60f); + float playerDistance = playerDirection.Length(); + if (playerDistance > 200f && returnSpeed < 8f) { - num650 = 1f; + returnSpeed = 1f; } - if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + if (playerDistance < 150f && isReturning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (num651 > 2000f) + if (playerDistance > 2000f) { Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } - if (num651 > 70f) + if (playerDistance > 70f) { - vector48.Normalize(); - vector48 *= num650; - Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; + playerDirection.Normalize(); + playerDirection *= returnSpeed; + Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { @@ -228,15 +224,15 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.ai[0] == 0f) { - if (Projectile.ai[1] == 0f && flag25 && num633 < 500f) + if (Projectile.ai[1] == 0f && canAttack && maxTargetDist < 500f) { Projectile.ai[1] += 1f; if (Main.myPlayer == Projectile.owner) { Projectile.ai[0] = 2f; - Vector2 value20 = vector46 - Projectile.Center; - value20.Normalize(); - Projectile.velocity = value20 * 13f; //8 + Vector2 npcCenter = projPos - Projectile.Center; + npcCenter.Normalize(); + Projectile.velocity = npcCenter * 13f; //8 Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index af0408810a..5bb58587ae 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -71,22 +71,22 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = 16; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int dusty = Dust.NewDust(vector6 + vector7, 0, 0, ModContent.DustType(), vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, ModContent.DustType(), faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; - Main.dust[dusty].velocity = vector7; + Main.dust[dusty].velocity = faceDirection; } dust = true; } //Bool setup - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isSummon = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isSummon) { if (player.dead) { @@ -123,9 +123,9 @@ namespace CalamityMod.Projectiles.Summon } else { - for (int num645 = 0; num645 < Main.npc.Length; num645++) + for (int i = 0; i < Main.npc.Length; i++) { - NPC npc = Main.npc[num645]; + NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(Projectile, false)) { bool lineOfSight = Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height); @@ -151,32 +151,31 @@ namespace CalamityMod.Projectiles.Summon float scaleAddition = Projectile.scale * 5f; if (teleportCounter <= 0 && teleportRange >= 800f) { - float num461 = 50f; - int num462 = 0; - while ((float)num462 < num461) + int counter = 0; + while ((float)counter < 50f) { int dustType = Utils.SelectRandom(Main.rand, new int[] { ModContent.DustType(), ModContent.DustType() }); - float num463 = Main.rand.Next(-10, 11); - float num464 = Main.rand.Next(-10, 11); - float num465 = 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, dustType, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num467]; + float rand1 = Main.rand.Next(-10, 11); + float rand2 = Main.rand.Next(-10, 11); + float rand3 = Main.rand.Next(3, 9); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int astralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[astralDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; dust.position.X += Main.rand.Next(-10, 11); dust.position.Y += Main.rand.Next(-10, 11); - dust.velocity.X = num463; - dust.velocity.Y = num464; - num462++; + dust.velocity.X = rand1; + dust.velocity.Y = rand2; + counter++; } Projectile.position.X = objectivepos.X - (float)(Projectile.width / 2) + Main.rand.NextFloat(-100f, 100f); Projectile.position.Y = objectivepos.Y - (float)(Projectile.height / 2) - Main.rand.NextFloat(0f + scaleAddition, 200f + scaleAddition); diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index 7805e9bc61..81efca5f8b 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -47,16 +47,16 @@ namespace CalamityMod.Projectiles.Summon //on spawn effects && minion flexibility if (Projectile.localAI[0] == 0f) { - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int constant = 36; + for (int i = 0; i < constant; 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, dustType, vector7.X * 1.5f, vector7.Y * 1.5f, 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int astralDust = Dust.NewDust(rotate + faceDirection, 0, 0, dustType, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 1.4f); + Main.dust[astralDust].noGravity = true; + Main.dust[astralDust].noLight = true; + Main.dust[astralDust].velocity = faceDirection; } Projectile.localAI[0] += 1f; } @@ -234,18 +234,18 @@ namespace CalamityMod.Projectiles.Summon Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int num193 = 0; num193 < 2; num193++) + for (int j = 0; j < 2; j++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); } - for (int num194 = 0; num194 < 20; num194++) + for (int k = 0; k < 20; k++) { - int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int moreAstralDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); + Main.dust[moreAstralDust].noGravity = true; + Main.dust[moreAstralDust].velocity *= 3f; + moreAstralDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + Main.dust[moreAstralDust].velocity *= 2f; + Main.dust[moreAstralDust].noGravity = true; } } diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs index a2a877dff9..93babecfea 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -65,22 +65,22 @@ namespace CalamityMod.Projectiles.Summon if (dust == 0f) { - int num226 = 16; - for (int num227 = 0; num227 < num226; num227++) + int constant = 16; + for (int i = 0; i < constant; 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, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); - 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int bloody = Dust.NewDust(rotate + faceDirection, 0, 0, 5, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + Main.dust[bloody].noGravity = true; + Main.dust[bloody].noLight = true; + Main.dust[bloody].velocity = faceDirection; } dust += 1f; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { diff --git a/Projectiles/Summon/BabyPlaguebringer.cs b/Projectiles/Summon/BabyPlaguebringer.cs index 747465f19f..c2e73d0f19 100644 --- a/Projectiles/Summon/BabyPlaguebringer.cs +++ b/Projectiles/Summon/BabyPlaguebringer.cs @@ -43,17 +43,14 @@ namespace CalamityMod.Projectiles.Summon { Projectile.spriteDirection = -Projectile.direction; } - float num633 = 800f; - float num634 = 1200f; - float num635 = 3000f; - float num636 = 500f; + float maxTargetDist = 800f; //lighting - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(Projectile.Center, 0f * num, 0.75f * num, 0f * num); + float lights = (float)Main.rand.Next(90, 111) * 0.01f; + lights *= Main.essScale; + Lighting.AddLight(Projectile.Center, 0f * lights, 0.75f * lights, 0f * lights); - bool flag24 = false; + bool decelerate = false; if (Projectile.ai[0] == 2f) { Projectile.ai[1] += 1f; @@ -78,109 +75,108 @@ namespace CalamityMod.Projectiles.Summon } else { - flag24 = true; + decelerate = true; } } - if (flag24) + if (decelerate) { return; } - Vector2 vector46 = Projectile.position; - bool flag25 = false; + Vector2 projPos = Projectile.position; + bool canAttack = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!canAttack && targetDist < maxTargetDist) { - num633 = num646; - vector46 = npc.Center; - flag25 = true; + maxTargetDist = targetDist; + projPos = npc.Center; + canAttack = true; } } } - if (!flag25) + if (!canAttack) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[i]; if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if (!canAttack && targetDist < maxTargetDist) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; + maxTargetDist = targetDist; + projPos = nPC2.Center; + canAttack = true; } } } } - float num647 = num634; - if (flag25) + float separationAnxietyRange = 1200f; + if (canAttack) { - num647 = num635; + separationAnxietyRange = 3000f; } - if (Vector2.Distance(player.Center, Projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyRange) { Projectile.ai[0] = 1f; Projectile.netUpdate = true; } - if (flag25 && Projectile.ai[0] == 0f) + if (canAttack && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - Projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 projDirection = projPos - Projectile.Center; + float projLength = projDirection.Length(); + projDirection.Normalize(); + if (projLength > 200f) { float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } else { - float num649 = 4f; - vector47 *= -num649; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= -4f; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } } else { - bool flag26 = false; - if (!flag26) + bool isReturning = false; + if (!isReturning) { - flag26 = Projectile.ai[0] == 1f; + isReturning = Projectile.ai[0] == 1f; } - float num650 = 6f; - if (flag26) + float returnSpeed = 6f; + if (isReturning) { - num650 = 15f; + returnSpeed = 15f; } Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) + Vector2 playerDirection = player.Center - center2 + new Vector2(0f, -60f); + float playerDistance = playerDirection.Length(); + if (playerDistance > 200f && returnSpeed < 8f) { - num650 = 8f; + returnSpeed = 8f; } - if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + if (playerDistance < 500f && isReturning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (num651 > 2000f) + if (playerDistance > 2000f) { Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } - if (num651 > 70f) + if (playerDistance > 70f) { - vector48.Normalize(); - vector48 *= num650; - Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; + playerDirection.Normalize(); + playerDirection *= returnSpeed; + Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { @@ -209,15 +205,15 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.ai[0] == 0f) { - if (Projectile.ai[1] == 0f && flag25 && num633 < 500f) + if (Projectile.ai[1] == 0f && canAttack && maxTargetDist < 500f) { Projectile.ai[1] += 1f; if (Main.myPlayer == Projectile.owner) { Projectile.ai[0] = 2f; - Vector2 value20 = vector46 - Projectile.Center; - value20.Normalize(); - Projectile.velocity = value20 * 8f; + Vector2 npcCenter = projPos - Projectile.Center; + npcCenter.Normalize(); + Projectile.velocity = npcCenter * 8f; Projectile.netUpdate = true; } } @@ -233,10 +229,10 @@ namespace CalamityMod.Projectiles.Summon { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Texture2D texture = ModContent.Request(Texture).Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Vector2 origin = new Vector2(texture.Width / 2f, num214 / 2f); - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture.Width, num214), Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Vector2 origin = new Vector2(texture.Width / 2f, framing / 2f); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture.Width, framing), Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); return false; } diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index e45fc3458b..26c28e707c 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isActive = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.brimstoneWaifu && !modPlayer.allWaifus && !modPlayer.brimstoneWaifuVanity && !modPlayer.allWaifusVanity) @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; return; } - if (flag64) + if (isActive) { if (player.dead) { @@ -62,12 +62,11 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + for (int i = 0; i < 50; i++) { - int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + Main.dust[brimDust].velocity *= 2f; + Main.dust[brimDust].scale *= 1.15f; } } bool passive = modPlayer.brimstoneWaifuVanity || modPlayer.allWaifusVanity; @@ -83,19 +82,18 @@ namespace CalamityMod.Projectiles.Summon } if (!passive) { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(Projectile.Center, 1.25f * num, 0f * num, 0.5f * num); + float lights = (float)Main.rand.Next(90, 111) * 0.01f; + lights *= Main.essScale; + Lighting.AddLight(Projectile.Center, 1.25f * lights, 0f * lights, 0.5f * lights); } if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; } - float num633 = 700f; - float num636 = 400f; //150 + float maxTargetDist = 700f; Projectile.MinionAntiClump(); Vector2 targetCenter = Projectile.position; - bool flag25 = false; + bool canAttack = false; if (Projectile.ai[0] != 1f) { Projectile.tileCollide = false; @@ -109,27 +107,27 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if ((!canAttack && targetDist < maxTargetDist) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { targetCenter = npc.Center; - flag25 = true; + canAttack = true; } } } - if (!flag25 && !passive) + if (!canAttack && !passive) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[i]; if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if ((!canAttack && targetDist < maxTargetDist) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) { - num633 = num646; + maxTargetDist = targetDist; targetCenter = nPC2.Center; - flag25 = true; + canAttack = true; } } } @@ -140,39 +138,39 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.netUpdate = true; } - bool flag26 = false; - if (!flag26) + bool isReturning = false; + if (!isReturning) { - flag26 = Projectile.ai[0] == 1f; + isReturning = Projectile.ai[0] == 1f; } - float num650 = 5f; //6 - if (flag26) + float returnSpeed = 5f; //6 + if (isReturning) { - num650 = 12f; //15 + returnSpeed = 12f; //15 } Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(-500f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 6.5f) //200 and 8 + Vector2 playerDirection = player.Center - center2 + new Vector2(-500f, -60f); //-60 + float playerDistance = playerDirection.Length(); + if (playerDistance > 200f && returnSpeed < 6.5f) //200 and 8 { - num650 = 6.5f; //8 + returnSpeed = 6.5f; //8 } - if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + if (playerDistance < 400f && isReturning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (num651 > 2000f) + if (playerDistance > 2000f) { Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } - if (num651 > 70f) + if (playerDistance > 70f) { - vector48.Normalize(); - vector48 *= num650; - Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; + playerDirection.Normalize(); + playerDirection *= returnSpeed; + Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { @@ -197,7 +195,7 @@ namespace CalamityMod.Projectiles.Summon { float fireballShootSpeed = 14f; int projID = ModContent.ProjectileType(); - if (flag25 && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) + if (canAttack && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { Projectile.ai[1] += 1f; if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetCenter, 0, 0)) diff --git a/Projectiles/Summon/BrimstoneExplosionMinion.cs b/Projectiles/Summon/BrimstoneExplosionMinion.cs index f16306933e..d1cd5185f7 100644 --- a/Projectiles/Summon/BrimstoneExplosionMinion.cs +++ b/Projectiles/Summon/BrimstoneExplosionMinion.cs @@ -40,38 +40,38 @@ namespace CalamityMod.Projectiles.Summon 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 rand1 = (float)Main.rand.Next(-10, 11); + float rand2 = (float)Main.rand.Next(-10, 11); + float rand3 = (float)Main.rand.Next(3, 9); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs index 738c294645..1b5b7934de 100644 --- a/Projectiles/Summon/BrimstoneFireballMinion.cs +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -58,10 +58,10 @@ namespace CalamityMod.Projectiles.Summon 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(new Vector2(Projectile.position.X, Projectile.position.Y), 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(new Vector2(Projectile.position.X, Projectile.position.Y), 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/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index da4c0f42c1..1824738482 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -45,13 +45,13 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int dusty = Dust.NewDust(vector6 + vector7, 0, 0, 6, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, 6, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; - Main.dust[dusty].velocity = vector7; + Main.dust[dusty].velocity = faceDirection; } initialized = true; } diff --git a/Projectiles/Summon/CorroslimeMinion.cs b/Projectiles/Summon/CorroslimeMinion.cs index 174e882f2f..42ed83d21c 100644 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ b/Projectiles/Summon/CorroslimeMinion.cs @@ -52,22 +52,22 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - int num226 = 16; - for (int num227 = 0; num227 < num226; num227++) + int constant = 16; + for (int i = 0; i < constant; 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, 14, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); - 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 14, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = faceDirection; } dust += 1f; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Summon 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.EntitySpriteDraw(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.EntitySpriteDraw(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/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/CorruptionSlimeGodMinion.cs index 66fd14f3a6..53d0b49efc 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -50,27 +50,27 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - int num226 = 16; - for (int num227 = 0; num227 < num226; num227++) + int constant = 16; + for (int i = 0; i < constant; 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, 173, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); - 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = faceDirection; } dust += 1f; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (!modPlayer.slimeGod) { Projectile.active = false; return; } - if (flag64) + if (isMinion) { if (player.dead) { diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index 616766ef0b..4360f4fe61 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -44,10 +44,10 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(8)) { Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[rainbowDust].noGravity = true; + Main.dust[rainbowDust].velocity = value3 * 0.66f; + Main.dust[rainbowDust].position = Projectile.Center + value3 * 12f; } NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Main.player[Projectile.owner]); if (potentialTarget != null) @@ -66,9 +66,9 @@ namespace CalamityMod.Projectiles.Summon 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.EntitySpriteDraw(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.EntitySpriteDraw(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; } @@ -84,19 +84,19 @@ namespace CalamityMod.Projectiles.Summon Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); - for (int num193 = 0; num193 < 3; num193++) + for (int i = 0; i < 3; i++) { int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[dust].noGravity = true; } - for (int num194 = 0; num194 < 30; num194++) + for (int j = 0; j < 30; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int rainbowDusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); + Main.dust[rainbowDusty].noGravity = true; + Main.dust[rainbowDusty].velocity *= 3f; + rainbowDusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + Main.dust[rainbowDusty].velocity *= 2f; + Main.dust[rainbowDusty].noGravity = true; } } } diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index ecd3563c86..1b8d36f8e8 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -41,23 +41,23 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(8)) { Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[rainbowDust].noGravity = true; + Main.dust[rainbowDust].velocity = value3 * 0.66f; + Main.dust[rainbowDust].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(24) && Main.netMode != NetmodeID.Server) { - int num60 = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += Projectile.velocity * 0.3f; + int rainbowGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[rainbowGore].velocity *= 0.66f; + Main.gore[rainbowGore].velocity += Projectile.velocity * 0.3f; } if (Projectile.ai[1] == 1f) { if (Main.rand.NextBool(5)) { - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; + int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[rainbowDust].noGravity = true; } if (Main.rand.NextBool(10) && Main.netMode != NetmodeID.Server) { @@ -90,19 +90,19 @@ namespace CalamityMod.Projectiles.Summon Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); - for (int num193 = 0; num193 < 3; num193++) + for (int i = 0; i < 3; i++) { int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[dust].noGravity = true; } - for (int num194 = 0; num194 < 30; num194++) + for (int j = 0; j < 30; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int rainbowDusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); + Main.dust[rainbowDusty].noGravity = true; + Main.dust[rainbowDusty].velocity *= 3f; + rainbowDusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + Main.dust[rainbowDusty].velocity *= 2f; + Main.dust[rainbowDusty].noGravity = true; } } } diff --git a/Projectiles/Summon/CosmicEnergySpiral.cs b/Projectiles/Summon/CosmicEnergySpiral.cs index 20dd58c1fd..c62e9bcf6b 100644 --- a/Projectiles/Summon/CosmicEnergySpiral.cs +++ b/Projectiles/Summon/CosmicEnergySpiral.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 255f, (float)Main.DiscoG / 255f, (float)Main.DiscoB / 255f); - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -55,109 +55,105 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - float num633 = 1400f; //700 - float num634 = 1600f; //800 - float num635 = 2400f; //1200 - float num636 = 800f; + float targetDist = 1400f; //700 Projectile.rotation += Projectile.velocity.X * 0.1f; - Vector2 vector46 = Projectile.position; - bool flag25 = false; + Vector2 projPos = Projectile.position; + bool canAttack = false; int target = 0; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float maxTargetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!canAttack && maxTargetDist < targetDist) { - vector46 = npc.Center; - flag25 = true; + projPos = npc.Center; + canAttack = true; target = npc.whoAmI; } } } else { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[i]; if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float maxTargetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if (!canAttack && maxTargetDist < targetDist) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - target = num645; + targetDist = maxTargetDist; + projPos = nPC2.Center; + canAttack = true; + target = i; } } } } - float num647 = num634; - if (flag25) + float separationAnxietyDist = 1600f; + if (canAttack) { - num647 = num635; + separationAnxietyDist = 2400f; } - if (Vector2.Distance(player.Center, Projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { Projectile.ai[1] = 1f; Projectile.netUpdate = true; } - if (flag25 && Projectile.ai[1] == 0f) + if (canAttack && Projectile.ai[1] == 0f) { - Vector2 vector47 = vector46 - Projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 projDirection = projPos - Projectile.Center; + float projDistance = projDirection.Length(); + projDirection.Normalize(); + if (projDistance > 200f) { float scaleFactor2 = 6f; //6 - vector47 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } else { - float num649 = 4f; //4 - vector47 *= -num649; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= -4f; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } } else { - bool flag26 = false; - if (!flag26) + bool isReturning = false; + if (!isReturning) { - flag26 = Projectile.ai[1] == 1f; + isReturning = Projectile.ai[1] == 1f; } - float num650 = 6f; - if (flag26) + float returnSpeed = 6f; + if (isReturning) { - num650 = 15f; + returnSpeed = 15f; } Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) + Vector2 playerDirection = player.Center - center2 + new Vector2(0f, -60f); + float playerDistance = playerDirection.Length(); + if (playerDistance > 200f && returnSpeed < 8f) { - num650 = 8f; + returnSpeed = 8f; } - if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + if (playerDistance < 800f && isReturning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; } - if (num651 > 2000f) //2000 + if (playerDistance > 2000f) //2000 { Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } - if (num651 > 70f) + if (playerDistance > 70f) { - vector48.Normalize(); - vector48 *= num650; - Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; + playerDirection.Normalize(); + playerDirection *= returnSpeed; + Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { @@ -165,9 +161,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y = -0.05f; } } - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - Projectile.scale = num395 + 0.95f; + float projScale = (float)Main.mouseTextColor / 200f - 0.35f; + projScale *= 0.2f; + Projectile.scale = projScale + 0.95f; if (justSpawned) { justSpawned = false; @@ -180,27 +176,27 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] -= 1f; return; } - float num396 = Projectile.position.X; - float num397 = Projectile.position.Y; - float num398 = 1200f; - bool flag11 = false; - for (int num399 = 0; num399 < Main.maxNPCs; num399++) + float projX = Projectile.position.X; + float projY = Projectile.position.Y; + float homeDistance = 1200f; + bool isInRange = false; + for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[num399].CanBeChasedBy(Projectile, false)) + if (Main.npc[j].CanBeChasedBy(Projectile, false)) { - float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); - float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); - float num402 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num400) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num401); - if (num402 < num398) + float npcX = Main.npc[j].position.X + (float)(Main.npc[j].width / 2); + float npcY = Main.npc[j].position.Y + (float)(Main.npc[j].height / 2); + float npcDistance = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); + if (npcDistance < homeDistance) { - num398 = num402; - num396 = num400; - num397 = num401; - flag11 = true; + homeDistance = npcDistance; + projX = npcX; + projY = npcY; + isInRange = true; } } } - if (flag11) + if (isInRange) { SoundEngine.PlaySound(SoundID.Item105, Projectile.position); int blastAmt = Main.rand.Next(5, 8); @@ -210,13 +206,13 @@ namespace CalamityMod.Projectiles.Summon Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 2f, Projectile.owner, (float)target, 0f); } float speed = 15f; - float num404 = num396 - Projectile.Center.X; - float num405 = num397 - Projectile.Center.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = speed / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, num404, num405, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, (float)target, 0f); + float projXSpeed = projX - Projectile.Center.X; + float projYSpeed = projY - Projectile.Center.Y; + float velocityMult = (float)Math.Sqrt((double)(projXSpeed * projXSpeed + projYSpeed * projYSpeed)); + velocityMult = speed / velocityMult; + projXSpeed *= velocityMult; + projYSpeed *= velocityMult; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, projXSpeed, projYSpeed, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, (float)target, 0f); Projectile.ai[0] = 100f; } } diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 8cf9a48e96..84bf3e4ab2 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -69,12 +69,12 @@ namespace CalamityMod.Projectiles.Summon for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int dusty = Dust.NewDust(vector6 + vector7, 0, 0, dustType, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, dustType, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; - Main.dust[dusty].velocity = vector7; + Main.dust[dusty].velocity = faceDirection; } // Construct a fake item to use with vanilla code for the sake of firing bullets. diff --git a/Projectiles/Summon/CrimslimeMinion.cs b/Projectiles/Summon/CrimslimeMinion.cs index 91296c842d..da2f4469f8 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/CrimslimeMinion.cs @@ -52,22 +52,22 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - int num226 = 16; - for (int num227 = 0; num227 < num226; num227++) + int constant = 16; + for (int i = 0; i < constant; 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, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); - 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 5, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = faceDirection; } dust += 1f; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = texture2D13.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.EntitySpriteDraw(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 = texture2D13.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.EntitySpriteDraw(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/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index c24adbb9e2..0df9749d66 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -50,27 +50,27 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - int num226 = 16; - for (int num227 = 0; num227 < num226; num227++) + int constant = 16; + for (int i = 0; i < constant; 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, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); - 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 5, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = faceDirection; } dust += 1f; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (!modPlayer.slimeGod) { Projectile.active = false; return; } - if (flag64) + if (isMinion) { if (player.dead) { diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index ea2bbbb0d5..7e43adef7d 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.daedalusCrystal) @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; return; } - if (flag64) + if (isMinion) { if (player.dead) { @@ -58,12 +58,12 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + int constant = 50; + for (int i = 0; i < constant; i++) { - int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 173, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 173, 0f, 0f, 0, default, 1f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].scale *= 1.15f; } } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); @@ -79,9 +79,9 @@ namespace CalamityMod.Projectiles.Summon } Projectile.position.X = (int)Projectile.position.X; Projectile.position.Y = (int)Projectile.position.Y; - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - Projectile.scale = num395 + 0.95f; + float projScale = (float)Main.mouseTextColor / 200f - 0.35f; + projScale *= 0.2f; + Projectile.scale = projScale + 0.95f; if (Projectile.owner == Main.myPlayer) { if (Projectile.ai[0] != 0f) @@ -89,61 +89,61 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] -= 1f; return; } - bool flag18 = false; - float num506 = Projectile.Center.X; - float num507 = Projectile.Center.Y; - float num508 = 1000f; + bool isInRange = false; + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + float attackRange = 1000f; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + float npcX = npc.position.X + (float)(npc.width / 2); + float npcY = npc.position.Y + (float)(npc.height / 2); + float npcDistance = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); + if (npcDistance < attackRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - num506 = num539; - num507 = num540; - flag18 = true; + projX = npcX; + projY = npcY; + isInRange = true; } } } - if (!flag18) + if (!isInRange) { - for (int num512 = 0; num512 < Main.maxNPCs; num512++) + for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[num512].CanBeChasedBy(Projectile, false)) + if (Main.npc[j].CanBeChasedBy(Projectile, false)) { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num513) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + float otherNPCX = Main.npc[j].position.X + (float)(Main.npc[j].width / 2); + float otherNPCY = Main.npc[j].position.Y + (float)(Main.npc[j].height / 2); + float otherNPCDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - otherNPCX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - otherNPCY); + if (otherNPCDist < attackRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[j].position, Main.npc[j].width, Main.npc[j].height)) { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; + attackRange = otherNPCDist; + projX = otherNPCX; + projY = otherNPCY; + isInRange = true; } } } } - if (flag18) + if (isInRange) { - float num516 = num506; - float num517 = num507; - num506 -= Projectile.Center.X; - num507 -= Projectile.Center.Y; + float projXStore = projX; + float projYStore = projY; + projX -= Projectile.Center.X; + projY -= Projectile.Center.Y; int projectileType = ModContent.ProjectileType(); - float num403 = Main.rand.Next(10, 15); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 vector29 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - 4f, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, 5f, Projectile.owner); + float randSpeed = Main.rand.Next(10, 15); //modify the speed the projectile are shot. Lower number = slower projectile. + Vector2 firingDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float projXDirection = projXStore - firingDirection.X; + float projYDirection = projYStore - firingDirection.Y; + float projSpeed = (float)Math.Sqrt((double)(projXDirection * projXDirection + projYDirection * projYDirection)); + projSpeed = randSpeed / projSpeed; + projXDirection *= projSpeed; + projYDirection *= projSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - 4f, Projectile.Center.Y, projXDirection, projYDirection, projectileType, Projectile.damage, 5f, Projectile.owner); Projectile.ai[0] = 50f; } } diff --git a/Projectiles/Summon/DaedalusCrystalShot.cs b/Projectiles/Summon/DaedalusCrystalShot.cs index c1be5ff133..a0b655e073 100644 --- a/Projectiles/Summon/DaedalusCrystalShot.cs +++ b/Projectiles/Summon/DaedalusCrystalShot.cs @@ -34,33 +34,33 @@ namespace CalamityMod.Projectiles.Summon } for (int num457 = 0; num457 < 5; num457++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 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 daeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[daeDust].noGravity = true; + Main.dust[daeDust].velocity *= 0.5f; + Main.dust[daeDust].velocity += Projectile.velocity * 0.1f; } } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item74, Projectile.position); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; 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 dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; 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 dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Summon/DankCreeperMinion.cs b/Projectiles/Summon/DankCreeperMinion.cs index 6090d4ebf8..07c506c085 100644 --- a/Projectiles/Summon/DankCreeperMinion.cs +++ b/Projectiles/Summon/DankCreeperMinion.cs @@ -43,22 +43,22 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int constant = 36; + for (int i = 0; i < constant; 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, 14, vector7.X * 1.5f, vector7.Y * 1.5f, 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 - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 14, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = faceDirection; } Projectile.localAI[0] += 1f; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -70,16 +70,16 @@ namespace CalamityMod.Projectiles.Summon } } Projectile.MinionAntiClump(); - float num535 = Projectile.position.X; - float num536 = Projectile.position.Y; - float num537 = 1300f; - bool flag19 = false; - int num538 = 1100; + float projX = Projectile.position.X; + float projY = Projectile.position.Y; + float attackRange = 1300f; + bool canAttack = false; + int separationAnxietyDist = 1100; if (Projectile.ai[1] != 0f) { - num538 = 1800; + separationAnxietyDist = 1800; } - if (Math.Abs(Projectile.Center.X - Main.player[Projectile.owner].Center.X) + Math.Abs(Projectile.Center.Y - Main.player[Projectile.owner].Center.Y) > (float)num538) + if (Math.Abs(Projectile.Center.X - Main.player[Projectile.owner].Center.X) + Math.Abs(Projectile.Center.Y - Main.player[Projectile.owner].Center.Y) > (float)separationAnxietyDist) { Projectile.ai[0] = 1f; } @@ -90,64 +90,64 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + float npcX = npc.position.X + (float)(npc.width / 2); + float npcY = npc.position.Y + (float)(npc.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 < attackRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - num535 = num539; - num536 = num540; - flag19 = true; + projX = npcX; + projY = npcY; + canAttack = true; } } } - if (!flag19) + if (!canAttack) { - for (int num542 = 0; num542 < Main.maxNPCs; num542++) + for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[num542].CanBeChasedBy(Projectile, false)) + if (Main.npc[j].CanBeChasedBy(Projectile, false)) { - float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); - float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num543) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num544); - if (num545 < num537 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num542].position, Main.npc[num542].width, Main.npc[num542].height)) + float otherNPCX = Main.npc[j].position.X + (float)(Main.npc[j].width / 2); + float otherNPCY = Main.npc[j].position.Y + (float)(Main.npc[j].height / 2); + float otherNPCDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - otherNPCX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - otherNPCY); + if (otherNPCDist < attackRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[j].position, Main.npc[j].width, Main.npc[j].height)) { - num537 = num545; - num535 = num543; - num536 = num544; - flag19 = true; + attackRange = otherNPCDist; + projX = otherNPCX; + projY = otherNPCY; + canAttack = true; } } } } } - if (!flag19) + if (!canAttack) { - float num546 = 8f; + float returnSpeed = 8f; if (Projectile.ai[0] == 1f) { - num546 = 12f; + returnSpeed = 12f; } - Vector2 vector42 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num547 = player.Center.X - vector42.X; - float num548 = player.Center.Y - vector42.Y - 60f; - float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); - if (num549 < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + Vector2 playerDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float playerXDist = player.Center.X - playerDirection.X; + float playerYDist = player.Center.Y - playerDirection.Y - 60f; + float playerDist = (float)Math.Sqrt((double)(playerXDist * playerXDist + playerYDist * playerYDist)); + if (playerDist < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { Projectile.ai[0] = 0f; } - if (num549 > 2000f) + if (playerDist > 2000f) { Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); Projectile.position.Y = player.Center.Y - (float)(Projectile.width / 2); } - if (num549 > 70f) + if (playerDist > 70f) { - num549 = num546 / num549; - num547 *= num549; - num548 *= num549; - Projectile.velocity.X = (Projectile.velocity.X * 20f + num547) / 21f; - Projectile.velocity.Y = (Projectile.velocity.Y * 20f + num548) / 21f; + playerDist = returnSpeed / playerDist; + playerXDist *= playerDist; + playerYDist *= playerDist; + Projectile.velocity.X = (Projectile.velocity.X * 20f + playerXDist) / 21f; + Projectile.velocity.Y = (Projectile.velocity.Y * 20f + playerYDist) / 21f; } else { @@ -177,20 +177,20 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.ai[1] == 0f) { - float num550 = 8f; //12 - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num551 = num535 - vector43.X; - float num552 = num536 - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) + float hoverSpeed = 8f; //12 + Vector2 playerDirectionAgain = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float playerXDistAgain = projX - playerDirectionAgain.X; + float playerYDistAgain = projY - playerDirectionAgain.Y; + float playerDistAgain = (float)Math.Sqrt((double)(playerXDistAgain * playerXDistAgain + playerYDistAgain * playerYDistAgain)); + if (playerDistAgain < 100f) { - num550 = 10f; //14 + hoverSpeed = 10f; //14 } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - Projectile.velocity.X = (Projectile.velocity.X * 40f + num551) / 41f; - Projectile.velocity.Y = (Projectile.velocity.Y * 40f + num552) / 41f; + playerDistAgain = hoverSpeed / playerDistAgain; + playerXDistAgain *= playerDistAgain; + playerYDistAgain *= playerDistAgain; + Projectile.velocity.X = (Projectile.velocity.X * 40f + playerXDistAgain) / 41f; + Projectile.velocity.Y = (Projectile.velocity.Y * 40f + playerYDistAgain) / 41f; } else { diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index eb4a1da0ac..51b9079b8c 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -27,28 +27,28 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - float num945 = 1f; - float num946 = 1f; + float xflag = 1f; + float yflag = 1f; if (Projectile.identity % 6 == 0) { - num946 *= -1f; + yflag *= -1f; } if (Projectile.identity % 6 == 1) { - num945 *= -1f; + xflag *= -1f; } if (Projectile.identity % 6 == 2) { - num946 *= -1f; - num945 *= -1f; + yflag *= -1f; + xflag *= -1f; } if (Projectile.identity % 6 == 3) { - num946 = 0f; + yflag = 0f; } if (Projectile.identity % 6 == 4) { - num945 = 0f; + xflag = 0f; } Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 60f) @@ -57,13 +57,13 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.localAI[1] >= -60f) { - Projectile.velocity.X = Projectile.velocity.X + 0.002f * num946; - Projectile.velocity.Y = Projectile.velocity.Y + 0.002f * num945; + Projectile.velocity.X = Projectile.velocity.X + 0.002f * yflag; + Projectile.velocity.Y = Projectile.velocity.Y + 0.002f * xflag; } else { - Projectile.velocity.X = Projectile.velocity.X - 0.002f * num946; - Projectile.velocity.Y = Projectile.velocity.Y - 0.002f * num945; + Projectile.velocity.X = Projectile.velocity.X - 0.002f * yflag; + Projectile.velocity.Y = Projectile.velocity.Y - 0.002f * xflag; } Projectile.ai[0] += 1f; if (Projectile.ai[0] > 5400f) @@ -80,36 +80,36 @@ namespace CalamityMod.Projectiles.Summon } else { - float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (num947 > 4f) + float playerDist = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; + if (playerDist > 4f) { - num947 *= 1.1f; + playerDist *= 1.1f; } - if (num947 > 5f) + if (playerDist > 5f) { - num947 *= 1.2f; + playerDist *= 1.2f; } - if (num947 > 6f) + if (playerDist > 6f) { - num947 *= 1.3f; + playerDist *= 1.3f; } - if (num947 > 7f) + if (playerDist > 7f) { - num947 *= 1.4f; + playerDist *= 1.4f; } - if (num947 > 8f) + if (playerDist > 8f) { - num947 *= 1.5f; + playerDist *= 1.5f; } - if (num947 > 9f) + if (playerDist > 9f) { - num947 *= 1.6f; + playerDist *= 1.6f; } - if (num947 > 10f) + if (playerDist > 10f) { - num947 *= 1.7f; + playerDist *= 1.7f; } - Projectile.ai[0] += num947; + Projectile.ai[0] += playerDist; if (Projectile.alpha > 0) { Projectile.alpha -= 25; @@ -119,49 +119,49 @@ namespace CalamityMod.Projectiles.Summon } } } - bool flag49 = false; + bool canAttack = false; Vector2 center12 = new Vector2(0f, 0f); - float num948 = 600f; + float attackDistance = 600f; if (Main.player[Projectile.owner].HasMinionAttackTargetNPC) { NPC npc = Main.npc[Main.player[Projectile.owner].MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num950 = npc.position.X + (float)(npc.width / 2); - float num951 = npc.position.Y + (float)(npc.height / 2); - float num952 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num950) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num951); - if (num952 < num948) + float npcX = npc.position.X + (float)(npc.width / 2); + float npcY = npc.position.Y + (float)(npc.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 < attackDistance) { - num948 = num952; + attackDistance = npcDist; center12 = npc.Center; - flag49 = true; + canAttack = true; } } } - if (!flag49) + if (!canAttack) { - for (int num949 = 0; num949 < Main.npc.Length; num949++) + for (int i = 0; i < Main.npc.Length; i++) { - if (Main.npc[num949].CanBeChasedBy(Projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { - float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); - float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); - float num952 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num950) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num951); - if (num952 < num948) + 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 < attackDistance) { - num948 = num952; - center12 = Main.npc[num949].Center; - flag49 = true; + attackDistance = npcDist; + center12 = Main.npc[i].Center; + canAttack = true; } } } } - if (flag49) + if (canAttack) { - Vector2 vector101 = center12 - Projectile.Center; - vector101.Normalize(); - vector101 *= 0.75f; - Projectile.velocity = (Projectile.velocity * 10f + vector101) / 10.8f; //11 + Vector2 attackPosition = center12 - Projectile.Center; + attackPosition.Normalize(); + attackPosition *= 0.75f; + Projectile.velocity = (Projectile.velocity * 10f + attackPosition) / 10.8f; //11 return; } if ((double)Projectile.velocity.Length() > 0.2) @@ -182,23 +182,23 @@ namespace CalamityMod.Projectiles.Summon Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 20; num621++) + for (int j = 0; j < 20; j++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 30; num623++) + for (int k = 0; k < 30; k++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index 1302762e6f..9bcb120628 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -49,62 +49,61 @@ namespace CalamityMod.Projectiles.Summon } if (Main.rand.NextBool(15)) { - int num = 0; + int mineAmt = 0; for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == ModContent.ProjectileType()) { - num++; + mineAmt++; } } - if (Main.rand.Next(15) >= num && num < 10) + if (Main.rand.Next(15) >= mineAmt && mineAmt < 10) { - int num2 = 50; - int num3 = 24; - int num4 = 90; - for (int j = 0; j < num2; j++) + int spawnVariance = 24; + int moreSpawnVariance = 90; + for (int j = 0; j < 50; j++) { - int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2); + int randSpawn = Main.rand.Next(200 - j * 2, 400 + j * 2); Vector2 center = Projectile.Center; - center.X += (float)Main.rand.Next(-num5, num5 + 1); - center.Y += (float)Main.rand.Next(-num5, num5 + 1); - if (!Collision.SolidCollision(center, num3, num3)) + center.X += (float)Main.rand.Next(-randSpawn, randSpawn + 1); + center.Y += (float)Main.rand.Next(-randSpawn, randSpawn + 1); + if (!Collision.SolidCollision(center, spawnVariance, spawnVariance)) { - center.X += (float)(num3 / 2); - center.Y += (float)(num3 / 2); + center.X += (float)(spawnVariance / 2); + center.Y += (float)(spawnVariance / 2); if (Collision.CanHit(new Vector2(Projectile.Center.X, Projectile.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(Projectile.Center.X, Projectile.position.Y - 50f), 1, 1, center, 1, 1)) { - int num6 = (int)center.X / 16; - int num7 = (int)center.Y / 16; - bool flag = false; - if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].WallType > 0) + int tileX = (int)center.X / 16; + int tileY = (int)center.Y / 16; + bool canSpawnMine = false; + if (Main.rand.NextBool(3) && Main.tile[tileX, tileY] != null && Main.tile[tileX, tileY].WallType > 0) { - flag = true; + canSpawnMine = true; } else { - center.X -= (float)(num4 / 2); - center.Y -= (float)(num4 / 2); - if (Collision.SolidCollision(center, num4, num4)) + center.X -= (float)(moreSpawnVariance / 2); + center.Y -= (float)(moreSpawnVariance / 2); + if (Collision.SolidCollision(center, moreSpawnVariance, moreSpawnVariance)) { - center.X += (float)(num4 / 2); - center.Y += (float)(num4 / 2); - flag = true; + center.X += (float)(moreSpawnVariance / 2); + center.Y += (float)(moreSpawnVariance / 2); + canSpawnMine = true; } } - if (flag) + if (canSpawnMine) { for (int k = 0; k < Main.maxProjectiles; k++) { if (Main.projectile[k].active && Main.projectile[k].owner == Main.myPlayer && Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) { - flag = false; + canSpawnMine = false; break; } } - if (flag && Main.myPlayer == Projectile.owner) + if (canSpawnMine && Main.myPlayer == Projectile.owner) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } diff --git a/Projectiles/Summon/ElementalAxeMinion.cs b/Projectiles/Summon/ElementalAxeMinion.cs index cc8ed7ea38..3151f632df 100644 --- a/Projectiles/Summon/ElementalAxeMinion.cs +++ b/Projectiles/Summon/ElementalAxeMinion.cs @@ -41,9 +41,9 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index 784d0ece09..259fe2c373 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -59,11 +59,11 @@ namespace CalamityMod.Projectiles.Summon } //Apply the buff - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.Kill(); Projectile.MinionAntiClump(); - bool flag24 = false; + bool accelerate = false; if (Projectile.ai[0] == 2f) { Projectile.ai[1] += 1f; @@ -148,10 +148,10 @@ namespace CalamityMod.Projectiles.Summon } else { - flag24 = true; + accelerate = true; } } - if (flag24) + if (accelerate) { return; } @@ -173,9 +173,9 @@ namespace CalamityMod.Projectiles.Summon } if (!gotoenemy) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[i]; if (nPC2.CanBeChasedBy(Projectile, false)) { float disttoobjective = Vector2.Distance(nPC2.Center, Projectile.Center); diff --git a/Projectiles/Summon/EndoCooperLimbs.cs b/Projectiles/Summon/EndoCooperLimbs.cs index 053032e9c7..da0a05859b 100644 --- a/Projectiles/Summon/EndoCooperLimbs.cs +++ b/Projectiles/Summon/EndoCooperLimbs.cs @@ -47,12 +47,12 @@ namespace CalamityMod.Projectiles.Summon { Projectile body = Main.projectile[(int)Projectile.ai[1]]; //Apply the buff - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { diff --git a/Projectiles/Summon/EndoFire.cs b/Projectiles/Summon/EndoFire.cs index 7575ad1540..ffb48ae5bd 100644 --- a/Projectiles/Summon/EndoFire.cs +++ b/Projectiles/Summon/EndoFire.cs @@ -52,30 +52,30 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.X *= speedY; if (Projectile.ai[0] > 20f) { - float num296 = 1f; + float dustScale = 1f; if (Projectile.ai[0] == 21f) { - num296 = 0.25f; + dustScale = 0.25f; } else if (Projectile.ai[0] == 22f) { - num296 = 0.5f; + dustScale = 0.5f; } else if (Projectile.ai[0] == 23f) { - num296 = 0.75f; + dustScale = 0.75f; } Projectile.ai[0] += 1f; - int num297 = Main.rand.NextBool() ? 68 : 67; + int dustType = Main.rand.NextBool() ? 68 : 67; if (Main.rand.NextBool(4)) { - num297 = 80; + dustType = 80; } if (Main.rand.NextBool()) { - 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, 0.8f); - Dust dust = Main.dust[num299]; + int endoDust = 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, 0.8f); + Dust dust = Main.dust[endoDust]; if (Main.rand.NextBool(3)) { dust.scale *= 1.5f; @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Summon dust.noGravity = true; dust.velocity.X *= 0.8f; dust.velocity.Y *= 0.8f; - dust.scale *= num296; + dust.scale *= dustScale; dust.velocity += Projectile.velocity; dust.noLight = true; diff --git a/Projectiles/Summon/EnergyOrb.cs b/Projectiles/Summon/EnergyOrb.cs index 0cf4e7950e..114eb15353 100644 --- a/Projectiles/Summon/EnergyOrb.cs +++ b/Projectiles/Summon/EnergyOrb.cs @@ -26,10 +26,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 1f); if (Main.rand.Next(6) != 0) - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } NPC potentialTarget = Projectile.Center.MinionHoming(400f, Main.player[Projectile.owner]); if (potentialTarget != null) diff --git a/Projectiles/Summon/FieryDraconid.cs b/Projectiles/Summon/FieryDraconid.cs index 90d69d84fa..366d0f51f8 100644 --- a/Projectiles/Summon/FieryDraconid.cs +++ b/Projectiles/Summon/FieryDraconid.cs @@ -240,9 +240,9 @@ namespace CalamityMod.Projectiles.Summon { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture2D13.Width, num214), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, spriteEffects, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture2D13.Width, framing), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale, spriteEffects, 0); return false; } } diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index 3cd5d56e5d..e94c7641d6 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -40,33 +40,33 @@ namespace CalamityMod.Projectiles.Summon Projectile.height = 20; 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 < 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, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].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, 246, 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 dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } count += 1f; } Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 5; num468++) + for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].velocity *= 0f; + int otherDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 0.75f); + Main.dust[otherDust].velocity *= 0f; } } NPC potentialTarget = Projectile.Center.MinionHoming(300f, Main.player[Projectile.owner]); diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index 971849ce34..6a02840309 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -40,33 +40,33 @@ namespace CalamityMod.Projectiles.Summon Projectile.height = 20; 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 < 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, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].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, 246, 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 dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } count += 1f; } Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 5; num468++) + for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].velocity *= 0f; + int otherDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 0.75f); + Main.dust[otherDust].velocity *= 0f; } } NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Main.player[Projectile.owner]); diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index ca0efa3029..8c901b2312 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -51,23 +51,21 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 0; } - for (int num369 = 0; num369 < 1; num369++) - { - int dustType = 159; - float num370 = Projectile.velocity.X / 3f * (float)num369; - float num371 = Projectile.velocity.Y / 3f * (float)num369; - int num372 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num372]; - dust.position.X = Projectile.Center.X - num370; - dust.position.Y = Projectile.Center.Y - num371; - dust.velocity *= 0f; - dust.scale = 0.5f; - } + int dustType = 159; + float slowXVel = Projectile.velocity.X / 3f; + float slowYVel = Projectile.velocity.Y / 3f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[dust]; + dust.position.X = Projectile.Center.X - slowXVel; + dust.position.Y = Projectile.Center.Y - slowYVel; + dust.velocity *= 0f; + dust.scale = 0.5f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; - 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 attackDistance = 100000f; + bool canAttack = false; Projectile.ai[0] += 1f; if (Projectile.ai[0] > 30f) { @@ -76,83 +74,82 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num377 = npc.position.X + (float)(npc.width / 2); - float num378 = npc.position.Y + (float)(npc.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 < 640f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + float npcX = npc.position.X + (float)(npc.width / 2); + float npcY = npc.position.Y + (float)(npc.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 < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; + attackDistance = npcDist; + projX = npcX; + projY = npcY; + canAttack = true; } } } - if (!flag10) + if (!canAttack) { - for (int num376 = 0; num376 < Main.maxNPCs; num376++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC npc = Main.npc[num376]; + NPC npc = Main.npc[j]; if (npc.CanBeChasedBy(Projectile, false)) { - float num377 = npc.position.X + (float)(npc.width / 2); - float num378 = npc.position.Y + (float)(npc.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 < 640f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + float npcX = npc.position.X + (float)(npc.width / 2); + float npcY = npc.position.Y + (float)(npc.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 < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; + attackDistance = npcDist; + projX = npcX; + projY = npcY; + canAttack = true; } } } } } - if (!flag10) + if (!canAttack) { - 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 = 10f; - float num381 = 0.16f; - 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 projVel = 0.16f; + Vector2 playerDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float playerX = projX - playerDirection.X; + float playerY = projY - playerDirection.Y; + float playerDist = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + playerDist = 10f / playerDist; + playerX *= playerDist; + playerY *= playerDist; + if (Projectile.velocity.X < playerX) { - Projectile.velocity.X = Projectile.velocity.X + num381; - if (Projectile.velocity.X < 0f && num382 > 0f) + Projectile.velocity.X = Projectile.velocity.X + projVel; + if (Projectile.velocity.X < 0f && playerX > 0f) { - Projectile.velocity.X = Projectile.velocity.X + num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X + projVel * 2f; } } - else if (Projectile.velocity.X > num382) + else if (Projectile.velocity.X > playerX) { - Projectile.velocity.X = Projectile.velocity.X - num381; - if (Projectile.velocity.X > 0f && num382 < 0f) + Projectile.velocity.X = Projectile.velocity.X - projVel; + if (Projectile.velocity.X > 0f && playerX < 0f) { - Projectile.velocity.X = Projectile.velocity.X - num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X - projVel * 2f; } } - if (Projectile.velocity.Y < num383) + if (Projectile.velocity.Y < playerY) { - Projectile.velocity.Y = Projectile.velocity.Y + num381; - if (Projectile.velocity.Y < 0f && num383 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + projVel; + if (Projectile.velocity.Y < 0f && playerY > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + projVel * 2f; } } - else if (Projectile.velocity.Y > num383) + else if (Projectile.velocity.Y > playerY) { - Projectile.velocity.Y = Projectile.velocity.Y - num381; - if (Projectile.velocity.Y > 0f && num383 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - projVel; + if (Projectile.velocity.Y > 0f && playerY < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - projVel * 2f; } } } diff --git a/Projectiles/Summon/FrostMistFriendly.cs b/Projectiles/Summon/FrostMistFriendly.cs index 5bd1922125..3c117c9f9e 100644 --- a/Projectiles/Summon/FrostMistFriendly.cs +++ b/Projectiles/Summon/FrostMistFriendly.cs @@ -40,14 +40,14 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.ai[1] == 0f) { - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } Projectile.ai[1] = 1f; @@ -73,15 +73,15 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] = 0f; } } - int num103 = (int)Player.FindClosest(Projectile.Center, 1, 1); + int playerOwner = (int)Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; if (Projectile.ai[1] < 110f && Projectile.ai[1] > 30f) { float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + Vector2 playerDist = Main.player[playerOwner].Center - Projectile.Center; + playerDist.Normalize(); + playerDist *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + playerDist) / 25f; Projectile.velocity.Normalize(); Projectile.velocity *= scaleFactor2; } @@ -99,9 +99,9 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = texture2D13.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.EntitySpriteDraw(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 = texture2D13.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.EntitySpriteDraw(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/Summon/GhostlyMine.cs b/Projectiles/Summon/GhostlyMine.cs index 9eb4d9e887..274acd6d97 100644 --- a/Projectiles/Summon/GhostlyMine.cs +++ b/Projectiles/Summon/GhostlyMine.cs @@ -45,23 +45,23 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[1] += 1f; if (spawnDust) { - 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, 180, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int j = 0; j < 15; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 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, 180, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } spawnDust = false; } @@ -85,23 +85,23 @@ namespace CalamityMod.Projectiles.Summon Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - 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, 180, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].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, 180, 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, 180, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + Main.dust[dust2].velocity *= 2f; } } } diff --git a/Projectiles/Summon/GlacialEmbracePointyThing.cs b/Projectiles/Summon/GlacialEmbracePointyThing.cs index 856abdb1ad..c91831d4a8 100644 --- a/Projectiles/Summon/GlacialEmbracePointyThing.cs +++ b/Projectiles/Summon/GlacialEmbracePointyThing.cs @@ -32,20 +32,20 @@ namespace CalamityMod.Projectiles.Summon target = CalamityUtils.MinionHoming(Projectile.Center, 1000f, Main.player[Projectile.owner]); if (target != null) //target found { - float num550 = 40f; - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num551 = target.Center.X - vector43.X; - float num552 = target.Center.Y - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) + float projVel = 40f; + Vector2 targetDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float targetX = target.Center.X - targetDirection.X; + float targetY = target.Center.Y - targetDirection.Y; + float targetDist = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + if (targetDist < 100f) { - num550 = 28f; //14 + projVel = 28f; //14 } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - Projectile.velocity.X = (Projectile.velocity.X * 20f + num551) / 21f; - Projectile.velocity.Y = (Projectile.velocity.Y * 20f + num552) / 21f; + targetDist = projVel / targetDist; + targetX *= targetDist; + targetY *= targetDist; + Projectile.velocity.X = (Projectile.velocity.X * 20f + targetX) / 21f; + Projectile.velocity.Y = (Projectile.velocity.Y * 20f + targetY) / 21f; } } } diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index b3587b17d5..35ddc8de60 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -44,15 +44,15 @@ namespace CalamityMod.Projectiles.Summon if (dust == 0f) { int dustAmt = 36; - for (int num227 = 0; num227 < dustAmt; num227++) + 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 - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int dusty = Dust.NewDust(vector6 + vector7, 0, 0, 7, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); + 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)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, 7, faceDirection.X * 1.1f, faceDirection.Y * 1.1f, 100, default, 1.4f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; - Main.dust[dusty].velocity = vector7; + Main.dust[dusty].velocity = faceDirection; } dust += 1f; } @@ -73,17 +73,15 @@ namespace CalamityMod.Projectiles.Summon bool flag2 = false; bool flag3 = false; bool flag4 = false; - int num1 = 60 + 30 * Projectile.minionPos; if (Projectile.lavaWet) { Projectile.ai[0] = 1f; Projectile.ai[1] = 0f; } - int num2 = 10; - int num3 = 40 * (Projectile.minionPos + 1) * player.direction; - if (player.position.X + (float) (player.width / 2) < Projectile.position.X + (float) (Projectile.width / 2) - (float) num2 + (float) num3) + int idlePos = 40 * (Projectile.minionPos + 1) * player.direction; + if (player.position.X + (float) (player.width / 2) < Projectile.position.X + (float) (Projectile.width / 2) - 10f + (float) idlePos) flag1 = true; - else if (player.position.X + (float) (player.width / 2) > Projectile.position.X + (float) (Projectile.width / 2) + (float) num2 + (float) num3) + else if (player.position.X + (float) (player.width / 2) > Projectile.position.X + (float) (Projectile.width / 2) + 10f + (float) idlePos) flag2 = true; if (Projectile.ai[1] == 0f) diff --git a/Projectiles/Summon/HermitCrabMinion.cs b/Projectiles/Summon/HermitCrabMinion.cs index 5af490b966..dff0a079d2 100644 --- a/Projectiles/Summon/HermitCrabMinion.cs +++ b/Projectiles/Summon/HermitCrabMinion.cs @@ -48,18 +48,17 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (spawnDust) { - int num501 = 20; - for (int num502 = 0; num502 < num501; num502++) + for (int i = 0; i < 20; i++) { - int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].scale *= 1.15f; } spawnDust = false; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -70,12 +69,12 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - Vector2 vector46 = Projectile.position; + Vector2 projPos = Projectile.position; if (!fly) { Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 destination = player.Center - center2; + float playerDistance = destination.Length(); if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 205f && Projectile.position.X == Projectile.oldPosition.X))) { Projectile.velocity.Y = -10f; @@ -98,7 +97,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 1; } - float num633 = 600f; + float attackDistance = 600f; bool chaseNPC = false; float npcPositionX = 0f; if (player.HasMinionAttackTargetNPC) @@ -106,11 +105,11 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (!chaseNPC && num646 < num633) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!chaseNPC && targetDist < attackDistance) { - num633 = num646; - vector46 = npc.Center; + attackDistance = targetDist; + projPos = npc.Center; npcPositionX = npc.position.X; chaseNPC = true; } @@ -118,16 +117,16 @@ namespace CalamityMod.Projectiles.Summon } if (!chaseNPC) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC npcTarget = Main.npc[num645]; + NPC npcTarget = Main.npc[j]; if (npcTarget.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npcTarget.Center, Projectile.Center); - if (!chaseNPC && num646 < num633) + float targetDist = Vector2.Distance(npcTarget.Center, Projectile.Center); + if (!chaseNPC && targetDist < attackDistance) { - num633 = num646; - vector46 = npcTarget.Center; + attackDistance = targetDist; + projPos = npcTarget.Center; npcPositionX = npcTarget.position.X; chaseNPC = true; } @@ -288,11 +287,11 @@ namespace CalamityMod.Projectiles.Summon else if (fly) { Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); - float playerDistance = vector48.Length(); - vector48.Normalize(); - vector48 *= 8f; - Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; + Vector2 destination = player.Center - center2 + new Vector2(0f, 0f); + float playerDistance = destination.Length(); + destination.Normalize(); + destination *= 8f; + Projectile.velocity = (Projectile.velocity * 40f + destination) / 41f; Projectile.rotation = Projectile.velocity.X * 0.03f; Projectile.frameCounter++; diff --git a/Projectiles/Summon/Hive.cs b/Projectiles/Summon/Hive.cs index a3e9ed5972..609038c0ef 100644 --- a/Projectiles/Summon/Hive.cs +++ b/Projectiles/Summon/Hive.cs @@ -50,42 +50,42 @@ namespace CalamityMod.Projectiles.Summon Projectile.StickToTiles(false, false); int target = 0; - float num633 = 800f; - Vector2 vector46 = Projectile.position; - bool flag25 = false; + float attackDist = 800f; + Vector2 projPos = Projectile.position; + bool canAttack = false; if (Main.player[Projectile.owner].HasMinionAttackTargetNPC) { NPC npc = Main.npc[Main.player[Projectile.owner].MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!canAttack && targetDist < attackDist) { - vector46 = npc.Center; - flag25 = true; + projPos = npc.Center; + canAttack = true; target = npc.whoAmI; } } } - if (!flag25) + if (!canAttack) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[j]; if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if (!canAttack && targetDist < attackDist) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - target = num645; + attackDist = targetDist; + projPos = nPC2.Center; + canAttack = true; + target = j; } } } } - if (Projectile.owner == Main.myPlayer && flag25) + if (Projectile.owner == Main.myPlayer && canAttack) { if (Projectile.ai[0] != 0f) { diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index d713a234e3..42ca33b782 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -44,13 +44,13 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int dusty = Dust.NewDust(vector6 + vector7, 0, 0, 191, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, 191, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; - Main.dust[dusty].velocity = vector7; + Main.dust[dusty].velocity = faceDirection; } initialized = true; } diff --git a/Projectiles/Summon/HydrothermicVent.cs b/Projectiles/Summon/HydrothermicVent.cs index 4aa195b408..5cedf175e8 100644 --- a/Projectiles/Summon/HydrothermicVent.cs +++ b/Projectiles/Summon/HydrothermicVent.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.chaosSpirit) @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; return; } - if (flag64) + if (isMinion) { if (player.dead) { @@ -59,12 +59,11 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + for (int i = 0; i < 50; i++) { - int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, Main.rand.NextBool(3) ? 16 : 127, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, Main.rand.NextBool(3) ? 16 : 127, 0f, 0f, 0, default, 1f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].scale *= 1.15f; } } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 1f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f); diff --git a/Projectiles/Summon/IceSentryFrostBolt.cs b/Projectiles/Summon/IceSentryFrostBolt.cs index fc07f40b21..09e1850807 100644 --- a/Projectiles/Summon/IceSentryFrostBolt.cs +++ b/Projectiles/Summon/IceSentryFrostBolt.cs @@ -38,25 +38,25 @@ namespace CalamityMod.Projectiles.Summon 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 num102 = 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); - Dust dust = Main.dust[num102]; + float slowVelX = Projectile.velocity.X / 3f * (float)i; + float slowVelY = Projectile.velocity.Y / 3f * (float)i; + int four = 4; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, 92, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[dusty]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= num99; - dust.position.Y -= num100; + dust.position.X -= slowVelX; + dust.position.Y -= slowVelY; } if (Main.rand.NextBool(10)) { - 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, 92, 0f, 0f, 100, default, 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += Projectile.velocity * 0.5f; + int otherFour = 4; + int dustier = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFour, Projectile.position.Y + (float)otherFour), Projectile.width - otherFour * 2, Projectile.height - otherFour * 2, 92, 0f, 0f, 100, default, 0.6f); + Main.dust[dustier].velocity *= 0.25f; + Main.dust[dustier].velocity += Projectile.velocity * 0.5f; } Projectile.rotation += 0.3f * (float)Projectile.direction; } diff --git a/Projectiles/Summon/IrradiatedAura.cs b/Projectiles/Summon/IrradiatedAura.cs index 1fce516a5f..82d8d3248f 100644 --- a/Projectiles/Summon/IrradiatedAura.cs +++ b/Projectiles/Summon/IrradiatedAura.cs @@ -41,14 +41,14 @@ namespace CalamityMod.Projectiles.Summon { randomDust = 33; } - for (int num468 = 0; num468 < (Main.rand.NextBool() ? 1 : 2); num468++) + for (int i = 0; i < (Main.rand.NextBool() ? 1 : 2); i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); if (randomDust == 89) { - Main.dust[num469].scale *= 0.35f; + Main.dust[dust].scale *= 0.35f; } - Main.dust[num469].velocity *= 0f; + Main.dust[dust].velocity *= 0f; } } diff --git a/Projectiles/Summon/LanternFlame.cs b/Projectiles/Summon/LanternFlame.cs index de8e17d38d..4b6c5d4ce1 100644 --- a/Projectiles/Summon/LanternFlame.cs +++ b/Projectiles/Summon/LanternFlame.cs @@ -64,23 +64,23 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - 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, 127, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int j = 0; j < 15; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 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, 127, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index ed369b4a85..de2b181995 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -42,15 +42,15 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - 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, 107, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = 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 dust = Dust.NewDust(rotate + faceDirection, 0, 0, 107, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = faceDirection; } dust--; } @@ -75,8 +75,8 @@ namespace CalamityMod.Projectiles.Summon } } - bool flag64 = Projectile.type == ModContent.ProjectileType(); - if (flag64) + bool isMinion = Projectile.type == ModContent.ProjectileType(); + if (isMinion) { if (!modPlayer.luxorsGift || player.dead) { diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index 9597941677..bedbe64fb8 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -45,21 +45,21 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - 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(Projectile.width / 2f, Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 180, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = faceDirection; } Projectile.localAI[0] += 1f; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -71,106 +71,102 @@ namespace CalamityMod.Projectiles.Summon } } Projectile.MinionAntiClump(); - float num633 = 3000f; - float num634 = 3500f; - float num635 = 4000f; - float num636 = 600f; - Vector2 vector46 = Projectile.position; - bool flag25 = false; + float attackDistance = 3000f; + Vector2 targetCenter = Projectile.position; + bool canAttack = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (num646 < num633) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetDist < attackDistance) { - num633 = num646; - vector46 = npc.Center; - flag25 = true; + attackDistance = targetDist; + targetCenter = npc.Center; + canAttack = true; } } } - if (!flag25) + if (!canAttack) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[j]; if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if (!canAttack && targetDist < attackDistance) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; + attackDistance = targetDist; + targetCenter = nPC2.Center; + canAttack = true; } } } } - float num647 = num634; - if (flag25) + float separationAnxietyDist = 3500f; + if (canAttack) { - num647 = num635; + separationAnxietyDist = 4000f; } - if (Vector2.Distance(player.Center, Projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { Projectile.ai[0] = 1f; Projectile.netUpdate = true; } - if (flag25 && Projectile.ai[0] == 0f) + if (canAttack && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - Projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 targetDirection = targetCenter - Projectile.Center; + float targetDistance = targetDirection.Length(); + targetDirection.Normalize(); + if (targetDistance > 200f) { float scaleFactor2 = 18f; - vector47 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + targetDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 40f + targetDirection) / 41f; } else { - float num649 = 12f; - vector47 *= -num649; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + targetDirection *= -12f; + Projectile.velocity = (Projectile.velocity * 40f + targetDirection) / 41f; } } else { - bool flag26 = false; - if (!flag26) + bool isReturning = false; + if (!isReturning) { - flag26 = Projectile.ai[0] == 1f; + isReturning = Projectile.ai[0] == 1f; } - float num650 = 12f; - if (flag26) + float returnSpeed = 12f; + if (isReturning) { - num650 = 30f; + returnSpeed = 30f; } Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 16f) + Vector2 playerDirection = player.Center - center2 + new Vector2(0f, -120f); + float playerDist = playerDirection.Length(); + if (playerDist > 200f && returnSpeed < 16f) { - num650 = 16f; + returnSpeed = 16f; } - if (num651 < num636 && flag26) + if (playerDist < 600f && isReturning) { Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (num651 > 3500f) + if (playerDist > 3500f) { Projectile.position.X = player.Center.X - (Projectile.width / 2); Projectile.position.Y = player.Center.Y - (Projectile.height / 2); Projectile.netUpdate = true; } - if (num651 > 70f) + if (playerDist > 70f) { - vector48.Normalize(); - vector48 *= num650; - Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; + playerDirection.Normalize(); + playerDirection *= returnSpeed; + Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { @@ -178,9 +174,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y = -0.05f; } } - if (flag25) + if (canAttack) { - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(vector46), 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(targetCenter), 0.1f); } else { @@ -197,7 +193,7 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.ai[0] == 0f) { - if (flag25 && Projectile.ai[1] == 0f) + if (canAttack && Projectile.ai[1] == 0f) { Projectile.ai[1] += 1f; if (Main.myPlayer == Projectile.owner) diff --git a/Projectiles/Summon/PhantomicDagger.cs b/Projectiles/Summon/PhantomicDagger.cs index b82c4fbe46..cabc85e146 100644 --- a/Projectiles/Summon/PhantomicDagger.cs +++ b/Projectiles/Summon/PhantomicDagger.cs @@ -126,20 +126,20 @@ namespace CalamityMod.Projectiles.Summon NPC target = CalamityUtils.MinionHoming(Projectile.Center, 1500f, Main.player[Projectile.owner]); if (target != null) { - float num550 = 40f; - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num551 = target.Center.X - vector43.X; - float num552 = target.Center.Y - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) + float projVel = 40f; + Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float targetXDist = target.Center.X - projDirection.X; + float targetYDist = target.Center.Y - projDirection.Y; + float targetDist = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (targetDist < 100f) { - num550 = 28f; //14 + projVel = 28f; //14 } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - Projectile.velocity.X = (Projectile.velocity.X * 25f + num551) / 26f; - Projectile.velocity.Y = (Projectile.velocity.Y * 25f + num552) / 26f; + targetDist = projVel / targetDist; + targetXDist *= targetDist; + targetYDist *= targetDist; + Projectile.velocity.X = (Projectile.velocity.X * 25f + targetXDist) / 26f; + Projectile.velocity.Y = (Projectile.velocity.Y * 25f + targetYDist) / 26f; } else { diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index b67ccedf92..4fcfccd7bd 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -40,14 +40,14 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - 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.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, 73, vector7.X, vector7.Y, 100, default, 1.1f); - Main.dust[num228].noGravity = true; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; + rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 73, faceDirection.X, faceDirection.Y, 100, default, 1.1f); + Main.dust[dust].noGravity = true; } Projectile.localAI[0] += 1f; } @@ -67,13 +67,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } Lighting.AddLight(Projectile.Center, 0.3f, 0.2f, 0.3f); - float num633 = 1200f; - float num634 = 1500f; - float num635 = 2400f; - float num636 = 150f; - bool flag64 = Projectile.type == ModContent.ProjectileType(); + float attackRange = 1200f; + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -85,109 +82,108 @@ namespace CalamityMod.Projectiles.Summon } } Projectile.MinionAntiClump(); - bool flag24 = false; - if (flag24) + bool returnbool = false; + if (returnbool) { return; } - Vector2 vector46 = Projectile.position; - bool flag25 = false; + Vector2 projPos = Projectile.position; + bool canAttack = false; int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if ((npc.CanBeChasedBy(Projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!canAttack && targetDist < attackRange) { - vector46 = npc.Center; - flag25 = true; + projPos = npc.Center; + canAttack = true; targetIndex = npc.whoAmI; } } } - if (!flag25) + if (!canAttack) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[j]; if ((nPC2.CanBeChasedBy(Projectile, false) || nPC2.type == NPCID.DukeFishron) && nPC2.active) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if (!canAttack && targetDist < attackRange) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - targetIndex = num645; + attackRange = targetDist; + projPos = nPC2.Center; + canAttack = true; + targetIndex = j; } } } } - float num647 = num634; - if (flag25) + float separationAnxietyDist = 1500f; + if (canAttack) { - num647 = num635; + separationAnxietyDist = 2400f; } - if (Vector2.Distance(player.Center, Projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { Projectile.ai[0] = 1f; Projectile.netUpdate = true; } - if (flag25 && Projectile.ai[0] == 0f) + if (canAttack && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - Projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 projDirection = projPos - Projectile.Center; + float projDistance = projDirection.Length(); + projDirection.Normalize(); + if (projDistance > 200f) { float scaleFactor2 = 12f; - vector47 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } else { - float num649 = 6f; - vector47 *= -num649; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= -6f; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } } else { - bool flag26 = false; - if (!flag26) + bool isReturning = false; + if (!isReturning) { - flag26 = Projectile.ai[0] == 1f; + isReturning = Projectile.ai[0] == 1f; } - float num650 = 10f; - if (flag26) + float returnSpeed = 10f; + if (isReturning) { - num650 = 24f; + returnSpeed = 24f; } Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(-40f, -40f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 12f) + Vector2 playerDirection = player.Center - center2 + new Vector2(-40f, -40f); + float playerDist = playerDirection.Length(); + if (playerDist > 200f && returnSpeed < 12f) { - num650 = 12f; + returnSpeed = 12f; } - if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + if (playerDist < 150f && isReturning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (num651 > 2000f) + if (playerDist > 2000f) { Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } - if (num651 > 70f) + if (playerDist > 70f) { - vector48.Normalize(); - vector48 *= num650; - Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; + playerDirection.Normalize(); + playerDirection *= returnSpeed; + Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { @@ -216,20 +212,20 @@ namespace CalamityMod.Projectiles.Summon { float velocity = 8f; int projectileType = ModContent.ProjectileType(); - if (flag25 && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) + if (canAttack && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { Projectile.ai[1] += 1f; if (Main.myPlayer == Projectile.owner) { SoundEngine.PlaySound(SoundID.Item8, Projectile.position); - Vector2 value19 = vector46 - Projectile.Center; - value19.Normalize(); - value19 *= velocity; + Vector2 projDirectionAgain = projPos - Projectile.Center; + projDirectionAgain.Normalize(); + projDirectionAgain *= velocity; int numProj = 2; float rotation = MathHelper.ToRadians(4); for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Vector2 perturbedSpeed = projDirectionAgain.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); } Projectile.netUpdate = true; @@ -242,9 +238,9 @@ namespace CalamityMod.Projectiles.Summon { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.EntitySpriteDraw(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, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.EntitySpriteDraw(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, 0); return false; } diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index db1042ee93..723a7e324f 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -78,55 +78,55 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] -= 1f; return; } - bool flag18 = false; - float num506 = Projectile.Center.X; - float num507 = Projectile.Center.Y; - float num508 = 1000f; + bool canAttack = false; + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + float attackDistance = 1000f; int target = 0; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num539 = npc.Center.X; - float num540 = npc.Center.Y; - float num541 = Math.Abs(Projectile.Center.X - num539) + Math.Abs(Projectile.Center.Y - num540); - if (num541 < num508 && Collision.CanHit(Projectile.Center, Projectile.width, Projectile.height, npc.Center, npc.width, npc.height)) + float targetX = npc.Center.X; + float targetY = npc.Center.Y; + float targetDist = Math.Abs(Projectile.Center.X - targetX) + Math.Abs(Projectile.Center.Y - targetY); + if (targetDist < attackDistance && Collision.CanHit(Projectile.Center, Projectile.width, Projectile.height, npc.Center, npc.width, npc.height)) { - num506 = num539; - num507 = num540; - flag18 = true; + projX = targetX; + projY = targetY; + canAttack = true; target = npc.whoAmI; } } } - if (!flag18) + if (!canAttack) { - for (int num512 = 0; num512 < Main.maxNPCs; num512++) + for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[num512].CanBeChasedBy(Projectile, false)) + if (Main.npc[j].CanBeChasedBy(Projectile, false)) { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num513) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + float npcX = Main.npc[j].position.X + (float)(Main.npc[j].width / 2); + float npcY = Main.npc[j].position.Y + (float)(Main.npc[j].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 < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[j].position, Main.npc[j].width, Main.npc[j].height)) { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - target = num512; + attackDistance = npcDist; + projX = npcX; + projY = npcY; + canAttack = true; + target = j; } } } } - if (flag18) + if (canAttack) { - float num516 = num506; - float num517 = num507; - num506 -= Projectile.Center.X; - num507 -= Projectile.Center.Y; - if (num506 < 0f) + float projXStore = projX; + float projYStore = projY; + projX -= Projectile.Center.X; + projY -= Projectile.Center.Y; + if (projX < 0f) { Projectile.spriteDirection = 1; } @@ -140,14 +140,14 @@ namespace CalamityMod.Projectiles.Summon ModContent.ProjectileType() }); float speed = 25f; - Vector2 vector29 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = speed / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, (float)target, 0f); + Vector2 fireDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float fireXVel = projXStore - fireDirection.X; + float fireYVel = projYStore - fireDirection.Y; + float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); + fireVelocity = speed / fireVelocity; + fireXVel *= fireVelocity; + fireYVel *= fireVelocity; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, fireXVel, fireYVel, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, (float)target, 0f); Projectile.ai[0] = 16f; } diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index 88565068b1..fccd2d79a0 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -42,14 +42,14 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - 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.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, 173, vector7.X, vector7.Y, 100, default, 1.8f); - Main.dust[num228].noGravity = true; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; + rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X, faceDirection.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; } dust--; } @@ -70,9 +70,9 @@ namespace CalamityMod.Projectiles.Summon } Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f); Projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 30f, 18f, 9f, new Vector2(0f, -60f), 30f, 12f, true, true); - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -89,9 +89,9 @@ namespace CalamityMod.Projectiles.Summon { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.EntitySpriteDraw(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, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.EntitySpriteDraw(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, 0); return false; } diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index 449f564029..f6b29e3023 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -88,25 +88,25 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 11f) / (21f); } - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int pinkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 0.6f); + Main.dust[pinkDust].noGravity = true; + Main.dust[pinkDust].velocity *= 0.5f; + Main.dust[pinkDust].velocity += Projectile.velocity * 0.1f; } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item25, Projectile.position); - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 0.5f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); + Main.dust[dust].velocity *= 0.5f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.4f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 0.8f); + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.4f); + Main.dust[dust2].noGravity = true; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 0.8f); } } } diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index 2511555085..d8a45cdf7c 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -46,8 +46,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; return; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); - if (flag64) + bool isMinion = Projectile.type == ModContent.ProjectileType(); + if (isMinion) { if (player.dead) { @@ -61,12 +61,11 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + for (int i = 0; i < 50; i++) { - int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 32, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 32, 0f, 0f, 0, default, 1f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].scale *= 1.15f; } } bool passive = modPlayer.sandWaifuVanity || modPlayer.allWaifusVanity; @@ -74,19 +73,16 @@ namespace CalamityMod.Projectiles.Summon { Projectile.spriteDirection = -Projectile.direction; } - float num633 = 700f; //700 - float num634 = 800f; - float num635 = 1200f; - float num636 = 200f; //150 + float attackDistance = 700f; //700 if (!passive) { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(Projectile.Center, 0.7f * num, 0.6f * num, 0f * num); + float lights = (float)Main.rand.Next(90, 111) * 0.01f; + lights *= Main.essScale; + Lighting.AddLight(Projectile.Center, 0.7f * lights, 0.6f * lights, 0f * lights); } Projectile.MinionAntiClump(); - Vector2 vector46 = Projectile.position; - bool flag25 = false; + Vector2 projPos = Projectile.position; + bool canAttack = false; if (Projectile.ai[0] != 1f) { Projectile.tileCollide = false; @@ -100,33 +96,33 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!canAttack && targetDist < attackDistance) { - vector46 = npc.Center; - flag25 = true; + projPos = npc.Center; + canAttack = true; } } } - if (!flag25 && !passive) + if (!canAttack && !passive) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[j]; if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float targetDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if ((!canAttack && targetDist < attackDistance) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; + attackDistance = targetDist; + projPos = nPC2.Center; + canAttack = true; } } } } - float num647 = num634; - if (flag25 && !passive) + float separationAnxietyDist = 800f; + if (canAttack && !passive) { if (Projectile.frame < 6) { @@ -142,7 +138,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 6; } - num647 = num635; + separationAnxietyDist = 1200f; } else { @@ -157,65 +153,64 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } } - if (Vector2.Distance(player.Center, Projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { Projectile.ai[0] = 1f; Projectile.tileCollide = false; Projectile.netUpdate = true; } - if (flag25 && Projectile.ai[0] == 0f) + if (canAttack && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - Projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 targetDirection = projPos - Projectile.Center; + float targetDistance = targetDirection.Length(); + targetDirection.Normalize(); + if (targetDistance > 200f) { float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + targetDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 40f + targetDirection) / 41f; } else { - float num649 = 4f; - vector47 *= -num649; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + targetDirection *= -4f; + Projectile.velocity = (Projectile.velocity * 40f + targetDirection) / 41f; } } else { - bool flag26 = false; - if (!flag26) + bool isReturning = false; + if (!isReturning) { - flag26 = Projectile.ai[0] == 1f; + isReturning = Projectile.ai[0] == 1f; } - float num650 = 6f; //6 - if (flag26) + float returnSpeed = 6f; //6 + if (isReturning) { - num650 = 15f; //16 + returnSpeed = 15f; //16 } Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(250f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) //200 and 8 + Vector2 playerDirection = player.Center - center2 + new Vector2(250f, -60f); //-60 + float playerDist = playerDirection.Length(); + if (playerDist > 200f && returnSpeed < 8f) //200 and 8 { - num650 = 8f; //8 + returnSpeed = 8f; //8 } - if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + if (playerDist < 200f && isReturning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (num651 > 2000f) + if (playerDist > 2000f) { Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } - if (num651 > 70f) + if (playerDist > 70f) { - vector48.Normalize(); - vector48 *= num650; - Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; + playerDirection.Normalize(); + playerDirection *= returnSpeed; + Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { @@ -240,16 +235,16 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[0] == 0f) { float scaleFactor3 = 11f; - int num658 = ModContent.ProjectileType(); - if (flag25 && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) + int projType = ModContent.ProjectileType(); + if (canAttack && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, vector46, 0, 0)) + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, projPos, 0, 0)) { - Vector2 value19 = vector46 - Projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, value19, num658, Projectile.damage, 0f, Main.myPlayer); + Vector2 projVel = projPos - Projectile.Center; + projVel.Normalize(); + projVel *= scaleFactor3; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projVel, projType, Projectile.damage, 0f, Main.myPlayer); Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/SandMark.cs b/Projectiles/Summon/SandMark.cs index 9a0606c688..e366f64e60 100644 --- a/Projectiles/Summon/SandMark.cs +++ b/Projectiles/Summon/SandMark.cs @@ -40,34 +40,34 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.localAI[1] < 30f) { - for (int num1134 = 0; num1134 < 1; num1134++) + for (int i = 0; i < 1; i++) { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = Projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) + float lerpvalue1 = -0.5f; + float lerpvalue2 = 0.9f; + float randomLerp = Main.rand.NextFloat(); + Vector2 dustMovement = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(lerpvalue1, lerpvalue2, randomLerp)); + dustMovement.X *= MathHelper.Lerp(2.2f, 0.6f, randomLerp); + dustMovement.X *= -1f; + Vector2 dustMovement2 = new Vector2(2f, 10f); + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * dustMovement * 0.5f + dustMovement2; + Dust dust = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; + dust.position = position4; + dust.customData = Projectile.Center + dustMovement2; + dust.fadeIn = 1f; + dust.scale = 0.3f; + if (dustMovement.X > -1.2f) { - dust34.velocity.X = 1f + Main.rand.NextFloat(); + dust.velocity.X = 1f + Main.rand.NextFloat(); } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + dust.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 0.8f; Projectile.direction = 1; - Point point9 = Projectile.Center.ToTileCoordinates(); - Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Point projCenter = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(projCenter.X * 16 + 8), (float)(projCenter.Y * 16 + 8)); } Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; if (Projectile.localAI[1] < 33f) @@ -96,30 +96,30 @@ namespace CalamityMod.Projectiles.Summon { Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } - for (int num1135 = 0; num1135 < 2; num1135++) + for (int j = 0; j < 2; j++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = Projectile.Opacity * Projectile.localAI[0]; - dust35.position = Projectile.Center; - dust35.velocity = value83 * 2.5f; + Vector2 dustVel = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dusty = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + dusty.noGravity = true; + dusty.noLight = true; + dusty.scale = Projectile.Opacity * Projectile.localAI[0]; + dusty.position = Projectile.Center; + dusty.velocity = dustVel * 2.5f; } } - for (int num1136 = 0; num1136 < 2; num1136++) + for (int k = 0; k < 2; k++) { if (Main.rand.NextBool(10)) { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = Projectile.Opacity * Projectile.localAI[0]; - dust36.position = Projectile.Center; - dust36.velocity = value84 * 2.5f; + Vector2 dustVel2 = Vector2.UnitY.RotatedBy((double)((float)k * 3.14159274f), default); + Dust dustier = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + dustier.noGravity = true; + dustier.noLight = true; + dustier.scale = Projectile.Opacity * Projectile.localAI[0]; + dustier.position = Projectile.Center; + dustier.velocity = dustVel2 * 2.5f; } } if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) @@ -141,16 +141,16 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - 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)); - Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Color originalColor = 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)); + Vector2 drawPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D27 = ModContent.Request(Texture).Value; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.EntitySpriteDraw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, SpriteEffects.None, 0); + Rectangle rectangle = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alphaColor = Projectile.GetAlpha(originalColor); + Vector2 origin7 = rectangle.Size() / 2f; + Color sandyColor = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); + Main.EntitySpriteDraw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), sandyColor, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, Projectile.rotation, origin7, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Summon/SandTornado.cs b/Projectiles/Summon/SandTornado.cs index 45c37c5bdc..8aaa6d1339 100644 --- a/Projectiles/Summon/SandTornado.cs +++ b/Projectiles/Summon/SandTornado.cs @@ -30,65 +30,63 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - float num1125 = 900f; + float lifeSpan = 900f; if (Projectile.soundDelay == 0) { Projectile.soundDelay = -1; SoundEngine.PlaySound(SoundID.Item122, Projectile.position); } Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= num1125) + if (Projectile.ai[0] >= lifeSpan) { Projectile.Kill(); } if (Projectile.localAI[0] >= 30f) { Projectile.damage = 0; - if (Projectile.ai[0] < num1125 - 120f) + if (Projectile.ai[0] < lifeSpan - 120f) { - float num1126 = Projectile.ai[0] % 60f; - Projectile.ai[0] = num1125 - 120f + num1126; + float aiDecrement = Projectile.ai[0] % 60f; + Projectile.ai[0] = lifeSpan - 120f + aiDecrement; Projectile.netUpdate = true; } } - float num1127 = 15f; - float num1128 = 15f; Point point8 = Projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - Projectile.width = (int)(value74.X * 0.65f); - Projectile.height = (int)value74.Y; - Projectile.Center = vector146; + int sizeMod; + int sizeMod2; + Collision.ExpandVertically(point8.X, point8.Y, out sizeMod, out sizeMod2, 15, 15); + sizeMod++; + sizeMod2--; + Vector2 sizeModVector = new Vector2((float)point8.X, (float)sizeMod) * 16f + new Vector2(8f); + Vector2 sizeModVector2 = new Vector2((float)point8.X, (float)sizeMod2) * 16f + new Vector2(8f); + Vector2 centering = Vector2.Lerp(sizeModVector, sizeModVector2, 0.5f); + Vector2 sizeModPos = new Vector2(0f, sizeModVector2.Y - sizeModVector.Y); + sizeModPos.X = sizeModPos.Y * 0.2f; + Projectile.width = (int)(sizeModPos.X * 0.65f); + Projectile.height = (int)sizeModPos.Y; + Projectile.Center = centering; if (Projectile.owner == Main.myPlayer) { - bool flag74 = false; - Vector2 center16 = Main.player[Projectile.owner].Center; + bool breakFlag = false; + Vector2 playerCenter = Main.player[Projectile.owner].Center; Vector2 top = Main.player[Projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + for (float i = 0f; i < 1f; i += 0.05f) { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + Vector2 position2 = Vector2.Lerp(sizeModVector, sizeModVector2, i); + if (Collision.CanHitLine(position2, 0, 0, playerCenter, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) { - flag74 = true; + breakFlag = true; break; } } - if (!flag74 && Projectile.ai[0] < num1125 - 120f) + if (!breakFlag && Projectile.ai[0] < lifeSpan - 120f) { - float num1132 = Projectile.ai[0] % 60f; - Projectile.ai[0] = num1125 - 120f + num1132; + float aiDecrement2 = Projectile.ai[0] % 60f; + Projectile.ai[0] = lifeSpan - 120f + aiDecrement2; Projectile.netUpdate = true; } } - if (Projectile.ai[0] < num1125 - 120f) + if (Projectile.ai[0] < lifeSpan - 120f) { return; } @@ -96,57 +94,54 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = Projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) + float aiTracker = Projectile.ai[0]; + float trackerClamp = MathHelper.Clamp(aiTracker / 30f, 0f, 1f); + if (aiTracker > 540f) { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + trackerClamp = MathHelper.Lerp(1f, 0f, (aiTracker - 540f) / 60f); } - Point point5 = Projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); + Point centerPoint = Projectile.Center.ToTileCoordinates(); + int sizeModding; + int sizeModding2; + Collision.ExpandVertically(centerPoint.X, centerPoint.Y, out sizeModding, out sizeModding2, 15, 15); + sizeModding++; + sizeModding2--; + float vectorMult = 0.2f; + Vector2 sizeModdingVector = new Vector2((float)centerPoint.X, (float)sizeModding) * 16f + new Vector2(8f); + Vector2 sizeModdingVector2 = new Vector2((float)centerPoint.X, (float)sizeModding2) * 16f + new Vector2(8f); + Vector2.Lerp(sizeModdingVector, sizeModdingVector2, 0.5f); + Vector2 sizeModdingPos = new Vector2(0f, sizeModdingVector2.Y - sizeModdingVector.Y); + sizeModdingPos.X = sizeModdingPos.Y * vectorMult; + new Vector2(sizeModdingVector.X - sizeModdingPos.X / 2f, sizeModdingVector.Y); Texture2D texture2D23 = ModContent.Request(Texture).Value; - Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Color value34 = new Color(225, 225, 100); - for (float num236 = (float)(int)value33.Y; num236 > (float)(int)value32.Y; num236 -= num235) + Rectangle drawRectangle = texture2D23.Frame(1, 1, 0, 0); + Vector2 smallRect = drawRectangle.Size() / 2f; + float aiTrackMult = -0.06283186f * aiTracker; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(aiTracker * 0.1f), default); + float incrementStorage = 0f; + float increment = 5.1f; + Color sandYellow = new Color(225, 225, 100); + for (float k = (float)(int)sizeModdingVector2.Y; k > (float)(int)sizeModdingVector.Y; k -= increment) { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) + incrementStorage += increment; + float colorChanger = incrementStorage / sizeModdingPos.Y; + float incStorageMult = incrementStorage * 6.28318548f / -20f; + float lowerColorChanger = colorChanger - 0.15f; + Vector2 spinArea = spinningpoint2.RotatedBy((double)incStorageMult, default); + Vector2 colorChangeVector = new Vector2(0f, colorChanger + 1f); + colorChangeVector.X = colorChangeVector.Y * vectorMult; + Color newSandYellow = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, sandYellow, colorChanger * 2f); + if (colorChanger > 0.5f) { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + newSandYellow = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, sandYellow, 2f - colorChanger * 2f); } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.EntitySpriteDraw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0); + newSandYellow.A = (byte)((float)newSandYellow.A * 0.5f); + newSandYellow *= trackerClamp; + spinArea *= colorChangeVector * 100f; + spinArea.Y = 0f; + spinArea.X = 0f; + spinArea += new Vector2(sizeModdingVector2.X, k) - Main.screenPosition; + Main.EntitySpriteDraw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), newSandYellow, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index 0bb2b1b993..2df2ba0adb 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -38,13 +38,13 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); if (!modPlayer.silvaSummon) { Projectile.active = false; return; } - if (flag64) + if (isMinion) { if (player.dead) { @@ -67,7 +67,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.position.X = (int)Projectile.position.X; Projectile.position.Y = (int)Projectile.position.Y; - float num1072 = 1500f; Projectile.velocity = Vector2.Zero; Projectile.alpha -= 5; if (Projectile.alpha < 0) @@ -80,12 +79,12 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.alpha == 0 && Main.rand.NextBool(15)) { - Dust dust34 = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f)]; - dust34.velocity.X = 0f; - dust34.noGravity = true; - dust34.fadeIn = 1f; - dust34.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); - dust34.scale = 0.5f; + Dust silvaDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f)]; + silvaDust.velocity.X = 0f; + silvaDust.noGravity = true; + silvaDust.fadeIn = 1f; + silvaDust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); + silvaDust.scale = 0.5f; } Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 60f) @@ -98,51 +97,51 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.ai[0] == 0f) { - int num1074 = -1; - float num1075 = num1072; + int targetID = -1; + float attackRange = 1500f; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num1076 = Projectile.Distance(npc.Center); - if (num1076 < num1075 && Collision.CanHitLine(Projectile.Center, 0, 0, npc.Center, 0, 0)) + float targetDist = Projectile.Distance(npc.Center); + if (targetDist < attackRange && Collision.CanHitLine(Projectile.Center, 0, 0, npc.Center, 0, 0)) { - num1075 = num1076; - num1074 = npc.whoAmI; + attackRange = targetDist; + targetID = npc.whoAmI; } } } - if (num1074 < 0) + if (targetID < 0) { - int num30; - for (int num1077 = 0; num1077 < Main.maxNPCs; num1077 = num30 + 1) + int targetIDCopy; + for (int i = 0; i < Main.maxNPCs; i = targetIDCopy + 1) { - NPC nPC16 = Main.npc[num1077]; - if (nPC16.CanBeChasedBy(Projectile, false)) + NPC target = Main.npc[i]; + if (target.CanBeChasedBy(Projectile, false)) { - float num1078 = Projectile.Distance(nPC16.Center); - if (num1078 < num1075 && Collision.CanHitLine(Projectile.Center, 0, 0, nPC16.Center, 0, 0)) + float targetDistance = Projectile.Distance(target.Center); + if (targetDistance < attackRange && Collision.CanHitLine(Projectile.Center, 0, 0, target.Center, 0, 0)) { - num1075 = num1078; - num1074 = num1077; + attackRange = targetDistance; + targetID = i; } } - num30 = num1077; + targetIDCopy = i; } } - if (num1074 != -1) + if (targetID != -1) { Projectile.ai[0] = 1f; - Projectile.ai[1] = (float)num1074; + Projectile.ai[1] = (float)targetID; Projectile.netUpdate = true; return; } } if (Projectile.ai[0] > 0f) { - int num1079 = (int)Projectile.ai[1]; - if (!Main.npc[num1079].CanBeChasedBy(Projectile, false)) + int npcTrack = (int)Projectile.ai[1]; + if (!Main.npc[npcTrack].CanBeChasedBy(Projectile, false)) { Projectile.ai[0] = 0f; Projectile.ai[1] = 0f; @@ -152,24 +151,24 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 5f) { - int num1082 = (Projectile.SafeDirectionTo(Main.npc[num1079].Center, Vector2.UnitY).X > 0f) ? 1 : -1; - Projectile.direction = num1082; + int projXDirection = (Projectile.SafeDirectionTo(Main.npc[npcTrack].Center, Vector2.UnitY).X > 0f) ? 1 : -1; + Projectile.direction = projXDirection; Projectile.ai[0] = -20f; Projectile.netUpdate = true; if (Projectile.owner == Main.myPlayer) { - Vector2 vector155 = Main.npc[num1079].position + Main.npc[num1079].Size * Utils.RandomVector2(Main.rand, 0f, 1f) - Projectile.Center; - int num31; - for (int num1083 = 0; num1083 < 3; num1083 = num31 + 1) + Vector2 attackPos = Main.npc[npcTrack].position + Main.npc[npcTrack].Size * Utils.RandomVector2(Main.rand, 0f, 1f) - Projectile.Center; + int attackAmt; + for (int j = 0; j < 3; j = attackAmt + 1) { - Vector2 vector156 = Projectile.Center + vector155; - if (num1083 > 0) + Vector2 finalAttackPos = Projectile.Center + attackPos; + if (j > 0) { - vector156 = Projectile.Center + vector155.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f); + finalAttackPos = Projectile.Center + attackPos.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f); } float x4 = Main.rgbToHsl(new Color(Main.DiscoR, 203, 103)).X; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), vector156, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, (float)Projectile.whoAmI); - num31 = num1083; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), finalAttackPos, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, (float)Projectile.whoAmI); + attackAmt = j; } return; } @@ -184,19 +183,19 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - 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)); - Vector2 vector59 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + 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)); + Vector2 projPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D34 = ModContent.Request(Texture).Value; - Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin11 = rectangle17.Size() / 2f; - float scaleFactor5 = (float)Math.Cos((double)(6.28318548f * (Projectile.localAI[0] / 60f))) + 3f + 3f; - for (float num286 = 0f; num286 < 4f; num286 += 1f) + Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color colorAlpha = Projectile.GetAlpha(colorArea); + Vector2 halfRectangle = rectangular.Size() / 2f; + float scaleFactor = (float)Math.Cos((double)(6.28318548f * (Projectile.localAI[0] / 60f))) + 3f + 3f; + for (float k = 0f; k < 4f; k += 1f) { SpriteBatch spritebatch = Main.spriteBatch; - double arg_F8BE_1 = (double)(num286 * MathHelper.PiOver2); + double arg_F8BE_1 = (double)(k * MathHelper.PiOver2); Vector2 center = default; - Main.EntitySpriteDraw(texture2D34, vector59 + Vector2.UnitY.RotatedBy(arg_F8BE_1, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, Projectile.rotation, origin11, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D34, projPos + Vector2.UnitY.RotatedBy(arg_F8BE_1, center) * scaleFactor, new Microsoft.Xna.Framework.Rectangle?(rectangular), colorAlpha * 0.2f, Projectile.rotation, halfRectangle, Projectile.scale, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index db14aa6d3b..10b0cae3c2 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -28,15 +28,15 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Color newColor2 = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); - int num978 = (int)Projectile.ai[1]; - if (num978 < 0 || num978 >= 1000 || (!Main.projectile[num978].active && Main.projectile[num978].type != ModContent.ProjectileType())) + int activeTimer = (int)Projectile.ai[1]; + if (activeTimer < 0 || activeTimer >= 1000 || (!Main.projectile[activeTimer].active && Main.projectile[activeTimer].type != ModContent.ProjectileType())) { Projectile.ai[1] = -1f; } else { DelegateMethods.v3_1 = newColor2.ToVector3() * 0.5f; - Utils.PlotTileLine(Projectile.Center, Main.projectile[num978].Center, 8f, DelegateMethods.CastLight); + Utils.PlotTileLine(Projectile.Center, Main.projectile[activeTimer].Center, 8f, DelegateMethods.CastLight); } if (Projectile.localAI[0] == 0f) { @@ -56,72 +56,72 @@ namespace CalamityMod.Projectiles.Summon { Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); } - int num3; - for (int num979 = 0; num979 < 2; num979 = num3 + 1) + int dustCount; + for (int i = 0; i < 2; i = dustCount + 1) { if (Main.rand.NextBool(10)) { - Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust24.noGravity = true; - dust24.noLight = true; - dust24.scale = Projectile.Opacity * Projectile.localAI[0]; - dust24.position = Projectile.Center; - dust24.velocity = value55 * 2.5f; + Vector2 silvaDustVel = Vector2.UnitY.RotatedBy((double)((float)i * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust silvaDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + silvaDust.noGravity = true; + silvaDust.noLight = true; + silvaDust.scale = Projectile.Opacity * Projectile.localAI[0]; + silvaDust.position = Projectile.Center; + silvaDust.velocity = silvaDustVel * 2.5f; } - num3 = num979; + dustCount = i; } - for (int num980 = 0; num980 < 2; num980 = num3 + 1) + for (int j = 0; j < 2; j = dustCount + 1) { if (Main.rand.NextBool(10)) { - Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default); - Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust25.noGravity = true; - dust25.noLight = true; - dust25.scale = Projectile.Opacity * Projectile.localAI[0]; - dust25.position = Projectile.Center; - dust25.velocity = value56 * 2.5f; + Vector2 silvaDustVel2 = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default); + Dust silvaDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + silvaDust2.noGravity = true; + silvaDust2.noLight = true; + silvaDust2.scale = Projectile.Opacity * Projectile.localAI[0]; + silvaDust2.position = Projectile.Center; + silvaDust2.velocity = silvaDustVel2 * 2.5f; } - num3 = num980; + dustCount = j; } if (Main.rand.NextBool(10)) { - float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; + float dustVelMod = 1f + Main.rand.NextFloat() * 2f; float fadeIn = 1f + Main.rand.NextFloat(); - float num981 = 1f + Main.rand.NextFloat(); - Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector136 != Vector2.Zero) + float dustScale = 1f + Main.rand.NextFloat(); + Vector2 randVector = Utils.RandomVector2(Main.rand, -1f, 1f); + if (randVector != Vector2.Zero) { - vector136.Normalize(); + randVector.Normalize(); } - vector136 *= 20f + Main.rand.NextFloat() * 100f; - Vector2 vector137 = Projectile.Center + vector136; - Point point3 = vector137.ToTileCoordinates(); - bool flag52 = true; - if (!WorldGen.InWorld(point3.X, point3.Y, 0)) + randVector *= 20f + Main.rand.NextFloat() * 100f; + Vector2 dustPos = Projectile.Center + randVector; + Point dustCoords = dustPos.ToTileCoordinates(); + bool shouldSpawnDust = true; + if (!WorldGen.InWorld(dustCoords.X, dustCoords.Y, 0)) { - flag52 = false; + shouldSpawnDust = false; } - if (flag52 && WorldGen.SolidTile(point3.X, point3.Y)) + if (shouldSpawnDust && WorldGen.SolidTile(dustCoords.X, dustCoords.Y)) { - flag52 = false; + shouldSpawnDust = false; } - if (flag52) + if (shouldSpawnDust) { - Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; - dust26.noGravity = true; - dust26.position = vector137; - dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); - dust26.fadeIn = fadeIn; - dust26.scale = num981; - dust26.noLight = true; - Dust dust27 = Dust.CloneDust(dust26); - Dust dust = dust27; + Dust rainbowDust = Main.dust[Dust.NewDust(dustPos, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + rainbowDust.noGravity = true; + rainbowDust.position = dustPos; + rainbowDust.velocity = -Vector2.UnitY * dustVelMod * (Main.rand.NextFloat() * 0.9f + 1.6f); + rainbowDust.fadeIn = fadeIn; + rainbowDust.scale = dustScale; + rainbowDust.noLight = true; + Dust rainbowDust2 = Dust.CloneDust(rainbowDust); + Dust dust = rainbowDust2; dust.scale *= 0.65f; - dust = dust27; + dust = rainbowDust2; dust.fadeIn *= 0.65f; - dust27.color = new Color(255, 255, 255, 255); + rainbowDust2.color = new Color(255, 255, 255, 255); } } Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; @@ -135,26 +135,26 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - 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)); - Vector2 vector59 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + 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)); + Vector2 projPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D34 = ModContent.Request(Texture).Value; - Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin11 = rectangle17.Size() / 2f; - Color color60 = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.EntitySpriteDraw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, Projectile.rotation, origin11, Projectile.scale * 2f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, 0f, origin11, Projectile.scale * 2f, SpriteEffects.None, 0); + Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color colorAlpha = Projectile.GetAlpha(colorArea); + Vector2 halfRectangle = rectangular.Size() / 2f; + Color projColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Color(255, 255, 255, 0)); + Main.EntitySpriteDraw(texture2D34, projPos, new Microsoft.Xna.Framework.Rectangle?(rectangular), projColor, Projectile.rotation, halfRectangle, Projectile.scale * 2f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D34, projPos, new Microsoft.Xna.Framework.Rectangle?(rectangular), projColor, 0f, halfRectangle, Projectile.scale * 2f, SpriteEffects.None, 0); if (Projectile.ai[1] != -1f && Projectile.Opacity > 0.3f) { - Vector2 vector61 = Main.projectile[(int)Projectile.ai[1]].Center - Projectile.Center; - Vector2 vector62 = new Vector2(1f, vector61.Length() / (float)texture2D34.Height); - float rotation27 = vector61.ToRotation() + 1.57079637f; - float num279 = MathHelper.Distance(15f, Projectile.localAI[1]) / 20f; - num279 = MathHelper.Clamp(num279, 0f, 1f); - if (num279 > 0f) + Vector2 projDirection = Main.projectile[(int)Projectile.ai[1]].Center - Projectile.Center; + Vector2 projDistance = new Vector2(1f, projDirection.Length() / (float)texture2D34.Height); + float drawRotation = projDirection.ToRotation() + 1.57079637f; + float colorClamp = MathHelper.Distance(15f, Projectile.localAI[1]) / 20f; + colorClamp = MathHelper.Clamp(colorClamp, 0f, 1f); + if (colorClamp > 0f) { - Main.EntitySpriteDraw(texture2D34, vector59 + vector61 / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60 * num279, rotation27, origin11, vector62, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D34, vector59 + vector61 / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * num279, rotation27, origin11, vector62 / 2f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D34, projPos + projDirection / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangular), projColor * colorClamp, drawRotation, halfRectangle, projDistance, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D34, projPos + projDirection / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangular), colorAlpha * colorClamp, drawRotation, halfRectangle, projDistance / 2f, SpriteEffects.None, 0); } } return false; @@ -163,51 +163,51 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); - float num69 = (float)Main.rand.Next(7, 13); - Vector2 value5 = new Vector2(2.1f, 2f); + float rando = (float)Main.rand.Next(7, 13); + Vector2 dustVel = new Vector2(2.1f, 2f); Color newColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); newColor.A = 255; - float num72; - for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) + float dustCount; + for (float i = 0f; i < rando; i = dustCount + 1f) { - int num71 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = Projectile.Center; - Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Main.dust[num71].noGravity = true; - Main.dust[num71].scale = 2f; - Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust11 = Dust.CloneDust(num71); - Dust dust = dust11; + int dust = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[dust].position = Projectile.Center; + Main.dust[dust].velocity = spinningpoint.RotatedBy((double)(6.28318548f * i / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 2f; + Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dustCloning = Dust.CloneDust(dust); + Dust dust = dustCloning; dust.scale /= 2f; - dust = dust11; + dust = dustCloning; dust.fadeIn /= 2f; - dust11.color = new Color(255, 255, 255, 255); - num72 = num70; + dustCloning.color = new Color(255, 255, 255, 255); + dustCount = i; } - for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) + for (float j = 0f; j < rando; j = dustCount + 1f) { - int num74 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = Projectile.Center; - Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Dust dust = Main.dust[num74]; + int dust2 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[dust2].position = Projectile.Center; + Main.dust[dust2].velocity = spinningpoint.RotatedBy((double)(6.28318548f * j / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); + Dust dust = Main.dust[dust2]; dust.velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[num74].noGravity = true; - Main.dust[num74].scale = Main.rand.NextFloat() * 1f; - Main.dust[num74].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust12 = Dust.CloneDust(num74); - dust = dust12; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].scale = Main.rand.NextFloat() * 1f; + Main.dust[dust2].fadeIn = Main.rand.NextFloat() * 2f; + Dust dustCloning2 = Dust.CloneDust(dust2); + dust = dustCloning2; dust.scale /= 2f; - dust = dust12; + dust = dustCloning2; dust.fadeIn /= 2f; - dust12.color = new Color(255, 255, 255, 255); - num72 = num73; + dustCloning2.color = new Color(255, 255, 255, 255); + dustCount = j; } if (Main.myPlayer == Projectile.owner) { Projectile.friendly = true; int width = Projectile.width; int height2 = Projectile.height; - int num75 = Projectile.penetrate; + int penetrateClone = Projectile.penetrate; Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 60; Projectile.Center = Projectile.position; @@ -216,7 +216,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - Projectile.penetrate = num75; + Projectile.penetrate = penetrateClone; Projectile.position = Projectile.Center; Projectile.width = width; Projectile.height = height2; diff --git a/Projectiles/Summon/SiriusBeam.cs b/Projectiles/Summon/SiriusBeam.cs index bc70c1c24b..a8e1925172 100644 --- a/Projectiles/Summon/SiriusBeam.cs +++ b/Projectiles/Summon/SiriusBeam.cs @@ -35,11 +35,11 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 4; d++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * (d * 0.25f); + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * (d * 0.25f); Projectile.alpha = 255; - int trailDust = Dust.NewDust(vector33, 1, 1, 20, 0f, 0f, 0, default, 1f); - Main.dust[trailDust].position = vector33; + int trailDust = Dust.NewDust(projPos, 1, 1, 20, 0f, 0f, 0, default, 1f); + Main.dust[trailDust].position = projPos; Main.dust[trailDust].scale = Main.rand.Next(70, 110) * 0.013f; Main.dust[trailDust].velocity *= 0.2f; Main.dust[trailDust].noGravity = true; diff --git a/Projectiles/Summon/SiriusExplosion.cs b/Projectiles/Summon/SiriusExplosion.cs index 9e3781b7e3..368594ac2a 100644 --- a/Projectiles/Summon/SiriusExplosion.cs +++ b/Projectiles/Summon/SiriusExplosion.cs @@ -29,15 +29,15 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Color newColor2 = Main.hslToRgb(0.5f, 1f, Projectile.ai[0]); - int num978 = (int)Projectile.ai[1]; - if (num978 < 0 || num978 >= 1000 || (!Main.projectile[num978].active && Main.projectile[num978].type != ModContent.ProjectileType())) + int activeTimer = (int)Projectile.ai[1]; + if (activeTimer < 0 || activeTimer >= 1000 || (!Main.projectile[activeTimer].active && Main.projectile[activeTimer].type != ModContent.ProjectileType())) { Projectile.ai[1] = -1f; } else { DelegateMethods.v3_1 = newColor2.ToVector3() * 0.5f; - Utils.PlotTileLine(Projectile.Center, Main.projectile[num978].Center, 8f, DelegateMethods.CastLight); + Utils.PlotTileLine(Projectile.Center, Main.projectile[activeTimer].Center, 8f, DelegateMethods.CastLight); } if (Projectile.localAI[0] == 0f) { @@ -57,72 +57,72 @@ namespace CalamityMod.Projectiles.Summon { Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); } - int num3; - for (int num979 = 0; num979 < 2; num979 = num3 + 1) + int dustCount; + for (int i = 0; i < 2; i = dustCount + 1) { if (Main.rand.NextBool(10)) { - Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust24.noGravity = true; - dust24.noLight = true; - dust24.scale = Projectile.Opacity * Projectile.localAI[0]; - dust24.position = Projectile.Center; - dust24.velocity = value55 * 2.5f; + Vector2 siriusDustVel = Vector2.UnitY.RotatedBy((double)((float)i * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust siriusDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + siriusDust.noGravity = true; + siriusDust.noLight = true; + siriusDust.scale = Projectile.Opacity * Projectile.localAI[0]; + siriusDust.position = Projectile.Center; + siriusDust.velocity = siriusDustVel * 2.5f; } - num3 = num979; + dustCount = i; } - for (int num980 = 0; num980 < 2; num980 = num3 + 1) + for (int j = 0; j < 2; j = dustCount + 1) { if (Main.rand.NextBool(10)) { - Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default); - Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust25.noGravity = true; - dust25.noLight = true; - dust25.scale = Projectile.Opacity * Projectile.localAI[0]; - dust25.position = Projectile.Center; - dust25.velocity = value56 * 2.5f; + Vector2 siriusDustVel2 = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default); + Dust siriusDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + siriusDust2.noGravity = true; + siriusDust2.noLight = true; + siriusDust2.scale = Projectile.Opacity * Projectile.localAI[0]; + siriusDust2.position = Projectile.Center; + siriusDust2.velocity = siriusDustVel2 * 2.5f; } - num3 = num980; + dustCount = j; } if (Main.rand.NextBool(10)) { - float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; + float dustVelMod = 1f + Main.rand.NextFloat() * 2f; float fadeIn = 1f + Main.rand.NextFloat(); - float num981 = 1f + Main.rand.NextFloat(); - Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector136 != Vector2.Zero) + float dustScale = 1f + Main.rand.NextFloat(); + Vector2 randVector = Utils.RandomVector2(Main.rand, -1f, 1f); + if (randVector != Vector2.Zero) { - vector136.Normalize(); + randVector.Normalize(); } - vector136 *= 20f + Main.rand.NextFloat() * 100f; - Vector2 vector137 = Projectile.Center + vector136; - Point point3 = vector137.ToTileCoordinates(); - bool flag52 = true; - if (!WorldGen.InWorld(point3.X, point3.Y, 0)) + randVector *= 20f + Main.rand.NextFloat() * 100f; + Vector2 dustPos = Projectile.Center + randVector; + Point dustCoords = dustPos.ToTileCoordinates(); + bool shouldSpawnDust = true; + if (!WorldGen.InWorld(dustCoords.X, dustCoords.Y, 0)) { - flag52 = false; + shouldSpawnDust = false; } - if (flag52 && WorldGen.SolidTile(point3.X, point3.Y)) + if (shouldSpawnDust && WorldGen.SolidTile(dustCoords.X, dustCoords.Y)) { - flag52 = false; + shouldSpawnDust = false; } - if (flag52) + if (shouldSpawnDust) { - Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; - dust26.noGravity = true; - dust26.position = vector137; - dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); - dust26.fadeIn = fadeIn; - dust26.scale = num981; - dust26.noLight = true; - Dust dust27 = Dust.CloneDust(dust26); - Dust dust = dust27; + Dust starDust = Main.dust[Dust.NewDust(dustPos, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + starDust.noGravity = true; + starDust.position = dustPos; + starDust.velocity = -Vector2.UnitY * dustVelMod * (Main.rand.NextFloat() * 0.9f + 1.6f); + starDust.fadeIn = fadeIn; + starDust.scale = dustScale; + starDust.noLight = true; + Dust starDust2 = Dust.CloneDust(starDust); + Dust dust = starDust2; dust.scale *= 0.65f; - dust = dust27; + dust = starDust2; dust.fadeIn *= 0.65f; - dust27.color = new Color(255, 255, 255, 255); + starDust2.color = new Color(255, 255, 255, 255); } } Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; @@ -137,26 +137,26 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - 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)); - Vector2 vector59 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + 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)); + Vector2 projPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D34 = ModContent.Request(Texture).Value; - Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin11 = rectangle17.Size() / 2f; - Color color60 = Main.hslToRgb(0.5f, 1f, Projectile.ai[0]).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.EntitySpriteDraw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, Projectile.rotation, origin11, Projectile.scale * 2f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, 0f, origin11, Projectile.scale * 2f, SpriteEffects.None, 0); + Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color colorAlpha = Projectile.GetAlpha(colorArea); + Vector2 halfRectangle = rectangular.Size() / 2f; + Color projColor = Main.hslToRgb(0.5f, 1f, Projectile.ai[0]).MultiplyRGBA(new Color(255, 255, 255, 0)); + Main.EntitySpriteDraw(texture2D34, projPos, new Microsoft.Xna.Framework.Rectangle?(rectangular), projColor, Projectile.rotation, halfRectangle, Projectile.scale * 2f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D34, projPos, new Microsoft.Xna.Framework.Rectangle?(rectangular), projColor, 0f, halfRectangle, Projectile.scale * 2f, SpriteEffects.None, 0); if (Projectile.ai[1] != -1f && Projectile.Opacity > 0.3f) { - Vector2 vector61 = Main.projectile[(int)Projectile.ai[1]].Center - Projectile.Center; - Vector2 vector62 = new Vector2(1f, vector61.Length() / (float)texture2D34.Height); - float rotation27 = vector61.ToRotation() + 1.57079637f; - float num279 = MathHelper.Distance(30f, Projectile.localAI[1]) / 20f; - num279 = MathHelper.Clamp(num279, 0f, 1f); - if (num279 > 0f) + Vector2 projDirection = Main.projectile[(int)Projectile.ai[1]].Center - Projectile.Center; + Vector2 projDistance = new Vector2(1f, projDirection.Length() / (float)texture2D34.Height); + float drawRotation = projDirection.ToRotation() + 1.57079637f; + float colorClamp = MathHelper.Distance(30f, Projectile.localAI[1]) / 20f; + colorClamp = MathHelper.Clamp(colorClamp, 0f, 1f); + if (colorClamp > 0f) { - Main.EntitySpriteDraw(texture2D34, vector59 + vector61 / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60 * num279, rotation27, origin11, vector62, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D34, vector59 + vector61 / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * num279, rotation27, origin11, vector62 / 2f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D34, projPos + projDirection / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangular), projColor * colorClamp, drawRotation, halfRectangle, projDistance, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D34, projPos + projDirection / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangular), colorAlpha * colorClamp, drawRotation, halfRectangle, projDistance / 2f, SpriteEffects.None, 0); } } return false; @@ -165,51 +165,51 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); - float num69 = (float)Main.rand.Next(7, 13); - Vector2 value5 = new Vector2(2.1f, 2f); + float rando = (float)Main.rand.Next(7, 13); + Vector2 dustVel = new Vector2(2.1f, 2f); Color newColor = Main.hslToRgb(0.5f, 1f, Projectile.ai[0]); newColor.A = 255; - float num72; - for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) + float dustCount; + for (float i = 0f; i < rando; i = dustCount + 1f) { - int num71 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = Projectile.Center; - Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Main.dust[num71].noGravity = true; - Main.dust[num71].scale = 2f; - Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust11 = Dust.CloneDust(num71); + int dusty = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[dusty].position = Projectile.Center; + Main.dust[dusty].velocity = spinningpoint.RotatedBy((double)(6.28318548f * i / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].scale = 2f; + Main.dust[dusty].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust11 = Dust.CloneDust(dusty); Dust dust = dust11; dust.scale /= 2f; dust = dust11; dust.fadeIn /= 2f; dust11.color = new Color(255, 255, 255, 255); - num72 = num70; + dustCount = i; } - for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) + for (float j = 0f; j < rando; j = dustCount + 1f) { - int num74 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = Projectile.Center; - Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Dust dust = Main.dust[num74]; + int dusty2 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[dusty2].position = Projectile.Center; + Main.dust[dusty2].velocity = spinningpoint.RotatedBy((double)(6.28318548f * j / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); + Dust dust = Main.dust[dusty2]; dust.velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[num74].noGravity = true; - Main.dust[num74].scale = Main.rand.NextFloat() * 1f; - Main.dust[num74].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust12 = Dust.CloneDust(num74); + Main.dust[dusty2].noGravity = true; + Main.dust[dusty2].scale = Main.rand.NextFloat() * 1f; + Main.dust[dusty2].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust12 = Dust.CloneDust(dusty2); dust = dust12; dust.scale /= 2f; dust = dust12; dust.fadeIn /= 2f; dust12.color = new Color(255, 255, 255, 255); - num72 = num73; + dustCount = j; } if (Main.myPlayer == Projectile.owner) { Projectile.friendly = true; int width = Projectile.width; int height2 = Projectile.height; - int num75 = Projectile.penetrate; + int penetrateClone = Projectile.penetrate; Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 60; Projectile.Center = Projectile.position; @@ -218,7 +218,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - Projectile.penetrate = num75; + Projectile.penetrate = penetrateClone; Projectile.position = Projectile.Center; Projectile.width = width; Projectile.height = height2; diff --git a/Projectiles/Summon/SolarBeam.cs b/Projectiles/Summon/SolarBeam.cs index 95fb7570c0..96d9be1691 100644 --- a/Projectiles/Summon/SolarBeam.cs +++ b/Projectiles/Summon/SolarBeam.cs @@ -29,15 +29,15 @@ namespace CalamityMod.Projectiles.Summon 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 dustPos = Projectile.position; + dustPos -= 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 dust = Dust.NewDust(dustPos, 1, 1, 246, 0f, 0f, 0, default, 1f); + Main.dust[dust].position = dustPos; + Main.dust[dust].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[dust].velocity *= 0.2f; } } } diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 8f78fa731d..a26695514e 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -59,12 +59,11 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.localAI[0] == 0f) { - int num501 = 30; - for (int num502 = 0; num502 < num501; num502++) + for (int i = 0; i < 30; i++) { - int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 59, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int spawnDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 59, 0f, 0f, 0, default, 1f); + Main.dust[spawnDust].velocity *= 2f; + Main.dust[spawnDust].scale *= 1.15f; } Projectile.localAI[0] += 1f; } @@ -99,9 +98,9 @@ namespace CalamityMod.Projectiles.Summon { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.EntitySpriteDraw(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, 0); + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.EntitySpriteDraw(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, 0); return false; } } diff --git a/Projectiles/Summon/VileFeederProjectile.cs b/Projectiles/Summon/VileFeederProjectile.cs index a7b8074c9c..bc93e881e2 100644 --- a/Projectiles/Summon/VileFeederProjectile.cs +++ b/Projectiles/Summon/VileFeederProjectile.cs @@ -51,23 +51,23 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 0; } - for (int num369 = 0; num369 < 1; num369++) + for (int i = 0; i < 1; i++) { int dustType = 7; - float num370 = Projectile.velocity.X / 3f * (float)num369; - float num371 = Projectile.velocity.Y / 3f * (float)num369; - int num372 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num372]; - dust.position.X = Projectile.Center.X - num370; - dust.position.Y = Projectile.Center.Y - num371; + float smallXVel = Projectile.velocity.X / 3f * (float)i; + float smallYVel = Projectile.velocity.Y / 3f * (float)i; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[dusty]; + dust.position.X = Projectile.Center.X - smallXVel; + dust.position.Y = Projectile.Center.Y - smallYVel; dust.velocity *= 0f; dust.scale = 0.5f; } Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; - 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 attackDistance = 100000f; + bool canAttack = false; Projectile.ai[0] += 1f; if (Projectile.ai[0] > 30f) { @@ -76,83 +76,83 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num377 = npc.position.X + (float)(npc.width / 2); - float num378 = npc.position.Y + (float)(npc.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 < 640f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + float npcX = npc.position.X + (float)(npc.width / 2); + float npcY = npc.position.Y + (float)(npc.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 < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; + attackDistance = npcDist; + projX = npcX; + projY = npcY; + canAttack = true; } } } - if (!flag10) + if (!canAttack) { - for (int num376 = 0; num376 < Main.maxNPCs; num376++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC npc = Main.npc[num376]; + NPC npc = Main.npc[j]; if (npc.CanBeChasedBy(Projectile, false)) { - float num377 = npc.position.X + (float)(npc.width / 2); - float num378 = npc.position.Y + (float)(npc.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 < 640f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + float npcX = npc.position.X + (float)(npc.width / 2); + float npcY = npc.position.Y + (float)(npc.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 < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; + attackDistance = npcDist; + projX = npcX; + projY = npcY; + canAttack = true; } } } } } - if (!flag10) + if (!canAttack) { - 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 = 10f; - float num381 = 0.16f; - 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 projSpeed = 10f; + float XSpeedMod = 0.16f; + Vector2 fireDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float fireXVel = projX - fireDirection.X; + float fireYVel = projY - fireDirection.Y; + float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); + fireVelocity = projSpeed / fireVelocity; + fireXVel *= fireVelocity; + fireYVel *= fireVelocity; + if (Projectile.velocity.X < fireXVel) { - Projectile.velocity.X = Projectile.velocity.X + num381; - if (Projectile.velocity.X < 0f && num382 > 0f) + Projectile.velocity.X = Projectile.velocity.X + XSpeedMod; + if (Projectile.velocity.X < 0f && fireXVel > 0f) { - Projectile.velocity.X = Projectile.velocity.X + num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X + XSpeedMod * 2f; } } - else if (Projectile.velocity.X > num382) + else if (Projectile.velocity.X > fireXVel) { - Projectile.velocity.X = Projectile.velocity.X - num381; - if (Projectile.velocity.X > 0f && num382 < 0f) + Projectile.velocity.X = Projectile.velocity.X - XSpeedMod; + if (Projectile.velocity.X > 0f && fireXVel < 0f) { - Projectile.velocity.X = Projectile.velocity.X - num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X - XSpeedMod * 2f; } } - if (Projectile.velocity.Y < num383) + if (Projectile.velocity.Y < fireYVel) { - Projectile.velocity.Y = Projectile.velocity.Y + num381; - if (Projectile.velocity.Y < 0f && num383 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + XSpeedMod; + if (Projectile.velocity.Y < 0f && fireYVel > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + XSpeedMod * 2f; } } - else if (Projectile.velocity.Y > num383) + else if (Projectile.velocity.Y > fireYVel) { - Projectile.velocity.Y = Projectile.velocity.Y - num381; - if (Projectile.velocity.Y > 0f && num383 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - XSpeedMod; + if (Projectile.velocity.Y > 0f && fireYVel < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - XSpeedMod * 2f; } } } diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index 9b61c2efdb..d2bf443515 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -63,9 +63,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 dustVel = source - Projectile.Center; - int num228 = Dust.NewDust(source + dustVel, 0, 0, 7, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = dustVel; + int dusty = Dust.NewDust(source + dustVel, 0, 0, 7, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity = dustVel; } spawnDust = false; } @@ -233,15 +233,15 @@ namespace CalamityMod.Projectiles.Summon } if (projCount >= array2.Length) { - int num30 = 0; + int projCount = 0; for (int m = 1; m < array2.Length; m++) { - if (array2[m].Y < array2[num30].Y) + if (array2[m].Y < array2[projCount].Y) { - num30 = m; + projCount = m; } } - Main.projectile[array2[num30].X].Kill(); + Main.projectile[array2[projCount].X].Kill(); } } } @@ -262,9 +262,9 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Summon/VoidConcentrationBlackhole.cs b/Projectiles/Summon/VoidConcentrationBlackhole.cs index 5f1c294cb9..058c45b90f 100644 --- a/Projectiles/Summon/VoidConcentrationBlackhole.cs +++ b/Projectiles/Summon/VoidConcentrationBlackhole.cs @@ -54,20 +54,20 @@ namespace CalamityMod.Projectiles.Summon Vector2 velocity = Projectile.Center - npc.Center; velocity *= 2f; velocity.SafeNormalize(Vector2.Zero); - float num550 = 5f * Projectile.scale; - Vector2 vector43 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num551 = Projectile.Center.X - vector43.X; - float num552 = Projectile.Center.Y - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) + float projSpeed = 5f * Projectile.scale; + Vector2 fireDirection = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float fireXVel = Projectile.Center.X - fireDirection.X; + float fireYVel = Projectile.Center.Y - fireDirection.Y; + float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); + if (fireVelocity < 100f) { - num550 = 28f; //14 + projSpeed = 28f; //14 } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - npc.velocity.X = (velocity.X * 15f + num551) / 16f; - npc.velocity.Y = (velocity.Y * 15f + num552) / 16f; + fireVelocity = projSpeed / fireVelocity; + fireXVel *= fireVelocity; + fireYVel *= fireVelocity; + npc.velocity.X = (velocity.X * 15f + fireXVel) / 16f; + npc.velocity.Y = (velocity.Y * 15f + fireYVel) / 16f; npc.velocity = (velocity / succStrength); } diff --git a/Projectiles/Summon/VoidConcentrationOrb.cs b/Projectiles/Summon/VoidConcentrationOrb.cs index c7491c846d..6d0e1a5a03 100644 --- a/Projectiles/Summon/VoidConcentrationOrb.cs +++ b/Projectiles/Summon/VoidConcentrationOrb.cs @@ -69,20 +69,20 @@ namespace CalamityMod.Projectiles.Summon { if (target != null) { - float num550 = 40f; - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num551 = target.Center.X - vector43.X; - float num552 = target.Center.Y - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) + float projSpeed = 40f; + Vector2 fireDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float fireXVel = target.Center.X - fireDirection.X; + float fireYVel = target.Center.Y - fireDirection.Y; + float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); + if (fireVelocity < 100f) { - num550 = 28f; //14 + projSpeed = 28f; //14 } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - Projectile.velocity.X = (Projectile.velocity.X * 25f + num551) / 26f; - Projectile.velocity.Y = (Projectile.velocity.Y * 25f + num552) / 26f; + fireVelocity = projSpeed / fireVelocity; + fireXVel *= fireVelocity; + fireYVel *= fireVelocity; + Projectile.velocity.X = (Projectile.velocity.X * 25f + fireXVel) / 26f; + Projectile.velocity.Y = (Projectile.velocity.Y * 25f + fireYVel) / 26f; if (Main.rand.NextBool(5)) Projectile.velocity *= 1.1f; } diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index fca691fcc0..1e3faffa33 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.sirenWaifu && !modPlayer.allWaifus && !modPlayer.sirenWaifuVanity && !modPlayer.allWaifusVanity) @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; return; } - if (flag64) + if (isMinion) { if (player.dead) { @@ -58,12 +58,11 @@ namespace CalamityMod.Projectiles.Summon } if (dust > 0) { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + for (int i = 0; i < 50; i++) { - int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int spawnDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + Main.dust[spawnDust].velocity *= 2f; + Main.dust[spawnDust].scale *= 1.15f; } dust--; } @@ -104,52 +103,52 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] -= 1f; return; } - bool flag18 = false; - float num506 = Projectile.Center.X; - float num507 = Projectile.Center.Y; - float num508 = 1000f; + bool canAttack = false; + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + float attackRange = 1000f; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + float npcX = npc.position.X + (float)(npc.width / 2); + float npcY = npc.position.Y + (float)(npc.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 < attackRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - num506 = num539; - num507 = num540; - flag18 = true; + projX = npcX; + projY = npcY; + canAttack = true; } } } - if (!flag18) + if (!canAttack) { - for (int num512 = 0; num512 < Main.maxNPCs; num512++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num512].CanBeChasedBy(Projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num513) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + float targetX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float targetY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float targetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - targetX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - targetY); + if (targetDist < attackRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; + attackRange = targetDist; + projX = targetX; + projY = targetY; + canAttack = true; } } } } - if (flag18 && Projectile.localAI[0] >= 120f) + if (canAttack && Projectile.localAI[0] >= 120f) { - float num516 = num506; - float num517 = num507; - num506 -= Projectile.Center.X; - num507 -= Projectile.Center.Y; - if (num506 < 0f) + float projXStore = projX; + float projYStore = projY; + projX -= Projectile.Center.X; + projY -= Projectile.Center.Y; + if (projX < 0f) { Projectile.spriteDirection = 1; } @@ -166,15 +165,15 @@ namespace CalamityMod.Projectiles.Summon { projectileType = ModContent.ProjectileType(); } - float num403 = Main.rand.Next(12, 20); - Vector2 vector29 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - 4f, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + float projVel = Main.rand.Next(12, 20); + Vector2 fireDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float fireXVel = projXStore - fireDirection.X; + float fireYVel = projYStore - fireDirection.Y; + float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); + fireVelocity = projVel / fireVelocity; + fireXVel *= fireVelocity; + fireYVel *= fireVelocity; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X - 4f, Projectile.Center.Y, fireXVel, fireYVel, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Projectile.ai[0] = 12f; } } diff --git a/Projectiles/Summon/WaterSpearFriendly.cs b/Projectiles/Summon/WaterSpearFriendly.cs index f28667cf99..36e0cda993 100644 --- a/Projectiles/Summon/WaterSpearFriendly.cs +++ b/Projectiles/Summon/WaterSpearFriendly.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y *= 1.01f; if (Projectile.ai[1] == 0f) { - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } Projectile.ai[1] = 1f; From c166b401d2212adb4ace98f6bc5fd3a0dbc48ef0 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 19 Oct 2023 17:17:48 -0400 Subject: [PATCH 04/43] Typeless --- Projectiles/Typeless/AstralStar.cs | 8 +- Projectiles/Typeless/BlazingStarHeal.cs | 67 +++---- Projectiles/Typeless/BloodBomb.cs | 10 +- Projectiles/Typeless/BloodBombExplosion.cs | 52 ++--- .../BrimstoneHellfireballFriendly2.cs | 10 +- Projectiles/Typeless/ChaoticGeyser.cs | 8 +- Projectiles/Typeless/CursorProj.cs | 119 ++++++----- Projectiles/Typeless/CursorProjSplit.cs | 161 +++++++-------- Projectiles/Typeless/DeepseaBlaze.cs | 52 ++--- Projectiles/Typeless/DemonshadeRedDevil.cs | 129 ++++++------ Projectiles/Typeless/DragonDust.cs | 52 ++--- Projectiles/Typeless/EmpyreanBlast.cs | 52 ++--- Projectiles/Typeless/EmpyreanEmber.cs | 8 +- Projectiles/Typeless/EmpyreanGlob.cs | 6 +- Projectiles/Typeless/EmpyreanMarble.cs | 6 +- .../Typeless/EmpyreanStellarDetritus.cs | 6 +- Projectiles/Typeless/FuckYou.cs | 8 +- Projectiles/Typeless/GhostlyBolt.cs | 22 +- Projectiles/Typeless/GodKiller.cs | 48 ++--- Projectiles/Typeless/GodSlayerBlaze.cs | 38 ++-- Projectiles/Typeless/GodSlayerShrapnel.cs | 8 +- Projectiles/Typeless/GoldenGunProj.cs | 40 ++-- .../Typeless/HellfireExplosionFriendly2.cs | 38 ++-- Projectiles/Typeless/HolyExplosion.cs | 22 +- Projectiles/Typeless/HolyExplosionSupreme.cs | 56 +++--- Projectiles/Typeless/HydrothermalSmoke.cs | 6 +- Projectiles/Typeless/KelvinCatalystStar.cs | 14 +- Projectiles/Typeless/LunicBeam.cs | 189 +++++++++--------- Projectiles/Typeless/Nanotech.cs | 30 +-- Projectiles/Typeless/PendantProjectile1.cs | 10 +- Projectiles/Typeless/PendantProjectile2.cs | 10 +- Projectiles/Typeless/PendantProjectile3.cs | 10 +- Projectiles/Typeless/PoisonousSeawater.cs | 8 +- Projectiles/Typeless/SkyFlareFriendly.cs | 22 +- Projectiles/Typeless/StandingFire.cs | 18 +- Projectiles/Typeless/StickyFeatherAero.cs | 22 +- .../Typeless/SulphuricAcidBubbleFriendly.cs | 24 +-- Projectiles/Typeless/TarraEnergy.cs | 20 +- 38 files changed, 688 insertions(+), 721 deletions(-) diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index 0ceb8f68c0..0e415f6579 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -63,10 +63,10 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + Vector2 rotational = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int astralDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); + Main.dust[astralDust].velocity = rotational * 0.66f; + Main.dust[astralDust].position = Projectile.Center + rotational * 12f; } if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index 7a0eca626c..4d213b444a 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -58,34 +58,33 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D value = ModContent.Request(Texture).Value; - Color color33 = new Color(54, 209, 54, 0); - Vector2 vector28 = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color color34 = color33; - Vector2 origin5 = value.Size() / 2f; - Color color35 = color33 * 0.5f; - float num162 = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; - Vector2 vector29 = new Vector2(0.5f, 1f) * num162; - Vector2 vector30 = new Vector2(0.5f, 1f) * num162; - color34 *= num162; - color35 *= num162; + Texture2D starTexture = ModContent.Request(Texture).Value; + Color healGreen = new Color(54, 209, 54, 0); + Vector2 projPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color healGreenDraw = healGreen; + Vector2 colorSize = starTexture.Size() / 2f; + Color lesserHealGreen = healGreen * 0.5f; + float colorLerp = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; + Vector2 scaledColorLerp1 = new Vector2(0.5f, 1f) * colorLerp; + Vector2 scaledColorLerp2 = new Vector2(0.5f, 1f) * colorLerp; + healGreenDraw *= colorLerp; + lesserHealGreen *= colorLerp; - int num163 = 0; - Vector2 position3 = vector28 + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * num163; + Vector2 drawPos = projPos + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(value, position3, null, color34, (float)Math.PI / 2f, origin5, vector29, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color34, 0f, origin5, vector30, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color35, (float)Math.PI / 2f, origin5, vector29 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color35, 0f, origin5, vector30 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(value, drawPos, null, healGreenDraw, (float)Math.PI / 2f, colorSize, scaledColorLerp1, spriteEffects, 0); + Main.EntitySpriteDraw(value, drawPos, null, healGreenDraw, 0f, colorSize, scaledColorLerp2, spriteEffects, 0); + Main.EntitySpriteDraw(value, drawPos, null, lesserHealGreen, (float)Math.PI / 2f, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(value, drawPos, null, lesserHealGreen, 0f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color34, MathHelper.PiOver4, origin5, vector29 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color34, MathHelper.PiOver4 * 3f, origin5, vector30 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color35, MathHelper.PiOver4, origin5, vector29 * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color35, MathHelper.PiOver4 * 3f, origin5, vector30 * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(value, drawPos, null, healGreenDraw, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(value, drawPos, null, healGreenDraw, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(value, drawPos, null, lesserHealGreen, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(value, drawPos, null, lesserHealGreen, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.36f, spriteEffects, 0); return false; } @@ -99,25 +98,25 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 40; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; 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; - Main.dust[num622].noGravity = true; + int duster = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[duster].velocity *= 3f; + Main.dust[duster].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[duster].scale = 0.5f; + Main.dust[duster].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 8; num623++) + for (int j = 0; j < 8; 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; - Main.dust[num624].noGravity = true; + int duster2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); + Main.dust[duster2].noGravity = true; + Main.dust[duster2].velocity *= 5f; + duster2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[duster2].velocity *= 2f; + Main.dust[duster2].noGravity = true; } } diff --git a/Projectiles/Typeless/BloodBomb.cs b/Projectiles/Typeless/BloodBomb.cs index add83a54e7..67d697676d 100644 --- a/Projectiles/Typeless/BloodBomb.cs +++ b/Projectiles/Typeless/BloodBomb.cs @@ -29,12 +29,12 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item73, Projectile.position); Projectile.localAI[0] += 1f; } - for (int num457 = 0; num457 < 3; num457++) + for (int j = 0; j < 3; j++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 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 bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.2f); + Main.dust[bloody].noGravity = true; + Main.dust[bloody].velocity *= 0.5f; + Main.dust[bloody].velocity += Projectile.velocity * 0.1f; } } diff --git a/Projectiles/Typeless/BloodBombExplosion.cs b/Projectiles/Typeless/BloodBombExplosion.cs index 1c8f35d578..b2183ade06 100644 --- a/Projectiles/Typeless/BloodBombExplosion.cs +++ b/Projectiles/Typeless/BloodBombExplosion.cs @@ -33,60 +33,60 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item74, Projectile.position); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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, 5, 0f, 0f, 100, default, 1.8f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-30, 31); + float rand2 = (float)Main.rand.Next(-30, 31); + float rand3 = (float)Main.rand.Next(9, 27); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.8f); + Dust dust = Main.dust[bloody]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } return; } diff --git a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs b/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs index da8651cfae..11f8c94957 100644 --- a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs +++ b/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs @@ -34,12 +34,12 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.localAI[0] += 1f; } - for (int num457 = 0; num457 < 5; num457++) + for (int i = 0; i < 5; i++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.6f); + Main.dust[brimDust].noGravity = true; + Main.dust[brimDust].velocity *= 0.5f; + Main.dust[brimDust].velocity += Projectile.velocity * 0.1f; } return; } diff --git a/Projectiles/Typeless/ChaoticGeyser.cs b/Projectiles/Typeless/ChaoticGeyser.cs index dad02e60d5..066954385f 100644 --- a/Projectiles/Typeless/ChaoticGeyser.cs +++ b/Projectiles/Typeless/ChaoticGeyser.cs @@ -66,8 +66,8 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num199]; + int flareDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[flareDust]; dust.position.X -= 2f; dust.position.Y += 2f; dust.scale += (float)Main.rand.Next(50) * 0.01f; @@ -75,8 +75,8 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 16f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); - Dust dust2 = Main.dust[num200]; + int flareDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); + Dust dust2 = Main.dust[flareDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index 601e6e6e7a..059f41d89a 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -37,13 +37,9 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.timeLeft > 285) return; - float num29 = 5f; - float num30 = 300f; + float aiTrack = 5f; float scaleFactor = 6f; - Vector2 value7 = new Vector2(10f, 20f); - //float num31 = 1f; - int num32 = 3 * Projectile.MaxUpdates; - int num33 = Utils.SelectRandom(Main.rand, new int[] + int dustType = Utils.SelectRandom(Main.rand, new int[] { 246, 242, @@ -51,7 +47,7 @@ namespace CalamityMod.Projectiles.Typeless 226, 247 }); - int num34 = 255; + int crystalDustType = 255; if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; @@ -59,38 +55,38 @@ namespace CalamityMod.Projectiles.Typeless } else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) { - int num35 = -1; - float num36 = num30; - for (int num37 = 0; num37 < Main.maxNPCs; num37++) + int targetID = -1; + float hitDistance = 300f; + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) + if (Main.npc[i].active && Main.npc[i].CanBeChasedBy(Projectile, false)) { - Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, Projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) + Vector2 targetCenter = Main.npc[i].Center; + float targetDist = Vector2.Distance(targetCenter, Projectile.Center); + if (targetDist < hitDistance && targetID == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, targetCenter, 1, 1)) { - num36 = num38; - num35 = num37; + hitDistance = targetDist; + targetID = i; } } } - if (num36 < 4f) + if (hitDistance < 4f) { Projectile.Kill(); return; } - if (num35 != -1) + if (targetID != -1) { - Projectile.ai[1] = num29 + 1f; - Projectile.ai[0] = (float)num35; + Projectile.ai[1] = aiTrack + 1f; + Projectile.ai[0] = (float)targetID; Projectile.netUpdate = true; } } - else if (Projectile.ai[1] > num29) + else if (Projectile.ai[1] > aiTrack) { Projectile.ai[1] += 1f; - int num39 = (int)Projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) + int npcTrack = (int)Projectile.ai[0]; + if (!Main.npc[npcTrack].active || !Main.npc[npcTrack].CanBeChasedBy(Projectile, false)) { Projectile.ai[1] = 1f; Projectile.ai[0] = 0f; @@ -99,25 +95,24 @@ namespace CalamityMod.Projectiles.Typeless else { Projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; - if (vector6.Length() < 10f) + Vector2 npcDirection = Main.npc[npcTrack].Center - Projectile.Center; + if (npcDirection.Length() < 10f) { Projectile.Kill(); return; } - if (vector6 != Vector2.Zero) + if (npcDirection != Vector2.Zero) { - vector6.Normalize(); - vector6 *= scaleFactor; + npcDirection.Normalize(); + npcDirection *= scaleFactor; } - float num40 = 30f; - Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; + Projectile.velocity = (Projectile.velocity * 29f + npcDirection) / 30f; } } - if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < aiTrack) { Projectile.ai[1] += 1f; - if (Projectile.ai[1] == num29) + if (Projectile.ai[1] == aiTrack) { Projectile.ai[1] = 1f; } @@ -129,57 +124,55 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(12)) { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 160, default, 1f); - Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = Projectile.Center + value9 * (float)Projectile.width / 2f + Projectile.velocity * 2f; - Main.dust[num44].fadeIn = 0.9f; + Vector2 rotateFirstDust = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int crystalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 160, default, 1f); + Main.dust[crystalDust].velocity *= 0.1f; + Main.dust[crystalDust].position = Projectile.Center + rotateFirstDust * (float)Projectile.width / 2f + Projectile.velocity * 2f; + Main.dust[crystalDust].fadeIn = 0.9f; } if (Main.rand.NextBool(18)) { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 155, default, 0.8f); - Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = Projectile.Center + value10 * (float)Projectile.width / 2f; + Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 155, default, 0.8f); + Main.dust[greenDust].velocity *= 0.3f; + Main.dust[greenDust].position = Projectile.Center + rotateSecondDust * (float)Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[num46].fadeIn = 1.4f; + Main.dust[greenDust].fadeIn = 1.4f; } } if (Main.rand.NextBool(8)) { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num33, 0f, 0f, 0, default, 1f); - Main.dust[num48].velocity *= 0.3f; - Main.dust[num48].noGravity = true; - Main.dust[num48].position = Projectile.Center + value11 * (float)Projectile.width / 2f; + Vector2 rotateThirdDust = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int randomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Main.dust[randomDust].velocity *= 0.3f; + Main.dust[randomDust].noGravity = true; + Main.dust[randomDust].position = Projectile.Center + rotateThirdDust * (float)Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[num48].fadeIn = 1.4f; + Main.dust[randomDust].fadeIn = 1.4f; } } if (Main.rand.NextBool(6)) { Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); - Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = Projectile.Center + value13 * (float)Projectile.width / 2f; - Main.dust[num50].fadeIn = 1.2f; - Main.dust[num50].scale = 1.5f; - Main.dust[num50].noGravity = true; + int crystalDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 100, default, 1f); + Main.dust[crystalDust2].velocity *= 0.3f; + Main.dust[crystalDust2].position = Projectile.Center + value13 * (float)Projectile.width / 2f; + Main.dust[crystalDust2].fadeIn = 1.2f; + Main.dust[crystalDust2].scale = 1.5f; + Main.dust[crystalDust2].noGravity = true; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 234, 0f, 0f, 100, default, 0.8f); - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; - Main.dust[num155].noGravity = true; + int paleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 28, Projectile.height - 28, 234, 0f, 0f, 100, default, 0.8f); + Main.dust[paleDust].velocity *= 0.1f; + Main.dust[paleDust].velocity += Projectile.velocity * 0.5f; + Main.dust[paleDust].noGravity = true; if (Main.rand.NextBool(12)) { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 159, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; + int shinyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 32, Projectile.height - 32, 159, 0f, 0f, 100, default, 1f); + Main.dust[shinyDust].velocity *= 0.25f; + Main.dust[shinyDust].velocity += Projectile.velocity * 0.5f; } } diff --git a/Projectiles/Typeless/CursorProjSplit.cs b/Projectiles/Typeless/CursorProjSplit.cs index 585026fb34..f107778b0b 100644 --- a/Projectiles/Typeless/CursorProjSplit.cs +++ b/Projectiles/Typeless/CursorProjSplit.cs @@ -36,13 +36,9 @@ namespace CalamityMod.Projectiles.Typeless Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - float num29 = 5f; - float num30 = 300f; + float aiTrack = 5f; float scaleFactor = 6f; - Vector2 value7 = new Vector2(10f, 20f); - //float num31 = 1f; - int num32 = 3 * Projectile.MaxUpdates; - int num33 = Utils.SelectRandom(Main.rand, new int[] + int dustType = Utils.SelectRandom(Main.rand, new int[] { 246, 242, @@ -50,7 +46,7 @@ namespace CalamityMod.Projectiles.Typeless 226, 247 }); - int num34 = 255; + int crystalDustType = 255; if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; @@ -60,39 +56,39 @@ namespace CalamityMod.Projectiles.Typeless { if (Projectile.alpha < 128) { - int num35 = -1; - float num36 = num30; - for (int num37 = 0; num37 < Main.maxNPCs; num37++) + int targetID = -1; + float hitDistance = 300f; + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) + if (Main.npc[i].active && Main.npc[i].CanBeChasedBy(Projectile, false)) { - Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, Projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) + Vector2 targetCenter = Main.npc[i].Center; + float targetDist = Vector2.Distance(targetCenter, Projectile.Center); + if (targetDist < hitDistance && targetID == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, targetCenter, 1, 1)) { - num36 = num38; - num35 = num37; + hitDistance = targetDist; + targetID = i; } } } - if (num36 < 4f) + if (hitDistance < 4f) { Projectile.Kill(); return; } - if (num35 != -1) + if (targetID != -1) { - Projectile.ai[1] = num29 + 1f; - Projectile.ai[0] = (float)num35; + Projectile.ai[1] = aiTrack + 1f; + Projectile.ai[0] = (float)targetID; Projectile.netUpdate = true; } } } - else if (Projectile.ai[1] > num29) + else if (Projectile.ai[1] > aiTrack) { Projectile.ai[1] += 1f; - int num39 = (int)Projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) + int npcTrack = (int)Projectile.ai[0]; + if (!Main.npc[npcTrack].active || !Main.npc[npcTrack].CanBeChasedBy(Projectile, false)) { Projectile.ai[1] = 1f; Projectile.ai[0] = 0f; @@ -101,25 +97,24 @@ namespace CalamityMod.Projectiles.Typeless else { Projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; - if (vector6.Length() < 10f) + Vector2 npcDirection = Main.npc[npcTrack].Center - Projectile.Center; + if (npcDirection.Length() < 10f) { Projectile.Kill(); return; } - if (vector6 != Vector2.Zero) + if (npcDirection != Vector2.Zero) { - vector6.Normalize(); - vector6 *= scaleFactor; + npcDirection.Normalize(); + npcDirection *= scaleFactor; } - float num40 = 30f; - Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; + Projectile.velocity = (Projectile.velocity * 29f + npcDirection) / 30f; } } - if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < aiTrack) { Projectile.ai[1] += 1f; - if (Projectile.ai[1] == num29) + if (Projectile.ai[1] == aiTrack) { Projectile.ai[1] = 1f; } @@ -131,57 +126,55 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(12)) { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); - Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = Projectile.Center + value9 * (float)Projectile.width / 2f + Projectile.velocity * 2f; - Main.dust[num44].fadeIn = 0.9f; + Vector2 rotateFirstDust = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int crystalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 100, default, 1f); + Main.dust[crystalDust].velocity *= 0.1f; + Main.dust[crystalDust].position = Projectile.Center + rotateFirstDust * (float)Projectile.width / 2f + Projectile.velocity * 2f; + Main.dust[crystalDust].fadeIn = 0.9f; } if (Main.rand.NextBool(18)) { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 155, default, 0.8f); - Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = Projectile.Center + value10 * (float)Projectile.width / 2f; + Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 155, default, 0.8f); + Main.dust[greenDust].velocity *= 0.3f; + Main.dust[greenDust].position = Projectile.Center + rotateSecondDust * (float)Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[num46].fadeIn = 1.4f; + Main.dust[greenDust].fadeIn = 1.4f; } } if (Main.rand.NextBool(8)) { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num33, 0f, 0f, 0, default, 1f); - Main.dust[num48].velocity *= 0.3f; - Main.dust[num48].noGravity = true; - Main.dust[num48].position = Projectile.Center + value11 * (float)Projectile.width / 2f; + Vector2 rotateThirdDust = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int randomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Main.dust[randomDust].velocity *= 0.3f; + Main.dust[randomDust].noGravity = true; + Main.dust[randomDust].position = Projectile.Center + rotateThirdDust * (float)Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[num48].fadeIn = 1.4f; + Main.dust[randomDust].fadeIn = 1.4f; } } if (Main.rand.NextBool(6)) { Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); - Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = Projectile.Center + value13 * (float)Projectile.width / 2f; - Main.dust[num50].fadeIn = 1.2f; - Main.dust[num50].scale = 1.5f; - Main.dust[num50].noGravity = true; + int crystalDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 100, default, 1f); + Main.dust[crystalDust2].velocity *= 0.3f; + Main.dust[crystalDust2].position = Projectile.Center + value13 * (float)Projectile.width / 2f; + Main.dust[crystalDust2].fadeIn = 1.2f; + Main.dust[crystalDust2].scale = 1.5f; + Main.dust[crystalDust2].noGravity = true; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 234, 0f, 0f, 100, default, 0.8f); - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; - Main.dust[num155].noGravity = true; + int paleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 28, Projectile.height - 28, 234, 0f, 0f, 100, default, 0.8f); + Main.dust[paleDust].velocity *= 0.1f; + Main.dust[paleDust].velocity += Projectile.velocity * 0.5f; + Main.dust[paleDust].noGravity = true; if (Main.rand.NextBool(12)) { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 159, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; + int shinyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 32, Projectile.height - 32, 159, 0f, 0f, 100, default, 1f); + Main.dust[shinyDust].velocity *= 0.25f; + Main.dust[shinyDust].velocity += Projectile.velocity * 0.5f; } } @@ -208,7 +201,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - int num47 = Utils.SelectRandom(Main.rand, new int[] + int otherDustType = Utils.SelectRandom(Main.rand, new int[] { 246, 242, @@ -217,49 +210,45 @@ namespace CalamityMod.Projectiles.Typeless 247 }); - int num48 = 187; - int num49 = 234; - //int height = 50; - float num50 = 1.2f; - float num51 = 0.6f; - float num52 = 1.5f; + int randomDust = 187; + float crystalDust2 = 1.2f; - Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + Vector2 dustRotate = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 dustVel = dustRotate * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int num3; - for (int num53 = 0; num53 < 20; num53 = num3 + 1) + int dustCount; + for (int j = 0; j < 20; j = dustCount + 1) { - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num47, 0f, 0f, 200, default, num50); - Dust dust = Main.dust[num54]; + int superRandomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, otherDustType, 0f, 0f, 200, default, crystalDust2); + Dust dust = Main.dust[superRandomDust]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity.Y -= 6f; dust.velocity *= 3f; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num48, 0f, 0f, 100, default, num51); + dust.velocity += dustVel * Main.rand.NextFloat(); + superRandomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.6f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity.Y -= 6f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; dust.color = Color.Cyan * 0.5f; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; + dust.velocity += dustVel * Main.rand.NextFloat(); + dustCount = j; } - for (int num55 = 0; num55 < 10; num55 = num3 + 1) + for (int k = 0; k < 10; k = dustCount + 1) { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num49, 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; - Dust dust = Main.dust[num56]; + int palestDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 234, 0f, 0f, 0, default, 1.5f); + Main.dust[palestDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; + Dust dust = Main.dust[palestDust]; dust.noGravity = true; dust.velocity.Y -= 6f; dust.velocity *= 0.5f; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; + dust.velocity += dustVel * (0.6f + 0.6f * Main.rand.NextFloat()); + dustCount = k; } } } diff --git a/Projectiles/Typeless/DeepseaBlaze.cs b/Projectiles/Typeless/DeepseaBlaze.cs index 3bd3a1438d..afffc48e1a 100644 --- a/Projectiles/Typeless/DeepseaBlaze.cs +++ b/Projectiles/Typeless/DeepseaBlaze.cs @@ -31,60 +31,60 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.Kill(); } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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, 127, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-30, 31); + float rand2 = (float)Main.rand.Next(-30, 31); + float rand3 = (float)Main.rand.Next(9, 27); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[fiery]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Typeless/DemonshadeRedDevil.cs b/Projectiles/Typeless/DemonshadeRedDevil.cs index 855548c857..8d2b584ef3 100644 --- a/Projectiles/Typeless/DemonshadeRedDevil.cs +++ b/Projectiles/Typeless/DemonshadeRedDevil.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - bool flag64 = Projectile.type == ModContent.ProjectileType(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.redDevil) @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.active = false; return; } - if (flag64) + if (isMinion) { if (player.dead) { @@ -58,12 +58,11 @@ namespace CalamityMod.Projectiles.Typeless dust--; if (dust >= 0) { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + for (int i = 0; i < 50; i++) { - int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + Main.dust[brimDust].velocity *= 2f; + Main.dust[brimDust].scale *= 1.15f; } } Projectile.frameCounter++; @@ -76,19 +75,16 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.frame = 0; } - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(Projectile.Center, 1f * num, 0f * num, 0.15f * num); + float lights = (float)Main.rand.Next(90, 111) * 0.01f; + lights *= Main.essScale; + Lighting.AddLight(Projectile.Center, 1f * lights, 0f * lights, 0.15f * lights); Projectile.rotation = Projectile.velocity.X * 0.04f; if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { Projectile.spriteDirection = -Projectile.direction; } - float num633 = 2000f; - float num634 = 2000f; - float num635 = 3000f; - float num636 = 150f; - bool flag24 = false; + float attackRange = 2000f; + bool decelerate = false; if (Projectile.ai[0] == 2f) { Projectile.ai[1] += 1f; @@ -103,15 +99,15 @@ namespace CalamityMod.Projectiles.Typeless } else { - flag24 = true; + decelerate = true; } } - if (flag24) + if (decelerate) { return; } - Vector2 vector46 = Projectile.position; - bool flag25 = false; + Vector2 projPos = Projectile.position; + bool canAttack = false; if (Projectile.ai[0] != 1f) { Projectile.tileCollide = false; @@ -125,96 +121,95 @@ namespace CalamityMod.Projectiles.Typeless NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (!flag25 && num646 < num633) + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!canAttack && npcDist < attackRange) { - num633 = num646; - vector46 = npc.Center; - flag25 = true; + attackRange = npcDist; + projPos = npc.Center; + canAttack = true; } } } else { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[j]; if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float npcDist = Vector2.Distance(nPC2.Center, Projectile.Center); + if ((!canAttack && npcDist < attackRange) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; + attackRange = npcDist; + projPos = nPC2.Center; + canAttack = true; } } } } - float num647 = num634; - if (flag25) + float separationAnxietyDist = 2000f; + if (canAttack) { - num647 = num635; + separationAnxietyDist = 3000f; } - if (Vector2.Distance(player.Center, Projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { Projectile.ai[0] = 1f; Projectile.tileCollide = false; Projectile.netUpdate = true; } - if (flag25 && Projectile.ai[0] == 0f) + if (canAttack && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - Projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 projDirection = projPos - Projectile.Center; + float projDist = projDirection.Length(); + projDirection.Normalize(); + if (projDist > 200f) { float scaleFactor2 = 16f; //8 - vector47 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } else { - float num649 = 4f; - vector47 *= -num649; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + projDirection *= -4f; + Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } } else { - bool flag26 = false; - if (!flag26) + bool isReturning = false; + if (!isReturning) { - flag26 = Projectile.ai[0] == 1f; + isReturning = Projectile.ai[0] == 1f; } - float num650 = 5f; //6 - if (flag26) + float returnSpeed = 5f; //6 + if (isReturning) { - num650 = 12f; //15 + returnSpeed = 12f; //15 } Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -30f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 6.5f) //200 and 8 + Vector2 playerDirection = player.Center - center2 + new Vector2(0f, -30f); //-60 + float playerDist = playerDirection.Length(); + if (playerDist > 200f && returnSpeed < 6.5f) //200 and 8 { - num650 = 6.5f; //8 + returnSpeed = 6.5f; //8 } - if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + if (playerDist < 150f && isReturning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (num651 > 2000f) + if (playerDist > 2000f) { Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } - if (num651 > 70f) + if (playerDist > 70f) { - vector48.Normalize(); - vector48 *= num650; - Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; + playerDirection.Normalize(); + playerDirection *= returnSpeed; + Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { @@ -235,12 +230,12 @@ namespace CalamityMod.Projectiles.Typeless { float speed = 24f; int projType = ProjectileID.UnholyTridentFriendly; - if (flag25 && Projectile.ai[1] == 0f) + if (canAttack && Projectile.ai[1] == 0f) { Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, vector46, 0, 0)) + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, projPos, 0, 0)) { - Vector2 velocity = vector46 - Projectile.Center; + Vector2 velocity = projPos - Projectile.Center; velocity.Normalize(); velocity *= speed; int trident = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, 0f, Main.myPlayer); @@ -261,9 +256,9 @@ namespace CalamityMod.Projectiles.Typeless { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; 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, 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, 0); return false; } diff --git a/Projectiles/Typeless/DragonDust.cs b/Projectiles/Typeless/DragonDust.cs index 642eae5395..11c1c056ad 100644 --- a/Projectiles/Typeless/DragonDust.cs +++ b/Projectiles/Typeless/DragonDust.cs @@ -23,60 +23,60 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f); - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - float num461 = 25f; + float projTimer = 25f; if (Projectile.ai[0] > 60f) { - num461 -= (Projectile.ai[0] - 60f) / 2f; + projTimer -= (Projectile.ai[0] - 60f) / 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(-8, 9); - float num464 = (float)Main.rand.Next(-8, 9); - float num465 = (float)Main.rand.Next(2, 7); - 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, 244, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-8, 9); + float rand2 = (float)Main.rand.Next(-8, 9); + float rand3 = (float)Main.rand.Next(2, 7); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int dragonDuster = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[dragonDuster]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Typeless/EmpyreanBlast.cs b/Projectiles/Typeless/EmpyreanBlast.cs index 9f6eb38ef3..a2ef4103a7 100644 --- a/Projectiles/Typeless/EmpyreanBlast.cs +++ b/Projectiles/Typeless/EmpyreanBlast.cs @@ -24,60 +24,60 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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, 62, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-10, 11); + float rand2 = (float)Main.rand.Next(-10, 11); + float rand3 = (float)Main.rand.Next(3, 9); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int ourpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[ourpleDust]; 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } } diff --git a/Projectiles/Typeless/EmpyreanEmber.cs b/Projectiles/Typeless/EmpyreanEmber.cs index cc92fa0dcf..db48cb33a7 100644 --- a/Projectiles/Typeless/EmpyreanEmber.cs +++ b/Projectiles/Typeless/EmpyreanEmber.cs @@ -48,8 +48,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.rotation += Projectile.velocity.X * 0.1f; if (Main.rand.NextBool(3)) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 0.75f); - Dust dust2 = Main.dust[num200]; + int ourpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 0.75f); + Dust dust2 = Main.dust[ourpleDust]; dust2.position.X -= 2f; dust2.position.Y += 2f; dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; @@ -58,8 +58,8 @@ namespace CalamityMod.Projectiles.Typeless } else { - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 0.75f); - Dust dust = Main.dust[num199]; + int ourpleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 0.75f); + Dust dust = Main.dust[ourpleDust2]; dust.position.X -= 2f; dust.position.Y += 2f; dust.scale += (float)Main.rand.Next(50) * 0.01f; diff --git a/Projectiles/Typeless/EmpyreanGlob.cs b/Projectiles/Typeless/EmpyreanGlob.cs index ed93b1dbe0..0e8e864e0f 100644 --- a/Projectiles/Typeless/EmpyreanGlob.cs +++ b/Projectiles/Typeless/EmpyreanGlob.cs @@ -23,9 +23,9 @@ namespace CalamityMod.Projectiles.Typeless Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int ourpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 1f); + Main.dust[ourpleDust].noGravity = true; + Main.dust[ourpleDust].velocity *= 0f; } CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 8f, 20f); } diff --git a/Projectiles/Typeless/EmpyreanMarble.cs b/Projectiles/Typeless/EmpyreanMarble.cs index b062faae51..704be03a85 100644 --- a/Projectiles/Typeless/EmpyreanMarble.cs +++ b/Projectiles/Typeless/EmpyreanMarble.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int ourpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); + Main.dust[ourpleDust].noGravity = true; + Main.dust[ourpleDust].velocity *= 0f; CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 7f, 20f); } } diff --git a/Projectiles/Typeless/EmpyreanStellarDetritus.cs b/Projectiles/Typeless/EmpyreanStellarDetritus.cs index 7f3e09889c..ff3a085054 100644 --- a/Projectiles/Typeless/EmpyreanStellarDetritus.cs +++ b/Projectiles/Typeless/EmpyreanStellarDetritus.cs @@ -26,9 +26,9 @@ namespace CalamityMod.Projectiles.Typeless Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int ourpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); + Main.dust[ourpleDust].noGravity = true; + Main.dust[ourpleDust].velocity *= 0f; } CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 10f, 20f); } diff --git a/Projectiles/Typeless/FuckYou.cs b/Projectiles/Typeless/FuckYou.cs index 5eac86066c..d1e83f41d9 100644 --- a/Projectiles/Typeless/FuckYou.cs +++ b/Projectiles/Typeless/FuckYou.cs @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int dustIndexA = 0; dustIndexA < 4; dustIndexA = incrementer + 1) { - int num992 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); - Main.dust[num992].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Main.dust[smoky].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; incrementer = dustIndexA; } for (int dustIndexB = 0; dustIndexB < 10; dustIndexB = incrementer + 1) @@ -94,8 +94,8 @@ namespace CalamityMod.Projectiles.Typeless } for (int dustIndexD = 0; dustIndexD < 10; dustIndexD = incrementer + 1) { - int num998 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 0, default, 1.5f); - Dust dust = Main.dust[num998]; + int smokier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 0, default, 1.5f); + Dust dust = Main.dust[smokier]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; diff --git a/Projectiles/Typeless/GhostlyBolt.cs b/Projectiles/Typeless/GhostlyBolt.cs index 97993e25ae..236e2a67cb 100644 --- a/Projectiles/Typeless/GhostlyBolt.cs +++ b/Projectiles/Typeless/GhostlyBolt.cs @@ -31,24 +31,24 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.localAI[0] == 6f) { SoundEngine.PlaySound(SoundID.Item8, Projectile.position); - for (int num151 = 0; num151 < 40; num151++) + for (int i = 0; i < 40; i++) { - int num152 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, 0f, 0f, 100, default, 1f); - Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += Projectile.velocity * 0.75f; - Main.dust[num152].scale *= 1.2f; - Main.dust[num152].noGravity = true; + int cursedDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, 0f, 0f, 100, default, 1f); + Main.dust[cursedDust].velocity *= 3f; + Main.dust[cursedDust].velocity += Projectile.velocity * 0.75f; + Main.dust[cursedDust].scale *= 1.2f; + Main.dust[cursedDust].noGravity = true; } } Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 6f) { - for (int num153 = 0; num153 < 3; num153++) + for (int j = 0; j < 3; j++) { - int num154 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - Main.dust[num154].velocity *= 0.6f; - Main.dust[num154].scale *= 1.4f; - Main.dust[num154].noGravity = true; + int cursedDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + Main.dust[cursedDust2].velocity *= 0.6f; + Main.dust[cursedDust2].scale *= 1.4f; + Main.dust[cursedDust2].noGravity = true; } } } diff --git a/Projectiles/Typeless/GodKiller.cs b/Projectiles/Typeless/GodKiller.cs index ec9aa3b6e1..561ef29f1b 100644 --- a/Projectiles/Typeless/GodKiller.cs +++ b/Projectiles/Typeless/GodKiller.cs @@ -52,22 +52,22 @@ namespace CalamityMod.Projectiles.Typeless { if (Math.Abs(Projectile.velocity.X) >= 2f || Math.Abs(Projectile.velocity.Y) >= 2f) { - for (int num246 = 0; num246 < 2; num246++) + for (int i = 0; i < 2; i++) { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) + float shortXVel = 0f; + float shortYVel = 0f; + if (i == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + shortXVel = Projectile.velocity.X * 0.5f; + shortYVel = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 173, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 199, 0f, 0f, 100, default, 0.1f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int dusting = Dust.NewDust(new Vector2(Projectile.position.X + 3f + shortXVel, Projectile.position.Y + 3f + shortYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 173, 0f, 0f, 100, default, 1f); + Main.dust[dusting].scale *= 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dusting].velocity *= 0.2f; + Main.dust[dusting].noGravity = true; + dusting = Dust.NewDust(new Vector2(Projectile.position.X + 3f + shortXVel, Projectile.position.Y + 3f + shortYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 199, 0f, 0f, 100, default, 0.1f); + Main.dust[dusting].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dusting].velocity *= 0.05f; } } } @@ -83,23 +83,23 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item89, Projectile.position); - for (int num621 = 0; num621 < 5; num621++) + for (int j = 0; j < 5; j++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 199, 0f, 0f, 100, default, 1.5f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 199, 0f, 0f, 100, default, 1.5f); + Main.dust[dust].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[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int k = 0; k < 10; k++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); - 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, 1.5f); - Main.dust[num624].velocity *= 2f; + int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Typeless/GodSlayerBlaze.cs b/Projectiles/Typeless/GodSlayerBlaze.cs index d73aa76a73..0a85c77b34 100644 --- a/Projectiles/Typeless/GodSlayerBlaze.cs +++ b/Projectiles/Typeless/GodSlayerBlaze.cs @@ -27,19 +27,19 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { Lighting.AddLight(Projectile.Center, 0.5f, 0f, 0.75f); - 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; + int timerCounter = 0; float scale = 0.7f; int dustType = Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType(); if (Projectile.ai[1] == 0f) @@ -47,17 +47,17 @@ namespace CalamityMod.Projectiles.Typeless scale = 1.5f; dustType = 173; } - while ((float)num462 < num461) + 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, dustType, 0f, 0f, 100, default, scale); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-30, 31); + float rand2 = (float)Main.rand.Next(-30, 31); + float rand3 = (float)Main.rand.Next(9, 27); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, scale); + Dust dust = Main.dust[dusty]; if (dustType != 173) dust.color = new Color(255, 255, 255, 0); dust.noGravity = true; @@ -65,9 +65,9 @@ namespace CalamityMod.Projectiles.Typeless 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Typeless/GodSlayerShrapnel.cs b/Projectiles/Typeless/GodSlayerShrapnel.cs index 839ded82f7..ca5cc26b24 100644 --- a/Projectiles/Typeless/GodSlayerShrapnel.cs +++ b/Projectiles/Typeless/GodSlayerShrapnel.cs @@ -54,8 +54,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item13, Projectile.position); } - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[num199]; + int godDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[godDust]; dust.position.X -= 2f; dust.position.Y += 2f; dust.scale += (float)Main.rand.Next(50) * 0.01f; @@ -63,8 +63,8 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); - Dust dust2 = Main.dust[num200]; + int godDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); + Dust dust2 = Main.dust[godDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; diff --git a/Projectiles/Typeless/GoldenGunProj.cs b/Projectiles/Typeless/GoldenGunProj.cs index 585a64f68d..8f80048492 100644 --- a/Projectiles/Typeless/GoldenGunProj.cs +++ b/Projectiles/Typeless/GoldenGunProj.cs @@ -29,16 +29,16 @@ namespace CalamityMod.Projectiles.Typeless Projectile.localAI[0] += 1f; return; } - int num3; - for (int num586 = 0; num586 < 1; num586 = num3 + 1) + int inc; + for (int i = 0; i < 1; i = inc + 1) { - for (int num587 = 0; num587 < 6; num587 = num3 + 1) + for (int j = 0; j < 6; j = inc + 1) { - float num588 = Projectile.velocity.X / 6f * (float)num587; - float num589 = Projectile.velocity.Y / 6f * (float)num587; - int num590 = 6; - int num591 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num590, Projectile.position.Y + (float)num590), Projectile.width - num590 * 2, Projectile.height - num590 * 2, 170, 0f, 0f, 75, default, 1.2f); - Dust dust = Main.dust[num591]; + float dustX = Projectile.velocity.X / 6f * (float)j; + float dustY = Projectile.velocity.Y / 6f * (float)j; + int dustPosMod = 6; + int goldenDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosMod, Projectile.position.Y + (float)dustPosMod), Projectile.width - dustPosMod * 2, Projectile.height - dustPosMod * 2, 170, 0f, 0f, 75, default, 1.2f); + Dust dust = Main.dust[goldenDust]; if (Main.rand.NextBool()) { dust.alpha += 25; @@ -55,31 +55,31 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity *= 0.3f; dust.velocity += Projectile.velocity * 0.5f; dust.position = Projectile.Center; - dust.position.X -= num588; - dust.position.Y -= num589; + dust.position.X -= dustX; + dust.position.Y -= dustY; dust.velocity *= 0.2f; - num3 = num587; + inc = j; } if (Main.rand.NextBool(4)) { - int num592 = 6; - int num593 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num592, Projectile.position.Y + (float)num592), Projectile.width - num592 * 2, Projectile.height - num592 * 2, 170, 0f, 0f, 75, default, 0.65f); - Dust dust = Main.dust[num593]; + int dustPosMod2 = 6; + int moreGoldenDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosMod2, Projectile.position.Y + (float)dustPosMod2), Projectile.width - dustPosMod2 * 2, Projectile.height - dustPosMod2 * 2, 170, 0f, 0f, 75, default, 0.65f); + Dust dust = Main.dust[moreGoldenDust]; dust.velocity *= 0.5f; dust.velocity += Projectile.velocity * 0.5f; } - num3 = num586; + inc = i; } } public override void OnKill(int timeLeft) { Projectile.velocity = Projectile.oldVelocity * 0.2f; - int num3; - for (int num362 = 0; num362 < 100; num362 = num3 + 1) + int inc; + for (int k = 0; k < 100; k = inc + 1) { - int num363 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 75, default, 1.2f); - Dust dust = Main.dust[num363]; + int deathGoldenDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 75, default, 1.2f); + Dust dust = Main.dust[deathGoldenDust]; if (Main.rand.NextBool()) { dust.alpha += 25; @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; dust.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; dust.position = Projectile.Center; - num3 = num362; + inc = k; } } diff --git a/Projectiles/Typeless/HellfireExplosionFriendly2.cs b/Projectiles/Typeless/HellfireExplosionFriendly2.cs index f3933d15a9..52ecb09a68 100644 --- a/Projectiles/Typeless/HellfireExplosionFriendly2.cs +++ b/Projectiles/Typeless/HellfireExplosionFriendly2.cs @@ -34,38 +34,38 @@ namespace CalamityMod.Projectiles.Typeless 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(-15, 16); - float num464 = (float)Main.rand.Next(-15, 16); - float num465 = (float)Main.rand.Next(5, 12); - 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, 0.75f); - Dust dust = Main.dust[num467]; + float rand1 = (float)Main.rand.Next(-15, 16); + float rand2 = (float)Main.rand.Next(-15, 16); + float rand3 = (float)Main.rand.Next(5, 12); + float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjust = rand3 / randAdjust; + rand1 *= randAdjust; + rand2 *= randAdjust; + int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.75f); + 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Typeless/HolyExplosion.cs b/Projectiles/Typeless/HolyExplosion.cs index 84cde429dc..4fc213896c 100644 --- a/Projectiles/Typeless/HolyExplosion.cs +++ b/Projectiles/Typeless/HolyExplosion.cs @@ -32,23 +32,23 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 20; 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 < 40; num623++) + for (int j = 0; j < 40; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 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, 246, 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/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index 1a370a4913..2c8c85e1ed 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -39,29 +39,29 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 60; 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 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 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, 244, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].velocity *= 3f; if (Projectile.ai[0] == 1) - Main.dust[num622].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + Main.dust[holyDust].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); 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 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; + int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[holyDust2].noGravity = true; + Main.dust[holyDust2].velocity *= 5f; if (Projectile.ai[0] == 1) - Main.dust[num624].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); - 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; + Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + 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; if (Projectile.ai[0] == 1) - Main.dust[num624].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); } } else @@ -74,26 +74,26 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 60; 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 < 8; num621++) + for (int i = 0; i < 8; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, 0f, 0f, 100, default, Main.rand.NextFloat(1.2f, 1.8f)); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, 0f, 0f, 100, default, Main.rand.NextFloat(1.2f, 1.8f)); + Main.dust[holyDust].velocity *= 3f; + Main.dust[holyDust].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); 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 < 12; num623++) + for (int j = 0; j < 12; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 272, 0f, 0f, 100, default, 0.8f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - Main.dust[num624].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 226, 0f, 0f, 100, default, 0.6f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 272, 0f, 0f, 100, default, 0.8f); + Main.dust[holyDust2].noGravity = true; + Main.dust[holyDust2].velocity *= 5f; + Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 226, 0f, 0f, 100, default, 0.6f); + Main.dust[holyDust2].velocity *= 2f; + Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); } } } diff --git a/Projectiles/Typeless/HydrothermalSmoke.cs b/Projectiles/Typeless/HydrothermalSmoke.cs index be332b38ab..dc762df3e9 100644 --- a/Projectiles/Typeless/HydrothermalSmoke.cs +++ b/Projectiles/Typeless/HydrothermalSmoke.cs @@ -37,12 +37,12 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(4)) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int fieryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); if (Main.rand.NextBool(4)) { - Main.dust[num469].scale *= 0.35f; + Main.dust[fieryDust].scale *= 0.35f; } - Main.dust[num469].velocity *= 0f; + Main.dust[fieryDust].velocity *= 0f; } Vector2 goreVec = new Vector2(Projectile.position.X, Projectile.position.Y); diff --git a/Projectiles/Typeless/KelvinCatalystStar.cs b/Projectiles/Typeless/KelvinCatalystStar.cs index c225e89aca..7945edcc91 100644 --- a/Projectiles/Typeless/KelvinCatalystStar.cs +++ b/Projectiles/Typeless/KelvinCatalystStar.cs @@ -92,14 +92,14 @@ namespace CalamityMod.Projectiles.Typeless { SoundEngine.PlaySound(SoundID.Item27, Projectile.position); Projectile.ExpandHitboxBy(24); - 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; - 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, 67, vector7.X * 0.5f, vector7.Y * 0.5f, 100, default, 0.75f); - Main.dust[num228].noGravity = true; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int icyDust = Dust.NewDust(rotate + faceDirection, 0, 0, 67, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, default, 0.75f); + Main.dust[icyDust].noGravity = true; } } diff --git a/Projectiles/Typeless/LunicBeam.cs b/Projectiles/Typeless/LunicBeam.cs index 626372112e..cdcbcd0404 100644 --- a/Projectiles/Typeless/LunicBeam.cs +++ b/Projectiles/Typeless/LunicBeam.cs @@ -25,13 +25,10 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - float num29 = 5f; - float num30 = 150f; + float aiTrack = 5f; float scaleFactor = 6f; - Vector2 value7 = new Vector2(10f, 20f); - float num31 = 1f; - int num32 = 3 * Projectile.MaxUpdates; - int num33 = Utils.SelectRandom(Main.rand, new int[] + Vector2 dustRotation = new Vector2(10f, 20f); + int dustType = Utils.SelectRandom(Main.rand, new int[] { 246, 244, @@ -39,7 +36,7 @@ namespace CalamityMod.Projectiles.Typeless 262, 247 }); - int num34 = 259; + int solarDustType = 259; if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; @@ -47,38 +44,38 @@ namespace CalamityMod.Projectiles.Typeless } else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) { - int num35 = -1; - float num36 = num30; - for (int num37 = 0; num37 < Main.maxNPCs; num37++) + int targetID = -1; + float hitDistance = 150f; + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) + if (Main.npc[i].active && Main.npc[i].CanBeChasedBy(Projectile, false)) { - Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, Projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) + Vector2 targetCenter = Main.npc[i].Center; + float targetDist = Vector2.Distance(targetCenter, Projectile.Center); + if (targetDist < hitDistance && targetID == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, targetCenter, 1, 1)) { - num36 = num38; - num35 = num37; + hitDistance = targetDist; + targetID = i; } } } - if (num36 < 8f) + if (hitDistance < 8f) { Projectile.Kill(); return; } - if (num35 != -1) + if (targetID != -1) { - Projectile.ai[1] = num29 + 1f; - Projectile.ai[0] = (float)num35; + Projectile.ai[1] = aiTrack + 1f; + Projectile.ai[0] = (float)targetID; Projectile.netUpdate = true; } } - else if (Projectile.ai[1] > num29) + else if (Projectile.ai[1] > aiTrack) { Projectile.ai[1] += 1f; - int num39 = (int)Projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) + int npcTrack = (int)Projectile.ai[0]; + if (!Main.npc[npcTrack].active || !Main.npc[npcTrack].CanBeChasedBy(Projectile, false)) { Projectile.ai[1] = 1f; Projectile.ai[0] = 0f; @@ -87,25 +84,24 @@ namespace CalamityMod.Projectiles.Typeless else { Projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; - if (vector6.Length() < 20f) + Vector2 npcDirection = Main.npc[npcTrack].Center - Projectile.Center; + if (npcDirection.Length() < 20f) { Projectile.Kill(); return; } - if (vector6 != Vector2.Zero) + if (npcDirection != Vector2.Zero) { - vector6.Normalize(); - vector6 *= scaleFactor; + npcDirection.Normalize(); + npcDirection *= scaleFactor; } - float num40 = 30f; - Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; + Projectile.velocity = (Projectile.velocity * 29f + npcDirection) / 30f; } } - if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < aiTrack) { Projectile.ai[1] += 1f; - if (Projectile.ai[1] == num29) + if (Projectile.ai[1] == aiTrack) { Projectile.ai[1] = 1f; } @@ -117,83 +113,81 @@ namespace CalamityMod.Projectiles.Typeless } else if (Projectile.alpha == 0) { - for (int num41 = 0; num41 < 2; num41++) + for (int j = 0; j < 2; j++) { - Vector2 value8 = Vector2.UnitX * -30f; - value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = num31; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8 + Projectile.velocity * 2f; - Main.dust[num42].velocity = Vector2.Normalize(Projectile.Center + Projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + Projectile.velocity * 2f; + Vector2 rotateFirstDust = Vector2.UnitX * -30f; + rotateFirstDust = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)j * 3.14159274f), default) * dustRotation - Projectile.rotation.ToRotationVector2() * 10f; + int solarDust = Dust.NewDust(Projectile.Center, 0, 0, solarDustType, 0f, 0f, 160, default, 1f); + Main.dust[solarDust].scale = 1f; + Main.dust[solarDust].noGravity = true; + Main.dust[solarDust].position = Projectile.Center + rotateFirstDust + Projectile.velocity * 2f; + Main.dust[solarDust].velocity = Vector2.Normalize(Projectile.Center + Projectile.velocity * 2f * 8f - Main.dust[solarDust].position) * 2f + Projectile.velocity * 2f; } } if (Main.rand.NextBool(12)) { - for (int num43 = 0; num43 < 1; num43++) + for (int k = 0; k < 1; k++) { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = Projectile.Center + value9 * (float)Projectile.width / 2f + Projectile.velocity * 2f; - Main.dust[num44].fadeIn = 0.9f; + Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int smokyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); + Main.dust[smokyDust].velocity *= 0.1f; + Main.dust[smokyDust].position = Projectile.Center + rotateSecondDust * (float)Projectile.width / 2f + Projectile.velocity * 2f; + Main.dust[smokyDust].fadeIn = 0.9f; } } if (Main.rand.NextBool(64)) { - for (int num45 = 0; num45 < 1; num45++) + for (int l = 0; l < 1; l++) { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 155, default, 0.8f); - Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = Projectile.Center + value10 * (float)Projectile.width / 2f; + Vector2 rotateThirdDust = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int smokyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 155, default, 0.8f); + Main.dust[smokyDust2].velocity *= 0.3f; + Main.dust[smokyDust2].position = Projectile.Center + rotateThirdDust * (float)Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[num46].fadeIn = 1.4f; + Main.dust[smokyDust2].fadeIn = 1.4f; } } } if (Main.rand.NextBool(4)) { - for (int num47 = 0; num47 < 2; num47++) + for (int m = 0; m < 2; m++) { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num33, 0f, 0f, 0, default, 1.2f); - Main.dust[num48].velocity *= 0.3f; - Main.dust[num48].noGravity = true; - Main.dust[num48].position = Projectile.Center + value11 * (float)Projectile.width / 2f; + Vector2 rotateFourthDust = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int randomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1.2f); + Main.dust[randomDust].velocity *= 0.3f; + Main.dust[randomDust].noGravity = true; + Main.dust[randomDust].position = Projectile.Center + rotateFourthDust * (float)Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[num48].fadeIn = 1.4f; + Main.dust[randomDust].fadeIn = 1.4f; } } } if (Main.rand.NextBool(3)) { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); - Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = Projectile.Center + value13 * (float)Projectile.width / 2f; - Main.dust[num50].fadeIn = 1.2f; - Main.dust[num50].scale = 1.5f; - Main.dust[num50].noGravity = true; + Vector2 rotateFifthDust = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int solarDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, solarDustType, 0f, 0f, 100, default, 1f); + Main.dust[solarDust2].velocity *= 0.3f; + Main.dust[solarDust2].position = Projectile.Center + rotateFifthDust * (float)Projectile.width / 2f; + Main.dust[solarDust2].fadeIn = 1.2f; + Main.dust[solarDust2].scale = 1.5f; + Main.dust[solarDust2].noGravity = true; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - for (int num151 = 0; num151 < 3; num151++) + for (int r = 0; r < 3; r++) { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 259, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; + int moreSolarDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 28, Projectile.height - 28, 259, 0f, 0f, 100, default, 1.35f); + Main.dust[moreSolarDust].noGravity = true; + Main.dust[moreSolarDust].velocity *= 0.1f; + Main.dust[moreSolarDust].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(8)) { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 259, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; + int mostSolarDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 32, Projectile.height - 32, 259, 0f, 0f, 100, default, 1f); + Main.dust[mostSolarDust].velocity *= 0.25f; + Main.dust[mostSolarDust].noGravity = true; + Main.dust[mostSolarDust].velocity += Projectile.velocity * 0.5f; } } @@ -210,7 +204,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - int num47 = Utils.SelectRandom(Main.rand, new int[] + int m = Utils.SelectRandom(Main.rand, new int[] { 246, 244, @@ -218,14 +212,11 @@ namespace CalamityMod.Projectiles.Typeless 262, 247 }); - int num48 = 259; - int num49 = 259; + int randomDust = 259; int height = 50; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + float solarDust2 = 1.7f; + Vector2 dustRotate = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 dustVel = dustRotate * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; SoundEngine.PlaySound(SoundID.Item14, Projectile.position); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = height; @@ -235,10 +226,10 @@ namespace CalamityMod.Projectiles.Typeless Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) + int inc; + for (int j = 0; j < 40; j = inc + 1) { - num47 = Utils.SelectRandom(Main.rand, new int[] + m = Utils.SelectRandom(Main.rand, new int[] { 246, 244, @@ -246,30 +237,30 @@ namespace CalamityMod.Projectiles.Typeless 262, 247 }); - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num47, 0f, 0f, 200, default, num50); - Dust dust = Main.dust[num54]; + int orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, m, 0f, 0f, 200, default, solarDust2); + Dust dust = Main.dust[orangeDust]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num48, 0f, 0f, 100, default, num51); + dust.velocity += dustVel * Main.rand.NextFloat(); + orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.8f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; dust.color = Color.Crimson * 0.5f; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; + dust.velocity += dustVel * Main.rand.NextFloat(); + inc = j; } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) + for (int k = 0; k < 20; k = inc + 1) { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num49, 0f, 0f, 0, default, num52); - Dust dust = Main.dust[num56]; + int deathSolar = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 259, 0f, 0f, 0, default, 2f); + Dust dust = Main.dust[deathSolar]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; dust.noGravity = true; dust.velocity *= 0.5f; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; + dust.velocity += dustVel * (0.6f + 0.6f * Main.rand.NextFloat()); + inc = k; } } } diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index 693b74c32a..616927e7de 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -56,27 +56,27 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - int num3; - for (int num191 = 0; num191 < 2; num191 = num3 + 1) + int inc; + for (int i = 0; i < 2; i = inc + 1) { - int num192 = (int)(10f * Projectile.scale); - int num193 = Dust.NewDust(Projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default, 1f); - Dust dust20 = Main.dust[num193]; - Vector2 value8 = Vector2.Normalize(dust20.position - Projectile.Center); - dust20.position = Projectile.Center + value8 * (float)num192 * Projectile.scale; - if (num191 < 30) + int dustScale = (int)(10f * Projectile.scale); + int greenDust = Dust.NewDust(Projectile.Center - Vector2.One * (float)dustScale, dustScale * 2, dustScale * 2, 107, 0f, 0f, 0, default, 1f); + Dust nanoDust = Main.dust[greenDust]; + Vector2 dustDirection = Vector2.Normalize(nanoDust.position - Projectile.Center); + nanoDust.position = Projectile.Center + dustDirection * (float)dustScale * Projectile.scale; + if (i < 30) { - dust20.velocity = value8 * dust20.velocity.Length(); + nanoDust.velocity = dustDirection * nanoDust.velocity.Length(); } else { - dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; + nanoDust.velocity = dustDirection * (float)Main.rand.Next(45, 91) / 10f; } - dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); - dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); - dust20.noGravity = true; - dust20.scale = 0.7f; - num3 = num191; + nanoDust.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); + nanoDust.color = Color.Lerp(nanoDust.color, Color.White, 0.3f); + nanoDust.noGravity = true; + nanoDust.scale = 0.7f; + inc = i; } } } diff --git a/Projectiles/Typeless/PendantProjectile1.cs b/Projectiles/Typeless/PendantProjectile1.cs index 6599962449..35ef3774a6 100644 --- a/Projectiles/Typeless/PendantProjectile1.cs +++ b/Projectiles/Typeless/PendantProjectile1.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Typeless { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int num457 = 0; num457 < 5; num457++) + for (int i = 0; i < 5; i++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity += Projectile.velocity * 0.1f; } } diff --git a/Projectiles/Typeless/PendantProjectile2.cs b/Projectiles/Typeless/PendantProjectile2.cs index d75992ca46..195d600e90 100644 --- a/Projectiles/Typeless/PendantProjectile2.cs +++ b/Projectiles/Typeless/PendantProjectile2.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Typeless { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int num457 = 0; num457 < 5; num457++) + for (int i = 0; i < 5; i++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity += Projectile.velocity * 0.1f; } } diff --git a/Projectiles/Typeless/PendantProjectile3.cs b/Projectiles/Typeless/PendantProjectile3.cs index 355e6982d1..982005b4d2 100644 --- a/Projectiles/Typeless/PendantProjectile3.cs +++ b/Projectiles/Typeless/PendantProjectile3.cs @@ -24,12 +24,12 @@ namespace CalamityMod.Projectiles.Typeless Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int num457 = 0; num457 < 5; num457++) + for (int i = 0; i < 5; i++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity += Projectile.velocity * 0.1f; } } diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index 20f5460100..fe72306c83 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -36,14 +36,14 @@ namespace CalamityMod.Projectiles.Typeless { randomDust = 33; } - for (int num468 = 0; num468 < 2; num468++) + for (int i = 0; i < 2; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); if (randomDust == 89) { - Main.dust[num469].scale *= 0.35f; + Main.dust[seaDust].scale *= 0.35f; } - Main.dust[num469].velocity *= 0f; + Main.dust[seaDust].velocity *= 0f; } } diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index ac0d4505c8..3d69cbc6ff 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -59,23 +59,23 @@ namespace CalamityMod.Projectiles.Typeless Projectile.width = Projectile.height = 200; 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 < 4; num621++) + for (int i = 0; i < 4; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int skyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[skyDust].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[skyDust].scale = 0.5f; + Main.dust[skyDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 12; num623++) + for (int j = 0; j < 12; j++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int skyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[skyDust2].noGravity = true; + Main.dust[skyDust2].velocity *= 5f; + skyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[skyDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Typeless/StandingFire.cs b/Projectiles/Typeless/StandingFire.cs index 6774138de3..b1c3b82708 100644 --- a/Projectiles/Typeless/StandingFire.cs +++ b/Projectiles/Typeless/StandingFire.cs @@ -58,8 +58,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item13, Projectile.position); } - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num199]; + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[brimDust]; dust.position.X -= 2f; dust.position.Y += 2f; dust.scale += (float)Main.rand.Next(50) * 0.01f; @@ -67,13 +67,13 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Dust dust2 = Main.dust[num200]; - dust2.position.X -= 2f; - dust2.position.Y += 2f; - dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - dust2.noGravity = true; - dust2.velocity *= 0.1f; + int brimDusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Dust dusty = Main.dust[brimDusty]; + dusty.position.X -= 2f; + dusty.position.Y += 2f; + dusty.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + dusty.noGravity = true; + dusty.velocity *= 0.1f; } if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index 52ad50eec1..a5092d1b74 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -41,23 +41,23 @@ namespace CalamityMod.Projectiles.Typeless 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/Typeless/SulphuricAcidBubbleFriendly.cs b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs index 7882562788..c636b151e4 100644 --- a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs +++ b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs @@ -102,9 +102,9 @@ namespace CalamityMod.Projectiles.Typeless 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; } @@ -135,17 +135,17 @@ namespace CalamityMod.Projectiles.Typeless Projectile.width = Projectile.height = 60; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - 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, 31, 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, 31, 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; } } } diff --git a/Projectiles/Typeless/TarraEnergy.cs b/Projectiles/Typeless/TarraEnergy.cs index a4270a7ada..dbcbf4179d 100644 --- a/Projectiles/Typeless/TarraEnergy.cs +++ b/Projectiles/Typeless/TarraEnergy.cs @@ -32,18 +32,18 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - for (int num136 = 0; num136 < 2; num136++) + for (int i = 0; i < 2; i++) { - float x2 = Projectile.position.X - Projectile.velocity.X / 10f * (float)num136; - float y2 = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)num136; + float x2 = Projectile.position.X - Projectile.velocity.X / 10f * (float)i; + float y2 = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)i; Vector2 dspeed = Projectile.velocity * Main.rand.NextFloat(0.7f, 0.4f); - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity = dspeed; - Main.dust[num137].noGravity = true; - Main.dust[num137].noLight = true; + int greenDust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); + Main.dust[greenDust].alpha = Projectile.alpha; + Main.dust[greenDust].position.X = x2; + Main.dust[greenDust].position.Y = y2; + Main.dust[greenDust].velocity = dspeed; + Main.dust[greenDust].noGravity = true; + Main.dust[greenDust].noLight = true; } if (Projectile.timeLeft < 170) From 4ef641b500c8d69d686b3c149d9c836c3ce1182d Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 19 Oct 2023 17:54:11 -0400 Subject: [PATCH 05/43] Pets --- Projectiles/Pets/Astrophage.cs | 12 ++-- Projectiles/Pets/Bear.cs | 56 +++++++++---------- Projectiles/Pets/BrimlingPet.cs | 79 +++++++++++++-------------- Projectiles/Pets/ChibiiDoggo.cs | 42 +++++++------- Projectiles/Pets/ChibiiDoggoFly.cs | 38 ++++++------- Projectiles/Pets/DannyDevitoPet.cs | 70 ++++++++++++------------ Projectiles/Pets/EidolonSnail.cs | 58 ++++++++++---------- Projectiles/Pets/FlakPet.cs | 56 +++++++++---------- Projectiles/Pets/KendraPet.cs | 62 ++++++++++----------- Projectiles/Pets/RadiatorPet.cs | 12 ++-- Projectiles/Pets/Sparks.cs | 88 ++++++++++++++---------------- 11 files changed, 276 insertions(+), 297 deletions(-) diff --git a/Projectiles/Pets/Astrophage.cs b/Projectiles/Pets/Astrophage.cs index 368fdb67aa..92606b0c88 100644 --- a/Projectiles/Pets/Astrophage.cs +++ b/Projectiles/Pets/Astrophage.cs @@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Pets public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { Player player = Main.player[Projectile.owner]; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); fallThrough = playerDistance > 200f; return true; } @@ -79,9 +79,9 @@ namespace CalamityMod.Projectiles.Pets if (!fly) { Projectile.rotation = 0; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { Projectile.velocity.Y = -5f; diff --git a/Projectiles/Pets/Bear.cs b/Projectiles/Pets/Bear.cs index 9202a2c4b0..5577af726f 100644 --- a/Projectiles/Pets/Bear.cs +++ b/Projectiles/Pets/Bear.cs @@ -34,9 +34,9 @@ namespace CalamityMod.Projectiles.Pets public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { Player player = Main.player[Projectile.owner]; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); fallThrough = playerDistance > 200f; return true; } @@ -67,9 +67,9 @@ namespace CalamityMod.Projectiles.Pets if (!fly) { Projectile.rotation = 0; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { Projectile.velocity.Y = -5f; @@ -233,18 +233,16 @@ namespace CalamityMod.Projectiles.Pets } else if (fly) { - float num16 = 0.3f; + float flyingSpeed = 0.3f; Projectile.tileCollide = false; - Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; + Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction); vertiPos -= 60f; float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - float num21 = 18f; - float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); if (playerDistance > 2000f) { @@ -254,7 +252,7 @@ namespace CalamityMod.Projectiles.Pets } if (playerDistance < 100f) { - num16 = 0.1f; + flyingSpeed = 0.1f; if (player.velocity.Y == 0f) { ++playerStill; @@ -275,53 +273,53 @@ namespace CalamityMod.Projectiles.Pets { Projectile.velocity *= 0.90f; } - num16 = 0.01f; + flyingSpeed = 0.01f; } else { if (playerDistance < 100f) { - num16 = 0.1f; + flyingSpeed = 0.1f; } if (playerDistance > 300f) { - num16 = 1f; + flyingSpeed = 1f; } - playerDistance = num21 / playerDistance; + playerDistance = 18f / playerDistance; horiPos *= playerDistance; vertiPos *= playerDistance; } if (Projectile.velocity.X <= horiPos) { - Projectile.velocity.X = Projectile.velocity.X + num16; - if (num16 > 0.05f && Projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + flyingSpeed; + if (flyingSpeed > 0.05f && Projectile.velocity.X < 0f) { - Projectile.velocity.X = Projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + flyingSpeed; } } if (Projectile.velocity.X > horiPos) { - Projectile.velocity.X = Projectile.velocity.X - num16; - if (num16 > 0.05f && Projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - flyingSpeed; + if (flyingSpeed > 0.05f && Projectile.velocity.X > 0f) { - Projectile.velocity.X = Projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - flyingSpeed; } } if (Projectile.velocity.Y <= vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y + num16; - if (num16 > 0.05f && Projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + flyingSpeed; + if (flyingSpeed > 0.05f && Projectile.velocity.Y < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + flyingSpeed * 2f; } } if (Projectile.velocity.Y > vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y - num16; - if (num16 > 0.05f && Projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - flyingSpeed; + if (flyingSpeed > 0.05f && Projectile.velocity.Y > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - flyingSpeed * 2f; } } diff --git a/Projectiles/Pets/BrimlingPet.cs b/Projectiles/Pets/BrimlingPet.cs index d2a5c420fd..039b854234 100644 --- a/Projectiles/Pets/BrimlingPet.cs +++ b/Projectiles/Pets/BrimlingPet.cs @@ -42,33 +42,30 @@ namespace CalamityMod.Projectiles.Pets { Projectile.timeLeft = 4; } - float num16 = 0.5f; + float flySpeed = 0.5f; Projectile.tileCollide = false; - int num17 = 100; - Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num18 = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; - float num19 = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; - num19 += (float)Main.rand.Next(-10, 21); - num18 += (float)Main.rand.Next(-10, 21); - num18 += (float)(60 * -(float)Main.player[Projectile.owner].direction); - num19 -= 60f; - float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); - float num21 = 18f; + Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; + float vertPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; + vertPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction); + vertPos -= 60f; + float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertPos * vertPos)); //Limites de mouvement ici - float num27 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); - if (num27 > 1000f) + if (playerDistance > 1000f) { - Projectile.position.X = Projectile.position.X + num18; - Projectile.position.Y = Projectile.position.Y + num19; + Projectile.position.X = Projectile.position.X + horiPos; + Projectile.position.Y = Projectile.position.Y + vertPos; for (int k = 0; k < 10; k++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0, -1f, 0, default, 1f); } } - if (num20 < (float)num17 && Main.player[Projectile.owner].velocity.Y == 0f && + if (playerDistance < 100f && Main.player[Projectile.owner].velocity.Y == 0f && Projectile.position.Y + (float)Projectile.height <= Main.player[Projectile.owner].position.Y + (float)Main.player[Projectile.owner].height && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { @@ -78,60 +75,60 @@ namespace CalamityMod.Projectiles.Pets Projectile.velocity.Y = -6f; } } - if (num20 < 50f) + if (playerDistance < 50f) { if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { Projectile.velocity *= 0.90f; } - num16 = 0.01f; + flySpeed = 0.01f; } else { - if (num20 < 100f) + if (playerDistance < 100f) { - num16 = 0.1f; + flySpeed = 0.1f; } - if (num20 > 300f) + if (playerDistance > 300f) { - num16 = 1f; + flySpeed = 1f; } - num20 = num21 / num20; - num18 *= num20; - num19 *= num20; + playerDistance = 18f / playerDistance; + horiPos *= playerDistance; + vertPos *= playerDistance; } //Les changements de velocité ici - if (Projectile.velocity.X < num18) + if (Projectile.velocity.X < horiPos) { - Projectile.velocity.X = Projectile.velocity.X + num16; - if (num16 > 0.05f && Projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X < 0f) { - Projectile.velocity.X = Projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + flySpeed; } } - if (Projectile.velocity.X > num18) + if (Projectile.velocity.X > horiPos) { - Projectile.velocity.X = Projectile.velocity.X - num16; - if (num16 > 0.05f && Projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X > 0f) { - Projectile.velocity.X = Projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - flySpeed; } } - if (Projectile.velocity.Y < num19) + if (Projectile.velocity.Y < vertPos) { - Projectile.velocity.Y = Projectile.velocity.Y + num16; - if (num16 > 0.05f && Projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f; } } - if (Projectile.velocity.Y > num19) + if (Projectile.velocity.Y > vertPos) { - Projectile.velocity.Y = Projectile.velocity.Y - num16; - if (num16 > 0.05f && Projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f; } } if ((double)Projectile.velocity.X > 0.25) diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 4f0304c20f..c158fe7771 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -49,40 +49,38 @@ namespace CalamityMod.Projectiles.Pets SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Color color25 = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16)); + Color colorArea = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16)); Texture2D texture2D3 = ModContent.Request("CalamityMod/Projectiles/Pets/ChibiiDoggoMonochrome").Value; - int num156 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y3 = num156 * Projectile.frame; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; + 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; + int eightCompare = 8; + int twoConst = 2; - int num161 = num159; - while ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) + int counter = 1; + while ((twoConst > 0 && counter < eightCompare) || (twoConst < 0 && counter > eightCompare)) { - Color color26 = color25; - color26 = Projectile.GetAlpha(color26); + Color colorAlpha = colorArea; + colorAlpha = Projectile.GetAlpha(colorAlpha); goto IL_6899; IL_6881: - num161 += num158; + counter += twoConst; continue; IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) + float trailColorChange = (float)(eightCompare - counter); + if (twoConst < 0) { - num164 = (float)(num159 - num161); + trailColorChange = (float)(1 - counter); } - color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); - Vector2 value4 = Projectile.oldPos[num161]; - float num165 = Projectile.rotation; + colorAlpha *= trailColorChange / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 oldDrawPos = Projectile.oldPos[counter]; + float projRotate = Projectile.rotation; SpriteEffects effects = spriteEffects; - Main.spriteBatch.Draw(texture2D3, value4 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + Projectile.rotation * num160 * (float)(num161 - 1) * Projectile.spriteDirection, origin2, Projectile.scale, effects, 0f); + Main.spriteBatch.Draw(texture2D3, oldDrawPos + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorAlpha, projRotate + Projectile.rotation * 0f * (float)(counter - 1) * Projectile.spriteDirection, halfRect, Projectile.scale, effects, 0f); goto IL_6881; } - Main.spriteBatch.Draw(ModContent.Request(Texture).Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0); + Main.spriteBatch.Draw(ModContent.Request(Texture).Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, halfRect, Projectile.scale, spriteEffects, 0); return false; } diff --git a/Projectiles/Pets/ChibiiDoggoFly.cs b/Projectiles/Pets/ChibiiDoggoFly.cs index c2240aea2b..c46dd04893 100644 --- a/Projectiles/Pets/ChibiiDoggoFly.cs +++ b/Projectiles/Pets/ChibiiDoggoFly.cs @@ -35,36 +35,34 @@ namespace CalamityMod.Projectiles.Pets SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Color color25 = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16)); + Color colorArea = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16)); Texture2D texture2D3 = ModContent.Request("CalamityMod/Projectiles/Pets/ChibiiDoggoFlyMonochrome").Value; - int num156 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y3 = num156 * Projectile.frame; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); + 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 origin2 = rectangle.Size() / 2f; - int num157 = 12; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) + int twelveCompare = 12; + int twoConst = 2; + int counter = 1; + while ((twoConst > 0 && counter < twelveCompare) || (twoConst < 0 && counter > twelveCompare)) { - Color color26 = color25; - color26 = Projectile.GetAlpha(color26); + Color colorAlpha = colorArea; + colorAlpha = Projectile.GetAlpha(colorAlpha); goto IL_6899; IL_6881: - num161 += num158; + counter += twoConst; continue; IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) + float trailColorChange = (float)(twelveCompare - counter); + if (twoConst < 0) { - num164 = (float)(num159 - num161); + trailColorChange = (float)(1 - counter); } - color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); - Vector2 value4 = Projectile.oldPos[num161]; - float num165 = Projectile.rotation; + colorAlpha *= trailColorChange / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 oldDrawPos = Projectile.oldPos[counter]; + float projRotate = Projectile.rotation; SpriteEffects effects = spriteEffects; - Main.spriteBatch.Draw(texture2D3, value4 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + Projectile.rotation * num160 * (float)(num161 - 1) * Projectile.spriteDirection, origin2, Projectile.scale, effects, 0f); + Main.spriteBatch.Draw(texture2D3, oldDrawPos + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorAlpha, projRotate + Projectile.rotation * 0f * (float)(counter - 1) * Projectile.spriteDirection, origin2, Projectile.scale, effects, 0f); goto IL_6881; } Main.spriteBatch.Draw(ModContent.Request(Texture).Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0); diff --git a/Projectiles/Pets/DannyDevitoPet.cs b/Projectiles/Pets/DannyDevitoPet.cs index 6b5740d9c6..caf6efc850 100644 --- a/Projectiles/Pets/DannyDevitoPet.cs +++ b/Projectiles/Pets/DannyDevitoPet.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Pets public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { Player player = Main.player[Projectile.owner]; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); fallThrough = playerDistance > 200f; return true; } @@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Pets if (!fly) { Projectile.rotation = 0; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { Projectile.velocity.Y = -5f; @@ -144,18 +144,16 @@ namespace CalamityMod.Projectiles.Pets } else if (fly) { - float num16 = 0.3f; + float flySpeed = 0.3f; Projectile.tileCollide = false; - Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; + Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction); vertiPos -= 60f; float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - float num21 = 18f; - float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); if (playerDistance > 1200f) { Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); @@ -164,7 +162,7 @@ namespace CalamityMod.Projectiles.Pets } if (playerDistance < 100f) { - num16 = 0.1f; + flySpeed = 0.1f; if (player.velocity.Y == 0f) { ++playerStill; @@ -185,52 +183,52 @@ namespace CalamityMod.Projectiles.Pets { Projectile.velocity *= 0.90f; } - num16 = 0.01f; + flySpeed = 0.01f; } else { if (playerDistance < 100f) { - num16 = 0.1f; + flySpeed = 0.1f; } if (playerDistance > 300f) { - num16 = 1f; + flySpeed = 1f; } - playerDistance = num21 / playerDistance; + playerDistance = 18f / playerDistance; horiPos *= playerDistance; vertiPos *= playerDistance; } if (Projectile.velocity.X <= horiPos) { - Projectile.velocity.X = Projectile.velocity.X + num16; - if (num16 > 0.05f && Projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X < 0f) { - Projectile.velocity.X = Projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + flySpeed; } } if (Projectile.velocity.X > horiPos) { - Projectile.velocity.X = Projectile.velocity.X - num16; - if (num16 > 0.05f && Projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X > 0f) { - Projectile.velocity.X = Projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - flySpeed; } } if (Projectile.velocity.Y <= vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y + num16; - if (num16 > 0.05f && Projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f; } } if (Projectile.velocity.Y > vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y - num16; - if (num16 > 0.05f && Projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f; } } Projectile.rotation = Projectile.velocity.X * 0.03f; @@ -250,16 +248,16 @@ namespace CalamityMod.Projectiles.Pets { if (!Main.gamePaused || Main.gameMenu) { - Vector2 vector69 = projectile.position - Main.screenPosition; - if ((float)Main.mouseX > vector69.X && (float)Main.mouseX < vector69.X + (float)projectile.width && (float)Main.mouseY > vector69.Y && (float)Main.mouseY < vector69.Y + (float)projectile.height) + Vector2 projDirect = projectile.position - Main.screenPosition; + if ((float)Main.mouseX > projDirect.X && (float)Main.mouseX < projDirect.X + (float)projectile.width && (float)Main.mouseY > projDirect.Y && (float)Main.mouseY < projDirect.Y + (float)projectile.height) { - int num345 = (int)(Main.player[projectile.owner].Center.X / 16f); - int num346 = (int)(Main.player[projectile.owner].Center.Y / 16f); - int num347 = (int)projectile.Center.X / 16; - int num348 = (int)projectile.Center.Y / 16; + int playerTileX = (int)(Main.player[projectile.owner].Center.X / 16f); + int playerTileY = (int)(Main.player[projectile.owner].Center.Y / 16f); + int projTileX = (int)projectile.Center.X / 16; + int projTileY = (int)projectile.Center.Y / 16; int lastTileRangeX = Main.player[projectile.owner].lastTileRangeX; int lastTileRangeY = Main.player[projectile.owner].lastTileRangeY; - if (num345 >= num347 - lastTileRangeX && num345 <= num347 + lastTileRangeX + 1 && num346 >= num348 - lastTileRangeY && num346 <= num348 + lastTileRangeY + 1) + if (playerTileX >= projTileX - lastTileRangeX && playerTileX <= projTileX + lastTileRangeX + 1 && playerTileY >= projTileY - lastTileRangeY && playerTileY <= projTileY + lastTileRangeY + 1) { Main.player[projectile.owner].noThrow = 2; Main.player[projectile.owner].cursorItemIconEnabled = true; diff --git a/Projectiles/Pets/EidolonSnail.cs b/Projectiles/Pets/EidolonSnail.cs index 43eca6fac7..1cb931d241 100644 --- a/Projectiles/Pets/EidolonSnail.cs +++ b/Projectiles/Pets/EidolonSnail.cs @@ -62,9 +62,9 @@ namespace CalamityMod.Projectiles.Pets public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { Player player = Main.player[Projectile.owner]; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); fallThrough = playerDistance > 200f; return true; } @@ -87,13 +87,13 @@ namespace CalamityMod.Projectiles.Pets Projectile.timeLeft = 2; } - Vector2 vector46 = Projectile.position; + Vector2 projPos = Projectile.position; if (!fly) { Projectile.rotation = 0; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); if (Projectile.velocity.Y == 0 && ((HoleBelow() && playerDistance > 150f) || (playerDistance > 150f && Projectile.position.X == Projectile.oldPosition.X))) { Projectile.velocity.Y = -8f; @@ -189,18 +189,16 @@ namespace CalamityMod.Projectiles.Pets } else if (fly) { - float num16 = 0.5f; + float flySpeed = 0.5f; Projectile.tileCollide = false; - Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; + Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)(60 * -(float)player.direction); vertiPos -= 60f; float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - float num21 = 18f; - float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); if (playerDistance > 1200f) { Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); @@ -209,7 +207,7 @@ namespace CalamityMod.Projectiles.Pets } if (playerDistance < 100f) { - num16 = 0.5f; + flySpeed = 0.5f; if (player.velocity.Y == 0f) { ++playerStill; @@ -231,52 +229,52 @@ namespace CalamityMod.Projectiles.Pets { Projectile.velocity *= 0.90f; } - num16 = 0.02f; + flySpeed = 0.02f; } else { if (playerDistance < 100f) { - num16 = 0.35f; + flySpeed = 0.35f; } if (playerDistance > 300f) { - num16 = 1f; + flySpeed = 1f; } - playerDistance = num21 / playerDistance; + playerDistance = 18f / playerDistance; horiPos *= playerDistance; vertiPos *= playerDistance; } if (Projectile.velocity.X <= horiPos) { - Projectile.velocity.X = Projectile.velocity.X + num16; - if (num16 > 0.05f && Projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X < 0f) { - Projectile.velocity.X = Projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + flySpeed; } } if (Projectile.velocity.X > horiPos) { - Projectile.velocity.X = Projectile.velocity.X - num16; - if (num16 > 0.05f && Projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X > 0f) { - Projectile.velocity.X = Projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - flySpeed; } } if (Projectile.velocity.Y <= vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y + num16; - if (num16 > 0.05f && Projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f; } } if (Projectile.velocity.Y > vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y - num16; - if (num16 > 0.05f && Projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f; } } diff --git a/Projectiles/Pets/FlakPet.cs b/Projectiles/Pets/FlakPet.cs index 898b6a38eb..ae63ae54d8 100644 --- a/Projectiles/Pets/FlakPet.cs +++ b/Projectiles/Pets/FlakPet.cs @@ -33,9 +33,9 @@ namespace CalamityMod.Projectiles.Pets public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { Player player = Main.player[Projectile.owner]; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); fallThrough = playerDistance > 200f; return true; } @@ -61,9 +61,9 @@ namespace CalamityMod.Projectiles.Pets if (!fly) { Projectile.rotation = 0; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { Projectile.velocity.Y = -5f; @@ -166,18 +166,16 @@ namespace CalamityMod.Projectiles.Pets } else if (fly) { - float num16 = 0.3f; + float flySpeed = 0.3f; Projectile.tileCollide = false; - Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; + Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)(60 * -(float)player.direction); vertiPos -= 60f; float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - float num21 = 18f; - float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); if (playerDistance > 1200f) { Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); @@ -186,7 +184,7 @@ namespace CalamityMod.Projectiles.Pets } if (playerDistance < 100f) { - num16 = 0.1f; + flySpeed = 0.1f; if (player.velocity.Y == 0f) { ++playerStill; @@ -207,52 +205,52 @@ namespace CalamityMod.Projectiles.Pets { Projectile.velocity *= 0.90f; } - num16 = 0.01f; + flySpeed = 0.01f; } else { if (playerDistance < 100f) { - num16 = 0.1f; + flySpeed = 0.1f; } if (playerDistance > 300f) { - num16 = 1f; + flySpeed = 1f; } - playerDistance = num21 / playerDistance; + playerDistance = 18f / playerDistance; horiPos *= playerDistance; vertiPos *= playerDistance; } if (Projectile.velocity.X <= horiPos) { - Projectile.velocity.X = Projectile.velocity.X + num16; - if (num16 > 0.05f && Projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X < 0f) { - Projectile.velocity.X = Projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + flySpeed; } } if (Projectile.velocity.X > horiPos) { - Projectile.velocity.X = Projectile.velocity.X - num16; - if (num16 > 0.05f && Projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X > 0f) { - Projectile.velocity.X = Projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - flySpeed; } } if (Projectile.velocity.Y <= vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y + num16; - if (num16 > 0.05f && Projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f; } } if (Projectile.velocity.Y > vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y - num16; - if (num16 > 0.05f && Projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f; } } Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; diff --git a/Projectiles/Pets/KendraPet.cs b/Projectiles/Pets/KendraPet.cs index ccfe64890e..2dfbb656b9 100644 --- a/Projectiles/Pets/KendraPet.cs +++ b/Projectiles/Pets/KendraPet.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Pets public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { Player player = Main.player[Projectile.owner]; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); fallThrough = playerDistance > 200f; return true; } @@ -66,9 +66,9 @@ namespace CalamityMod.Projectiles.Pets if (!fly) { Projectile.rotation = 0; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); if (Projectile.velocity.Y == 0f && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { Projectile.velocity.Y = -5f; @@ -233,18 +233,16 @@ namespace CalamityMod.Projectiles.Pets } else if (fly) { - float num16 = 0.3f; + float flySpeed = 0.3f; Projectile.tileCollide = false; - Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; + Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction); vertiPos -= 60f; float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - float num21 = 18.5f; - float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); if (playerDistance > 2000f) { Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); @@ -253,7 +251,7 @@ namespace CalamityMod.Projectiles.Pets } if (playerDistance < 100f) { - num16 = 0.1f; + flySpeed = 0.1f; if (player.velocity.Y == 0f) { playerStill++; @@ -274,52 +272,52 @@ namespace CalamityMod.Projectiles.Pets { Projectile.velocity *= 0.9f; } - num16 = 0.01f; + flySpeed = 0.01f; } else { if (playerDistance < 100f) { - num16 = 0.1f; + flySpeed = 0.1f; } if (playerDistance > 300f) { - num16 = 1f; + flySpeed = 1f; } - playerDistance = num21 / playerDistance; + playerDistance = 18.5f / playerDistance; horiPos *= playerDistance; vertiPos *= playerDistance; } if (Projectile.velocity.X <= horiPos) { - Projectile.velocity.X = Projectile.velocity.X + num16; - if (num16 > 0.05f && Projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X < 0f) { - Projectile.velocity.X = Projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + flySpeed; } } if (Projectile.velocity.X > horiPos) { - Projectile.velocity.X = Projectile.velocity.X - num16; - if (num16 > 0.05f && Projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X > 0f) { - Projectile.velocity.X = Projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - flySpeed; } } if (Projectile.velocity.Y <= vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y + num16; - if (num16 > 0.05f && Projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f; } } if (Projectile.velocity.Y > vertiPos) { - Projectile.velocity.Y = Projectile.velocity.Y - num16; - if (num16 > 0.05f && Projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f; } } Projectile.rotation = Projectile.velocity.X * 0.015f; @@ -352,9 +350,9 @@ namespace CalamityMod.Projectiles.Pets { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; 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, 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, 0); return false; } diff --git a/Projectiles/Pets/RadiatorPet.cs b/Projectiles/Pets/RadiatorPet.cs index 575f2bfbe4..701e26229d 100644 --- a/Projectiles/Pets/RadiatorPet.cs +++ b/Projectiles/Pets/RadiatorPet.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Pets public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { Player player = Main.player[Projectile.owner]; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); fallThrough = playerDistance > 200f; return true; } @@ -82,9 +82,9 @@ namespace CalamityMod.Projectiles.Pets if (!fly) { Projectile.rotation = 0; - Vector2 center2 = Projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { Projectile.velocity.Y = -5f; diff --git a/Projectiles/Pets/Sparks.cs b/Projectiles/Pets/Sparks.cs index 4b7711a883..0de8b7de5c 100644 --- a/Projectiles/Pets/Sparks.cs +++ b/Projectiles/Pets/Sparks.cs @@ -42,8 +42,6 @@ namespace CalamityMod.Projectiles.Pets Item item = Main.item[itemIndex]; if (item.active && item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Projectile.owner && ItemLoader.CanPickup(item, player)) { - int num = defaultItemGrabRange;//Player.defaultItemGrabRange; - if (new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height).Intersects(new Rectangle((int)item.position.X, (int)item.position.Y, item.width, item.height))) { if (Projectile.owner == Main.myPlayer && (player.ActiveItem().type != ItemID.None || player.itemAnimation <= 0)) @@ -63,16 +61,16 @@ namespace CalamityMod.Projectiles.Pets { continue; //Main.PlaySound(7, (int)player.position.X, (int)player.position.Y, 1); - //int num2 = item.buffType; + //int nebulaBuff = item.buffType; //Main.item[itemIndex] = new Item(); //if (Main.netMode == 1) //{ - // NetMessage.SendData(102, -1, -1, "", projectile.owner, (float)num2, player.Center.X, player.Center.Y, 0, 0, 0); + // NetMessage.SendData(102, -1, -1, "", projectile.owner, (float)nebulaBuff, player.Center.X, player.Center.Y, 0, 0, 0); // NetMessage.SendData(21, -1, -1, "", itemIndex, 0f, 0f, 0f, 0, 0, 0); //} //else //{ - // player.NebulaLevelup(num2); + // player.NebulaLevelup(nebulaBuff); //} } if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) @@ -149,8 +147,8 @@ namespace CalamityMod.Projectiles.Pets for (int index = 0; index < Main.projectile.Length; index++) { Projectile proj = Main.projectile[index]; - bool flag23 = Main.projPet[proj.type]; - if (index != Projectile.whoAmI && proj.active && proj.owner == Projectile.owner && flag23 && Math.Abs(Projectile.position.X - proj.position.X) + Math.Abs(Projectile.position.Y - proj.position.Y) < (float)Projectile.width) + bool isPet = Main.projPet[proj.type]; + if (index != Projectile.whoAmI && proj.active && proj.owner == Projectile.owner && isPet && Math.Abs(Projectile.position.X - proj.position.X) + Math.Abs(Projectile.position.Y - proj.position.Y) < (float)Projectile.width) { if (Projectile.position.X < proj.position.X) { @@ -170,17 +168,16 @@ namespace CalamityMod.Projectiles.Pets } } } - float num16 = 0.5f; + float flySpeed = 0.5f; Projectile.tileCollide = false; - Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float xDist = player.position.X + (float)(player.width / 2) - vector3.X; - float yDist = player.position.Y + (float)(player.height / 2) - vector3.Y; + Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float xDist = player.position.X + (float)(player.width / 2) - flyDirection.X; + float yDist = player.position.Y + (float)(player.height / 2) - flyDirection.Y; yDist += (float)Main.rand.Next(-10, 21); xDist += (float)Main.rand.Next(-10, 21); xDist += (float)(60 * (float)player.direction); yDist -= 60f; float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - float num21 = 18f; if (playerDist < 160f) Projectile.ai[0] = 0f; if (playerDist < 100f && player.velocity.Y == 0f && @@ -204,52 +201,52 @@ namespace CalamityMod.Projectiles.Pets { Projectile.velocity *= 0.99f; } - num16 = 0.01f; + flySpeed = 0.01f; } else { if (playerDist < 100f) { - num16 = 0.1f; + flySpeed = 0.1f; } if (playerDist > 300f) { - num16 = 1f; + flySpeed = 1f; } - playerDist = num21 / playerDist; + playerDist = 18f / playerDist; xDist *= playerDist; yDist *= playerDist; } if (Projectile.velocity.X < xDist) { - Projectile.velocity.X = Projectile.velocity.X + num16; - if (num16 > 0.05f && Projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X < 0f) { - Projectile.velocity.X = Projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + flySpeed; } } if (Projectile.velocity.X > xDist) { - Projectile.velocity.X = Projectile.velocity.X - num16; - if (num16 > 0.05f && Projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X > 0f) { - Projectile.velocity.X = Projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - flySpeed; } } if (Projectile.velocity.Y < yDist) { - Projectile.velocity.Y = Projectile.velocity.Y + num16; - if (num16 > 0.05f && Projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y < 0f) { - Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f; } } if (Projectile.velocity.Y > yDist) { - Projectile.velocity.Y = Projectile.velocity.Y - num16; - if (num16 > 0.05f && Projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y > 0f) { - Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f; } } } @@ -334,7 +331,7 @@ namespace CalamityMod.Projectiles.Pets Pickup(); //pickup items - bool flag24 = false; + bool decelerate = false; if (Projectile.ai[0] == 2f) { Projectile.ai[1] += 1f; @@ -347,10 +344,10 @@ namespace CalamityMod.Projectiles.Pets } else { - flag24 = true; + decelerate = true; } } - if (flag24) + if (decelerate) { return; } @@ -406,32 +403,31 @@ namespace CalamityMod.Projectiles.Pets } } - float num647 = 100f; + float separationAnxietyDist = 100f; if (foundFood) { - num647 = 200f; + separationAnxietyDist = 200f; } - if (Vector2.Distance(player.Center, Projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { Projectile.ai[0] = 1f; Projectile.netUpdate = true; } if (foundFood && Projectile.ai[0] == 0f) { - Vector2 vector47 = targetLocation - Projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 targetDirection = targetLocation - Projectile.Center; + float targetDist = targetDirection.Length(); + targetDirection.Normalize(); + if (targetDist > 200f) { float scaleFactor2 = 18f; - vector47 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + targetDirection *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 40f + targetDirection) / 41f; } else { - float num649 = 9f; - vector47 *= -num649; - Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; + targetDirection *= -9f; + Projectile.velocity = (Projectile.velocity * 40f + targetDirection) / 41f; } } else @@ -455,9 +451,9 @@ namespace CalamityMod.Projectiles.Pets if (Main.myPlayer == Projectile.owner) { Projectile.ai[0] = 2f; - Vector2 value20 = targetLocation - Projectile.Center; - value20.Normalize(); - Projectile.velocity = value20 * 12f; + Vector2 targetDest = targetLocation - Projectile.Center; + targetDest.Normalize(); + Projectile.velocity = targetDest * 12f; Projectile.netUpdate = true; } } From 03316717327be3434e10e2038eab3d1227fc1129 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 20 Oct 2023 11:32:50 -0400 Subject: [PATCH 06/43] MELEE --- Projectiles/Melee/AegisBeam.cs | 28 +-- Projectiles/Melee/AegisBlast.cs | 60 +++---- Projectiles/Melee/AegisBlast2.cs | 60 +++---- Projectiles/Melee/AegisFlame.cs | 24 +-- Projectiles/Melee/AmidiasWhirlpool.cs | 93 +++++----- .../Melee/BalefulHarvesterProjectile.cs | 79 +++++---- Projectiles/Melee/BallOFuguProj.cs | 54 +++--- Projectiles/Melee/BansheeHookBoom.cs | 46 ++--- Projectiles/Melee/Blood.cs | 8 +- Projectiles/Melee/Blood2.cs | 8 +- Projectiles/Melee/BloodBall.cs | 56 +++--- Projectiles/Melee/Brimblast.cs | 8 +- .../Melee/BrimlanceHellfireExplosion.cs | 52 +++--- Projectiles/Melee/BrimlanceStandingFire.cs | 24 +-- Projectiles/Melee/Brimlash2.cs | 28 +-- Projectiles/Melee/BrimlashProj.cs | 28 +-- Projectiles/Melee/BrimstoneBoom.cs | 46 ++--- Projectiles/Melee/BrimstoneSwordExplosion.cs | 52 +++--- Projectiles/Melee/BrinySpout.cs | 47 +++-- Projectiles/Melee/BrinyTyphoonBubble.cs | 95 +++++----- Projectiles/Melee/BurningMeteor.cs | 26 +-- Projectiles/Melee/ClamCrusherFlail.cs | 76 ++++---- Projectiles/Melee/CometQuasherMeteor.cs | 24 +-- Projectiles/Melee/CosmicDischargeFlail.cs | 4 +- Projectiles/Melee/CosmicIceBurst.cs | 55 +++--- Projectiles/Melee/CosmicOrb.cs | 6 +- Projectiles/Melee/CosmicSpiritBomb1.cs | 40 ++--- Projectiles/Melee/CosmicSpiritBomb2.cs | 40 ++--- Projectiles/Melee/CosmicSpiritBomb3.cs | 40 ++--- Projectiles/Melee/CrystylCrusherRay.cs | 64 +++---- Projectiles/Melee/Cyclone.cs | 17 +- Projectiles/Melee/DarkBall.cs | 56 +++--- Projectiles/Melee/DarkBeam.cs | 8 +- Projectiles/Melee/DarkIceZero.cs | 18 +- Projectiles/Melee/DepthOrb.cs | 30 ++-- Projectiles/Melee/DepthOrb2.cs | 30 ++-- Projectiles/Melee/DevilsSunriseCyclone.cs | 106 +++++------ Projectiles/Melee/DevilsSunriseProj.cs | 28 +-- Projectiles/Melee/DragonRageStaff.cs | 27 ++- Projectiles/Melee/Earth2.cs | 22 +-- Projectiles/Melee/Earth3.cs | 42 ++--- Projectiles/Melee/Earth4.cs | 22 +-- Projectiles/Melee/EarthProj.cs | 22 +-- Projectiles/Melee/ElementBall.cs | 6 +- Projectiles/Melee/EmpyreanKnife.cs | 10 +- Projectiles/Melee/EntropicFlechette.cs | 22 +-- Projectiles/Melee/EntropicFlechetteLarge.cs | 22 +-- Projectiles/Melee/EntropicFlechetteSmall.cs | 22 +-- Projectiles/Melee/EssenceFlame2.cs | 22 +-- Projectiles/Melee/EutrophicSpark.cs | 24 +-- Projectiles/Melee/Exocomet.cs | 35 ++-- Projectiles/Melee/Feather.cs | 6 +- Projectiles/Melee/Flarefrost.cs | 26 +-- Projectiles/Melee/GaelExplosion.cs | 60 +++---- Projectiles/Melee/GalacticaComet.cs | 54 +++--- Projectiles/Melee/GalaxyBlast.cs | 54 +++--- Projectiles/Melee/GalaxyBlastType2.cs | 54 +++--- Projectiles/Melee/GalaxyBlastType3.cs | 48 ++--- Projectiles/Melee/GalileosPlanet.cs | 26 +-- Projectiles/Melee/GhastlySoulLarge.cs | 35 ++-- Projectiles/Melee/GhastlySoulMedium.cs | 35 ++-- Projectiles/Melee/GhastlySoulSmall.cs | 35 ++-- Projectiles/Melee/GreenWater.cs | 28 +-- Projectiles/Melee/HolyColliderHolyFire.cs | 22 +-- Projectiles/Melee/IceBombFriendly.cs | 22 +-- Projectiles/Melee/IllustriousKnife.cs | 10 +- Projectiles/Melee/InsidiousHarpoon.cs | 32 ++-- Projectiles/Melee/JudgementProj.cs | 10 +- Projectiles/Melee/LaserFountain.cs | 8 +- Projectiles/Melee/LifeScythe.cs | 6 +- Projectiles/Melee/LightBeam.cs | 8 +- Projectiles/Melee/LuxorsGiftMelee.cs | 36 ++-- Projectiles/Melee/MirrorBlast.cs | 14 +- Projectiles/Melee/MourningSkull.cs | 81 +++++---- Projectiles/Melee/Nebudust.cs | 46 ++--- Projectiles/Melee/NebulaShot.cs | 14 +- Projectiles/Melee/NebulashFlail.cs | 3 +- Projectiles/Melee/NeptuneOrb.cs | 30 ++-- Projectiles/Melee/OrderbringerAura.cs | 32 ++-- Projectiles/Melee/OrderbringerBeam.cs | 24 +-- Projectiles/Melee/OrderbringerRain.cs | 10 +- Projectiles/Melee/OrderbringerWhiteOrb.cs | 10 +- Projectiles/Melee/PlagueSeeker.cs | 8 +- Projectiles/Melee/RSSolarFlare.cs | 28 +-- Projectiles/Melee/RainBolt.cs | 6 +- Projectiles/Melee/RainbowBoom.cs | 60 +++---- Projectiles/Melee/Razorwind.cs | 8 +- Projectiles/Melee/SandFire.cs | 8 +- Projectiles/Melee/ScourgeoftheCosmosMini.cs | 82 ++++----- Projectiles/Melee/ScourgeoftheCosmosProj.cs | 82 ++++----- .../Melee/Shortswords/ElementalShivProj.cs | 6 +- .../Melee/Shortswords/GalileoGladiusProj.cs | 6 +- Projectiles/Melee/SolsticeBeam.cs | 12 +- Projectiles/Melee/SoulScytheExplosion.cs | 22 +-- Projectiles/Melee/Spark.cs | 24 +-- Projectiles/Melee/SpatialSpear.cs | 16 +- Projectiles/Melee/SpatialSpear2.cs | 16 +- Projectiles/Melee/SpatialSpear3.cs | 16 +- Projectiles/Melee/SpatialSpear4.cs | 16 +- .../Melee/Spears/GildedProboscisProj.cs | 4 +- Projectiles/Melee/StarnightBeam.cs | 16 +- Projectiles/Melee/StormMark.cs | 86 ++++----- Projectiles/Melee/SulphurousGrabberBubble.cs | 12 +- Projectiles/Melee/SulphurousGrabberBubble2.cs | 12 +- Projectiles/Melee/SwordsplosionBlue.cs | 10 +- Projectiles/Melee/SwordsplosionGreen.cs | 10 +- Projectiles/Melee/SwordsplosionPurple.cs | 10 +- Projectiles/Melee/SwordsplosionRed.cs | 10 +- Projectiles/Melee/TerraSpear.cs | 20 +-- Projectiles/Melee/TerrorBlast.cs | 12 +- Projectiles/Melee/TinyCrystal.cs | 32 ++-- Projectiles/Melee/TinyFlare.cs | 8 +- Projectiles/Melee/Tornado.cs | 164 +++++++++--------- Projectiles/Melee/TriactisHammerProj.cs | 99 ++++++----- .../Melee/TrueCausticEdgeProjectile.cs | 20 +-- Projectiles/Melee/TumbleweedFlail.cs | 84 ++++----- Projectiles/Melee/TumbleweedRolling.cs | 22 +-- Projectiles/Melee/TyphonsGreedBubble.cs | 27 ++- Projectiles/Melee/TyphonsGreedStaff.cs | 73 ++++---- Projectiles/Melee/UltimusCleaverDust.cs | 24 +-- Projectiles/Melee/UrchinBall.cs | 62 +++---- Projectiles/Melee/UrchinBallSpike.cs | 8 +- Projectiles/Melee/VolcanicFireball.cs | 12 +- Projectiles/Melee/VolcanicFireballLarge.cs | 12 +- Projectiles/Melee/Waterfall.cs | 48 ++--- Projectiles/Melee/WhiteBoltAura.cs | 32 ++-- Projectiles/Melee/WhiteOrb.cs | 10 +- Projectiles/Melee/Whiterain.cs | 10 +- Projectiles/Melee/YateveoBloomProj.cs | 73 ++++---- Projectiles/Melee/Yoyos/SmokingCometYoyo.cs | 126 +++++++------- 130 files changed, 2140 insertions(+), 2165 deletions(-) diff --git a/Projectiles/Melee/AegisBeam.cs b/Projectiles/Melee/AegisBeam.cs index 0620e23ebd..bd40232028 100644 --- a/Projectiles/Melee/AegisBeam.cs +++ b/Projectiles/Melee/AegisBeam.cs @@ -35,10 +35,10 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item73, Projectile.position); Projectile.localAI[0] += 1f; } - int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int goldDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); + Main.dust[goldDust].noGravity = true; + Main.dust[goldDust].velocity *= 0.5f; + Main.dust[goldDust].velocity += Projectile.velocity * 0.1f; } public override void OnKill(int timeLeft) @@ -55,22 +55,22 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); for (int d = 0; d <= 30; d++) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); + float rando = (float)Main.rand.Next(-10, 11); + float rando2 = (float)Main.rand.Next(-10, 11); float speed = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = speed / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); - Dust dust = Main.dust[num467]; + float randoAdjuster = (float)Math.Sqrt((double)(rando * rando + rando2 * rando2)); + randoAdjuster = speed / randoAdjuster; + rando *= randoAdjuster; + rando2 *= randoAdjuster; + int deathDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); + Dust dust = Main.dust[deathDust]; 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; + dust.velocity.X = rando; + dust.velocity.Y = rando2; } int flameAmt = Main.rand.Next(2, 4); if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/AegisBlast.cs b/Projectiles/Melee/AegisBlast.cs index 41171e81ed..623d48f4b4 100644 --- a/Projectiles/Melee/AegisBlast.cs +++ b/Projectiles/Melee/AegisBlast.cs @@ -34,61 +34,61 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item74, Projectile.position); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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(-15, 16); - float num464 = (float)Main.rand.Next(-15, 16); - float num465 = (float)Main.rand.Next(4, 13); - 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, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); - 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]; + float rando1 = (float)Main.rand.Next(-15, 16); + float rando2 = (float)Main.rand.Next(-15, 16); + float rando3 = (float)Main.rand.Next(4, 13); + float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjuster = rando3 / randoAdjuster; + rando1 *= randoAdjuster; + rando2 *= randoAdjuster; + int goldDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + Main.dust[goldDust].noGravity = true; + Main.dust[goldDust].position.X = Projectile.Center.X; + Main.dust[goldDust].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[goldDust]; 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[goldDust]; 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[goldDust].velocity.X = rando1; + Main.dust[goldDust].velocity.Y = rando2; + timerCounter++; } } diff --git a/Projectiles/Melee/AegisBlast2.cs b/Projectiles/Melee/AegisBlast2.cs index ce706a55df..14462ca888 100644 --- a/Projectiles/Melee/AegisBlast2.cs +++ b/Projectiles/Melee/AegisBlast2.cs @@ -26,61 +26,61 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0f / 255f); - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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(-5, 6); - float num464 = (float)Main.rand.Next(-5, 6); - float num465 = (float)Main.rand.Next(2, 5); - 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, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); - 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]; + float rando1 = (float)Main.rand.Next(-5, 6); + float rando2 = (float)Main.rand.Next(-5, 6); + float rando3 = (float)Main.rand.Next(2, 5); + float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjuster = rando3 / randoAdjuster; + rando1 *= randoAdjuster; + rando2 *= randoAdjuster; + int goldDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + Main.dust[goldDust].noGravity = true; + Main.dust[goldDust].position.X = Projectile.Center.X; + Main.dust[goldDust].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[goldDust]; 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[goldDust]; 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[goldDust].velocity.X = rando1; + Main.dust[goldDust].velocity.Y = rando2; + timerCounter++; } } } diff --git a/Projectiles/Melee/AegisFlame.cs b/Projectiles/Melee/AegisFlame.cs index 7e782a0e22..f5c7d0dddd 100644 --- a/Projectiles/Melee/AegisFlame.cs +++ b/Projectiles/Melee/AegisFlame.cs @@ -48,25 +48,25 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; + int goldFlameDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Dust expr_8976_cp_0 = Main.dust[goldFlameDust]; expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; + Dust expr_8994_cp_0 = Main.dust[goldFlameDust]; expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; + Main.dust[goldFlameDust].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[goldFlameDust].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[goldFlameDust]; expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; + int goldFlameDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Dust expr_8A4E_cp_0 = Main.dust[goldFlameDust2]; expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; + Dust expr_8A6C_cp_0 = Main.dust[goldFlameDust2]; expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; + Main.dust[goldFlameDust2].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[goldFlameDust2].noGravity = true; + Main.dust[goldFlameDust2].velocity *= 0.1f; } if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index 40e9297957..1d14113510 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -31,26 +31,26 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - 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(0, 142, 255), 1.5f); - 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(0, 142, 255), 1.5f); + 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; } Projectile.ai[0] += 1f; - int num1013 = 0; + int homeTracker = 0; if (Projectile.velocity.Length() <= 8f) //4 { - num1013 = 1; + homeTracker = 1; } - if (num1013 == 0) + if (homeTracker == 0) { Projectile.rotation -= 0.104719758f; @@ -66,68 +66,67 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0] = 0f; } } - else if (num1013 == 1) + else if (homeTracker == 1) { - int num3; + int inc; Projectile.rotation -= 0.104719758f; - Vector2 vector145 = Projectile.Center; - float num1015 = 150f; - bool flag59 = false; - int num1016 = 0; + Vector2 projCenter = Projectile.Center; + float homingRange = 150f; + bool isHoming = false; + int npcTracker = 0; if (Projectile.ai[1] == 0f) { - for (int num1017 = 0; num1017 < Main.maxNPCs; num1017 = num3 + 1) + for (int j = 0; j < Main.maxNPCs; j = inc + 1) { - if (Main.npc[num1017].CanBeChasedBy(Projectile, false)) + if (Main.npc[j].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[j].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[j].position, Main.npc[j].width, Main.npc[j].height)) { - num1015 = Projectile.Distance(center13); - vector145 = center13; - flag59 = true; - num1016 = num1017; + homingRange = Projectile.Distance(npcCenter); + projCenter = npcCenter; + isHoming = true; + npcTracker = j; break; } } - num3 = num1017; + inc = j; } - 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 npcTrackAgain = (int)(Projectile.ai[1] - 1f); + if (Main.npc[npcTrackAgain].active && Main.npc[npcTrackAgain].CanBeChasedBy(Projectile, true) && Projectile.Distance(Main.npc[npcTrackAgain].Center) < 1000f) { - flag59 = true; - vector145 = Main.npc[num1018].Center; + isHoming = true; + projCenter = Main.npc[npcTrackAgain].Center; } } if (!Projectile.friendly) { - flag59 = false; + isHoming = false; } - if (flag59) + if (isHoming) { - float num1019 = 24f; - int num1020 = 10; - Vector2 vector146 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num1021 = vector145.X - vector146.X; - float num1022 = vector145.Y - vector146.Y; - float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); - num1023 = num1019 / num1023; - num1021 *= num1023; - num1022 *= num1023; - Projectile.velocity.X = (Projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; - Projectile.velocity.Y = (Projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; + int waterDust0 = 10; + Vector2 dustDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float waterDust1 = projCenter.X - dustDirection.X; + float waterDust2 = projCenter.Y - dustDirection.Y; + float waterDust3 = (float)Math.Sqrt((double)(waterDust1 * waterDust1 + waterDust2 * waterDust2)); + waterDust3 = 24f / waterDust3; + waterDust1 *= waterDust3; + waterDust2 *= waterDust3; + Projectile.velocity.X = (Projectile.velocity.X * (float)(waterDust0 - 1) + waterDust1) / (float)waterDust0; + Projectile.velocity.Y = (Projectile.velocity.Y * (float)(waterDust0 - 1) + waterDust2) / (float)waterDust0; } } Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.9f); diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 7deb4805d8..7b6f2a619b 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -47,38 +47,37 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) { - int num554 = (int)Projectile.ai[0]; - if (Main.npc[num554].active) + int npcTracker = (int)Projectile.ai[0]; + if (Main.npc[npcTracker].active) { - float num555 = 8f; - Vector2 vector44 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num556 = Main.npc[num554].position.X - vector44.X; - float num557 = Main.npc[num554].position.Y - vector44.Y; - float num558 = (float)Math.Sqrt((double)(num556 * num556 + num557 * num557)); - num558 = num555 / num558; - num556 *= num558; - num557 *= num558; - Projectile.velocity.X = (Projectile.velocity.X * 14f + num556) / 15f; - Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num557) / 15f; + Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float projXVel = Main.npc[npcTracker].position.X - projDirection.X; + float projYVel = Main.npc[npcTracker].position.Y - projDirection.Y; + float projVelocity = (float)Math.Sqrt((double)(projXVel * projXVel + projYVel * projYVel)); + projVelocity = 8f / projVelocity; + projXVel *= projVelocity; + projYVel *= projVelocity; + Projectile.velocity.X = (Projectile.velocity.X * 14f + projXVel) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + projYVel) / 15f; } else { - float num559 = 1000f; - int num3; - for (int num560 = 0; num560 < Main.maxNPCs; num560 = num3 + 1) + float homingRange = 1000f; + int inc; + for (int i = 0; i < Main.maxNPCs; i = inc + 1) { - if (Main.npc[num560].CanBeChasedBy(Projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { - float num561 = Main.npc[num560].position.X + (float)(Main.npc[num560].width / 2); - float num562 = Main.npc[num560].position.Y + (float)(Main.npc[num560].height / 2); - float num563 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num561) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num562); - if (num563 < num559 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num560].position, Main.npc[num560].width, Main.npc[num560].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 < homingRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) { - num559 = num563; - Projectile.ai[0] = (float)num560; + homingRange = npcDist; + Projectile.ai[0] = (float)i; } } - num3 = num560; + inc = i; } } @@ -93,14 +92,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - for (int num157 = 0; num157 < 2; num157++) + for (int j = 0; j < 2; j++) { - int num158 = Dust.NewDust(new Vector2(Projectile.position.X + 4f, Projectile.position.Y + 4f), Projectile.width - 8, Projectile.height - 8, Main.rand.NextBool() ? 5 : 6, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 2f); - Main.dust[num158].position -= Projectile.velocity * 2f; - Main.dust[num158].noGravity = true; - Dust expr_7A4A_cp_0_cp_0 = Main.dust[num158]; + int dust = Dust.NewDust(new Vector2(Projectile.position.X + 4f, Projectile.position.Y + 4f), Projectile.width - 8, Projectile.height - 8, Main.rand.NextBool() ? 5 : 6, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 2f); + Main.dust[dust].position -= Projectile.velocity * 2f; + Main.dust[dust].noGravity = true; + Dust expr_7A4A_cp_0_cp_0 = Main.dust[dust]; expr_7A4A_cp_0_cp_0.velocity.X *= 0.3f; - Dust expr_7A65_cp_0_cp_0 = Main.dust[num158]; + Dust expr_7A65_cp_0_cp_0 = Main.dust[dust]; expr_7A65_cp_0_cp_0.velocity.Y *= 0.3f; } @@ -124,23 +123,23 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - for (int num621 = 0; num621 < 5; num621++) + for (int j = 0; j < 5; j++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int deathDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[deathDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[deathDust].scale = 0.5f; + Main.dust[deathDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int k = 0; k < 10; k++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int deathDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[deathDust2].noGravity = true; + Main.dust[deathDust2].velocity *= 5f; + deathDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[deathDust2].velocity *= 2f; } } diff --git a/Projectiles/Melee/BallOFuguProj.cs b/Projectiles/Melee/BallOFuguProj.cs index f105a0c7aa..fc786dfeac 100644 --- a/Projectiles/Melee/BallOFuguProj.cs +++ b/Projectiles/Melee/BallOFuguProj.cs @@ -63,13 +63,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0] = 2f; } Projectile.tileCollide = false; - float num694 = 20f; + float returnSpeed = 20f; if (Projectile.ai[0] == 2f) { - num694 = 40f; + returnSpeed = 40f; } - Projectile.velocity = Vector2.Normalize(projVector) * num694; - if (projVector.Length() < num694) + Projectile.velocity = Vector2.Normalize(projVector) * returnSpeed; + if (projVector.Length() < returnSpeed) { Projectile.Kill(); return; @@ -82,11 +82,11 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.ai[1] % 6f == 0f && Projectile.owner == Main.myPlayer) { - Vector2 vector63 = projVector * -1f; - vector63.Normalize(); - vector63 *= (float)Main.rand.Next(45, 65) * 0.1f; - vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); + Vector2 spikeVector = projVector * -1f; + spikeVector.Normalize(); + spikeVector *= (float)Main.rand.Next(45, 65) * 0.1f; + spikeVector = spikeVector.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, spikeVector.X, spikeVector.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); } } @@ -103,35 +103,35 @@ namespace CalamityMod.Projectiles.Melee { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Texture2D texture2D2 = ModContent.Request("CalamityMod/Projectiles/Melee/BallOFuguChain").Value; - Vector2 vector17 = Projectile.Center; + Vector2 projCenter = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + float projHeight = (float)texture2D2.Height; + Vector2 actualCenter = mountedCenter - projCenter; + float drawRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + bool isActive = true; + if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { - flag13 = false; + isActive = false; } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y)) { - flag13 = false; + isActive = false; } - while (flag13) + while (isActive) { - if (vector18.Length() < num91 + 1f) + if (actualCenter.Length() < projHeight + 1f) { - flag13 = false; + isActive = false; } else { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0); + Vector2 drawCenter = actualCenter; + drawCenter.Normalize(); + projCenter += drawCenter * projHeight; + actualCenter = mountedCenter - projCenter; + Color drawArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, drawArea, drawRotation, origin, 1f, SpriteEffects.None, 0); } } return true; diff --git a/Projectiles/Melee/BansheeHookBoom.cs b/Projectiles/Melee/BansheeHookBoom.cs index 27075ae819..81d597f932 100644 --- a/Projectiles/Melee/BansheeHookBoom.cs +++ b/Projectiles/Melee/BansheeHookBoom.cs @@ -40,36 +40,36 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = (int)(52f * Projectile.scale); Projectile.Center = Projectile.position; Projectile.Damage(); - for (int num1000 = 0; num1000 < 2; num1000++) + for (int i = 0; i < 2; i++) { - int num1001 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num1001].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + int bansheeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[bansheeDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; } - for (int num1002 = 0; num1002 < 5; num1002++) + for (int j = 0; j < 5; j++) { - int num1003 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 200, default, 2.7f); - Main.dust[num1003].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].velocity *= 3f; - num1003 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num1003].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num1003].velocity *= 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].fadeIn = 2.5f; + int bansheeDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 200, default, 2.7f); + Main.dust[bansheeDust2].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[bansheeDust2].noGravity = true; + Main.dust[bansheeDust2].velocity *= 3f; + bansheeDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[bansheeDust2].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[bansheeDust2].velocity *= 2f; + Main.dust[bansheeDust2].noGravity = true; + Main.dust[bansheeDust2].fadeIn = 2.5f; } - for (int num1004 = 0; num1004 < 2; num1004++) + for (int k = 0; k < 2; k++) { - int num1005 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.7f); - Main.dust[num1005].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; - Main.dust[num1005].noGravity = true; - Main.dust[num1005].velocity *= 3f; + int bansheeDust3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.7f); + Main.dust[bansheeDust3].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; + Main.dust[bansheeDust3].noGravity = true; + Main.dust[bansheeDust3].velocity *= 3f; } - for (int num1006 = 0; num1006 < 5; num1006++) + for (int l = 0; l < 5; l++) { - int num1007 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 0, default, 1.5f); - Main.dust[num1007].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; - Main.dust[num1007].noGravity = true; - Main.dust[num1007].velocity *= 3f; + int spiritDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 0, default, 1.5f); + Main.dust[spiritDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; + Main.dust[spiritDust].noGravity = true; + Main.dust[spiritDust].velocity *= 3f; } } } diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index 360450cb38..bfa2b4bc7a 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -25,11 +25,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 2; num468++) + for (int i = 0; i < 2; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[blood].noGravity = true; + Main.dust[blood].velocity *= 0f; } } diff --git a/Projectiles/Melee/Blood2.cs b/Projectiles/Melee/Blood2.cs index 52931358fb..41e14a6e26 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 2; num468++) + for (int i = 0; i < 2; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[blood].noGravity = true; + Main.dust[blood].velocity *= 0f; } } diff --git a/Projectiles/Melee/BloodBall.cs b/Projectiles/Melee/BloodBall.cs index 69c5acdb19..89ab005342 100644 --- a/Projectiles/Melee/BloodBall.cs +++ b/Projectiles/Melee/BloodBall.cs @@ -25,36 +25,36 @@ namespace CalamityMod.Projectiles.Melee { try { - int num223 = (int)(Projectile.position.X / 16f) - 1; - int num224 = (int)((Projectile.position.X + (float)Projectile.width) / 16f) + 2; - int num225 = (int)(Projectile.position.Y / 16f) - 1; - int num226 = (int)((Projectile.position.Y + (float)Projectile.height) / 16f) + 2; - if (num223 < 0) + int tileXMin = (int)(Projectile.position.X / 16f) - 1; + int tileXMax = (int)((Projectile.position.X + (float)Projectile.width) / 16f) + 2; + int tileYMin = (int)(Projectile.position.Y / 16f) - 1; + int tileYMax = (int)((Projectile.position.Y + (float)Projectile.height) / 16f) + 2; + if (tileXMin < 0) { - num223 = 0; + tileXMin = 0; } - if (num224 > Main.maxTilesX) + if (tileXMax > Main.maxTilesX) { - num224 = Main.maxTilesX; + tileXMax = Main.maxTilesX; } - if (num225 < 0) + if (tileYMin < 0) { - num225 = 0; + tileYMin = 0; } - if (num226 > Main.maxTilesY) + if (tileYMax > Main.maxTilesY) { - num226 = Main.maxTilesY; + tileYMax = Main.maxTilesY; } - for (int num227 = num223; num227 < num224; num227++) + for (int i = tileXMin; i < tileXMax; i++) { - for (int num228 = num225; num228 < num226; num228++) + for (int j = tileYMin; j < tileYMax; j++) { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0))) + if (Main.tile[i, j] != null && Main.tile[i, j].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[i, j].TileType] || (Main.tileSolidTop[(int)Main.tile[i, j].TileType] && Main.tile[i, j].TileFrameY == 0))) { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (Projectile.position.X + (float)Projectile.width - 4f > vector19.X && Projectile.position.X + 4f < vector19.X + 16f && Projectile.position.Y + (float)Projectile.height - 4f > vector19.Y && Projectile.position.Y + 4f < vector19.Y + 16f) + Vector2 projPos; + projPos.X = (float)(i * 16); + projPos.Y = (float)(j * 16); + if (Projectile.position.X + (float)Projectile.width - 4f > projPos.X && Projectile.position.X + 4f < projPos.X + 16f && Projectile.position.Y + (float)Projectile.height - 4f > projPos.Y && Projectile.position.Y + 4f < projPos.Y + 16f) { Projectile.velocity.X = 0f; Projectile.velocity.Y = -0.2f; @@ -105,18 +105,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 22; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num648 = 0; num648 < 20; num648++) + for (int i = 0; i < 20; i++) { - int num649 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); - Main.dust[num649].velocity *= 1.4f; + int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); + Main.dust[blood].velocity *= 1.4f; } - for (int num650 = 0; num650 < 10; num650++) + for (int j = 0; j < 10; j++) { - int num651 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2.5f); - Main.dust[num651].noGravity = true; - Main.dust[num651].velocity *= 5f; - num651 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); - Main.dust[num651].velocity *= 3f; + int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2.5f); + Main.dust[bloody].noGravity = true; + Main.dust[bloody].velocity *= 5f; + bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); + Main.dust[bloody].velocity *= 3f; } } diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index 42b93f9ce6..c71cbaf998 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -52,8 +52,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num199]; + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[brimDust]; dust.position.X -= 2f; dust.position.Y += 2f; dust.scale += (float)Main.rand.Next(50) * 0.01f; @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Melee dust.velocity.Y -= 4f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Dust dust2 = Main.dust[num200]; + int brimDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Dust dust2 = Main.dust[brimDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; diff --git a/Projectiles/Melee/BrimlanceHellfireExplosion.cs b/Projectiles/Melee/BrimlanceHellfireExplosion.cs index cd69daba96..b040414fa7 100644 --- a/Projectiles/Melee/BrimlanceHellfireExplosion.cs +++ b/Projectiles/Melee/BrimlanceHellfireExplosion.cs @@ -36,60 +36,60 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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 rand1 = (float)Main.rand.Next(-10, 11); + float rand2 = (float)Main.rand.Next(-10, 11); + float rand3 = (float)Main.rand.Next(3, 9); + float randAdjuster = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); + randAdjuster = rand3 / randAdjuster; + rand1 *= randAdjuster; + rand2 *= randAdjuster; + 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 = rand1; + dust.velocity.Y = rand2; + timerCounter++; } } diff --git a/Projectiles/Melee/BrimlanceStandingFire.cs b/Projectiles/Melee/BrimlanceStandingFire.cs index 5a011c9c82..bd898c12e0 100644 --- a/Projectiles/Melee/BrimlanceStandingFire.cs +++ b/Projectiles/Melee/BrimlanceStandingFire.cs @@ -60,25 +60,25 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item13, Projectile.position); } - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[brimDust]; expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; + Dust expr_8994_cp_0 = Main.dust[brimDust]; expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; + Main.dust[brimDust].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[brimDust].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[brimDust]; expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; + int brimDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[brimDust2]; expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; + Dust expr_8A6C_cp_0 = Main.dust[brimDust2]; expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; + Main.dust[brimDust2].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 0.1f; } if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index 2f6f31ea3a..252b5827c5 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -38,10 +38,10 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft < 90) CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 15f); - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 235, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int redderDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 235, 0f, 0f, 100, default, 1f); + Main.dust[redderDust].noGravity = true; + Main.dust[redderDust].velocity *= 0.5f; + Main.dust[redderDust].velocity += Projectile.velocity * 0.1f; } public override Color? GetAlpha(Color lightColor) @@ -61,19 +61,19 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) + int inc; + for (int i = 4; i < 31; i = inc + 1) { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 235, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; + float dustX = Projectile.oldVelocity.X * (30f / (float)i); + float dustY = Projectile.oldVelocity.Y * (30f / (float)i); + int deathDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - dustX, Projectile.oldPosition.Y - dustY), 8, 8, 235, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[deathDust].noGravity = true; + Dust dust = Main.dust[deathDust]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 235, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; + deathDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - dustX, Projectile.oldPosition.Y - dustY), 8, 8, 235, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[deathDust]; dust.velocity *= 0.05f; - num3 = num795; + inc = i; } } diff --git a/Projectiles/Melee/BrimlashProj.cs b/Projectiles/Melee/BrimlashProj.cs index be62d4248d..58f21983d3 100644 --- a/Projectiles/Melee/BrimlashProj.cs +++ b/Projectiles/Melee/BrimlashProj.cs @@ -41,10 +41,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Main.dust[brimDust].noGravity = true; + Main.dust[brimDust].velocity *= 0.5f; + Main.dust[brimDust].velocity += Projectile.velocity * 0.1f; } public override Color? GetAlpha(Color lightColor) @@ -64,19 +64,19 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) + int inc; + for (int i = 4; i < 31; i = inc + 1) { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; + float dustX = Projectile.oldVelocity.X * (30f / (float)i); + float dustY = Projectile.oldVelocity.Y * (30f / (float)i); + int deathDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - dustX, Projectile.oldPosition.Y - dustY), 8, 8, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[deathDust].noGravity = true; + Dust dust = Main.dust[deathDust]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; + deathDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - dustX, Projectile.oldPosition.Y - dustY), 8, 8, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[deathDust]; dust.velocity *= 0.05f; - num3 = num795; + inc = i; } if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index adf103f0b4..9f40aef9c7 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -27,39 +27,39 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); - 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 (num462 < num461) + int timerCounter = 0; + while (timerCounter < projTimer) { - float num463 = Main.rand.Next(-10, 11); - float num464 = Main.rand.Next(-10, 11); - float num465 = Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - 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]; + float rando1 = Main.rand.Next(-10, 11); + float rando2 = Main.rand.Next(-10, 11); + float rando3 = Main.rand.Next(3, 9); + float randoAdjuster = (float)Math.Sqrt(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, 1f); + Main.dust[brimDust].noGravity = true; + Main.dust[brimDust].position.X = Projectile.Center.X; + Main.dust[brimDust].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[brimDust]; expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; + Dust expr_14A09_cp_0 = Main.dust[brimDust]; expr_14A09_cp_0.position.Y += Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; + Main.dust[brimDust].velocity.X = rando1; + Main.dust[brimDust].velocity.Y = rando2; + timerCounter++; } } } diff --git a/Projectiles/Melee/BrimstoneSwordExplosion.cs b/Projectiles/Melee/BrimstoneSwordExplosion.cs index 7ea6d6dac0..4424898918 100644 --- a/Projectiles/Melee/BrimstoneSwordExplosion.cs +++ b/Projectiles/Melee/BrimstoneSwordExplosion.cs @@ -36,60 +36,60 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index 0b0e90ff4e..bd4cbec34a 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -30,11 +30,10 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - int num613 = 16; - int num614 = 16; - float num615 = 1.5f; - int num616 = 150; - int num617 = 42; + int projScale = 32; + float scaleModifier = 1.5f; + int projWidth = 150; + int projHeight = 42; if (Projectile.velocity.X != 0f) { Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); @@ -54,18 +53,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] = 1f; Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); - Projectile.width = (int)((float)num616 * Projectile.scale); - Projectile.height = (int)((float)num617 * Projectile.scale); + Projectile.scale = ((float)(projScale) - Projectile.ai[1]) * scaleModifier / (float)(projScale); + Projectile.width = (int)((float)projWidth * Projectile.scale); + Projectile.height = (int)((float)projHeight * Projectile.scale); Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } if (Projectile.ai[1] != -1f) { - Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); - Projectile.width = (int)((float)num616 * Projectile.scale); - Projectile.height = (int)((float)num617 * Projectile.scale); + Projectile.scale = ((float)(projScale) - Projectile.ai[1]) * scaleModifier / (float)(projScale); + Projectile.width = (int)((float)projWidth * Projectile.scale); + Projectile.height = (int)((float)projHeight * Projectile.scale); } if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { @@ -91,22 +90,22 @@ namespace CalamityMod.Projectiles.Melee { Projectile.netUpdate = true; Vector2 center = Projectile.Center; - center.Y -= (float)num617 * Projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - Projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; + center.Y -= (float)projHeight * Projectile.scale / 2f; + float nextSegment = ((float)(projScale) - Projectile.ai[1] + 1f) * scaleModifier / (float)(projScale); + center.Y -= (float)projHeight * nextSegment / 2f; center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 8f, Projectile.ai[1] - 1f); } 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 = Projectile.position.X - num624 * (float)-(float)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 = Projectile.position.X - projXChange * (float)-(float)Projectile.direction; Projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; - Projectile.position.X = Projectile.position.X + num624 * (float)-(float)Projectile.direction; + projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; + Projectile.position.X = Projectile.position.X + projXChange * (float)-(float)Projectile.direction; } } @@ -118,9 +117,9 @@ namespace CalamityMod.Projectiles.Melee 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/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index 35c621594a..5afc1be218 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -30,23 +30,23 @@ namespace CalamityMod.Projectiles.Melee { 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, 187, value15.X * 2f, value15.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 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 faceDirection = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int bluishDust = Dust.NewDust(dustRotate + faceDirection, 0, 0, 187, faceDirection.X * 2f, faceDirection.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); + Main.dust[bluishDust].noGravity = true; + Main.dust[bluishDust].noLight = true; + Main.dust[bluishDust].velocity /= 4f; + Main.dust[bluishDust].velocity -= Projectile.velocity; } Projectile.alpha -= 5; if (Projectile.alpha < 100) @@ -56,11 +56,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation += Projectile.velocity.X * 0.1f; Projectile.frame = (int)(Projectile.localAI[0] / 3f) % 3; } - 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 playerDirection = Main.player[playerTrack].Center - Projectile.Center; + float projVelocity = 4f; + projVelocity += Projectile.localAI[0] / 20f; + Projectile.velocity = Vector2.Normalize(playerDirection) * projVelocity; + if (playerDirection.Length() < 50f) { Projectile.Kill(); } @@ -68,13 +68,12 @@ namespace CalamityMod.Projectiles.Melee } 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 spoutSway = 0.209439516f; + float spoutSpawn = (float)(Math.Cos((double)(spoutSway * Projectile.ai[0])) - 0.5) * 4f; + Projectile.velocity.Y = Projectile.velocity.Y - spoutSpawn; Projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; - Projectile.velocity.Y = Projectile.velocity.Y + num632; + spoutSpawn = (float)(Math.Cos((double)(spoutSway * Projectile.ai[0])) - 0.5) * 4f; + Projectile.velocity.Y = Projectile.velocity.Y + spoutSpawn; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 10f) { @@ -98,49 +97,49 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item96, Projectile.Center); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int moreDustAmt = 36; + for (int j = 0; j < moreDustAmt; 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, 187, vector7.X * 2f, vector7.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 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)(j - (moreDustAmt / 2 - 1)) * 6.28318548f / (float)moreDustAmt), default) + Projectile.Center; + Vector2 facingDirection = rotate - Projectile.Center; + int killDust = Dust.NewDust(rotate + facingDirection, 0, 0, 187, facingDirection.X * 2f, facingDirection.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); + Main.dust[killDust].noGravity = true; + Main.dust[killDust].noLight = true; + Main.dust[killDust].velocity = facingDirection; } if (Projectile.owner == Main.myPlayer) { - int num330 = (int)(Projectile.Center.Y / 16f); - int num331 = (int)(Projectile.Center.X / 16f); - int num332 = 100; - if (num331 < 10) + int projTileX = (int)(Projectile.Center.Y / 16f); + int projTileY = (int)(Projectile.Center.X / 16f); + int posModifier = 100; + if (projTileY < 10) { - num331 = 10; + projTileY = 10; } - if (num331 > Main.maxTilesX - 10) + if (projTileY > Main.maxTilesX - 10) { - num331 = Main.maxTilesX - 10; + projTileY = Main.maxTilesX - 10; } - if (num330 < 10) + if (projTileX < 10) { - num330 = 10; + projTileX = 10; } - if (num330 > Main.maxTilesY - num332 - 10) + if (projTileX > Main.maxTilesY - posModifier - 10) { - num330 = Main.maxTilesY - num332 - 10; + projTileX = Main.maxTilesY - posModifier - 10; } - for (int num333 = num330; num333 < num330 + num332; num333++) + for (int k = projTileX; k < projTileX + posModifier; k++) { - Tile tile = Main.tile[num331, num333]; + Tile tile = Main.tile[projTileY, k]; if (tile.HasTile && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0)) { - num330 = num333; + projTileX = k; break; } } - int num335 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 6f, Main.myPlayer, 8f, 25f); - Main.projectile[num335].netUpdate = true; + int SPOUT = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 6f, Main.myPlayer, 8f, 25f); + Main.projectile[SPOUT].netUpdate = true; } } } diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 280ab258cb..8185479e74 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -54,26 +54,26 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] = 0f; 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 burntDust = Dust.NewDust(Projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + Main.dust[burntDust].scale = 1.1f; + Main.dust[burntDust].noGravity = true; + Main.dust[burntDust].position = Projectile.Center + dustRotate; + Main.dust[burntDust].velocity = Projectile.velocity * 0.1f; + Main.dust[burntDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[burntDust].position) * 1.25f; } } Projectile.alpha -= 15; - int num58 = 150; + int alphaControl = 150; if (Projectile.Center.Y >= Projectile.ai[1]) { - num58 = 0; + alphaControl = 0; } - if (Projectile.alpha < num58) + if (Projectile.alpha < alphaControl) { - Projectile.alpha = num58; + Projectile.alpha = alphaControl; } Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index b44d07713f..419dc954fe 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -35,26 +35,26 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.ai[1] >= 5f && (Projectile.ai[1] <= 10f)) { - for (int num105 = 0; num105 < 10; num105++) + for (int i = 0; i < 10; i++) { - float num99 = Projectile.velocity.X / 3f * (float)num105; - float num100 = Projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int waterDust = 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(0, 142, 255), 1.5f); + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int dustPos = 4; + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPos, Projectile.position.Y + (float)dustPos), Projectile.width - dustPos * 2, Projectile.height - dustPos * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); Dust waterdust = Main.dust[waterDust]; waterdust.noGravity = true; waterdust.velocity *= 0.1f; waterdust.velocity += Projectile.velocity * 0.1f; - waterdust.position.X -= num99; - waterdust.position.Y -= num100; + waterdust.position.X -= shortXVel; + waterdust.position.Y -= shortYVel; } } if (Projectile.ai[1] == 5f) { Projectile.tileCollide = true; } - Vector2 vector62 = Main.player[Projectile.owner].Center - Projectile.Center; - Projectile.rotation = vector62.ToRotation() - 1.57f; + Vector2 flailDirection = Main.player[Projectile.owner].Center - Projectile.Center; + Projectile.rotation = flailDirection.ToRotation() - 1.57f; if (Main.player[Projectile.owner].dead) { Projectile.Kill(); @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee } Main.player[Projectile.owner].itemAnimation = 10; Main.player[Projectile.owner].itemTime = 10; - if (vector62.X < 0f) + if (flailDirection.X < 0f) { Main.player[Projectile.owner].ChangeDir(1); Projectile.direction = 1; @@ -72,38 +72,38 @@ namespace CalamityMod.Projectiles.Melee Main.player[Projectile.owner].ChangeDir(-1); Projectile.direction = -1; } - Main.player[Projectile.owner].itemRotation = (vector62 * -1f * (float)Projectile.direction).ToRotation(); - Projectile.spriteDirection = (vector62.X > 0f) ? -1 : 1; + Main.player[Projectile.owner].itemRotation = (flailDirection * -1f * (float)Projectile.direction).ToRotation(); + Projectile.spriteDirection = (flailDirection.X > 0f) ? -1 : 1; if (Projectile.ai[1] >= 45f && (Projectile.ai[0] != 1f || Projectile.ai[0] != 2f)) { Projectile.velocity.Y += 1f; Projectile.velocity.X *= 0.995f; Projectile.damage = finalDamage; } - if (Projectile.ai[0] == 0f && vector62.Length() > 1000f) + if (Projectile.ai[0] == 0f && flailDirection.Length() > 1000f) { Projectile.ai[0] = 1f; } if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) { - float num693 = vector62.Length(); - if (num693 > 1500f) + float flailDistance = flailDirection.Length(); + if (flailDistance > 1500f) { Projectile.Kill(); return; } - if (num693 > 600f) + if (flailDistance > 600f) { Projectile.ai[0] = 2f; } Projectile.tileCollide = false; - float num694 = 20f; + float flailSpeed = 20f; if (Projectile.ai[0] == 2f) { - num694 = 40f; + flailSpeed = 40f; } - Projectile.velocity = Vector2.Normalize(vector62) * num694; - if (vector62.Length() < num694) + Projectile.velocity = Vector2.Normalize(flailDirection) * flailSpeed; + if (flailDirection.Length() < flailSpeed) { Projectile.Kill(); return; @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0] = 1f; Projectile.netUpdate = true; SoundEngine.PlaySound(GiantClam.SlamSound, Projectile.position); - for (int num105 = 0; num105 < 50; num105++) + for (int i = 0; i < 50; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int waterDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width / 2, Projectile.height / 2, 33, velocity.X, velocity.Y, 0, new Color(0, 142, 255), 1.5f); @@ -138,35 +138,35 @@ namespace CalamityMod.Projectiles.Melee { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Texture2D texture2D2 = ModContent.Request("CalamityMod/Projectiles/Melee/ClamCrusherChain").Value; - Vector2 vector17 = Projectile.Center; + Vector2 projCenter = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + float projHeight = (float)texture2D2.Height; + Vector2 actualCenter = mountedCenter - projCenter; + float flailRotate = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + bool isActive = true; + if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { - flag13 = false; + isActive = false; } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y)) { - flag13 = false; + isActive = false; } - while (flag13) + while (isActive) { - if (vector18.Length() < num91 + 1f) + if (actualCenter.Length() < projHeight + 1f) { - flag13 = false; + isActive = false; } else { - Vector2 value2 = vector18; + Vector2 value2 = actualCenter; value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0); + projCenter += value2 * projHeight; + actualCenter = mountedCenter - projCenter; + Color colorArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, colorArea, flailRotate, origin, 1f, SpriteEffects.None, 0); } } return true; diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index 4f26b4e4e6..cbdc26cee8 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -43,25 +43,25 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item89, Projectile.position); Projectile.ExpandHitboxBy((int)(128f * Projectile.scale)); - for (int index = 0; index < 8; ++index) + for (int i = 0; i < 8; ++i) Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); - for (int index1 = 0; index1 < 32; ++index1) + for (int j = 0; j < 32; ++j) { - int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f); - Dust dust1 = Main.dust[index2]; + int fieryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f); + Dust dust1 = Main.dust[fieryDust]; dust1.noGravity = true; dust1.velocity *= 3f; - int index3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f); - Dust dust2 = Main.dust[index3]; + int fieryDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f); + Dust dust2 = Main.dust[fieryDust2]; dust2.velocity *= 2f; dust2.noGravity = true; } if (Main.netMode != NetmodeID.Server) { - for (int index1 = 0; index1 < 2; ++index1) + for (int j = 0; j < 2; ++j) { - int index2 = 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, new Vector2(), Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[index2]; + int fieryDust = 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, new Vector2(), Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[fieryDust]; 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; @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.maxPenetrate = 0; Projectile.Damage(); } - for (int index1 = 0; index1 < 5; ++index1) + for (int j = 0; j < 5; ++j) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Utils.SelectRandom(Main.rand, new int[3]{ 6, 259, 158 }), 2.5f * (float) Projectile.direction, -2.5f, 0, new Color(), 1f); - Dust dust1 = Main.dust[index2]; + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Utils.SelectRandom(Main.rand, new int[3]{ 6, 259, 158 }), 2.5f * (float) Projectile.direction, -2.5f, 0, new Color(), 1f); + Dust dust1 = Main.dust[fieryDust]; dust1.alpha = 200; dust1.velocity *= 2.4f; dust1.scale += Main.rand.NextFloat(); diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index bdb194086a..cbb4681399 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -89,8 +89,8 @@ namespace CalamityMod.Projectiles.Melee { return true; } - float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref num8)) + float zero = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref zero)) { return true; } diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 81e7e4e20c..5de6f01074 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -63,36 +63,36 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Projectile.position; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item62, Projectile.position); - for (int num1000 = 0; num1000 < 2; num1000++) + for (int i = 0; i < 2; i++) { - int num1001 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, new Color(150, 255, 255), 1f); - Main.dust[num1001].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + int cosmicDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, new Color(150, 255, 255), 1f); + Main.dust[cosmicDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; } - for (int num1002 = 0; num1002 < 3; num1002++) + for (int j = 0; j < 3; j++) { - int num1003 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 200, new Color(150, 255, 255), 1f); - Main.dust[num1003].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].velocity *= 3f; - num1003 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, new Color(150, 255, 255), 0.6f); - Main.dust[num1003].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num1003].velocity *= 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].fadeIn = 2.5f; + int iceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 200, new Color(150, 255, 255), 1f); + Main.dust[iceDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[iceDust].noGravity = true; + Main.dust[iceDust].velocity *= 3f; + iceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, new Color(150, 255, 255), 0.6f); + Main.dust[iceDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[iceDust].velocity *= 2f; + Main.dust[iceDust].noGravity = true; + Main.dust[iceDust].fadeIn = 2.5f; } - for (int num1004 = 0; num1004 < 2; num1004++) + for (int k = 0; k < 2; k++) { - int num1005 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 0, new Color(150, 255, 255), 1f); - Main.dust[num1005].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; - Main.dust[num1005].noGravity = true; - Main.dust[num1005].velocity *= 3f; + int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 0, new Color(150, 255, 255), 1f); + Main.dust[icyDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; + Main.dust[icyDust].noGravity = true; + Main.dust[icyDust].velocity *= 3f; } - for (int num1006 = 0; num1006 < 3; num1006++) + for (int l = 0; l < 3; l++) { - int num1007 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 0, new Color(150, 255, 255), 0.6f); - Main.dust[num1007].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; - Main.dust[num1007].noGravity = true; - Main.dust[num1007].velocity *= 3f; + int freezeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 0, new Color(150, 255, 255), 0.6f); + Main.dust[freezeDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; + Main.dust[freezeDust].noGravity = true; + Main.dust[freezeDust].velocity *= 3f; } } } @@ -100,16 +100,13 @@ namespace CalamityMod.Projectiles.Melee 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 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)); if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + colorArea = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); } - Vector2 vector42 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D33 = ModContent.Request(Texture).Value; - Rectangle rectangle15 = texture2D33.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin11 = rectangle15.Size() / 2f; + Rectangle rectangl = texture2D33.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); return true; } diff --git a/Projectiles/Melee/CosmicOrb.cs b/Projectiles/Melee/CosmicOrb.cs index 27dc0ee463..d26d6aaea9 100644 --- a/Projectiles/Melee/CosmicOrb.cs +++ b/Projectiles/Melee/CosmicOrb.cs @@ -57,11 +57,11 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item54, Projectile.position); for (int i = 0; i < 10; i++) { - int num192 = (int)(10f * Projectile.scale); - int d = Dust.NewDust(Projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 242, 0f, 0f, 0, default, 1f); + int dustScale = (int)(10f * Projectile.scale); + int d = Dust.NewDust(Projectile.Center - Vector2.One * (float)dustScale, dustScale * 2, dustScale * 2, 242, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[d]; Vector2 offset = Vector2.Normalize(dust.position - Projectile.Center); - dust.position = Projectile.Center + offset * (float)num192 * Projectile.scale; + dust.position = Projectile.Center + offset * (float)dustScale * Projectile.scale; if (i < 30) { dust.velocity = offset * dust.velocity.Length(); diff --git a/Projectiles/Melee/CosmicSpiritBomb1.cs b/Projectiles/Melee/CosmicSpiritBomb1.cs index 8fc061771a..74e36e75d3 100644 --- a/Projectiles/Melee/CosmicSpiritBomb1.cs +++ b/Projectiles/Melee/CosmicSpiritBomb1.cs @@ -23,47 +23,47 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - Projectile.scale = num395 + 0.95f; + float scaleModd = (float)Main.mouseTextColor / 200f - 0.35f; + scaleModd *= 0.2f; + Projectile.scale = scaleModd + 0.95f; - float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (num947 <= 2f) + float projDistance = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; + if (projDistance <= 2f) { - num947 = 1f; + projDistance = 1f; } else { - if (num947 > 8f) + if (projDistance > 8f) { - num947 = 12f; + projDistance = 12f; } - else if (num947 > 6f) + else if (projDistance > 6f) { - num947 = 9f; + projDistance = 9f; } - else if (num947 > 5f) + else if (projDistance > 5f) { - num947 = 7f; + projDistance = 7f; } - else if (num947 > 4f) + else if (projDistance > 4f) { - num947 = 5f; + projDistance = 5f; } - else if (num947 > 3f) + else if (projDistance > 3f) { - num947 = 4f; + projDistance = 4f; } - else if (num947 > 2.5f) + else if (projDistance > 2.5f) { - num947 = 3f; + projDistance = 3f; } else { - num947 = 2f; + projDistance = 2f; } } - Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * num947; + Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * projDistance; Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; } diff --git a/Projectiles/Melee/CosmicSpiritBomb2.cs b/Projectiles/Melee/CosmicSpiritBomb2.cs index a363109413..0635b3f57b 100644 --- a/Projectiles/Melee/CosmicSpiritBomb2.cs +++ b/Projectiles/Melee/CosmicSpiritBomb2.cs @@ -23,47 +23,47 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - Projectile.scale = num395 + 0.95f; + float scaleModd = (float)Main.mouseTextColor / 200f - 0.35f; + scaleModd *= 0.2f; + Projectile.scale = scaleModd + 0.95f; - float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (num947 <= 2f) + float projDistance = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; + if (projDistance <= 2f) { - num947 = 1f; + projDistance = 1f; } else { - if (num947 > 8f) + if (projDistance > 8f) { - num947 = 12f; + projDistance = 12f; } - else if (num947 > 6f) + else if (projDistance > 6f) { - num947 = 9f; + projDistance = 9f; } - else if (num947 > 5f) + else if (projDistance > 5f) { - num947 = 7f; + projDistance = 7f; } - else if (num947 > 4f) + else if (projDistance > 4f) { - num947 = 5f; + projDistance = 5f; } - else if (num947 > 3f) + else if (projDistance > 3f) { - num947 = 4f; + projDistance = 4f; } - else if (num947 > 2.5f) + else if (projDistance > 2.5f) { - num947 = 3f; + projDistance = 3f; } else { - num947 = 2f; + projDistance = 2f; } } - Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * num947; + Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * projDistance; Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; } diff --git a/Projectiles/Melee/CosmicSpiritBomb3.cs b/Projectiles/Melee/CosmicSpiritBomb3.cs index bb97d276a2..f267b25d63 100644 --- a/Projectiles/Melee/CosmicSpiritBomb3.cs +++ b/Projectiles/Melee/CosmicSpiritBomb3.cs @@ -23,47 +23,47 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - Projectile.scale = num395 + 0.95f; + float scaleModd = (float)Main.mouseTextColor / 200f - 0.35f; + scaleModd *= 0.2f; + Projectile.scale = scaleModd + 0.95f; - float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (num947 <= 2f) + float projDistance = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; + if (projDistance <= 2f) { - num947 = 1f; + projDistance = 1f; } else { - if (num947 > 8f) + if (projDistance > 8f) { - num947 = 12f; + projDistance = 12f; } - else if (num947 > 6f) + else if (projDistance > 6f) { - num947 = 9f; + projDistance = 9f; } - else if (num947 > 5f) + else if (projDistance > 5f) { - num947 = 7f; + projDistance = 7f; } - else if (num947 > 4f) + else if (projDistance > 4f) { - num947 = 5f; + projDistance = 5f; } - else if (num947 > 3f) + else if (projDistance > 3f) { - num947 = 4f; + projDistance = 4f; } - else if (num947 > 2.5f) + else if (projDistance > 2.5f) { - num947 = 3f; + projDistance = 3f; } else { - num947 = 2f; + projDistance = 2f; } } - Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * num947; + Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * projDistance; Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; } diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index 8c2f6ecd47..faedfd0d5f 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -242,44 +242,44 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { Vector2 destroyVector = Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE); - int num814 = 3; - int num815 = (int)(destroyVector.X / 16f - num814); - int num816 = (int)(destroyVector.X / 16f + num814); - int num817 = (int)(destroyVector.Y / 16f - num814); - int num818 = (int)(destroyVector.Y / 16f + num814); - if (num815 < 0) + int threeMod = 3; + int mineXLeft = (int)(destroyVector.X / 16f - threeMod); + int mineXRight = (int)(destroyVector.X / 16f + threeMod); + int mineXUp = (int)(destroyVector.Y / 16f - threeMod); + int mineXDown = (int)(destroyVector.Y / 16f + threeMod); + if (mineXLeft < 0) { - num815 = 0; + mineXLeft = 0; } - if (num816 > Main.maxTilesX) + if (mineXRight > Main.maxTilesX) { - num816 = Main.maxTilesX; + mineXRight = Main.maxTilesX; } - if (num817 < 0) + if (mineXUp < 0) { - num817 = 0; + mineXUp = 0; } - if (num818 > Main.maxTilesY) + if (mineXDown > Main.maxTilesY) { - num818 = Main.maxTilesY; + mineXDown = Main.maxTilesY; } AchievementsHelper.CurrentlyMining = true; - for (int num824 = num815; num824 <= num816; num824++) + for (int i = mineXLeft; i <= mineXRight; i++) { - for (int num825 = num817; num825 <= num818; num825++) + for (int j = mineXUp; j <= mineXDown; j++) { - float num826 = Math.Abs(num824 - destroyVector.X / 16f); - float num827 = Math.Abs(num825 - destroyVector.Y / 16f); - double num828 = Math.Sqrt(num826 * num826 + num827 * num827); - if (num828 < num814) + float destroyTileX = Math.Abs(i - destroyVector.X / 16f); + float destroyTileY = Math.Abs(j - destroyVector.Y / 16f); + double destroyTileArea = Math.Sqrt(destroyTileX * destroyTileX + destroyTileY * destroyTileY); + if (destroyTileArea < threeMod) { - if (Main.tile[num824, num825] != null && Main.tile[num824, num825].HasTile) + if (Main.tile[i, j] != null && Main.tile[i, j].HasTile) { - WorldGen.KillTile(num824, num825, false, false, false); + WorldGen.KillTile(i, j, false, false, false); DustExplosion(destroyVector); - if (!Main.tile[num824, num825].HasTile && Main.netMode != NetmodeID.SinglePlayer) + if (!Main.tile[i, j].HasTile && Main.netMode != NetmodeID.SinglePlayer) { - NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, num824, num825, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, i, j, 0f, 0, 0, 0); } } } @@ -291,8 +291,8 @@ namespace CalamityMod.Projectiles.Melee private void DustExplosion(Vector2 vector) { - int num226 = 12; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 12; + for (int k = 0; k < dustAmt; k++) { int dustType = Main.rand.Next(3); switch (dustType) @@ -309,13 +309,13 @@ namespace CalamityMod.Projectiles.Melee default: break; } - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226, default) + vector; - Vector2 vector7 = vector6 - vector; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, dustType, vector7.X * 0.5f, vector7.Y * 0.5f, 100, new Color(Main.DiscoR, 0, 255), 1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((k - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + vector; + Vector2 faceDirection = rotate - vector; + int explosionDust = Dust.NewDust(rotate + faceDirection, 0, 0, dustType, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, new Color(Main.DiscoR, 0, 255), 1f); + Main.dust[explosionDust].noGravity = true; + Main.dust[explosionDust].noLight = true; + Main.dust[explosionDust].velocity = faceDirection; } } } diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index d4b5f8df47..2e6a0a3be3 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -63,20 +63,19 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[1] = 0; } } - float num472 = Projectile.Center.X; - float num473 = Projectile.Center.Y; - float num474 = 600f; - for (int num475 = 0; num475 < Main.maxNPCs; num475++) + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + for (int i = 0; i < Main.maxNPCs; i++) { - NPC npc = Main.npc[num475]; + NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { float npcCenterX = npc.position.X + (float)(npc.width / 2); float npcCenterY = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); - if (num478 < num474) + float npcDistance = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); + if (npcDistance < 600f) { - if (npc.position.X < num472) + if (npc.position.X < projX) { npc.velocity.X += 0.05f; } @@ -84,7 +83,7 @@ namespace CalamityMod.Projectiles.Melee { npc.velocity.X -= 0.05f; } - if (npc.position.Y < num473) + if (npc.position.Y < projY) { npc.velocity.Y += 0.05f; } diff --git a/Projectiles/Melee/DarkBall.cs b/Projectiles/Melee/DarkBall.cs index 150a81ced4..1888333251 100644 --- a/Projectiles/Melee/DarkBall.cs +++ b/Projectiles/Melee/DarkBall.cs @@ -26,36 +26,36 @@ namespace CalamityMod.Projectiles.Melee { try { - int num223 = (int)(Projectile.position.X / 16f) - 1; - int num224 = (int)((Projectile.position.X + (float)Projectile.width) / 16f) + 2; - int num225 = (int)(Projectile.position.Y / 16f) - 1; - int num226 = (int)((Projectile.position.Y + (float)Projectile.height) / 16f) + 2; - if (num223 < 0) + int tileXMin = (int)(Projectile.position.X / 16f) - 1; + int tileXMax = (int)((Projectile.position.X + (float)Projectile.width) / 16f) + 2; + int tileYMin = (int)(Projectile.position.Y / 16f) - 1; + int tileYMax = (int)((Projectile.position.Y + (float)Projectile.height) / 16f) + 2; + if (tileXMin < 0) { - num223 = 0; + tileXMin = 0; } - if (num224 > Main.maxTilesX) + if (tileXMax > Main.maxTilesX) { - num224 = Main.maxTilesX; + tileXMax = Main.maxTilesX; } - if (num225 < 0) + if (tileYMin < 0) { - num225 = 0; + tileYMin = 0; } - if (num226 > Main.maxTilesY) + if (tileYMax > Main.maxTilesY) { - num226 = Main.maxTilesY; + tileYMax = Main.maxTilesY; } - for (int num227 = num223; num227 < num224; num227++) + for (int i = tileXMin; i < tileXMax; i++) { - for (int num228 = num225; num228 < num226; num228++) + for (int j = tileYMin; j < tileYMax; j++) { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0))) + if (Main.tile[i, j] != null && Main.tile[i, j].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[i, j].TileType] || (Main.tileSolidTop[(int)Main.tile[i, j].TileType] && Main.tile[i, j].TileFrameY == 0))) { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (Projectile.position.X + (float)Projectile.width - 4f > vector19.X && Projectile.position.X + 4f < vector19.X + 16f && Projectile.position.Y + (float)Projectile.height - 4f > vector19.Y && Projectile.position.Y + 4f < vector19.Y + 16f) + Vector2 projPos; + projPos.X = (float)(i * 16); + projPos.Y = (float)(j * 16); + if (Projectile.position.X + (float)Projectile.width - 4f > projPos.X && Projectile.position.X + 4f < projPos.X + 16f && Projectile.position.Y + (float)Projectile.height - 4f > projPos.Y && Projectile.position.Y + 4f < projPos.Y + 16f) { Projectile.velocity.X = 0f; Projectile.velocity.Y = -0.2f; @@ -106,18 +106,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 22; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num648 = 0; num648 < 20; num648++) + for (int i = 0; i < 20; i++) { - int num649 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1.5f); - Main.dust[num649].velocity *= 1.4f; + int corruptDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1.5f); + Main.dust[corruptDust].velocity *= 1.4f; } - for (int num650 = 0; num650 < 10; num650++) + for (int j = 0; j < 10; j++) { - int num651 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 2.5f); - Main.dust[num651].noGravity = true; - Main.dust[num651].velocity *= 5f; - num651 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1.5f); - Main.dust[num651].velocity *= 3f; + int corruptDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 2.5f); + Main.dust[corruptDust2].noGravity = true; + Main.dust[corruptDust2].velocity *= 5f; + corruptDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1.5f); + Main.dust[corruptDust2].velocity *= 3f; } } diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index ad3dc3be76..147e922335 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -58,11 +58,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - for (int num105 = 0; num105 < 20; num105++) + for (int i = 0; i < 20; i++) { - int num102 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 0, default, 1f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity += Projectile.velocity * 0.1f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity += Projectile.velocity * 0.1f; } if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Melee/DarkIceZero.cs b/Projectiles/Melee/DarkIceZero.cs index d62ad17a67..8ac81e90c0 100644 --- a/Projectiles/Melee/DarkIceZero.cs +++ b/Projectiles/Melee/DarkIceZero.cs @@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Melee } //make pretty dust - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f); - Main.dust[index2].noGravity = true; + int dustSpawns = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f); + Main.dust[dustSpawns].noGravity = true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -75,15 +75,15 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int i = 0; i < 30; i++) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 4f; + int dustSpawns = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); + Main.dust[dustSpawns].noGravity = true; + Main.dust[dustSpawns].velocity *= 4f; } - for (int index1 = 0; index1 < 20; ++index1) + for (int j = 0; j < 20; ++j) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1.3f); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 1.5f; + int dustSpawns = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1.3f); + Main.dust[dustSpawns].noGravity = true; + Main.dust[dustSpawns].velocity *= 1.5f; } } } diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index 1ab9b9ca49..d76bc5f02c 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -27,10 +27,10 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int waterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.6f); + Main.dust[waterDust].noGravity = true; + Main.dust[waterDust].velocity *= 0.5f; + Main.dust[waterDust].velocity += Projectile.velocity * 0.1f; } public override bool PreDraw(ref Color lightColor) @@ -56,22 +56,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Projectile.position; for (int dustIndex = 0; dustIndex < 30; dustIndex++) { - 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(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); - 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 randoAdjust = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjust = rando3 / randoAdjust; + rando1 *= randoAdjust; + rando2 *= randoAdjust; + int killWaterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[killWaterDust]; 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; + dust.velocity.X = rando1; + dust.velocity.Y = rando2; } Projectile.maxPenetrate = -1; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index dd4bbe8eb3..d1d2ad2813 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -30,10 +30,10 @@ namespace CalamityMod.Projectiles.Melee { Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int waterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[waterDust].noGravity = true; + Main.dust[waterDust].velocity *= 0.5f; + Main.dust[waterDust].velocity += Projectile.velocity * 0.1f; CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } @@ -62,22 +62,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int dustIndex = 0; dustIndex <= 30; dustIndex++) { - 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(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); - 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 randoAdjust = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjust = rando3 / randoAdjust; + rando1 *= randoAdjust; + rando2 *= randoAdjust; + int killWaterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[killWaterDust]; 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; + dust.velocity.X = rando1; + dust.velocity.Y = rando2; } Projectile.maxPenetrate = -1; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index 6f85a670ca..8a418a3c09 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Melee Main.dust[dust].velocity *= 0.3f; Main.dust[dust].noGravity = true; - Vector2 vector2 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float x = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector2.X; - float y = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector2.Y; + Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float x = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - projDirection.X; + float y = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - projDirection.Y; float distanceFromOwner = (float)Math.Sqrt((double)(x * x + y * y)); float speed = 25f; @@ -104,8 +104,8 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Projectile.owner) { Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); - if (rectangle.Intersects(value2)) + Rectangle playerPos = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); + if (rectangle.Intersects(playerPos)) Projectile.Kill(); } } @@ -113,72 +113,72 @@ namespace CalamityMod.Projectiles.Melee { if (Main.player[Projectile.owner].channel) { - 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; + Vector2 projTravel = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float mouseDestX = (float)Main.mouseX + Main.screenPosition.X - projTravel.X; + float mouseDestY = (float)Main.mouseY + Main.screenPosition.Y - projTravel.Y; if (Main.player[Projectile.owner].gravDir == -1f) - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; + mouseDestY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projTravel.Y; if (Projectile.ai[0] < 0f) Projectile.ai[0] += 1f; - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (num118 > speed) + float mouseDistance = (float)Math.Sqrt((double)(mouseDestX * mouseDestX + mouseDestY * mouseDestY)); + mouseDistance = (float)Math.Sqrt((double)(mouseDestX * mouseDestX + mouseDestY * mouseDestY)); + if (mouseDistance > speed) { - num118 = speed / 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); + mouseDistance = speed / mouseDistance; + mouseDestX *= mouseDistance; + mouseDestY *= mouseDistance; + int projMouseSpeedX = (int)(mouseDestX * 1000f); + int projMouseSpeedXVel = (int)(Projectile.velocity.X * 1000f); + int projMouseSpeedY = (int)(mouseDestY * 1000f); + int projMouseSpeedYVel = (int)(Projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) + if (projMouseSpeedX != projMouseSpeedXVel || projMouseSpeedY != projMouseSpeedYVel) Projectile.netUpdate = true; - Projectile.velocity.X = num116; - Projectile.velocity.Y = num117; + Projectile.velocity.X = mouseDestX; + Projectile.velocity.Y = mouseDestY; } 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); + int projMouseSpeedyX = (int)(mouseDestX * 1000f); + int projMouseSpeedyXVel = (int)(Projectile.velocity.X * 1000f); + int projMouseSpeedyY = (int)(mouseDestY * 1000f); + int projMouseSpeedyYVel = (int)(Projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) + if (projMouseSpeedyX != projMouseSpeedyXVel || projMouseSpeedyY != projMouseSpeedyYVel) Projectile.netUpdate = true; - Projectile.velocity.X = num116; - Projectile.velocity.Y = num117; + Projectile.velocity.X = mouseDestX; + Projectile.velocity.Y = mouseDestY; } } else if (Projectile.ai[0] <= 0f) { Projectile.netUpdate = true; - 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 projDirect = 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 - projDirect.X; + float miceY = (float)Main.mouseY + Main.screenPosition.Y - projDirect.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 - projDirect.Y; - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || Projectile.ai[0] < 0f) + float miceDistancing = (float)Math.Sqrt((double)(miceX * miceX + miceY * miceY)); + if (miceDistancing == 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)); + projDirect = 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 - projDirect.X; + miceY = Projectile.position.Y + (float)Projectile.height * 0.5f - projDirect.Y; + miceDistancing = (float)Math.Sqrt((double)(miceX * miceX + miceY * miceY)); } - num130 = speed / num130; - num128 *= num130; - num129 *= num130; - Projectile.velocity.X = num128; - Projectile.velocity.Y = num129; + miceDistancing = speed / miceDistancing; + miceX *= miceDistancing; + miceY *= miceDistancing; + Projectile.velocity.X = miceX; + Projectile.velocity.Y = miceY; if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) Projectile.Kill(); @@ -210,16 +210,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = 64; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - 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, 66, vector7.X, vector7.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); - 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 cycloneDust = Dust.NewDust(rotate + faceDirection, 0, 0, 66, faceDirection.X, faceDirection.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + Main.dust[cycloneDust].noGravity = true; + Main.dust[cycloneDust].noLight = true; + Main.dust[cycloneDust].velocity = faceDirection; } Projectile.Damage(); } diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index b0556cf518..4f05159cff 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -47,11 +47,11 @@ namespace CalamityMod.Projectiles.Melee red = 255; Player player = Main.player[Projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float pi = 0f; + Vector2 playerRotate = player.RotatedRelativePoint(player.MountedCenter, true); if (Projectile.spriteDirection == -1) - num = 3.14159274f; + pi = 3.14159274f; if (++Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; @@ -72,33 +72,33 @@ namespace CalamityMod.Projectiles.Melee if (player.ActiveItem().shoot == Projectile.type) scaleFactor6 = player.ActiveItem().shootSpeed * Projectile.scale; - Vector2 vector13 = Main.MouseWorld - vector; - vector13.Normalize(); - if (vector13.HasNaNs()) - vector13 = Vector2.UnitX * (float)player.direction; + Vector2 slashDirection = Main.MouseWorld - playerRotate; + slashDirection.Normalize(); + if (slashDirection.HasNaNs()) + slashDirection = Vector2.UnitX * (float)player.direction; - vector13 *= scaleFactor6; - if (vector13.X != Projectile.velocity.X || vector13.Y != Projectile.velocity.Y) + slashDirection *= scaleFactor6; + if (slashDirection.X != Projectile.velocity.X || slashDirection.Y != Projectile.velocity.Y) Projectile.netUpdate = true; - Projectile.velocity = vector13; + Projectile.velocity = slashDirection; } else Projectile.Kill(); } - Vector2 vector14 = Projectile.Center + Projectile.velocity * 3f; - Lighting.AddLight(vector14, (float)((double)red * 0.001), 0.1f, 0.1f); + Vector2 dustSpawn = Projectile.Center + Projectile.velocity * 3f; + Lighting.AddLight(dustSpawn, (float)((double)red * 0.001), 0.1f, 0.1f); if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(vector14 - Projectile.Size / 2f, Projectile.width, Projectile.height, 66, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + int dust = Dust.NewDust(dustSpawn - Projectile.Size / 2f, Projectile.width, Projectile.height, 66, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); Main.dust[dust].noGravity = true; Main.dust[dust].position -= Projectile.velocity; } Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.rotation = Projectile.velocity.ToRotation() + pi; Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; player.ChangeDir(Projectile.direction); diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index de9251d9eb..cdb81fb540 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -74,14 +74,14 @@ namespace CalamityMod.Projectiles.Melee private void SpawnDust(Player player, int direction) { - float num12 = Projectile.rotation - MathHelper.PiOver4 * direction; - Vector2 value3 = Projectile.Center + (num12 + ((direction == -1) ? MathHelper.Pi : 0f)).ToRotationVector2() * 30f; - Vector2 vector2 = num12.ToRotationVector2(); - Vector2 value4 = vector2.RotatedBy(MathHelper.PiOver2 * Projectile.spriteDirection); + float rotateDirection = Projectile.rotation - MathHelper.PiOver4 * direction; + Vector2 dustSpawn = Projectile.Center + (rotateDirection + ((direction == -1) ? MathHelper.Pi : 0f)).ToRotationVector2() * 30f; + Vector2 staffTipDirection = rotateDirection.ToRotationVector2(); + Vector2 tipDustDirection = staffTipDirection.RotatedBy(MathHelper.PiOver2 * Projectile.spriteDirection); if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustDirect(value3 - new Vector2(5f), 10, 10, 244, player.velocity.X, player.velocity.Y, 150, default, 1f); + Dust dust = Dust.NewDustDirect(dustSpawn - new Vector2(5f), 10, 10, 244, player.velocity.X, player.velocity.Y, 150, default, 1f); dust.velocity = Projectile.SafeDirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f; } for (int j = 0; j < 4; j++) @@ -105,8 +105,8 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.Next(6) != 0) { Dust dust = Dust.NewDustDirect(Projectile.position, 0, 0, 244, 0f, 0f, 100, default, 1f); - dust.position = Projectile.Center + vector2 * (60f + Main.rand.NextFloat() * 20f) * dustVelMult2; - dust.velocity = value4 * (4f + 4f * Main.rand.NextFloat()) * dustVelMult2 * dustVelMult; + dust.position = Projectile.Center + staffTipDirection * (60f + Main.rand.NextFloat() * 20f) * dustVelMult2; + dust.velocity = tipDustDirection * (4f + 4f * Main.rand.NextFloat()) * dustVelMult2 * dustVelMult; dust.noGravity = true; dust.noLight = true; dust.scale = 0.5f; @@ -228,10 +228,10 @@ namespace CalamityMod.Projectiles.Melee public override void CutTiles() { - float num5 = 60f; - float f = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); + float staffRadius = 60f; + float spinning = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Utils.PlotTileLine(Projectile.Center + f.ToRotationVector2() * -num5, Projectile.Center + f.ToRotationVector2() * num5, (float)Projectile.width * Projectile.scale, DelegateMethods.CutTiles); + Utils.PlotTileLine(Projectile.Center + spinning.ToRotationVector2() * -staffRadius, Projectile.Center + spinning.ToRotationVector2() * staffRadius, (float)Projectile.width * Projectile.scale, DelegateMethods.CutTiles); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -240,10 +240,9 @@ namespace CalamityMod.Projectiles.Melee { return true; } - float f = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); - float num2 = 0f; - float num3 = 110f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + f.ToRotationVector2() * -num3, Projectile.Center + f.ToRotationVector2() * num3, 23f * Projectile.scale, ref num2)) + float spinning = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); + float staffRadiusHit = 110f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + spinning.ToRotationVector2() * -staffRadiusHit, Projectile.Center + spinning.ToRotationVector2() * staffRadiusHit, 23f * Projectile.scale, ref 0f)) { return true; } diff --git a/Projectiles/Melee/Earth2.cs b/Projectiles/Melee/Earth2.cs index 3c029c65ea..6ad47c4d86 100644 --- a/Projectiles/Melee/Earth2.cs +++ b/Projectiles/Melee/Earth2.cs @@ -42,29 +42,29 @@ namespace CalamityMod.Projectiles.Melee } } Projectile.alpha -= 15; - int num58 = 150; + int alphaControl = 150; if (Projectile.Center.Y >= Projectile.ai[1]) { - num58 = 0; + alphaControl = 0; } - if (Projectile.alpha < num58) + if (Projectile.alpha < alphaControl) { - Projectile.alpha = num58; + Projectile.alpha = alphaControl; } Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int greenishDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[greenishDust].velocity = dustDirection * 0.66f; + Main.dust[greenishDust].position = Projectile.Center + dustDirection * 12f; } if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) { - int num60 = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += Projectile.velocity * 0.3f; + int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[gored].velocity *= 0.66f; + Main.gore[gored].velocity += Projectile.velocity * 0.3f; } if (Projectile.ai[1] == 1f) { diff --git a/Projectiles/Melee/Earth3.cs b/Projectiles/Melee/Earth3.cs index 762508caf7..60691b5e4e 100644 --- a/Projectiles/Melee/Earth3.cs +++ b/Projectiles/Melee/Earth3.cs @@ -42,29 +42,29 @@ namespace CalamityMod.Projectiles.Melee } } Projectile.alpha -= 15; - int num58 = 150; + int alphaControl = 150; if (Projectile.Center.Y >= Projectile.ai[1]) { - num58 = 0; + alphaControl = 0; } - if (Projectile.alpha < num58) + if (Projectile.alpha < alphaControl) { - Projectile.alpha = num58; + Projectile.alpha = alphaControl; } Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int brownDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[brownDust].velocity = dustDirection * 0.66f; + Main.dust[brownDust].position = Projectile.Center + dustDirection * 12f; } if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) { - int num60 = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += Projectile.velocity * 0.3f; + int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[gored].velocity *= 0.66f; + Main.gore[gored].velocity += Projectile.velocity * 0.3f; } if (Projectile.ai[1] == 1f) { @@ -90,23 +90,23 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 30; 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(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dusty].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[dusty].scale = 0.5f; + Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 35; num623++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[dusty2].noGravity = true; + Main.dust[dusty2].velocity *= 5f; + dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[dusty2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index e69957deb6..3f6f3696ec 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -42,29 +42,29 @@ namespace CalamityMod.Projectiles.Melee } } Projectile.alpha -= 15; - int num58 = 150; + int alphaControl = 150; if (Projectile.Center.Y >= Projectile.ai[1]) { - num58 = 0; + alphaControl = 0; } - if (Projectile.alpha < num58) + if (Projectile.alpha < alphaControl) { - Projectile.alpha = num58; + Projectile.alpha = alphaControl; } Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 74, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int brightGreenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 74, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[brightGreenDust].velocity = dustDirection * 0.66f; + Main.dust[brightGreenDust].position = Projectile.Center + dustDirection * 12f; } if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) { - int num60 = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += Projectile.velocity * 0.3f; + int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[gored].velocity *= 0.66f; + Main.gore[gored].velocity += Projectile.velocity * 0.3f; } if (Projectile.ai[1] == 1f) { diff --git a/Projectiles/Melee/EarthProj.cs b/Projectiles/Melee/EarthProj.cs index 463be63f40..204ba36e80 100644 --- a/Projectiles/Melee/EarthProj.cs +++ b/Projectiles/Melee/EarthProj.cs @@ -42,14 +42,14 @@ namespace CalamityMod.Projectiles.Melee } } Projectile.alpha -= 15; - int num58 = 150; + int alphaControl = 150; if (Projectile.Center.Y >= Projectile.ai[1]) { - num58 = 0; + alphaControl = 0; } - if (Projectile.alpha < num58) + if (Projectile.alpha < alphaControl) { - Projectile.alpha = num58; + Projectile.alpha = alphaControl; } Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; @@ -68,16 +68,16 @@ namespace CalamityMod.Projectiles.Melee } if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int dustOnHit = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[dustOnHit].velocity = dustDirection * 0.66f; + Main.dust[dustOnHit].position = Projectile.Center + dustDirection * 12f; } if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) { - int num60 = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += Projectile.velocity * 0.3f; + int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[gored].velocity *= 0.66f; + Main.gore[gored].velocity += Projectile.velocity * 0.3f; } if (Projectile.ai[1] == 1f) { diff --git a/Projectiles/Melee/ElementBall.cs b/Projectiles/Melee/ElementBall.cs index e278e8b033..86233f22be 100644 --- a/Projectiles/Melee/ElementBall.cs +++ b/Projectiles/Melee/ElementBall.cs @@ -23,9 +23,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - int num250 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; + int rainbowDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[rainbowDust].noGravity = true; + Main.dust[rainbowDust].velocity *= 0f; CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index f8deb094e6..b37700d8f2 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -67,12 +67,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - for (int num303 = 0; num303 < 3; num303++) + for (int i = 0; i < 3; i++) { - int num304 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 58, 0f, 0f, 100, default, 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= Projectile.oldVelocity * 0.3f; + int empyreanDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 58, 0f, 0f, 100, default, 0.8f); + Main.dust[empyreanDust].noGravity = true; + Main.dust[empyreanDust].velocity *= 1.2f; + Main.dust[empyreanDust].velocity -= Projectile.oldVelocity * 0.3f; } } diff --git a/Projectiles/Melee/EntropicFlechette.cs b/Projectiles/Melee/EntropicFlechette.cs index 930b11bbd1..f598ca5a90 100644 --- a/Projectiles/Melee/EntropicFlechette.cs +++ b/Projectiles/Melee/EntropicFlechette.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation(); - Vector2 value7 = new Vector2(6f, 12f); + Vector2 rotateVector = new Vector2(6f, 12f); Projectile.localAI[0] += 1f; if (Projectile.localAI[0] == 48f) { @@ -35,20 +35,20 @@ namespace CalamityMod.Projectiles.Melee } else { - for (int num41 = 0; num41 < 2; num41++) + for (int i = 0; i < 2; i++) { - Vector2 value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = 1f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; + Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; + int darkDust = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + Main.dust[darkDust].scale = 1f; + Main.dust[darkDust].noGravity = true; + Main.dust[darkDust].position = Projectile.Center + dustRotate; + Main.dust[darkDust].velocity = Projectile.velocity; } } - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0f; + int darkestDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); + Main.dust[darkestDust].noGravity = true; + Main.dust[darkestDust].velocity *= 0f; CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } diff --git a/Projectiles/Melee/EntropicFlechetteLarge.cs b/Projectiles/Melee/EntropicFlechetteLarge.cs index d7ac15d055..08aa4c6067 100644 --- a/Projectiles/Melee/EntropicFlechetteLarge.cs +++ b/Projectiles/Melee/EntropicFlechetteLarge.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation(); - Vector2 value7 = new Vector2(6f, 12f); + Vector2 rotateVector = new Vector2(6f, 12f); Projectile.localAI[0] += 1f; if (Projectile.localAI[0] == 48f) { @@ -35,20 +35,20 @@ namespace CalamityMod.Projectiles.Melee } else { - for (int num41 = 0; num41 < 2; num41++) + for (int i = 0; i < 2; i++) { - Vector2 value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = 1f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; + Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; + int darkDust = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + Main.dust[darkDust].scale = 1f; + Main.dust[darkDust].noGravity = true; + Main.dust[darkDust].position = Projectile.Center + dustRotate; + Main.dust[darkDust].velocity = Projectile.velocity; } } - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0f; + int darkestDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); + Main.dust[darkestDust].noGravity = true; + Main.dust[darkestDust].velocity *= 0f; CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } diff --git a/Projectiles/Melee/EntropicFlechetteSmall.cs b/Projectiles/Melee/EntropicFlechetteSmall.cs index 533c708ced..1396ebc85d 100644 --- a/Projectiles/Melee/EntropicFlechetteSmall.cs +++ b/Projectiles/Melee/EntropicFlechetteSmall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation(); - Vector2 value7 = new Vector2(6f, 12f); + Vector2 rotateVector = new Vector2(6f, 12f); Projectile.localAI[0] += 1f; if (Projectile.localAI[0] == 48f) { @@ -35,20 +35,20 @@ namespace CalamityMod.Projectiles.Melee } else { - for (int num41 = 0; num41 < 2; num41++) + for (int i = 0; i < 2; i++) { - Vector2 value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = 1f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; + Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; + int darkDust = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + Main.dust[darkDust].scale = 1f; + Main.dust[darkDust].noGravity = true; + Main.dust[darkDust].position = Projectile.Center + dustRotate; + Main.dust[darkDust].velocity = Projectile.velocity; } } - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0f; + int darkestDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); + Main.dust[darkestDust].noGravity = true; + Main.dust[darkestDust].velocity *= 0f; CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } diff --git a/Projectiles/Melee/EssenceFlame2.cs b/Projectiles/Melee/EssenceFlame2.cs index adb3c0b4d2..16bc0d9c17 100644 --- a/Projectiles/Melee/EssenceFlame2.cs +++ b/Projectiles/Melee/EssenceFlame2.cs @@ -56,23 +56,23 @@ namespace CalamityMod.Projectiles.Melee 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 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int essenceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[essenceDust].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[essenceDust].scale = 0.5f; + Main.dust[essenceDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 8; num623++) + for (int j = 0; j < 8; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int essenceDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[essenceDust2].noGravity = true; + Main.dust[essenceDust2].velocity *= 5f; + essenceDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[essenceDust2].velocity *= 2f; } } } diff --git a/Projectiles/Melee/EutrophicSpark.cs b/Projectiles/Melee/EutrophicSpark.cs index dbc92223f8..7dd42bd447 100644 --- a/Projectiles/Melee/EutrophicSpark.cs +++ b/Projectiles/Melee/EutrophicSpark.cs @@ -50,25 +50,25 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; + int eutrophicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[eutrophicDust]; expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; + Dust expr_8994_cp_0 = Main.dust[eutrophicDust]; expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; + Main.dust[eutrophicDust].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[eutrophicDust].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[eutrophicDust]; expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; + int eutrophicDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[eutrophicDust2]; expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; + Dust expr_8A6C_cp_0 = Main.dust[eutrophicDust2]; expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; + Main.dust[eutrophicDust2].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[eutrophicDust2].noGravity = true; + Main.dust[eutrophicDust2].velocity *= 0.1f; } if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index d2aa0ed6b9..0caae195ec 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -53,11 +53,11 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.alpha < 40) { - int num309 = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num309].velocity *= -0.25f; - num309 = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num309].velocity *= -0.25f; - Main.dust[num309].position -= Projectile.velocity * 0.5f; + int exo = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + Main.dust[exo].velocity *= -0.25f; + exo = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + Main.dust[exo].velocity *= -0.25f; + Main.dust[exo].position -= Projectile.velocity * 0.5f; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -68,15 +68,14 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 12f, 20f); else { - float num953 = 100f * Projectile.ai[1]; - float scaleFactor12 = 20f * Projectile.ai[1]; - float num954 = 40f; + float projVelocity = 100f * Projectile.ai[1]; + float scaleFactor = 20f * Projectile.ai[1]; 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) > 40f) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Projectile.velocity = (Projectile.velocity * (projVelocity - 1f) + moveDirection * scaleFactor) / projVelocity; } } } @@ -134,18 +133,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = 80; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 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, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int exoDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[exoDust].noGravity = true; + Main.dust[exoDust].velocity *= 3f; + exoDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[exoDust].velocity *= 2f; + Main.dust[exoDust].noGravity = true; } } } diff --git a/Projectiles/Melee/Feather.cs b/Projectiles/Melee/Feather.cs index ccfb5db8e1..46df7b87bf 100644 --- a/Projectiles/Melee/Feather.cs +++ b/Projectiles/Melee/Feather.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - int num3; - for (int num611 = 0; num611 < 10; num611 = num3 + 1) + int inc; + for (int i = 0; i < 10; i = inc + 1) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 64, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); - num3 = num611; + inc = i; } } } diff --git a/Projectiles/Melee/Flarefrost.cs b/Projectiles/Melee/Flarefrost.cs index 51dacd41ca..eece894ca7 100644 --- a/Projectiles/Melee/Flarefrost.cs +++ b/Projectiles/Melee/Flarefrost.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Vector2 value7 = new Vector2(5f, 10f); + Vector2 rotateVector = new Vector2(5f, 10f); Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0.25f); Projectile.localAI[0] += 1f; if (Projectile.localAI[0] == 48f) @@ -33,19 +33,19 @@ namespace CalamityMod.Projectiles.Melee } else { - for (int num41 = 0; num41 < 2; num41++) + for (int i = 0; i < 2; i++) { - int dustType = num41 == 0 ? 67 : 174; - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = dustType == 67 ? 1.5f : 1f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0f; + int dustType = i == 0 ? 67 : 174; + Vector2 dustRotate = Vector2.UnitX * -12f; + dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; + int flarefrost = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + Main.dust[flarefrost].scale = dustType == 67 ? 1.5f : 1f; + Main.dust[flarefrost].noGravity = true; + Main.dust[flarefrost].position = Projectile.Center + dustRotate; + Main.dust[flarefrost].velocity = Projectile.velocity; + int frostflare = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Main.dust[frostflare].noGravity = true; + Main.dust[frostflare].velocity *= 0f; } } diff --git a/Projectiles/Melee/GaelExplosion.cs b/Projectiles/Melee/GaelExplosion.cs index 65dc01c2b5..0ce3b94ef1 100644 --- a/Projectiles/Melee/GaelExplosion.cs +++ b/Projectiles/Melee/GaelExplosion.cs @@ -35,61 +35,61 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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, 218, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = Projectile.Center.X; - Main.dust[num467].position.Y = Projectile.Center.Y; - 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 gaelDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[gaelDust].noGravity = true; + Main.dust[gaelDust].position.X = Projectile.Center.X; + Main.dust[gaelDust].position.Y = Projectile.Center.Y; + Dust dust = Main.dust[gaelDust]; dust.position.X += (float)Main.rand.Next(-10, 11); - dust = Main.dust[num467]; + dust = Main.dust[gaelDust]; dust.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; + Main.dust[gaelDust].velocity.X = rando1; + Main.dust[gaelDust].velocity.Y = rando2; + timerCounter++; } } } diff --git a/Projectiles/Melee/GalacticaComet.cs b/Projectiles/Melee/GalacticaComet.cs index 7a939a2234..159797a916 100644 --- a/Projectiles/Melee/GalacticaComet.cs +++ b/Projectiles/Melee/GalacticaComet.cs @@ -51,39 +51,39 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); - int num9 = Dust.NewDust(Projectile.Center, 0, 0, Main.rand.NextBool() ? 164 : 229, 0f, 0f, 160, default, 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 * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); + dustRotate = dustRotate.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); + int galactic = Dust.NewDust(Projectile.Center, 0, 0, Main.rand.NextBool() ? 164 : 229, 0f, 0f, 160, default, 1f); + Main.dust[galactic].noGravity = true; + Main.dust[galactic].position = Projectile.Center + dustRotate; + Main.dust[galactic].velocity = Projectile.velocity * 0.1f; + Main.dust[galactic].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[galactic].position) * 1.25f; } } Projectile.alpha -= 15; - int num58 = 150; + int alphaControl = 150; if (Projectile.Center.Y >= Projectile.ai[1]) - num58 = 0; - if (Projectile.alpha < num58) - Projectile.alpha = num58; + alphaControl = 0; + if (Projectile.alpha < alphaControl) + Projectile.alpha = alphaControl; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 164, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + Vector2 rotation = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int pinkDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 164, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); + Main.dust[pinkDust].velocity = rotation * 0.66f; + Main.dust[pinkDust].position = Projectile.Center + rotation * 12f; } if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) { - int num60 = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += Projectile.velocity * 0.3f; + int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[gored].velocity *= 0.66f; + Main.gore[gored].velocity += Projectile.velocity * 0.3f; } if (Projectile.ai[1] == 1f) @@ -120,18 +120,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = 68; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - 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, 164, 0f, 0f, 50, default, 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 0, default, 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, 229, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int galaxyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 0, default, 2.5f); + Main.dust[galaxyDust].noGravity = true; + Main.dust[galaxyDust].velocity *= 3f; + galaxyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 50, default, 1.5f); + Main.dust[galaxyDust].velocity *= 2f; + Main.dust[galaxyDust].noGravity = true; } Projectile.maxPenetrate = -1; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/GalaxyBlast.cs b/Projectiles/Melee/GalaxyBlast.cs index 20dffd4f3c..fffe60486e 100644 --- a/Projectiles/Melee/GalaxyBlast.cs +++ b/Projectiles/Melee/GalaxyBlast.cs @@ -40,14 +40,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); return; } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f)]; - dust6.position = Projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) + bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + Dust blastDust = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f)]; + blastDust.position = Projectile.Center; + blastDust.velocity = Vector2.Zero; + blastDust.noGravity = true; + if (isInTile) { - dust6.noLight = true; + blastDust.noLight = true; } if (Projectile.ai[1] == -1f) { @@ -77,22 +77,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; if (Projectile.numUpdates == 0) { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < Main.maxNPCs; num160++) + int npcTracker = -1; + float homingRange = 60f; + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC = Main.npc[num160]; + NPC nPC = Main.npc[i]; if (nPC.CanBeChasedBy(Projectile, false)) { - float num161 = Projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) + float npcDistance = Projectile.Distance(nPC.Center); + if (npcDistance < homingRange && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) { - num159 = num161; - num158 = num160; + homingRange = npcDistance; + npcTracker = i; } } } - if (num158 != -1) + if (npcTracker != -1) { Projectile.ai[0] = 0f; Projectile.ai[1] = -1f; @@ -104,26 +104,26 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + bool insideTile = 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 killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 2.5f); + Main.dust[killingPeople].noGravity = true; + Main.dust[killingPeople].velocity *= 3f; + if (insideTile) { - Main.dust[num10].noLight = true; + Main.dust[killingPeople].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) + killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Main.dust[killingPeople].velocity *= 2f; + Main.dust[killingPeople].noGravity = true; + if (insideTile) { - Main.dust[num10].noLight = true; + Main.dust[killingPeople].noLight = true; } } } diff --git a/Projectiles/Melee/GalaxyBlastType2.cs b/Projectiles/Melee/GalaxyBlastType2.cs index cdd2f8a31e..d48506f7bc 100644 --- a/Projectiles/Melee/GalaxyBlastType2.cs +++ b/Projectiles/Melee/GalaxyBlastType2.cs @@ -41,14 +41,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); return; } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f)]; - dust6.position = Projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) + bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + Dust blastDust = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f)]; + blastDust.position = Projectile.Center; + blastDust.velocity = Vector2.Zero; + blastDust.noGravity = true; + if (isInTile) { - dust6.noLight = true; + blastDust.noLight = true; } if (Projectile.ai[1] == -1f) { @@ -78,22 +78,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; if (Projectile.numUpdates == 0) { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < Main.maxNPCs; num160++) + int npcTracker = -1; + float homingRange = 60f; + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC = Main.npc[num160]; + NPC nPC = Main.npc[i]; if (nPC.CanBeChasedBy(Projectile, false)) { - float num161 = Projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) + float npcDistance = Projectile.Distance(nPC.Center); + if (npcDistance < homingRange && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) { - num159 = num161; - num158 = num160; + homingRange = npcDistance; + npcTracker = i; } } } - if (num158 != -1) + if (npcTracker != -1) { Projectile.ai[0] = 0f; Projectile.ai[1] = -1f; @@ -105,26 +105,26 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + bool insideTile = 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, (int)CalamityDusts.Brimstone, 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, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) + int killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 2.5f); + Main.dust[killingPeople].noGravity = true; + Main.dust[killingPeople].velocity *= 3f; + if (insideTile) { - Main.dust[num10].noLight = true; + Main.dust[killingPeople].noLight = true; } - num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) + killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + Main.dust[killingPeople].velocity *= 2f; + Main.dust[killingPeople].noGravity = true; + if (insideTile) { - Main.dust[num10].noLight = true; + Main.dust[killingPeople].noLight = true; } } } diff --git a/Projectiles/Melee/GalaxyBlastType3.cs b/Projectiles/Melee/GalaxyBlastType3.cs index faeee31dc1..42903a8258 100644 --- a/Projectiles/Melee/GalaxyBlastType3.cs +++ b/Projectiles/Melee/GalaxyBlastType3.cs @@ -40,14 +40,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); return; } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, 1f)]; - dust6.position = Projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) + bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + Dust blastDust = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, 1f)]; + blastDust.position = Projectile.Center; + blastDust.velocity = Vector2.Zero; + blastDust.noGravity = true; + if (isInTile) { - dust6.noLight = true; + blastDust.noLight = true; } if (Projectile.ai[1] == -1f) { @@ -77,22 +77,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; if (Projectile.numUpdates == 0) { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < Main.maxNPCs; num160++) + int npcTracker = -1; + float homingRange = 60f; + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC = Main.npc[num160]; + NPC nPC = Main.npc[i]; if (nPC.CanBeChasedBy(Projectile, false)) { - float num161 = Projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) + float npcDistance = Projectile.Distance(nPC.Center); + if (npcDistance < homingRange && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) { - num159 = num161; - num158 = num160; + homingRange = npcDistance; + npcTracker = i; } } } - if (num158 != -1) + if (npcTracker != -1) { Projectile.ai[0] = 0f; Projectile.ai[1] = -1f; @@ -111,19 +111,19 @@ namespace CalamityMod.Projectiles.Melee } for (int n = 0; n < 4; n++) { - int num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; + int killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, 2.5f); + Main.dust[killingPeople].noGravity = true; + Main.dust[killingPeople].velocity *= 3f; if (flag) { - Main.dust[num10].noLight = true; + Main.dust[killingPeople].noLight = true; } - num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; + killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 100, default, 1.5f); + Main.dust[killingPeople].velocity *= 2f; + Main.dust[killingPeople].noGravity = true; if (flag) { - Main.dust[num10].noLight = true; + Main.dust[killingPeople].noLight = true; } } } diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index df5965c35d..fdb5102f85 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -103,30 +103,30 @@ namespace CalamityMod.Projectiles.Melee for (int x = 1; x <= 3; x++) { - int num20 = 36; - for (int i = 0; i < num20; i++) + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) { Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f * 0.5f; - spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + Projectile.Center; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default(Vector2)) + Projectile.Center; Vector2 vector = spinningpoint - Projectile.Center; - int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); - Main.dust[num21].noGravity = true; - Main.dust[num21].velocity = Vector2.Normalize(vector) * x; + int stratus = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); + Main.dust[stratus].noGravity = true; + Main.dust[stratus].velocity = Vector2.Normalize(vector) * x; } } for (int x = 1; x <= 3; x++) { - int num20 = 36; - for (int i = 0; i < num20; i++) + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) { Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f * 0.5f; - spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + Projectile.Center; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default(Vector2)) + Projectile.Center; Vector2 vector = spinningpoint - Projectile.Center; - int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); - Main.dust[num21].noGravity = true; - Main.dust[num21].velocity = Vector2.Normalize(vector) * x; - Main.dust[num21].velocity *= 2; + int stratus = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); + Main.dust[stratus].noGravity = true; + Main.dust[stratus].velocity = Vector2.Normalize(vector) * x; + Main.dust[stratus].velocity *= 2; } } diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index bd5cec0b55..4d4c4c9f5c 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -45,22 +45,21 @@ namespace CalamityMod.Projectiles.Melee { Projectile.frame = 0; } - int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num822]; + int ghostlyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[ghostlyDust]; dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - float num953 = 30f * Projectile.ai[1]; //100 - float scaleFactor12 = 6f * Projectile.ai[1]; //5 - float num954 = 900f; + Main.dust[ghostlyDust].scale = 1.3f; + Main.dust[ghostlyDust].noGravity = true; + float projVelocityFactor = 30f * Projectile.ai[1]; //100 + float scaleFactor = 6f * Projectile.ai[1]; //5 Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); 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) > 900f) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Projectile.velocity = (Projectile.velocity * (projVelocityFactor - 1f) + moveDirection * scaleFactor) / projVelocityFactor; return; } @@ -112,16 +111,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); - 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 2f); - 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 killedDust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); + Main.dust[killedDust].noGravity = true; + Main.dust[killedDust].noLight = true; + Main.dust[killedDust].velocity = faceDirection; } } } diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index f06353b0d7..617c424eb9 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -45,22 +45,21 @@ namespace CalamityMod.Projectiles.Melee { Projectile.frame = 0; } - int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num822]; + int ghostlyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[ghostlyDust]; dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - float num953 = 35f * Projectile.ai[1]; //100 - float scaleFactor12 = 7f * Projectile.ai[1]; //5 - float num954 = 900f; + Main.dust[ghostlyDust].scale = 1.3f; + Main.dust[ghostlyDust].noGravity = true; + float projVelocityFactor = 35f * Projectile.ai[1]; //100 + float scaleFactor = 7f * Projectile.ai[1]; //5 Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); 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) > 900f) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Projectile.velocity = (Projectile.velocity * (projVelocityFactor - 1f) + moveDirection * scaleFactor) / projVelocityFactor; return; } @@ -112,16 +111,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); - 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 2f); - 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 killedDust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); + Main.dust[killedDust].noGravity = true; + Main.dust[killedDust].noLight = true; + Main.dust[killedDust].velocity = faceDirection; } } } diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index 6381fc0eca..9b7833bc18 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -44,22 +44,21 @@ namespace CalamityMod.Projectiles.Melee { Projectile.frame = 0; } - int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num822]; + int ghostlyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[ghostlyDust]; dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - float num953 = 40f * Projectile.ai[1]; //100 - float scaleFactor12 = 8f * Projectile.ai[1]; //5 - float num954 = 900f; + Main.dust[ghostlyDust].scale = 1.3f; + Main.dust[ghostlyDust].noGravity = true; + float projVelocityFactor = 40f * Projectile.ai[1]; //100 + float scaleFactor = 8f * Projectile.ai[1]; //5 Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); 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) > 900f) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Projectile.velocity = (Projectile.velocity * (projVelocityFactor - 1f) + moveDirection * scaleFactor) / projVelocityFactor; return; } @@ -111,16 +110,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); - 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 2f); - 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 killedDust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); + Main.dust[killedDust].noGravity = true; + Main.dust[killedDust].noLight = true; + Main.dust[killedDust].velocity = faceDirection; } } } diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index afc132e469..6ea7da0139 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -37,10 +37,10 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item21, Projectile.position); Projectile.localAI[0] += 1f; } - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int hitDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[hitDust].noGravity = true; + Main.dust[hitDust].velocity *= 0.5f; + Main.dust[hitDust].velocity += Projectile.velocity * 0.1f; } public override bool PreDraw(ref Color lightColor) @@ -55,19 +55,19 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) + int inc; + for (int i = 4; i < 31; i = inc + 1) { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 5, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; + float oldXPos = Projectile.oldVelocity.X * (30f / (float)i); + float oldYPos = Projectile.oldVelocity.Y * (30f / (float)i); + int killDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXPos, Projectile.oldPosition.Y - oldYPos), 8, 8, 5, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[killDust].noGravity = true; + Dust dust = Main.dust[killDust]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 5, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; + killDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXPos, Projectile.oldPosition.Y - oldYPos), 8, 8, 5, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[killDust]; dust.velocity *= 0.05f; - num3 = num795; + inc = i; } } diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index 2bf5b20987..8f23dda5c3 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Melee 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; } @@ -72,20 +72,20 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 150; 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 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int holy = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[holy].scale = 0.5f; + Main.dust[holy].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int holy2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[holy2].noGravity = true; + holy2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); } } } diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index 5e0f27bbdb..260d58f52f 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -57,23 +57,23 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0] += 1f; if (Projectile.ai[0] == 120f) { - for (int num621 = 0; num621 < 8; num621++) + for (int i = 0; i < 8; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[icyDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[icyDust].scale = 0.5f; + Main.dust[icyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 14; num623++) + for (int j = 0; j < 14; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 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, 67, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int icyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 3f); + Main.dust[icyDust2].noGravity = true; + Main.dust[icyDust2].velocity *= 5f; + icyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[icyDust2].velocity *= 2f; } Projectile.scale = 1f; diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 8a6a77621f..9be56b2def 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -62,12 +62,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - for (int num303 = 0; num303 < 3; num303++) + for (int i = 0; i < 3; i++) { - int num304 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= Projectile.oldVelocity * 0.3f; + int illustrious = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 0.8f); + Main.dust[illustrious].noGravity = true; + Main.dust[illustrious].velocity *= 1.2f; + Main.dust[illustrious].velocity -= Projectile.oldVelocity * 0.3f; } } diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index 68f57203a5..78bdfa9373 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -39,14 +39,14 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.alpha < 0) Projectile.alpha = 0; - int num297 = 171; + int dustType = 171; if (Main.rand.Next(3) == 0) { - num297 = 46; + dustType = 46; } if (Main.rand.NextBool(9)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Projectile.ai[0] == 0f) { @@ -73,10 +73,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - int num297 = 171; + int dustType = 171; if (Main.rand.Next(3) == 0) { - num297 = 46; + dustType = 46; } SoundEngine.PlaySound(SoundID.Item14, Projectile.position); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); @@ -86,23 +86,23 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.Damage(); - 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, num297, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int deathDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.2f); + Main.dust[deathDust].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[deathDust].scale = 0.5f; + Main.dust[deathDust].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, num297, 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, num297, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int deathDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.7f); + Main.dust[deathDust2].noGravity = true; + Main.dust[deathDust2].velocity *= 5f; + deathDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); + Main.dust[deathDust2].velocity *= 2f; } } diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index e2adcefc5e..b20d1aa80f 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); - 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, 91, 0f, 0f, 100, default, 1.25f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int shinyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f); + Main.dust[shinyDust].noGravity = true; + Main.dust[shinyDust].velocity *= 0.5f; + Main.dust[shinyDust].velocity += Projectile.velocity * 0.1f; } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 9f, 20f); diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index 93ff1c72d4..2bcf99ec00 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { int damage = (int)Main.player[Projectile.owner].GetTotalDamage().ApplyTo(350f); - int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - if (projectile1.WithinBounds(Main.maxProjectiles)) + int laserShot = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (laserShot.WithinBounds(Main.maxProjectiles)) { - Main.projectile[projectile1].DamageType = DamageClass.Melee; - Main.projectile[projectile1].aiStyle = ProjAIStyleID.Arrow; + Main.projectile[laserShot].DamageType = DamageClass.Melee; + Main.projectile[laserShot].aiStyle = ProjAIStyleID.Arrow; } } Projectile.localAI[0] = 0f; diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index 67c99eed4a..6fb0490f00 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -33,9 +33,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - float num395 = Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - Projectile.scale = num395 + 0.95f; + float scaling = Main.mouseTextColor / 200f - 0.35f; + scaling *= 0.2f; + Projectile.scale = scaling + 0.95f; Lighting.AddLight(Projectile.Center, 0.1f, 0.5f, 0.15f); } diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index a0d407eb9c..eb36e4cf2d 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -58,11 +58,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - for (int num105 = 0; num105 < 20; num105++) + for (int i = 0; i < 20; i++) { - int num102 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 73, 0f, 0f, 0, default, 1f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity += Projectile.velocity * 0.1f; + int pinkish = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 73, 0f, 0f, 0, default, 1f); + Main.dust[pinkish].noGravity = true; + Main.dust[pinkish].velocity += Projectile.velocity * 0.1f; } if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Melee/LuxorsGiftMelee.cs b/Projectiles/Melee/LuxorsGiftMelee.cs index 956805e7d6..3068ea8f1a 100644 --- a/Projectiles/Melee/LuxorsGiftMelee.cs +++ b/Projectiles/Melee/LuxorsGiftMelee.cs @@ -56,15 +56,15 @@ namespace CalamityMod.Projectiles.Melee { 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, (int)CalamityDusts.Brimstone, 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 spawnDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); + Main.dust[spawnDust].scale = 1.1f; + Main.dust[spawnDust].noGravity = true; + Main.dust[spawnDust].position = Projectile.Center + dustRotate; + Main.dust[spawnDust].velocity = Projectile.velocity * 0.1f; + Main.dust[spawnDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[spawnDust].position) * 1.25f; } } } @@ -85,15 +85,15 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item10, Projectile.position); 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, (int)CalamityDusts.Brimstone, 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 spawnDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); + Main.dust[spawnDust].scale = 1.1f; + Main.dust[spawnDust].noGravity = true; + Main.dust[spawnDust].position = Projectile.Center + dustRotate; + Main.dust[spawnDust].velocity = Projectile.velocity * 0.1f; + Main.dust[spawnDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[spawnDust].position) * 1.25f; } if (Projectile.velocity.X != oldVelocity.X) { diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 433c182b49..78194da957 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -28,17 +28,17 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - int num123 = (int)Player.FindClosest(Projectile.Center, 1, 1); + int playerOwner = (int)Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; if (Projectile.ai[1] < 110f && Projectile.ai[1] > 30f) { - float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector17 = Main.player[num123].Center - Projectile.Center; - vector17.Normalize(); - vector17 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 24f + vector17) / 25f; + float scaleFactor = Projectile.velocity.Length(); + Vector2 projDirection = Main.player[playerOwner].Center - Projectile.Center; + projDirection.Normalize(); + projDirection *= scaleFactor; + Projectile.velocity = (Projectile.velocity * 24f + projDirection) / 25f; Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor2; + Projectile.velocity *= scaleFactor; } if (Projectile.velocity.Length() < 18f) diff --git a/Projectiles/Melee/MourningSkull.cs b/Projectiles/Melee/MourningSkull.cs index 6ec657800a..6f056934c1 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -58,38 +58,37 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) { - int num554 = (int)Projectile.ai[0]; - if (Main.npc[num554].active) + int npcTracker = (int)Projectile.ai[0]; + if (Main.npc[npcTracker].active) { - float num555 = 8f; - Vector2 vector44 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num556 = Main.npc[num554].position.X - vector44.X; - float num557 = Main.npc[num554].position.Y - vector44.Y; - float num558 = (float)Math.Sqrt((double)(num556 * num556 + num557 * num557)); - num558 = num555 / num558; - num556 *= num558; - num557 *= num558; - Projectile.velocity.X = (Projectile.velocity.X * 14f + num556) / 15f; - Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num557) / 15f; + Vector2 projPos = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float npcXDist = Main.npc[npcTracker].position.X - projPos.X; + float npcYDist = Main.npc[npcTracker].position.Y - projPos.Y; + float npcDistance = (float)Math.Sqrt((double)(npcXDist * npcXDist + npcYDist * npcYDist)); + npcDistance = 8f / npcDistance; + npcXDist *= npcDistance; + npcYDist *= npcDistance; + Projectile.velocity.X = (Projectile.velocity.X * 14f + npcXDist) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + npcYDist) / 15f; } else { - float num559 = 1000f; - int num3; - for (int num560 = 0; num560 < Main.maxNPCs; num560 = num3 + 1) + float homingRange = 1000f; + int inc; + for (int j = 0; j < Main.maxNPCs; j = inc + 1) { - if (Main.npc[num560].CanBeChasedBy(Projectile, false)) + if (Main.npc[j].CanBeChasedBy(Projectile, false)) { - float num561 = Main.npc[num560].position.X + (float)(Main.npc[num560].width / 2); - float num562 = Main.npc[num560].position.Y + (float)(Main.npc[num560].height / 2); - float num563 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num561) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num562); - if (num563 < num559 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num560].position, Main.npc[num560].width, Main.npc[num560].height)) + float targetX = Main.npc[j].position.X + (float)(Main.npc[j].width / 2); + float targetY = Main.npc[j].position.Y + (float)(Main.npc[j].height / 2); + float targetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - targetX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - targetY); + if (targetDist < homingRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[j].position, Main.npc[j].width, Main.npc[j].height)) { - num559 = num563; - Projectile.ai[0] = (float)num560; + homingRange = targetDist; + Projectile.ai[0] = (float)j; } } - num3 = num560; + inc = j; } } @@ -104,15 +103,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - int num564 = 8; - int num565 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num564, Projectile.position.Y + (float)num564), Projectile.width - num564 * 2, Projectile.height - num564 * 2, Main.rand.NextBool() ? 5 : 6, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num565]; + int eightConst = 8; + int mourningDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)eightConst, Projectile.position.Y + (float)eightConst), Projectile.width - eightConst * 2, Projectile.height - eightConst * 2, Main.rand.NextBool() ? 5 : 6, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[mourningDust]; dust.velocity *= 0.5f; - dust = Main.dust[num565]; + dust = Main.dust[mourningDust]; dust.velocity += Projectile.velocity * 0.5f; - Main.dust[num565].noGravity = true; - Main.dust[num565].noLight = true; - Main.dust[num565].scale = 1.4f; + Main.dust[mourningDust].noGravity = true; + Main.dust[mourningDust].noLight = true; + Main.dust[mourningDust].scale = 1.4f; return; } @@ -133,23 +132,23 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[bloody].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[bloody].scale = 0.5f; + Main.dust[bloody].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + Main.dust[fiery].noGravity = true; + Main.dust[fiery].velocity *= 5f; + fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + Main.dust[fiery].velocity *= 2f; } } diff --git a/Projectiles/Melee/Nebudust.cs b/Projectiles/Melee/Nebudust.cs index ad433e2bd8..7371c95e26 100644 --- a/Projectiles/Melee/Nebudust.cs +++ b/Projectiles/Melee/Nebudust.cs @@ -28,43 +28,43 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0f); - float num461 = 25f; + float projTimer = 25f; if (Projectile.ai[0] > 60f) { - num461 -= (Projectile.ai[0] - 60f) / 2f; + projTimer -= (Projectile.ai[0] - 60f) / 2f; } - if (num461 <= 0f) + if (projTimer <= 0f) { - num461 = 0f; + projTimer = 0f; Projectile.Kill(); } - num461 *= 0.7f; + projTimer *= 0.7f; if (Projectile.ai[0] == 0f) { SoundEngine.PlaySound(SoundID.Item105, Projectile.position); } Projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) + int timerCounter = 0; + while ((float)timerCounter < projTimer) { - float num463 = (float)Main.rand.Next(-6, 7); - float num464 = (float)Main.rand.Next(-6, 7); - float num465 = (float)Main.rand.Next(2, 5); - 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, 269, 0f, 0f, 100, default, 1f); - 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]; + float rando1 = (float)Main.rand.Next(-6, 7); + float rando2 = (float)Main.rand.Next(-6, 7); + float rando5 = (float)Main.rand.Next(2, 5); + float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjuster = rando5 / randoAdjuster; + rando1 *= randoAdjuster; + rando2 *= randoAdjuster; + int astra = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 269, 0f, 0f, 100, default, 1f); + Main.dust[astra].noGravity = true; + Main.dust[astra].position.X = Projectile.Center.X; + Main.dust[astra].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[astra]; 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[astra]; 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[astra].velocity.X = rando1; + Main.dust[astra].velocity.Y = rando2; + timerCounter++; } } } diff --git a/Projectiles/Melee/NebulaShot.cs b/Projectiles/Melee/NebulaShot.cs index 0eca731392..0d1af76fbf 100644 --- a/Projectiles/Melee/NebulaShot.cs +++ b/Projectiles/Melee/NebulaShot.cs @@ -42,14 +42,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 0; } Lighting.AddLight(Projectile.Center, 0.4f, 0.2f, 0.4f); - for (int num121 = 0; num121 < 5; num121++) + for (int i = 0; i < 5; i++) { - Dust dust4 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= Projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; + Dust dustSpawn = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + dustSpawn.velocity = Vector2.Zero; + dustSpawn.position -= Projectile.velocity / 5f * (float)i; + dustSpawn.noGravity = true; + dustSpawn.scale = 0.8f; + dustSpawn.noLight = true; } } diff --git a/Projectiles/Melee/NebulashFlail.cs b/Projectiles/Melee/NebulashFlail.cs index f8a50b26ca..ecac7d81ad 100644 --- a/Projectiles/Melee/NebulashFlail.cs +++ b/Projectiles/Melee/NebulashFlail.cs @@ -40,8 +40,7 @@ namespace CalamityMod.Projectiles.Melee { return true; } - float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref num8)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref 0f)) { return true; } diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs index 8f7bc1b7a8..bd0cb4164d 100644 --- a/Projectiles/Melee/NeptuneOrb.cs +++ b/Projectiles/Melee/NeptuneOrb.cs @@ -34,10 +34,10 @@ namespace CalamityMod.Projectiles.Melee int splitDamage = Projectile.damage / 2; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 15f, ModContent.ProjectileType(), splitDamage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[waterDust].noGravity = true; + Main.dust[waterDust].velocity *= 0.5f; + Main.dust[waterDust].velocity += Projectile.velocity * 0.1f; } public override bool PreDraw(ref Color lightColor) @@ -64,22 +64,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int dustIndex = 0; dustIndex <= 30; dustIndex++) { - 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, 33, 0f, 0f, 100, default, 1.2f); - 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 killWatery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[killWatery]; 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; + dust.velocity.X = rando1; + dust.velocity.Y = rando2; } Projectile.maxPenetrate = -1; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/OrderbringerAura.cs b/Projectiles/Melee/OrderbringerAura.cs index efc1899506..ebf5317dae 100644 --- a/Projectiles/Melee/OrderbringerAura.cs +++ b/Projectiles/Melee/OrderbringerAura.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Melee 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, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); + int randOrbXOffset = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int randOrbYOffset = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)randOrbXOffset, (float)randOrbYOffset, 0f, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } } @@ -48,26 +48,26 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.localAI[0] >= 10f) { Projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = Projectile.type; - for (int num420 = 0; num420 < 1000; num420++) + int projTimer = 0; + int incTracker = 0; + float aiTracker = 0f; + int theProjectile = Projectile.type; + for (int i = 0; i < 1000; i++) { - if (Main.projectile[num420].active && Main.projectile[num420].owner == Projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + if (Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner && Main.projectile[i].type == theProjectile && Main.projectile[i].ai[1] < 3600f) { - num416++; - if (Main.projectile[num420].ai[1] > num418) + projTimer++; + if (Main.projectile[i].ai[1] > aiTracker) { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; + incTracker = i; + aiTracker = Main.projectile[i].ai[1]; } } } - if (num416 > 1) + if (projTimer > 1) { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; + Main.projectile[incTracker].netUpdate = true; + Main.projectile[incTracker].ai[1] = 36000f; } } } diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index aea11d746d..a8a03a1073 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -83,10 +83,10 @@ namespace CalamityMod.Projectiles.Melee whiteLightTimer = 5; } - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.6f); + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].velocity *= 0.5f; + Main.dust[rainbow].velocity += Projectile.velocity * 0.1f; CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f); } @@ -108,19 +108,19 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[dust].noGravity = true; } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int deathRainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); + Main.dust[deathRainbow].noGravity = true; + Main.dust[deathRainbow].velocity *= 3f; + deathRainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + Main.dust[deathRainbow].velocity *= 2f; + Main.dust[deathRainbow].noGravity = true; } if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Melee/OrderbringerRain.cs b/Projectiles/Melee/OrderbringerRain.cs index b07864691c..8bdedf01ad 100644 --- a/Projectiles/Melee/OrderbringerRain.cs +++ b/Projectiles/Melee/OrderbringerRain.cs @@ -34,12 +34,12 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); - 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].velocity *= 0.5f; + Main.dust[rainbow].velocity += Projectile.velocity * 0.1f; } CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); diff --git a/Projectiles/Melee/OrderbringerWhiteOrb.cs b/Projectiles/Melee/OrderbringerWhiteOrb.cs index 8b57e374b8..cd05a3c73d 100644 --- a/Projectiles/Melee/OrderbringerWhiteOrb.cs +++ b/Projectiles/Melee/OrderbringerWhiteOrb.cs @@ -24,12 +24,12 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); - 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].velocity *= 0.5f; + Main.dust[rainbow].velocity += Projectile.velocity * 0.1f; } } } diff --git a/Projectiles/Melee/PlagueSeeker.cs b/Projectiles/Melee/PlagueSeeker.cs index a60634f4e0..c3ecf585ce 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -37,11 +37,11 @@ namespace CalamityMod.Projectiles.Melee 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, 107, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int plagued = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.75f); + Main.dust[plagued].noGravity = true; + Main.dust[plagued].velocity *= 0f; } } diff --git a/Projectiles/Melee/RSSolarFlare.cs b/Projectiles/Melee/RSSolarFlare.cs index b94a5734c0..11dddd101d 100644 --- a/Projectiles/Melee/RSSolarFlare.cs +++ b/Projectiles/Melee/RSSolarFlare.cs @@ -72,9 +72,9 @@ namespace CalamityMod.Projectiles.Melee 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; } @@ -101,23 +101,23 @@ namespace CalamityMod.Projectiles.Melee 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, 159, 0f, 0f, 100, default, 0.5f); - Main.dust[num622].velocity *= 3f; + int shiny = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); + Main.dust[shiny].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[shiny].scale = 0.5f; + Main.dust[shiny].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, 32, 0f, 0f, 100, default, 1f); - 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, 159, 0f, 0f, 100, default, 0.5f); - Main.dust[num624].velocity *= 2f; + int shiny2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1f); + Main.dust[shiny2].noGravity = true; + Main.dust[shiny2].velocity *= 5f; + shiny2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); + Main.dust[shiny2].velocity *= 2f; } } diff --git a/Projectiles/Melee/RainBolt.cs b/Projectiles/Melee/RainBolt.cs index 9eff0a3558..5eb537263b 100644 --- a/Projectiles/Melee/RainBolt.cs +++ b/Projectiles/Melee/RainBolt.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; } - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].velocity *= 0f; if (Projectile.timeLeft < 150) CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs index bb003b38ce..4ea9633a44 100644 --- a/Projectiles/Melee/RainbowBoom.cs +++ b/Projectiles/Melee/RainbowBoom.cs @@ -25,61 +25,61 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - 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]; + 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 rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].position.X = Projectile.Center.X; + Main.dust[rainbow].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[rainbow]; 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[rainbow]; 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[rainbow].velocity.X = rando1; + Main.dust[rainbow].velocity.Y = rando2; + timerCounter++; } } diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index 3ecc436a06..91f164ec01 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -44,11 +44,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 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, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int blueDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); + Main.dust[blueDust].noGravity = true; + Main.dust[blueDust].velocity *= 0f; } } diff --git a/Projectiles/Melee/SandFire.cs b/Projectiles/Melee/SandFire.cs index 1dafccff81..cc3ae55ea2 100644 --- a/Projectiles/Melee/SandFire.cs +++ b/Projectiles/Melee/SandFire.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 5; num468++) + for (int i = 0; i < 5; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int shiny = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); + Main.dust[shiny].noGravity = true; + Main.dust[shiny].velocity *= 0f; } } diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index 6836a73f50..c7c74e0569 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -50,13 +50,13 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.frame > 1) Projectile.frame = 0; - for (int num369 = 0; num369 < 1; num369++) + for (int i = 0; i < 1; i++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - float dustX = Projectile.velocity.X / 3f * num369; - float dustY = Projectile.velocity.Y / 3f * num369; - int num372 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num372]; + float dustX = Projectile.velocity.X / 3f * i; + float dustY = Projectile.velocity.Y / 3f * i; + int scourgeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[scourgeDust]; dust.position.X = Projectile.Center.X - dustX; dust.position.Y = Projectile.Center.Y - dustY; dust.velocity *= 0f; @@ -65,9 +65,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; - float num373 = Projectile.position.X; - float num374 = Projectile.position.Y; - float num375 = 100000f; + 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) @@ -80,11 +80,11 @@ namespace CalamityMod.Projectiles.Melee float enemyX = Main.npc[enemy].position.X + Main.npc[enemy].width / 2; float enemyY = Main.npc[enemy].position.Y + Main.npc[enemy].height / 2; float enemyDistance = Math.Abs(Projectile.position.X + Projectile.width / 2 - enemyX) + Math.Abs(Projectile.position.Y + Projectile.height / 2 - enemyY); - if (enemyDistance < 800f && enemyDistance < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[enemy].position, Main.npc[enemy].width, Main.npc[enemy].height)) + if (enemyDistance < 800f && enemyDistance < homingRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[enemy].position, Main.npc[enemy].width, Main.npc[enemy].height)) { - num375 = enemyDistance; - num373 = enemyX; - num374 = enemyY; + homingRange = enemyDistance; + projX = enemyX; + projY = enemyY; isHoming = true; } } @@ -92,41 +92,41 @@ namespace CalamityMod.Projectiles.Melee } if (!isHoming) { - num373 = Projectile.position.X + Projectile.width / 2 + Projectile.velocity.X * 100f; - num374 = Projectile.position.Y + Projectile.height / 2 + Projectile.velocity.Y * 100f; + projX = Projectile.position.X + Projectile.width / 2 + Projectile.velocity.X * 100f; + projY = Projectile.position.Y + Projectile.height / 2 + Projectile.velocity.Y * 100f; } - float num381 = 0.16f; - Vector2 vector30 = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); - float num382 = num373 - vector30.X; - float num383 = num374 - vector30.Y; - float num384 = (float)Math.Sqrt(num382 * num382 + num383 * num383); - num384 = 10f / num384; - num382 *= num384; - num383 *= num384; - if (Projectile.velocity.X < num382) + float projVelModifier = 0.16f; + Vector2 projDirection = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); + float projDirectX = projX - projDirection.X; + float projDirectY = projY - projDirection.Y; + float projDistance = (float)Math.Sqrt(projDirectX * projDirectX + projDirectY * projDirectY); + projDistance = 10f / projDistance; + projDirectX *= projDistance; + projDirectY *= projDistance; + if (Projectile.velocity.X < projDirectX) { - Projectile.velocity.X = Projectile.velocity.X + num381; - if (Projectile.velocity.X < 0f && num382 > 0f) - Projectile.velocity.X = Projectile.velocity.X + num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X + projVelModifier; + if (Projectile.velocity.X < 0f && projDirectX > 0f) + Projectile.velocity.X = Projectile.velocity.X + projVelModifier * 2f; } - else if (Projectile.velocity.X > num382) + else if (Projectile.velocity.X > projDirectX) { - Projectile.velocity.X = Projectile.velocity.X - num381; - if (Projectile.velocity.X > 0f && num382 < 0f) - Projectile.velocity.X = Projectile.velocity.X - num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X - projVelModifier; + if (Projectile.velocity.X > 0f && projDirectX < 0f) + Projectile.velocity.X = Projectile.velocity.X - projVelModifier * 2f; } - if (Projectile.velocity.Y < num383) + if (Projectile.velocity.Y < projDirectY) { - Projectile.velocity.Y = Projectile.velocity.Y + num381; - if (Projectile.velocity.Y < 0f && num383 > 0f) - Projectile.velocity.Y = Projectile.velocity.Y + num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier; + if (Projectile.velocity.Y < 0f && projDirectY > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier * 2f; } - else if (Projectile.velocity.Y > num383) + else if (Projectile.velocity.Y > projDirectY) { - Projectile.velocity.Y = Projectile.velocity.Y - num381; - if (Projectile.velocity.Y > 0f && num383 < 0f) - Projectile.velocity.Y = Projectile.velocity.Y - num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier; + if (Projectile.velocity.Y > 0f && projDirectY < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier * 2f; } } @@ -148,10 +148,10 @@ namespace CalamityMod.Projectiles.Melee 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(9f, 10f); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/ScourgeoftheCosmosMiniGlow").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.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/ScourgeoftheCosmosMiniGlow").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.None, 0); } } } diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.cs b/Projectiles/Melee/ScourgeoftheCosmosProj.cs index 6fd5205955..5fa7b6724f 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosProj.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -33,19 +33,19 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.alpha <= 200) { - int num3; - for (int num20 = 0; num20 < 2; num20 = num3 + 1) + int inc; + for (int i = 0; i < 2; i = inc + 1) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - float num21 = Projectile.velocity.X / 4f * num20; - float num22 = Projectile.velocity.Y / 4f * num20; - int num23 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Main.dust[num23].position.X = Projectile.Center.X - num21; - Main.dust[num23].position.Y = Projectile.Center.Y - num22; - Dust dust = Main.dust[num23]; + float shortXVel = Projectile.velocity.X / 4f * i; + float shortYVel = Projectile.velocity.Y / 4f * i; + int scourgeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Main.dust[scourgeDust].position.X = Projectile.Center.X - shortXVel; + Main.dust[scourgeDust].position.Y = Projectile.Center.Y - shortYVel; + Dust dust = Main.dust[scourgeDust]; dust.velocity *= 0f; - Main.dust[num23].scale = 0.7f; - num3 = num20; + Main.dust[scourgeDust].scale = 0.7f; + inc = i; } } Projectile.alpha -= 50; @@ -82,18 +82,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = -oldVelocity.Y; if (Projectile.owner == Main.myPlayer) { - int num626 = 1; + int minisAmt = 1; if (Main.rand.NextBool(10)) - num626++; - int num3; - for (int num627 = 0; num627 < num626; num627 = num3 + 1) + minisAmt++; + int inc; + for (int j = 0; j < minisAmt; j = inc + 1) { - float num628 = Main.rand.Next(-35, 36) * 0.02f; - float num629 = Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.35f, Main.myPlayer); - num3 = num627; + float randXDirect = Main.rand.Next(-35, 36) * 0.02f; + float randYDirect = Main.rand.Next(-35, 36) * 0.02f; + randXDirect *= 10f; + randYDirect *= 10f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randXDirect, randYDirect, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.35f, Main.myPlayer); + inc = j; } } } @@ -103,40 +103,40 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCHit4, Projectile.position); - int num3; - for (int num622 = 0; num622 < 10; num622 = num3 + 1) + int inc; + for (int i = 0; i < 10; i = inc + 1) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int num623 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num623]; + int killedDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[killedDust]; dust.scale *= 1.1f; - Main.dust[num623].noGravity = true; - num3 = num622; + Main.dust[killedDust].noGravity = true; + inc = i; } - for (int num624 = 0; num624 < 15; num624 = num3 + 1) + for (int j = 0; j < 15; j = inc + 1) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int num625 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num625]; + int killedDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[killedDust2]; dust.velocity *= 2.5f; - dust = Main.dust[num625]; + dust = Main.dust[killedDust2]; dust.scale *= 0.8f; - Main.dust[num625].noGravity = true; - num3 = num624; + Main.dust[killedDust2].noGravity = true; + inc = j; } if (Projectile.owner == Main.myPlayer) { - int num626 = 3; + int minisAmt = 3; if (Main.rand.NextBool(10)) - num626++; - for (int num627 = 0; num627 < num626; num627 = num3 + 1) + minisAmt++; + for (int j = 0; j < minisAmt; j = inc + 1) { - float num628 = Main.rand.Next(-35, 36) * 0.02f; - float num629 = Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); - num3 = num627; + float randXDirect = Main.rand.Next(-35, 36) * 0.02f; + float randYDirect = Main.rand.Next(-35, 36) * 0.02f; + randXDirect *= 10f; + randYDirect *= 10f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randXDirect, randYDirect, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); + inc = j; } } } diff --git a/Projectiles/Melee/Shortswords/ElementalShivProj.cs b/Projectiles/Melee/Shortswords/ElementalShivProj.cs index 0fcd9afc81..5b9da39b23 100644 --- a/Projectiles/Melee/Shortswords/ElementalShivProj.cs +++ b/Projectiles/Melee/Shortswords/ElementalShivProj.cs @@ -54,9 +54,9 @@ namespace CalamityMod.Projectiles.Melee.Shortswords { if (Main.rand.NextBool(5)) { - int num250 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; + int rainbowDust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[rainbowDust].velocity *= 0.2f; + Main.dust[rainbowDust].noGravity = true; } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs index ed3cfe862b..c57f33da20 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs @@ -55,9 +55,9 @@ namespace CalamityMod.Projectiles.Melee.Shortswords { if (Main.rand.NextBool(5)) { - int num250 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (Main.rand.NextBool() ? 20 : 176), (float)(Main.player[Projectile.owner].direction * 2), 0f, 150, default, 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; + int gladiusDust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (Main.rand.NextBool() ? 20 : 176), (float)(Main.player[Projectile.owner].direction * 2), 0f, 150, default, 1.3f); + Main.dust[gladiusDust].velocity *= 0.2f; + Main.dust[gladiusDust].noGravity = true; } } diff --git a/Projectiles/Melee/SolsticeBeam.cs b/Projectiles/Melee/SolsticeBeam.cs index c6a091e7e0..bd8ee4572f 100644 --- a/Projectiles/Melee/SolsticeBeam.cs +++ b/Projectiles/Melee/SolsticeBeam.cs @@ -175,15 +175,15 @@ namespace CalamityMod.Projectiles.Melee break; } SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int num795 = 0; num795 < 27; num795++) + for (int i = 0; i < 27; i++) { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Dust dust = Main.dust[num798]; + float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); + float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); + int solsticeDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Dust dust = Main.dust[solsticeDust]; dust.noGravity = true; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + solsticeDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust.velocity *= 0.05f; } } diff --git a/Projectiles/Melee/SoulScytheExplosion.cs b/Projectiles/Melee/SoulScytheExplosion.cs index c04a25824c..5b3fc595f6 100644 --- a/Projectiles/Melee/SoulScytheExplosion.cs +++ b/Projectiles/Melee/SoulScytheExplosion.cs @@ -29,23 +29,23 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.timeLeft == 5) { - 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, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int soulDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[soulDust].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[soulDust].scale = 0.5f; + Main.dust[soulDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 50; num623++) + for (int j = 0; j < 50; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 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, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int soulDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[soulDust2].noGravity = true; + Main.dust[soulDust2].velocity *= 5f; + soulDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[soulDust2].velocity *= 2f; } } } diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs index 7d07e3b47e..31483c64cc 100644 --- a/Projectiles/Melee/Spark.cs +++ b/Projectiles/Melee/Spark.cs @@ -50,25 +50,25 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; + int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[sparky]; expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; + Dust expr_8994_cp_0 = Main.dust[sparky]; expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; + Main.dust[sparky].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[sparky].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[sparky]; expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; + int sparkier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[sparkier]; expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; + Dust expr_8A6C_cp_0 = Main.dust[sparkier]; expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; + Main.dust[sparkier].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[sparkier].noGravity = true; + Main.dust[sparkier].velocity *= 0.1f; } if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index 0802f94fdf..082eeec0c0 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -97,16 +97,16 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int num795 = 4; num795 < 12; num795++) + for (int i = 4; i < 12; i++) { - float num796 = Projectile.oldVelocity.X * (30f / num795); - float num797 = Projectile.oldVelocity.Y * (30f / num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; + float projOldX = Projectile.oldVelocity.X * (30f / i); + float projOldY = Projectile.oldVelocity.Y * (30f / i); + int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[spatial].noGravity = true; + Dust dust = Main.dust[spatial]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; + spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[spatial]; dust.velocity *= 0.05f; } } diff --git a/Projectiles/Melee/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index 8375481479..7deac57c88 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -83,16 +83,16 @@ namespace CalamityMod.Projectiles.Melee } public override void OnKill(int timeLeft) { - for (int num795 = 4; num795 < 12; num795++) + for (int i = 4; i < 12; i++) { - float num796 = Projectile.oldVelocity.X * (30f / num795); - float num797 = Projectile.oldVelocity.Y * (30f / num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; + float projOldX = Projectile.oldVelocity.X * (30f / i); + float projOldY = Projectile.oldVelocity.Y * (30f / i); + int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[spatial].noGravity = true; + Dust dust = Main.dust[spatial]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; + spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[spatial]; dust.velocity *= 0.05f; } } diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index 22d2e14348..00b8011745 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -81,16 +81,16 @@ namespace CalamityMod.Projectiles.Melee } public override void OnKill(int timeLeft) { - for (int num795 = 4; num795 < 12; num795++) + for (int i = 4; i < 12; i++) { - float num796 = Projectile.oldVelocity.X * (30f / num795); - float num797 = Projectile.oldVelocity.Y * (30f / num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; + float projOldX = Projectile.oldVelocity.X * (30f / i); + float projOldY = Projectile.oldVelocity.Y * (30f / i); + int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[spatial].noGravity = true; + Dust dust = Main.dust[spatial]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; + spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[spatial]; dust.velocity *= 0.05f; } } diff --git a/Projectiles/Melee/SpatialSpear4.cs b/Projectiles/Melee/SpatialSpear4.cs index deda68dc7c..89f1712f64 100644 --- a/Projectiles/Melee/SpatialSpear4.cs +++ b/Projectiles/Melee/SpatialSpear4.cs @@ -66,16 +66,16 @@ namespace CalamityMod.Projectiles.Melee } public override void OnKill(int timeLeft) { - for (int num795 = 4; num795 < 12; num795++) + for (int i = 4; i < 12; i++) { - float num796 = Projectile.oldVelocity.X * (30f / num795); - float num797 = Projectile.oldVelocity.Y * (30f / num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 244, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; + float projOldX = Projectile.oldVelocity.X * (30f / i); + float projOldY = Projectile.oldVelocity.Y * (30f / i); + int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 244, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[spatial].noGravity = true; + Dust dust = Main.dust[spatial]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 244, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; + spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 244, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[spatial]; dust.velocity *= 0.05f; } } diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index e7caef897e..90265cc36b 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Melee.Spears { if (Main.rand.NextBool(4)) { - int num = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 60, Projectile.direction * 2, 0f, 150, default, 1f); - Main.dust[num].noGravity = true; + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 60, Projectile.direction * 2, 0f, 150, default, 1f); + Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index 3a304cf341..1fff404fd7 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -49,18 +49,18 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) + int inc; + for (int i = 4; i < 31; i = inc + 1) { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Dust dust = Main.dust[num798]; + float projOldX = Projectile.oldVelocity.X * (30f / (float)i); + float projOldY = Projectile.oldVelocity.Y * (30f / (float)i); + int starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Dust dust = Main.dust[starnight]; dust.noGravity = true; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust.velocity *= 0.05f; - num3 = num795; + inc = i; } } diff --git a/Projectiles/Melee/StormMark.cs b/Projectiles/Melee/StormMark.cs index 3a86561206..163effed93 100644 --- a/Projectiles/Melee/StormMark.cs +++ b/Projectiles/Melee/StormMark.cs @@ -36,34 +36,34 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.localAI[1] < 30f) { - for (int num1134 = 0; num1134 < 1; num1134++) + for (int i = 0; i < 1; i++) { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 187, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = Projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) + float lerpvalue1 = -0.5f; + float lerpvalue2 = 0.9f; + float randomLerp = Main.rand.NextFloat(); + Vector2 dustMovement = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(lerpvalue1, lerpvalue2, randomLerp)); + dustMovement.X *= MathHelper.Lerp(2.2f, 0.6f, randomLerp); + dustMovement.X *= -1f; + Vector2 dustMovement2 = new Vector2(2f, 10f); + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * dustMovement * 0.5f + dustMovement2; + Dust stormy = Main.dust[Dust.NewDust(position4, 0, 0, 187, 0f, 0f, 0, default, 0.5f)]; + stormy.position = position4; + stormy.customData = Projectile.Center + dustMovement2; + stormy.fadeIn = 1f; + stormy.scale = 0.3f; + if (dustMovement.X > -1.2f) { - dust34.velocity.X = 1f + Main.rand.NextFloat(); + stormy.velocity.X = 1f + Main.rand.NextFloat(); } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + stormy.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 0.8f; Projectile.direction = 1; - Point point9 = Projectile.Center.ToTileCoordinates(); - Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Point projCenter = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(projCenter.X * 16 + 8), (float)(projCenter.Y * 16 + 8)); } Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; if (Projectile.localAI[1] < 33f) @@ -92,30 +92,30 @@ namespace CalamityMod.Projectiles.Melee { Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } - for (int num1135 = 0; num1135 < 2; num1135++) + for (int j = 0; j < 2; j++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = Projectile.Opacity * Projectile.localAI[0]; - dust35.position = Projectile.Center; - dust35.velocity = value83 * 2.5f; + Vector2 dustVel = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust stormDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1f)]; + stormDust.noGravity = true; + stormDust.noLight = true; + stormDust.scale = Projectile.Opacity * Projectile.localAI[0]; + stormDust.position = Projectile.Center; + stormDust.velocity = dustVel * 2.5f; } } for (int num1136 = 0; num1136 < 2; num1136++) { if (Main.rand.NextBool(10)) { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = Projectile.Opacity * Projectile.localAI[0]; - dust36.position = Projectile.Center; - dust36.velocity = value84 * 2.5f; + Vector2 dustVel2 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); + Dust stormDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1.5f)]; + stormDust2.noGravity = true; + stormDust2.noLight = true; + stormDust2.scale = Projectile.Opacity * Projectile.localAI[0]; + stormDust2.position = Projectile.Center; + stormDust2.velocity = dustVel2 * 2.5f; } } if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) @@ -136,16 +136,16 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - 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)); - Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Color originalColor = 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)); + Vector2 drawPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D27 = ModContent.Request(Texture).Value; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, SpriteEffects.None, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, SpriteEffects.None, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, SpriteEffects.None, 0); + Rectangle rectangl = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alphaColor = Projectile.GetAlpha(originalColor); + Vector2 halfRect = rectangl.Size() / 2f; + Color whiteColor = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangl), whiteColor, 0f, halfRect, new Vector2(1f, 5f) * Projectile.scale * 2f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangl), alphaColor, Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangl), alphaColor, 0f, halfRect, new Vector2(1f, 8f) * Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Melee/SulphurousGrabberBubble.cs b/Projectiles/Melee/SulphurousGrabberBubble.cs index 5054d746ab..1898eba9e7 100644 --- a/Projectiles/Melee/SulphurousGrabberBubble.cs +++ b/Projectiles/Melee/SulphurousGrabberBubble.cs @@ -32,13 +32,13 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item54, Projectile.position); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) + int randAmt = Main.rand.Next(5, 9); + for (int i = 0; i < randAmt; i++) { - int num192 = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 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 toxicDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); + Main.dust[toxicDust].velocity *= 0.8f; + Main.dust[toxicDust].position = Vector2.Lerp(Main.dust[toxicDust].position, Projectile.Center, 0.5f); + Main.dust[toxicDust].noGravity = true; } } } diff --git a/Projectiles/Melee/SulphurousGrabberBubble2.cs b/Projectiles/Melee/SulphurousGrabberBubble2.cs index 3930c4100b..b16fdbf074 100644 --- a/Projectiles/Melee/SulphurousGrabberBubble2.cs +++ b/Projectiles/Melee/SulphurousGrabberBubble2.cs @@ -33,13 +33,13 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item54, Projectile.position); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) + int randAmt = Main.rand.Next(5, 9); + for (int i = 0; i < randAmt; i++) { - int num192 = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 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 toxicDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); + Main.dust[toxicDust].velocity *= 0.8f; + Main.dust[toxicDust].position = Vector2.Lerp(Main.dust[toxicDust].position, Projectile.Center, 0.5f); + Main.dust[toxicDust].noGravity = true; } } } diff --git a/Projectiles/Melee/SwordsplosionBlue.cs b/Projectiles/Melee/SwordsplosionBlue.cs index 4e0c6b87b6..ea04cb0b27 100644 --- a/Projectiles/Melee/SwordsplosionBlue.cs +++ b/Projectiles/Melee/SwordsplosionBlue.cs @@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); if (Projectile.localAI[1] > 7f) { - int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num308].velocity *= 0.1f; - Main.dust[num308].noGravity = true; + int blueBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[blueBoi].velocity *= 0.1f; + Main.dust[blueBoi].noGravity = true; } Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); } @@ -55,8 +55,8 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num308].noGravity = true; + int blueBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[blueBoi].noGravity = true; } } } diff --git a/Projectiles/Melee/SwordsplosionGreen.cs b/Projectiles/Melee/SwordsplosionGreen.cs index 4c6520db9a..8643a98643 100644 --- a/Projectiles/Melee/SwordsplosionGreen.cs +++ b/Projectiles/Melee/SwordsplosionGreen.cs @@ -28,9 +28,9 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); if (Projectile.localAI[1] > 7f) { - int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(53, Main.DiscoG, 255), 1.2f); - Main.dust[num308].velocity *= 0.1f; - Main.dust[num308].noGravity = true; + int greenBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(53, Main.DiscoG, 255), 1.2f); + Main.dust[greenBoi].velocity *= 0.1f; + Main.dust[greenBoi].noGravity = true; } Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); } @@ -54,8 +54,8 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(53, Main.DiscoG, 255), 1.2f); - Main.dust[num308].noGravity = true; + int greenBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(53, Main.DiscoG, 255), 1.2f); + Main.dust[greenBoi].noGravity = true; } } } diff --git a/Projectiles/Melee/SwordsplosionPurple.cs b/Projectiles/Melee/SwordsplosionPurple.cs index 992fc4b9ba..8dd5acffab 100644 --- a/Projectiles/Melee/SwordsplosionPurple.cs +++ b/Projectiles/Melee/SwordsplosionPurple.cs @@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); if (Projectile.localAI[1] > 7f) { - int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); - Main.dust[num308].velocity *= 0.1f; - Main.dust[num308].noGravity = true; + int purpleBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + Main.dust[purpleBoi].velocity *= 0.1f; + Main.dust[purpleBoi].noGravity = true; } Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); } @@ -55,8 +55,8 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); - Main.dust[num308].noGravity = true; + int purpleBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + Main.dust[purpleBoi].noGravity = true; } } } diff --git a/Projectiles/Melee/SwordsplosionRed.cs b/Projectiles/Melee/SwordsplosionRed.cs index e56c929093..eb591be3bc 100644 --- a/Projectiles/Melee/SwordsplosionRed.cs +++ b/Projectiles/Melee/SwordsplosionRed.cs @@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); if (Projectile.localAI[1] > 7f) { - int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(255, Main.DiscoG, 53), 1.2f); - Main.dust[num308].velocity *= 0.1f; - Main.dust[num308].noGravity = true; + int redBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(255, Main.DiscoG, 53), 1.2f); + Main.dust[redBoi].velocity *= 0.1f; + Main.dust[redBoi].noGravity = true; } Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); } @@ -55,8 +55,8 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(255, Main.DiscoG, 53), 1.2f); - Main.dust[num308].noGravity = true; + int redBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(255, Main.DiscoG, 53), 1.2f); + Main.dust[redBoi].noGravity = true; } } } diff --git a/Projectiles/Melee/TerraSpear.cs b/Projectiles/Melee/TerraSpear.cs index a542f77883..90e863d103 100644 --- a/Projectiles/Melee/TerraSpear.cs +++ b/Projectiles/Melee/TerraSpear.cs @@ -57,19 +57,19 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) + int inc; + for (int i = 4; i < 31; i = inc + 1) { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; + float projOldX = Projectile.oldVelocity.X * (30f / (float)i); + float projOldY = Projectile.oldVelocity.Y * (30f / (float)i); + int terraDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[terraDust].noGravity = true; + Dust dust = Main.dust[terraDust]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; + terraDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[terraDust]; dust.velocity *= 0.05f; - num3 = num795; + inc = i; } } diff --git a/Projectiles/Melee/TerrorBlast.cs b/Projectiles/Melee/TerrorBlast.cs index 86eb76f8f7..cf21a58e37 100644 --- a/Projectiles/Melee/TerrorBlast.cs +++ b/Projectiles/Melee/TerrorBlast.cs @@ -42,12 +42,12 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 60; i++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 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, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int scaryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); + Main.dust[scaryDust].noGravity = true; + Main.dust[scaryDust].velocity *= 3f; + scaryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[scaryDust].velocity *= 2f; + Main.dust[scaryDust].noGravity = true; } // Guarantee a hit on all nearby enemies when the projectile explodes. Changing localAI[0] enables it to hit. diff --git a/Projectiles/Melee/TinyCrystal.cs b/Projectiles/Melee/TinyCrystal.cs index 47a5cd8bca..42b024e9a1 100644 --- a/Projectiles/Melee/TinyCrystal.cs +++ b/Projectiles/Melee/TinyCrystal.cs @@ -27,27 +27,27 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { int dustType = Projectile.ai[0] == 0f ? 56 : 73; - 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, dustType, 0f, 0f, 100, default, 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += Projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int dustPosModifier = 4; + int crystalDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosModifier, Projectile.position.Y + (float)dustPosModifier), Projectile.width - dustPosModifier * 2, Projectile.height - dustPosModifier * 2, dustType, 0f, 0f, 100, default, 1.2f); + Main.dust[crystalDust].noGravity = true; + Main.dust[crystalDust].velocity *= 0.1f; + Main.dust[crystalDust].velocity += Projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[crystalDust]; + expr_47FA_cp_0.position.X -= shortXVel; + Dust expr_4815_cp_0 = Main.dust[crystalDust]; + expr_4815_cp_0.position.Y -= shortYVel; } if (Main.rand.NextBool(10)) { - 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, dustType, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += Projectile.velocity * 0.5f; + int dustPosModifierAgain = 4; + int extraCrystalDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosModifierAgain, Projectile.position.Y + (float)dustPosModifierAgain), Projectile.width - dustPosModifierAgain * 2, Projectile.height - dustPosModifierAgain * 2, dustType, 0f, 0f, 100, default, 0.6f); + Main.dust[extraCrystalDust].velocity *= 0.25f; + Main.dust[extraCrystalDust].velocity += Projectile.velocity * 0.5f; } if (Projectile.timeLeft < 75) diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index 417f980dfc..ef6cb08da4 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -25,11 +25,11 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - 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, 174, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, 0.75f); + Main.dust[fiery].noGravity = true; + Main.dust[fiery].velocity *= 0f; } if (Projectile.timeLeft < 150) diff --git a/Projectiles/Melee/Tornado.cs b/Projectiles/Melee/Tornado.cs index 3ba1e8085d..8a0fe3f3eb 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -59,41 +59,40 @@ namespace CalamityMod.Projectiles.Melee } } - float num1125 = 900f; + float projTimer = 900f; if (Projectile.soundDelay == 0) { Projectile.soundDelay = -1; SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); } Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= num1125) + if (Projectile.ai[0] >= projTimer) { Projectile.Kill(); } if (Projectile.localAI[0] >= 30f) { Projectile.damage = 0; - if (Projectile.ai[0] < num1125 - 120f) + if (Projectile.ai[0] < projTimer - 120f) { - float num1126 = Projectile.ai[0] % 60f; - Projectile.ai[0] = num1125 - 120f + num1126; + float timeModulo = Projectile.ai[0] % 60f; + Projectile.ai[0] = projTimer - 120f + timeModulo; Projectile.netUpdate = true; } } - float num472 = Projectile.Center.X; - float num473 = Projectile.Center.Y; - float num474 = 600f; - for (int num475 = 0; num475 < Main.maxNPCs; num475++) + float projX = Projectile.Center.X; + float projY = Projectile.Center.Y; + for (int i = 0; i < Main.maxNPCs; i++) { - NPC npc = Main.npc[num475]; + NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { float npcCenterX = npc.position.X + (float)(npc.width / 2); float npcCenterY = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); - if (num478 < num474) + float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); + if (npcDist < 600f) { - if (npc.position.X < num472) + if (npc.position.X < projX) { npc.velocity.X += 0.02f; } @@ -101,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee { npc.velocity.X -= 0.02f; } - if (npc.position.Y < num473) + if (npc.position.Y < projY) { npc.velocity.Y += 0.02f; } @@ -112,44 +111,42 @@ namespace CalamityMod.Projectiles.Melee } } } - float num1127 = 15f; - float num1128 = 15f; - Point point8 = Projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - Projectile.width = (int)(value74.X * 0.65f); - Projectile.height = (int)value74.Y; - Projectile.Center = vector146; + Point projCenterTile = Projectile.Center.ToTileCoordinates(); + int sizeMod; + int sizeMod2; + Collision.ExpandVertically(projCenterTile.X, projCenterTile.Y, out sizeMod, out sizeMod2, 15, 15); + sizeMod++; + sizeMod2--; + Vector2 sizeModVector = new Vector2((float)projCenterTile.X, (float)sizeMod) * 16f + new Vector2(8f); + Vector2 sizeModVector2 = new Vector2((float)projCenterTile.X, (float)sizeMod2) * 16f + new Vector2(8f); + Vector2 centering = Vector2.Lerp(sizeModVector, sizeModVector2, 0.5f); + Vector2 sizeModPos = new Vector2(0f, sizeModVector2.Y - sizeModVector.Y); + sizeModPos.X = sizeModPos.Y * 0.2f; + Projectile.width = (int)(sizeModPos.X * 0.65f); + Projectile.height = (int)sizeModPos.Y; + Projectile.Center = centering; if (Projectile.owner == Main.myPlayer) { - bool flag74 = false; - Vector2 center16 = Main.player[Projectile.owner].Center; + bool breakFlag = false; + Vector2 playerCenter = Main.player[Projectile.owner].Center; Vector2 top = Main.player[Projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + for (float i = 0f; i < 1f; i += 0.05f) { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + Vector2 position2 = Vector2.Lerp(sizeModVector, sizeModVector2, i); + if (Collision.CanHitLine(position2, 0, 0, playerCenter, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) { - flag74 = true; + breakFlag = true; break; } } - if (!flag74 && Projectile.ai[0] < num1125 - 120f) + if (!breakFlag && Projectile.ai[0] < projTimer - 120f) { - float num1132 = Projectile.ai[0] % 60f; - Projectile.ai[0] = num1125 - 120f + num1132; + float aiDecrement = Projectile.ai[0] % 60f; + Projectile.ai[0] = projTimer - 120f + aiDecrement; Projectile.netUpdate = true; } } - if (Projectile.ai[0] < num1125 - 120f) + if (Projectile.ai[0] < projTimer - 120f) { return; } @@ -157,57 +154,54 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = Projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) + float aiTracker = Projectile.ai[0]; + float trackerClamp = MathHelper.Clamp(aiTracker / 30f, 0f, 1f); + if (aiTracker > 540f) { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + trackerClamp = MathHelper.Lerp(1f, 0f, (aiTracker - 540f) / 60f); } - Point point5 = Projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); + Point centerPoint = Projectile.Center.ToTileCoordinates(); + int sizeModding; + int sizeModding2; + Collision.ExpandVertically(centerPoint.X, centerPoint.Y, out sizeModding, out sizeModding2, 15, 15); + sizeModding++; + sizeModding2--; + float vectorMult = 0.2f; + Vector2 sizeModdingVector = new Vector2((float)centerPoint.X, (float)sizeModding) * 16f + new Vector2(8f); + Vector2 sizeModdingVector2 = new Vector2((float)centerPoint.X, (float)sizeModding2) * 16f + new Vector2(8f); + Vector2.Lerp(sizeModdingVector, sizeModdingVector2, 0.5f); + Vector2 sizeModdingPos = new Vector2(0f, sizeModdingVector2.Y - sizeModdingVector.Y); + sizeModdingPos.X = sizeModdingPos.Y * vectorMult; + new Vector2(sizeModdingVector.X - sizeModdingPos.X / 2f, sizeModdingVector.Y); Texture2D texture2D23 = ModContent.Request(Texture).Value; - Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Color value34 = new Color(225, 225, 225); - for (float num236 = (float)(int)value33.Y; num236 > (float)(int)value32.Y; num236 -= num235) + Rectangle drawRectangle = texture2D23.Frame(1, 1, 0, 0); + Vector2 smallRect = drawRectangle.Size() / 2f; + float aiTrackMult = -0.06283186f * aiTracker; + Vector2 spinningpoint = Vector2.UnitY.RotatedBy((double)(aiTracker * 0.1f), default); + float incrementStorage = 0f; + float increment = 5.1f; + Color cloudColor = new Color(225, 225, 225); + for (float j = (float)(int)sizeModdingVector2.Y; j > (float)(int)sizeModdingVector.Y; j -= increment) { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) + incrementStorage += increment; + float colorChanger = incrementStorage / sizeModdingPos.Y; + float incStorageMult = incrementStorage * 6.28318548f / -20f; + float lowerColorChanger = colorChanger - 0.15f; + Vector2 spinArea = spinningpoint.RotatedBy((double)incStorageMult, default); + Vector2 colorChangeVector = new Vector2(0f, colorChanger + 1f); + colorChangeVector.X = colorChangeVector.Y * vectorMult; + Color newCloudColor = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, cloudColor, colorChanger * 2f); + if (colorChanger > 0.5f) { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + newCloudColor = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, cloudColor, 2f - colorChanger * 2f); } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0); + newCloudColor.A = (byte)((float)newCloudColor.A * 0.5f); + newCloudColor *= trackerClamp; + spinArea *= colorChangeVector * 100f; + spinArea.Y = 0f; + spinArea.X = 0f; + spinArea += new Vector2(sizeModdingVector2.X, j) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), newCloudColor, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs index 826d855d53..f1595d901b 100644 --- a/Projectiles/Melee/TriactisHammerProj.cs +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -52,46 +52,45 @@ namespace CalamityMod.Projectiles.Melee else { Projectile.tileCollide = false; - float num42 = 20f; - float num43 = 5f; - Vector2 vector2 = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); - float num44 = Main.player[Projectile.owner].position.X + Main.player[Projectile.owner].width / 2 - vector2.X; - float num45 = Main.player[Projectile.owner].position.Y + Main.player[Projectile.owner].height / 2 - vector2.Y; - float num46 = (float)Math.Sqrt(num44 * num44 + num45 * num45); - if (num46 > 3000f) + float projVelModifier = 5f; + Vector2 projDirection = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); + float projXDist = Main.player[Projectile.owner].position.X + Main.player[Projectile.owner].width / 2 - projDirection.X; + float projYDist = Main.player[Projectile.owner].position.Y + Main.player[Projectile.owner].height / 2 - projDirection.Y; + float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); + if (projDistance > 3000f) Projectile.Kill(); - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (Projectile.velocity.X < num44) + projDistance = 20f / projDistance; + projXDist *= projDistance; + projYDist *= projDistance; + if (Projectile.velocity.X < projXDist) { - Projectile.velocity.X = Projectile.velocity.X + num43; - if (Projectile.velocity.X < 0f && num44 > 0f) - Projectile.velocity.X = Projectile.velocity.X + num43; + Projectile.velocity.X = Projectile.velocity.X + projVelModifier; + if (Projectile.velocity.X < 0f && projXDist > 0f) + Projectile.velocity.X = Projectile.velocity.X + projVelModifier; } - else if (Projectile.velocity.X > num44) + else if (Projectile.velocity.X > projXDist) { - Projectile.velocity.X = Projectile.velocity.X - num43; - if (Projectile.velocity.X > 0f && num44 < 0f) - Projectile.velocity.X = Projectile.velocity.X - num43; + Projectile.velocity.X = Projectile.velocity.X - projVelModifier; + if (Projectile.velocity.X > 0f && projXDist < 0f) + Projectile.velocity.X = Projectile.velocity.X - projVelModifier; } - if (Projectile.velocity.Y < num45) + if (Projectile.velocity.Y < projYDist) { - Projectile.velocity.Y = Projectile.velocity.Y + num43; - if (Projectile.velocity.Y < 0f && num45 > 0f) - Projectile.velocity.Y = Projectile.velocity.Y + num43; + Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier; + if (Projectile.velocity.Y < 0f && projYDist > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier; } - else if (Projectile.velocity.Y > num45) + else if (Projectile.velocity.Y > projYDist) { - Projectile.velocity.Y = Projectile.velocity.Y - num43; - if (Projectile.velocity.Y > 0f && num45 < 0f) - Projectile.velocity.Y = Projectile.velocity.Y - num43; + Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier; + if (Projectile.velocity.Y > 0f && projYDist < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier; } if (Main.myPlayer == Projectile.owner) { Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); - if (rectangle.Intersects(value2)) + Rectangle playerArea = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); + if (rectangle.Intersects(playerArea)) Projectile.Kill(); } } @@ -108,23 +107,23 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int triactisDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[triactisDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[triactisDust].scale = 0.5f; + Main.dust[triactisDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 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, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int triactisDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 3f); + Main.dust[triactisDust2].noGravity = true; + Main.dust[triactisDust2].velocity *= 5f; + triactisDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[triactisDust2].velocity *= 2f; } } @@ -133,23 +132,23 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int triactisDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[triactisDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[triactisDust].scale = 0.5f; + Main.dust[triactisDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 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, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int triactisDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 3f); + Main.dust[triactisDust2].noGravity = true; + Main.dust[triactisDust2].velocity *= 5f; + triactisDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[triactisDust2].velocity *= 2f; } } diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs index 4cc393c505..dc9b04bf46 100644 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ b/Projectiles/Melee/TrueCausticEdgeProjectile.cs @@ -74,19 +74,19 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) + int inc; + for (int i = 4; i < 31; i = inc + 1) { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 44, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; + float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); + float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); + int causticDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, 44, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[causticDust].noGravity = true; + Dust dust = Main.dust[causticDust]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 44, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; + causticDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, 44, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust = Main.dust[causticDust]; dust.velocity *= 0.05f; - num3 = num795; + inc = i; } } } diff --git a/Projectiles/Melee/TumbleweedFlail.cs b/Projectiles/Melee/TumbleweedFlail.cs index 1dfd79bdac..784bb98e58 100644 --- a/Projectiles/Melee/TumbleweedFlail.cs +++ b/Projectiles/Melee/TumbleweedFlail.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Vector2 vector62 = Main.player[Projectile.owner].Center - Projectile.Center; + Vector2 projDirection = Main.player[Projectile.owner].Center - Projectile.Center; Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; if (Main.player[Projectile.owner].dead) { @@ -31,8 +31,8 @@ namespace CalamityMod.Projectiles.Melee } Main.player[Projectile.owner].itemAnimation = 10; Main.player[Projectile.owner].itemTime = 10; - float arg_1DC8F_0 = vector62.X; - if (vector62.X < 0f) + float arg_1DC8F_0 = projDirection.X; + if (projDirection.X < 0f) { Main.player[Projectile.owner].ChangeDir(1); Projectile.direction = 1; @@ -42,32 +42,32 @@ namespace CalamityMod.Projectiles.Melee Main.player[Projectile.owner].ChangeDir(-1); Projectile.direction = -1; } - Main.player[Projectile.owner].itemRotation = (vector62 * -1f * (float)Projectile.direction).ToRotation(); - Projectile.spriteDirection = (vector62.X > 0f) ? -1 : 1; - if (Projectile.ai[0] == 0f && vector62.Length() > 400f) + Main.player[Projectile.owner].itemRotation = (projDirection * -1f * (float)Projectile.direction).ToRotation(); + Projectile.spriteDirection = (projDirection.X > 0f) ? -1 : 1; + if (Projectile.ai[0] == 0f && projDirection.Length() > 400f) { Projectile.ai[0] = 1f; } if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) { - float num693 = vector62.Length(); - if (num693 > 1500f) + float projDistance = projDirection.Length(); + if (projDistance > 1500f) { Projectile.Kill(); return; } - if (num693 > 600f) + if (projDistance > 600f) { Projectile.ai[0] = 2f; } Projectile.tileCollide = false; - float num694 = 20f; + float returnLength = 20f; if (Projectile.ai[0] == 2f) { - num694 = 40f; + returnLength = 40f; } - Projectile.velocity = Vector2.Normalize(vector62) * num694; - if (vector62.Length() < num694) + Projectile.velocity = Vector2.Normalize(projDirection) * returnLength; + if (projDirection.Length() < returnLength) { Projectile.Kill(); return; @@ -93,35 +93,35 @@ namespace CalamityMod.Projectiles.Melee { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Texture2D texture2D2 = ModContent.Request("CalamityMod/Projectiles/Melee/TumbleweedChain").Value; - Vector2 vector17 = Projectile.Center; + Vector2 projCenter = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + float projHeight = (float)texture2D2.Height; + Vector2 actualCenter = mountedCenter - projCenter; + float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + bool isActive = true; + if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { - flag13 = false; + isActive = false; } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y)) { - flag13 = false; + isActive = false; } - while (flag13) + while (isActive) { - if (vector18.Length() < num91 + 1f) + if (actualCenter.Length() < projHeight + 1f) { - flag13 = false; + isActive = false; } else { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0); + Vector2 centerCopy = actualCenter; + centerCopy.Normalize(); + projCenter += centerCopy * projHeight; + actualCenter = mountedCenter - projCenter; + Color drawArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, drawArea, projRotation, origin, 1f, SpriteEffects.None, 0); } } return true; @@ -130,23 +130,23 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.position); - 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, 32, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int tumbleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1.2f); + Main.dust[tumbleDust].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[tumbleDust].scale = 0.5f; + Main.dust[tumbleDust].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, 85, 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, 85, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int tumbleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.7f); + Main.dust[tumbleDust2].noGravity = true; + Main.dust[tumbleDust2].velocity *= 5f; + tumbleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + Main.dust[tumbleDust2].velocity *= 2f; } if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Melee/TumbleweedRolling.cs b/Projectiles/Melee/TumbleweedRolling.cs index 7feae93ae6..95bfd673e6 100644 --- a/Projectiles/Melee/TumbleweedRolling.cs +++ b/Projectiles/Melee/TumbleweedRolling.cs @@ -49,23 +49,23 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.position); - 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, 32, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int tumbleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1.2f); + Main.dust[tumbleDust].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[tumbleDust].scale = 0.5f; + Main.dust[tumbleDust].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, 85, 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, 85, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int tumbleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.7f); + Main.dust[tumbleDust2].noGravity = true; + Main.dust[tumbleDust2].velocity *= 5f; + tumbleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + Main.dust[tumbleDust2].velocity *= 2f; } } } diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index 036c41542d..e0378a8aca 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Projectiles.Melee float inertia = 50f * Projectile.ai[1]; //100 float speed = 10f * Projectile.ai[1]; //5 - float num954 = 40f; if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; @@ -59,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee Player player = Main.player[Projectile.owner]; if (player.active && !player.dead) { - if (Projectile.Distance(player.Center) > num954) + if (Projectile.Distance(player.Center) > 40f) { Vector2 moveDirection = Projectile.SafeDirectionTo(player.Center, Vector2.UnitY); Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; @@ -77,12 +76,12 @@ namespace CalamityMod.Projectiles.Melee 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; + 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, num214)), - Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + 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; } @@ -98,18 +97,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = 64; Projectile.position.X -= (float)(Projectile.width / 2); Projectile.position.Y -= (float)(Projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(Projectile.position, 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(Projectile.position, 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(Projectile.position, 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 bubblyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[bubblyDust].noGravity = true; + Main.dust[bubblyDust].velocity *= 3f; + bubblyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[bubblyDust].velocity *= 2f; + Main.dust[bubblyDust].noGravity = true; } Projectile.maxPenetrate = -1; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 4d35054de9..778538f088 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -3,7 +3,7 @@ using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using System; using Terraria; -using Terraria.Enums; +using Terraria.EnumTimers; using Terraria.Localization; using Terraria.ModLoader; @@ -31,13 +31,13 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - float num = 50f; - float num2 = 2f; + float spinTimer = 50f; + float rotationFactor = 2f; float scaleFactor = 20f; Player player = Main.player[Projectile.owner]; - float num3 = -0.7853982f; - Vector2 value = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value2 = Vector2.Zero; + float rotationSpeed = -0.7853982f; + Vector2 actualPosition = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 rotationPoint = Vector2.Zero; if (player.dead) { @@ -45,11 +45,11 @@ namespace CalamityMod.Projectiles.Melee return; } Lighting.AddLight(player.Center, 0f, 0.2f, 1.45f); - int num9 = Math.Sign(Projectile.velocity.X); - Projectile.velocity = new Vector2((float)num9, 0f); + int rotationVel = Math.Sign(Projectile.velocity.X); + Projectile.velocity = new Vector2((float)rotationVel, 0f); if (Projectile.ai[0] == 0f) { - Projectile.rotation = new Vector2((float)num9, -player.gravDir).ToRotation() + num3 + 3.14159274f; + Projectile.rotation = new Vector2((float)rotationVel, -player.gravDir).ToRotation() + rotationSpeed + 3.14159274f; if (Projectile.velocity.X < 0f) { Projectile.rotation -= 1.57079637f; @@ -60,17 +60,16 @@ namespace CalamityMod.Projectiles.Melee { Projectile.alpha = 0; } - float arg_5DB_0 = Projectile.ai[0] / num; - float num10 = 1f; - Projectile.ai[0] += num10; - Projectile.rotation += 6.28318548f * num2 / num * (float)num9; - bool flag2 = Projectile.ai[0] == (float)(int)(num / 2f); - if (Projectile.ai[0] >= num || (flag2 && !player.controlUseItem)) + float arg_5DB_0 = Projectile.ai[0] / spinTimer; + Projectile.ai[0] += 1f; + Projectile.rotation += 6.28318548f * rotationFactor / spinTimer * (float)rotationVel; + bool isUsing = Projectile.ai[0] == (float)(int)(spinTimer / 2f); + if (Projectile.ai[0] >= spinTimer || (isUsing && !player.controlUseItem)) { Projectile.Kill(); player.reuseDelay = 2; } - else if (flag2) + else if (isUsing) { int expectedDirection = (player.SafeDirectionTo(Main.MouseWorld).X > 0f).ToDirectionInt(); if (expectedDirection != Projectile.velocity.X) @@ -81,15 +80,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.netUpdate = true; } } - float num12 = Projectile.rotation - 0.7853982f * (float)num9; - value2 = (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * (Projectile.ai[0] / num) * scaleFactor; - Vector2 value3 = Projectile.Center + (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * 30f; - Vector2 vector2 = num12.ToRotationVector2(); - Vector2 value4 = vector2.RotatedBy((double)(1.57079637f * (float)Projectile.spriteDirection), default); + float rotateDirection = Projectile.rotation - 0.7853982f * (float)rotationVel; + rotationPoint = (rotateDirection + ((rotationVel == -1) ? 3.14159274f : 0f)).ToRotationVector2() * (Projectile.ai[0] / spinTimer) * scaleFactor; + Vector2 dustSpawn = Projectile.Center + (rotateDirection + ((rotationVel == -1) ? 3.14159274f : 0f)).ToRotationVector2() * 30f; + Vector2 staffTipDirection = rotateDirection.ToRotationVector2(); + Vector2 tipDustDirection = staffTipDirection.RotatedBy((double)(1.57079637f * (float)Projectile.spriteDirection), default); if (Main.rand.NextBool()) { - Dust dust3 = Dust.NewDustDirect(value3 - new Vector2(5f), 10, 10, 33, player.velocity.X, player.velocity.Y, 150, default, 1f); - dust3.velocity = Projectile.SafeDirectionTo(dust3.position) * 0.1f + dust3.velocity * 0.1f; + Dust staffDust = Dust.NewDustDirect(dustSpawn - new Vector2(5f), 10, 10, 33, player.velocity.X, player.velocity.Y, 150, default, 1f); + staffDust.velocity = Projectile.SafeDirectionTo(staffDust.position) * 0.1f + staffDust.velocity * 0.1f; } for (int j = 0; j < 4; j++) { @@ -111,20 +110,20 @@ namespace CalamityMod.Projectiles.Melee } if (Main.rand.Next(6) != 0) { - Dust dust4 = Dust.NewDustDirect(Projectile.position, 0, 0, 186, 0f, 0f, 100, default, 1f); - dust4.position = Projectile.Center + vector2 * (60f + Main.rand.NextFloat() * 20f) * scaleFactor3; - dust4.velocity = value4 * (4f + 4f * Main.rand.NextFloat()) * scaleFactor3 * scaleFactor2; - dust4.noGravity = true; - dust4.noLight = true; - dust4.scale = 0.5f; + Dust staffTipDust = Dust.NewDustDirect(Projectile.position, 0, 0, 186, 0f, 0f, 100, default, 1f); + staffTipDust.position = Projectile.Center + staffTipDirection * (60f + Main.rand.NextFloat() * 20f) * scaleFactor3; + staffTipDust.velocity = tipDustDirection * (4f + 4f * Main.rand.NextFloat()) * scaleFactor3 * scaleFactor2; + staffTipDust.noGravity = true; + staffTipDust.noLight = true; + staffTipDust.scale = 0.5f; if (Main.rand.NextBool(4)) { - dust4.noGravity = false; + staffTipDust.noGravity = false; } } } - Projectile.position = value - Projectile.Size / 2f; - Projectile.position += value2; + Projectile.position = actualPosition - Projectile.Size / 2f; + Projectile.position += rotationPoint; Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; player.ChangeDir(Projectile.direction); @@ -146,10 +145,10 @@ namespace CalamityMod.Projectiles.Melee public override void CutTiles() { - float num5 = 60f; + float cutRadius = 60f; float f = Projectile.rotation - 0.7853982f * (float)Math.Sign(Projectile.velocity.X); DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Utils.PlotTileLine(Projectile.Center + f.ToRotationVector2() * -num5, Projectile.Center + f.ToRotationVector2() * num5, (float)Projectile.width * Projectile.scale, DelegateMethods.CutTiles); + Utils.PlotTileLine(Projectile.Center + f.ToRotationVector2() * -cutRadius, Projectile.Center + f.ToRotationVector2() * cutRadius, (float)Projectile.width * Projectile.scale, DelegateMethods.CutTiles); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -159,9 +158,9 @@ namespace CalamityMod.Projectiles.Melee return true; } float f = Projectile.rotation - 0.7853982f * (float)Math.Sign(Projectile.velocity.X); - float num2 = 0f; - float num3 = 110f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + f.ToRotationVector2() * -num3, Projectile.Center + f.ToRotationVector2() * num3, 23f * Projectile.scale, ref num2)) + float rotationFactor = 0f; + float collisionRadius = 110f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + f.ToRotationVector2() * -collisionRadius, Projectile.Center + f.ToRotationVector2() * collisionRadius, 23f * Projectile.scale, ref rotationFactor)) { return true; } diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs index 9cf40df931..0b2f2a3f12 100644 --- a/Projectiles/Melee/UltimusCleaverDust.cs +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -56,26 +56,26 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[num199]; + int coldFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[coldFire]; expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[num199]; + Dust expr_8994_cp_0 = Main.dust[coldFire]; expr_8994_cp_0.position.Y += 2f; - Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num199].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[num199]; + Main.dust[coldFire].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[coldFire].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[coldFire]; expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[num200]; + int coldFiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[coldFiery]; expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[num200]; + Dust expr_8A6C_cp_0 = Main.dust[coldFiery]; expr_8A6C_cp_0.position.Y += 2f; - Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; + Main.dust[coldFiery].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[coldFiery].noGravity = true; + Main.dust[coldFiery].velocity *= 0.1f; } if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) diff --git a/Projectiles/Melee/UrchinBall.cs b/Projectiles/Melee/UrchinBall.cs index 2d506c0de6..81215289ed 100644 --- a/Projectiles/Melee/UrchinBall.cs +++ b/Projectiles/Melee/UrchinBall.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Player player = Main.player[Projectile.owner]; - Vector2 vector62 = player.Center - Projectile.Center; - Projectile.rotation = vector62.ToRotation() - 1.57f; + Vector2 projDirection = player.Center - Projectile.Center; + Projectile.rotation = projDirection.ToRotation() - 1.57f; if (player.dead) { Projectile.Kill(); @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee } player.itemAnimation = 10; player.itemTime = 10; - if (vector62.X < 0f) + if (projDirection.X < 0f) { player.ChangeDir(1); Projectile.direction = 1; @@ -48,9 +48,9 @@ namespace CalamityMod.Projectiles.Melee player.ChangeDir(-1); Projectile.direction = -1; } - player.itemRotation = (vector62 * -1f * (float)Projectile.direction).ToRotation(); - Projectile.spriteDirection = (vector62.X > 0f) ? -1 : 1; - if (Projectile.ai[0] == 0f && vector62.Length() > 400f) + player.itemRotation = (projDirection * -1f * (float)Projectile.direction).ToRotation(); + Projectile.spriteDirection = (projDirection.X > 0f) ? -1 : 1; + if (Projectile.ai[0] == 0f && projDirection.Length() > 400f) { Projectile.ai[0] = 1f; } @@ -62,24 +62,24 @@ namespace CalamityMod.Projectiles.Melee Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); } Projectile.usesLocalNPCImmunity = false; - float num693 = vector62.Length(); - if (num693 > 1500f) + float projDistance = projDirection.Length(); + if (projDistance > 1500f) { Projectile.Kill(); return; } - if (num693 > 600f) + if (projDistance > 600f) { Projectile.ai[0] = 2f; } Projectile.tileCollide = false; - float num694 = 20f; + float returnLength = 20f; if (Projectile.ai[0] == 2f) { - num694 = 40f; + returnLength = 40f; } - Projectile.velocity = Vector2.Normalize(vector62) * num694; - if (vector62.Length() < num694) + Projectile.velocity = Vector2.Normalize(projDirection) * returnLength; + if (projDirection.Length() < returnLength) { Projectile.Kill(); return; @@ -105,35 +105,35 @@ namespace CalamityMod.Projectiles.Melee { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Texture2D texture2D2 = ModContent.Request("CalamityMod/Projectiles/Melee/UrchinFlailChain").Value; - Vector2 vector17 = Projectile.Center; + Vector2 projCenter = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + float projHeight = (float)texture2D2.Height; + Vector2 actualCenter = mountedCenter - projCenter; + float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + bool isActive = true; + if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { - flag13 = false; + isActive = false; } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y)) { - flag13 = false; + isActive = false; } - while (flag13) + while (isActive) { - if (vector18.Length() < num91 + 1f) + if (actualCenter.Length() < projHeight + 1f) { - flag13 = false; + isActive = false; } else { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0); + Vector2 centerCopy = actualCenter; + centerCopy.Normalize(); + projCenter += centerCopy * projHeight; + actualCenter = mountedCenter - projCenter; + Color drawArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, drawArea, projRotation, origin, 1f, SpriteEffects.None, 0); } } return true; diff --git a/Projectiles/Melee/UrchinBallSpike.cs b/Projectiles/Melee/UrchinBallSpike.cs index d29cd719be..238fee7564 100644 --- a/Projectiles/Melee/UrchinBallSpike.cs +++ b/Projectiles/Melee/UrchinBallSpike.cs @@ -54,11 +54,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 20; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num194 = 0; num194 < 20; num194++) + for (int i = 0; i < 20; i++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; + int urchin = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); + Main.dust[urchin].noGravity = true; + Main.dust[urchin].velocity *= 2f; } } diff --git a/Projectiles/Melee/VolcanicFireball.cs b/Projectiles/Melee/VolcanicFireball.cs index 52fad75e47..1d3a7398f6 100644 --- a/Projectiles/Melee/VolcanicFireball.cs +++ b/Projectiles/Melee/VolcanicFireball.cs @@ -41,9 +41,9 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0f); 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 volcano = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); + Main.dust[volcano].noGravity = true; + Main.dust[volcano].velocity *= 0f; } } @@ -51,9 +51,9 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, 0f, 0f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int volcano = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, 0f, 0f); + Main.dust[volcano].noGravity = true; + Main.dust[volcano].velocity *= 0f; } } diff --git a/Projectiles/Melee/VolcanicFireballLarge.cs b/Projectiles/Melee/VolcanicFireballLarge.cs index 5c205a0238..9aed240398 100644 --- a/Projectiles/Melee/VolcanicFireballLarge.cs +++ b/Projectiles/Melee/VolcanicFireballLarge.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0f); 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 volcano = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); + Main.dust[volcano].noGravity = true; + Main.dust[volcano].velocity *= 0f; } } @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, 0f, 0f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int volcano = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, 0f, 0f); + Main.dust[volcano].noGravity = true; + Main.dust[volcano].velocity *= 0f; } } diff --git a/Projectiles/Melee/Waterfall.cs b/Projectiles/Melee/Waterfall.cs index 38cc9e8418..183b47508a 100644 --- a/Projectiles/Melee/Waterfall.cs +++ b/Projectiles/Melee/Waterfall.cs @@ -28,33 +28,33 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - 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, 56, 0f, 0f, 100, default, 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.25f; - Main.dust[num96].velocity += Projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int fourConst = 4; + int watery = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 56, 0f, 0f, 100, default, 1.2f); + Main.dust[watery].noGravity = true; + Main.dust[watery].velocity *= 0.25f; + Main.dust[watery].velocity += Projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[watery]; + expr_47FA_cp_0.position.X -= shortXVel; + Dust expr_4815_cp_0 = Main.dust[watery]; + expr_4815_cp_0.position.Y -= shortYVel; } - 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 num102 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 245, 0f, 0f, 100, default, 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += Projectile.velocity * 0.25f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y -= num100; + float shortXVel2 = Projectile.velocity.X / 3f * (float)j; + float shortYVel2 = Projectile.velocity.Y / 3f * (float)j; + int otherFourConst = 4; + int superWet = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 245, 0f, 0f, 100, default, 1.2f); + Main.dust[superWet].noGravity = true; + Main.dust[superWet].velocity *= 0.1f; + Main.dust[superWet].velocity += Projectile.velocity * 0.25f; + Dust expr_47FA_cp_0 = Main.dust[superWet]; + expr_47FA_cp_0.position.X -= shortXVel2; + Dust expr_4815_cp_0 = Main.dust[superWet]; + expr_4815_cp_0.position.Y -= shortYVel2; } Projectile.ai[1] += 1f; diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs index 04f62d7631..195648c6bc 100644 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ b/Projectiles/Melee/WhiteBoltAura.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Projectiles.Melee 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 randOrbXOffset = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int randOrbYOffset = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)randOrbXOffset, (float)randOrbYOffset, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } } @@ -47,26 +47,26 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.localAI[0] >= 10f) { Projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = Projectile.type; - for (int num420 = 0; num420 < 1000; num420++) + int projTimer = 0; + int incTracker = 0; + float aiTracker = 0f; + int theProjectile = Projectile.type; + for (int j = 0; j < 1000; j++) { - if (Main.projectile[num420].active && Main.projectile[num420].owner == Projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + if (Main.projectile[j].active && Main.projectile[j].owner == Projectile.owner && Main.projectile[j].type == theProjectile && Main.projectile[j].ai[1] < 3600f) { - num416++; - if (Main.projectile[num420].ai[1] > num418) + projTimer++; + if (Main.projectile[j].ai[1] > aiTracker) { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; + incTracker = j; + aiTracker = Main.projectile[j].ai[1]; } } } - if (num416 > 1) + if (projTimer > 1) { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; + Main.projectile[incTracker].netUpdate = true; + Main.projectile[incTracker].ai[1] = 36000f; } } } diff --git a/Projectiles/Melee/WhiteOrb.cs b/Projectiles/Melee/WhiteOrb.cs index b74f4bdc2b..0b70581667 100644 --- a/Projectiles/Melee/WhiteOrb.cs +++ b/Projectiles/Melee/WhiteOrb.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { 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, 91, 0f, 0f, 100, default, 1.25f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int shiny = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f); + Main.dust[shiny].noGravity = true; + Main.dust[shiny].velocity *= 0.5f; + Main.dust[shiny].velocity += Projectile.velocity * 0.1f; } } } diff --git a/Projectiles/Melee/Whiterain.cs b/Projectiles/Melee/Whiterain.cs index 51cac12528..9f6c09a1fe 100644 --- a/Projectiles/Melee/Whiterain.cs +++ b/Projectiles/Melee/Whiterain.cs @@ -33,12 +33,12 @@ namespace CalamityMod.Projectiles.Melee 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, 91, 0f, 0f, 100, default, 1.25f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += Projectile.velocity * 0.1f; + int shiny = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f); + Main.dust[shiny].noGravity = true; + Main.dust[shiny].velocity *= 0.5f; + Main.dust[shiny].velocity += Projectile.velocity * 0.1f; } CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); diff --git a/Projectiles/Melee/YateveoBloomProj.cs b/Projectiles/Melee/YateveoBloomProj.cs index d1e9127de6..0e0aee2827 100644 --- a/Projectiles/Melee/YateveoBloomProj.cs +++ b/Projectiles/Melee/YateveoBloomProj.cs @@ -23,9 +23,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Vector2 vector62 = Main.player[Projectile.owner].MountedCenter - Projectile.Center; - Projectile.rotation = vector62.ToRotation() - 1.57f; - float distance = vector62.Length(); + Vector2 projDirection = Main.player[Projectile.owner].MountedCenter - Projectile.Center; + Projectile.rotation = projDirection.ToRotation() - 1.57f; + float distance = projDirection.Length(); if (Main.player[Projectile.owner].dead) { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee Main.player[Projectile.owner].itemAnimation = 10; Main.player[Projectile.owner].itemTime = 10; - if (vector62.X < 0f) + if (projDirection.X < 0f) { Main.player[Projectile.owner].ChangeDir(1); Projectile.direction = 1; @@ -66,8 +66,8 @@ namespace CalamityMod.Projectiles.Melee } else { - float num211 = 14f / Main.player[Projectile.owner].GetAttackSpeed() * 1.25f; - float num212 = 0.9f / Main.player[Projectile.owner].GetAttackSpeed() * 1.25f; + float meleeSpeedDistance = 14f / Main.player[Projectile.owner].GetAttackSpeed() * 1.25f; + float meleeDamage = 0.9f / Main.player[Projectile.owner].GetAttackSpeed() * 1.25f; if (Projectile.ai[1] == 1f) Projectile.tileCollide = false; @@ -86,27 +86,26 @@ namespace CalamityMod.Projectiles.Melee } if (!Projectile.tileCollide) - num212 *= 2f; + meleeDamage *= 2f; if (distance > 80f || !Projectile.tileCollide) { - distance = num211 / distance; - vector62.X *= distance; - vector62.Y *= distance; + distance = meleeSpeedDistance / distance; + projDirection.X *= distance; + projDirection.Y *= distance; - Vector2 vector21 = new Vector2(Projectile.velocity.X, Projectile.velocity.Y); - float num217 = vector62.X - Projectile.velocity.X; - float num218 = vector62.Y - Projectile.velocity.Y; - float num219 = (float)Math.Sqrt((double)(num217 * num217 + num218 * num218)); + float projXDirect = projDirection.X - Projectile.velocity.X; + float projYDirect = projDirection.Y - Projectile.velocity.Y; + float projDistance = (float)Math.Sqrt((double)(projXDirect * projXDirect + projYDirect * projYDirect)); - num219 = num212 / num219; - num217 *= num219; - num218 *= num219; + projDistance = meleeDamage / projDistance; + projXDirect *= projDistance; + projYDirect *= projDistance; Projectile.velocity.X = Projectile.velocity.X * 0.98f; Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; - Projectile.velocity.X = Projectile.velocity.X + num217; - Projectile.velocity.Y = Projectile.velocity.Y + num218; + Projectile.velocity.X = Projectile.velocity.X + projXDirect; + Projectile.velocity.Y = Projectile.velocity.Y + projYDirect; } else { @@ -183,35 +182,35 @@ namespace CalamityMod.Projectiles.Melee { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Texture2D texture2D2 = ModContent.Request("CalamityMod/Projectiles/Melee/YateveoBloomChain").Value; - Vector2 vector17 = Projectile.Center; + Vector2 projCenter = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + float projHeight = (float)texture2D2.Height; + Vector2 actualCenter = mountedCenter - projCenter; + float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + bool isActive = true; + if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { - flag13 = false; + isActive = false; } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y)) { - flag13 = false; + isActive = false; } - while (flag13) + while (isActive) { - if (vector18.Length() < num91 + 1f) + if (actualCenter.Length() < projHeight + 1f) { - flag13 = false; + isActive = false; } else { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0); + Vector2 centerCopy = actualCenter; + centerCopy.Normalize(); + projCenter += centerCopy * projHeight; + actualCenter = mountedCenter - projCenter; + Color drawArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, drawArea, projRotation, origin, 1f, SpriteEffects.None, 0); } } return true; diff --git a/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs b/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs index 1f8deca17c..21111f7f14 100644 --- a/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs +++ b/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs @@ -81,103 +81,103 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { Vector2 vector = Main.player[Projectile.owner].MountedCenter; vector.Y += Main.player[Projectile.owner].gfxOffY; - float num2 = Projectile.Center.X - vector.X; - float num3 = Projectile.Center.Y - vector.Y; - Math.Sqrt(num2 * num2 + num3 * num3); + float yoyoXVel = Projectile.Center.X - vector.X; + float yoyoYVel = Projectile.Center.Y - vector.Y; + Math.Sqrt(yoyoXVel * yoyoXVel + yoyoYVel * yoyoYVel); if (!Projectile.counterweight) { - int num5 = -1; + int distanceCheck = -1; if (Projectile.position.X + (float)(Projectile.width / 2) < Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2)) - num5 = 1; + distanceCheck = 1; - num5 *= -1; - Main.player[Projectile.owner].itemRotation = (float)Math.Atan2(num3 * (float)num5, num2 * (float)num5); + distanceCheck *= -1; + Main.player[Projectile.owner].itemRotation = (float)Math.Atan2(yoyoYVel * (float)distanceCheck, yoyoXVel * (float)distanceCheck); } - bool flag = true; - if (num2 == 0f && num3 == 0f) + bool isActive = true; + if (yoyoXVel == 0f && yoyoYVel == 0f) { - flag = false; + isActive = false; } else { - float num6 = (float)Math.Sqrt(num2 * num2 + num3 * num3); - num6 = 12f / num6; - num2 *= num6; - num3 *= num6; - vector.X -= num2 * 0.1f; - vector.Y -= num3 * 0.1f; - num2 = Projectile.position.X + (float)Projectile.width * 0.5f - vector.X; - num3 = Projectile.position.Y + (float)Projectile.height * 0.5f - vector.Y; + float yoyoVelocity = (float)Math.Sqrt(yoyoXVel * yoyoXVel + yoyoYVel * yoyoYVel); + yoyoVelocity = 12f / yoyoVelocity; + yoyoXVel *= yoyoVelocity; + yoyoYVel *= yoyoVelocity; + vector.X -= yoyoXVel * 0.1f; + vector.Y -= yoyoYVel * 0.1f; + yoyoXVel = Projectile.position.X + (float)Projectile.width * 0.5f - vector.X; + yoyoYVel = Projectile.position.Y + (float)Projectile.height * 0.5f - vector.Y; } - while (flag) + while (isActive) { - float num7 = 12f; - float num8 = (float)Math.Sqrt(num2 * num2 + num3 * num3); - float num9 = num8; - if (float.IsNaN(num8) || float.IsNaN(num9)) + float chainWidth = 12f; + float yoyoVelocityAgain = (float)Math.Sqrt(yoyoXVel * yoyoXVel + yoyoYVel * yoyoYVel); + float yoyoVelocityCopy = yoyoVelocityAgain; + if (float.IsNaN(yoyoVelocityAgain) || float.IsNaN(yoyoVelocityCopy)) { - flag = false; + isActive = false; continue; } - if (num8 < 20f) + if (yoyoVelocityAgain < 20f) { - num7 = num8 - 8f; - flag = false; + chainWidth = yoyoVelocityAgain - 8f; + isActive = false; } - num8 = 12f / num8; - num2 *= num8; - num3 *= num8; - vector.X += num2; - vector.Y += num3; - num2 = Projectile.position.X + (float)Projectile.width * 0.5f - vector.X; - num3 = Projectile.position.Y + (float)Projectile.height * 0.1f - vector.Y; - if (num9 > 12f) + yoyoVelocityAgain = 12f / yoyoVelocityAgain; + yoyoXVel *= yoyoVelocityAgain; + yoyoYVel *= yoyoVelocityAgain; + vector.X += yoyoXVel; + vector.Y += yoyoYVel; + yoyoXVel = Projectile.position.X + (float)Projectile.width * 0.5f - vector.X; + yoyoYVel = Projectile.position.Y + (float)Projectile.height * 0.1f - vector.Y; + if (yoyoVelocityCopy > 12f) { - float num10 = 0.3f; - float num11 = Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y); - if (num11 > 16f) - num11 = 16f; + float absVelocityCheck = 0.3f; + float absVelocity = Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y); + if (absVelocity > 16f) + absVelocity = 16f; - num11 = 1f - num11 / 16f; - num10 *= num11; - num11 = num9 / 80f; - if (num11 > 1f) - num11 = 1f; + absVelocity = 1f - absVelocity / 16f; + absVelocityCheck *= absVelocity; + absVelocity = yoyoVelocityCopy / 80f; + if (absVelocity > 1f) + absVelocity = 1f; - num10 *= num11; - if (num10 < 0f) - num10 = 0f; + absVelocityCheck *= absVelocity; + if (absVelocityCheck < 0f) + absVelocityCheck = 0f; - num10 *= num11; - num10 *= 0.5f; - if (num3 > 0f) + absVelocityCheck *= absVelocity; + absVelocityCheck *= 0.5f; + if (yoyoYVel > 0f) { - num3 *= 1f + num10; - num2 *= 1f - num10; + yoyoYVel *= 1f + absVelocityCheck; + yoyoXVel *= 1f - absVelocityCheck; } else { - num11 = Math.Abs(Projectile.velocity.X) / 3f; - if (num11 > 1f) - num11 = 1f; + absVelocity = Math.Abs(Projectile.velocity.X) / 3f; + if (absVelocity > 1f) + absVelocity = 1f; - num11 -= 0.5f; - num10 *= num11; - if (num10 > 0f) - num10 *= 2f; + absVelocity -= 0.5f; + absVelocityCheck *= absVelocity; + if (absVelocityCheck > 0f) + absVelocityCheck *= 2f; - num3 *= 1f + num10; - num2 *= 1f - num10; + yoyoYVel *= 1f + absVelocityCheck; + yoyoXVel *= 1f - absVelocityCheck; } } - float num4 = (float)Math.Atan2(num3, num2) - MathHelper.PiOver2; + float stringHelper = (float)Math.Atan2(yoyoYVel, yoyoXVel) - MathHelper.PiOver2; Texture2D stringTexture = ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Value; - Main.spriteBatch.Draw(stringTexture, new Vector2(vector.X - Main.screenPosition.X + (float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width() * 0.5f, vector.Y - Main.screenPosition.Y + (float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Height() * 0.5f) - new Vector2(6f, 0f), new Rectangle(0, 0, ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width(), (int)num7), Color.White, num4, new Vector2((float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width() * 0.5f, 0f), 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(stringTexture, new Vector2(vector.X - Main.screenPosition.X + (float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width() * 0.5f, vector.Y - Main.screenPosition.Y + (float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Height() * 0.5f) - new Vector2(6f, 0f), new Rectangle(0, 0, ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width(), (int)chainWidth), Color.White, stringHelper, new Vector2((float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width() * 0.5f, 0f), 1f, SpriteEffects.None, 0f); } CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); From f2ab40bdf5224a4937c58eae9b0a4119bb577da8 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 20 Oct 2023 20:54:57 -0400 Subject: [PATCH 07/43] Killing nums with magic --- Projectiles/Magic/AbyssBall.cs | 22 +- Projectiles/Magic/AcidicSaxBubble.cs | 35 ++- Projectiles/Magic/AquamarineBolt.cs | 16 +- Projectiles/Magic/Asteroid.cs | 72 +++--- Projectiles/Magic/AsteroidMolten.cs | 72 +++--- Projectiles/Magic/BeastScythe.cs | 101 ++++---- Projectiles/Magic/BigBeamofDeath.cs | 10 +- Projectiles/Magic/BigBeamofDeath2.cs | 10 +- Projectiles/Magic/BlackAnurianBubble.cs | 18 +- Projectiles/Magic/BlackAnurianPlankton.cs | 83 ++++--- Projectiles/Magic/BloodBlast.cs | 24 +- Projectiles/Magic/BlueBubble.cs | 24 +- .../Magic/BrimstoneHellfireballFriendly.cs | 8 +- Projectiles/Magic/BrimstoneTentacle.cs | 20 +- Projectiles/Magic/ClamorNoctusStar.cs | 24 +- Projectiles/Magic/ClimaxBeam.cs | 12 +- Projectiles/Magic/ClimaxProj.cs | 10 +- Projectiles/Magic/CosmicTentacle.cs | 26 +-- Projectiles/Magic/DarkSparkBeam.cs | 125 +++++----- Projectiles/Magic/DarkSparkPrism.cs | 110 +++++---- Projectiles/Magic/DivineRetributionSpear.cs | 26 +-- Projectiles/Magic/EldritchTentacle.cs | 26 +-- Projectiles/Magic/ElementTentacle.cs | 24 +- Projectiles/Magic/EvergladeSprayProjectile.cs | 20 +- Projectiles/Magic/FatesRevealFlame.cs | 99 ++++---- Projectiles/Magic/FlareBoltProjectile.cs | 18 +- Projectiles/Magic/ForbiddenSunProjectile.cs | 6 +- Projectiles/Magic/ForbiddenSunburst.cs | 38 +-- .../Magic/FrigidflashBoltProjectile.cs | 36 +-- Projectiles/Magic/FrostBoltProjectile.cs | 18 +- Projectiles/Magic/GhastlyBlast.cs | 217 +++++++++--------- Projectiles/Magic/GhastlyExplosion.cs | 69 +++--- Projectiles/Magic/GhastlyExplosionShard.cs | 56 ++--- Projectiles/Magic/GhastlySubBlast.cs | 59 +++-- Projectiles/Magic/GhastlyVisageProj.cs | 83 ++++--- Projectiles/Magic/HadalUrnIsopod.cs | 18 +- Projectiles/Magic/HadalUrnLamprey.cs | 18 +- .../Magic/HellfireExplosionFriendly.cs | 38 +-- Projectiles/Magic/HellwingPillar.cs | 5 +- Projectiles/Magic/HolyFlame.cs | 22 +- Projectiles/Magic/HolyLaser.cs | 20 +- Projectiles/Magic/IcicleStaffProj.cs | 8 +- Projectiles/Magic/InfernadoFriendly.cs | 24 +- Projectiles/Magic/InfernadoMarkFriendly.cs | 96 ++++---- Projectiles/Magic/InfernalBlade.cs | 62 +++-- Projectiles/Magic/InfernalBlade2.cs | 80 +++---- Projectiles/Magic/IonBlast.cs | 22 +- Projectiles/Magic/LazharSolarBeam.cs | 14 +- Projectiles/Magic/LightBall.cs | 22 +- Projectiles/Magic/LiquidBlade.cs | 70 +++--- Projectiles/Magic/LiquidBlade2.cs | 70 +++--- Projectiles/Magic/LuxorsGiftMagic.cs | 18 +- Projectiles/Magic/MadAlchemistsCocktailAlt.cs | 65 +++--- .../Magic/MadAlchemistsCocktailGreen.cs | 19 +- .../Magic/MadAlchemistsCocktailPurple.cs | 8 +- Projectiles/Magic/MadAlchemistsCocktailRed.cs | 90 ++++---- .../Magic/MadAlchemistsCocktailShrapnel.cs | 20 +- Projectiles/Magic/MagneticBeam.cs | 12 +- Projectiles/Magic/MagneticOrb.cs | 10 +- Projectiles/Magic/MelterAmp.cs | 39 ++-- Projectiles/Magic/NebulaCloud.cs | 67 +++--- Projectiles/Magic/NebulaCloudCore.cs | 210 ++++++++--------- Projectiles/Magic/NightBolt.cs | 14 +- Projectiles/Magic/NuclearFuryProjectile.cs | 44 ++-- Projectiles/Magic/ParticleBeamofDoom.cs | 10 +- Projectiles/Magic/PhantasmalFuryProj.cs | 10 +- Projectiles/Magic/Phantom.cs | 6 +- Projectiles/Magic/PlagueFang.cs | 30 +-- Projectiles/Magic/PlasmaRay.cs | 14 +- Projectiles/Magic/PlasmaRay2.cs | 14 +- Projectiles/Magic/RougeSlashLarge.cs | 18 +- Projectiles/Magic/RougeSlashMedium.cs | 18 +- Projectiles/Magic/RougeSlashSmall.cs | 18 +- Projectiles/Magic/SHPB.cs | 38 +-- Projectiles/Magic/SHPExplosion.cs | 52 ++--- Projectiles/Magic/SHPL.cs | 11 +- Projectiles/Magic/SanguineFlareProj.cs | 22 +- Projectiles/Magic/SerpentineBody.cs | 47 ++-- Projectiles/Magic/SerpentineHead.cs | 105 +++++---- Projectiles/Magic/SerpentineTail.cs | 47 ++-- Projectiles/Magic/ShadeNimbus.cs | 6 +- Projectiles/Magic/ShadecrystalProjectile.cs | 8 +- Projectiles/Magic/Shadowbolt.cs | 14 +- Projectiles/Magic/Snowball.cs | 10 +- Projectiles/Magic/SoulPiercerBeam.cs | 12 +- Projectiles/Magic/SoulPiercerBolt.cs | 12 +- Projectiles/Magic/Starblast.cs | 20 +- Projectiles/Magic/StickyFeather.cs | 22 +- .../Magic/SupremeDustFlakProjectile.cs | 26 +-- Projectiles/Magic/SupremeDustProjectile.cs | 22 +- Projectiles/Magic/ThunderstormShot.cs | 56 ++--- Projectiles/Magic/ThunderstormShotSplit.cs | 40 ++-- Projectiles/Magic/UberBubble.cs | 28 +-- Projectiles/Magic/UndinesRetributionSpear.cs | 26 +-- Projectiles/Magic/VenusianBolt.cs | 10 +- Projectiles/Magic/VenusianExplosion.cs | 38 +-- Projectiles/Magic/VenusianFlame.cs | 8 +- Projectiles/Magic/VisceraBeam.cs | 14 +- Projectiles/Magic/VividBolt.cs | 34 +-- Projectiles/Magic/VividClarityBeam.cs | 34 +-- Projectiles/Magic/VividLaser2.cs | 14 +- Projectiles/Magic/VoidVortexProj.cs | 10 +- Projectiles/Magic/WaterStream.cs | 24 +- Projectiles/Magic/WaterStream2.cs | 24 +- Projectiles/Magic/WaywasherProj.cs | 24 +- Projectiles/Magic/WyvernFeatherGreen.cs | 22 +- Projectiles/Magic/WyvernFeatherPink.cs | 22 +- Projectiles/Magic/WyvernFeatherPurple.cs | 22 +- 108 files changed, 1915 insertions(+), 1969 deletions(-) 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; } } From 94bb4fe7a5c12a252556b78d27eb1204496f79d0 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 20 Oct 2023 21:46:48 -0400 Subject: [PATCH 08/43] Enemy, Environment, Healing --- Projectiles/Enemy/CrimsonSpike.cs | 8 +- Projectiles/Enemy/EarthRockBig.cs | 22 +-- Projectiles/Enemy/EarthRockSmall.cs | 22 +-- Projectiles/Enemy/FlameBurstHostile.cs | 42 ++--- Projectiles/Enemy/HorsWaterBlast.cs | 50 +++--- Projectiles/Enemy/InkBombHostile.cs | 34 ++-- Projectiles/Enemy/PearlBurst.cs | 18 +-- Projectiles/Enemy/PufferExplosion.cs | 60 +++---- Projectiles/Enemy/StormMarkHostile.cs | 88 +++++----- Projectiles/Enemy/SulphuricAcidBubble.cs | 20 +-- Projectiles/Enemy/TornadoHostile.cs | 178 ++++++++++----------- Projectiles/Environment/BrimstoneGeyser.cs | 94 +++++------ Projectiles/Environment/LavaChunk.cs | 28 ++-- Projectiles/Environment/SmokeTelegraph.cs | 94 +++++------ Projectiles/Healing/EmpyreanHealOrb.cs | 12 +- Projectiles/Healing/EssenceFlame.cs | 22 +-- Projectiles/Healing/FungalHeal.cs | 24 +-- Projectiles/Healing/RainHeal.cs | 12 +- Projectiles/Healing/RoyalHeal.cs | 28 ++-- Projectiles/Healing/ShinobiHealOrb.cs | 8 +- Projectiles/Healing/SilvaOrb.cs | 10 +- Projectiles/Healing/TransfusionTrail.cs | 26 +-- 22 files changed, 449 insertions(+), 451 deletions(-) diff --git a/Projectiles/Enemy/CrimsonSpike.cs b/Projectiles/Enemy/CrimsonSpike.cs index 41947aea1d..8308f706c3 100644 --- a/Projectiles/Enemy/CrimsonSpike.cs +++ b/Projectiles/Enemy/CrimsonSpike.cs @@ -25,10 +25,10 @@ namespace CalamityMod.Projectiles.Enemy { Color dustColor = Color.Crimson; dustColor.A = 150; - int num67 = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, 260, 0f, 0f, 50, dustColor, 1.2f); - Main.dust[num67].velocity *= 0.3f; - Main.dust[num67].velocity += Projectile.velocity * 0.3f; - Main.dust[num67].noGravity = true; + int redSpiky = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, 260, 0f, 0f, 50, dustColor, 1.2f); + Main.dust[redSpiky].velocity *= 0.3f; + Main.dust[redSpiky].velocity += Projectile.velocity * 0.3f; + Main.dust[redSpiky].noGravity = true; } Projectile.Opacity += 0.2f; diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index f9464dc62e..edc68e0e4b 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -57,23 +57,23 @@ namespace CalamityMod.Projectiles.Enemy Projectile.height = 60; 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(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int earthyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1.2f); + Main.dust[earthyDust].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[earthyDust].scale = 0.5f; + Main.dust[earthyDust].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(Projectile.position, Projectile.width, Projectile.height, 1, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 1, 0f, 0f, 100, default, 1.7f); + Main.dust[earthyDust2].noGravity = true; + Main.dust[earthyDust2].velocity *= 5f; + earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1f); + Main.dust[earthyDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index f4104cfa59..299f26e190 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -35,23 +35,23 @@ namespace CalamityMod.Projectiles.Enemy 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 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int earthyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1.2f); + Main.dust[earthyDust].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[earthyDust].scale = 0.5f; + Main.dust[earthyDust].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(Projectile.position, Projectile.width, Projectile.height, 1, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 1, 0f, 0f, 100, default, 1.7f); + Main.dust[earthyDust2].noGravity = true; + Main.dust[earthyDust2].velocity *= 5f; + earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1f); + Main.dust[earthyDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Enemy/FlameBurstHostile.cs b/Projectiles/Enemy/FlameBurstHostile.cs index 5299d1e5ab..330565f9d5 100644 --- a/Projectiles/Enemy/FlameBurstHostile.cs +++ b/Projectiles/Enemy/FlameBurstHostile.cs @@ -34,46 +34,46 @@ namespace CalamityMod.Projectiles.Enemy Projectile.height = 20; 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 < 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, 2f); - Main.dust[num622].velocity *= 3f; + int flameDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[flameDust].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[flameDust].scale = 0.5f; + Main.dust[flameDust].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, 246, 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 sparkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[sparkDust].noGravity = true; + Main.dust[sparkDust].velocity *= 5f; + sparkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[sparkDust].velocity *= 2f; } count += 1f; } Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 5; num468++) + for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 0.75f); - Main.dust[num469].velocity *= 0f; + int sparky = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 0.75f); + Main.dust[sparky].velocity *= 0f; } } - int num103 = (int)Player.FindClosest(Projectile.Center, 1, 1); + int playerTarget = (int)Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; if (Projectile.ai[1] < 200f && Projectile.ai[1] > 40f) { - float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + float scaleFactor = Projectile.velocity.Length(); + Vector2 playerDistance = Main.player[playerTarget].Center - Projectile.Center; + playerDistance.Normalize(); + playerDistance *= scaleFactor; + Projectile.velocity = (Projectile.velocity * 24f + playerDistance) / 25f; Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor2; + Projectile.velocity *= scaleFactor; } if (Projectile.ai[0] < 0f) { diff --git a/Projectiles/Enemy/HorsWaterBlast.cs b/Projectiles/Enemy/HorsWaterBlast.cs index 74f98882b7..63afd6fa39 100644 --- a/Projectiles/Enemy/HorsWaterBlast.cs +++ b/Projectiles/Enemy/HorsWaterBlast.cs @@ -26,26 +26,26 @@ namespace CalamityMod.Projectiles.Enemy { if (Projectile.ai[1] == 0f) { - 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, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[waterDust].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[waterDust].scale = 0.5f; + Main.dust[waterDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item21, Projectile.position); } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); - for (int num457 = 0; num457 < 10; num457++) + for (int j = 0; j < 10; j++) { - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 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 watery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Main.dust[watery].noGravity = true; + Main.dust[watery].velocity *= 0.5f; + Main.dust[watery].velocity += Projectile.velocity * 0.1f; } } @@ -54,23 +54,23 @@ namespace CalamityMod.Projectiles.Enemy SoundEngine.PlaySound(SoundID.Item21, Projectile.position); for (int dust = 0; dust <= 40; dust++) { - 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, 33, 0f, 0f, 100, default, 1.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]; + 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 killWaterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Main.dust[killWaterDust].noGravity = true; + Main.dust[killWaterDust].position.X = Projectile.Center.X; + Main.dust[killWaterDust].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[killWaterDust]; 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[killWaterDust]; expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; + Main.dust[killWaterDust].velocity.X = rando1; + Main.dust[killWaterDust].velocity.Y = rando2; } } diff --git a/Projectiles/Enemy/InkBombHostile.cs b/Projectiles/Enemy/InkBombHostile.cs index b120709e00..62983c68ea 100644 --- a/Projectiles/Enemy/InkBombHostile.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -56,13 +56,13 @@ namespace CalamityMod.Projectiles.Enemy SoundEngine.PlaySound(SoundID.NPCDeath28, Projectile.position); if (Projectile.owner == Main.myPlayer) { - int num320 = Main.rand.Next(5, 9); - for (int num321 = 0; num321 < num320; num321++) + int randProjAmt = Main.rand.Next(5, 9); + for (int i = 0; i < randProjAmt; i++) { - Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.165), 1f, Projectile.owner, Main.rand.Next(-45, 1)); + Vector2 randProjRotation = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randProjRotation.Normalize(); + randProjRotation *= Main.rand.Next(50, 401) * 0.01f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, randProjRotation.X, randProjRotation.Y, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.165), 1f, Projectile.owner, Main.rand.Next(-45, 1)); } } Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); @@ -71,23 +71,23 @@ namespace CalamityMod.Projectiles.Enemy Projectile.height = 60; 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 < 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, 54, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int inkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 54, 0f, 0f, 100, default, 2f); + Main.dust[inkDust].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[inkDust].scale = 0.5f; + Main.dust[inkDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int j = 0; j < 15; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 109, 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, 109, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int inkDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 109, 0f, 0f, 100, default, 3f); + Main.dust[inkDust2].noGravity = true; + Main.dust[inkDust2].velocity *= 5f; + inkDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 109, 0f, 0f, 100, default, 2f); + Main.dust[inkDust2].velocity *= 2f; } } diff --git a/Projectiles/Enemy/PearlBurst.cs b/Projectiles/Enemy/PearlBurst.cs index 37320e5ec0..479090ce09 100644 --- a/Projectiles/Enemy/PearlBurst.cs +++ b/Projectiles/Enemy/PearlBurst.cs @@ -67,15 +67,15 @@ namespace CalamityMod.Projectiles.Enemy Projectile.localAI[0] = 0f; 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, 92, 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 * (float)-(float)Projectile.width / 2f; + dustRotation += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + dustRotation = dustRotation.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int pearlDust = Dust.NewDust(Projectile.Center, 0, 0, 92, 0f, 0f, 160, default, 1f); + Main.dust[pearlDust].scale = 1.1f; + Main.dust[pearlDust].noGravity = true; + Main.dust[pearlDust].position = Projectile.Center + dustRotation; + Main.dust[pearlDust].velocity = Projectile.velocity * 0.1f; + Main.dust[pearlDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[pearlDust].position) * 1.25f; } } } diff --git a/Projectiles/Enemy/PufferExplosion.cs b/Projectiles/Enemy/PufferExplosion.cs index 22bf6542bc..0538e7a4b8 100644 --- a/Projectiles/Enemy/PufferExplosion.cs +++ b/Projectiles/Enemy/PufferExplosion.cs @@ -34,61 +34,61 @@ namespace CalamityMod.Projectiles.Enemy SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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, 35); - float num464 = (float)Main.rand.Next(-30, 35); - float num465 = (float)Main.rand.Next(13, 18); - 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); - 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]; + float rando1 = (float)Main.rand.Next(-30, 35); + float rando2 = (float)Main.rand.Next(-30, 35); + float rando3 = (float)Main.rand.Next(13, 18); + float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); + randoAdjuster = rando3 / randoAdjuster; + rando1 *= randoAdjuster; + rando2 *= randoAdjuster; + int explodeBrimStyle = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + Main.dust[explodeBrimStyle].noGravity = true; + Main.dust[explodeBrimStyle].position.X = Projectile.Center.X; + Main.dust[explodeBrimStyle].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[explodeBrimStyle]; 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[explodeBrimStyle]; 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[explodeBrimStyle].velocity.X = rando1; + Main.dust[explodeBrimStyle].velocity.Y = rando2; + timerCounter++; } } } diff --git a/Projectiles/Enemy/StormMarkHostile.cs b/Projectiles/Enemy/StormMarkHostile.cs index 0a4e988b8c..21b06efcf0 100644 --- a/Projectiles/Enemy/StormMarkHostile.cs +++ b/Projectiles/Enemy/StormMarkHostile.cs @@ -34,34 +34,34 @@ namespace CalamityMod.Projectiles.Enemy if (Projectile.localAI[1] < 30f) { int totalDust = Projectile.ai[0] != 0f ? 2 : 1; - for (int num1134 = 0; num1134 < totalDust; num1134++) + for (int i = 0; i < totalDust; i++) { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = Projectile.Center + new Vector2(60f, Projectile.ai[0] != 0f ? 800f : 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = Projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) + float lerpvalue = -0.5f; + float lerpvalue2 = 0.9f; + float randomLerp = Main.rand.NextFloat(); + Vector2 dustMovement = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(lerpvalue, lerpvalue2, randomLerp)); + dustMovement.X *= MathHelper.Lerp(2.2f, 0.6f, randomLerp); + dustMovement.X *= -1f; + Vector2 dustMovement2 = new Vector2(2f, 10f); + Vector2 position4 = Projectile.Center + new Vector2(60f, Projectile.ai[0] != 0f ? 800f : 200f) * dustMovement * 0.5f + dustMovement2; + Dust stormy = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; + stormy.position = position4; + stormy.customData = Projectile.Center + dustMovement2; + stormy.fadeIn = 1f; + stormy.scale = 0.3f; + if (dustMovement.X > -1.2f) { - dust34.velocity.X = 1f + Main.rand.NextFloat(); + stormy.velocity.X = 1f + Main.rand.NextFloat(); } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + stormy.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 0.8f; Projectile.direction = 1; - Point point9 = Projectile.Center.ToTileCoordinates(); - Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Point projCenter = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(projCenter.X * 16 + 8), (float)(projCenter.Y * 16 + 8)); } Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; if (Projectile.localAI[1] < 33f) @@ -90,30 +90,30 @@ namespace CalamityMod.Projectiles.Enemy { Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } - for (int num1135 = 0; num1135 < 2; num1135++) + for (int j = 0; j < 2; j++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = Projectile.Opacity * Projectile.localAI[0]; - dust35.position = Projectile.Center; - dust35.velocity = value83 * 2.5f; + Vector2 dustVel = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust stormDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; + stormDust.noGravity = true; + stormDust.noLight = true; + stormDust.scale = Projectile.Opacity * Projectile.localAI[0]; + stormDust.position = Projectile.Center; + stormDust.velocity = dustVel * 2.5f; } } - for (int num1136 = 0; num1136 < 2; num1136++) + for (int k = 0; k < 2; k++) { if (Main.rand.NextBool(10)) { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = Projectile.Opacity * Projectile.localAI[0]; - dust36.position = Projectile.Center; - dust36.velocity = value84 * 2.5f; + Vector2 dustVel2 = Vector2.UnitY.RotatedBy((double)((float)k * 3.14159274f), default); + Dust stormDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; + stormDust2.noGravity = true; + stormDust2.noLight = true; + stormDust2.scale = Projectile.Opacity * Projectile.localAI[0]; + stormDust2.position = Projectile.Center; + stormDust2.velocity = dustVel2 * 2.5f; } } if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) @@ -135,16 +135,16 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - 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)); - Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Color originalColor = 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)); + Vector2 drawPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D27 = ModContent.Request(Texture).Value; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, SpriteEffects.None, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, SpriteEffects.None, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, SpriteEffects.None, 0); + Rectangle rectangl = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alphaColor = Projectile.GetAlpha(originalColor); + Vector2 halfRect = rectangl.Size() / 2f; + Color whiteColor = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangl), whiteColor, 0f, halfRect, new Vector2(1f, 5f) * Projectile.scale * 2f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangl), alphaColor, Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangl), alphaColor, 0f, halfRect, new Vector2(1f, 8f) * Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Enemy/SulphuricAcidBubble.cs b/Projectiles/Enemy/SulphuricAcidBubble.cs index 10dd5292e6..acc97e0f35 100644 --- a/Projectiles/Enemy/SulphuricAcidBubble.cs +++ b/Projectiles/Enemy/SulphuricAcidBubble.cs @@ -86,12 +86,12 @@ namespace CalamityMod.Projectiles.Enemy 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; + int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); - 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); + 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; } @@ -113,15 +113,15 @@ namespace CalamityMod.Projectiles.Enemy Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num246 = 0; num246 < 25; num246++) + for (int i = 0; i < 25; i++) { - int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 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, 31, 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 = 255 - (int)(Projectile.Opacity * 255f); + Main.dust[toxicDust].alpha = 255 - (int)(Projectile.Opacity * 255f); } } } diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index ef78d90a71..61def509db 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -28,76 +28,74 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - float num1125 = Projectile.ai[1] == 1f ? 900f : 600f; + float projTimer = Projectile.ai[1] == 1f ? 900f : 600f; if (Projectile.soundDelay == 0) { Projectile.soundDelay = -1; SoundEngine.PlaySound(SoundID.Item122, Projectile.position); } Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= num1125) + if (Projectile.ai[0] >= projTimer) { Projectile.Kill(); } - float num1127 = Projectile.ai[1] == 1f ? 90f : 15f; - float num1128 = Projectile.ai[1] == 1f ? 90f : 15f; - Point point8 = Projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - Projectile.width = (int)(value74.X * (Projectile.ai[1] == 1f ? 0.167f : 0.65f)); - Projectile.height = (int)value74.Y; - Projectile.Center = vector146; + float expandSizeX = Projectile.ai[1] == 1f ? 90f : 15f; + float expandSizeY = Projectile.ai[1] == 1f ? 90f : 15f; + Point projCenterTile = Projectile.Center.ToTileCoordinates(); + int sizeMod; + int sizeMod2; + Collision.ExpandVertically(projCenterTile.X, projCenterTile.Y, out sizeMod, out sizeMod2, (int)expandSizeX, (int)expandSizeY); + sizeMod++; + sizeMod2--; + Vector2 sizeModVector = new Vector2((float)projCenterTile.X, (float)sizeMod) * 16f + new Vector2(8f); + Vector2 sizeModVector2 = new Vector2((float)projCenterTile.X, (float)sizeMod2) * 16f + new Vector2(8f); + Vector2 centering = Vector2.Lerp(sizeModVector, sizeModVector2, 0.5f); + Vector2 sizeModPos = new Vector2(0f, sizeModVector2.Y - sizeModVector.Y); + sizeModPos.X = sizeModPos.Y * 0.2f; + Projectile.width = (int)(sizeModPos.X * (Projectile.ai[1] == 1f ? 0.167f : 0.65f)); + Projectile.height = (int)sizeModPos.Y; + Projectile.Center = centering; if (Projectile.owner == Main.myPlayer) { - bool flag74 = false; - Vector2 center16 = Main.player[Projectile.owner].Center; + bool breakFlag = false; + Vector2 playerCenter = Main.player[Projectile.owner].Center; Vector2 top = Main.player[Projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + for (float i = 0f; i < 1f; i += 0.05f) { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + Vector2 position2 = Vector2.Lerp(sizeModVector, sizeModVector2, i); + if (Collision.CanHitLine(position2, 0, 0, playerCenter, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) { - flag74 = true; + breakFlag = true; break; } } - if (!flag74 && Projectile.ai[0] < num1125 - 120f) + if (!breakFlag && Projectile.ai[0] < projTimer - 120f) { - float num1132 = Projectile.ai[0] % 60f; - Projectile.ai[0] = num1125 - 120f + num1132; + float aiDecrement = Projectile.ai[0] % 60f; + Projectile.ai[0] = projTimer - 120f + aiDecrement; Projectile.netUpdate = true; } } - if (Projectile.ai[0] < num1125 - 120f) + if (Projectile.ai[0] < projTimer - 120f) { - for (int num1133 = 0; num1133 < 1; num1133++) + for (int j = 0; j < 1; j++) { - float value75 = -0.5f; - float value76 = 0.9f; - float amount3 = Main.rand.NextFloat(); - Vector2 value77 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value75, value76, amount3)); - value77.X *= MathHelper.Lerp(2.2f, 0.6f, amount3); - value77.X *= -1f; - Vector2 value78 = new Vector2(6f, 10f); - Vector2 position3 = vector146 + value74 * value77 * 0.5f + value78; - Dust dust33 = Main.dust[Dust.NewDust(position3, 0, 0, 16, 0f, 0f, 0, default, 1.5f)]; - dust33.position = position3; - dust33.customData = vector146 + value78; - dust33.fadeIn = 1f; - dust33.scale = 0.3f; - if (value77.X > -1.2f) + float lerpRandomizer = Main.rand.NextFloat(); + Vector2 dustVelocity = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(-0.5f, 0.9f, lerpRandomizer)); + dustVelocity.X *= MathHelper.Lerp(2.2f, 0.6f, lerpRandomizer); + dustVelocity.X *= -1f; + Vector2 dustCustomData = new Vector2(6f, 10f); + Vector2 dustPosition = centering + sizeModPos * dustVelocity * 0.5f + dustCustomData; + Dust cloudDust = Main.dust[Dust.NewDust(dustPosition, 0, 0, 16, 0f, 0f, 0, default, 1.5f)]; + cloudDust.position = dustPosition; + cloudDust.customData = centering + dustCustomData; + cloudDust.fadeIn = 1f; + cloudDust.scale = 0.3f; + if (dustVelocity.X > -1.2f) { - dust33.velocity.X = 1f + Main.rand.NextFloat(); + cloudDust.velocity.X = 1f + Main.rand.NextFloat(); } - dust33.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + cloudDust.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } } @@ -106,57 +104,57 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - float num226 = Projectile.ai[1] == 1f ? 900f : 600f; - float num227 = Projectile.ai[1] == 1f ? 90f : 15f; - float num228 = Projectile.ai[1] == 1f ? 90f : 15f; - float num229 = Projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) + float aiTrackCheck = Projectile.ai[1] == 1f ? 900f : 600f; + float expandSizeX2 = Projectile.ai[1] == 1f ? 90f : 15f; + float expandSizeY2 = Projectile.ai[1] == 1f ? 90f : 15f; + float aiTracker = Projectile.ai[0]; + float trackerClamp = MathHelper.Clamp(aiTracker / 30f, 0f, 1f); + if (aiTracker > aiTrackCheck - 60f) { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + trackerClamp = MathHelper.Lerp(1f, 0f, (aiTracker - (aiTrackCheck - 60f)) / 60f); } - Point point5 = Projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); + Point centerPoint = Projectile.Center.ToTileCoordinates(); + int sizeModding; + int sizeModding2; + Collision.ExpandVertically(centerPoint.X, centerPoint.Y, out sizeModding, out sizeModding2, (int)expandSizeX2, (int)expandSizeY2); + sizeModding++; + sizeModding2--; + float vectorMult = 0.2f; + Vector2 sizeModdingVector = new Vector2((float)centerPoint.X, (float)sizeModding) * 16f + new Vector2(8f); + Vector2 sizeModdingVector2 = new Vector2((float)centerPoint.X, (float)sizeModding2) * 16f + new Vector2(8f); + Vector2.Lerp(sizeModdingVector, sizeModdingVector2, 0.5f); + Vector2 sizeModdingPos = new Vector2(0f, sizeModdingVector2.Y - sizeModdingVector.Y); + sizeModdingPos.X = sizeModdingPos.Y * vectorMult; + new Vector2(sizeModdingVector.X - sizeModdingPos.X / 2f, sizeModdingVector.Y); Texture2D texture2D23 = ModContent.Request(Texture).Value; - Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Color value34 = new Color(225, 225, 225); - for (float num236 = (float)(int)value33.Y; num236 > (float)(int)value32.Y; num236 -= num235) + Rectangle drawRectangle = texture2D23.Frame(1, 1, 0, 0); + Vector2 smallRect = drawRectangle.Size() / 2f; + float aiTrackMult = -0.06283186f * aiTracker; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(aiTracker * 0.1f), default); + float incrementStorage = 0f; + float increment = 5.1f; + Color cloudColor = new Color(225, 225, 225); + for (float k = (float)(int)sizeModdingVector2.Y; k > (float)(int)sizeModdingVector.Y; k -= increment) { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Color color39 = Color.Lerp(Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) + incrementStorage += increment; + float colorChanger = incrementStorage / sizeModdingPos.Y; + float incStorageMult = incrementStorage * 6.28318548f / -20f; + float lowerColorChanger = colorChanger - 0.15f; + Vector2 spinArea = spinningpoint2.RotatedBy((double)incStorageMult, default); + Vector2 colorChangeVector = new Vector2(0f, colorChanger + 1f); + colorChangeVector.X = colorChangeVector.Y * vectorMult; + Color newCloudColor = Color.Lerp(Color.Transparent, cloudColor, colorChanger * 2f); + if (colorChanger > 0.5f) { - color39 = Color.Lerp(Color.Transparent, value34, 2f - num237 * 2f); + newCloudColor = Color.Lerp(Color.Transparent, cloudColor, 2f - colorChanger * 2f); } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0); + newCloudColor.A = (byte)((float)newCloudColor.A * 0.5f); + newCloudColor *= trackerClamp; + spinArea *= colorChangeVector * 100f; + spinArea.Y = 0f; + spinArea.X = 0f; + spinArea += new Vector2(sizeModdingVector2.X, k) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), newCloudColor, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Environment/BrimstoneGeyser.cs b/Projectiles/Environment/BrimstoneGeyser.cs index 16f793ac1d..1de3662158 100644 --- a/Projectiles/Environment/BrimstoneGeyser.cs +++ b/Projectiles/Environment/BrimstoneGeyser.cs @@ -29,11 +29,11 @@ namespace CalamityMod.Projectiles.Environment public override void AI() { - int num1 = Math.Sign(Projectile.velocity.Y); - int num2 = num1 == -1 ? 0 : 1; + int isActive = Math.Sign(Projectile.velocity.Y); + int dustCustomData = isActive == -1 ? 0 : 1; if (Projectile.ai[0] == 0f) { - if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float) (Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float) (Projectile.height - 20) : 0f), Projectile.width, 20)) + if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float) (Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float) (Projectile.height - 20) : 0f), Projectile.width, 20)) { Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); Projectile.ai[0] = 1f; @@ -45,13 +45,13 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.ai[1] >= 60f) Projectile.Kill(); - for (int index1 = 0; index1 < 3; ++index1) + for (int i = 0; i < 3; ++i) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); - Main.dust[index2].scale = 0.1f + Main.rand.Next(5) * 0.1f; - Main.dust[index2].fadeIn = 1.5f + Main.rand.Next(5) * 0.1f; - Main.dust[index2].noGravity = true; - Main.dust[index2].position = Projectile.Center + new Vector2(0f, (float) (-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); + Main.dust[brimDust].scale = 0.1f + Main.rand.Next(5) * 0.1f; + Main.dust[brimDust].fadeIn = 1.5f + Main.rand.Next(5) * 0.1f; + Main.dust[brimDust].noGravity = true; + Main.dust[brimDust].position = Projectile.Center + new Vector2(0f, (float) (-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; } } @@ -60,21 +60,21 @@ namespace CalamityMod.Projectiles.Environment Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); - if (num1 != 0) + if (isActive != 0) { - int num3 = 16; - int num4 = 320; - while (num3 < num4 && !Collision.SolidCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float)(Projectile.height - num3 - 16) : 0f), Projectile.width, num3 + 16)) - num3 += 16; + int heightIncrease = 16; + int maxHeight = 320; + while (heightIncrease < maxHeight && !Collision.SolidCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float)(Projectile.height - heightIncrease - 16) : 0f), Projectile.width, heightIncrease + 16)) + heightIncrease += 16; - if (num1 == -1) + if (isActive == -1) { Projectile.position.Y += (float)Projectile.height; - Projectile.height = num3; - Projectile.position.Y -= (float)num3; + Projectile.height = heightIncrease; + Projectile.position.Y -= (float)heightIncrease; } else - Projectile.height = num3; + Projectile.height = heightIncrease; } Projectile.ai[1] += 1f; @@ -84,52 +84,52 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - for (int index1 = 0; index1 < 60; ++index1) + for (int i = 0; i < 60; ++i) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); - Dust dust = Main.dust[index2]; + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + Dust dust = Main.dust[brimDust]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); - dust.velocity.Y += (float)(2 * num1); + dust.velocity.Y += (float)(2 * isActive); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -num1); - dust.customData = (object) num2; - if (num1 == -1 && Main.rand.Next(4) != 0) + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -isActive); + dust.customData = (object) dustCustomData; + if (isActive == -1 && Main.rand.Next(4) != 0) { dust.velocity.Y -= 0.2f; } } SoundEngine.PlaySound(SoundID.Item34, Projectile.position); } - if (num1 == 1) + if (isActive == 1) { - for (int index1 = 0; index1 < 9; ++index1) + for (int i = 0; i < 9; ++i) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); - Dust dust = Main.dust[index2]; + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + Dust dust = Main.dust[brimDust]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); - dust.velocity.Y += (float)(2 * num1); + dust.velocity.Y += (float)(2 * isActive); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -num1); - dust.customData = (object)num2; - if (num1 == -1 && Main.rand.Next(4) != 0) + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -isActive); + dust.customData = (object)dustCustomData; + if (isActive == -1 && Main.rand.Next(4) != 0) { - Main.dust[index2].velocity.Y -= 0.2f; + Main.dust[brimDust].velocity.Y -= 0.2f; } } } int Height = (int)(Projectile.ai[1] / 60f * (float)Projectile.height) * 3; if (Height > Projectile.height) Height = Projectile.height; - Vector2 Position = Projectile.position + (num1 == -1 ? new Vector2(0f, (float) (Projectile.height - Height)) : Vector2.Zero); - Vector2 vector2 = Projectile.position + (num1 == -1 ? new Vector2(0f, (float) Projectile.height) : Vector2.Zero); - for (int index1 = 0; index1 < 6; ++index1) + Vector2 Position = Projectile.position + (isActive == -1 ? new Vector2(0f, (float) (Projectile.height - Height)) : Vector2.Zero); + Vector2 vector2 = Projectile.position + (isActive == -1 ? new Vector2(0f, (float) Projectile.height) : Vector2.Zero); + for (int i = 0; i < 6; ++i) { if (Main.rand.Next(3) < 2) { - int index2 = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, 0f, 90, new Color(), 2.5f); - Dust dust = Main.dust[index2]; + int brimDust = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, 0f, 90, new Color(), 2.5f); + Dust dust = Main.dust[brimDust]; dust.noGravity = true; dust.fadeIn = 1f; if (dust.velocity.Y > 0f) @@ -148,25 +148,25 @@ namespace CalamityMod.Projectiles.Environment dust.scale *= 0.3f; } else - Main.dust[index2].velocity = Projectile.DirectionFrom(Main.dust[index2].position) * Main.dust[index2].velocity.Length() * 0.25f; - Main.dust[index2].velocity.Y *= (float)-num1; - Main.dust[index2].customData = (object)num2; + Main.dust[brimDust].velocity = Projectile.DirectionFrom(Main.dust[brimDust].position) * Main.dust[brimDust].velocity.Length() * 0.25f; + Main.dust[brimDust].velocity.Y *= (float)-isActive; + Main.dust[brimDust].customData = (object)dustCustomData; } } - for (int index1 = 0; index1 < 6; ++index1) + for (int i = 0; i < 6; ++i) { if (Main.rand.NextFloat() >= 0.5f) { - int index2 = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); - Dust dust = Main.dust[index2]; + int brimDust = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + Dust dust = Main.dust[brimDust]; dust.alpha = 200; dust.velocity *= new Vector2(0.6f, 1.5f); dust.scale += Main.rand.NextFloat(); - if (num1 == -1 && Main.rand.Next(4) != 0) + if (isActive == -1 && Main.rand.Next(4) != 0) { dust.velocity.Y -= 0.2f; } - dust.customData = (object)num2; + dust.customData = (object)dustCustomData; } } } diff --git a/Projectiles/Environment/LavaChunk.cs b/Projectiles/Environment/LavaChunk.cs index beb37b7f2a..95ee91bc2d 100644 --- a/Projectiles/Environment/LavaChunk.cs +++ b/Projectiles/Environment/LavaChunk.cs @@ -46,20 +46,20 @@ namespace CalamityMod.Projectiles.Environment } if (Projectile.scale > 0.25f) { - for (int num246 = 0; num246 < 2; num246++) + for (int i = 0; i < 2; i++) { - float num248 = 0f; - if (num246 == 1) + float dustYOffset = 0f; + if (i == 1) { - num248 = Projectile.velocity.Y * 0.5f; + dustYOffset = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, Projectile.scale); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, Projectile.scale * 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int lavaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + dustYOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, Projectile.scale); + Main.dust[lavaDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[lavaDust].velocity *= 0.2f; + Main.dust[lavaDust].noGravity = true; + lavaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + dustYOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, Projectile.scale * 0.5f); + Main.dust[lavaDust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[lavaDust].velocity *= 0.05f; } } else @@ -86,9 +86,9 @@ namespace CalamityMod.Projectiles.Environment 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/Environment/SmokeTelegraph.cs b/Projectiles/Environment/SmokeTelegraph.cs index a14193c9e5..9d214531f1 100644 --- a/Projectiles/Environment/SmokeTelegraph.cs +++ b/Projectiles/Environment/SmokeTelegraph.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Projectiles.Environment public override void AI() { - int num1 = Math.Sign(Projectile.velocity.Y); - int num2 = num1 == -1 ? 0 : 1; + int isActive = Math.Sign(Projectile.velocity.Y); + int dustCustomData = isActive == -1 ? 0 : 1; if (Projectile.ai[0] == 0f) { - if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float) (Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float) (Projectile.height - 20) : 0f), Projectile.width, 20)) + if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float) (Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float) (Projectile.height - 20) : 0f), Projectile.width, 20)) { Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); Projectile.ai[0] = 1f; @@ -43,13 +43,13 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.ai[1] >= 60f) Projectile.Kill(); - for (int index1 = 0; index1 < 3; ++index1) + for (int i = 0; i < 3; ++i) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); - Main.dust[index2].scale = 0.1f + Main.rand.Next(5) * 0.1f; - Main.dust[index2].fadeIn = 1.5f + Main.rand.Next(5) * 0.1f; - Main.dust[index2].noGravity = true; - Main.dust[index2].position = Projectile.Center + new Vector2(0f, (float) (-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; + int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); + Main.dust[smoky].scale = 0.1f + Main.rand.Next(5) * 0.1f; + Main.dust[smoky].fadeIn = 1.5f + Main.rand.Next(5) * 0.1f; + Main.dust[smoky].noGravity = true; + Main.dust[smoky].position = Projectile.Center + new Vector2(0f, (float) (-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; } } @@ -58,21 +58,21 @@ namespace CalamityMod.Projectiles.Environment Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); - if (num1 != 0) + if (isActive != 0) { - int num3 = 16; - int num4 = 320; - while (num3 < num4 && !Collision.SolidCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float)(Projectile.height - num3 - 16) : 0f), Projectile.width, num3 + 16)) - num3 += 16; + int heightIncrease = 16; + int maxHeight = 320; + while (heightIncrease < maxHeight && !Collision.SolidCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float)(Projectile.height - heightIncrease - 16) : 0f), Projectile.width, heightIncrease + 16)) + heightIncrease += 16; - if (num1 == -1) + if (isActive == -1) { Projectile.position.Y += (float)Projectile.height; - Projectile.height = num3; - Projectile.position.Y -= (float)num3; + Projectile.height = heightIncrease; + Projectile.position.Y -= (float)heightIncrease; } else - Projectile.height = num3; + Projectile.height = heightIncrease; } Projectile.ai[1] += 1f; @@ -82,52 +82,52 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - for (int index1 = 0; index1 < 60; ++index1) + for (int i = 0; i < 60; ++i) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); - Dust dust = Main.dust[index2]; + int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + Dust dust = Main.dust[smoky]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); - dust.velocity.Y += (float)(2 * num1); + dust.velocity.Y += (float)(2 * isActive); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -num1); - dust.customData = (object) num2; - if (num1 == -1 && Main.rand.Next(4) != 0) + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -isActive); + dust.customData = (object) dustCustomData; + if (isActive == -1 && Main.rand.Next(4) != 0) { dust.velocity.Y -= 0.2f; } } SoundEngine.PlaySound(SoundID.Item34, Projectile.position); } - if (num1 == 1) + if (isActive == 1) { - for (int index1 = 0; index1 < 9; ++index1) + for (int i = 0; i < 9; ++i) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); - Dust dust = Main.dust[index2]; + int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + Dust dust = Main.dust[smoky]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); - dust.velocity.Y += (float)(2 * num1); + dust.velocity.Y += (float)(2 * isActive); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -num1); - dust.customData = (object)num2; - if (num1 == -1 && Main.rand.Next(4) != 0) + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -isActive); + dust.customData = (object)dustCustomData; + if (isActive == -1 && Main.rand.Next(4) != 0) { - Main.dust[index2].velocity.Y -= 0.2f; + Main.dust[smoky].velocity.Y -= 0.2f; } } } int Height = (int)(Projectile.ai[1] / 60f * (float)Projectile.height) * 3; if (Height > Projectile.height) Height = Projectile.height; - Vector2 Position = Projectile.position + (num1 == -1 ? new Vector2(0f, (float) (Projectile.height - Height)) : Vector2.Zero); - Vector2 vector2 = Projectile.position + (num1 == -1 ? new Vector2(0f, (float) Projectile.height) : Vector2.Zero); - for (int index1 = 0; index1 < 6; ++index1) + Vector2 Position = Projectile.position + (isActive == -1 ? new Vector2(0f, (float) (Projectile.height - Height)) : Vector2.Zero); + Vector2 vector2 = Projectile.position + (isActive == -1 ? new Vector2(0f, (float) Projectile.height) : Vector2.Zero); + for (int i = 0; i < 6; ++i) { if (Main.rand.Next(3) < 2) { - int index2 = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, 0f, 90, new Color(), 2.5f); - Dust dust = Main.dust[index2]; + int smoky = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, 0f, 90, new Color(), 2.5f); + Dust dust = Main.dust[smoky]; dust.noGravity = true; dust.fadeIn = 1f; if (dust.velocity.Y > 0f) @@ -146,25 +146,25 @@ namespace CalamityMod.Projectiles.Environment dust.scale *= 0.3f; } else - Main.dust[index2].velocity = Projectile.DirectionFrom(Main.dust[index2].position) * Main.dust[index2].velocity.Length() * 0.25f; - Main.dust[index2].velocity.Y *= (float)-num1; - Main.dust[index2].customData = (object)num2; + Main.dust[smoky].velocity = Projectile.DirectionFrom(Main.dust[smoky].position) * Main.dust[smoky].velocity.Length() * 0.25f; + Main.dust[smoky].velocity.Y *= (float)-isActive; + Main.dust[smoky].customData = (object)dustCustomData; } } - for (int index1 = 0; index1 < 6; ++index1) + for (int i = 0; i < 6; ++i) { if (Main.rand.NextFloat() >= 0.5f) { - int index2 = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); - Dust dust = Main.dust[index2]; + int smoky = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + Dust dust = Main.dust[smoky]; dust.alpha = 200; dust.velocity *= new Vector2(0.6f, 1.5f); dust.scale += Main.rand.NextFloat(); - if (num1 == -1 && Main.rand.Next(4) != 0) + if (isActive == -1 && Main.rand.Next(4) != 0) { dust.velocity.Y -= 0.2f; } - dust.customData = (object)num2; + dust.customData = (object)dustCustomData; } } } diff --git a/Projectiles/Healing/EmpyreanHealOrb.cs b/Projectiles/Healing/EmpyreanHealOrb.cs index a6f863adcf..7b46370a34 100644 --- a/Projectiles/Healing/EmpyreanHealOrb.cs +++ b/Projectiles/Healing/EmpyreanHealOrb.cs @@ -20,15 +20,15 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - float num498 = Projectile.velocity.X * 0.2f; - float num499 = -(Projectile.velocity.Y * 0.2f); + float dustX = Projectile.velocity.X * 0.2f; + float dustY = -(Projectile.velocity.Y * 0.2f); if (Projectile.timeLeft % 2 == 0) { - int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num500]; + int healDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[healDust]; dust.noGravity = true; - dust.position.X -= num498; - dust.position.Y -= num499; + dust.position.X -= dustX; + dust.position.Y -= dustY; } } } diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index 8a6b21d5bd..c5877a25e2 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -52,23 +52,23 @@ namespace CalamityMod.Projectiles.Healing 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 < 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int godSlay = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[godSlay].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[godSlay].scale = 0.5f; + Main.dust[godSlay].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int j = 0; j < 15; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int godSlay2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[godSlay2].noGravity = true; + Main.dust[godSlay2].velocity *= 5f; + godSlay2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[godSlay2].velocity *= 2f; } } } diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 042b605de8..8f13ec8042 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -20,20 +20,20 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); - float num494 = Projectile.velocity.X * 0.334f; - float num495 = -(Projectile.velocity.Y * 0.334f); - int num496 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[num496]; + float dustX = Projectile.velocity.X * 0.334f; + float dustY = -(Projectile.velocity.Y * 0.334f); + int fungi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[fungi]; dust.noGravity = true; - dust.position.X -= num494; - dust.position.Y -= num495; - float num498 = Projectile.velocity.X * 0.2f; - float num499 = -(Projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.7f); - Dust dust2 = Main.dust[num500]; + dust.position.X -= dustX; + dust.position.Y -= dustY; + float dustX2 = Projectile.velocity.X * 0.2f; + float dustY2 = -(Projectile.velocity.Y * 0.2f); + int fungi2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.7f); + Dust dust2 = Main.dust[fungi2]; dust2.noGravity = true; - dust2.position.X -= num498; - dust2.position.Y -= num499; + dust2.position.X -= dustX2; + dust2.position.Y -= dustY2; } } } diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index e76b1cc791..b9b3902bb3 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -30,13 +30,13 @@ namespace CalamityMod.Projectiles.Healing Projectile.HealingProjectile(8, Projectile.owner, 12f, 15f, false); } - float num498 = Projectile.velocity.X * 0.2f; - float num499 = -(Projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Dust dust = Main.dust[num500]; + float dustX = Projectile.velocity.X * 0.2f; + float dustY = -(Projectile.velocity.Y * 0.2f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Dust dust = Main.dust[rainbow]; dust.noGravity = true; - dust.position.X -= num498; - dust.position.Y -= num499; + dust.position.X -= dustX; + dust.position.Y -= dustY; } } } diff --git a/Projectiles/Healing/RoyalHeal.cs b/Projectiles/Healing/RoyalHeal.cs index 9c0016a0b7..f65c93ec2a 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -20,25 +20,25 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - for (int num493 = 0; num493 < 3; num493++) + for (int i = 0; i < 3; i++) { - float num494 = Projectile.velocity.X * 0.334f * (float)num493; - float num495 = -(Projectile.velocity.Y * 0.334f) * (float)num493; - int num496 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.1f); - Dust dust = Main.dust[num496]; + float dustX = Projectile.velocity.X * 0.334f * (float)i; + float dustY = -(Projectile.velocity.Y * 0.334f) * (float)i; + int pureHeal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.1f); + Dust dust = Main.dust[pureHeal]; dust.noGravity = true; - dust.position.X -= num494; - dust.position.Y -= num495; + dust.position.X -= dustX; + dust.position.Y -= dustY; } - for (int num497 = 0; num497 < 5; num497++) + for (int j = 0; j < 5; j++) { - float num498 = Projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(Projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.3f); - Dust dust2 = Main.dust[num500]; + float dustX2 = Projectile.velocity.X * 0.2f * (float)j; + float dustY2 = -(Projectile.velocity.Y * 0.2f) * (float)j; + int pureHeal2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.3f); + Dust dust2 = Main.dust[pureHeal2]; dust2.noGravity = true; - dust2.position.X -= num498; - dust2.position.Y -= num499; + dust2.position.X -= dustX2; + dust2.position.Y -= dustY2; } } } diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index 001ea12b6a..be3d5edd5e 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Projectiles.Healing { Projectile.HealingProjectile((int)Projectile.ai[1], Projectile.owner, 6f, 15f); - 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, 15, 0f, 0f, 100, default, 1.3f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int magicHeal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 15, 0f, 0f, 100, default, 1.3f); + Main.dust[magicHeal].noGravity = true; + Main.dust[magicHeal].velocity *= 0f; } } } diff --git a/Projectiles/Healing/SilvaOrb.cs b/Projectiles/Healing/SilvaOrb.cs index eb43f6cf2e..a78c26ef64 100644 --- a/Projectiles/Healing/SilvaOrb.cs +++ b/Projectiles/Healing/SilvaOrb.cs @@ -49,12 +49,12 @@ namespace CalamityMod.Projectiles.Healing public override void OnKill(int timeLeft) { - for (int num407 = 0; num407 < 5; num407++) + for (int i = 0; i < 5; i++) { - int num408 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 1.5f; - Main.dust[num408].scale = 1.5f; + int silvaHeal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[silvaHeal].noGravity = true; + Main.dust[silvaHeal].velocity *= 1.5f; + Main.dust[silvaHeal].scale = 1.5f; } } } diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index 0062ee8f9e..74a3c75371 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6.5f, 15f); - float num494 = Projectile.velocity.X * 0.334f; - float num495 = -(Projectile.velocity.Y * 0.334f); - int num496 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 183, 0f, 0f, 100, default, 0.7f); - Dust dust = Main.dust[num496]; + float dustX = Projectile.velocity.X * 0.334f; + float dustY = -(Projectile.velocity.Y * 0.334f); + int healRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 183, 0f, 0f, 100, default, 0.7f); + Dust dust = Main.dust[healRed]; dust.noGravity = true; - dust.position.X -= num494; - dust.position.Y -= num495; - for (int num497 = 0; num497 < 2; num497++) + dust.position.X -= dustX; + dust.position.Y -= dustY; + for (int i = 0; i < 2; i++) { - float num498 = Projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(Projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 183, 0f, 0f, 100, default, 0.9f); - Dust dust2 = Main.dust[num500]; + float dustyX = Projectile.velocity.X * 0.2f * (float)i; + float dustyY = -(Projectile.velocity.Y * 0.2f) * (float)i; + int healRedMore = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 183, 0f, 0f, 100, default, 0.9f); + Dust dust2 = Main.dust[healRedMore]; dust2.noGravity = true; - dust2.position.X -= num498; - dust2.position.Y -= num499; + dust2.position.X -= dustyX; + dust2.position.Y -= dustyY; } } } From cb017403f4b2cf476653ea570a319f184e0c9de2 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 20 Oct 2023 22:21:03 -0400 Subject: [PATCH 09/43] DraedonsArsenal --- .../DraedonsArsenal/GatlingLaserProj.cs | 39 ++-- .../DraedonsArsenal/GatlingLaserShot.cs | 76 ++++---- Projectiles/DraedonsArsenal/LaserRifleShot.cs | 77 ++++---- .../DraedonsArsenal/PlasmaCasterShot.cs | 130 ++++++------- Projectiles/DraedonsArsenal/PulseRifleShot.cs | 132 ++++++------- .../DraedonsArsenal/TeslaCannonShot.cs | 181 +++++++++--------- 6 files changed, 312 insertions(+), 323 deletions(-) diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index 73c710bc14..f6b0fe0b94 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -32,8 +32,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (SoundEngine.TryGetActiveSound(gatlingLaserLoopID, out var ShootingSound) && ShootingSound.IsPlaying) ShootingSound.Position = Projectile.Center; Player player = Main.player[Projectile.owner]; - float num = MathHelper.PiOver2; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 playerRotation = player.RotatedRelativePoint(player.MountedCenter, true); if (Projectile.type == ModContent.ProjectileType()) { if (Projectile.ai[0] < 5f) @@ -82,26 +81,26 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (stillInUse && hasMana && hasCharge) { float scaleFactor = player.ActiveItem().shootSpeed * Projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - value2; + Vector2 laserDirection = playerRotation; + Vector2 aimDirection = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - laserDirection; if (player.gravDir == -1f) { - value3.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - value2.Y; + aimDirection.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - laserDirection.Y; } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) + Vector2 projVelocity = Vector2.Normalize(aimDirection); + if (float.IsNaN(projVelocity.X) || float.IsNaN(projVelocity.Y)) { - vector3 = -Vector2.UnitY; + projVelocity = -Vector2.UnitY; } - vector3 *= scaleFactor; - if (vector3.X != Projectile.velocity.X || vector3.Y != Projectile.velocity.Y) + projVelocity *= scaleFactor; + if (projVelocity.X != Projectile.velocity.X || projVelocity.Y != Projectile.velocity.Y) { Projectile.netUpdate = true; } - Projectile.velocity = vector3; + Projectile.velocity = projVelocity; int type = ModContent.ProjectileType(); float velocity = 3f; - value2 = Projectile.Center; + laserDirection = Projectile.Center; Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * velocity; double spread = Math.PI / 32D; @@ -111,19 +110,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { spinningpoint = -Vector2.UnitY; } - Vector2 velocity2 = new Vector2(spinningpoint.X, spinningpoint.Y); - if (velocity2.Length() > 5f) + Vector2 projVelocitySpread = new Vector2(spinningpoint.X, spinningpoint.Y); + if (projVelocitySpread.Length() > 5f) { - velocity2.Normalize(); - velocity2 *= 5f; + projVelocitySpread.Normalize(); + projVelocitySpread *= 5f; } - float SpeedX = velocity2.X + Main.rand.Next(-1, 2) * 0.005f; - float SpeedY = velocity2.Y + Main.rand.Next(-1, 2) * 0.005f; + float SpeedX = projVelocitySpread.X + Main.rand.Next(-1, 2) * 0.005f; + float SpeedY = projVelocitySpread.Y + Main.rand.Next(-1, 2) * 0.005f; float ai0 = Projectile.ai[0] - 2f; // 0, 1, or 2 // Use charge when firing a laser. modItem.Charge -= GatlingLaser.HoldoutChargeUse; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), value2.X, value2.Y, SpeedX, SpeedY, type, currentDamage, Projectile.knockBack, Projectile.owner, ai0, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserDirection.X, laserDirection.Y, SpeedX, SpeedY, type, currentDamage, Projectile.knockBack, Projectile.owner, ai0, 0f); } else { @@ -137,7 +136,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; player.ChangeDir(Projectile.direction); diff --git a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs index c4c4017923..aae0a0d746 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs @@ -55,31 +55,29 @@ namespace CalamityMod.Projectiles.DraedonsArsenal LaserBurst(2.4f, 4.2f); // 60 dusts - int num3; - for (int num640 = 0; num640 < 100; num640 = num3 + 1) + int inc; + for (int i = 0; i < 100; i = inc + 1) { - float num641 = 4f; + int gatlingDust = Dust.NewDust(Projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 1f); + float dustVelX = Main.dust[gatlingDust].velocity.X; + float dustVelY = Main.dust[gatlingDust].velocity.Y; - int num643 = Dust.NewDust(Projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 1f); - float num644 = Main.dust[num643].velocity.X; - float num645 = Main.dust[num643].velocity.Y; + if (dustVelX == 0f && dustVelY == 0f) + dustVelX = 1f; - if (num644 == 0f && num645 == 0f) - num644 = 1f; + float dustVelocity = (float)Math.Sqrt(dustVelX * dustVelX + dustVelY * dustVelY); + dustVelocity = 4f / dustVelocity; + dustVelX *= dustVelocity; + dustVelY *= dustVelocity; - float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); - num646 = num641 / num646; - num644 *= num646; - num645 *= num646; - - Dust dust2 = Main.dust[num643]; + Dust dust2 = Main.dust[gatlingDust]; dust2.velocity *= 0.5f; - dust2.velocity.X = dust2.velocity.X + num644; - dust2.velocity.Y = dust2.velocity.Y + num645; + dust2.velocity.X = dust2.velocity.X + dustVelX; + dust2.velocity.Y = dust2.velocity.Y + dustVelY; dust2.scale = 0.66f; dust2.noGravity = true; - num3 = num640; + inc = i; } } @@ -87,52 +85,52 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angleRandom = 0.05f; - int num3; - for (int num53 = 0; num53 < 4; num53 = num3 + 1) + int inc; + for (int j = 0; j < 4; j = inc + 1) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 0.9f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num54].noGravity = true; + int burstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 0.9f); + Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[burstDust].noGravity = true; - Dust dust2 = Main.dust[num54]; + Dust dust2 = Main.dust[burstDust]; dust2.velocity *= 3f; - dust2 = Main.dust[num54]; + dust2 = Main.dust[burstDust]; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 0.66f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + burstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 0.66f); + Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust2 = Main.dust[num54]; + dust2 = Main.dust[burstDust]; dust2.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; + Main.dust[burstDust].noGravity = true; + Main.dust[burstDust].fadeIn = 1f; + Main.dust[burstDust].color = Color.Crimson * 0.5f; - dust2 = Main.dust[num54]; + dust2 = Main.dust[burstDust]; - num3 = num53; + inc = j; } - for (int num55 = 0; num55 < 2; num55 = num3 + 1) + for (int k = 0; k < 2; k = inc + 1) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 1.2f); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[num56].noGravity = true; + int moreBurstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 1.2f); + Main.dust[moreBurstDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; + Main.dust[moreBurstDust].noGravity = true; - Dust dust2 = Main.dust[num56]; + Dust dust2 = Main.dust[moreBurstDust]; dust2.velocity *= 0.5f; - dust2 = Main.dust[num56]; + dust2 = Main.dust[moreBurstDust]; - num3 = num55; + inc = k; } } } diff --git a/Projectiles/DraedonsArsenal/LaserRifleShot.cs b/Projectiles/DraedonsArsenal/LaserRifleShot.cs index 18b8691de0..29e284b6fc 100644 --- a/Projectiles/DraedonsArsenal/LaserRifleShot.cs +++ b/Projectiles/DraedonsArsenal/LaserRifleShot.cs @@ -32,15 +32,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > createDustVar) { - Vector2 value7 = new Vector2(5f, 10f); - Vector2 value8 = Vector2.UnitX * -12f; - for (int i = 0; i < 2; i++) { - int num41 = Dust.NewDust(Projectile.Center, 0, 0, dust, 0f, 0f, 160, Projectile.ai[0] == 0f ? default : new Color(255, 255, 0), 2f); - Main.dust[num41].noGravity = true; - Main.dust[num41].position = Projectile.Center; - Main.dust[num41].velocity = Projectile.velocity; + int laserDust = Dust.NewDust(Projectile.Center, 0, 0, dust, 0f, 0f, 160, Projectile.ai[0] == 0f ? default : new Color(255, 255, 0), 2f); + Main.dust[laserDust].noGravity = true; + Main.dust[laserDust].position = Projectile.Center; + Main.dust[laserDust].velocity = Projectile.velocity; } } @@ -62,26 +59,24 @@ namespace CalamityMod.Projectiles.DraedonsArsenal LaserBurst(2.4f, 4.2f); // 60 dusts - for (int num640 = 0; num640 < 100; num640++) + for (int i = 0; i < 100; i++) { - float num641 = 4f; + int killDust = Dust.NewDust(Projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 2f); + float killDustX = Main.dust[killDust].velocity.X; + float killDustY = Main.dust[killDust].velocity.Y; - int num643 = Dust.NewDust(Projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 2f); - float num644 = Main.dust[num643].velocity.X; - float num645 = Main.dust[num643].velocity.Y; + if (killDustX == 0f && killDustY == 0f) + killDustX = 1f; - if (num644 == 0f && num645 == 0f) - num644 = 1f; + float killDustVelocity = (float)Math.Sqrt(killDustX * killDustX + killDustY * killDustY); + killDustVelocity = 4f / killDustVelocity; + killDustX *= killDustVelocity; + killDustY *= killDustVelocity; - float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); - num646 = num641 / num646; - num644 *= num646; - num645 *= num646; - - Dust dust2 = Main.dust[num643]; + Dust dust2 = Main.dust[killDust]; dust2.velocity *= 0.5f; - dust2.velocity.X = dust2.velocity.X + num644; - dust2.velocity.Y = dust2.velocity.Y + num645; + dust2.velocity.X = dust2.velocity.X + killDustX; + dust2.velocity.Y = dust2.velocity.Y + killDustY; dust2.noGravity = true; } } @@ -90,47 +85,47 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angleRandom = 0.05f; - for (int num53 = 0; num53 < 20; num53++) + for (int i = 0; i < 20; i++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 2.5f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num54].noGravity = true; + int burstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 2.5f); + Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[burstDust].noGravity = true; - Dust dust2 = Main.dust[num54]; + Dust dust2 = Main.dust[burstDust]; dust2.velocity *= 3f; - dust2 = Main.dust[num54]; + dust2 = Main.dust[burstDust]; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 1.9f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + burstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 1.9f); + Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust2 = Main.dust[num54]; + dust2 = Main.dust[burstDust]; dust2.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Orange * 0.5f; + Main.dust[burstDust].noGravity = true; + Main.dust[burstDust].fadeIn = 1f; + Main.dust[burstDust].color = Color.Orange * 0.5f; - dust2 = Main.dust[num54]; + dust2 = Main.dust[burstDust]; } - for (int num55 = 0; num55 < 10; num55++) + for (int j = 0; j < 10; j++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 3.2f); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[num56].noGravity = true; + int burstDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 3.2f); + Main.dust[burstDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; + Main.dust[burstDust2].noGravity = true; - Dust dust2 = Main.dust[num56]; + Dust dust2 = Main.dust[burstDust2]; dust2.velocity *= 0.5f; - dust2 = Main.dust[num56]; + dust2 = Main.dust[burstDust2]; } } } diff --git a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs index a30502d230..dc43fcf7ea 100644 --- a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs +++ b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs @@ -36,15 +36,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > createDustVar) { - for (int num447 = 0; num447 < 2; num447++) + for (int i = 0; i < 2; i++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * (num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; + Vector2 dustRotation = Projectile.position; + dustRotation -= Projectile.velocity * (i * 0.25f); + int dustSpawn = Dust.NewDust(dustRotation, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 1f); + Main.dust[dustSpawn].noGravity = true; + Main.dust[dustSpawn].position = dustRotation; + Main.dust[dustSpawn].scale = Main.rand.Next(70, 110) * 0.013f; + Main.dust[dustSpawn].velocity *= 0.2f; } Projectile.ai[0] += 1f; @@ -59,28 +59,28 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } else { - Vector2 value7 = new Vector2(5f, 10f); + Vector2 dustRotateVector = new Vector2(5f, 10f); - for (int num41 = 0; num41 < 2; num41++) + for (int j = 0; j < 2; j++) { - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 0.75f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dust1, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = 0.6f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; + Vector2 dustRotate = Vector2.UnitX * -12f; + dustRotate = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + j * MathHelper.Pi) * dustRotateVector * 0.75f; + int plasmaDust = Dust.NewDust(Projectile.Center, 0, 0, dust1, 0f, 0f, 160, default, 1f); + Main.dust[plasmaDust].scale = 0.6f; + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].position = Projectile.Center + dustRotate; + Main.dust[plasmaDust].velocity = Projectile.velocity; } - for (int num41 = 0; num41 < 2; num41++) + for (int j = 0; j < 2; j++) { - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 1.5f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = 0.6f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; - Main.dust[num42].velocity = Projectile.velocity; + Vector2 dustRotate = Vector2.UnitX * -12f; + dustRotate = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + j * MathHelper.Pi) * dustRotateVector * 1.5f; + int plasmaDust = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); + Main.dust[plasmaDust].scale = 0.6f; + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].position = Projectile.Center + dustRotate; + Main.dust[plasmaDust].velocity = Projectile.velocity; } } } @@ -102,30 +102,30 @@ namespace CalamityMod.Projectiles.DraedonsArsenal PlasmaBurst(1.8f, 3.6f); // 60 dusts - for (int num640 = 0; num640 < 400; num640++) + for (int i = 0; i < 400; i++) { - float num641 = 16f; - if (num640 < 300) - num641 = 12f; - if (num640 < 200) - num641 = 8f; - if (num640 < 100) - num641 = 4f; + float dustScale = 16f; + if (i < 300) + dustScale = 12f; + if (i < 200) + dustScale = 8f; + if (i < 100) + dustScale = 4f; - int num643 = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.NextBool() ? dust1 : dust2, 0f, 0f, 100, default, 1f); - float num644 = Main.dust[num643].velocity.X; - float num645 = Main.dust[num643].velocity.Y; + int deathDust = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.NextBool() ? dust1 : dust2, 0f, 0f, 100, default, 1f); + float deathDustX = Main.dust[deathDust].velocity.X; + float deathDustY = Main.dust[deathDust].velocity.Y; - if (num644 == 0f && num645 == 0f) - num644 = 1f; + if (deathDustX == 0f && deathDustY == 0f) + deathDustX = 1f; - float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); - num646 = num641 / num646; - num644 *= num646; - num645 *= num646; + float deathDustVel = (float)Math.Sqrt(deathDustX * deathDustX + deathDustY * deathDustY); + deathDustVel = dustScale / deathDustVel; + deathDustX *= deathDustVel; + deathDustY *= deathDustVel; float scale = 1f; - switch ((int)num641) + switch ((int)dustScale) { case 4: scale = 1.2f; @@ -143,10 +143,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal break; } - Dust dust = Main.dust[num643]; + Dust dust = Main.dust[deathDust]; dust.velocity *= 0.5f; - dust.velocity.X = dust.velocity.X + num644; - dust.velocity.Y = dust.velocity.Y + num645; + dust.velocity.X = dust.velocity.X + deathDustX; + dust.velocity.Y = dust.velocity.Y + deathDustY; dust.scale = scale; dust.noGravity = true; } @@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angleRandom = 0.35f; - for (int num53 = 0; num53 < 40; num53++) + for (int i = 0; i < 40; i++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -164,27 +164,27 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.Next(2) == 0 ? dust1 : dust2; - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num54].noGravity = true; + int plasmaBurstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[plasmaBurstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[plasmaBurstDust].noGravity = true; - Dust dust = Main.dust[num54]; + Dust dust = Main.dust[plasmaBurstDust]; dust.velocity *= 3f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaBurstDust]; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + plasmaBurstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[plasmaBurstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaBurstDust]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Green * 0.5f; + Main.dust[plasmaBurstDust].noGravity = true; + Main.dust[plasmaBurstDust].fadeIn = 1f; + Main.dust[plasmaBurstDust].color = Color.Green * 0.5f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaBurstDust]; } - for (int num55 = 0; num55 < 20; num55++) + for (int j = 0; j < 20; j++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -192,13 +192,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.Next(2) == 0 ? dust1 : dust2; - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[num56].noGravity = true; + int plasmaBurstDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[plasmaBurstDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; + Main.dust[plasmaBurstDust2].noGravity = true; - Dust dust = Main.dust[num56]; + Dust dust = Main.dust[plasmaBurstDust2]; dust.velocity *= 0.5f; - dust = Main.dust[num56]; + dust = Main.dust[plasmaBurstDust2]; } } } diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index e1d60d1435..8f8b09c5af 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -38,42 +38,42 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > createDustVar) { - for (int num447 = 0; num447 < 2; num447++) + for (int i = 0; i < 2; i++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * (num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, dust1, 0f, 0f, 0, default, 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * (i * 0.25f); + int purpleDust = Dust.NewDust(projPos, 1, 1, dust1, 0f, 0f, 0, default, 1f); + Main.dust[purpleDust].noGravity = true; + Main.dust[purpleDust].position = projPos; + Main.dust[purpleDust].scale = Main.rand.Next(70, 110) * 0.013f; - int num449 = Dust.NewDust(vector33, 1, 1, dust3, 0f, 0f, 0, default, 1f); - Main.dust[num449].noGravity = true; - Main.dust[num449].position = vector33; - Main.dust[num449].scale = Main.rand.Next(70, 110) * 0.013f; + int pinkDust = Dust.NewDust(projPos, 1, 1, dust3, 0f, 0f, 0, default, 1f); + Main.dust[pinkDust].noGravity = true; + Main.dust[pinkDust].position = projPos; + Main.dust[pinkDust].scale = Main.rand.Next(70, 110) * 0.013f; } if (notSplitProjectile) { - Vector2 value7 = new Vector2(5f, 10f); - Vector2 value8 = Vector2.UnitX * -12f; + Vector2 dustRotateVector = new Vector2(5f, 10f); + Vector2 dustRotate = Vector2.UnitX * -12f; - for (int num41 = 0; num41 < 2; num41++) + for (int k = 0; k < 2; k++) { - value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 0f * MathHelper.Pi) * value7; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = 1.5f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; + dustRotate = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 0f * MathHelper.Pi) * dustRotateVector; + int darkPurpDust = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); + Main.dust[darkPurpDust].scale = 1.5f; + Main.dust[darkPurpDust].noGravity = true; + Main.dust[darkPurpDust].position = Projectile.Center + dustRotate; } - for (int num41 = 0; num41 < 2; num41++) + for (int k = 0; k < 2; k++) { - value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 1f * MathHelper.Pi) * value7; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = 1.5f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; + dustRotate = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 1f * MathHelper.Pi) * dustRotateVector; + int darkPurpDust = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); + Main.dust[darkPurpDust].scale = 1.5f; + Main.dust[darkPurpDust].noGravity = true; + Main.dust[darkPurpDust].position = Projectile.Center + dustRotate; } } } @@ -153,47 +153,47 @@ namespace CalamityMod.Projectiles.DraedonsArsenal int half = totalDust / 2; int x = (int)(totalDust * 0.625f); - for (int num647 = 0; num647 < totalDust; num647++) + for (int i = 0; i < totalDust; i++) { - float num648 = 2f * (num647 / (float)fourth); + float dustSpeed = 2f * (i / (float)fourth); int dustType = dust1; - if (num647 > fourth) + if (i > fourth) { - num648 = speed1; + dustSpeed = speed1; } - if (num647 > x) + if (i > x) { - num648 = speed1 * 1.3f; + dustSpeed = speed1 * 1.3f; dustType = dust3; } - int num650 = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); - float num651 = Main.dust[num650].velocity.X; - float num652 = Main.dust[num650].velocity.Y; - if (num651 == 0f && num652 == 0f) + int killDust = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); + float killDustX = Main.dust[killDust].velocity.X; + float killDustY = Main.dust[killDust].velocity.Y; + if (killDustX == 0f && killDustY == 0f) { - num651 = 1f; + killDustX = 1f; } - float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652); - num653 = num648 / num653; - if (num647 <= half) + float killDustYVel = (float)Math.Sqrt(killDustX * killDustX + killDustY * killDustY); + killDustYVel = dustSpeed / killDustYVel; + if (i <= half) { - num651 *= num653; - num652 *= num653; + killDustX *= killDustYVel; + killDustY *= killDustYVel; } else { - num651 = num651 * num653 * 1.25f; - num652 = num652 * num653 * 0.75f; + killDustX = killDustX * killDustYVel * 1.25f; + killDustY = killDustY * killDustYVel * 0.75f; } - Dust dust2 = Main.dust[num650]; + Dust dust2 = Main.dust[killDust]; dust2.velocity *= 0.5f; - dust2.velocity.X = dust2.velocity.X + num651; - dust2.velocity.Y = dust2.velocity.Y + num652; + dust2.velocity.X = dust2.velocity.X + killDustX; + dust2.velocity.Y = dust2.velocity.Y + killDustY; - if (num647 > fourth) + if (i > fourth) { dust2.scale = 1.3f; } @@ -206,47 +206,47 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angleRandom = 0.05f; - for (int num53 = 0; num53 < 50; num53++) + for (int i = 0; i < 50; i++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust3, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num54].noGravity = true; + int pulseDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust3, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[pulseDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[pulseDust].noGravity = true; - Dust dust = Main.dust[num54]; + Dust dust = Main.dust[pulseDust]; dust.velocity *= 3f; - dust = Main.dust[num54]; + dust = Main.dust[pulseDust]; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust1, dustVel.X, dustVel.Y, 100, default, 1f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + pulseDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust1, dustVel.X, dustVel.Y, 100, default, 1f); + Main.dust[pulseDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust = Main.dust[num54]; + dust = Main.dust[pulseDust]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Green * 0.5f; + Main.dust[pulseDust].noGravity = true; + Main.dust[pulseDust].fadeIn = 1f; + Main.dust[pulseDust].color = Color.Green * 0.5f; - dust = Main.dust[num54]; + dust = Main.dust[pulseDust]; } - for (int num55 = 0; num55 < 25; num55++) + for (int j = 0; j < 25; j++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust2, dustVel.X, dustVel.Y, 0, default, 3f); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[num56].noGravity = true; + int pulseDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust2, dustVel.X, dustVel.Y, 0, default, 3f); + Main.dust[pulseDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; + Main.dust[pulseDust2].noGravity = true; - Dust dust = Main.dust[num56]; + Dust dust = Main.dust[pulseDust2]; dust.velocity *= 0.5f; - dust = Main.dust[num56]; + dust = Main.dust[pulseDust2]; } } } diff --git a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs index 5b1a0f7c39..a9ac5ec782 100644 --- a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs +++ b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs @@ -37,14 +37,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > createDustVar) { - for (int num447 = 0; num447 < 2; num447++) + for (int i = 0; i < 2; i++) { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * (num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, dustArray[3], 0f, 0f, 0, default, 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.026f; + Vector2 projPos = Projectile.position; + projPos -= Projectile.velocity * (i * 0.25f); + int teslaDust = Dust.NewDust(projPos, 1, 1, dustArray[3], 0f, 0f, 0, default, 1f); + Main.dust[teslaDust].noGravity = true; + Main.dust[teslaDust].position = projPos; + Main.dust[teslaDust].scale = Main.rand.Next(70, 110) * 0.026f; } if (Main.rand.Next(6) == 0) @@ -60,35 +60,35 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.ai[0] = 0f; else { - Vector2 value7 = new Vector2(5f, 10f); - Vector2 value8 = Vector2.UnitX * -12f; + Vector2 dustRotateVector = new Vector2(5f, 10f); + Vector2 dustRotate = Vector2.UnitX * -12f; float scale = 1f; - for (int num41 = 0; num41 < 2; num41++) + for (int j = 0; j < 2; j++) { - value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustArray[2], 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = scale; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; + dustRotate = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + j * MathHelper.Pi) * dustRotateVector; + int lightBlueDust = Dust.NewDust(Projectile.Center, 0, 0, dustArray[2], 0f, 0f, 160, default, 1f); + Main.dust[lightBlueDust].scale = scale; + Main.dust[lightBlueDust].noGravity = true; + Main.dust[lightBlueDust].position = Projectile.Center + dustRotate; } - for (int num41 = 0; num41 < 2; num41++) + for (int j = 0; j < 2; j++) { - value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 1.5f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustArray[1], 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = scale; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; + dustRotate = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + j * MathHelper.Pi) * dustRotateVector * 1.5f; + int lightBlueDust = Dust.NewDust(Projectile.Center, 0, 0, dustArray[1], 0f, 0f, 160, default, 1f); + Main.dust[lightBlueDust].scale = scale; + Main.dust[lightBlueDust].noGravity = true; + Main.dust[lightBlueDust].position = Projectile.Center + dustRotate; } - for (int num41 = 0; num41 < 2; num41++) + for (int j = 0; j < 2; j++) { - value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 2f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustArray[0], 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = scale; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8; + dustRotate = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + j * MathHelper.Pi) * dustRotateVector * 2f; + int lightBlueDust = Dust.NewDust(Projectile.Center, 0, 0, dustArray[0], 0f, 0f, 160, default, 1f); + Main.dust[lightBlueDust].scale = scale; + Main.dust[lightBlueDust].noGravity = true; + Main.dust[lightBlueDust].position = Projectile.Center + dustRotate; } } @@ -96,15 +96,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { if (arcs < 10) { - Vector2 vector35 = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); - float num474 = 600f; - for (int i = 0; i < Main.maxNPCs; i++) { if (!Main.npc[i].CanBeChasedBy(Projectile, false) || !Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) continue; - if (Projectile.Center.ManhattanDistance(Main.npc[i].Center) < num474) + if (Projectile.Center.ManhattanDistance(Main.npc[i].Center) < 600f) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(Main.npc[i].Center) * 2f, Projectile.type, (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.6f, Projectile.owner, 0f, -1f); @@ -146,81 +143,81 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float dustSpeed = notArcingProjectile ? 12f : 6f; - for (int num672 = 0; num672 < dustAmt; num672++) + for (int i = 0; i < dustAmt; i++) { int dustType = dustArray[4]; - float num674 = dustSpeed; - if (num672 > fourth) + float deathDustSpeed = dustSpeed; + if (i > fourth) { - num674 = dustSpeed * 0.6875f; + deathDustSpeed = dustSpeed * 0.6875f; dustType = dustArray[5]; } - if (num672 > half) + if (i > half) { - num674 = dustSpeed * 0.5f; + deathDustSpeed = dustSpeed * 0.5f; dustType = dustArray[4]; } - if (num672 > threeFourths) + if (i > threeFourths) { - num674 = dustSpeed * 0.3125f; + deathDustSpeed = dustSpeed * 0.3125f; dustType = dustArray[5]; } float scale = (dustType == dustArray[4] ? 3f : 1.5f); - int num675 = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, scale); - float num676 = Main.dust[num675].velocity.X; - float num677 = Main.dust[num675].velocity.Y; + int deathDarkBlue = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, scale); + float deathDustX = Main.dust[deathDarkBlue].velocity.X; + float deathDustY = Main.dust[deathDarkBlue].velocity.Y; - if (num676 == 0f && num677 == 0f) - num676 = 1f; + if (deathDustX == 0f && deathDustY == 0f) + deathDustX = 1f; - float num678 = (float)Math.Sqrt(num676 * num676 + num677 * num677); - num678 = num674 / num678; - if (num672 > threeFourths) + float deathDustVel = (float)Math.Sqrt(deathDustX * deathDustX + deathDustY * deathDustY); + deathDustVel = deathDustSpeed / deathDustVel; + if (i > threeFourths) { - num676 = num676 * num678 * 0.7f; - num677 *= num678; + deathDustX = deathDustX * deathDustVel * 0.7f; + deathDustY *= deathDustVel; } - else if (num672 > half) + else if (i > half) { - num676 *= num678; - num677 = num677 * num678 * 0.7f; + deathDustX *= deathDustVel; + deathDustY = deathDustY * deathDustVel * 0.7f; } - else if (num672 > fourth) + else if (i > fourth) { - num676 = num676 * num678 * 0.7f; - num677 *= num678; + deathDustX = deathDustX * deathDustVel * 0.7f; + deathDustY *= deathDustVel; } else { - num676 *= num678; - num677 = num677 * num678 * 0.7f; + deathDustX *= deathDustVel; + deathDustY = deathDustY * deathDustVel * 0.7f; } - Dust dust8 = Main.dust[num675]; + Dust dust8 = Main.dust[deathDarkBlue]; dust8.velocity *= 0.5f; - dust8.velocity.X = dust8.velocity.X + num676; - dust8.velocity.Y = dust8.velocity.Y + num677; + dust8.velocity.X = dust8.velocity.X + deathDustX; + dust8.velocity.Y = dust8.velocity.Y + deathDustY; dust8.noGravity = true; - if (num672 > threeFourths) + if (i > threeFourths) { - int num650 = Dust.NewDust(Projectile.Center, 6, 6, dustArray[5], 0f, 0f, 100, default, 1.3f); - float num651 = Main.dust[num650].velocity.X; - float num652 = Main.dust[num650].velocity.Y; + int tealDust = Dust.NewDust(Projectile.Center, 6, 6, dustArray[5], 0f, 0f, 100, default, 1.3f); + float tealDustX = Main.dust[tealDust].velocity.X; + float tealDustY = Main.dust[tealDust].velocity.Y; - if (num651 == 0f && num652 == 0f) - num651 = 1f; + if (tealDustX == 0f && tealDustY == 0f) + tealDustX = 1f; - float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652); - num653 = 16f / num653; - num651 = num651 * num653 * 1.25f; - num652 = num652 * num653 * 0.75f; + float tealDustVel = (float)Math.Sqrt(tealDustX * tealDustX + tealDustY * tealDustY); + tealDustVel = 16f / tealDustVel; + tealDustX = tealDustX * tealDustVel * 1.25f; + tealDustY = tealDustY * tealDustVel * 0.75f; - Dust dust9 = Main.dust[num650]; + Dust dust9 = Main.dust[tealDust]; dust9.velocity *= 0.5f; - dust9.velocity.X = dust9.velocity.X + num651; - dust9.velocity.Y = dust9.velocity.Y + num652; + dust9.velocity.X = dust9.velocity.X + tealDustX; + dust9.velocity.Y = dust9.velocity.Y + tealDustY; dust9.noGravity = true; } } @@ -230,7 +227,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angleRandom = 0.05f; - for (int num53 = 0; num53 < 40; num53++) + for (int i = 0; i < 40; i++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -239,27 +236,27 @@ namespace CalamityMod.Projectiles.DraedonsArsenal int randomDustType = Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]; float scale = randomDustType == dustArray[4] ? 1.5f : 1f; - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num54].noGravity = true; + int electricDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); + Main.dust[electricDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[electricDust].noGravity = true; - Dust dust = Main.dust[num54]; + Dust dust = Main.dust[electricDust]; dust.velocity *= 3f; - dust = Main.dust[num54]; + dust = Main.dust[electricDust]; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + electricDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); + Main.dust[electricDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust = Main.dust[num54]; + dust = Main.dust[electricDust]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Cyan * 0.5f; + Main.dust[electricDust].noGravity = true; + Main.dust[electricDust].fadeIn = 1f; + Main.dust[electricDust].color = Color.Cyan * 0.5f; - dust = Main.dust[num54]; + dust = Main.dust[electricDust]; } - for (int num55 = 0; num55 < 20; num55++) + for (int j = 0; j < 20; j++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -268,13 +265,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal int randomDustType = Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]; float scale = randomDustType == dustArray[4] ? 1.5f : 1f; - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[num56].noGravity = true; + int electricDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); + Main.dust[electricDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; + Main.dust[electricDust2].noGravity = true; - Dust dust = Main.dust[num56]; + Dust dust = Main.dust[electricDust2]; dust.velocity *= 0.5f; - dust = Main.dust[num56]; + dust = Main.dust[electricDust2]; } } } From 060aa6acdc96ee5daccdb422f7a3bfda6f110203 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sat, 21 Oct 2023 19:47:40 -0400 Subject: [PATCH 10/43] Boss; Projectiles folder done --- Projectiles/Boss/ApolloFireball.cs | 80 ++++++------- Projectiles/Boss/ApolloRocket.cs | 50 ++++---- Projectiles/Boss/AresLaserBeamStart.cs | 33 +++--- Projectiles/Boss/AresPlasmaFireball.cs | 82 ++++++------- Projectiles/Boss/AresTeslaOrb.cs | 32 ++--- Projectiles/Boss/AstralFlame.cs | 34 +++--- Projectiles/Boss/BigFlare.cs | 89 +++++++------- Projectiles/Boss/BigFlare2.cs | 89 +++++++------- Projectiles/Boss/BirbAura.cs | 77 ++++++------ Projectiles/Boss/BirbAuraFlare.cs | 91 +++++++------- Projectiles/Boss/BloodGeyser.cs | 6 +- Projectiles/Boss/BrimstoneBall.cs | 8 +- Projectiles/Boss/BrimstoneHellfireball.cs | 8 +- Projectiles/Boss/BrimstoneRay.cs | 103 ++++++++-------- Projectiles/Boss/BrimstoneTargetRay.cs | 62 +++++----- Projectiles/Boss/BrimstoneWave.cs | 6 +- Projectiles/Boss/DarkEnergyBall.cs | 26 ++-- Projectiles/Boss/DarkEnergyBall2.cs | 26 ++-- Projectiles/Boss/DeusMine.cs | 18 +-- Projectiles/Boss/DoGBeam.cs | 14 +-- Projectiles/Boss/DoGBeamPortal.cs | 26 ++-- Projectiles/Boss/DoGFire.cs | 64 +++++----- Projectiles/Boss/EssenceDust.cs | 30 ++--- Projectiles/Boss/Flare.cs | 65 +++++----- Projectiles/Boss/FlareBomb.cs | 41 ++++--- Projectiles/Boss/FlareDust.cs | 24 ++-- Projectiles/Boss/FlareDust2.cs | 6 +- Projectiles/Boss/Flarenado.cs | 24 ++-- Projectiles/Boss/FrostMist.cs | 42 +++---- Projectiles/Boss/GreatSandBlast.cs | 24 ++-- Projectiles/Boss/HealOrbProv.cs | 59 +++++---- Projectiles/Boss/HellfireExplosion.cs | 60 +++++----- Projectiles/Boss/HiveBombGoliath.cs | 62 +++++----- Projectiles/Boss/HolyBlast.cs | 34 +++--- Projectiles/Boss/HolyBomb.cs | 38 +++--- Projectiles/Boss/HolyFire.cs | 26 ++-- Projectiles/Boss/HolyFire2.cs | 40 +++---- Projectiles/Boss/HolyFlare.cs | 26 ++-- Projectiles/Boss/HolyLight.cs | 66 +++++------ Projectiles/Boss/HolySpear.cs | 45 ++++--- Projectiles/Boss/IceBlast.cs | 13 +- Projectiles/Boss/IceBomb.cs | 22 ++-- Projectiles/Boss/IceRain.cs | 26 ++-- Projectiles/Boss/IchorBlob.cs | 27 ++--- Projectiles/Boss/IchorShot.cs | 6 +- Projectiles/Boss/Infernado.cs | 24 ++-- Projectiles/Boss/Infernado2.cs | 24 ++-- Projectiles/Boss/LeviathanBomb.cs | 22 ++-- Projectiles/Boss/MoltenBlast.cs | 50 ++++---- Projectiles/Boss/MoltenBlob.cs | 26 ++-- Projectiles/Boss/MushBomb.cs | 18 +-- Projectiles/Boss/MushBombFall.cs | 18 +-- Projectiles/Boss/OldDukeGore.cs | 12 +- Projectiles/Boss/PhantomBlast.cs | 42 +++---- Projectiles/Boss/PhantomBlast2.cs | 42 +++---- Projectiles/Boss/PhantomGhostShot.cs | 12 +- Projectiles/Boss/PhantomHookShot.cs | 12 +- Projectiles/Boss/PhantomMine.cs | 22 ++-- Projectiles/Boss/PhantomShot.cs | 11 +- Projectiles/Boss/PhantomShot2.cs | 11 +- Projectiles/Boss/PlagueExplosion.cs | 48 ++++---- Projectiles/Boss/PlagueStingerGoliath.cs | 28 ++--- Projectiles/Boss/ProvidenceCrystal.cs | 30 ++--- Projectiles/Boss/ProvidenceCrystalShard.cs | 126 ++++++++++---------- Projectiles/Boss/ProvidenceHolyRay.cs | 103 ++++++++-------- Projectiles/Boss/RavagerFlame.cs | 8 +- Projectiles/Boss/RedLightning.cs | 132 ++++++++++----------- Projectiles/Boss/RedLightningFeather.cs | 30 ++--- Projectiles/Boss/SandBlast.cs | 30 ++--- Projectiles/Boss/SandTooth.cs | 14 +-- Projectiles/Boss/ScavengerLaser.cs | 68 +++++------ Projectiles/Boss/ScavengerNuke.cs | 30 ++--- Projectiles/Boss/ShadeNimbusHostile.cs | 6 +- Projectiles/Boss/ShaderainHostile.cs | 4 +- Projectiles/Boss/ShadowflameFireball.cs | 14 +-- Projectiles/Boss/SignusScythe.cs | 36 +++--- Projectiles/Boss/SkyFlare.cs | 63 +++++----- Projectiles/Boss/SkyFlareRevenge.cs | 6 +- Projectiles/Boss/VileClot.cs | 16 +-- Projectiles/Boss/WaterSpear.cs | 10 +- 80 files changed, 1475 insertions(+), 1503 deletions(-) diff --git a/Projectiles/Boss/ApolloFireball.cs b/Projectiles/Boss/ApolloFireball.cs index 449bdfd0f3..39a8db04fd 100644 --- a/Projectiles/Boss/ApolloFireball.cs +++ b/Projectiles/Boss/ApolloFireball.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Boss float speed2 = 2.8f; float angleRandom = 0.35f; - for (int num53 = 0; num53 < 40; num53++) + for (int i = 0; i < 40; i++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -86,27 +86,27 @@ namespace CalamityMod.Projectiles.Boss dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num54].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[plasmaDust].noGravity = true; - Dust dust = Main.dust[num54]; + Dust dust = Main.dust[plasmaDust]; dust.velocity *= 3f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaDust]; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaDust]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Green * 0.5f; + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].fadeIn = 1f; + Main.dust[plasmaDust].color = Color.Green * 0.5f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaDust]; } - for (int num55 = 0; num55 < 20; num55++) + for (int j = 0; j < 20; j++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -114,13 +114,13 @@ namespace CalamityMod.Projectiles.Boss dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[num56].noGravity = true; + int plasmaDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[plasmaDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; + Main.dust[plasmaDust2].noGravity = true; - Dust dust = Main.dust[num56]; + Dust dust = Main.dust[plasmaDust2]; dust.velocity *= 0.5f; - dust = Main.dust[num56]; + dust = Main.dust[plasmaDust2]; } } } @@ -180,30 +180,30 @@ namespace CalamityMod.Projectiles.Boss } } - for (int num640 = 0; num640 < 200; num640++) + for (int i = 0; i < 200; i++) { - float num641 = 16f; - if (num640 < 150) - num641 = 12f; - if (num640 < 100) - num641 = 8f; - if (num640 < 50) - num641 = 4f; + float dustScale = 16f; + if (i < 150) + dustScale = 12f; + if (i < 100) + dustScale = 8f; + if (i < 50) + dustScale = 4f; - int num643 = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.NextBool() ? 107 : 110, 0f, 0f, 100, default, 1f); - float num644 = Main.dust[num643].velocity.X; - float num645 = Main.dust[num643].velocity.Y; + int plasmaDeathDust = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.NextBool() ? 107 : 110, 0f, 0f, 100, default, 1f); + float plasmaDeathDustX = Main.dust[plasmaDeathDust].velocity.X; + float plasmaDeathDustY = Main.dust[plasmaDeathDust].velocity.Y; - if (num644 == 0f && num645 == 0f) - num644 = 1f; + if (plasmaDeathDustX == 0f && plasmaDeathDustY == 0f) + plasmaDeathDustX = 1f; - float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); - num646 = num641 / num646; - num644 *= num646; - num645 *= num646; + float plasmaDeathDustVel = (float)Math.Sqrt(plasmaDeathDustX * plasmaDeathDustX + plasmaDeathDustY * plasmaDeathDustY); + plasmaDeathDustVel = dustScale / plasmaDeathDustVel; + plasmaDeathDustX *= plasmaDeathDustVel; + plasmaDeathDustY *= plasmaDeathDustVel; float scale = 1f; - switch ((int)num641) + switch ((int)dustScale) { case 4: scale = 1.2f; @@ -221,10 +221,10 @@ namespace CalamityMod.Projectiles.Boss break; } - Dust dust = Main.dust[num643]; + Dust dust = Main.dust[plasmaDeathDust]; dust.velocity *= 0.5f; - dust.velocity.X = dust.velocity.X + num644; - dust.velocity.Y = dust.velocity.Y + num645; + dust.velocity.X = dust.velocity.X + plasmaDeathDustX; + dust.velocity.Y = dust.velocity.Y + plasmaDeathDustY; dust.scale = scale; dust.noGravity = true; } diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index c24d7520f8..01c48380b6 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -67,53 +67,53 @@ namespace CalamityMod.Projectiles.Boss { Projectile.localAI[0] = 1f; - float speed1 = 1.8f; - float speed2 = 2.8f; + float randDustSpeed1 = 1.8f; + float randDustSpeed2 = 2.8f; float angleRandom = 0.35f; - for (int num53 = 0; num53 < 20; num53++) + for (int i = 0; i < 20; i++) { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); + float dustSpeed = Main.rand.NextFloat(randDustSpeed1, randDustSpeed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num54].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[plasmaDust].noGravity = true; - Dust dust = Main.dust[num54]; + Dust dust = Main.dust[plasmaDust]; dust.velocity *= 3f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaDust]; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaDust]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Green * 0.5f; + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].fadeIn = 1f; + Main.dust[plasmaDust].color = Color.Green * 0.5f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaDust]; } - for (int num55 = 0; num55 < 10; num55++) + for (int j = 0; j < 10; j++) { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); + float dustSpeed = Main.rand.NextFloat(randDustSpeed1, randDustSpeed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[num56].noGravity = true; + int plasmaDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[plasmaDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; + Main.dust[plasmaDust2].noGravity = true; - Dust dust = Main.dust[num56]; + Dust dust = Main.dust[plasmaDust2]; dust.velocity *= 0.5f; - dust = Main.dust[num56]; + dust = Main.dust[plasmaDust2]; } } @@ -214,7 +214,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int num621 = 0; num621 < 12; num621++) + for (int i = 0; i < 12; i++) { int randomDustType = Main.rand.NextBool() ? 107 : 110; int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, 0f, 0f, 100, default, 2f); @@ -225,7 +225,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int j = 0; j < 15; j++) { int randomDustType = Main.rand.NextBool() ? 107 : 110; int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, 0f, 0f, 100, default, 3f); diff --git a/Projectiles/Boss/AresLaserBeamStart.cs b/Projectiles/Boss/AresLaserBeamStart.cs index 26be83ad1b..72fd77af59 100644 --- a/Projectiles/Boss/AresLaserBeamStart.cs +++ b/Projectiles/Boss/AresLaserBeamStart.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Boss else Projectile.Kill(); - float num801 = 1f; + float projScale = 1f; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 60f) { @@ -88,38 +88,37 @@ namespace CalamityMod.Projectiles.Boss return; } - Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * (float)Math.PI / 60f) * 10f * num801; - if (Projectile.scale > num801) - Projectile.scale = num801; + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * (float)Math.PI / 60f) * 10f * projScale; + if (Projectile.scale > projScale) + Projectile.scale = projScale; - float num804 = Projectile.velocity.ToRotation(); - Projectile.rotation = num804 - MathHelper.PiOver2; - Projectile.velocity = num804.ToRotationVector2(); + float projVelRotation = Projectile.velocity.ToRotation(); + Projectile.rotation = projVelRotation - MathHelper.PiOver2; + Projectile.velocity = projVelRotation.ToRotationVector2(); - float num805 = 3f; //3f - float num806 = Projectile.width; + float projWidth = Projectile.width; Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) samplingPoint = vector78.Value; - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, 2400f, array3); - float num807 = 0f; - for (int num808 = 0; num808 < array3.Length; num808++) + float[] array3 = new float[3]; + Collision.LaserScan(samplingPoint, Projectile.velocity, projWidth * Projectile.scale, 2400f, array3); + float laserLength = 0f; + for (int j = 0; j < array3.Length; j++) { - num807 += array3[num808]; + laserLength += array3[j]; } - num807 /= num805; + laserLength /= 3f; // Fire laser through walls at max length if target cannot be seen if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) { - num807 = 2400f; + laserLength = 2400f; } float amount = 0.5f; - Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); //length of laser, linear interpolation + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], laserLength, amount); //length of laser, linear interpolation // Spawn dust at the end of the beam int dustType = (int)CalamityDusts.Brimstone; diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index bb996d70a9..7f31201977 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -77,48 +77,48 @@ namespace CalamityMod.Projectiles.Boss { Projectile.localAI[0] = 1f; - float speed1 = 1.8f; - float speed2 = 2.8f; + float randDustSpeed1 = 1.8f; + float randDustSpeed2 = 2.8f; float angleRandom = 0.35f; - for (int num53 = 0; num53 < 40; num53++) + for (int i = 0; i < 40; i++) { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); + float dustSpeed = Main.rand.NextFloat(randDustSpeed1, randDustSpeed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num54].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[plasmaDust].noGravity = true; - Dust dust = Main.dust[num54]; + Dust dust = Main.dust[plasmaDust]; dust.velocity *= 3f; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust = Main.dust[num54]; + dust = Main.dust[plasmaDust]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Green * 0.5f; + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].fadeIn = 1f; + Main.dust[plasmaDust].color = Color.Green * 0.5f; } - for (int num55 = 0; num55 < 20; num55++) + for (int j = 0; j < 20; j++) { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); + float dustSpeed = Main.rand.NextFloat(randDustSpeed1, randDustSpeed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[num56].noGravity = true; + int plasmaDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[plasmaDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; + Main.dust[plasmaDust2].noGravity = true; - Dust dust = Main.dust[num56]; + Dust dust = Main.dust[plasmaDust2]; dust.velocity *= 0.5f; } } @@ -184,30 +184,30 @@ namespace CalamityMod.Projectiles.Boss } } - for (int num640 = 0; num640 < 200; num640++) + for (int i = 0; i < 200; i++) { - float num641 = 16f; - if (num640 < 150) - num641 = 12f; - if (num640 < 100) - num641 = 8f; - if (num640 < 50) - num641 = 4f; + float dustScale = 16f; + if (i < 150) + dustScale = 12f; + if (i < 100) + dustScale = 8f; + if (i < 50) + dustScale = 4f; - int num643 = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.NextBool() ? 107 : 110, 0f, 0f, 100, default, 1f); - float num644 = Main.dust[num643].velocity.X; - float num645 = Main.dust[num643].velocity.Y; + int deathPlasmaDust = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.NextBool() ? 107 : 110, 0f, 0f, 100, default, 1f); + float deathPlasmaDustX = Main.dust[deathPlasmaDust].velocity.X; + float deathPlasmaDustY = Main.dust[deathPlasmaDust].velocity.Y; - if (num644 == 0f && num645 == 0f) - num644 = 1f; + if (deathPlasmaDustX == 0f && deathPlasmaDustY == 0f) + deathPlasmaDustX = 1f; - float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); - num646 = num641 / num646; - num644 *= num646; - num645 *= num646; + float deathPlasmaDustVel = (float)Math.Sqrt(deathPlasmaDustX * deathPlasmaDustX + deathPlasmaDustY * deathPlasmaDustY); + deathPlasmaDustVel = dustScale / deathPlasmaDustVel; + deathPlasmaDustX *= deathPlasmaDustVel; + deathPlasmaDustY *= deathPlasmaDustVel; float scale = 1f; - switch ((int)num641) + switch ((int)dustScale) { case 4: scale = 1.2f; @@ -225,10 +225,10 @@ namespace CalamityMod.Projectiles.Boss break; } - Dust dust = Main.dust[num643]; + Dust dust = Main.dust[deathPlasmaDust]; dust.velocity *= 0.5f; - dust.velocity.X = dust.velocity.X + num644; - dust.velocity.Y = dust.velocity.Y + num645; + dust.velocity.X = dust.velocity.X + deathPlasmaDustX; + dust.velocity.Y = dust.velocity.Y + deathPlasmaDustY; dust.scale = scale; dust.noGravity = true; } diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index a12991cc6c..499fcd342c 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss float speed2 = 2.8f; float angleRandom = 0.35f; - for (int num53 = 0; num53 < 40; num53++) + for (int i = 0; i < 40; i++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -98,24 +98,24 @@ namespace CalamityMod.Projectiles.Boss int randomDustType = Main.rand.Next(2) == 0 ? 206 : 229; float scale = randomDustType == 206 ? 1.5f : 1f; - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[num54].noGravity = true; + int teslaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); + Main.dust[teslaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[teslaDust].noGravity = true; - Dust dust = Main.dust[num54]; + Dust dust = Main.dust[teslaDust]; dust.velocity *= 3f; - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + teslaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); + Main.dust[teslaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - dust = Main.dust[num54]; + dust = Main.dust[teslaDust]; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Cyan * 0.5f; + Main.dust[teslaDust].noGravity = true; + Main.dust[teslaDust].fadeIn = 1f; + Main.dust[teslaDust].color = Color.Cyan * 0.5f; } - for (int num55 = 0; num55 < 20; num55++) + for (int j = 0; j < 20; j++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(Projectile.velocity.ToRotation()); @@ -124,11 +124,11 @@ namespace CalamityMod.Projectiles.Boss int randomDustType = Main.rand.Next(2) == 0 ? 206 : 229; float scale = randomDustType == 206 ? 1.5f : 1f; - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[num56].noGravity = true; + int teslaDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); + Main.dust[teslaDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; + Main.dust[teslaDust2].noGravity = true; - Dust dust = Main.dust[num56]; + Dust dust = Main.dust[teslaDust2]; dust.velocity *= 0.5f; } } diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index f465ac111a..b7fd4f0366 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -67,9 +67,9 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); - int num103 = Player.FindClosest(Projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; - if (vector11.Length() < 60f) + int targetPlayer = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 playerDist = Main.player[targetPlayer].Center - Projectile.Center; + if (playerDist.Length() < 60f) { Projectile.Kill(); return; @@ -78,9 +78,9 @@ namespace CalamityMod.Projectiles.Boss Projectile.ai[0] += 1f; if (Projectile.ai[0] > 15f) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 0.8f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int astralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 0.8f); + Main.dust[astralDust].noGravity = true; + Main.dust[astralDust].velocity *= 0f; } if (Projectile.ai[0] >= 120f) @@ -88,9 +88,9 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] < 180f) { float scaleFactor2 = Projectile.velocity.Length(); - vector11.Normalize(); - vector11 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 30f + vector11) / 31f; + playerDist.Normalize(); + playerDist *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 30f + playerDist) / 31f; Projectile.velocity.Normalize(); Projectile.velocity *= scaleFactor2; } @@ -160,18 +160,18 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = Projectile.height = 96; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.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, 173, 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int deathAstralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); + Main.dust[deathAstralDust].noGravity = true; + Main.dust[deathAstralDust].velocity *= 3f; + deathAstralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 50, default, 1f); + Main.dust[deathAstralDust].velocity *= 2f; + Main.dust[deathAstralDust].noGravity = true; } Projectile.Damage(); } diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index a91f53e261..2b31191ca4 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -56,23 +56,23 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] > 0f) { - int num625 = (int)Projectile.ai[1] - 1; - if (num625 < 255) + int playerTracker = (int)Projectile.ai[1] - 1; + if (playerTracker < 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 randomDustPos = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int flareDust = Dust.NewDust(dustRotate + randomDustPos, 0, 0, 244, randomDustPos.X * 2f, randomDustPos.Y * 2f, 100, default, 1.4f); + Main.dust[flareDust].noGravity = true; + Main.dust[flareDust].noLight = true; + Main.dust[flareDust].velocity /= 4f; + Main.dust[flareDust].velocity -= Projectile.velocity; } Projectile.alpha -= 5; if (Projectile.alpha < 100) @@ -81,11 +81,11 @@ namespace CalamityMod.Projectiles.Boss } } - Vector2 value16 = Main.player[num625].Center - Projectile.Center; - float num629 = 4f; - num629 += Projectile.localAI[0] / 60f; - Projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 64f) + Vector2 playerDistance = Main.player[playerTracker].Center - Projectile.Center; + float projVelocityMult = 4f; + projVelocityMult += Projectile.localAI[0] / 60f; + Projectile.velocity = Vector2.Normalize(playerDistance) * projVelocityMult; + if (playerDistance.Length() < 64f) { Projectile.Kill(); } @@ -114,55 +114,54 @@ namespace CalamityMod.Projectiles.Boss { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; SoundEngine.PlaySound(FlareSound, Projectile.Center); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmtKill = 36; + for (int j = 0; j < dustAmtKill; 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, 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 rotation = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotation = rotation.RotatedBy((double)((float)(j - (dustAmtKill / 2 - 1)) * 6.28318548f / (float)dustAmtKill), default) + Projectile.Center; + Vector2 faceDirection = rotation - Projectile.Center; + int flareDeath = Dust.NewDust(rotation + faceDirection, 0, 0, 244, faceDirection.X * 2f, faceDirection.Y * 2f, 100, default, 1.4f); + Main.dust[flareDeath].noGravity = true; + Main.dust[flareDeath].noLight = true; + Main.dust[flareDeath].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 projTileX = (int)(Projectile.Center.Y / 16f); + int projTileY = (int)(Projectile.Center.X / 16f); + if (projTileY < 10) { - num232 = 10; + projTileY = 10; } - if (num232 > Main.maxTilesX - 10) + if (projTileY > Main.maxTilesX - 10) { - num232 = Main.maxTilesX - 10; + projTileY = Main.maxTilesX - 10; } - if (num231 < 10) + if (projTileX < 10) { - num231 = 10; + projTileX = 10; } - if (num231 > Main.maxTilesY - num233 - 10) + if (projTileX > Main.maxTilesY - 110) { - num231 = Main.maxTilesY - num233 - 10; + projTileX = Main.maxTilesY - 110; } - int spawnAreaY = Main.maxTilesY - num231; - for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) + int spawnAreaY = Main.maxTilesY - projTileX; + for (int k = projTileX; k < projTileX + spawnAreaY; k++) { - Tile tile = Main.tile[num232, num234 + 10]; + Tile tile = Main.tile[projTileY, k + 10]; if (tile.HasTile && !TileID.Sets.Platforms[tile.TileType] && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0)) { - num231 = num234; + projTileX = k; break; } } int spawnLimitY = (int)(Main.player[Projectile.owner].Center.Y / 16f) + 50; - if (num231 > spawnLimitY) + if (projTileX > spawnLimitY) { - num231 = spawnLimitY; + projTileX = spawnLimitY; } - int num236 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), 0, 4f, Main.myPlayer, 11f, 16f + (revenge ? 2f : 0f)); - Main.projectile[num236].netUpdate = true; + int infernadoSpawn = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), 0, 4f, Main.myPlayer, 11f, 16f + (revenge ? 2f : 0f)); + Main.projectile[infernadoSpawn].netUpdate = true; } } } diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index 79b0ea852b..ef29b09baa 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -56,23 +56,23 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] > 0f) { - int num625 = (int)Projectile.ai[1] - 1; - if (num625 < 255) + int playerTracker = (int)Projectile.ai[1] - 1; + if (playerTracker < 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 dustRotation = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustRotation = dustRotation.RotatedBy((double)(i - (dustAmt / 2 - 1)) * 3.1415926535897931 / (double)(float)dustAmt, default) + Projectile.Center; + Vector2 randomDustPos = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int flareDust = Dust.NewDust(dustRotation + randomDustPos, 0, 0, 244, randomDustPos.X * 2f, randomDustPos.Y * 2f, 100, default, 1.4f); + Main.dust[flareDust].noGravity = true; + Main.dust[flareDust].noLight = true; + Main.dust[flareDust].velocity /= 4f; + Main.dust[flareDust].velocity -= Projectile.velocity; } Projectile.alpha -= 5; if (Projectile.alpha < 100) @@ -81,11 +81,11 @@ namespace CalamityMod.Projectiles.Boss } } - Vector2 value16 = Main.player[num625].Center - Projectile.Center; - float num629 = 4f; - num629 += Projectile.localAI[0] / 60f; - Projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 64f) + Vector2 playerDistance = Main.player[playerTracker].Center - Projectile.Center; + float projVelocityMult = 4f; + projVelocityMult += Projectile.localAI[0] / 60f; + Projectile.velocity = Vector2.Normalize(playerDistance) * projVelocityMult; + if (playerDistance.Length() < 64f) { Projectile.Kill(); } @@ -114,55 +114,54 @@ namespace CalamityMod.Projectiles.Boss { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; SoundEngine.PlaySound(FlareSound, Projectile.Center); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int killDustAmt = 36; + for (int i = 0; i < killDustAmt; 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 killDustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + killDustRotate = killDustRotate.RotatedBy((double)((float)(i - (killDustAmt / 2 - 1)) * 6.28318548f / (float)killDustAmt), default) + Projectile.Center; + Vector2 killDustDirection = killDustRotate - Projectile.Center; + int killFlareDust = Dust.NewDust(killDustRotate + killDustDirection, 0, 0, 244, killDustDirection.X * 2f, killDustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[killFlareDust].noGravity = true; + Main.dust[killFlareDust].noLight = true; + Main.dust[killFlareDust].velocity = killDustDirection; } 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 projTileX = (int)(Projectile.Center.Y / 16f); + int projTileY = (int)(Projectile.Center.X / 16f); + if (projTileY < 10) { - num232 = 10; + projTileY = 10; } - if (num232 > Main.maxTilesX - 10) + if (projTileY > Main.maxTilesX - 10) { - num232 = Main.maxTilesX - 10; + projTileY = Main.maxTilesX - 10; } - if (num231 < 10) + if (projTileX < 10) { - num231 = 10; + projTileX = 10; } - if (num231 > Main.maxTilesY - num233 - 10) + if (projTileX > Main.maxTilesY - 110) { - num231 = Main.maxTilesY - num233 - 10; + projTileX = Main.maxTilesY - 110; } - int spawnAreaY = Main.maxTilesY - num231; - for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) + int spawnAreaY = Main.maxTilesY - projTileX; + for (int j = projTileX; j < projTileX + spawnAreaY; j++) { - Tile tile = Main.tile[num232, num234 + 10]; + Tile tile = Main.tile[projTileY, j + 10]; if (tile.HasTile && !TileID.Sets.Platforms[tile.TileType] && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0)) { - num231 = num234; + projTileX = j; break; } } int spawnLimitY = (int)(Main.player[Projectile.owner].Center.Y / 16f) + 75; - if (num231 > spawnLimitY) + if (projTileX > spawnLimitY) { - num231 = spawnLimitY; + projTileX = spawnLimitY; } - int num236 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), 0, 4f, Main.myPlayer, 11f, 24f + (revenge ? 2f : 0f)); - Main.projectile[num236].netUpdate = true; + int infernadoSpawn = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), 0, 4f, Main.myPlayer, 11f, 24f + (revenge ? 2f : 0f)); + Main.projectile[infernadoSpawn].netUpdate = true; } } } diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index f211dc83e4..acf28018d7 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss if (timer > 0f) timer -= 1f; - float num801 = 1f; + float projScale = 1f; if (timeBeforeVanish == 0f) timeBeforeVanish = Projectile.timeLeft <= 900 ? 900f : 1200f; @@ -77,35 +77,33 @@ namespace CalamityMod.Projectiles.Boss return; } - Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * Math.PI / timeBeforeVanish) * 10f * num801; - if (Projectile.scale > num801) - Projectile.scale = num801; + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * Math.PI / timeBeforeVanish) * 10f * projScale; + if (Projectile.scale > projScale) + Projectile.scale = projScale; - float num804 = Projectile.velocity.ToRotation(); - Projectile.rotation = num804 - MathHelper.PiOver2; - Projectile.velocity = num804.ToRotationVector2(); + float projVelRotation = Projectile.velocity.ToRotation(); + Projectile.rotation = projVelRotation - MathHelper.PiOver2; + Projectile.velocity = projVelRotation.ToRotationVector2(); - float num805 = 3f; //3f - float num806 = Projectile.width; + float projWidth = Projectile.width; Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) samplingPoint = vector78.Value; float laserLength = Projectile.ai[1] - 160f; - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, laserLength, array3); - float num807 = 0f; - for (int num808 = 0; num808 < array3.Length; num808++) + float[] array3 = new float[3]; + Collision.LaserScan(samplingPoint, Projectile.velocity, projWidth * Projectile.scale, laserLength, array3); + float auraLength = 0f; + for (int j = 0; j < array3.Length; j++) { - num807 += array3[num808]; + auraLength += array3[j]; } - num807 /= num805; + auraLength /= 3f; - num807 = MathHelper.Clamp(num807, 3600f, 4800f); + auraLength = MathHelper.Clamp(auraLength, 3600f, 4800f); - float amount = 0.5f; - Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], auraLength, 0.5f); DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, DelegateMethods.CastLight); @@ -137,37 +135,37 @@ namespace CalamityMod.Projectiles.Boss Texture2D texture = ModContent.Request(Texture).Value; Texture2D texture2 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraStart", AssetRequestMode.ImmediateLoad).Value; Texture2D texture3 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraEnd", AssetRequestMode.ImmediateLoad).Value; - float num223 = Projectile.localAI[1]; //length of laser - Color color44 = new Color(128, 128, 128, 0); + float auraDrawLength = Projectile.localAI[1]; //length of laser + Color grayColor = new Color(128, 128, 128, 0); Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - Main.EntitySpriteDraw(texture2, vector, sourceRectangle2, color44, Projectile.rotation, texture2.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - num223 -= (texture2.Height / 2 + texture3.Height) * Projectile.scale; - Vector2 value20 = Projectile.Center; - value20 += Projectile.velocity * Projectile.scale * texture2.Height / 2f; - if (num223 > 0f) + Main.EntitySpriteDraw(texture2, vector, sourceRectangle2, grayColor, Projectile.rotation, texture2.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + auraDrawLength -= (texture2.Height / 2 + texture3.Height) * Projectile.scale; + Vector2 projCenter = Projectile.Center; + projCenter += Projectile.velocity * Projectile.scale * texture2.Height / 2f; + if (auraDrawLength > 0f) { - float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 0, texture.Width, texture.Height); - while (num224 + 1f < num223) + float auraSegment = 0f; + Rectangle drawRectangle = new Rectangle(0, 0, texture.Width, texture.Height); + while (auraSegment + 1f < auraDrawLength) { - if (num223 - num224 < rectangle7.Height) + if (auraDrawLength - auraSegment < drawRectangle.Height) { - rectangle7.Height = (int)(num223 - num224); + drawRectangle.Height = (int)(auraDrawLength - auraSegment); } - Main.EntitySpriteDraw(texture, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); - num224 += rectangle7.Height * Projectile.scale; - value20 += Projectile.velocity * rectangle7.Height * Projectile.scale; - rectangle7.Y += texture.Height; - if (rectangle7.Y + rectangle7.Height > texture.Height) + Main.EntitySpriteDraw(texture, projCenter - Main.screenPosition, new Rectangle?(drawRectangle), grayColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); + auraSegment += drawRectangle.Height * Projectile.scale; + projCenter += Projectile.velocity * drawRectangle.Height * Projectile.scale; + drawRectangle.Y += texture.Height; + if (drawRectangle.Y + drawRectangle.Height > texture.Height) { - rectangle7.Y = 0; + drawRectangle.Y = 0; } } } - Vector2 vector2 = value20 - Main.screenPosition; + Vector2 vector2 = projCenter - Main.screenPosition; sourceRectangle2 = null; - Main.EntitySpriteDraw(texture3, vector2, sourceRectangle2, color44, Projectile.rotation, texture3.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture3, vector2, sourceRectangle2, grayColor, Projectile.rotation, texture3.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -188,8 +186,7 @@ namespace CalamityMod.Projectiles.Boss { return true; } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 80f * Projectile.scale, ref num6)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 80f * Projectile.scale, ref 0f)) { return true; } diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index 1c8dce2446..a865c28167 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -40,35 +40,35 @@ namespace CalamityMod.Projectiles.Boss { if (Projectile.ai[1] > 0f) { - int num625 = (int)Projectile.ai[1] - 1; - if (num625 < 255) + int playerTracker = (int)Projectile.ai[1] - 1; + if (playerTracker < 255) { Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 10f) { // Dust pulse effect Projectile.localAI[1] = (float)Math.Abs(Math.Cos(MathHelper.ToRadians(Projectile.localAI[0] * 2f))); - int num626 = 18; - for (int num627 = 0; num627 < num626; num627++) + int dustAmt = 18; + for (int i = 0; i < dustAmt; i++) { - Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * Projectile.localAI[1]; - vector45 = vector45.RotatedBy((num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (float)num626) + Projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * Math.PI) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 60, value15.X * 2f, value15.Y * 2f, 100, default, 1f); - Main.dust[num628].scale = 1.4f; - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= Projectile.velocity; + Vector2 dustRotation = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * Projectile.localAI[1]; + dustRotation = dustRotation.RotatedBy((i - (dustAmt / 2 - 1)) * 3.1415926535897931 / (float)dustAmt) + Projectile.Center; + Vector2 randomDustPos = ((float)(Main.rand.NextDouble() * Math.PI) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int lightningDust = Dust.NewDust(dustRotation + randomDustPos, 0, 0, 60, randomDustPos.X * 2f, randomDustPos.Y * 2f, 100, default, 1f); + Main.dust[lightningDust].scale = 1.4f; + Main.dust[lightningDust].noGravity = true; + Main.dust[lightningDust].noLight = true; + Main.dust[lightningDust].velocity /= 4f; + Main.dust[lightningDust].velocity -= Projectile.velocity; } } - Vector2 value16 = Main.player[num625].Center - Projectile.Center; - float num629 = 4f; + Vector2 playerDistance = Main.player[playerTracker].Center - Projectile.Center; + float projVelocityMult = 4f; float divisor = 60f - 15f * Projectile.ai[0]; - num629 += Projectile.localAI[0] / divisor; - Projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 32f) + projVelocityMult += Projectile.localAI[0] / divisor; + Projectile.velocity = Vector2.Normalize(playerDistance) * projVelocityMult; + if (playerDistance.Length() < 32f) { Projectile.Kill(); } @@ -79,40 +79,39 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.Center); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int killDustAmt = 36; + for (int i = 0; i < killDustAmt; i++) { Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226) + Projectile.Center; + vector6 = vector6.RotatedBy((i - (killDustAmt / 2 - 1)) * MathHelper.TwoPi / killDustAmt) + Projectile.Center; Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X, vector7.Y, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + int killLightningDust = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X, vector7.Y, 100, default, 1.4f); + Main.dust[killLightningDust].noGravity = true; + Main.dust[killLightningDust].noLight = true; + Main.dust[killLightningDust].velocity = vector7; } 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 projTileX = (int)(Projectile.Center.Y / 16f); + int projTileY = (int)(Projectile.Center.X / 16f); + if (projTileY < 10) { - num232 = 10; + projTileY = 10; } - if (num232 > Main.maxTilesX - 10) + if (projTileY > Main.maxTilesX - 10) { - num232 = Main.maxTilesX - 10; + projTileY = Main.maxTilesX - 10; } - if (num231 < 10) + if (projTileX < 10) { - num231 = 10; + projTileX = 10; } - if (num231 > Main.maxTilesY - num233 - 10) + if (projTileX > Main.maxTilesY - 110) { - num231 = Main.maxTilesY - num233 - 10; + projTileX = Main.maxTilesY - 110; } - float x = num232 * 16; - float y = num231 * 16 + 900; + float x = projTileY * 16; + float y = projTileX * 16 + 900; Vector2 laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); int type = ModContent.ProjectileType(); int damage = Projectile.GetProjectileDamage(ModContent.NPCType()); @@ -125,9 +124,9 @@ namespace CalamityMod.Projectiles.Boss } laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); laserVelocity.Normalize(); - int num237 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, 0f, laserVelocity.Y, type, damage, 0f, Main.myPlayer, x, y); - Main.projectile[num237].timeLeft = 900; - Main.projectile[num237].netUpdate = true; + int thirdPhaseRightLaser = Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, 0f, laserVelocity.Y, type, damage, 0f, Main.myPlayer, x, y); + Main.projectile[thirdPhaseRightLaser].timeLeft = 900; + Main.projectile[thirdPhaseRightLaser].netUpdate = true; x -= 2000f; if ((int)(x / 16f) < 10) @@ -136,15 +135,15 @@ namespace CalamityMod.Projectiles.Boss } laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); laserVelocity.Normalize(); - int num238 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, 0f, laserVelocity.Y, type, damage, 0f, Main.myPlayer, x, y); - Main.projectile[num238].timeLeft = 900; - Main.projectile[num238].netUpdate = true; + int thirdPhaseLeftLaser = Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, 0f, laserVelocity.Y, type, damage, 0f, Main.myPlayer, x, y); + Main.projectile[thirdPhaseLeftLaser].timeLeft = 900; + Main.projectile[thirdPhaseLeftLaser].netUpdate = true; } else { laserVelocity.Normalize(); - int num236 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, 0f, laserVelocity.Y, type, damage, 0f, Main.myPlayer, x, y); - Main.projectile[num236].netUpdate = true; + int secondPhaseLaser = Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, 0f, laserVelocity.Y, type, damage, 0f, Main.myPlayer, x, y); + Main.projectile[secondPhaseLaser].netUpdate = true; } } } diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 45af5469f0..5d81a128e5 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -33,9 +33,9 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 0.5f); + Main.dust[bloody].noGravity = true; + Main.dust[bloody].velocity *= 0f; if (Projectile.velocity.Y < 12f) Projectile.velocity.Y += 0.06f; diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index 8e3b2899ba..74ee3fd7f0 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); - for (int num468 = 0; num468 < 2; num468++) + for (int i = 0; i < 2; i++) { Vector2 dspeed = -Projectile.velocity * 0.7f; - int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 150, default, 1.1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity = dspeed; + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 150, default, 1.1f); + Main.dust[brimDust].noGravity = true; + Main.dust[brimDust].velocity = dspeed; } } diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index 12748e6d7b..626c209abc 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -67,10 +67,10 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] += 1f; } - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 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(new Vector2(Projectile.position.X, Projectile.position.Y), 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; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index fbd382f4f2..ce405338e0 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss else Projectile.Kill(); - float num801 = 1f; + float projScale = 1f; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 45f) { @@ -74,21 +74,20 @@ namespace CalamityMod.Projectiles.Boss return; } - Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * (float)Math.PI / 45f) * 10f * num801; - if (Projectile.scale > num801) - Projectile.scale = num801; + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * (float)Math.PI / 45f) * 10f * projScale; + if (Projectile.scale > projScale) + Projectile.scale = projScale; - float num804 = Projectile.velocity.ToRotation(); + float projVelRotation = Projectile.velocity.ToRotation(); // Rotating beam for test AI if (Projectile.ai[0] > 0f) - num804 += Main.npc[(int)Projectile.ai[1]].spriteDirection * MathHelper.TwoPi / 360f; + projVelRotation += Main.npc[(int)Projectile.ai[1]].spriteDirection * MathHelper.TwoPi / 360f; - Projectile.rotation = num804 - MathHelper.PiOver2; - Projectile.velocity = num804.ToRotationVector2(); + Projectile.rotation = projVelRotation - MathHelper.PiOver2; + Projectile.velocity = projVelRotation.ToRotationVector2(); - float num805 = 3f; //3f - float num806 = Projectile.width; + float projWidth = Projectile.width; Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) @@ -96,24 +95,23 @@ namespace CalamityMod.Projectiles.Boss samplingPoint = vector78.Value; } - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, 2400f, array3); - float num807 = 0f; - for (int num808 = 0; num808 < array3.Length; num808++) + float[] array3 = new float[3]; + Collision.LaserScan(samplingPoint, Projectile.velocity, projWidth * Projectile.scale, 2400f, array3); + float rayLength = 0f; + for (int i = 0; i < array3.Length; i++) { - num807 += array3[num808]; + rayLength += array3[i]; } - num807 /= num805; + rayLength /= 3f; // Fire laser through walls at max length if target cannot be seen if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) { - num807 = 2400f; + rayLength = 2400f; } - float amount = 0.5f; //0.5f - Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); //length of laser, linear interpolation - Vector2 vector79 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], rayLength, 0.5f); //length of laser, linear interpolation + Vector2 dustSpawnPos = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); // Fire brimstone darts along the laser bool bossRush = BossRushEvent.BossRushActive; @@ -143,23 +141,23 @@ namespace CalamityMod.Projectiles.Boss } } - for (int num809 = 0; num809 < 2; num809++) + for (int j = 0; j < 2; j++) { - float num810 = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; - float num811 = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811); - int num812 = Dust.NewDust(vector79, 0, 0, (int)CalamityDusts.Brimstone, vector80.X, vector80.Y, 0, default, 1f); - Main.dust[num812].noGravity = true; - Main.dust[num812].scale = 1.7f; + float dustRotation = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float randomFloatOffset = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 dustDirection = new Vector2((float)Math.Cos(dustRotation) * randomFloatOffset, (float)Math.Sin(dustRotation) * randomFloatOffset); + int brimDust = Dust.NewDust(dustSpawnPos, 0, 0, (int)CalamityDusts.Brimstone, dustDirection.X, dustDirection.Y, 0, default, 1f); + Main.dust[brimDust].noGravity = true; + Main.dust[brimDust].scale = 1.7f; } if (Main.rand.NextBool(5)) { - Vector2 value29 = Projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; - int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num813]; + Vector2 extraDustSpawn = Projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; + int extraBrimDust = Dust.NewDust(dustSpawnPos + extraDustSpawn - Vector2.One * 4f, 8, 8, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[extraBrimDust]; dust.velocity *= 0.5f; - Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); + Main.dust[extraBrimDust].velocity.Y = -Math.Abs(Main.dust[extraBrimDust].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); @@ -175,37 +173,37 @@ namespace CalamityMod.Projectiles.Boss Texture2D texture2D19 = ModContent.Request(Texture).Value; Texture2D texture2D20 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayMid", AssetRequestMode.ImmediateLoad).Value; Texture2D texture2D21 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayEnd", AssetRequestMode.ImmediateLoad).Value; - float num223 = Projectile.localAI[1]; //length of laser - Color color44 = new Color(255, 255, 255, 0) * 0.9f; + float rayDrawLength = Projectile.localAI[1]; //length of laser + Color baseColor = new Color(255, 255, 255, 0) * 0.9f; Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - Main.EntitySpriteDraw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - num223 -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; - Vector2 value20 = Projectile.Center; - value20 += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; - if (num223 > 0f) + Main.EntitySpriteDraw(texture2D19, vector, sourceRectangle2, baseColor, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + rayDrawLength -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; + Vector2 projCenter = Projectile.Center; + projCenter += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; + if (rayDrawLength > 0f) { - float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 0, texture2D20.Width, texture2D20.Height); - while (num224 + 1f < num223) + float raySegment = 0f; + Rectangle drawRectangle = new Rectangle(0, 0, texture2D20.Width, texture2D20.Height); + while (raySegment + 1f < rayDrawLength) { - if (num223 - num224 < rectangle7.Height) + if (rayDrawLength - raySegment < drawRectangle.Height) { - rectangle7.Height = (int)(num223 - num224); + drawRectangle.Height = (int)(rayDrawLength - raySegment); } - Main.EntitySpriteDraw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); - num224 += rectangle7.Height * Projectile.scale; - value20 += Projectile.velocity * rectangle7.Height * Projectile.scale; - rectangle7.Y += texture2D20.Height; - if (rectangle7.Y + rectangle7.Height > texture2D20.Height) + Main.EntitySpriteDraw(texture2D20, projCenter - Main.screenPosition, new Rectangle?(drawRectangle), baseColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); + raySegment += drawRectangle.Height * Projectile.scale; + projCenter += Projectile.velocity * drawRectangle.Height * Projectile.scale; + drawRectangle.Y += texture2D20.Height; + if (drawRectangle.Y + drawRectangle.Height > texture2D20.Height) { - rectangle7.Y = 0; + drawRectangle.Y = 0; } } } - Vector2 vector2 = value20 - Main.screenPosition; + Vector2 vector2 = projCenter - Main.screenPosition; sourceRectangle2 = null; - Main.EntitySpriteDraw(texture2D21, vector2, sourceRectangle2, color44, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D21, vector2, sourceRectangle2, baseColor, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -222,8 +220,7 @@ namespace CalamityMod.Projectiles.Boss { 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; } diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index 6e3af11f4e..a50b424938 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -80,8 +80,7 @@ namespace CalamityMod.Projectiles.Boss } } - float num805 = 3f; //3f - float num806 = Projectile.width; + float projWidth = Projectile.width; Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) @@ -89,23 +88,23 @@ namespace CalamityMod.Projectiles.Boss samplingPoint = vector78.Value; } - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, 2400f, array3); - float num807 = 0f; - for (int num808 = 0; num808 < array3.Length; num808++) + float[] array3 = new float[3]; + Collision.LaserScan(samplingPoint, Projectile.velocity, projWidth * Projectile.scale, 2400f, array3); + float rayLength = 0f; + for (int i = 0; i < array3.Length; i++) { - num807 += array3[num808]; + rayLength += array3[i]; } - num807 /= num805; + rayLength /= 3f; // Fire laser through walls at max length if target cannot be seen if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) { - num807 = 2400f; + rayLength = 2400f; } float amount = 0.5f; //0.5f - Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); //length of laser, linear interpolation + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], rayLength, amount); //length of laser, linear interpolation DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, DelegateMethods.CastLight); @@ -120,37 +119,37 @@ namespace CalamityMod.Projectiles.Boss Texture2D texture2D19 = ModContent.Request(Texture).Value; Texture2D texture2D20 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayMid", AssetRequestMode.ImmediateLoad).Value; Texture2D texture2D21 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayEnd", AssetRequestMode.ImmediateLoad).Value; - float num223 = Projectile.localAI[1]; //length of laser - Color color44 = new Color(255, 255, 255, 0) * 0.9f; + float rayDrawLength = Projectile.localAI[1]; //length of laser + Color baseColor = new Color(255, 255, 255, 0) * 0.9f; Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - Main.EntitySpriteDraw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - num223 -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; - Vector2 value20 = Projectile.Center; - value20 += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; - if (num223 > 0f) + Main.EntitySpriteDraw(texture2D19, vector, sourceRectangle2, baseColor, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + rayDrawLength -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; + Vector2 projCenter = Projectile.Center; + projCenter += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; + if (rayDrawLength > 0f) { - float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 16 * (Projectile.timeLeft / 3 % 5), texture2D20.Width, 16); - while (num224 + 1f < num223) + float raySegment = 0f; + Rectangle drawRectangle = new Rectangle(0, 16 * (Projectile.timeLeft / 3 % 5), texture2D20.Width, 16); + while (raySegment + 1f < rayDrawLength) { - if (num223 - num224 < rectangle7.Height) + if (rayDrawLength - raySegment < drawRectangle.Height) { - rectangle7.Height = (int)(num223 - num224); + drawRectangle.Height = (int)(rayDrawLength - raySegment); } - Main.EntitySpriteDraw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); - num224 += rectangle7.Height * Projectile.scale; - value20 += Projectile.velocity * rectangle7.Height * Projectile.scale; - rectangle7.Y += 16; - if (rectangle7.Y + rectangle7.Height > texture2D20.Height) + Main.EntitySpriteDraw(texture2D20, projCenter - Main.screenPosition, new Rectangle?(drawRectangle), baseColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); + raySegment += drawRectangle.Height * Projectile.scale; + projCenter += Projectile.velocity * drawRectangle.Height * Projectile.scale; + drawRectangle.Y += 16; + if (drawRectangle.Y + drawRectangle.Height > texture2D20.Height) { - rectangle7.Y = 0; + drawRectangle.Y = 0; } } } - Vector2 vector2 = value20 - Main.screenPosition; + Vector2 vector2 = projCenter - Main.screenPosition; sourceRectangle2 = null; - Main.EntitySpriteDraw(texture2D21, vector2, sourceRectangle2, color44, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture2D21, vector2, sourceRectangle2, baseColor, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -167,8 +166,7 @@ namespace CalamityMod.Projectiles.Boss { 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; } diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index 54940b2f6a..d9cd6952b1 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -74,8 +74,8 @@ namespace CalamityMod.Projectiles.Boss { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Texture2D texture = ModContent.Request(Texture).Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); if (CalamityGlobalNPC.SCal != -1) @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss } } - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, spriteEffects, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, spriteEffects, 0); return false; } diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 0f730cec06..237932a27f 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -103,25 +103,25 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - 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.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int cosmiliteDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); + Main.dust[cosmiliteDust].velocity *= 3f; + Main.dust[cosmiliteDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int j = 0; j < 5; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 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.PurpleCosmilite, 0f, 0f, 100, default, 1f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 2f; } } } diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index a9b07a2097..67acbf3fb0 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -101,25 +101,25 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - 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.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int cosmiliteDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); + Main.dust[cosmiliteDust].velocity *= 3f; + Main.dust[cosmiliteDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int j = 0; j < 5; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 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.PurpleCosmilite, 0f, 0f, 100, default, 1f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 2f; } } } diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index f1f7af7d71..fab0dbc5ea 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -101,21 +101,21 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = Projectile.height = 96; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; 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 + Main.rand.Next(10) * 0.1f; + Main.dust[purpleDust].scale = 0.5f; + Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 1.5f; + int astralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); + Main.dust[astralDust].noGravity = true; + Main.dust[astralDust].velocity *= 1.5f; Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); } diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index c56b150337..7b87515033 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -44,17 +44,17 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; - int num103 = Player.FindClosest(Projectile.Center, 1, 1); + int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; if (Projectile.ai[1] < 120f && Projectile.ai[1] > 30f) { - float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 20f + vector11) / 21f; + float projSpeed = Projectile.velocity.Length(); + Vector2 playerDistance = Main.player[playerTracker].Center - Projectile.Center; + playerDistance.Normalize(); + playerDistance *= projSpeed; + Projectile.velocity = (Projectile.velocity * 20f + playerDistance) / 21f; Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor2; + Projectile.velocity *= projSpeed; } if (Projectile.timeLeft == 950) diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index 970a41e123..f505c744d5 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -58,25 +58,25 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); - 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, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int ectoDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.2f); + Main.dust[ectoDust].velocity *= 3f; + Main.dust[ectoDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[ectoDust].scale = 0.5f; + Main.dust[ectoDust].fadeIn = 1f + 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, (int)CalamityDusts.Ectoplasm, 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.Ectoplasm, 0f, 0f, 100, default, 1f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 2f; + int ectoDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.7f); + Main.dust[ectoDust2].noGravity = true; + Main.dust[ectoDust2].velocity *= 5f; + ectoDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1f); + Main.dust[ectoDust2].noGravity = true; + Main.dust[ectoDust2].velocity *= 2f; } Projectile.ai[1] = Projectile.ai[0]; diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 008ae249fa..3437032d2d 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -83,48 +83,48 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = Projectile.height = 64; Projectile.position.X = Projectile.position.X - Projectile.width / 2; Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int godSlay = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[godSlay].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[godSlay].scale = 0.5f; + Main.dust[godSlay].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int godSlay2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + Main.dust[godSlay2].noGravity = true; + Main.dust[godSlay2].velocity *= 5f; + godSlay2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[godSlay2].velocity *= 2f; } - for (int num640 = 0; num640 < 200; num640++) + for (int k = 0; k < 200; k++) { - float num641 = 12f; - if (num640 < 150) - num641 = 9f; - if (num640 < 100) - num641 = 6f; - if (num640 < 50) - num641 = 3f; + float dustScale = 12f; + if (k < 150) + dustScale = 9f; + if (k < 100) + dustScale = 6f; + if (k < 50) + dustScale = 3f; - int num643 = Dust.NewDust(Projectile.Center, 6, 6, 173, 0f, 0f, 100, default, 1f); - float num644 = Main.dust[num643].velocity.X; - float num645 = Main.dust[num643].velocity.Y; + int scalingDust = Dust.NewDust(Projectile.Center, 6, 6, 173, 0f, 0f, 100, default, 1f); + float scalingDustVelX = Main.dust[scalingDust].velocity.X; + float scalingDustVelY = Main.dust[scalingDust].velocity.Y; - if (num644 == 0f && num645 == 0f) - num644 = 1f; + if (scalingDustVelX == 0f && scalingDustVelY == 0f) + scalingDustVelX = 1f; - float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); - num646 = num641 / num646; - num644 *= num646; - num645 *= num646; + float scalingDustVelocity = (float)Math.Sqrt(scalingDustVelX * scalingDustVelX + scalingDustVelY * scalingDustVelY); + scalingDustVelocity = dustScale / scalingDustVelocity; + scalingDustVelX *= scalingDustVelocity; + scalingDustVelY *= scalingDustVelocity; float scale = 1f; - switch ((int)num641) + switch ((int)dustScale) { case 4: scale = 1.2f; @@ -142,10 +142,10 @@ namespace CalamityMod.Projectiles.Boss break; } - Dust dust = Main.dust[num643]; + Dust dust = Main.dust[scalingDust]; dust.velocity *= 0.5f; - dust.velocity.X += num644; - dust.velocity.Y += num645; + dust.velocity.X += scalingDustVelX; + dust.velocity.Y += scalingDustVelY; dust.scale = scale; dust.noGravity = true; } diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index fcfac47f19..adac751278 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Lighting.AddLight(Projectile.Center, 0.45f, 0f, 0.55f); - for (int num468 = 0; num468 < 5; num468++) + for (int i = 0; i < 5; i++) { - int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int essenceDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); + Main.dust[essenceDust].noGravity = true; + Main.dust[essenceDust].velocity *= 0f; } } @@ -40,23 +40,23 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = Projectile.height = size; 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 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + int godSlay = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[godSlay].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[godSlay].scale = 0.5f; + Main.dust[godSlay].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int j = 0; j < 15; j++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[godSlay2].noGravity = true; + Main.dust[godSlay2].velocity *= 5f; + godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[godSlay2].velocity *= 2f; } Projectile.Damage(); } diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index 4113ded6da..ae7e75876f 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -55,13 +55,13 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame = 0; } - 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 wavingAmplitude = 0.209439516f; + float projVelocityMult = 4f; + float projFloatDirection = (float)(Math.Cos((double)(wavingAmplitude * Projectile.ai[0])) - 0.5) * projVelocityMult; + Projectile.velocity.Y = Projectile.velocity.Y - projFloatDirection; Projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; - Projectile.velocity.Y = Projectile.velocity.Y + num632; + projFloatDirection = (float)(Math.Cos((double)(wavingAmplitude * Projectile.ai[0])) - 0.5) * projVelocityMult; + Projectile.velocity.Y = Projectile.velocity.Y + projFloatDirection; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 10f) @@ -95,54 +95,53 @@ namespace CalamityMod.Projectiles.Boss { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; SoundEngine.PlaySound(FlareSound, Projectile.Center); - 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 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustRotate = dustRotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 dustDirection = dustRotate - Projectile.Center; + int flareDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 244, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[flareDust].noGravity = true; + Main.dust[flareDust].noLight = true; + Main.dust[flareDust].velocity = dustDirection; } 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 projTileX = (int)(Projectile.Center.Y / 16f); + int projTileY = (int)(Projectile.Center.X / 16f); + if (projTileY < 10) { - num232 = 10; + projTileY = 10; } - if (num232 > Main.maxTilesX - 10) + if (projTileY > Main.maxTilesX - 10) { - num232 = Main.maxTilesX - 10; + projTileY = Main.maxTilesX - 10; } - if (num231 < 10) + if (projTileX < 10) { - num231 = 10; + projTileX = 10; } - if (num231 > Main.maxTilesY - num233 - 10) + if (projTileX > Main.maxTilesY - 110) { - num231 = Main.maxTilesY - num233 - 10; + projTileX = Main.maxTilesY - 110; } - for (int num234 = num231; num234 < num231 + num233; num234++) + for (int j = projTileX; j < projTileX + 100; j++) { - Tile tile = Main.tile[num232, num234]; + Tile tile = Main.tile[projTileY, j]; if (tile.HasTile && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0)) { - num231 = num234; + projTileX = j; break; } } int spawnLimitY = (int)(Main.player[Projectile.owner].Center.Y / 16f) + 25; - if (num231 > spawnLimitY) + if (projTileX > spawnLimitY) { - num231 = spawnLimitY; + projTileX = spawnLimitY; } - int num236 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), 0, 4f, Main.myPlayer, 11f, 10f + (revenge ? 1f : 0f)); - Main.projectile[num236].netUpdate = true; + int flarenadoSpawn = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), 0, 4f, Main.myPlayer, 11f, 10f + (revenge ? 1f : 0f)); + Main.projectile[flarenadoSpawn].netUpdate = true; } } } diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 06308c5beb..78ea47fe01 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -57,15 +57,14 @@ namespace CalamityMod.Projectiles.Boss return; float inertia = revenge ? 70f : 77f; - float num954 = 40f; - float scaleFactor12 = revenge ? 35f : 28f; - int num959 = (int)Projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + float velocityMult = revenge ? 35f : 28f; + int playerTracker = (int)Projectile.ai[0]; + if (playerTracker >= 0 && Main.player[playerTracker].active && !Main.player[playerTracker].dead) { - if (Projectile.Distance(Main.player[num959].Center) > num954) + if (Projectile.Distance(Main.player[playerTracker].Center) > 40f) { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[num959].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * scaleFactor12) / inertia; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[playerTracker].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * velocityMult) / inertia; } } else @@ -80,24 +79,24 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.timeLeft < 60) return; - float num1247 = 0.5f; - for (int num1248 = 0; num1248 < Main.maxProjectiles; num1248++) + float acceleration = 0.5f; + for (int j = 0; j < Main.maxProjectiles; j++) { - if (Main.projectile[num1248].active) + if (Main.projectile[j].active) { - if (num1248 != Projectile.whoAmI && Main.projectile[num1248].type == Projectile.type) + if (j != Projectile.whoAmI && Main.projectile[j].type == Projectile.type) { - if (Vector2.Distance(Projectile.Center, Main.projectile[num1248].Center) < 24f) + if (Vector2.Distance(Projectile.Center, Main.projectile[j].Center) < 24f) { - if (Projectile.position.X < Main.projectile[num1248].position.X) - Projectile.velocity.X -= num1247; + if (Projectile.position.X < Main.projectile[j].position.X) + Projectile.velocity.X -= acceleration; else - Projectile.velocity.X += num1247; + Projectile.velocity.X += acceleration; - if (Projectile.position.Y < Main.projectile[num1248].position.Y) - Projectile.velocity.Y -= num1247; + if (Projectile.position.Y < Main.projectile[j].position.Y) + Projectile.velocity.Y -= acceleration; else - Projectile.velocity.Y += num1247; + Projectile.velocity.Y += acceleration; } } } @@ -109,9 +108,9 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture.Width, num214), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture.Width, framing), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index ce1545d979..8016bf2334 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -79,17 +79,17 @@ namespace CalamityMod.Projectiles.Boss start = false; } - float amount = Projectile.localAI[0] / 120f; - if (amount > 1f) - amount = 1f; - distance += MathHelper.Lerp(1f, 9f, amount); + float earlyTimeProjSpeed = Projectile.localAI[0] / 120f; + if (earlyTimeProjSpeed > 1f) + earlyTimeProjSpeed = 1f; + distance += MathHelper.Lerp(1f, 9f, earlyTimeProjSpeed); if (Projectile.timeLeft < 380) { - float amount2 = (Projectile.localAI[0] - 300f) / 240f; - if (amount2 > 1f) - amount2 = 1f; - distance += MathHelper.Lerp(1f, 9f, amount2); + float longTimeProjSpeed = (Projectile.localAI[0] - 300f) / 240f; + if (longTimeProjSpeed > 1f) + longTimeProjSpeed = 1f; + distance += MathHelper.Lerp(1f, 9f, longTimeProjSpeed); } double rad = MathHelper.ToRadians(Projectile.ai[1]); @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = startingPosY - (int)(Math.Sin(rad) * distance) - Projectile.height / 2; } - Projectile.ai[1] += (1.1f - amount) * 0.5f; + Projectile.ai[1] += (1.1f - earlyTimeProjSpeed) * 0.5f; Projectile.localAI[0] += 1f; } @@ -113,9 +113,9 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index 94d948448a..85c84343bb 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -53,9 +53,9 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 7285cde7b5..66c0b66ff5 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -105,8 +105,8 @@ namespace CalamityMod.Projectiles.Boss 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 finalProjHeight = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; + center.Y -= baseHeight * finalProjHeight / 2f; center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } @@ -116,14 +116,14 @@ namespace CalamityMod.Projectiles.Boss bool breakapart = Main.zenithWorld && Projectile.localAI[1] >= breakThreshold; if (Projectile.ai[0] <= 0f && !breakapart) { - 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; } if (Projectile.localAI[1] == breakThreshold && Main.zenithWorld) { @@ -147,9 +147,9 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 5f7b867522..f1836f7a07 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -55,14 +55,14 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int mistDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 2f); + Main.dust[mistDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[mistDust].scale = 0.5f; + Main.dust[mistDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } Projectile.ai[1] = 1f; @@ -74,15 +74,15 @@ namespace CalamityMod.Projectiles.Boss 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, 187, 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 extraMistDust = Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f); + Main.dust[extraMistDust].scale = 1.1f; + Main.dust[extraMistDust].noGravity = true; + Main.dust[extraMistDust].position = Projectile.Center + dustRotation; + Main.dust[extraMistDust].velocity = Projectile.velocity * 0.1f; + Main.dust[extraMistDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[extraMistDust].position) * 1.25f; } } @@ -91,17 +91,17 @@ namespace CalamityMod.Projectiles.Boss else Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 270) / 30f), 0f, 1f); - int num103 = Player.FindClosest(Projectile.Center, 1, 1); + int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; if (Projectile.ai[1] < 140f && Projectile.ai[1] > 60f) { - float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + float projVelocityMult = Projectile.velocity.Length(); + Vector2 playerDistance = Main.player[playerTracker].Center - Projectile.Center; + playerDistance.Normalize(); + playerDistance *= projVelocityMult; + Projectile.velocity = (Projectile.velocity * 24f + playerDistance) / 25f; Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor2; + Projectile.velocity *= projVelocityMult; } if (Projectile.velocity.Length() < 12f) Projectile.velocity *= 1.02f; diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index 261318205c..7ffd48a1df 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -54,9 +54,9 @@ namespace CalamityMod.Projectiles.Boss { Projectile.alpha = 0; } - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int sandyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + Main.dust[sandyDust].noGravity = true; + Main.dust[sandyDust].velocity *= 0f; } } @@ -67,16 +67,16 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = Projectile.height = (int)(32 * Projectile.scale); 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 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 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)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 dustDirection = dustRotate - Projectile.Center; + int killSand = Dust.NewDust(dustRotate + dustDirection, 0, 0, 85, dustDirection.X * 1.5f, dustDirection.Y * 1.5f, 100, default, 1.2f); + Main.dust[killSand].noGravity = true; + Main.dust[killSand].noLight = true; + Main.dust[killSand].velocity = dustDirection; } Projectile.Damage(); } diff --git a/Projectiles/Boss/HealOrbProv.cs b/Projectiles/Boss/HealOrbProv.cs index 0cd8e9139b..511fcafcca 100644 --- a/Projectiles/Boss/HealOrbProv.cs +++ b/Projectiles/Boss/HealOrbProv.cs @@ -25,48 +25,47 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - int num487 = (int)Projectile.ai[0]; - float num488 = 2.5f; - Vector2 vector36 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && Projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && Projectile.position.X + (float)Projectile.width > Main.player[num487].position.X && Projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && Projectile.position.Y + (float)Projectile.height > Main.player[num487].position.Y) + int playerTracker = (int)Projectile.ai[0]; + Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float playerDistX = Main.player[playerTracker].Center.X - projDirection.X; + float playerDistY = Main.player[playerTracker].Center.Y - projDirection.Y; + float playerDistance = (float)Math.Sqrt((double)(playerDistX * playerDistX + playerDistY * playerDistY)); + if (playerDistance < 50f && Projectile.position.X < Main.player[playerTracker].position.X + (float)Main.player[playerTracker].width && Projectile.position.X + (float)Projectile.width > Main.player[playerTracker].position.X && Projectile.position.Y < Main.player[playerTracker].position.Y + (float)Main.player[playerTracker].height && Projectile.position.Y + (float)Projectile.height > Main.player[playerTracker].position.Y) { if (Projectile.owner == Main.myPlayer) { - int num492 = (int)Projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + int healAmount = (int)Projectile.ai[1]; + Main.player[playerTracker].HealEffect(healAmount, false); + Main.player[playerTracker].statLife += healAmount; + if (Main.player[playerTracker].statLife > Main.player[playerTracker].statLifeMax2) { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; + Main.player[playerTracker].statLife = Main.player[playerTracker].statLifeMax2; } // TODO -- but why - if (Main.player[num487].statLife < 0) + if (Main.player[playerTracker].statLife < 0) { - Main.player[num487].KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProvidenceAntiHealing").Format(Main.player[num487].name)), 1000.0, 0, false); + Main.player[playerTracker].KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProvidenceAntiHealing").Format(Main.player[playerTracker].name)), 1000.0, 0, false); } - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, playerTracker, (float)healAmount, 0f, 0f, 0, 0, 0); } Projectile.Kill(); } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - Projectile.velocity.X = (Projectile.velocity.X * 15f + num489) / 16f; - Projectile.velocity.Y = (Projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) + playerDistance = 2.5f / playerDistance; + playerDistX *= playerDistance; + playerDistY *= playerDistance; + Projectile.velocity.X = (Projectile.velocity.X * 15f + playerDistX) / 16f; + Projectile.velocity.Y = (Projectile.velocity.Y * 15f + playerDistY) / 16f; + for (int i = 0; i < 1; i++) { - float num498 = Projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(Projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X -= num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y -= num499; + float shortXVel = Projectile.velocity.X * 0.2f * (float)i; + float shortYVel = -(Projectile.velocity.Y * 0.2f) * (float)i; + int holyFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); + Main.dust[holyFire].noGravity = true; + Main.dust[holyFire].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[holyFire]; + expr_154F9_cp_0.position.X -= shortXVel; + Dust expr_15518_cp_0 = Main.dust[holyFire]; + expr_15518_cp_0.position.Y -= shortYVel; } return; } diff --git a/Projectiles/Boss/HellfireExplosion.cs b/Projectiles/Boss/HellfireExplosion.cs index a3e6051ff3..54bc90aae8 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -43,61 +43,61 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } - bool flag15 = false; - bool flag16 = false; + bool xflag = false; + bool yflag = false; if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { - flag15 = true; + xflag = true; } if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { - flag16 = true; + yflag = true; } if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { - flag16 = true; + yflag = true; } - if (flag15 && flag16) + if (xflag && yflag) { Projectile.Kill(); } - 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(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); - 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]; + 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(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + Main.dust[brimDust].noGravity = true; + Main.dust[brimDust].position.X = Projectile.Center.X; + Main.dust[brimDust].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[brimDust]; 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[brimDust]; 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[brimDust].velocity.X = rando1; + Main.dust[brimDust].velocity.Y = rando2; + timerCounter++; } } diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index f65ea162fe..3341fdd1e1 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -50,33 +50,33 @@ namespace CalamityMod.Projectiles.Boss } if (Math.Abs(Projectile.velocity.X) >= 3f || Math.Abs(Projectile.velocity.Y) >= 3f) { - float num247 = 0f; - float num248 = 0f; + float randDustXVel = 0f; + float randDustYVel = 0f; if (Main.rand.Next(2) == 1) { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; + randDustXVel = Projectile.velocity.X * 0.5f; + randDustYVel = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int bombDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + randDustXVel, Projectile.position.Y + 3f + randDustYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); + Main.dust[bombDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[bombDust].velocity *= 0.2f; + Main.dust[bombDust].noGravity = true; + bombDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + randDustXVel, Projectile.position.Y + 3f + randDustYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); + Main.dust[bombDust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[bombDust].velocity *= 0.05f; } else if (Main.rand.NextBool(4)) { - int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[smoke].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[smoke].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[smoke].noGravity = true; + Main.dust[smoke].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[smoke].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[smoke].noGravity = true; + Main.dust[smoke].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } @@ -100,23 +100,23 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int num621 = 0; num621 < 8; num621++) + for (int i = 0; i < 8; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int plagued = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[plagued].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[plagued].scale = 0.5f; + Main.dust[plagued].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int plagued2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[plagued2].noGravity = true; + Main.dust[plagued2].velocity *= 5f; + plagued2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[plagued2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 2c460a9a7e..4e3bf9a0d1 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -73,15 +73,15 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[0] == 0f) { int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - 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, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].velocity *= 3f; + Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[holyDust].scale = 0.5f; + Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } Projectile.localAI[0] = 1f; @@ -105,10 +105,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -134,19 +134,19 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(ImpactSound, Projectile.Center); int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int num193 = 0; num193 < 4; num193++) + for (int j = 0; j < 4; j++) { int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); Main.dust[dust].noGravity = true; } - for (int num194 = 0; num194 < 40; num194++) + for (int k = 0; k < 40; k++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 4f); - 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, dustType, 0f, 0f, 50, default, 2f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int profaned = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 4f); + Main.dust[profaned].noGravity = true; + Main.dust[profaned].velocity *= 3f; + profaned = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); + Main.dust[profaned].velocity *= 2f; + Main.dust[profaned].noGravity = true; } } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 652d7ab616..8a64014ea6 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -57,19 +57,19 @@ namespace CalamityMod.Projectiles.Boss float velocityY = -2f; int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); Main.dust[dust].noGravity = true; } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); - Main.dust[num195].velocity *= 1.5f; - Main.dust[num195].noGravity = true; + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 0, default, 2.5f); + Main.dust[holyDust].noGravity = true; + Main.dust[holyDust].velocity *= 2f; + holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); + Main.dust[holyDust].velocity *= 1.5f; + Main.dust[holyDust].noGravity = true; } if (Projectile.owner == Main.myPlayer) @@ -102,10 +102,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -119,19 +119,19 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); Main.dust[dust].noGravity = true; } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 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, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + Main.dust[holyDust].noGravity = true; + Main.dust[holyDust].velocity *= 3f; + holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + Main.dust[holyDust].velocity *= 2f; + Main.dust[holyDust].noGravity = true; } } diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 4a50fc14d0..76946f295f 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -73,10 +73,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -122,22 +122,22 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num622].noGravity = true; + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[holyDust].scale = 0.5f; + Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; + int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[holyDust2].noGravity = true; + holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust2].noGravity = true; } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index b3ad4de002..9fc41594ac 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss if (Math.Abs(Projectile.velocity.X) < 7f) Projectile.velocity.X *= 1.05f; - int num103 = Player.FindClosest(Projectile.Center, 1, 1); + int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); if (Projectile.ai[1] == 0f) Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); @@ -65,14 +65,14 @@ namespace CalamityMod.Projectiles.Boss Projectile.ai[1] += 1f; if (Projectile.ai[1] < 180f && Projectile.ai[1] > 60f) { - float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; + float projVelocityMult = Projectile.velocity.Length(); + Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; + playerDirection.Normalize(); + playerDirection *= projVelocityMult; float inertia = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 20f : 25f; - Projectile.velocity = (Projectile.velocity * (inertia - 1f) + vector11) / inertia; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia; Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor2; + Projectile.velocity *= projVelocityMult; } Projectile.rotation = Projectile.velocity.X * 0.025f; @@ -86,10 +86,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -103,22 +103,22 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num622].noGravity = true; + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[holyDust].scale = 0.5f; + Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; + int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[holyDust2].noGravity = true; + holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust2].noGravity = true; } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 9d7bd01c78..3ebb87ca7a 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -90,10 +90,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = Projectile.maxPenetrate == (int)Providence.BossMode.Day ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; - int num214 = texture.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; + int framing = texture.Height / Main.projFrames[Projectile.type]; + int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -107,22 +107,22 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num622].noGravity = true; + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[holyDust].scale = 0.5f; + Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; + int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[holyDust2].noGravity = true; + holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust2].noGravity = true; } } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 0c3b631d90..b0a662ad56 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -62,34 +62,32 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D value = ModContent.Request(Texture).Value; - Color color33 = new Color(54, 209, 54, 0); - Vector2 vector28 = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color color34 = color33; - Vector2 origin5 = value.Size() / 2f; - Color color35 = color33 * 0.5f; - float num162 = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; - Vector2 vector29 = new Vector2(0.5f, 1f) * num162; - Vector2 vector30 = new Vector2(0.5f, 1f) * num162; - color34 *= num162; - color35 *= num162; + Texture2D drawTexture = ModContent.Request(Texture).Value; + Color brightGreen = new Color(54, 209, 54, 0); + Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Vector2 halfTextureSize = drawTexture.Size() / 2f; + Color halfBrightGreen = brightGreen * 0.5f; + float timeLeftColorScale = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; + Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale; + Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; + brightGreen *= timeLeftColorScale; + halfBrightGreen *= timeLeftColorScale; - int num163 = 0; - Vector2 position3 = vector28 + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * num163; + Vector2 position3 = projDirection + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(value, position3, null, color34, (float)Math.PI / 2f, origin5, vector29, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color34, 0f, origin5, vector30, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color35, (float)Math.PI / 2f, origin5, vector29 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color35, 0f, origin5, vector30 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, (float)Math.PI / 2f, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, (float)Math.PI / 2f, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color34, MathHelper.PiOver4, origin5, vector29 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color34, MathHelper.PiOver4 * 3f, origin5, vector30 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color35, MathHelper.PiOver4, origin5, vector29 * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(value, position3, null, color35, MathHelper.PiOver4 * 3f, origin5, vector30 * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 * 3f, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 * 3f, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0); return false; } @@ -103,25 +101,25 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 40; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; 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; - Main.dust[num622].noGravity = true; + int holyYellow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[holyYellow].velocity *= 3f; + Main.dust[holyYellow].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[holyYellow].scale = 0.5f; + Main.dust[holyYellow].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 8; num623++) + for (int j = 0; j < 8; 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; - Main.dust[num624].noGravity = true; + int holyYellow2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); + Main.dust[holyYellow2].noGravity = true; + Main.dust[holyYellow2].velocity *= 5f; + holyYellow2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[holyYellow2].velocity *= 2f; + Main.dust[holyYellow2].noGravity = true; } } } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index d263512604..4ea6fb76cd 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D value = ModContent.Request(Texture).Value; + Texture2D drawTexture = ModContent.Request(Texture).Value; bool aimedSpear = Projectile.ai[0] > 0f; int red = 255; @@ -180,17 +180,16 @@ namespace CalamityMod.Projectiles.Boss } Color baseColor = new Color(red, green, blue, 255); - Color color33 = baseColor * 0.5f; - color33.A = 0; - Vector2 vector28 = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color color34 = color33; - Vector2 origin5 = value.Size() / 2f; - Color color35 = color33 * 0.5f; - float num162 = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; - Vector2 vector29 = new Vector2(1f, 1.5f) * num162; - Vector2 vector30 = new Vector2(0.5f, 1f) * num162; - color34 *= num162; - color35 *= num162; + Color halfBaseColor = baseColor * 0.5f; + halfBaseColor.A = 0; + Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Vector2 halfTextureSize = drawTexture.Size() / 2f; + Color halfOfHalfBaseColor = halfBaseColor * 0.5f; + float timeLeftColorScale = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; + Vector2 timeLeftDrawEffect = new Vector2(1f, 1.5f) * timeLeftColorScale; + Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; + halfBaseColor *= timeLeftColorScale; + halfOfHalfBaseColor *= timeLeftColorScale; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) @@ -200,21 +199,21 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = Projectile.oldPos[i] + vector28; - Color color = Projectile.GetAlpha(color34) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); - Main.spriteBatch.Draw(value, drawPos, null, color, Projectile.rotation, origin5, vector29, SpriteEffects.None, 0); - Main.spriteBatch.Draw(value, drawPos, null, color, Projectile.rotation, origin5, vector30, SpriteEffects.None, 0); + Vector2 drawPos = Projectile.oldPos[i] + projDirection; + Color baseColorAlpha = Projectile.GetAlpha(halfBaseColor) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); + Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, SpriteEffects.None, 0); + Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, SpriteEffects.None, 0); - color = Projectile.GetAlpha(color35) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); - Main.spriteBatch.Draw(value, drawPos, null, color, Projectile.rotation, origin5, vector29 * 0.6f, SpriteEffects.None, 0); - Main.spriteBatch.Draw(value, drawPos, null, color, Projectile.rotation, origin5, vector30 * 0.6f, SpriteEffects.None, 0); + baseColorAlpha = Projectile.GetAlpha(halfOfHalfBaseColor) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); + Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, SpriteEffects.None, 0); } } - Main.EntitySpriteDraw(value, vector28, null, color34, Projectile.rotation, origin5, vector29, spriteEffects, 0); - Main.EntitySpriteDraw(value, vector28, null, color34, Projectile.rotation, origin5, vector30, spriteEffects, 0); - Main.EntitySpriteDraw(value, vector28, null, color35, Projectile.rotation, origin5, vector29 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, vector28, null, color35, Projectile.rotation, origin5, vector30 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, projDirection, null, halfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, projDirection, null, halfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); return false; } diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index 49b8b443e7..5698e9a9dc 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -66,22 +66,21 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - int num497 = 5; SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); - for (int num498 = 0; num498 < num497; num498++) + for (int i = 0; i < 5; i++) { - int num499 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, 0f, 0f, 0, default, 1f); + int iceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, 0f, 0f, 0, default, 1f); if (!Main.rand.NextBool(3)) { - Dust dust = Main.dust[num499]; + Dust dust = Main.dust[iceDust]; dust.velocity *= 2f; - Main.dust[num499].noGravity = true; - dust = Main.dust[num499]; + Main.dust[iceDust].noGravity = true; + dust = Main.dust[iceDust]; dust.scale *= 1.75f; } else { - Dust dust = Main.dust[num499]; + Dust dust = Main.dust[iceDust]; dust.scale *= 0.5f; } } diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index 981f2fbffa..83ce65be43 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -35,23 +35,23 @@ namespace CalamityMod.Projectiles.Boss Projectile.ai[0] += 1f; if (Projectile.ai[0] == 120f) { - for (int num621 = 0; num621 < 8; num621++) + for (int i = 0; i < 8; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int iceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[iceDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[iceDust].scale = 0.5f; + Main.dust[iceDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 14; num623++) + for (int j = 0; j < 14; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 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, 67, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int iceDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 3f); + Main.dust[iceDust2].noGravity = true; + Main.dust[iceDust2].velocity *= 5f; + iceDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[iceDust2].velocity *= 2f; } Projectile.scale = 1.2f; diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index eb2511bfde..b15d8e203d 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -46,11 +46,11 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - for (int num322 = 0; num322 < 2; num322++) + for (int i = 0; i < 2; i++) { - int num323 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); - Main.dust[num323].noGravity = true; - Dust dust = Main.dust[num323]; + int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + Main.dust[icyDust].noGravity = true; + Dust dust = Main.dust[icyDust]; dust.velocity *= 0.3f; } } @@ -61,11 +61,11 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - for (int num322 = 0; num322 < 2; num322++) + for (int i = 0; i < 2; i++) { - int num323 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); - Main.dust[num323].noGravity = true; - Dust dust = Main.dust[num323]; + int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + Main.dust[icyDust].noGravity = true; + Dust dust = Main.dust[icyDust]; dust.velocity *= 0.3f; } } @@ -91,12 +91,12 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item27 with { Volume = SoundID.Item27.Volume * 0.25f }, Projectile.Center); - for (int num373 = 0; num373 < 3; num373++) + for (int j = 0; j < 3; j++) { - int num374 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 76, 0f, 0f, 0, default, 1f); - Main.dust[num374].noGravity = true; - Main.dust[num374].noLight = true; - Main.dust[num374].scale = 0.7f; + int snowDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 76, 0f, 0f, 0, default, 1f); + Main.dust[snowDust].noGravity = true; + Main.dust[snowDust].noLight = true; + Main.dust[snowDust].scale = 0.7f; } } diff --git a/Projectiles/Boss/IchorBlob.cs b/Projectiles/Boss/IchorBlob.cs index 8f54945832..db0613fc66 100644 --- a/Projectiles/Boss/IchorBlob.cs +++ b/Projectiles/Boss/IchorBlob.cs @@ -98,37 +98,34 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.NPCDeath21, Projectile.Center); // Emit dust - float num50 = 1.6f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length(); - for (int num53 = 0; num53 < 10; num53++) + Vector2 dustRotation = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + Vector2 dustVelocity = dustRotation * Projectile.velocity.Length(); + for (int i = 0; i < 10; i++) { - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 200, default, num50); - Dust dust = Main.dust[num54]; + int ichorDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 200, default, 1.6f); + Dust dust = Main.dust[ichorDust]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.noGravity = true; dust.velocity.Y -= 2f; dust.velocity *= 3f; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 100, default, num51); + dust.velocity += dustVelocity * Main.rand.NextFloat(); + ichorDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 100, default, 0.8f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.velocity.Y -= 2f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; - dust.velocity += value4 * Main.rand.NextFloat(); + dust.velocity += dustVelocity * Main.rand.NextFloat(); } - for (int num55 = 0; num55 < 5; num55++) + for (int j = 0; j < 5; j++) { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 0, default, num52); - Dust dust = Main.dust[num56]; + int ichorDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 0, default, 2f); + Dust dust = Main.dust[ichorDust2]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; dust.noGravity = true; dust.velocity.Y -= 2f; dust.velocity *= 0.5f; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); } } diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index 2dcf960210..7706b12242 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int ichorDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 100, default, 0.5f); + Main.dust[ichorDust].noGravity = true; + Main.dust[ichorDust].velocity *= 0f; if (Projectile.velocity.Y < 12f) Projectile.velocity.Y += 0.06f; diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 213b749959..5f3353a58a 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -107,8 +107,8 @@ namespace CalamityMod.Projectiles.Boss 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 finalProjHeight = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; + center.Y -= baseHeight * finalProjHeight / 2f; center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } @@ -118,14 +118,14 @@ namespace CalamityMod.Projectiles.Boss bool breakapart = Main.zenithWorld && Projectile.localAI[1] >= breakThreshold; if (Projectile.ai[0] <= 0f && !breakapart) { - 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; } if (Projectile.localAI[1] == breakThreshold && Main.zenithWorld) { @@ -149,9 +149,9 @@ namespace CalamityMod.Projectiles.Boss 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/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index 12d35a5f38..f398fe5668 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -105,8 +105,8 @@ namespace CalamityMod.Projectiles.Boss 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 finalProjHeight = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; + center.Y -= baseHeight * finalProjHeight / 2f; center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } @@ -115,14 +115,14 @@ namespace CalamityMod.Projectiles.Boss bool breakapart = Main.zenithWorld && Projectile.ai[0] <= breakThreshold; if (Projectile.ai[0] <= 0f && !breakapart) { - 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; } if (Projectile.ai[0] == breakThreshold && Main.zenithWorld) { @@ -143,9 +143,9 @@ namespace CalamityMod.Projectiles.Boss 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/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index 7522da820a..fedea1cbde 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -71,23 +71,23 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - 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, 2f); - Main.dust[num622].velocity *= 3f; + int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[meteorDust].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[meteorDust].scale = 0.5f; + Main.dust[meteorDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int j = 0; j < 15; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 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, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int meteorDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[meteorDust2].noGravity = true; + Main.dust[meteorDust2].velocity *= 5f; + meteorDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[meteorDust2].velocity *= 2f; } } } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 6ccc2dc9a0..a9fb3d86a6 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -75,13 +75,13 @@ namespace CalamityMod.Projectiles.Boss { for (int d = 0; d < 10; d++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].velocity *= 3f; + Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[holyDust].scale = 0.5f; + Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } Projectile.localAI[1] = 1f; @@ -94,15 +94,15 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy(l * 3.14159274f / 6f, default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(Projectile.rotation - 1.57079637f, default); - int num9 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 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 * -Projectile.width / 2f; + dustRotate += -Vector2.UnitY.RotatedBy(l * 3.14159274f / 6f, default) * new Vector2(8f, 16f); + dustRotate = dustRotate.RotatedBy(Projectile.rotation - 1.57079637f, default); + int profaned = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + Main.dust[profaned].scale = 1.1f; + Main.dust[profaned].noGravity = true; + Main.dust[profaned].position = Projectile.Center + dustRotate; + Main.dust[profaned].velocity = Projectile.velocity * 0.1f; + Main.dust[profaned].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[profaned].position) * 1.25f; } } @@ -117,10 +117,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").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; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -141,19 +141,19 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int num193 = 0; num193 < 4; num193++) + for (int i = 0; i < 4; i++) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); Main.dust[dust].noGravity = true; } - for (int num194 = 0; num194 < 40; num194++) + for (int j = 0; j < 40; j++) { - int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int killHolyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + Main.dust[killHolyDust].noGravity = true; + Main.dust[killHolyDust].velocity *= 3f; + killHolyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + Main.dust[killHolyDust].velocity *= 2f; + Main.dust[killHolyDust].noGravity = true; } } diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index a64b62465a..c551858525 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -86,10 +86,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").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; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -103,22 +103,22 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - 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, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num622].noGravity = true; + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[holyDust].scale = 0.5f; + Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int j = 0; j < 5; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; + int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[holyDust2].noGravity = true; + holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust2].noGravity = true; } } diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 9669d83276..286c536e13 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -111,21 +111,21 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 20; 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 < 4; num621++) + for (int i = 0; i < 4; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 1.5f; + int shroomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[shroomDust].velocity *= 1.5f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[shroomDust].scale = 0.5f; + Main.dust[shroomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 12; num623++) + for (int j = 0; j < 12; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 2f; + int shroomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); + Main.dust[shroomDust2].noGravity = true; + Main.dust[shroomDust2].velocity *= 2f; Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); } } diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index b39dbdf9a5..2e82c649fd 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -119,21 +119,21 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 20; 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 < 4; num621++) + for (int i = 0; i < 4; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 1.5f; + int shroomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[shroomDust].velocity *= 1.5f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[shroomDust].scale = 0.5f; + Main.dust[shroomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 12; num623++) + for (int j = 0; j < 12; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 2f; + int shroomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); + Main.dust[shroomDust2].noGravity = true; + Main.dust[shroomDust2].velocity *= 2f; Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); } diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index afd5bd1c2e..f9e876528b 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -61,13 +61,13 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.NPCDeath12, Projectile.Center); - int num226 = 8; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 8; + for (int i = 0; i < dustAmt; i++) { - Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 dustVel = source - Projectile.Center; - int blood = Dust.NewDust(source + dustVel, 0, 0, DustID.Blood, dustVel.X, dustVel.Y, 100, default, 1.2f); + Vector2 dustRotation = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustRotation = dustRotation.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = dustRotation - Projectile.Center; + int blood = Dust.NewDust(dustRotation + dustVel, 0, 0, DustID.Blood, dustVel.X, dustVel.Y, 100, default, 1.2f); Main.dust[blood].noGravity = true; Main.dust[blood].noLight = true; Main.dust[blood].velocity = dustVel; diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index e0acb2a64f..a5b7b30f91 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -64,15 +64,15 @@ namespace CalamityMod.Projectiles.Boss 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, 180, 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 phantomDust = Dust.NewDust(Projectile.Center, 0, 0, 180, 0f, 0f, 160, default, 1f); + Main.dust[phantomDust].scale = 1.1f; + Main.dust[phantomDust].noGravity = true; + Main.dust[phantomDust].position = Projectile.Center + dustRotation; + Main.dust[phantomDust].velocity = Projectile.velocity * 0.1f; + Main.dust[phantomDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[phantomDust].position) * 1.25f; } } } @@ -91,24 +91,24 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 50; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (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, 180, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int killGhostDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f); + Main.dust[killGhostDust].velocity *= 3f; + Main.dust[killGhostDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[killGhostDust].scale = 0.5f; + Main.dust[killGhostDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int j = 0; j < 5; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 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, 180, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f); + Main.dust[killGhostDust2].noGravity = true; + Main.dust[killGhostDust2].velocity *= 5f; + killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + Main.dust[killGhostDust2].velocity *= 2f; } } diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index 0eddcd73c2..6a2e5fd306 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -64,15 +64,15 @@ namespace CalamityMod.Projectiles.Boss 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 phantomDust = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + Main.dust[phantomDust].scale = 1.1f; + Main.dust[phantomDust].noGravity = true; + Main.dust[phantomDust].position = Projectile.Center + dustRotation; + Main.dust[phantomDust].velocity = Projectile.velocity * 0.1f; + Main.dust[phantomDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[phantomDust].position) * 1.25f; } } } @@ -91,24 +91,24 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 50; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (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, 60, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int killGhostDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.2f); + Main.dust[killGhostDust].velocity *= 3f; + Main.dust[killGhostDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[killGhostDust].scale = 0.5f; + Main.dust[killGhostDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int j = 0; j < 5; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 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, 60, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.7f); + Main.dust[killGhostDust2].noGravity = true; + Main.dust[killGhostDust2].velocity *= 5f; + killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); + Main.dust[killGhostDust2].velocity *= 2f; } } diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index 8d2f8c4bc3..c3e95d0d0e 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] += 1f; if (Projectile.localAI[0] == 6f) { - for (int num151 = 0; num151 < 40; num151++) + for (int i = 0; i < 40; i++) { - int num152 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); - Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += Projectile.velocity * 0.75f; - Main.dust[num152].scale *= 1.2f; - Main.dust[num152].noGravity = true; + int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); + Main.dust[redDust].velocity *= 3f; + Main.dust[redDust].velocity += Projectile.velocity * 0.75f; + Main.dust[redDust].scale *= 1.2f; + Main.dust[redDust].noGravity = true; } } diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index 3adaa6fc40..ba8332c594 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] += 1f; if (Projectile.localAI[0] == 6f) { - for (int num151 = 0; num151 < 40; num151++) + for (int i = 0; i < 40; i++) { - int num152 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); - Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += Projectile.velocity * 0.75f; - Main.dust[num152].scale *= 1.2f; - Main.dust[num152].noGravity = true; + int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + Main.dust[redDust].velocity *= 3f; + Main.dust[redDust].velocity += Projectile.velocity * 0.75f; + Main.dust[redDust].scale *= 1.2f; + Main.dust[redDust].noGravity = true; } } diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index efab133679..97897bc811 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -79,23 +79,23 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 150; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (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, 180, 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int phantomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f); + Main.dust[phantomDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[phantomDust].scale = 0.5f; + Main.dust[phantomDust].fadeIn = 1f + 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, 180, 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, 60, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int phantomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f); + Main.dust[phantomDust2].noGravity = true; + Main.dust[phantomDust2].velocity *= 5f; + phantomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); + Main.dust[phantomDust2].velocity *= 2f; } } diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index 5c78a68f1c..c38d4c962c 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -55,12 +55,11 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[0] == 0f) Projectile.ai[0] = Projectile.velocity.Length() * 3f; - int num189 = Player.FindClosest(Projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - Projectile.Center; - vector20.Normalize(); - vector20 *= Projectile.ai[0]; - int num190 = 80; - Projectile.velocity = (Projectile.velocity * (num190 - 1) + vector20) / num190; + int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; + playerDirection.Normalize(); + playerDirection *= Projectile.ai[0]; + Projectile.velocity = (Projectile.velocity * 79 + playerDirection) / 80; } } diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index 058baa4ff0..9263308bc6 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -55,12 +55,11 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[0] == 0f) Projectile.ai[0] = Projectile.velocity.Length() * 2f; - int num189 = Player.FindClosest(Projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - Projectile.Center; - vector20.Normalize(); - vector20 *= Projectile.ai[0]; - int num190 = 80; - Projectile.velocity = (Projectile.velocity * (num190 - 1) + vector20) / num190; + int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; + playerDirection.Normalize(); + playerDirection *= Projectile.ai[0]; + Projectile.velocity = (Projectile.velocity * 79 + playerDirection) / 80; } } diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index a1d0652c79..88853e72ba 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -23,39 +23,39 @@ namespace CalamityMod.Projectiles.Boss { Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0f); - 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 (num462 < num461) + int timerCounter = 0; + while (timerCounter < projTimer) { - float num463 = Main.rand.Next(-7, 8) * Projectile.scale; - float num464 = Main.rand.Next(-7, 8) * Projectile.scale; - float num465 = Main.rand.Next(2, 6) * Projectile.scale; - float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = Projectile.Center.X; - Main.dust[num467].position.Y = Projectile.Center.Y; - Main.dust[num467].position.X += Main.rand.Next(-10, 11); - Main.dust[num467].position.Y += Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - Main.dust[num467].scale = Projectile.scale * 0.35f; - num462++; + float rando1 = Main.rand.Next(-7, 8) * Projectile.scale; + float rando2 = Main.rand.Next(-7, 8) * Projectile.scale; + float rando3 = Main.rand.Next(2, 6) * Projectile.scale; + float randoAdjuster = (float)Math.Sqrt(rando1 * rando1 + rando2 * rando2); + randoAdjuster = rando3 / randoAdjuster; + rando1 *= randoAdjuster; + rando2 *= randoAdjuster; + int greenPlague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default); + Main.dust[greenPlague].noGravity = true; + Main.dust[greenPlague].position.X = Projectile.Center.X; + Main.dust[greenPlague].position.Y = Projectile.Center.Y; + Main.dust[greenPlague].position.X += Main.rand.Next(-10, 11); + Main.dust[greenPlague].position.Y += Main.rand.Next(-10, 11); + Main.dust[greenPlague].velocity.X = rando1; + Main.dust[greenPlague].velocity.Y = rando2; + Main.dust[greenPlague].scale = Projectile.scale * 0.35f; + timerCounter++; } } diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index 880f332496..172b16a111 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -27,17 +27,17 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - int num123 = Player.FindClosest(Projectile.Center, 1, 1); + int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); Projectile.localAI[0] += 1f; if (Projectile.localAI[0] < (60f + Projectile.ai[0] * 0.5f) && Projectile.localAI[0] > 30f) { - float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector17 = Main.player[num123].Center - Projectile.Center; - vector17.Normalize(); - vector17 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 24f + vector17) / 25f; + float projVelocity = Projectile.velocity.Length(); + Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; + playerDirection.Normalize(); + playerDirection *= projVelocity; + Projectile.velocity = (Projectile.velocity * 24f + playerDirection) / 25f; Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor2; + Projectile.velocity *= projVelocity; } if (Projectile.velocity.Length() < (16f + Projectile.ai[0] * 0.04f)) @@ -55,13 +55,13 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { Vector2 center = new Vector2(Projectile.Center.X, Projectile.Center.Y); - Vector2 vector11 = new Vector2(ModContent.Request(Texture).Value.Width / 2, ModContent.Request(Texture).Value.Height / 2); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Width, ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Height) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + Projectile.gfxOffY); - Color color = Color.White; - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value, vector, - null, color, Projectile.rotation, vector11, Projectile.scale, SpriteEffects.None, 0); + Vector2 textureArea = new Vector2(ModContent.Request(Texture).Value.Width / 2, ModContent.Request(Texture).Value.Height / 2); + Vector2 drawArea = center - Main.screenPosition; + drawArea -= new Vector2(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Width, ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Height) * 1f / 2f; + drawArea += textureArea * 1f + new Vector2(0f, 4f + Projectile.gfxOffY); + Color whiteColor = Color.White; + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value, drawArea, + null, whiteColor, Projectile.rotation, textureArea, Projectile.scale, SpriteEffects.None, 0); } } } diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 9d30598545..25c7473ed1 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -74,12 +74,12 @@ namespace CalamityMod.Projectiles.Boss Color BaseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); float Brightness = 0.8f; Color DustColor = Color.Lerp(BaseColor, Color.White, Brightness); - Dust dust34 = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, DustColor, 1f)]; - dust34.velocity.X = 0f; - dust34.noGravity = true; - dust34.fadeIn = 1f; - dust34.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * (4f * Main.rand.NextFloat() + 26f); - dust34.scale = 0.5f; + Dust crystalDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, DustColor, 1f)]; + crystalDust.velocity.X = 0f; + crystalDust.noGravity = true; + crystalDust.fadeIn = 1f; + crystalDust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * (4f * Main.rand.NextFloat() + 26f); + crystalDust.scale = 0.5f; } float lifeRatio = Projectile.ai[0]; @@ -126,18 +126,18 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Color color25 = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); - Vector2 vector59 = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Color colorArea = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); + Vector2 drawArea = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D34 = ModContent.Request(Texture).Value; - Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin11 = rectangle17.Size() / 2f; - float scaleFactor5 = (float)Math.Cos(MathHelper.TwoPi * (Projectile.localAI[0] / 60f)) + 3f + 3f; - for (float num286 = 0f; num286 < 4f; num286 += 1f) + Rectangle textureRect = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color colorAlpha = Projectile.GetAlpha(colorArea); + Vector2 halfRect = textureRect.Size() / 2f; + float scaleFactor = (float)Math.Cos(MathHelper.TwoPi * (Projectile.localAI[0] / 60f)) + 3f + 3f; + for (float i = 0f; i < 4f; i += 1f) { - double angle = num286 * MathHelper.PiOver2; + double angle = i * MathHelper.PiOver2; Vector2 center = default; - Main.spriteBatch.Draw(texture2D34, vector59 + Vector2.UnitY.RotatedBy(angle, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, Projectile.rotation, origin11, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D34, drawArea + Vector2.UnitY.RotatedBy(angle, center) * scaleFactor, new Microsoft.Xna.Framework.Rectangle?(textureRect), colorAlpha * 0.2f, Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 93a7be7cc8..94da33c373 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -96,71 +96,71 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; - for (int num979 = 0; num979 < 2; num979++) + for (int i = 0; i < 2; i++) { if (Main.rand.NextBool(10)) { - Vector2 value55 = Vector2.UnitY.RotatedBy(num979 * MathHelper.Pi).RotatedBy(Projectile.rotation); - Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust24.noGravity = true; - dust24.noLight = true; - dust24.scale = Projectile.Opacity * Projectile.localAI[0]; - dust24.position = Projectile.Center; - dust24.velocity = value55; + Vector2 dustRotation = Vector2.UnitY.RotatedBy(i * MathHelper.Pi).RotatedBy(Projectile.rotation); + Dust crystalDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + crystalDust.noGravity = true; + crystalDust.noLight = true; + crystalDust.scale = Projectile.Opacity * Projectile.localAI[0]; + crystalDust.position = Projectile.Center; + crystalDust.velocity = dustRotation; } } - for (int num980 = 0; num980 < 2; num980++) + for (int j = 0; j < 2; j++) { if (Main.rand.NextBool(10)) { - Vector2 value56 = Vector2.UnitY.RotatedBy(num980 * MathHelper.Pi); - Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust25.noGravity = true; - dust25.noLight = true; - dust25.scale = Projectile.Opacity * Projectile.localAI[0]; - dust25.position = Projectile.Center; - dust25.velocity = value56; + Vector2 dustRotate = Vector2.UnitY.RotatedBy(j * MathHelper.Pi); + Dust crystalDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + crystalDust2.noGravity = true; + crystalDust2.noLight = true; + crystalDust2.scale = Projectile.Opacity * Projectile.localAI[0]; + crystalDust2.position = Projectile.Center; + crystalDust2.velocity = dustRotate; } } if (Main.rand.NextBool(10)) { - float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; + float dustVelScale = 1f + Main.rand.NextFloat() * 2f; float fadeIn = 1f + Main.rand.NextFloat(); - float num981 = 1f + Main.rand.NextFloat(); - Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector136 != Vector2.Zero) + float dustScale = 1f + Main.rand.NextFloat(); + Vector2 randomDustOffset = Utils.RandomVector2(Main.rand, -1f, 1f); + if (randomDustOffset != Vector2.Zero) { - vector136.Normalize(); + randomDustOffset.Normalize(); } - vector136 *= 16f + Main.rand.NextFloat() * 16f; - Vector2 vector137 = Projectile.Center + vector136; - Point point3 = vector137.ToTileCoordinates(); - bool flag52 = true; - if (!WorldGen.InWorld(point3.X, point3.Y, 0)) + randomDustOffset *= 16f + Main.rand.NextFloat() * 16f; + Vector2 dustPos = Projectile.Center + randomDustOffset; + Point dustTileCoords = dustPos.ToTileCoordinates(); + bool shouldSpawn = true; + if (!WorldGen.InWorld(dustTileCoords.X, dustTileCoords.Y, 0)) { - flag52 = false; + shouldSpawn = false; } - if (flag52 && WorldGen.SolidTile(point3.X, point3.Y)) + if (shouldSpawn && WorldGen.SolidTile(dustTileCoords.X, dustTileCoords.Y)) { - flag52 = false; + shouldSpawn = false; } - if (flag52) + if (shouldSpawn) { - Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; - dust26.noGravity = true; - dust26.position = vector137; - dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); - dust26.fadeIn = fadeIn; - dust26.scale = num981; - dust26.noLight = true; - Dust dust27 = Dust.CloneDust(dust26); - Dust dust = dust27; + Dust holyDust = Main.dust[Dust.NewDust(dustPos, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + holyDust.noGravity = true; + holyDust.position = dustPos; + holyDust.velocity = -Vector2.UnitY * dustVelScale * (Main.rand.NextFloat() * 0.9f + 1.6f); + holyDust.fadeIn = fadeIn; + holyDust.scale = dustScale; + holyDust.noLight = true; + Dust holyDust2 = Dust.CloneDust(holyDust); + Dust dust = holyDust2; dust.scale *= 0.65f; - dust = dust27; + dust = holyDust2; dust.fadeIn *= 0.65f; - dust27.color = new Color(255, 255, 255, 255); + holyDust2.color = new Color(255, 255, 255, 255); } } } @@ -169,41 +169,41 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); - float num69 = Main.rand.Next(7, 13); - Vector2 value5 = new Vector2(1.6f, 1.5f); + float dustAmt = Main.rand.Next(7, 13); + Vector2 randomDustVelMod = new Vector2(1.6f, 1.5f); Color newColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); newColor.A = 255; - for (float num70 = 0f; num70 < num69; num70++) + for (float i = 0f; i < dustAmt; i++) { - int num71 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = Projectile.Center; - Main.dust[num71].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * num70 / num69) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Main.dust[num71].noGravity = true; - Main.dust[num71].scale = 2f; - Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust11 = Dust.CloneDust(num71); - Dust dust = dust11; + int killDust = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[killDust].position = Projectile.Center; + Main.dust[killDust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / dustAmt) * randomDustVelMod * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[killDust].noGravity = true; + Main.dust[killDust].scale = 2f; + Main.dust[killDust].fadeIn = Main.rand.NextFloat() * 2f; + Dust killDustClone = Dust.CloneDust(killDust); + Dust dust = killDustClone; dust.scale /= 2f; - dust = dust11; + dust = killDustClone; dust.fadeIn /= 2f; - dust11.color = new Color(255, 255, 255, 255); + killDustClone.color = new Color(255, 255, 255, 255); } - for (float num73 = 0f; num73 < num69; num73++) + for (float j = 0f; j < dustAmt; j++) { - int num74 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = Projectile.Center; - Main.dust[num74].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * num73 / num69) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Dust dust = Main.dust[num74]; + int killDust2 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[killDust2].position = Projectile.Center; + Main.dust[killDust2].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * j / dustAmt) * randomDustVelMod * (0.8f + Main.rand.NextFloat() * 0.4f); + Dust dust = Main.dust[killDust2]; dust.velocity *= Main.rand.NextFloat() * 0.8f; dust.noGravity = true; dust.scale = Main.rand.NextFloat() * 1f; dust.fadeIn = Main.rand.NextFloat() * 2f; - Dust dust12 = Dust.CloneDust(num74); - dust = dust12; + Dust killDustClone2 = Dust.CloneDust(killDust2); + dust = killDustClone2; dust.scale /= 2f; - dust = dust12; + dust = killDustClone2; dust.fadeIn /= 2f; - dust12.color = new Color(255, 255, 255, 255); + killDustClone2.color = new Color(255, 255, 255, 255); } } diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 5cf320e796..8f7042980f 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) Projectile.velocity = -Vector2.UnitY; - float num801 = Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType() ? 0.66f : 1f; + float projScale = Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType() ? 0.66f : 1f; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= (scissorLasers ? 100f : 180f)) { @@ -84,56 +84,54 @@ namespace CalamityMod.Projectiles.Boss return; } - Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * num801; - if (Projectile.scale > num801) - Projectile.scale = num801; + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * projScale; + if (Projectile.scale > projScale) + Projectile.scale = projScale; - float num804 = Projectile.velocity.ToRotation(); - num804 += Projectile.ai[0]; - Projectile.rotation = num804 - MathHelper.PiOver2; - Projectile.velocity = num804.ToRotationVector2(); + float projVelRotation = Projectile.velocity.ToRotation(); + projVelRotation += Projectile.ai[0]; + Projectile.rotation = projVelRotation - MathHelper.PiOver2; + Projectile.velocity = projVelRotation.ToRotationVector2(); - float num805 = 3f; - float num806 = Projectile.width; + float projWidth = Projectile.width; Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) samplingPoint = vector78.Value; - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, 2400f, array3); - float num807 = 0f; - for (int num808 = 0; num808 < array3.Length; num808++) + float[] array3 = new float[3]; + Collision.LaserScan(samplingPoint, Projectile.velocity, projWidth * Projectile.scale, 2400f, array3); + float rayLength = 0f; + for (int i = 0; i < array3.Length; i++) { - num807 += array3[num808]; + rayLength += array3[i]; } - num807 /= num805; + rayLength /= 3f; // Fire laser through walls at max length if target cannot be seen if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) - num807 = 2400f; + rayLength = 2400f; int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - float amount = 0.5f; - Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); // Length of laser, linear interpolation - Vector2 vector79 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); - for (int num809 = 0; num809 < 2; num809++) + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], rayLength, 0.5f); // Length of laser, linear interpolation + Vector2 dustRotation = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); + for (int j = 0; j < 2; j++) { - float num810 = Projectile.velocity.ToRotation() + (Main.rand.NextBool() ? -1f : 1f) * MathHelper.PiOver2; - float num811 = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811); - int num812 = Dust.NewDust(vector79, 0, 0, dustType, vector80.X, vector80.Y, 0, default, 1f); - Main.dust[num812].noGravity = true; - Main.dust[num812].scale = 1.7f; + float randDustDirection = Projectile.velocity.ToRotation() + (Main.rand.NextBool() ? -1f : 1f) * MathHelper.PiOver2; + float randDustVel = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 finalDustVel = new Vector2((float)Math.Cos(randDustDirection) * randDustVel, (float)Math.Sin(randDustDirection) * randDustVel); + int holyDust = Dust.NewDust(dustRotation, 0, 0, dustType, finalDustVel.X, finalDustVel.Y, 0, default, 1f); + Main.dust[holyDust].noGravity = true; + Main.dust[holyDust].scale = 1.7f; } if (Main.rand.NextBool(5)) { - Vector2 value29 = Projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; - int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num813]; + Vector2 extraDustRotate = Projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; + int extraHolyDust = Dust.NewDust(dustRotation + extraDustRotate - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[extraHolyDust]; dust.velocity *= 0.5f; - Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); + Main.dust[extraHolyDust].velocity.Y = -Math.Abs(Main.dust[extraHolyDust].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); @@ -153,38 +151,38 @@ namespace CalamityMod.Projectiles.Boss Texture2D texture2D21 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd", AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; - float num223 = Projectile.localAI[1]; //length of laser - Color color44 = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0) * 0.9f; + float rayDrawLength = Projectile.localAI[1]; //length of laser + Color baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0) * 0.9f; Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - num223 -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; - Vector2 value20 = Projectile.Center; - value20 += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; + Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, baseColor, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + rayDrawLength -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; + Vector2 projCenter = Projectile.Center; + projCenter += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; - if (num223 > 0f) + if (rayDrawLength > 0f) { - float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 36 * (Projectile.timeLeft / 3 % 4), texture2D20.Width, 36); - while (num224 + 1f < num223) + float raySegment = 0f; + Rectangle drawRectangle = new Rectangle(0, 36 * (Projectile.timeLeft / 3 % 4), texture2D20.Width, 36); + while (raySegment + 1f < rayDrawLength) { - if (num223 - num224 < rectangle7.Height) - rectangle7.Height = (int)(num223 - num224); + if (rayDrawLength - raySegment < drawRectangle.Height) + drawRectangle.Height = (int)(rayDrawLength - raySegment); - Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); - num224 += rectangle7.Height * Projectile.scale; - value20 += Projectile.velocity * rectangle7.Height * Projectile.scale; - rectangle7.Y += 36; + Main.spriteBatch.Draw(texture2D20, projCenter - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), baseColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); + raySegment += drawRectangle.Height * Projectile.scale; + projCenter += Projectile.velocity * drawRectangle.Height * Projectile.scale; + drawRectangle.Y += 36; - if (rectangle7.Y + rectangle7.Height > texture2D20.Height) - rectangle7.Y = 0; + if (drawRectangle.Y + drawRectangle.Height > texture2D20.Height) + drawRectangle.Y = 0; } } - Vector2 vector2 = value20 - Main.screenPosition; + Vector2 vector2 = projCenter - Main.screenPosition; sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, baseColor, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -201,8 +199,7 @@ namespace CalamityMod.Projectiles.Boss 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/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index 9629040da1..3902567863 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -29,11 +29,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - for (int num468 = 0; num468 < 2; num468++) + for (int i = 0; i < 2; i++) { - int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 3f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int icyFlame = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 3f); + Main.dust[icyFlame].noGravity = true; + Main.dust[icyFlame].velocity *= 0f; } if (Projectile.ai[1] == 0f) { diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs index 842c5d54d7..7f0a8ad5b8 100644 --- a/Projectiles/Boss/RedLightning.cs +++ b/Projectiles/Boss/RedLightning.cs @@ -49,40 +49,40 @@ namespace CalamityMod.Projectiles.Boss { if (Projectile.frameCounter == 0 || Projectile.oldPos[0] == Vector2.Zero) { - for (int num31 = Projectile.oldPos.Length - 1; num31 > 0; num31--) + for (int i = Projectile.oldPos.Length - 1; i > 0; i--) { - Projectile.oldPos[num31] = Projectile.oldPos[num31 - 1]; + Projectile.oldPos[i] = Projectile.oldPos[i - 1]; } Projectile.oldPos[0] = Projectile.position; if (Projectile.velocity == Vector2.Zero) { - float num32 = Projectile.rotation + MathHelper.PiOver2 + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; - float num33 = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 vector2 = new Vector2((float)Math.Cos((double)num32) * num33, (float)Math.Sin((double)num32) * num33); - int num34 = Dust.NewDust(Projectile.oldPos[Projectile.oldPos.Length - 1], 0, 0, 60, vector2.X, vector2.Y, 0, default, 1f); - Main.dust[num34].noGravity = true; - Main.dust[num34].scale = 1.7f; + float dustRotation = Projectile.rotation + MathHelper.PiOver2 + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float randDustRotateMod = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 dustVelocity = new Vector2((float)Math.Cos((double)dustRotation) * randDustRotateMod, (float)Math.Sin((double)dustRotation) * randDustRotateMod); + int redDust = Dust.NewDust(Projectile.oldPos[Projectile.oldPos.Length - 1], 0, 0, 60, dustVelocity.X, dustVelocity.Y, 0, default, 1f); + Main.dust[redDust].noGravity = true; + Main.dust[redDust].scale = 1.7f; } } - int num3 = Projectile.frameCounter; - Projectile.frameCounter = num3 + 1; + int inc = Projectile.frameCounter; + Projectile.frameCounter = inc + 1; Lighting.AddLight(Projectile.Center, 0.8f, 0.25f, 0.15f); if (Projectile.velocity == Vector2.Zero) { if (Projectile.frameCounter >= Projectile.extraUpdates * 2) { Projectile.frameCounter = 0; - bool flag36 = true; - for (int num855 = 1; num855 < Projectile.oldPos.Length; num855 = num3 + 1) + bool lightningExpired = true; + for (int j = 1; j < Projectile.oldPos.Length; j = inc + 1) { - if (Projectile.oldPos[num855] != Projectile.oldPos[0]) + if (Projectile.oldPos[j] != Projectile.oldPos[0]) { - flag36 = false; + lightningExpired = false; } - num3 = num855; + inc = j; } - if (flag36) + if (lightningExpired) { Projectile.Kill(); return; @@ -90,66 +90,66 @@ namespace CalamityMod.Projectiles.Boss } if (Main.rand.Next(Projectile.extraUpdates) == 0) { - for (int num856 = 0; num856 < 2; num856 = num3 + 1) + for (int k = 0; k < 2; k = inc + 1) { - float num857 = Projectile.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; - float num858 = (float)Main.rand.NextDouble() * 0.8f + 1f; - Vector2 vector96 = new Vector2((float)Math.Cos((double)num857) * num858, (float)Math.Sin((double)num857) * num858); - int num859 = Dust.NewDust(Projectile.Center, 0, 0, 60, vector96.X, vector96.Y, 0, default, 1f); - Main.dust[num859].noGravity = true; - Main.dust[num859].scale = 1.2f; - num3 = num856; + float extraDustRotate = Projectile.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float extraRandRotate = (float)Main.rand.NextDouble() * 0.8f + 1f; + Vector2 dustVelocity = new Vector2((float)Math.Cos((double)extraDustRotate) * extraRandRotate, (float)Math.Sin((double)extraDustRotate) * extraRandRotate); + int extraRedDust = Dust.NewDust(Projectile.Center, 0, 0, 60, dustVelocity.X, dustVelocity.Y, 0, default, 1f); + Main.dust[extraRedDust].noGravity = true; + Main.dust[extraRedDust].scale = 1.2f; + inc = k; } if (Main.rand.NextBool(5)) { - Vector2 value39 = Projectile.velocity.RotatedBy((double)MathHelper.PiOver2, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)Projectile.width; - int num860 = Dust.NewDust(Projectile.Center + value39 - Vector2.One * 4f, 8, 8, 60, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num860]; + Vector2 moreDustRotation = Projectile.velocity.RotatedBy((double)MathHelper.PiOver2, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)Projectile.width; + int moreExtraRedDust = Dust.NewDust(Projectile.Center + moreDustRotation - Vector2.One * 4f, 8, 8, 60, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[moreExtraRedDust]; dust.velocity *= 0.5f; - Main.dust[num860].velocity.Y = -Math.Abs(Main.dust[num860].velocity.Y); + Main.dust[moreExtraRedDust].velocity.Y = -Math.Abs(Main.dust[moreExtraRedDust].velocity.Y); } } } else if (Projectile.frameCounter >= Projectile.extraUpdates * 2) { Projectile.frameCounter = 0; - float num861 = Projectile.velocity.Length(); + float projSpeed = Projectile.velocity.Length(); UnifiedRandom unifiedRandom = new UnifiedRandom((int)Projectile.ai[1]); - int num862 = 0; - Vector2 vector97 = -Vector2.UnitY; - Vector2 vector98; + int frameIncrement = 0; + Vector2 randomLightningMovement = -Vector2.UnitY; + Vector2 lightningYRotation; do { - int num863 = unifiedRandom.Next(); - Projectile.ai[1] = (float)num863; - num863 %= 100; - float f = (float)num863 / 100f * MathHelper.TwoPi; - vector98 = f.ToRotationVector2(); - if (vector98.Y > 0f) + int randomIncrement = unifiedRandom.Next(); + Projectile.ai[1] = (float)randomIncrement; + randomIncrement %= 100; + float f = (float)randomIncrement / 100f * MathHelper.TwoPi; + lightningYRotation = f.ToRotationVector2(); + if (lightningYRotation.Y > 0f) { - vector98.Y *= -1f; + lightningYRotation.Y *= -1f; } - bool flag37 = false; - if (vector98.Y > -0.02f) + bool stopLightning = false; + if (lightningYRotation.Y > -0.02f) { - flag37 = true; + stopLightning = true; } - if (vector98.X * (float)(Projectile.extraUpdates + 1) * 2f * num861 + Projectile.localAI[0] > 40f) + if (lightningYRotation.X * (float)(Projectile.extraUpdates + 1) * 2f * projSpeed + Projectile.localAI[0] > 40f) { - flag37 = true; + stopLightning = true; } - if (vector98.X * (float)(Projectile.extraUpdates + 1) * 2f * num861 + Projectile.localAI[0] < -40f) + if (lightningYRotation.X * (float)(Projectile.extraUpdates + 1) * 2f * projSpeed + Projectile.localAI[0] < -40f) { - flag37 = true; + stopLightning = true; } - if (!flag37) + if (!stopLightning) { goto IL_25086; } - num3 = num862; - num862 = num3 + 1; + inc = frameIncrement; + frameIncrement = inc + 1; } - while (num3 < 100); + while (inc < 100); Projectile.velocity = Vector2.Zero; Projectile.localAI[1] = 1f; @@ -157,13 +157,13 @@ namespace CalamityMod.Projectiles.Boss goto IL_25092; IL_25086: - vector97 = vector98; + randomLightningMovement = lightningYRotation; IL_25092: if (Projectile.velocity != Vector2.Zero) { - Projectile.localAI[0] += vector97.X * (float)(Projectile.extraUpdates + 1) * 2f * num861; - Projectile.velocity = vector97.RotatedBy((double)(Projectile.ai[0] + MathHelper.PiOver2), default(Vector2)) * num861; + Projectile.localAI[0] += randomLightningMovement.X * (float)(Projectile.extraUpdates + 1) * 2f * projSpeed; + Projectile.velocity = randomLightningMovement.RotatedBy((double)(Projectile.ai[0] + MathHelper.PiOver2), default(Vector2)) * projSpeed; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } } @@ -182,39 +182,39 @@ namespace CalamityMod.Projectiles.Boss Vector2 end = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D tex3 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/RedLightningTexture").Value; Projectile.GetAlpha(lightColor); - Vector2 scale16 = new Vector2(Projectile.scale) / 2f; - for (int num289 = 0; num289 < 3; num289++) + Vector2 lightningScale = new Vector2(Projectile.scale) / 2f; + for (int i = 0; i < 3; i++) { - if (num289 == 0) + if (i == 0) { - scale16 = new Vector2(Projectile.scale) * 0.6f; + lightningScale = new Vector2(Projectile.scale) * 0.6f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(219, 104, 58, 0) * 0.5f; } - else if (num289 == 1) + else if (i == 1) { - scale16 = new Vector2(Projectile.scale) * 0.4f; + lightningScale = new Vector2(Projectile.scale) * 0.4f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 126, 56, 0) * 0.5f; } else { - scale16 = new Vector2(Projectile.scale) * 0.2f; + lightningScale = new Vector2(Projectile.scale) * 0.2f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 128, 128, 0) * 0.5f; } DelegateMethods.f_1 = 1f; - for (int num290 = Projectile.oldPos.Length - 1; num290 > 0; num290--) + for (int j = Projectile.oldPos.Length - 1; j > 0; j--) { - if (!(Projectile.oldPos[num290] == Vector2.Zero)) + if (!(Projectile.oldPos[j] == Vector2.Zero)) { - Vector2 start = Projectile.oldPos[num290] + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Vector2 end2 = Projectile.oldPos[num290 - 1] + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Utils.DrawLaser(Main.spriteBatch, tex3, start, end2, scale16, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Vector2 start = Projectile.oldPos[j] + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Vector2 end2 = Projectile.oldPos[j - 1] + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Utils.DrawLaser(Main.spriteBatch, tex3, start, end2, lightningScale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } if (Projectile.oldPos[0] != Vector2.Zero) { DelegateMethods.f_1 = 1f; Vector2 start2 = Projectile.oldPos[0] + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Utils.DrawLaser(Main.spriteBatch, tex3, start2, end, scale16, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Utils.DrawLaser(Main.spriteBatch, tex3, start2, end, lightningScale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } return false; diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index 6eb5b4c6d5..c3a4960d09 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -67,15 +67,15 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Length() < 10f) Projectile.velocity *= 1.015f; - int num103 = Player.FindClosest(Projectile.Center, 1, 1); - float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; + int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); + float projVelocity = Projectile.velocity.Length(); + Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; + playerDirection.Normalize(); + playerDirection *= projVelocity; - Projectile.velocity = (Projectile.velocity * 19f + vector11) / 20f; + Projectile.velocity = (Projectile.velocity * 19f + playerDirection) / 20f; Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor2; + Projectile.velocity *= projVelocity; } else { @@ -106,18 +106,18 @@ namespace CalamityMod.Projectiles.Boss private void EmitDust() { SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); - for (int num193 = 0; num193 < 6; num193++) + for (int j = 0; j < 6; j++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); } - for (int num194 = 0; num194 < 10; num194++) + for (int k = 0; k < 10; k++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 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, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); + Main.dust[redDust].noGravity = true; + Main.dust[redDust].velocity *= 3f; + redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[redDust].velocity *= 2f; + Main.dust[redDust].noGravity = true; } } diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index 0010d9bd83..1cc9041def 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -46,23 +46,23 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int dust = 0; dust <= 3; dust++) { - float num463 = Main.rand.Next(-10, 11); - float num464 = Main.rand.Next(-10, 11); - float num465 = Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.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]; + float rando1 = Main.rand.Next(-10, 11); + float rando2 = Main.rand.Next(-10, 11); + float rando3 = Main.rand.Next(3, 9); + float randoAdjuster = (float)Math.Sqrt(rando1 * rando1 + rando2 * rando2); + randoAdjuster = rando3 / randoAdjuster; + rando1 *= randoAdjuster; + rando2 *= randoAdjuster; + int sandyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.2f); + Main.dust[sandyDust].noGravity = true; + Main.dust[sandyDust].position.X = Projectile.Center.X; + Main.dust[sandyDust].position.Y = Projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[sandyDust]; expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; + Dust expr_14A09_cp_0 = Main.dust[sandyDust]; expr_14A09_cp_0.position.Y += Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; + Main.dust[sandyDust].velocity.X = rando1; + Main.dust[sandyDust].velocity.Y = rando2; } } diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs index 0fa14963f7..f2ae2e532c 100644 --- a/Projectiles/Boss/SandTooth.cs +++ b/Projectiles/Boss/SandTooth.cs @@ -20,18 +20,18 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - int num103 = Player.FindClosest(Projectile.Center, 1, 1); + int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; if (Projectile.ai[1] < 150f && Projectile.ai[1] > 30f) { float inertia = 30f; - float scaleFactor2 = Projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * (inertia - 1f) + vector11) / inertia; + float projVelocity = Projectile.velocity.Length(); + Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; + playerDirection.Normalize(); + playerDirection *= projVelocity; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia; Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor2; + Projectile.velocity *= projVelocity; } else if (Projectile.ai[0] == 1f) { diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index 9d96038f72..9003cd2f52 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.alpha < 40) { - int num805 = Dust.NewDust(Projectile.Center - Vector2.One * 5f, 10, 10, 244, -Projectile.velocity.X / 3f, -Projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); - Main.dust[num805].noGravity = true; + int laserDust = Dust.NewDust(Projectile.Center - Vector2.One * 5f, 10, 10, 244, -Projectile.velocity.X / 3f, -Projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); + Main.dust[laserDust].noGravity = true; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -121,44 +121,44 @@ namespace CalamityMod.Projectiles.Boss float speed = revenge ? 9f : 7.5f; - Vector2 vector70 = Main.player[(int)Projectile.ai[1]].Center - Projectile.Center; - if (vector70.Length() < 20f) + Vector2 playerDistance = Main.player[(int)Projectile.ai[1]].Center - Projectile.Center; + if (playerDistance.Length() < 20f) { Projectile.Kill(); return; } - vector70.Normalize(); - vector70 *= 14f; - vector70 = Vector2.Lerp(Projectile.velocity, vector70, 0.6f); - if (vector70.Y < speed) - vector70.Y = speed; + playerDistance.Normalize(); + playerDistance *= 14f; + playerDistance = Vector2.Lerp(Projectile.velocity, playerDistance, 0.6f); + if (playerDistance.Y < speed) + playerDistance.Y = speed; - float num804 = 0.4f; - if (Projectile.velocity.X < vector70.X) + float projVelocityMult = 0.4f; + if (Projectile.velocity.X < playerDistance.X) { - Projectile.velocity.X = Projectile.velocity.X + num804; - if (Projectile.velocity.X < 0f && vector70.X > 0f) - Projectile.velocity.X = Projectile.velocity.X + num804; + Projectile.velocity.X = Projectile.velocity.X + projVelocityMult; + if (Projectile.velocity.X < 0f && playerDistance.X > 0f) + Projectile.velocity.X = Projectile.velocity.X + projVelocityMult; } - else if (Projectile.velocity.X > vector70.X) + else if (Projectile.velocity.X > playerDistance.X) { - Projectile.velocity.X = Projectile.velocity.X - num804; - if (Projectile.velocity.X > 0f && vector70.X < 0f) - Projectile.velocity.X = Projectile.velocity.X - num804; + Projectile.velocity.X = Projectile.velocity.X - projVelocityMult; + if (Projectile.velocity.X > 0f && playerDistance.X < 0f) + Projectile.velocity.X = Projectile.velocity.X - projVelocityMult; } - if (Projectile.velocity.Y < vector70.Y) + if (Projectile.velocity.Y < playerDistance.Y) { - Projectile.velocity.Y = Projectile.velocity.Y + num804; - if (Projectile.velocity.Y < 0f && vector70.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y + num804; + Projectile.velocity.Y = Projectile.velocity.Y + projVelocityMult; + if (Projectile.velocity.Y < 0f && playerDistance.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + projVelocityMult; } - else if (Projectile.velocity.Y > vector70.Y) + else if (Projectile.velocity.Y > playerDistance.Y) { - Projectile.velocity.Y = Projectile.velocity.Y - num804; - if (Projectile.velocity.Y > 0f && vector70.Y < 0f) - Projectile.velocity.Y = Projectile.velocity.Y - num804; + Projectile.velocity.Y = Projectile.velocity.Y - projVelocityMult; + if (Projectile.velocity.Y > 0f && playerDistance.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - projVelocityMult; } } } @@ -189,18 +189,18 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = Projectile.height = 64; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 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, 244, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 0, 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, 244, 0f, 0f, 100, default, 1.5f); + Main.dust[killDust].velocity *= 2f; + Main.dust[killDust].noGravity = true; } Projectile.Damage(); } diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 19a762295d..41a14e4ea0 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -59,12 +59,12 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 1f, 0.7f, 0f); - int num959 = (int)Projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + int playerTracker = (int)Projectile.ai[0]; + if (playerTracker >= 0 && Main.player[playerTracker].active && !Main.player[playerTracker].dead) { - if (Projectile.Distance(Main.player[num959].Center) > 320f) + if (Projectile.Distance(Main.player[playerTracker].Center) > 320f) { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[num959].Center, Vector2.UnitY); + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[playerTracker].Center, Vector2.UnitY); Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * scaleFactor12) / inertia; } } @@ -89,23 +89,23 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); Projectile.Damage(); - for (int num621 = 0; num621 < 30; num621++) + for (int i = 0; i < 30; i++) { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int nukeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[nukeDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[nukeDust].scale = 0.5f; + Main.dust[nukeDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 40; num623++) + for (int j = 0; j < 40; j++) { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int nukeDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[nukeDust2].noGravity = true; + Main.dust[nukeDust2].velocity *= 5f; + nukeDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[nukeDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index d275b00760..4c9005206e 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -51,9 +51,9 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[0] >= (Main.getGoodWorld ? 10f : 36f)) { Projectile.ai[0] = 0f; - 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, 4f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); + int rainSpawnX = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int rainSpawnY = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)rainSpawnX, (float)rainSpawnY, 0f, 4f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index 4a5ed32fdb..a38be847da 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - int num310 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num310]; + int shadeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[shadeDust]; dust.position.X -= 2f; dust.alpha = 38; dust.velocity *= 0.1f; diff --git a/Projectiles/Boss/ShadowflameFireball.cs b/Projectiles/Boss/ShadowflameFireball.cs index 9e8caf3edf..3d7dffc402 100644 --- a/Projectiles/Boss/ShadowflameFireball.cs +++ b/Projectiles/Boss/ShadowflameFireball.cs @@ -58,19 +58,19 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 1f) { - int num103 = (int)Player.FindClosest(Projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - Projectile.Center; + int playerTracker = (int)Player.FindClosest(Projectile.Center, 1, 1); + Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 60f) { if (Projectile.ai[0] < 240f) { - float scaleFactor2 = Projectile.velocity.Length(); - vector11.Normalize(); - vector11 *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + float scaleFactor = Projectile.velocity.Length(); + playerDirection.Normalize(); + playerDirection *= scaleFactor; + Projectile.velocity = (Projectile.velocity * 24f + playerDirection) / 25f; Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor2; + Projectile.velocity *= scaleFactor; } else if (Projectile.velocity.Length() < 18f) { diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index 739b8d7ca1..9ec4ca3095 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -54,20 +54,20 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); } - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int shadowDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[shadowDust].noGravity = true; + Main.dust[shadowDust].velocity *= 0f; Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 150f) { if (Projectile.ai[1] > 0f && Projectile.ai[0] < 160f) { - int num625 = (int)Projectile.ai[1] - 1; - if (num625 < Main.maxPlayers) + int playerTracker = (int)Projectile.ai[1] - 1; + if (playerTracker < Main.maxPlayers) { - Vector2 value16 = Main.player[num625].Center - Projectile.Center; - Projectile.velocity = Vector2.Normalize(value16) * 22f; + Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; + Projectile.velocity = Vector2.Normalize(playerDirection) * 22f; } } } @@ -95,23 +95,23 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[killDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[killDust].scale = 0.5f; + Main.dust[killDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); - 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 killDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Main.dust[killDust2].noGravity = true; + Main.dust[killDust2].velocity *= 5f; + killDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[killDust2].velocity *= 2f; } } } diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs index 143fbf0bbf..6375930d03 100644 --- a/Projectiles/Boss/SkyFlare.cs +++ b/Projectiles/Boss/SkyFlare.cs @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Boss 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; } @@ -67,59 +67,58 @@ namespace CalamityMod.Projectiles.Boss { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; SoundEngine.PlaySound(FlareSound, Projectile.Center); - 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 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustRotate = dustRotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 dustDirection = dustRotate - Projectile.Center; + int flareDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 244, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[flareDust].noGravity = true; + Main.dust[flareDust].noLight = true; + Main.dust[flareDust].velocity = dustDirection; } 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 projTileX = (int)(Projectile.Center.Y / 16f); + int projTileY = (int)(Projectile.Center.X / 16f); + if (projTileY < 10) { - num232 = 10; + projTileY = 10; } - if (num232 > Main.maxTilesX - 10) + if (projTileY > Main.maxTilesX - 10) { - num232 = Main.maxTilesX - 10; + projTileY = Main.maxTilesX - 10; } - if (num231 < 10) + if (projTileX < 10) { - num231 = 10; + projTileX = 10; } - if (num231 > Main.maxTilesY - num233 - 10) + if (projTileX > Main.maxTilesY - 110) { - num231 = Main.maxTilesY - num233 - 10; + projTileX = Main.maxTilesY - 110; } - for (int num234 = num231; num234 < num231 + num233; num234++) + for (int j = projTileX; j < projTileX + 100; j++) { - Tile tile = Main.tile[num232, num234]; + Tile tile = Main.tile[projTileY, j]; if (tile.HasTile && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0)) { - num231 = num234; + projTileX = j; break; } } int tornadoType = Main.rand.Next(6); if (tornadoType < 5) { - int num235 = Main.expertMode ? 180 : 300; //720 - int num236 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), num235, 4f, Main.myPlayer, 16f, 15f + (revenge ? 4f : 0f)); - Main.projectile[num236].netUpdate = true; + int nadoDamage = Main.expertMode ? 180 : 300; //720 + int nadoSpawn = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), nadoDamage, 4f, Main.myPlayer, 16f, 15f + (revenge ? 4f : 0f)); + Main.projectile[nadoSpawn].netUpdate = true; } else { - int num235 = Main.expertMode ? 230 : 400; //920 - int num236 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), num235, 4f, Main.myPlayer, 16f, 16f + (revenge ? 4f : 0f)); - Main.projectile[num236].netUpdate = true; + int nadoDamage = Main.expertMode ? 230 : 400; //920 + int nadoSpawn = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), nadoDamage, 4f, Main.myPlayer, 16f, 16f + (revenge ? 4f : 0f)); + Main.projectile[nadoSpawn].netUpdate = true; } } } diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index 5f17cc6013..bc3a7fbde6 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -47,9 +47,9 @@ namespace CalamityMod.Projectiles.Boss 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/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs index 7f90a96afd..318e4c2e35 100644 --- a/Projectiles/Boss/VileClot.cs +++ b/Projectiles/Boss/VileClot.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Length() < 12f) Projectile.velocity *= 1.01f; - int num104 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), + int vileDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 100, default, 1.5f); - Main.dust[num104].noGravity = true; + Main.dust[vileDust].noGravity = true; Projectile.rotation += 0.3f * (float)Projectile.direction; } @@ -49,14 +49,14 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - for (int num584 = 0; num584 < 6; num584++) + for (int i = 0; i < 6; i++) { - int num585 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 2.5f); - Main.dust[num585].noGravity = true; - Dust dust = Main.dust[num585]; + int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 2.5f); + Main.dust[killDust].noGravity = true; + Dust dust = Main.dust[killDust]; dust.velocity *= 2f; - num585 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 1.2f); - dust = Main.dust[num585]; + killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 1.2f); + dust = Main.dust[killDust]; dust.velocity *= 2f; } } diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index 50003e6dea..a3323c537b 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -45,14 +45,14 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 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, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[waterDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[waterDust].scale = 0.5f; + Main.dust[waterDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } Projectile.ai[1] = 1f; From 85e7c63c2a840f36f1ac0ecd29eaafeb09dbeaaf Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 22 Oct 2023 15:05:36 -0400 Subject: [PATCH 11/43] Start of boss files --- NPCs/AquaticScourge/AquaticScourgeBody.cs | 10 +- NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs | 10 +- NPCs/AquaticScourge/AquaticScourgeHead.cs | 32 +-- NPCs/AquaticScourge/AquaticScourgeTail.cs | 10 +- NPCs/AstrumAureus/AstrumAureus.cs | 86 ++++---- NPCs/AstrumAureus/AureusSpawn.cs | 79 ++++---- NPCs/AstrumDeus/AstrumDeusBody.cs | 50 ++--- NPCs/AstrumDeus/AstrumDeusHead.cs | 50 ++--- NPCs/AstrumDeus/AstrumDeusTail.cs | 42 ++-- NPCs/BrimstoneElemental/Brimling.cs | 69 ++++--- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 34 ++-- NPCs/Bumblebirb/Bumblefuck.cs | 188 +++++++++--------- NPCs/Bumblebirb/Bumblefuck2.cs | 32 ++- NPCs/CalClone/CalamitasClone.cs | 40 ++-- NPCs/CalClone/Cataclysm.cs | 74 ++++--- NPCs/CalClone/Catastrophe.cs | 74 ++++--- NPCs/CeaselessVoid/CeaselessVoid.cs | 100 +++++----- NPCs/CeaselessVoid/DarkEnergy.cs | 22 +- 18 files changed, 495 insertions(+), 507 deletions(-) diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index e316b31f81..d66f327dce 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -100,11 +100,11 @@ namespace CalamityMod.NPCs.AquaticScourge spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld) @@ -115,7 +115,7 @@ namespace CalamityMod.NPCs.AquaticScourge color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 878f092770..06f72e58ef 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -99,11 +99,11 @@ namespace CalamityMod.NPCs.AquaticScourge spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld) @@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.AquaticScourge color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index a1c49cf262..f73c8daa8d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -138,11 +138,11 @@ namespace CalamityMod.NPCs.AquaticScourge spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld) @@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.AquaticScourge color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(NPC.localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f); return false; } @@ -162,18 +162,18 @@ namespace CalamityMod.NPCs.AquaticScourge { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float topLeftHitbox = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float topRightHitbox = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float bottomLeftHitbox = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float bottomRightHitbox = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = topLeftHitbox; + if (topRightHitbox < minDist) + minDist = topRightHitbox; + if (bottomLeftHitbox < minDist) + minDist = bottomLeftHitbox; + if (bottomRightHitbox < minDist) + minDist = bottomRightHitbox; return minDist <= 50f * NPC.scale; } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 8f3c854675..51908a45bf 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -99,11 +99,11 @@ namespace CalamityMod.NPCs.AquaticScourge spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld) @@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.AquaticScourge color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 6e276643b5..6a7d4a7caa 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -276,67 +276,67 @@ namespace CalamityMod.NPCs.AstrumAureus } int frameCount = Main.npcFrameCount[NPC.type]; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / frameCount / 2); + Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / frameCount / 2); Rectangle frame = NPC.frame; float scale = NPC.scale; float rotation = NPC.rotation; float offsetY = NPC.gfxOffY; - Color color36 = Color.White; + Color slimeColor = Color.White; if (Main.zenithWorld && slimePhaseHP) { - color36 = slimePhase == 0 ? Color.Yellow : Color.Violet; + slimeColor = slimePhase == 0 ? Color.Yellow : Color.Violet; } - float amount9 = 0.5f; - int num153 = 7; + float colorLerpAmt = 0.5f; + int afterimageAmt = 7; if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) - num153 = 10; + afterimageAmt = 10; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; - vector41 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector41, frame, color38, rotation, vector11, scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, slimeColor, colorLerpAmt); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; + afterimagePos += originalDrawSize * scale + new Vector2(0f, 4f + offsetY); + spriteBatch.Draw(NPCTexture, afterimagePos, frame, afterimageColor, rotation, originalDrawSize, scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; - vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY); - Color toUse = Main.zenithWorld && slimePhaseHP ? color36 : drawColor; - spriteBatch.Draw(NPCTexture, vector43, frame, NPC.GetAlpha(toUse), rotation, vector11, scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; + drawLocation += originalDrawSize * scale + new Vector2(0f, 4f + offsetY); + Color toUse = Main.zenithWorld && slimePhaseHP ? slimeColor : drawColor; + spriteBatch.Draw(NPCTexture, drawLocation, frame, NPC.GetAlpha(toUse), rotation, originalDrawSize, scale, spriteEffects, 0f); if (NPC.ai[0] != 1 || (slimePhaseHP && Main.zenithWorld)) //draw only if not recharging { Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Gold); - Color color40 = Color.Lerp(Color.White, color, 0.5f); + Color attackingColor = Color.Lerp(Color.White, color, 0.5f); if (Main.zenithWorld && slimePhaseHP) { - color40 = slimePhase == 0 ? Color.Violet : Color.Yellow; + attackingColor = slimePhase == 0 ? Color.Violet : Color.Yellow; } if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color40; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(GlowMaskTexture.Width, GlowMaskTexture.Height / frameCount) * scale / 2f; - vector44 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(GlowMaskTexture, vector44, frame, color41, rotation, vector11, scale, spriteEffects, 0f); + Color attackingAfterimageColor = attackingColor; + attackingAfterimageColor = Color.Lerp(attackingAfterimageColor, slimeColor, colorLerpAmt); + attackingAfterimageColor = NPC.GetAlpha(attackingAfterimageColor); + attackingAfterimageColor *= (afterimageAmt - j) / 15f; + Vector2 attackAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + attackAfterimagePos -= new Vector2(GlowMaskTexture.Width, GlowMaskTexture.Height / frameCount) * scale / 2f; + attackAfterimagePos += originalDrawSize * scale + new Vector2(0f, 4f + offsetY); + spriteBatch.Draw(GlowMaskTexture, attackAfterimagePos, frame, attackingAfterimageColor, rotation, originalDrawSize, scale, spriteEffects, 0f); } } - spriteBatch.Draw(GlowMaskTexture, vector43, frame, color40, rotation, vector11, scale, spriteEffects, 0f); + spriteBatch.Draw(GlowMaskTexture, drawLocation, frame, attackingColor, rotation, originalDrawSize, scale, spriteEffects, 0f); } return false; @@ -440,23 +440,23 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.height = (int)(100 * NPC.scale); NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 50; num621++) + for (int r = 0; r < 50; r++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int aureusDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[aureusDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[aureusDust].scale = 0.5f; + Main.dust[aureusDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 100; num623++) + for (int s = 0; s < 100; s++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int aureusDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + Main.dust[aureusDust2].noGravity = true; + Main.dust[aureusDust2].velocity *= 5f; + aureusDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + Main.dust[aureusDust2].velocity *= 2f; } } } diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 90390664c8..848c2a6de0 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -240,49 +240,48 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.DrawBackglow(Color.Lerp(Color.Cyan, Color.Orange, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) with { A = 0 }, 2f + 8f * ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f), spriteEffects, NPC.frame, screenPos); Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 10; + Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Color whiteColor = Color.White; + int afterimageAmt = 10; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, whiteColor, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; + Color afterimageColorLerp = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color secondAfterimageColor = afterimageColorLerp; + secondAfterimageColor = Color.Lerp(secondAfterimageColor, whiteColor, 0.5f); + secondAfterimageColor *= (afterimageAmt - j) / 15f; + Vector2 secondAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + secondAfterimagePos += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, afterimageColorLerp, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); return false; } @@ -351,26 +350,26 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.position.X = NPC.position.X - NPC.width / 2; NPC.position.Y = NPC.position.Y - NPC.height / 2; - for (int num621 = 0; num621 < 30; num621++) + for (int r = 0; r < 30; r++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[astralDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[astralDust].scale = 0.5f; + Main.dust[astralDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } - Main.dust[num622].noGravity = true; + Main.dust[astralDust].noGravity = true; } - for (int num623 = 0; num623 < 60; num623++) + for (int s = 0; s < 60; s++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; + int astralDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[astralDust2].noGravity = true; + Main.dust[astralDust2].velocity *= 5f; + astralDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[astralDust2].velocity *= 2f; + Main.dust[astralDust2].noGravity = true; } } } diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 9904695fef..ba1e2f361f 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -99,34 +99,34 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral").Value : TextureAssets.Npc[NPC.type].Value; - Texture2D texture2 = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2").Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2").Value; + Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector2, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(mainWormTex.Width, mainWormTex.Height) * NPC.scale / 2f; + drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - texture = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow").Value; + mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow").Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - texture = drawCyan ? texture : (altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3").Value); - texture2 = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4").Value : texture2; + mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3").Value); + secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4").Value : secondWormTex; } - Color color = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); - Color color2 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); if (!altBodyTextures) { timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture2, vector2, NPC.frame, color2, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); } return false; @@ -152,23 +152,23 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.height = 50; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[purpleDust].scale = 0.5f; + Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + Main.dust[astralDust].noGravity = true; + Main.dust[astralDust].velocity *= 5f; + astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + Main.dust[astralDust].velocity *= 2f; } } } diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index faabbec9db..d02666233a 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -149,32 +149,32 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = NPC.Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2 = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2").Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D mainWormTex = TextureAssets.Npc[NPC.type].Value; + Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2").Value; + Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector2, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(mainWormTex.Width, mainWormTex.Height) * NPC.scale / 2f; + drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow").Value; + mainWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow").Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - texture = drawCyan ? texture : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3").Value; - texture2 = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4").Value : texture2; + mainWormTex = drawCyan ? mainWormTex : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3").Value; + secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4").Value : secondWormTex; } - Color color = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); - Color color2 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture2, vector2, NPC.frame, color2, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); return false; } @@ -191,23 +191,23 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.height = 50; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[purpleDust].scale = 0.5f; + Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + Main.dust[astralDust].noGravity = true; + Main.dust[astralDust].velocity *= 5f; + astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + Main.dust[astralDust].velocity *= 2f; } } } diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 5747de46ef..eae753ab00 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -98,24 +98,24 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D wormTexture = TextureAssets.Npc[NPC.type].Value; + Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector2, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(wormTexture.Width, wormTexture.Height) * NPC.scale / 2f; + drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow").Value; + wormTexture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow").Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) - texture = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2").Value : texture; + wormTexture = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2").Value : wormTexture; - Color color = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color wormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, wormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); return false; } @@ -135,23 +135,23 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.height = 50; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[purpleDust].scale = 0.5f; + Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + Main.dust[astralDust].noGravity = true; + Main.dust[astralDust].velocity *= 5f; + astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + Main.dust[astralDust].velocity *= 2f; } } } diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 72d45033b2..bb7d4fa158 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -182,14 +182,14 @@ namespace CalamityMod.NPCs.BrimstoneElemental Vector2 distanceFromMother = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center - NPC.Center; if (distanceFromMother.Length() > 120f) { - Vector2 value54 = distanceFromMother; - if (value54.Length() > movementVelocity) + Vector2 farFromBrimVelocityMult = distanceFromMother; + if (farFromBrimVelocityMult.Length() > movementVelocity) { - value54.Normalize(); - value54 *= movementVelocity; + farFromBrimVelocityMult.Normalize(); + farFromBrimVelocityMult *= movementVelocity; } int inertia = 20; - NPC.velocity = (NPC.velocity * (inertia - 1) + value54) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1) + farFromBrimVelocityMult) / inertia; } else NPC.velocity *= 0.96f; @@ -221,13 +221,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Teleport to Brim's new location if (NPC.ai[2] != 0f && NPC.ai[3] != 0f) { - for (int num1449 = 0; num1449 < 20; num1449++) + for (int i = 0; i < 20; i++) { - int num1450 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1450]; + int deepRedDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[deepRedDust]; dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; + Main.dust[deepRedDust].noGravity = true; + Main.dust[deepRedDust].scale = 2.5f; } NPC.Center = new Vector2(NPC.ai[2] * 16f, NPC.ai[3] * 16f); @@ -238,13 +238,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental SoundEngine.PlaySound(SoundID.Item8, NPC.Center); - for (int num1451 = 0; num1451 < 20; num1451++) + for (int j = 0; j < 20; j++) { - int num1452 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1452]; + int deepRedDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[deepRedDust2]; dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; + Main.dust[deepRedDust2].noGravity = true; + Main.dust[deepRedDust2].scale = 2.5f; } } @@ -261,30 +261,29 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Teleport when Brim teleports if (Main.npc[CalamityGlobalNPC.brimstoneElemental].alpha == 255 && Main.netMode != NetmodeID.MultiplayerClient) { - Point point12 = NPC.Center.ToTileCoordinates(); - Point point13 = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center.ToTileCoordinates(); - int num1453 = 6; - int num1454 = 3; - int num1455 = 4; - int num1456 = 1; - int num1457 = 0; - while (num1457 < 100) + Point npcTileCoords = NPC.Center.ToTileCoordinates(); + Point brimmyTileCoords = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center.ToTileCoordinates(); + int babTeleportRadius = 3; + int brimmyTeleportRadius = 4; + int solidTileRadius = 1; + int increment = 0; + while (increment < 100) { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].HasUnactuatedTile) + increment++; + int randXOffset = Main.rand.Next(brimmyTileCoords.X - 6, brimmyTileCoords.X + 7); + int randYOffset = Main.rand.Next(brimmyTileCoords.Y - 6, brimmyTileCoords.Y + 7); + if ((randYOffset < brimmyTileCoords.Y - brimmyTeleportRadius || randYOffset > brimmyTileCoords.Y + brimmyTeleportRadius || randXOffset < brimmyTileCoords.X - brimmyTeleportRadius || randXOffset > brimmyTileCoords.X + brimmyTeleportRadius) && (randYOffset < npcTileCoords.Y - babTeleportRadius || randYOffset > npcTileCoords.Y + babTeleportRadius || randXOffset < npcTileCoords.X - babTeleportRadius || randXOffset > npcTileCoords.X + babTeleportRadius) && !Main.tile[randXOffset, randYOffset].HasUnactuatedTile) { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].LiquidType == LiquidID.Lava) - flag107 = false; - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - flag107 = false; + bool canTeleport = true; + if (canTeleport && Main.tile[randXOffset, randYOffset].LiquidType == LiquidID.Lava) + canTeleport = false; + if (canTeleport && Collision.SolidTiles(randXOffset - solidTileRadius, randXOffset + solidTileRadius, randYOffset - solidTileRadius, randYOffset + solidTileRadius)) + canTeleport = false; - if (flag107) + if (canTeleport) { - NPC.ai[2] = num1458; - NPC.ai[3] = num1459; + NPC.ai[2] = randXOffset; + NPC.ai[3] = randYOffset; break; } } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 304fd9a09b..bf3c38328e 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -263,23 +263,23 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.height = 150; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 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 < 60; num623++) + for (int j = 0; j < 60; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) { @@ -300,11 +300,11 @@ namespace CalamityMod.NPCs.BrimstoneElemental SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); + Texture2D npcTexture = TextureAssets.Npc[NPC.type].Value; + Vector2 frameLocation = new Vector2((float)(npcTexture.Width / 2), (float)(npcTexture.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + npcOffset -= new Vector2((float)npcTexture.Width, (float)(npcTexture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset += frameLocation * NPC.scale + new Vector2(0f, NPC.gfxOffY); // Give brimmy an outline based on current elemental mode if (Main.zenithWorld) @@ -340,11 +340,11 @@ namespace CalamityMod.NPCs.BrimstoneElemental for (float i = 0; i < 1; i += 0.125f) { - spriteBatch.Draw(texture, npcOffset + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, NPC.frame, outlineColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(npcTexture, npcOffset + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, NPC.frame, outlineColor, NPC.rotation, frameLocation, NPC.scale, spriteEffects, 0f); } CalamityUtils.ExitShaderRegion(spriteBatch); } - spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(npcTexture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, frameLocation, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index ab0ff5605b..f5dca66286 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -142,8 +142,8 @@ namespace CalamityMod.NPCs.Bumblebirb if (phaseSwitchPhase || birbSpawn) { float frameGateValue = birbSpawn ? NPC.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; - int num116 = 180; - if (frameGateValue < (num116 - 60) || frameGateValue > (num116 - 20)) + int frameTimer = 180; + if (frameGateValue < (frameTimer - 60) || frameGateValue > (frameTimer - 20)) { NPC.frameCounter += 1D; if (NPC.frameCounter > 5D) @@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.Bumblebirb else { NPC.frame.Y = frameHeight * 4; - if (frameGateValue > (num116 - 50) && frameGateValue < (num116 - 25)) + if (frameGateValue > (frameTimer - 50) && frameGateValue < (frameTimer - 25)) { NPC.frame.Y = frameHeight * 5; } @@ -167,8 +167,8 @@ namespace CalamityMod.NPCs.Bumblebirb } else if (NPC.ai[0] == 5f) { - int num115 = 120; - if (NPC.ai[1] < (num115 - 50) || NPC.ai[1] > (num115 - 10)) + int otherFrameTimer = 120; + if (NPC.ai[1] < (otherFrameTimer - 50) || NPC.ai[1] > (otherFrameTimer - 10)) { NPC.frameCounter += 1D; if (NPC.frameCounter > 5D) @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.Bumblebirb else { NPC.frame.Y = frameHeight * 4; - if (NPC.ai[1] > (num115 - 40) && NPC.ai[1] < (num115 - 15)) + if (NPC.ai[1] > (otherFrameTimer - 40) && NPC.ai[1] < (otherFrameTimer - 15)) { NPC.frame.Y = frameHeight * 5; } @@ -228,13 +228,13 @@ namespace CalamityMod.NPCs.Bumblebirb spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Color color = drawColor; - Color color36 = Color.White; + Color drawColor = Color.White; - float amount9 = 0f; - int num150 = 120; - int num151 = 60; + float lerpDrawTransition = 0f; + int newAITracker = 120; + int buffColorDampener = 60; if (phase3 && calamityGlobalNPC.newAI[3] == 1f) { @@ -244,27 +244,27 @@ namespace CalamityMod.NPCs.Bumblebirb { color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.3f, 1f); } - else if (phase2 && calamityGlobalNPC.newAI[0] > (float)num150) + else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) { - float num152 = calamityGlobalNPC.newAI[0] - (float)num150; - num152 /= (float)num151; - color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * num152, 1f - 0.3f * num152, 1f - 0.7f * num152, 1f); + float phase2TranBuff = calamityGlobalNPC.newAI[0] - (float)newAITracker; + phase2TranBuff /= (float)buffColorDampener; + color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * phase2TranBuff, 1f - 0.3f * phase2TranBuff, 1f - 0.7f * phase2TranBuff, 1f); } - int num153 = 10; - int num154 = 2; + int afterimageAmt = 10; + int afterimageIncrement = 2; if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) { - num153 = 4; + afterimageAmt = 4; } if (NPC.ai[0] == 1f || NPC.ai[0] == 3f || NPC.ai[0] == 4.1f) { - num153 = 7; + afterimageAmt = 7; } if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) { - color36 = Color.Yellow; - amount9 = 0.5f; + drawColor = Color.Yellow; + lerpDrawTransition = 0.5f; } else { @@ -273,128 +273,126 @@ namespace CalamityMod.NPCs.Bumblebirb if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += num154) + for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { - Color color38 = color; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = color; + afterimageColor = Color.Lerp(afterimageColor, drawColor, lerpDrawTransition); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - int num156 = 0; - float num157 = 0f; - float scaleFactor9 = 0f; + int extraAfterimageAmt = 0; + float extraAfterimageDampener = 0f; + float afterimageScaler = 0f; if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) { - num156 = 4; + extraAfterimageAmt = 4; } if (NPC.ai[0] == 5f) { - int num158 = 60; - int num159 = 30; - if (NPC.ai[1] > (float)num158) + if (NPC.ai[1] > 60f) { - num156 = 6; - num157 = 1f - (float)Math.Cos((double)((NPC.ai[1] - (float)num158) / (float)num159 * MathHelper.TwoPi)); - num157 /= 3f; - scaleFactor9 = 40f; + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((NPC.ai[1] - 60f) / 30f * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 40f; } } if (phaseSwitchPhase) { - if (phase3 && calamityGlobalNPC.newAI[1] > (float)num150) + if (phase3 && calamityGlobalNPC.newAI[1] > (float)newAITracker) { - num156 = 6; - num157 = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[1] - (float)num150) / (float)num151 * MathHelper.TwoPi)); - num157 /= 3f; - scaleFactor9 = 60f; + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[1] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 60f; } - else if (phase2 && calamityGlobalNPC.newAI[0] > (float)num150) + else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) { - num156 = 6; - num157 = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)num150) / (float)num151 * MathHelper.TwoPi)); - num157 /= 3f; - scaleFactor9 = 60f; + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 60f; } } if (CalamityConfig.Instance.Afterimages) { - for (int num160 = 0; num160 < num156; num160++) + for (int j = 0; j < extraAfterimageAmt; j++) { - Color color39 = drawColor; - color39 = Color.Lerp(color39, color36, amount9); - color39 = NPC.GetAlpha(color39); - color39 *= 1f - num157; - Vector2 vector42 = NPC.Center + ((float)num160 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos; - vector42 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector42 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector42, NPC.frame, color39, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraAfterimageColor = drawColor; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, drawColor, lerpDrawTransition); + extraAfterimageColor = NPC.GetAlpha(extraAfterimageColor); + extraAfterimageColor *= 1f - extraAfterimageDampener; + Vector2 extraAfterimageDrawPos = NPC.Center + ((float)j / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Color color2 = drawColor; - color2 = Color.Lerp(color2, color36, amount9); - color2 = NPC.GetAlpha(color2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? color2 : NPC.GetAlpha(drawColor)), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color mainDrawingColor = drawColor; + mainDrawingColor = Color.Lerp(mainDrawingColor, drawColor, lerpDrawTransition); + mainDrawingColor = NPC.GetAlpha(mainDrawingColor); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(drawColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (phase2) { texture2D15 = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow").Value; - Color color40 = Color.Lerp(Color.White, Color.Red, 0.5f); - color36 = Color.Red; + Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); + drawColor = Color.Red; - amount9 = 1f; - num157 = 0.5f; - scaleFactor9 = 10f; - num154 = 1; + lerpDrawTransition = 1f; + extraAfterimageDampener = 0.5f; + afterimageScaler = 10f; + afterimageIncrement = 1; if (phaseSwitchPhase) { - float num161 = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)num150; - num161 /= (float)num151; - color36 *= num161; - color40 *= num161; + float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker; + glowmaskDampener /= (float)buffColorDampener; + drawColor *= glowmaskDampener; + glowmaskColor *= glowmaskDampener; } if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163 += num154) + for (int k = 1; k < afterimageAmt; k += afterimageIncrement) { - Color color41 = color40; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color glowmaskAfterimageColor = glowmaskColor; + glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, drawColor, lerpDrawTransition); + glowmaskAfterimageColor *= (float)(afterimageAmt - k) / 15f; + Vector2 glowmaskAfterimageDrawPos = NPC.oldPos[k] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + glowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, glowmaskAfterimageDrawPos, NPC.frame, glowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } - for (int num164 = 1; num164 < num156; num164++) + for (int l = 1; l < extraAfterimageAmt; l++) { - Color color42 = color40; - color42 = Color.Lerp(color42, color36, amount9); - color42 = NPC.GetAlpha(color42); - color42 *= 1f - num157; - Vector2 vector45 = NPC.Center + ((float)num164 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos; - vector45 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector45 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector45, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraGlowmaskAfterimageColor = glowmaskColor; + extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, drawColor, lerpDrawTransition); + extraGlowmaskAfterimageColor = NPC.GetAlpha(extraGlowmaskAfterimageColor); + extraGlowmaskAfterimageColor *= 1f - extraAfterimageDampener; + Vector2 extraGlowmaskAfterimageDrawPos = NPC.Center + ((float)l / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; + extraGlowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraGlowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraGlowmaskAfterimageDrawPos, NPC.frame, extraGlowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color40, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } return false; diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index ab2e47b4b0..9312bb3f08 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -99,30 +99,28 @@ namespace CalamityMod.NPCs.Bumblebirb spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.Gold; - float amount9 = 0.5f; - int num153 = NPC.ai[0] == 2.1f ? 7 : 0; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index ca319541ce..1af5ce551a 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -138,14 +138,14 @@ namespace CalamityMod.NPCs.CalClone { for (int i = 1; i < afterimageAmt; i += 2) { - Color color1 = drawColor; - color1 = Color.Lerp(color1, white, colorLerpAmt); - color1 = NPC.GetAlpha(color1); - color1 *= (float)(afterimageAmt - i) / 15f; + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, white, colorLerpAmt); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, offset, NPC.frame, color1, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, offset, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } @@ -165,13 +165,13 @@ namespace CalamityMod.NPCs.CalClone { for (int i = 1; i < afterimageAmt; i++) { - Color color2 = color; - color2 = Color.Lerp(color2, white, colorLerpAmt); - color2 *= (float)(afterimageAmt - i) / 15f; + Color extraAfterimageColor = color; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, white, colorLerpAmt); + extraAfterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, offset, NPC.frame, color2, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, offset, NPC.frame, extraAfterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } @@ -275,23 +275,23 @@ namespace CalamityMod.NPCs.CalClone NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 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 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } } } diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index f3e564e480..1f2c153cea 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -106,49 +106,47 @@ namespace CalamityMod.NPCs.CalClone spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 7; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 7; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CataclysmGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraAfterimageColor = pinkLerp; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f); + extraAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, pinkLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -190,23 +188,23 @@ namespace CalamityMod.NPCs.CalClone NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 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 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } } } diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index 82937e480f..eac8c67b49 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -106,49 +106,47 @@ namespace CalamityMod.NPCs.CalClone spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 7; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 7; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CatastropheGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraAfterimageColor = pinkLerp; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f); + extraAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, pinkLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -190,23 +188,23 @@ namespace CalamityMod.NPCs.CalClone NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 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 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } } } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 2b7a7da62a..7ec4467489 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -122,18 +122,18 @@ namespace CalamityMod.NPCs.CeaselessVoid { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 50f; } @@ -145,49 +145,47 @@ namespace CalamityMod.NPCs.CeaselessVoid spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 7; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 7; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/CeaselessVoidGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraAfterimageColor = cyanLerp; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f); + extraAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, cyanLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -283,25 +281,25 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust].velocity *= 3f; + Main.dust[purpleDust].noGravity = true; 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 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 2f; + int purpleDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[purpleDust2].noGravity = true; + Main.dust[purpleDust2].velocity *= 5f; + purpleDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust2].noGravity = true; + Main.dust[purpleDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 754d971bd2..a254faf2f8 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -282,18 +282,18 @@ namespace CalamityMod.NPCs.CeaselessVoid { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 35f * NPC.scale; } From db6768b27ccf5493591af917d74156091887bbc7 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 22 Oct 2023 18:57:20 -0400 Subject: [PATCH 12/43] Crabulon, Cryogen, Desert Scourge --- NPCs/Crabulon/Crabulon.cs | 121 ++++++----- NPCs/Cryogen/Cryogen.cs | 249 +++++++++++------------ NPCs/Cryogen/CryogenShield.cs | 60 +++--- NPCs/DesertScourge/DesertNuisanceBody.cs | 45 ++-- NPCs/DesertScourge/DesertNuisanceHead.cs | 235 +++++++++++---------- NPCs/DesertScourge/DesertNuisanceTail.cs | 45 ++-- NPCs/DesertScourge/DesertScourgeBody.cs | 45 ++-- NPCs/DesertScourge/DesertScourgeHead.cs | 224 ++++++++++---------- NPCs/DesertScourge/DesertScourgeTail.cs | 46 ++--- 9 files changed, 531 insertions(+), 539 deletions(-) diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index bcd9cec924..b54d7a4d5b 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -190,18 +190,18 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.ai[0] < 2f) { - Vector2 vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - int num352 = 1; + Vector2 mushBombDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + int mushBombAmt = 1; NPC.localAI[3] += 2f; if (phase2) { NPC.localAI[3] += 1f; - num352 += 2; + mushBombAmt += 2; } if (phase3) { NPC.localAI[3] += 2f; - num352 += 3; + mushBombAmt += 3; } if (NPC.ai[3] == 0f) { @@ -215,30 +215,30 @@ namespace CalamityMod.NPCs.Crabulon { NPC.localAI[3] = 0f; NPC.ai[3] += 1f; - if (NPC.ai[3] >= num352) + if (NPC.ai[3] >= mushBombAmt) NPC.ai[3] = 0f; - float num353 = 10f; + float mushBombSpeed = 10f; int type = ModContent.ProjectileType(); SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { if (phase2) - num353 += 1f; + mushBombSpeed += 1f; if (phase3) - num353 += 1f; + mushBombSpeed += 1f; - vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num349 = player.position.X + player.width * 0.5f - vector34.X; - float num350 = player.position.Y + player.height * 0.5f - vector34.Y; - float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); - num351 = num353 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349; - vector34.Y += num350; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector34.X, vector34.Y, num349, num350 - 5f, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); + mushBombDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float playerXDist = player.position.X + player.width * 0.5f - mushBombDirection.X; + float playerYDist = player.position.Y + player.height * 0.5f - mushBombDirection.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + playerDistance = mushBombSpeed / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; + mushBombDirection.X += playerXDist; + mushBombDirection.Y += playerYDist; + Projectile.NewProjectile(NPC.GetSource_FromAI(), mushBombDirection.X, mushBombDirection.Y, playerXDist, playerYDist - 5f, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); } } } @@ -278,11 +278,11 @@ namespace CalamityMod.NPCs.Crabulon walkingVelocity *= 2f; walkingVelocity += 2.5f * enrageScale; - bool flag51 = false; + bool shouldWalkSlower = false; if (Math.Abs(NPC.Center.X - player.Center.X) < 50f) - flag51 = true; + shouldWalkSlower = true; - if (flag51) + if (shouldWalkSlower) { NPC.velocity.X *= 0.9f; if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) @@ -308,17 +308,14 @@ namespace CalamityMod.NPCs.Crabulon { NPC.noGravity = true; NPC.noTileCollide = true; - - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(NPC.Center.X - (num854 / 2), NPC.position.Y + NPC.height - num855); + Vector2 collisionCheckPosition = new Vector2(NPC.Center.X - 40, NPC.position.Y + NPC.height - 20); bool fallDownOnTopOfTarget = NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f; if (fallDownOnTopOfTarget) { NPC.velocity.Y += 0.5f; } - else if (Collision.SolidCollision(position2, num854, num855)) + else if (Collision.SolidCollision(collisionCheckPosition, 80, 20)) { if (NPC.velocity.Y > 0f) NPC.velocity.Y = 0f; @@ -529,16 +526,16 @@ namespace CalamityMod.NPCs.Crabulon NPC.netUpdate = true; } - for (int num622 = (int)NPC.position.X - 20; num622 < (int)NPC.position.X + NPC.width + 40; num622 += 20) + for (int j = (int)NPC.position.X - 20; j < (int)NPC.position.X + NPC.width + 40; j += 20) { - for (int num623 = 0; num623 < 4; num623++) + for (int k = 0; k < 4; k++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].velocity *= 0.2f; + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; } if (Main.zenithWorld) { - int x = num622 / 16; + int x = j / 16; int y = (int)(NPC.position.Y + NPC.height) / 16; Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y); Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y - 1); @@ -588,27 +585,27 @@ namespace CalamityMod.NPCs.Crabulon else if (NPC.direction > 0) NPC.velocity.X += velocityX; - float num626 = 2.5f; - num626 += enrageScale; + float topXSpeed = 2.5f; + topXSpeed += enrageScale; if (revenge) { - num626 += 1f; + topXSpeed += 1f; } if (phase2) { - num626 += 1f; + topXSpeed += 1f; } if (phase3) { - num626 += 1f; + topXSpeed += 1f; } - if (NPC.velocity.X < -num626) + if (NPC.velocity.X < -topXSpeed) { - NPC.velocity.X = -num626; + NPC.velocity.X = -topXSpeed; } - if (NPC.velocity.X > num626) + if (NPC.velocity.X > topXSpeed) { - NPC.velocity.X = num626; + NPC.velocity.X = topXSpeed; } } } @@ -622,23 +619,23 @@ namespace CalamityMod.NPCs.Crabulon { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.025 : 0.05)); - if ((NPC.life + num660) < NPC.localAI[0]) + int crabShroomSpawnFreq = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.025 : 0.05)); + if ((NPC.life + crabShroomSpawnFreq) < NPC.localAI[0]) { NPC.localAI[0] = NPC.life; - int num661 = death ? 3 : expertMode ? Main.rand.Next(2, 4) : 2; - for (int num662 = 0; num662 < num661; num662++) + int crabShroomAmt = death ? 3 : expertMode ? Main.rand.Next(2, 4) : 2; + for (int mush = 0; mush < crabShroomAmt; mush++) { int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32)); - int num663 = ModContent.NPCType(); - int num664 = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, num663); - Main.npc[num664].SetDefaults(num663); - Main.npc[num664].velocity.X = Main.rand.Next(-50, 51) * (Main.getGoodWorld ? 0.2f : 0.1f); - Main.npc[num664].velocity.Y = Main.rand.Next(-50, -31) * (Main.getGoodWorld ? 0.2f : 0.1f); - if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) + int npcType = ModContent.NPCType(); + int crabShroom = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, npcType); + Main.npc[crabShroom].SetDefaults(npcType); + Main.npc[crabShroom].velocity.X = Main.rand.Next(-50, 51) * (Main.getGoodWorld ? 0.2f : 0.1f); + Main.npc[crabShroom].velocity.Y = Main.rand.Next(-50, -31) * (Main.getGoodWorld ? 0.2f : 0.1f); + if (Main.netMode == NetmodeID.Server && crabShroom < Main.maxNPCs) { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, crabShroom, 0f, 0f, 0f, 0, 0, 0); } } } @@ -894,23 +891,23 @@ namespace CalamityMod.NPCs.Crabulon NPC.height = (int)(100 * NPC.scale); NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int j = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[j].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[j].scale = 0.5f; + Main.dust[j].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int k = 0; k < 70; k++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int stompDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 3f); + Main.dust[stompDust].noGravity = true; + Main.dust[stompDust].velocity *= 5f; + stompDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f); + Main.dust[stompDust].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index ec310e38d8..057201c028 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -230,16 +230,16 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (NPC.ai[0] < 3f || bossRush || (death && NPC.ai[0] > 3f))) //spawn shield for phase 0 1 2, not 3 4 5 { SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); - int num6 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); - NPC.ai[2] = num6 + 1; + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; NPC.localAI[1] = -1f; NPC.netUpdate = true; - Main.npc[num6].ai[0] = NPC.whoAmI; - Main.npc[num6].netUpdate = true; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; } - int num7 = (int)NPC.ai[2] - 1; - if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) + int shieldTracker = (int)NPC.ai[2] - 1; + if (shieldTracker != -1 && Main.npc[shieldTracker].active && Main.npc[shieldTracker].type == ModContent.NPCType()) { NPC.dontTakeDamage = true; } @@ -292,21 +292,20 @@ namespace CalamityMod.NPCs.Cryogen int spawnType = Main.zenithWorld ? NPCID.RedDevil : NPCID.IceGolem; if (!NPC.AnyNPCs(spawnType)) { - int num167 = 1000; - for (int num168 = 0; num168 < num167; num168++) + for (int i = 0; i < 1000; i++) { - int num169 = (int)(NPC.Center.X / 16f) + Main.rand.Next(-50, 51); - int num170; - for (num170 = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-50, 51); num170 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num169, num170); num170++) + int enemySpawnX = (int)(NPC.Center.X / 16f) + Main.rand.Next(-50, 51); + int enemySpawnY; + for (enemySpawnY = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-50, 51); enemySpawnY < Main.maxTilesY - 10 && !WorldGen.SolidTile(enemySpawnX, enemySpawnY); enemySpawnY++) { } - num170--; - if (!WorldGen.SolidTile(num169, num170)) + enemySpawnY--; + if (!WorldGen.SolidTile(enemySpawnX, enemySpawnY)) { - int num171 = NPC.NewNPC(NPC.GetSource_FromAI(), num169 * 16 + 8, num170 * 16, spawnType); - if (Main.netMode == NetmodeID.Server && num171 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171); + int legendEnemySpawn = NPC.NewNPC(NPC.GetSource_FromAI(), enemySpawnX * 16 + 8, enemySpawnY * 16, spawnType); + if (Main.netMode == NetmodeID.Server && legendEnemySpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, legendEnemySpawn); break; } @@ -352,8 +351,8 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); } } } @@ -382,31 +381,31 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); } } } } - Vector2 vector142 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); + Vector2 cryogenCenter = new Vector2(NPC.Center.X, NPC.Center.Y); + float playerXDist = player.Center.X - cryogenCenter.X; + float playerYDist = player.Center.Y - cryogenCenter.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - float num1246 = revenge ? 5f : 4f; - num1246 += 4f * enrageScale; + float cryogenSpeed = revenge ? 5f : 4f; + cryogenSpeed += 4f * enrageScale; - num1245 = num1246 / num1245; - num1243 *= num1245; - num1244 *= num1245; + playerDistance = cryogenSpeed / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; float inertia = 50f; if (Main.getGoodWorld) inertia *= 0.5f; - NPC.velocity.X = (NPC.velocity.X * inertia + num1243) / (inertia + 1f); - NPC.velocity.Y = (NPC.velocity.Y * inertia + num1244) / (inertia + 1f); + NPC.velocity.X = (NPC.velocity.X * inertia + playerXDist) / (inertia + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia + playerYDist) / (inertia + 1f); if (phase2) { @@ -443,8 +442,8 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = new Vector2(0f, -velocity2); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); } } } @@ -527,8 +526,8 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); for (int k = 0; k < totalProjectilesShot; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, velocity); } } } @@ -619,31 +618,31 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); } } } } - Vector2 vector142 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); + Vector2 cryogenCenter = new Vector2(NPC.Center.X, NPC.Center.Y); + float playerXDist = player.Center.X - cryogenCenter.X; + float playerYDist = player.Center.Y - cryogenCenter.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - float num1246 = revenge ? 7f : 6f; - num1246 += 4f * enrageScale; + float cryogenSpeed = revenge ? 7f : 6f; + cryogenSpeed += 4f * enrageScale; - num1245 = num1246 / num1245; - num1243 *= num1245; - num1244 *= num1245; + playerDistance = cryogenSpeed / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; float inertia = 50f; if (Main.getGoodWorld) inertia *= 0.5f; - NPC.velocity.X = (NPC.velocity.X * inertia + num1243) / (inertia + 1f); - NPC.velocity.Y = (NPC.velocity.Y * inertia + num1244) / (inertia + 1f); + NPC.velocity.X = (NPC.velocity.X * inertia + playerXDist) / (inertia + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia + playerYDist) / (inertia + 1f); } else if (NPC.ai[1] < chargeGateValue) { @@ -675,8 +674,8 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = i == 1 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); for (int k = 0; k < totalProjectilesShot; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, velocity); } } } @@ -769,31 +768,31 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); } } } } - Vector2 vector142 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); + Vector2 cryogenCenter = new Vector2(NPC.Center.X, NPC.Center.Y); + float playerXDist = player.Center.X - cryogenCenter.X; + float playerYDist = player.Center.Y - cryogenCenter.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); float speed = revenge ? 5.5f : 5f; speed += 3f * enrageScale; - num1245 = speed / num1245; - num1243 *= num1245; - num1244 *= num1245; + playerDistance = speed / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; float inertia = 50f; if (Main.getGoodWorld) inertia *= 0.5f; - NPC.velocity.X = (NPC.velocity.X * inertia + num1243) / (inertia + 1f); - NPC.velocity.Y = (NPC.velocity.Y * inertia + num1244) / (inertia + 1f); + NPC.velocity.X = (NPC.velocity.X * inertia + playerXDist) / (inertia + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia + playerYDist) / (inertia + 1f); if (NPC.ai[1] == 0f) { @@ -804,37 +803,37 @@ namespace CalamityMod.NPCs.Cryogen { NPC.TargetClosest(); NPC.localAI[2] = 0f; - int num1249 = 0; - int num1250; - int num1251; + int attackTimer = 0; + int playerTileX; + int playerTileY; while (true) { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; + attackTimer++; + playerTileX = (int)player.Center.X / 16; + playerTileY = (int)player.Center.Y / 16; int min = 16; int max = 20; if (Main.rand.NextBool()) - num1250 += Main.rand.Next(min, max); + playerTileX += Main.rand.Next(min, max); else - num1250 -= Main.rand.Next(min, max); + playerTileX -= Main.rand.Next(min, max); if (Main.rand.NextBool()) - num1251 += Main.rand.Next(min, max); + playerTileY += Main.rand.Next(min, max); else - num1251 -= Main.rand.Next(min, max); + playerTileY -= Main.rand.Next(min, max); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2(num1250 * 16, num1251 * 16), 1, 1, player.position, player.width, player.height)) + if (!WorldGen.SolidTile(playerTileX, playerTileY) && Collision.CanHit(new Vector2(playerTileX * 16, playerTileY * 16), 1, 1, player.position, player.width, player.height)) break; - if (num1249 > 100) + if (attackTimer > 100) goto Block; } NPC.ai[1] = 1f; - teleportLocationX = num1250; - calamityGlobalNPC.newAI[2] = num1251; + teleportLocationX = playerTileX; + calamityGlobalNPC.newAI[2] = playerTileY; NPC.netUpdate = true; Block: ; @@ -861,8 +860,8 @@ namespace CalamityMod.NPCs.Cryogen for (int n = 0; n < 15; n++) { - int num39 = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[num39].noGravity = true; + int iceDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[iceDust].noGravity = true; } if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) @@ -890,8 +889,8 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, velocity); } } } @@ -976,8 +975,8 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, ai, 1f); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, ai, 1f); } } } @@ -1012,29 +1011,29 @@ namespace CalamityMod.NPCs.Cryogen return; } - float num1372 = 18f + enrageScale * 2f; + float chargeVelMult = 18f + enrageScale * 2f; - Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); - float num1373 = player.position.X + player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; + Vector2 chargeDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); + float playerchargeXDist = player.position.X + player.width * 0.5f - chargeDirection.X; + float playerchargeYDist = player.Center.Y - chargeDirection.Y; + float playerDistance = (float)Math.Sqrt(playerchargeXDist * playerchargeXDist + playerchargeYDist * playerchargeYDist); + float chargeSpeed = chargeVelMult / playerDistance; + playerchargeXDist *= chargeSpeed; + playerchargeYDist *= chargeSpeed; calamityGlobalNPC.newAI[2] -= 1f; float chargeStartDistance = 300f; float chargeCooldown = 30f; - if (num1375 < chargeStartDistance || calamityGlobalNPC.newAI[2] > 0f) + if (playerDistance < chargeStartDistance || calamityGlobalNPC.newAI[2] > 0f) { - if (num1375 < chargeStartDistance) + if (playerDistance < chargeStartDistance) calamityGlobalNPC.newAI[2] = chargeCooldown; - if (NPC.velocity.Length() < num1372) + if (NPC.velocity.Length() < chargeVelMult) { NPC.velocity.Normalize(); - NPC.velocity *= num1372; + NPC.velocity *= chargeVelMult; } NPC.rotation += NPC.direction * 0.5f; @@ -1046,17 +1045,17 @@ namespace CalamityMod.NPCs.Cryogen if (Main.getGoodWorld) inertia *= 0.5f; - NPC.velocity.X = (NPC.velocity.X * inertia + num1373) / (inertia + 1f); - NPC.velocity.Y = (NPC.velocity.Y * inertia + num1374) / (inertia + 1f); - if (num1375 < chargeStartDistance + 200f) + NPC.velocity.X = (NPC.velocity.X * inertia + playerchargeXDist) / (inertia + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia + playerchargeYDist) / (inertia + 1f); + if (playerDistance < chargeStartDistance + 200f) { - NPC.velocity.X = (NPC.velocity.X * 9f + num1373) / 10f; - NPC.velocity.Y = (NPC.velocity.Y * 9f + num1374) / 10f; + NPC.velocity.X = (NPC.velocity.X * 9f + playerchargeXDist) / 10f; + NPC.velocity.Y = (NPC.velocity.Y * 9f + playerchargeYDist) / 10f; } - if (num1375 < chargeStartDistance + 100f) + if (playerDistance < chargeStartDistance + 100f) { - NPC.velocity.X = (NPC.velocity.X * 4f + num1373) / 5f; - NPC.velocity.Y = (NPC.velocity.Y * 4f + num1374) / 5f; + NPC.velocity.X = (NPC.velocity.X * 4f + playerchargeXDist) / 5f; + NPC.velocity.Y = (NPC.velocity.Y * 4f + playerchargeYDist) / 5f; } NPC.rotation = NPC.velocity.X * 0.15f; @@ -1081,8 +1080,8 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity2) : new Vector2(velocityX, -velocity2); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer); + Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); } } @@ -1250,23 +1249,23 @@ namespace CalamityMod.NPCs.Cryogen } if (NPC.life <= 0) { - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int icyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); + Main.dust[icyDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[icyDust].scale = 0.5f; + Main.dust[icyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); + Main.dust[icyDust2].noGravity = true; + Main.dust[icyDust2].velocity *= 5f; + icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); + Main.dust[icyDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server && !Main.zenithWorld) { @@ -1361,18 +1360,18 @@ namespace CalamityMod.NPCs.Cryogen { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 40f * NPC.scale; } diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index 246b7cc930..491b00ee4d 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -71,14 +71,14 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.type == ModContent.NPCType()) { - int num989 = (int)NPC.ai[0]; - if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType()) + int mainCryogen = (int)NPC.ai[0]; + if (Main.npc[mainCryogen].active && Main.npc[mainCryogen].type == ModContent.NPCType()) { NPC.velocity = Vector2.Zero; - NPC.position = Main.npc[num989].Center; - NPC.ai[1] = Main.npc[num989].velocity.X; - NPC.ai[2] = Main.npc[num989].velocity.Y; - NPC.ai[3] = Main.npc[num989].target; + NPC.position = Main.npc[mainCryogen].Center; + NPC.ai[1] = Main.npc[mainCryogen].velocity.X; + NPC.ai[2] = Main.npc[mainCryogen].velocity.Y; + NPC.ai[3] = Main.npc[mainCryogen].target; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); return; @@ -95,18 +95,18 @@ namespace CalamityMod.NPCs.Cryogen { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= (100f * NPC.scale) && NPC.Opacity == 1f; } @@ -165,24 +165,24 @@ namespace CalamityMod.NPCs.Cryogen } if (NPC.life <= 0) { - for (int num621 = 0; num621 < 25; num621++) + for (int i = 0; i < 25; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int icyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); + Main.dust[icyDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[icyDust].scale = 0.5f; + Main.dust[icyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 50; num623++) + for (int j = 0; j < 50; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); + Main.dust[icyDust2].noGravity = true; + Main.dust[icyDust2].velocity *= 5f; + icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); + Main.dust[icyDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server && !Main.zenithWorld) @@ -192,11 +192,11 @@ namespace CalamityMod.NPCs.Cryogen Vector2 spinningPoint = new Vector2(0f, -1f); for (int k = 0; k < totalGores; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Vector2 goreRotation = spinningPoint.RotatedBy(radians * k); for (int x = 1; x <= 4; x++) { float randomSpread = Main.rand.Next(-200, 201) / 100f; - Gore.NewGore(NPC.GetSource_Death(), NPC.Center + Vector2.Normalize(vector255) * 80f, vector255 * new Vector2(NPC.ai[1], NPC.ai[2]) * randomSpread, Mod.Find("CryoShieldGore" + x).Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center + Vector2.Normalize(goreRotation) * 80f, goreRotation * new Vector2(NPC.ai[1], NPC.ai[2]) * randomSpread, Mod.Find("CryoShieldGore" + x).Type, NPC.scale); } } } diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index 800bf83d00..0b2b291868 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -93,40 +93,39 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + playerXPos = (float)((int)(playerXPos / 16f) * 16); + playerYPos = (float)((int)(playerYPos / 16f) * 16); + segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16); + segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16); + playerXPos -= segmentTilePos.X; + playerYPos -= segmentTilePos.Y; + float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X; + playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = NPC.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f; + playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); + playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance; + playerXPos *= playerDistance; + playerYPos *= playerDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + playerXPos; + NPC.position.Y = NPC.position.Y + playerYPos; - if (num191 < 0f) + if (playerXPos < 0f) NPC.spriteDirection = 1; - else if (num191 > 0f) + else if (playerXPos > 0f) NPC.spriteDirection = -1; } } diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 31a770695d..9c0732dded 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -100,51 +100,50 @@ namespace CalamityMod.NPCs.DesertScourge NPC.ai[2] = (float)NPC.whoAmI; NPC.realLife = NPC.whoAmI; int num2 = NPC.whoAmI; - int num3 = maxLength; - for (int j = 0; j <= num3; j++) + for (int j = 0; j <= maxLength; j++) { - int num4 = ModContent.NPCType(); - if (j == num3) + int segmentType = ModContent.NPCType(); + if (j == maxLength) { - num4 = ModContent.NPCType(); + segmentType = ModContent.NPCType(); } - int num5 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (float)(NPC.width / 2)), (int)(NPC.position.Y + (float)NPC.height), num4, NPC.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num5].ai[2] = (float)NPC.whoAmI; - Main.npc[num5].realLife = NPC.whoAmI; - Main.npc[num5].ai[1] = (float)num2; - Main.npc[num2].ai[0] = (float)num5; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); - num2 = num5; + int segmentSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (float)(NPC.width / 2)), (int)(NPC.position.Y + (float)NPC.height), segmentType, NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[segmentSpawn].ai[2] = (float)NPC.whoAmI; + Main.npc[segmentSpawn].realLife = NPC.whoAmI; + Main.npc[segmentSpawn].ai[1] = (float)num2; + Main.npc[num2].ai[0] = (float)segmentSpawn; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentSpawn, 0f, 0f, 0f, 0, 0, 0); + num2 = segmentSpawn; } TailSpawned = true; } } - int num12 = (int)(NPC.position.X / 16f) - 1; - int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; - int num14 = (int)(NPC.position.Y / 16f) - 1; - int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; - if (num12 < 0) + int tilePositionX = (int)(NPC.position.X / 16f) - 1; + int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int tilePositionY = (int)(NPC.position.Y / 16f) - 1; + int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; + if (tilePositionX < 0) { - num12 = 0; + tilePositionX = 0; } - if (num13 > Main.maxTilesX) + if (tileWidthPosX > Main.maxTilesX) { - num13 = Main.maxTilesX; + tileWidthPosX = Main.maxTilesX; } - if (num14 < 0) + if (tilePositionY < 0) { - num14 = 0; + tilePositionY = 0; } - if (num15 > Main.maxTilesY) + if (tileWidthPosY > Main.maxTilesY) { - num15 = Main.maxTilesY; + tileWidthPosY = Main.maxTilesY; } - bool flag2 = false; - if (!flag2) + bool shouldFly = false; + if (!shouldFly) { - for (int k = num12; k < num13; k++) + for (int k = tilePositionX; k < tileWidthPosX; k++) { - for (int l = num14; l < num15; l++) + for (int l = tilePositionY; l < tileWidthPosY; l++) { if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) { @@ -153,36 +152,36 @@ namespace CalamityMod.NPCs.DesertScourge vector2.Y = (float)(l * 16); if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) { - flag2 = true; + shouldFly = true; break; } } } } } - if (!flag2) + if (!shouldFly) { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int num16 = 1000; - bool flag3 = true; + int directChaseDistance = 1000; + bool shouldDirectlyChase = true; if (NPC.position.Y > Main.player[NPC.target].position.Y) { for (int m = 0; m < 255; m++) { if (Main.player[m].active) { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - directChaseDistance, (int)Main.player[m].position.Y - directChaseDistance, directChaseDistance * 2, directChaseDistance * 2); if (rectangle.Intersects(rectangle2)) { - flag3 = false; + shouldDirectlyChase = false; break; } } } - if (flag3) + if (shouldDirectlyChase) { - flag2 = true; + shouldFly = true; } } } @@ -190,15 +189,15 @@ namespace CalamityMod.NPCs.DesertScourge { NPC.localAI[1] = 0f; } - float num17 = 16f; + float maxChaseSpeed = 16f; if (Main.player[NPC.target].dead) { - flag2 = false; + shouldFly = false; NPC.velocity.Y = NPC.velocity.Y + 1f; if ((double)NPC.position.Y > Main.worldSurface * 16.0) { NPC.velocity.Y = NPC.velocity.Y + 1f; - num17 = 32f; + maxChaseSpeed = 32f; } if ((double)NPC.position.Y > Main.rockLayer * 16.0) { @@ -212,62 +211,62 @@ namespace CalamityMod.NPCs.DesertScourge } } } - float num18 = speed; - float num19 = turnSpeed; + float speedCopy = speed; + float turnSpeedCopy = turnSpeed; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) { - num18 *= 1.5f; - num19 *= 1.5f; + speedCopy *= 1.5f; + turnSpeedCopy *= 1.5f; } - Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num20 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float num21 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (!flag2) + Vector2 npcCenter = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float playerX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targettingPosition = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + playerX = (float)((int)(playerX / 16f) * 16); + targettingPosition = (float)((int)(targettingPosition / 16f) * 16); + npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16); + npcCenter.Y = (float)((int)(npcCenter.Y / 16f) * 16); + playerX -= npcCenter.X; + targettingPosition -= npcCenter.Y; + float targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); + if (!shouldFly) { NPC.TargetClosest(); NPC.velocity.Y = NPC.velocity.Y + 0.15f; - if (NPC.velocity.Y > num17) + if (NPC.velocity.Y > maxChaseSpeed) { - NPC.velocity.Y = num17; + NPC.velocity.Y = maxChaseSpeed; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4) { if (NPC.velocity.X < 0f) { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; } else { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; } } - else if (NPC.velocity.Y == num17) + else if (NPC.velocity.Y == maxChaseSpeed) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } } else if (NPC.velocity.Y > 4f) { if (NPC.velocity.X < 0f) { - NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f; } else { - NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f; } } } @@ -275,131 +274,131 @@ namespace CalamityMod.NPCs.DesertScourge { if (NPC.soundDelay == 0) { - float num24 = num22 / 40f; - if (num24 < 10f) + float soundDelay = targetDistance / 40f; + if (soundDelay < 10f) { - num24 = 10f; + soundDelay = 10f; } - if (num24 > 20f) + if (soundDelay > 20f) { - num24 = 20f; + soundDelay = 20f; } - NPC.soundDelay = (int)num24; + NPC.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = num17 / num22; - num20 *= num27; - num21 *= num27; - if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) + targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); + float absolutePlayerX = Math.Abs(playerX); + float absoluteTargetPos = Math.Abs(targettingPosition); + float timeToReachTarget = maxChaseSpeed / targetDistance; + playerX *= timeToReachTarget; + targettingPosition *= timeToReachTarget; + if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num19; + NPC.velocity.X = NPC.velocity.X + turnSpeedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num19; + NPC.velocity.X = NPC.velocity.X - turnSpeedCopy; } - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y + num19; + NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y - num19; + NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy; } } - if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) + if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + speedCopy; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - speedCopy; } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) + if ((double)Math.Abs(targettingPosition) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f; } else { - NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) + if ((double)Math.Abs(playerX) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 2f; } else { - NPC.velocity.X = NPC.velocity.X - num18 * 2f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 2f; } } } - else if (num25 > num26) + else if (absolutePlayerX > absoluteTargetPos) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + speedCopy; } else { - NPC.velocity.Y = NPC.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - speedCopy; } } } else { - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } else { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } } } } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - if (flag2) + if (shouldFly) { if (NPC.localAI[0] != 1f) { diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index 26bba2e479..4d71065aab 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -93,40 +93,39 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + playerXPos = (float)((int)(playerXPos / 16f) * 16); + playerYPos = (float)((int)(playerYPos / 16f) * 16); + segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16); + segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16); + playerXPos -= segmentTilePos.X; + playerYPos -= segmentTilePos.Y; + float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X; + playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = NPC.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f; + playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); + playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance; + playerXPos *= playerDistance; + playerYPos *= playerDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + playerXPos; + NPC.position.Y = NPC.position.Y + playerYPos; - if (num191 < 0f) + if (playerXPos < 0f) NPC.spriteDirection = 1; - else if (num191 > 0f) + else if (playerXPos > 0f) NPC.spriteDirection = -1; } } diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 2b44b423b2..3154b76c7e 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -109,40 +109,39 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + playerXPos = (float)((int)(playerXPos / 16f) * 16); + playerYPos = (float)((int)(playerYPos / 16f) * 16); + segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16); + segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16); + playerXPos -= segmentTilePos.X; + playerYPos -= segmentTilePos.Y; + float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X; + playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = NPC.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f; + playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); + playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance; + playerXPos *= playerDistance; + playerYPos *= playerDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + playerXPos; + NPC.position.Y = NPC.position.Y + playerYPos; - if (num191 < 0f) + if (playerXPos < 0f) NPC.spriteDirection = 1; - else if (num191 > 0f) + else if (playerXPos > 0f) NPC.spriteDirection = -1; } } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 9a7a223f9a..8e2bc456cf 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -232,10 +232,10 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.getGoodWorld) minLength *= 3; - for (int num36 = 0; num36 < minLength + 1; num36++) + for (int i = 0; i < minLength + 1; i++) { int lol; - if (num36 >= 0 && num36 < minLength) + if (i >= 0 && i < minLength) { lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } @@ -300,32 +300,32 @@ namespace CalamityMod.NPCs.DesertScourge } } - int num12 = (int)(NPC.position.X / 16f) - 1; - int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; - int num14 = (int)(NPC.position.Y / 16f) - 1; - int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; - if (num12 < 0) + int tilePositionX = (int)(NPC.position.X / 16f) - 1; + int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int tilePositionY = (int)(NPC.position.Y / 16f) - 1; + int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; + if (tilePositionX < 0) { - num12 = 0; + tilePositionX = 0; } - if (num13 > Main.maxTilesX) + if (tileWidthPosX > Main.maxTilesX) { - num13 = Main.maxTilesX; + tileWidthPosX = Main.maxTilesX; } - if (num14 < 0) + if (tilePositionY < 0) { - num14 = 0; + tilePositionY = 0; } - if (num15 > Main.maxTilesY) + if (tileWidthPosY > Main.maxTilesY) { - num15 = Main.maxTilesY; + tileWidthPosY = Main.maxTilesY; } - bool flag2 = lungeUpward; - if (!flag2) + bool shouldFly = lungeUpward; + if (!shouldFly) { - for (int k = num12; k < num13; k++) + for (int k = tilePositionX; k < tileWidthPosX; k++) { - for (int l = num14; l < num15; l++) + for (int l = tilePositionY; l < tileWidthPosY; l++) { if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) { @@ -334,43 +334,43 @@ namespace CalamityMod.NPCs.DesertScourge vector2.Y = (float)(l * 16); if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) { - flag2 = true; + shouldFly = true; break; } } } } } - if (!flag2) + if (!shouldFly) { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int num954 = 1000; + int directChaseDistance = 1000; if (enrageScale > 0f) - num954 = 100; + directChaseDistance = 100; - bool flag3 = true; + bool shouldDirectlyChase = true; if (NPC.position.Y > player.position.Y) { - int rectWidth = num954 * 2; - int rectHeight = num954 * 2; + int rectWidth = directChaseDistance * 2; + int rectHeight = directChaseDistance * 2; for (int m = 0; m < 255; m++) { if (Main.player[m].active) { - int rectX = (int)Main.player[m].position.X - num954; - int rectY = (int)Main.player[m].position.Y - num954; - Rectangle rectangle13 = new Rectangle(rectX, rectY, rectWidth, rectHeight); - if (rectangle.Intersects(rectangle13)) + int rectX = (int)Main.player[m].position.X - directChaseDistance; + int rectY = (int)Main.player[m].position.Y - directChaseDistance; + Rectangle directChaseRect = new Rectangle(rectX, rectY, rectWidth, rectHeight); + if (rectangle.Intersects(directChaseRect)) { - flag3 = false; + shouldDirectlyChase = false; break; } } } - if (flag3) + if (shouldDirectlyChase) { - flag2 = true; + shouldFly = true; } } } @@ -379,15 +379,15 @@ namespace CalamityMod.NPCs.DesertScourge NPC.localAI[1] = 0f; } - float num17 = 16f; + float maxChaseSpeed = 16f; if (player.dead) { - flag2 = false; + shouldFly = false; NPC.velocity.Y += 1f; if ((double)NPC.position.Y > Main.worldSurface * 16.0) { NPC.velocity.Y += 1f; - num17 = 32f; + maxChaseSpeed = 32f; } if ((double)NPC.position.Y > Main.rockLayer * 16.0) { @@ -402,21 +402,21 @@ namespace CalamityMod.NPCs.DesertScourge } } - float num18 = speed; - float num19 = turnSpeed; + float speedCopy = speed; + float turnSpeedCopy = turnSpeed; float burrowDistance = bossRush ? 500f : 800f; float burrowTarget = player.Center.Y + burrowDistance; float lungeTarget = NPC.Calamity().newAI[3]; - Vector2 vector3 = NPC.Center; - float num20 = player.Center.X; - float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + Vector2 npcCenter = NPC.Center; + float playerX = player.Center.X; + float targettingPosition = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; + playerX = (float)((int)(playerX / 16f) * 16); + targettingPosition = (float)((int)(targettingPosition / 16f) * 16); + npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16); + npcCenter.Y = (float)((int)(npcCenter.Y / 16f) * 16); + playerX -= npcCenter.X; + targettingPosition -= npcCenter.Y; + float targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); // Lunge up towards target if (burrow && NPC.Center.Y >= burrowTarget - 16f) @@ -481,45 +481,45 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().newAI[1] = 0f; } - if (!flag2) + if (!shouldFly) { NPC.TargetClosest(); NPC.velocity.Y = NPC.velocity.Y + 0.15f; - if (NPC.velocity.Y > num17) + if (NPC.velocity.Y > maxChaseSpeed) { - NPC.velocity.Y = num17; + NPC.velocity.Y = maxChaseSpeed; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4) { if (NPC.velocity.X < 0f) { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; } else { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; } } - else if (NPC.velocity.Y == num17) + else if (NPC.velocity.Y == maxChaseSpeed) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } } else if (NPC.velocity.Y > 4f) { if (NPC.velocity.X < 0f) { - NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f; } else { - NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f; } } } @@ -527,131 +527,131 @@ namespace CalamityMod.NPCs.DesertScourge { if (NPC.soundDelay == 0) { - float num24 = num22 / 40f; - if (num24 < 10f) + float soundDelay = targetDistance / 40f; + if (soundDelay < 10f) { - num24 = 10f; + soundDelay = 10f; } - if (num24 > 20f) + if (soundDelay > 20f) { - num24 = 20f; + soundDelay = 20f; } - NPC.soundDelay = (int)num24; + NPC.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = num17 / num22; - num20 *= num27; - num21 *= num27; - if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) + targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); + float absolutePlayerX = Math.Abs(playerX); + float absoluteTargetPos = Math.Abs(targettingPosition); + float timeToReachTarget = maxChaseSpeed / targetDistance; + playerX *= timeToReachTarget; + targettingPosition *= timeToReachTarget; + if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num19; + NPC.velocity.X = NPC.velocity.X + turnSpeedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num19; + NPC.velocity.X = NPC.velocity.X - turnSpeedCopy; } - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y + num19; + NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y - num19; + NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy; } } - if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) + if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + speedCopy; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - speedCopy; } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) + if ((double)Math.Abs(targettingPosition) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f; } else { - NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) + if ((double)Math.Abs(playerX) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 2f; } else { - NPC.velocity.X = NPC.velocity.X - num18 * 2f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 2f; } } } - else if (num25 > num26) + else if (absolutePlayerX > absoluteTargetPos) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + speedCopy; } else { - NPC.velocity.Y = NPC.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - speedCopy; } } } else { - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } else { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } } } } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - if (flag2) + if (shouldFly) { if (NPC.localAI[0] != 1f) { diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 606841f272..733473bad9 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -108,40 +108,40 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + playerXPos = (float)((int)(playerXPos / 16f) * 16); + playerYPos = (float)((int)(playerYPos / 16f) * 16); + segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16); + segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16); + playerXPos -= segmentTilePos.X; + playerYPos -= segmentTilePos.Y; + float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X; + playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = NPC.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f; + playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); + int playerDistance = NPC.width; + playerDistance = (playerDistance - (float)playerDistance) / playerDistance; + playerXPos *= playerDistance; + playerYPos *= playerDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + playerXPos; + NPC.position.Y = NPC.position.Y + playerYPos; - if (num191 < 0f) + if (playerXPos < 0f) NPC.spriteDirection = 1; - else if (num191 > 0f) + else if (playerXPos > 0f) NPC.spriteDirection = -1; } } From 87b560470aee7cb38a058c1077fadbf2b7695ee8 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 22 Oct 2023 21:41:50 -0400 Subject: [PATCH 13/43] Devourer of Gods --- NPCs/DevourerofGods/CosmicGuardianBody.cs | 78 +-- NPCs/DevourerofGods/CosmicGuardianHead.cs | 170 +++--- NPCs/DevourerofGods/CosmicGuardianTail.cs | 78 +-- NPCs/DevourerofGods/DevourerofGodsBody.cs | 62 +-- NPCs/DevourerofGods/DevourerofGodsHead.cs | 642 +++++++++++----------- NPCs/DevourerofGods/DevourerofGodsTail.cs | 108 ++-- 6 files changed, 569 insertions(+), 569 deletions(-) diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 953fa54f05..f9eda53cda 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -106,36 +106,36 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + Vector2 segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + segmentPosition.X = (int)(segmentPosition.X / 16f) * 16; + segmentPosition.Y = (int)(segmentPosition.Y / 16f) * 16; + targetX -= segmentPosition.X; + targetY -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; - num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + 1.57f; + targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - segmentWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + targetX; + NPC.position.Y = NPC.position.Y + targetY; } } @@ -146,17 +146,17 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianBodyGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -190,23 +190,23 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = 50; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].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[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; } } } diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index 3a3476c303..24aa6058cd 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -175,151 +175,151 @@ namespace CalamityMod.NPCs.DevourerofGods return; } - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.npc[CalamityGlobalNPC.DoGHead].position.X + (Main.npc[CalamityGlobalNPC.DoGHead].width / 2); - float num192 = Main.npc[CalamityGlobalNPC.DoGHead].position.Y + (Main.npc[CalamityGlobalNPC.DoGHead].height / 2); - float num188 = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f; - float num189 = BossRushEvent.BossRushActive ? 0.9f : CalamityWorld.revenge ? 0.75f : 0.23f; + Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float dogHeadX = Main.npc[CalamityGlobalNPC.DoGHead].position.X + (Main.npc[CalamityGlobalNPC.DoGHead].width / 2); + float dogHeadY = Main.npc[CalamityGlobalNPC.DoGHead].position.Y + (Main.npc[CalamityGlobalNPC.DoGHead].height / 2); + float maxDistanceFromDoG = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f; + float velocityMult = BossRushEvent.BossRushActive ? 0.9f : CalamityWorld.revenge ? 0.75f : 0.23f; if (increaseSpeedMore) - num189 *= 4f; + velocityMult *= 4f; else if (increaseSpeed) - num189 *= 2f; + velocityMult *= 2f; - for (int num52 = 0; num52 < Main.maxNPCs; num52++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num52].active && (Main.npc[num52].type == NPC.type || Main.npc[num52].type == ModContent.NPCType()) && num52 != NPC.whoAmI) + if (Main.npc[i].active && (Main.npc[i].type == NPC.type || Main.npc[i].type == ModContent.NPCType()) && i != NPC.whoAmI) { - Vector2 vector4 = Main.npc[num52].Center - NPC.Center; - if (vector4.Length() < 400f) + Vector2 distFromHead = Main.npc[i].Center - NPC.Center; + if (distFromHead.Length() < 400f) { - vector4.Normalize(); - vector4 *= 400f; - num191 -= vector4.X; - num192 -= vector4.Y; + distFromHead.Normalize(); + distFromHead *= 400f; + dogHeadX -= distFromHead.X; + dogHeadY -= distFromHead.Y; } } } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = NPC.velocity.Length(); - if (num50 > 0f) + float higherMaxDistance = maxDistanceFromDoG * 1.3f; + float lowerMaxDistance = maxDistanceFromDoG * 0.7f; + float npcSpeed = NPC.velocity.Length(); + if (npcSpeed > 0f) { - if (num50 > num48) + if (npcSpeed > higherMaxDistance) { NPC.velocity.Normalize(); - NPC.velocity *= num48; + NPC.velocity *= higherMaxDistance; } - else if (num50 < num49) + else if (npcSpeed < lowerMaxDistance) { NPC.velocity.Normalize(); - NPC.velocity *= num49; + NPC.velocity *= lowerMaxDistance; } } - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - float num196 = Math.Abs(num191); - float num197 = Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) + dogHeadX = (int)(dogHeadX / 16f) * 16; + dogHeadY = (int)(dogHeadY / 16f) * 16; + segmentDirection.X = (int)(segmentDirection.X / 16f) * 16; + segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16; + dogHeadX -= segmentDirection.X; + dogHeadY -= segmentDirection.Y; + float targetDistance = (float)Math.Sqrt(dogHeadX * dogHeadX + dogHeadY * dogHeadY); + float absoluteDoGX = Math.Abs(dogHeadX); + float absoluteDoGY = Math.Abs(dogHeadY); + float timeToReachTarget = maxDistanceFromDoG / targetDistance; + dogHeadX *= timeToReachTarget; + dogHeadY *= timeToReachTarget; + if ((NPC.velocity.X > 0f && dogHeadX > 0f) || (NPC.velocity.X < 0f && dogHeadX < 0f) || (NPC.velocity.Y > 0f && dogHeadY > 0f) || (NPC.velocity.Y < 0f && dogHeadY < 0f)) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < dogHeadX) { - NPC.velocity.X = NPC.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + velocityMult; } else { - if (NPC.velocity.X > num191) + if (NPC.velocity.X > dogHeadX) { - NPC.velocity.X = NPC.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - velocityMult; } } - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < dogHeadY) { - NPC.velocity.Y = NPC.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + velocityMult; } else { - if (NPC.velocity.Y > num192) + if (NPC.velocity.Y > dogHeadY) { - NPC.velocity.Y = NPC.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - velocityMult; } } - if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(dogHeadY) < maxDistanceFromDoG * 0.2 && ((NPC.velocity.X > 0f && dogHeadX < 0f) || (NPC.velocity.X < 0f && dogHeadX > 0f))) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y + velocityMult * 2f; } else { - NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - velocityMult * 2f; } } - if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(dogHeadX) < maxDistanceFromDoG * 0.2 && ((NPC.velocity.Y > 0f && dogHeadY < 0f) || (NPC.velocity.Y < 0f && dogHeadY > 0f))) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X + velocityMult * 2f; //changed from 2 } else { - NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X - velocityMult * 2f; //changed from 2 } } } else { - if (num196 > num197) + if (absoluteDoGX > absoluteDoGY) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < dogHeadX) { - NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X + velocityMult * 1.1f; //changed from 1.1 } - else if (NPC.velocity.X > num191) + else if (NPC.velocity.X > dogHeadX) { - NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X - velocityMult * 1.1f; //changed from 1.1 } - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxDistanceFromDoG * 0.5) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + velocityMult; } else { - NPC.velocity.Y = NPC.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - velocityMult; } } } else { - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < dogHeadY) { - NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + velocityMult * 1.1f; } - else if (NPC.velocity.Y > num192) + else if (NPC.velocity.Y > dogHeadY) { - NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - velocityMult * 1.1f; } - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxDistanceFromDoG * 0.5) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + velocityMult; } else { - NPC.velocity.X = NPC.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - velocityMult; } } } @@ -337,22 +337,22 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 distFromHead3 = NPC.Center - screenPos; + distFromHead3 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + distFromHead3 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow2").Value; - color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -395,23 +395,23 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = 50; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].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[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; } } } diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index 5549188e1a..f7688b5818 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -103,36 +103,36 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + Vector2 segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + segmentPosition.X = (int)(segmentPosition.X / 16f) * 16; + segmentPosition.Y = (int)(segmentPosition.Y / 16f) * 16; + targetX -= segmentPosition.X; + targetY -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; - num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + 1.57f; + targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - segmentWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + targetX; + NPC.position.Y = NPC.position.Y + targetY; } } @@ -143,17 +143,17 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianTailGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -182,23 +182,23 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = 50; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].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[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index b39908370b..6fe4455bfe 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -365,27 +365,27 @@ namespace CalamityMod.NPCs.DevourerofGods bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS").Value : TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); + Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (!NPC.dontTakeDamage) { if (useOtherTextures) { texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow").Value; - Color color36 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color36, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + Color glowmaskColor2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor2, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } if (disintegrationFactor > 0f) @@ -400,18 +400,18 @@ namespace CalamityMod.NPCs.DevourerofGods Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= (phase2Started ? 55f : 40f) * NPC.scale && NPC.Opacity >= 1f && invinceTime <= 0; } @@ -478,23 +478,23 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = (int)(100 * NPC.scale); NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 4c6c3efa3d..aa673bc98f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -1023,19 +1023,19 @@ namespace CalamityMod.NPCs.DevourerofGods } // Movement - int num180 = (int)(NPC.position.X / 16f) - 1; - int num181 = (int)((NPC.position.X + NPC.width) / 16f) + 2; - int num182 = (int)(NPC.position.Y / 16f) - 1; - int num183 = (int)((NPC.position.Y + NPC.height) / 16f) + 2; + int tilePositionX = (int)(NPC.position.X / 16f) - 1; + int tileWidthPosX = (int)((NPC.position.X + NPC.width) / 16f) + 2; + int tilePositionY = (int)(NPC.position.Y / 16f) - 1; + int tileWidthPosY = (int)((NPC.position.Y + NPC.height) / 16f) + 2; - if (num180 < 0) - num180 = 0; - if (num181 > Main.maxTilesX) - num181 = Main.maxTilesX; - if (num182 < 0) - num182 = 0; - if (num183 > Main.maxTilesY) - num183 = Main.maxTilesY; + if (tilePositionX < 0) + tilePositionX = 0; + if (tileWidthPosX > Main.maxTilesX) + tileWidthPosX = Main.maxTilesX; + if (tilePositionY < 0) + tilePositionY = 0; + if (tileWidthPosY > Main.maxTilesY) + tileWidthPosY = Main.maxTilesY; if (NPC.velocity.X < 0f) NPC.spriteDirection = -1; @@ -1073,160 +1073,160 @@ namespace CalamityMod.NPCs.DevourerofGods else calamityGlobalNPC.newAI[2] += 2f; - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = NPC.Center; - float num191 = destination.X; - float num192 = destination.Y; - int num42 = -1; - int num43 = (int)(destination.X / 16f); - int num44 = (int)(destination.Y / 16f); + float speedCopy = speed; + float turnSpeedCopy = turnSpeed; + Vector2 npcCenter = NPC.Center; + float targetX = destination.X; + float targetY = destination.Y; + int flyYLevel = -1; + int destinationTileX = (int)(destination.X / 16f); + int destinationTileY = (int)(destination.Y / 16f); // Charge at target for 1.5 seconds bool flyAtTarget = (!phase4 || spawnedGuardians3) && calamityGlobalNPC.newAI[2] > phaseLimit - 90 && revenge; - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + for (int i = destinationTileX - 2; i <= destinationTileX + 2; i++) { - for (int num46 = num44; num46 <= num44 + 15; num46++) + for (int j = destinationTileY; j <= destinationTileY + 15; j++) { - if (WorldGen.SolidTile2(num45, num46)) + if (WorldGen.SolidTile2(i, j)) { - num42 = num46; + flyYLevel = j; break; } } - if (num42 > 0) + if (flyYLevel > 0) break; } if (!flyAtTarget && destination == player.Center) { - if (num42 > 0) + if (flyYLevel > 0) { - num42 *= 16; - float num47 = num42 - 800; - if (player.position.Y > num47) + flyYLevel *= 16; + float chaseFlyLevel = flyYLevel - 800; + if (player.position.Y > chaseFlyLevel) { - num192 = num47; + targetY = chaseFlyLevel; if (Math.Abs(NPC.Center.X - destination.X) < 500f) { if (NPC.velocity.X > 0f) - num191 = destination.X + 600f; + targetX = destination.X + 600f; else - num191 = destination.X - 600f; + targetX = destination.X - 600f; } } } } else { - num188 = homingSpeed; - num189 = homingTurnSpeed; + speedCopy = homingSpeed; + turnSpeedCopy = homingTurnSpeed; } - num188 += Vector2.Distance(destination, NPC.Center) * 0.005f; - num189 += Vector2.Distance(destination, NPC.Center) * 0.00025f; + speedCopy += Vector2.Distance(destination, NPC.Center) * 0.005f; + turnSpeedCopy += Vector2.Distance(destination, NPC.Center) * 0.00025f; if (CalamityWorld.LegendaryMode && revenge) { if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(10f)) - num188 *= 2f; + speedCopy *= 2f; } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = NPC.velocity.Length(); - if (num50 > 0f) + float fasterSpeedMult = speedCopy * 1.3f; + float slowerSpeedMult = speedCopy * 0.7f; + float npcSpeed = NPC.velocity.Length(); + if (npcSpeed > 0f) { - if (num50 > num48) + if (npcSpeed > fasterSpeedMult) { NPC.velocity.Normalize(); - NPC.velocity *= num48; + NPC.velocity *= fasterSpeedMult; } - else if (num50 < num49) + else if (npcSpeed < slowerSpeedMult) { NPC.velocity.Normalize(); - NPC.velocity *= num49; + NPC.velocity *= slowerSpeedMult; } } - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - float num196 = Math.Abs(num191); - float num197 = Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + npcCenter.X = (int)(npcCenter.X / 16f) * 16; + npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; + targetX -= npcCenter.X; + targetY -= npcCenter.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float absoluteTargetX = Math.Abs(targetX); + float absoluteTargetY = Math.Abs(targetY); + float timeToReachTarget = speedCopy / targetDistance; + targetX *= timeToReachTarget; + targetY *= timeToReachTarget; - if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f) || (NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f)) { - if (NPC.velocity.X < num191) - NPC.velocity.X += num189; + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy; else { - if (NPC.velocity.X > num191) - NPC.velocity.X -= num189; + if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy; } - if (NPC.velocity.Y < num192) - NPC.velocity.Y += num189; + if (NPC.velocity.Y < targetY) + NPC.velocity.Y += turnSpeedCopy; else { - if (NPC.velocity.Y > num192) - NPC.velocity.Y -= num189; + if (NPC.velocity.Y > targetY) + NPC.velocity.Y -= turnSpeedCopy; } - if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(targetY) < speedCopy * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) - NPC.velocity.Y += num189 * 2f; + NPC.velocity.Y += turnSpeedCopy * 2f; else - NPC.velocity.Y -= num189 * 2f; + NPC.velocity.Y -= turnSpeedCopy * 2f; } - if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(targetX) < speedCopy * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) - NPC.velocity.X += num189 * 2f; + NPC.velocity.X += turnSpeedCopy * 2f; else - NPC.velocity.X -= num189 * 2f; + NPC.velocity.X -= turnSpeedCopy * 2f; } } else { - if (num196 > num197) + if (absoluteTargetX > absoluteTargetY) { - if (NPC.velocity.X < num191) - NPC.velocity.X += num189 * 1.1f; - else if (NPC.velocity.X > num191) - NPC.velocity.X -= num189 * 1.1f; + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy * 1.1f; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < speedCopy * 0.5) { if (NPC.velocity.Y > 0f) - NPC.velocity.Y += num189; + NPC.velocity.Y += turnSpeedCopy; else - NPC.velocity.Y -= num189; + NPC.velocity.Y -= turnSpeedCopy; } } else { - if (NPC.velocity.Y < num192) - NPC.velocity.Y += num189 * 1.1f; - else if (NPC.velocity.Y > num192) - NPC.velocity.Y -= num189 * 1.1f; + if (NPC.velocity.Y < targetY) + NPC.velocity.Y += turnSpeedCopy * 1.1f; + else if (NPC.velocity.Y > targetY) + NPC.velocity.Y -= turnSpeedCopy * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < speedCopy * 0.5) { if (NPC.velocity.X > 0f) - NPC.velocity.X += num189; + NPC.velocity.X += turnSpeedCopy; else - NPC.velocity.X -= num189; + NPC.velocity.X -= turnSpeedCopy; } } } @@ -1296,16 +1296,16 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { - for (int num952 = num180; num952 < num181; num952++) + for (int r = tilePositionX; r < tileWidthPosX; r++) { - for (int num953 = num182; num953 < num183; num953++) + for (int s = tilePositionY; s < tileWidthPosY; s++) { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].HasUnactuatedTile && (Main.tileSolid[Main.tile[num952, num953].TileType] || (Main.tileSolidTop[Main.tile[num952, num953].TileType] && Main.tile[num952, num953].TileFrameY == 0))) || Main.tile[num952, num953].LiquidAmount > 64)) + if (Main.tile[r, s] != null && ((Main.tile[r, s].HasUnactuatedTile && (Main.tileSolid[Main.tile[r, s].TileType] || (Main.tileSolidTop[Main.tile[r, s].TileType] && Main.tile[r, s].TileFrameY == 0))) || Main.tile[r, s].LiquidAmount > 64)) { - Vector2 vector105; - vector105.X = num952 * 16; - vector105.Y = num953 * 16; - if (NPC.position.X + NPC.width > vector105.X && NPC.position.X < vector105.X + 16f && NPC.position.Y + NPC.height > vector105.Y && NPC.position.Y < vector105.Y + 16f) + Vector2 positionCheck; + positionCheck.X = r * 16; + positionCheck.Y = s * 16; + if (NPC.position.X + NPC.width > positionCheck.X && NPC.position.X < positionCheck.X + 16f && NPC.position.Y + NPC.height > positionCheck.Y && NPC.position.Y < positionCheck.Y + 16f) { flies = true; break; @@ -1321,46 +1321,46 @@ namespace CalamityMod.NPCs.DevourerofGods Rectangle rectangle12 = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int num954 = death ? 1125 : 1200; + int directChargeRange = death ? 1125 : 1200; if (expertMode) - num954 -= (int)(150f * (1f - lifeRatio)); + directChargeRange -= (int)(150f * (1f - lifeRatio)); - if (num954 < 1050) - num954 = 1050; + if (directChargeRange < 1050) + directChargeRange = 1050; - bool flag95 = true; + bool canDirectlyCharge = true; if (NPC.position.Y > player.position.Y) { - for (int num955 = 0; num955 < Main.maxPlayers; num955++) + for (int k = 0; k < Main.maxPlayers; k++) { - if (Main.player[num955].active) + if (Main.player[k].active) { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - 1000, (int)Main.player[num955].position.Y - 1000, 2000, num954); + Rectangle rectangle13 = new Rectangle((int)Main.player[k].position.X - 1000, (int)Main.player[k].position.Y - 1000, 2000, directChargeRange); if (rectangle12.Intersects(rectangle13)) { - flag95 = false; + canDirectlyCharge = false; break; } } } - if (flag95) + if (canDirectlyCharge) flies = true; } } else NPC.localAI[1] = 0f; - float num189 = groundPhaseTurnSpeed; - Vector2 vector18 = NPC.Center; - float num191 = destination.X; - float num192 = destination.Y; - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; + float turnSpeedCopy = groundPhaseTurnSpeed; + Vector2 npcCenter = NPC.Center; + float targetX = destination.X; + float targetY = destination.Y; + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + npcCenter.X = (int)(npcCenter.X / 16f) * 16; + npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; + targetX -= npcCenter.X; + targetY -= npcCenter.Y; if (!flies) { @@ -1371,23 +1371,23 @@ namespace CalamityMod.NPCs.DevourerofGods if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 2.2) { if (NPC.velocity.X < 0f) - NPC.velocity.X -= num189 * 1.1f; + NPC.velocity.X -= turnSpeedCopy * 1.1f; else - NPC.velocity.X += num189 * 1.1f; + NPC.velocity.X += turnSpeedCopy * 1.1f; } else if (NPC.velocity.Y == fallSpeed) { - if (NPC.velocity.X < num191) - NPC.velocity.X += num189; - else if (NPC.velocity.X > num191) - NPC.velocity.X -= num189; + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy; } else if (NPC.velocity.Y > 4f) { if (NPC.velocity.X < 0f) - NPC.velocity.X += num189 * 0.9f; + NPC.velocity.X += turnSpeedCopy * 0.9f; else - NPC.velocity.X -= num189 * 0.9f; + NPC.velocity.X -= turnSpeedCopy * 0.9f; } } else @@ -1401,39 +1401,39 @@ namespace CalamityMod.NPCs.DevourerofGods maximumSpeed2 += 0.2f * (1f - lifeRatio); } - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - float num25 = Math.Abs(num191); - float num26 = Math.Abs(num192); - float num27 = fallSpeed / num193; - num191 *= num27; - num192 *= num27; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float absoluteTargetX2 = Math.Abs(targetX); + float absoluteTargetY2 = Math.Abs(targetY); + float timeToReachTarget2 = fallSpeed / targetDistance; + targetX *= timeToReachTarget2; + targetY *= timeToReachTarget2; - if (((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f)) && ((NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f))) + if (((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f)) && ((NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f))) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < targetX) NPC.velocity.X += groundPhaseTurnSpeed * 1.5f; - else if (NPC.velocity.X > num191) + else if (NPC.velocity.X > targetX) NPC.velocity.X -= groundPhaseTurnSpeed * 1.5f; - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < targetY) NPC.velocity.Y += groundPhaseTurnSpeed * 1.5f; - else if (NPC.velocity.Y > num192) + else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed * 1.5f; } - if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f) || (NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f)) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < targetX) NPC.velocity.X += groundPhaseTurnSpeed; - else if (NPC.velocity.X > num191) + else if (NPC.velocity.X > targetX) NPC.velocity.X -= groundPhaseTurnSpeed; - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < targetY) NPC.velocity.Y += groundPhaseTurnSpeed; - else if (NPC.velocity.Y > num192) + else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed; - if (Math.Abs(num192) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(targetY) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) NPC.velocity.Y += groundPhaseTurnSpeed * 2f; @@ -1441,7 +1441,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.Y -= groundPhaseTurnSpeed * 2f; } - if (Math.Abs(num191) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(targetX) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) NPC.velocity.X += groundPhaseTurnSpeed * 2f; @@ -1449,11 +1449,11 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.X -= groundPhaseTurnSpeed * 2f; } } - else if (num25 > num26) + else if (absoluteTargetX2 > absoluteTargetY2) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < targetX) NPC.velocity.X += groundPhaseTurnSpeed * 1.1f; - else if (NPC.velocity.X > num191) + else if (NPC.velocity.X > targetX) NPC.velocity.X -= groundPhaseTurnSpeed * 1.1f; if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) @@ -1466,9 +1466,9 @@ namespace CalamityMod.NPCs.DevourerofGods } else { - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < targetY) NPC.velocity.Y += groundPhaseTurnSpeed * 1.1f; - else if (NPC.velocity.Y > num192) + else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed * 1.1f; if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) @@ -1813,19 +1813,19 @@ namespace CalamityMod.NPCs.DevourerofGods } // Movement - int num180 = (int)(NPC.position.X / 16f) - 1; - int num181 = (int)((NPC.position.X + NPC.width) / 16f) + 2; - int num182 = (int)(NPC.position.Y / 16f) - 1; - int num183 = (int)((NPC.position.Y + NPC.height) / 16f) + 2; + int tilePositionX = (int)(NPC.position.X / 16f) - 1; + int tileWidthPosX = (int)((NPC.position.X + NPC.width) / 16f) + 2; + int tilePositionY = (int)(NPC.position.Y / 16f) - 1; + int tileWidthPosY = (int)((NPC.position.Y + NPC.height) / 16f) + 2; - if (num180 < 0) - num180 = 0; - if (num181 > Main.maxTilesX) - num181 = Main.maxTilesX; - if (num182 < 0) - num182 = 0; - if (num183 > Main.maxTilesY) - num183 = Main.maxTilesY; + if (tilePositionX < 0) + tilePositionX = 0; + if (tileWidthPosX > Main.maxTilesX) + tileWidthPosX = Main.maxTilesX; + if (tilePositionY < 0) + tilePositionY = 0; + if (tileWidthPosY > Main.maxTilesY) + tileWidthPosY = Main.maxTilesY; if (NPC.velocity.X < 0f) NPC.spriteDirection = -1; @@ -1852,157 +1852,157 @@ namespace CalamityMod.NPCs.DevourerofGods else if (increaseSpeed) calamityGlobalNPC.newAI[2] += 2f; - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - int num42 = -1; - int num43 = (int)(destination.X / 16f); - int num44 = (int)(destination.Y / 16f); + float speedCopy = speed; + float turnSpeedCopy = turnSpeed; + Vector2 npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = player.position.X + (player.width / 2); + float targetY = player.position.Y + (player.height / 2); + int flyYLevel = -1; + int destinationTileX = (int)(destination.X / 16f); + int destinationTileY = (int)(destination.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + for (int i = destinationTileX - 2; i <= destinationTileX + 2; i++) { - for (int num46 = num44; num46 <= num44 + 15; num46++) + for (int j = destinationTileY; j <= destinationTileY + 15; j++) { - if (WorldGen.SolidTile2(num45, num46)) + if (WorldGen.SolidTile2(i, j)) { - num42 = num46; + flyYLevel = j; break; } } - if (num42 > 0) + if (flyYLevel > 0) break; } - if (num42 > 0) + if (flyYLevel > 0) { - num42 *= 16; - float num47 = num42 - 800; - if (player.position.Y > num47) + flyYLevel *= 16; + float chaseFlyLevel = flyYLevel - 800; + if (player.position.Y > chaseFlyLevel) { - num192 = num47; + targetY = chaseFlyLevel; if (Math.Abs(NPC.Center.X - destination.X) < 500f) { if (NPC.velocity.X > 0f) - num191 = destination.X + 600f; + targetX = destination.X + 600f; else - num191 = destination.X - 600f; + targetX = destination.X - 600f; } } } else { - num188 = homingSpeed; - num189 = homingTurnSpeed; + speedCopy = homingSpeed; + turnSpeedCopy = homingTurnSpeed; } if (expertMode) { - num188 += distanceFromTarget * 0.005f * (1f - lifeRatio); - num189 += distanceFromTarget * 0.0001f * (1f - lifeRatio); + speedCopy += distanceFromTarget * 0.005f * (1f - lifeRatio); + turnSpeedCopy += distanceFromTarget * 0.0001f * (1f - lifeRatio); } if (CalamityWorld.LegendaryMode && revenge) { if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(10f)) - num188 *= 2f; + speedCopy *= 2f; } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = NPC.velocity.Length(); - if (num50 > 0f) + float fasterSpeedMult = speedCopy * 1.3f; + float slowerSpeedMult = speedCopy * 0.7f; + float npcSpeed = NPC.velocity.Length(); + if (npcSpeed > 0f) { - if (num50 > num48) + if (npcSpeed > fasterSpeedMult) { NPC.velocity.Normalize(); - NPC.velocity *= num48; + NPC.velocity *= fasterSpeedMult; } - else if (num50 < num49) + else if (npcSpeed < slowerSpeedMult) { NPC.velocity.Normalize(); - NPC.velocity *= num49; + NPC.velocity *= slowerSpeedMult; } } - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - float num196 = Math.Abs(num191); - float num197 = Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + npcCenter.X = (int)(npcCenter.X / 16f) * 16; + npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; + targetX -= npcCenter.X; + targetY -= npcCenter.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float absoluteTargetX = Math.Abs(targetX); + float absoluteTargetY = Math.Abs(targetY); + float timeToReachTarget = speedCopy / targetDistance; + targetX *= timeToReachTarget; + targetY *= timeToReachTarget; - if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f) || (NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f)) { - if (NPC.velocity.X < num191) - NPC.velocity.X += num189; + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy; else { - if (NPC.velocity.X > num191) - NPC.velocity.X -= num189; + if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy; } - if (NPC.velocity.Y < num192) - NPC.velocity.Y += num189; + if (NPC.velocity.Y < targetY) + NPC.velocity.Y += turnSpeedCopy; else { - if (NPC.velocity.Y > num192) - NPC.velocity.Y -= num189; + if (NPC.velocity.Y > targetY) + NPC.velocity.Y -= turnSpeedCopy; } - if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(targetY) < speedCopy * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) - NPC.velocity.Y += num189 * 2f; + NPC.velocity.Y += turnSpeedCopy * 2f; else - NPC.velocity.Y -= num189 * 2f; + NPC.velocity.Y -= turnSpeedCopy * 2f; } - if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(targetX) < speedCopy * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) - NPC.velocity.X += num189 * 2f; + NPC.velocity.X += turnSpeedCopy * 2f; else - NPC.velocity.X -= num189 * 2f; + NPC.velocity.X -= turnSpeedCopy * 2f; } } else { - if (num196 > num197) + if (absoluteTargetX > absoluteTargetY) { - if (NPC.velocity.X < num191) - NPC.velocity.X += num189 * 1.1f; - else if (NPC.velocity.X > num191) - NPC.velocity.X -= num189 * 1.1f; + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy * 1.1f; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < speedCopy * 0.5) { if (NPC.velocity.Y > 0f) - NPC.velocity.Y += num189; + NPC.velocity.Y += turnSpeedCopy; else - NPC.velocity.Y -= num189; + NPC.velocity.Y -= turnSpeedCopy; } } else { - if (NPC.velocity.Y < num192) - NPC.velocity.Y += num189 * 1.1f; - else if (NPC.velocity.Y > num192) - NPC.velocity.Y -= num189 * 1.1f; + if (NPC.velocity.Y < targetY) + NPC.velocity.Y += turnSpeedCopy * 1.1f; + else if (NPC.velocity.Y > targetY) + NPC.velocity.Y -= turnSpeedCopy * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < speedCopy * 0.5) { if (NPC.velocity.X > 0f) - NPC.velocity.X += num189; + NPC.velocity.X += turnSpeedCopy; else - NPC.velocity.X -= num189; + NPC.velocity.X -= turnSpeedCopy; } } } @@ -2060,16 +2060,16 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { - for (int num952 = num180; num952 < num181; num952++) + for (int r = tilePositionX; r < tileWidthPosX; r++) { - for (int num953 = num182; num953 < num183; num953++) + for (int s = tilePositionY; s < tileWidthPosY; s++) { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].HasUnactuatedTile && (Main.tileSolid[Main.tile[num952, num953].TileType] || (Main.tileSolidTop[Main.tile[num952, num953].TileType] && Main.tile[num952, num953].TileFrameY == 0))) || Main.tile[num952, num953].LiquidAmount > 64)) + if (Main.tile[r, s] != null && ((Main.tile[r, s].HasUnactuatedTile && (Main.tileSolid[Main.tile[r, s].TileType] || (Main.tileSolidTop[Main.tile[r, s].TileType] && Main.tile[r, s].TileFrameY == 0))) || Main.tile[r, s].LiquidAmount > 64)) { - Vector2 vector105; - vector105.X = num952 * 16; - vector105.Y = num953 * 16; - if (NPC.position.X + NPC.width > vector105.X && NPC.position.X < vector105.X + 16f && NPC.position.Y + NPC.height > vector105.Y && NPC.position.Y < vector105.Y + 16f) + Vector2 positionCheck; + positionCheck.X = r * 16; + positionCheck.Y = s * 16; + if (NPC.position.X + NPC.width > positionCheck.X && NPC.position.X < positionCheck.X + 16f && NPC.position.Y + NPC.height > positionCheck.Y && NPC.position.Y < positionCheck.Y + 16f) { flies = true; break; @@ -2085,46 +2085,46 @@ namespace CalamityMod.NPCs.DevourerofGods Rectangle rectangle12 = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int num954 = death ? 1125 : 1200; + int directChargeRange = death ? 1125 : 1200; if (expertMode) - num954 -= (int)(150f * (1f - lifeRatio)); + directChargeRange -= (int)(150f * (1f - lifeRatio)); - if (num954 < 1050) - num954 = 1050; + if (directChargeRange < 1050) + directChargeRange = 1050; - bool flag95 = true; + bool canDirectlyCharge = true; if (NPC.position.Y > player.position.Y) { - for (int num955 = 0; num955 < 255; num955++) + for (int k = 0; k < 255; k++) { - if (Main.player[num955].active) + if (Main.player[k].active) { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - 1000, (int)Main.player[num955].position.Y - 1000, 2000, num954); + Rectangle rectangle13 = new Rectangle((int)Main.player[k].position.X - 1000, (int)Main.player[k].position.Y - 1000, 2000, directChargeRange); if (rectangle12.Intersects(rectangle13)) { - flag95 = false; + canDirectlyCharge = false; break; } } } - if (flag95) + if (canDirectlyCharge) flies = true; } } else NPC.localAI[1] = 0f; - float num189 = groundPhaseTurnSpeed; - Vector2 vector18 = NPC.Center; - float num191 = destination.X; - float num192 = destination.Y; - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; + float turnSpeedCopy = groundPhaseTurnSpeed; + Vector2 npcCenter = NPC.Center; + float targetX = destination.X; + float targetY = destination.Y; + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + npcCenter.X = (int)(npcCenter.X / 16f) * 16; + npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; + targetX -= npcCenter.X; + targetY -= npcCenter.Y; if (!flies) { @@ -2135,23 +2135,23 @@ namespace CalamityMod.NPCs.DevourerofGods if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 2.2) { if (NPC.velocity.X < 0f) - NPC.velocity.X -= num189 * 1.1f; + NPC.velocity.X -= turnSpeedCopy * 1.1f; else - NPC.velocity.X += num189 * 1.1f; + NPC.velocity.X += turnSpeedCopy * 1.1f; } else if (NPC.velocity.Y == fallSpeed) { - if (NPC.velocity.X < num191) - NPC.velocity.X += num189; - else if (NPC.velocity.X > num191) - NPC.velocity.X -= num189; + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy; } else if (NPC.velocity.Y > 4f) { if (NPC.velocity.X < 0f) - NPC.velocity.X += num189 * 0.9f; + NPC.velocity.X += turnSpeedCopy * 0.9f; else - NPC.velocity.X -= num189 * 0.9f; + NPC.velocity.X -= turnSpeedCopy * 0.9f; } } else @@ -2165,39 +2165,39 @@ namespace CalamityMod.NPCs.DevourerofGods maximumSpeed2 += 0.2f * (1f - lifeRatio); } - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - float num25 = Math.Abs(num191); - float num26 = Math.Abs(num192); - float num27 = fallSpeed / num193; - num191 *= num27; - num192 *= num27; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float absoluteTargetX2 = Math.Abs(targetX); + float absoluteTargetY2 = Math.Abs(targetY); + float timeToReachTarget2 = fallSpeed / targetDistance; + targetX *= timeToReachTarget2; + targetY *= timeToReachTarget2; - if (((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f)) && ((NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f))) + if (((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f)) && ((NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f))) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < targetX) NPC.velocity.X += groundPhaseTurnSpeed * 1.5f; - else if (NPC.velocity.X > num191) + else if (NPC.velocity.X > targetX) NPC.velocity.X -= groundPhaseTurnSpeed * 1.5f; - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < targetY) NPC.velocity.Y += groundPhaseTurnSpeed * 1.5f; - else if (NPC.velocity.Y > num192) + else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed * 1.5f; } - if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f) || (NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f)) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < targetX) NPC.velocity.X += groundPhaseTurnSpeed; - else if (NPC.velocity.X > num191) + else if (NPC.velocity.X > targetX) NPC.velocity.X -= groundPhaseTurnSpeed; - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < targetY) NPC.velocity.Y += groundPhaseTurnSpeed; - else if (NPC.velocity.Y > num192) + else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed; - if (Math.Abs(num192) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(targetY) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) NPC.velocity.Y += groundPhaseTurnSpeed * 2f; @@ -2205,7 +2205,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.Y -= groundPhaseTurnSpeed * 2f; } - if (Math.Abs(num191) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(targetX) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) NPC.velocity.X += groundPhaseTurnSpeed * 2f; @@ -2213,11 +2213,11 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.X -= groundPhaseTurnSpeed * 2f; } } - else if (num25 > num26) + else if (absoluteTargetX2 > absoluteTargetY2) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < targetX) NPC.velocity.X += groundPhaseTurnSpeed * 1.1f; - else if (NPC.velocity.X > num191) + else if (NPC.velocity.X > targetX) NPC.velocity.X -= groundPhaseTurnSpeed * 1.1f; if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) @@ -2230,9 +2230,9 @@ namespace CalamityMod.NPCs.DevourerofGods } else { - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < targetY) NPC.velocity.Y += groundPhaseTurnSpeed * 1.1f; - else if (NPC.velocity.Y > num192) + else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed * 1.1f; if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) @@ -2566,26 +2566,26 @@ namespace CalamityMod.NPCs.DevourerofGods bool useOtherTextures = (Phase2Started && NPC.localAI[2] <= 60f) || NPC.IsABestiaryIconDummy; Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadS").Value : TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); + Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); if (NPC.IsABestiaryIconDummy) NPC.frame = texture2D15.Frame(); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (!NPC.dontTakeDamage) { texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); + Color glowmaskLerp = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow2").Value; - color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + glowmaskLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } if (disintegrationFactor > 0f) @@ -2732,18 +2732,18 @@ namespace CalamityMod.NPCs.DevourerofGods Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= (Phase2Started ? 80f : 55f) * NPC.scale && (NPC.Opacity >= 1f || postTeleportTimer > 0); } @@ -2809,23 +2809,23 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = (int)(100 * NPC.scale); NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 4c043d0e79..1387a0a641 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -266,39 +266,39 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; } - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float playerXDist = player.position.X + (player.width / 2); + float playerYDist = player.position.Y + (player.height / 2); + playerXDist = (int)(playerXDist / 16f) * 16; + playerYDist = (int)(playerYDist / 16f) * 16; + segmentDirection.X = (int)(segmentDirection.X / 16f) * 16; + segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16; + playerXDist -= segmentDirection.X; + playerYDist -= segmentDirection.Y; + float playerDistance = (float)System.Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + playerXDist = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentDirection.X; + playerYDist = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentDirection.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2(playerYDist, playerXDist) + MathHelper.PiOver2; + playerDistance = (float)System.Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + int segmentWidth = NPC.width; + playerDistance = (playerDistance - segmentWidth) / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + playerXDist; + NPC.position.Y = NPC.position.Y + playerYDist; - if (num191 < 0f) + if (playerXDist < 0f) NPC.spriteDirection = -1; - else if (num191 > 0f) + else if (playerXDist > 0f) NPC.spriteDirection = 1; } } @@ -326,24 +326,24 @@ namespace CalamityMod.NPCs.DevourerofGods bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS").Value : TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); + Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawPosition = NPC.Center - screenPos; + drawPosition -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawPosition += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (!NPC.dontTakeDamage) { texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow2").Value; - color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } if (disintegrationFactor > 0f) @@ -358,18 +358,18 @@ namespace CalamityMod.NPCs.DevourerofGods Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= (phase2Started ? 70f : 35f) * NPC.scale && NPC.Opacity >= 1f; } @@ -395,23 +395,23 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = (int)(100 * NPC.scale); NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; } } } From 21e53c63a0fbc6efec3cd917fbc535828953b5a8 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 23 Oct 2023 00:11:46 -0400 Subject: [PATCH 14/43] Exos, Hive Mind, Levana --- NPCs/ExoMechs/Apollo/Apollo.cs | 36 +-- NPCs/ExoMechs/Ares/AresBody.cs | 16 +- NPCs/ExoMechs/Ares/AresGaussNuke.cs | 16 +- NPCs/ExoMechs/Ares/AresLaserCannon.cs | 16 +- NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs | 16 +- NPCs/ExoMechs/Ares/AresTeslaCannon.cs | 16 +- NPCs/ExoMechs/Artemis/Artemis.cs | 38 +-- NPCs/ExoMechs/Thanatos/ThanatosBody1.cs | 38 +-- NPCs/ExoMechs/Thanatos/ThanatosBody2.cs | 38 +-- NPCs/ExoMechs/Thanatos/ThanatosHead.cs | 38 +-- NPCs/ExoMechs/Thanatos/ThanatosTail.cs | 38 +-- NPCs/HiveMind/DankCreeper.cs | 34 +- NPCs/HiveMind/DarkHeart.cs | 66 ++-- NPCs/HiveMind/HiveBlob.cs | 87 +++-- NPCs/HiveMind/HiveBlob2.cs | 87 +++-- NPCs/HiveMind/HiveMind.cs | 94 +++--- NPCs/Leviathan/Anahita.cs | 136 ++++---- NPCs/Leviathan/AnahitasIceShield.cs | 18 +- NPCs/Leviathan/AquaticAberration.cs | 50 ++- NPCs/Leviathan/Leviathan.cs | 324 +++++++++---------- 20 files changed, 599 insertions(+), 603 deletions(-) diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 51e5a57441..5cc57db81f 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -1354,18 +1354,18 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.ChargeCombo; } @@ -1735,14 +1735,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int i = 0; i < 20; i++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 681e37913e..7507796074 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1607,18 +1607,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 7931ad3138..9fe7c496f7 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -665,18 +665,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 03a1228c90..4c6480bc00 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -715,18 +715,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 6d056c6235..121ea9d005 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -664,18 +664,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index e2f5026ff2..8dc30317a5 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -658,18 +658,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index e0b66c7179..a9df51f7de 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -1248,18 +1248,18 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.Charge; } @@ -1562,18 +1562,18 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 6ef5556299..b262f0b856 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -515,18 +515,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 50f && NPC.Opacity == 1f && noContactDamageTimer <= 0; } @@ -629,17 +629,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 7582176e24..8c4d93d0a7 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -517,18 +517,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 50f && NPC.Opacity == 1f && noContactDamageTimer <= 0; } @@ -632,18 +632,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 8f5ea05066..45d2c746ed 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -1018,18 +1018,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 50f && NPC.Opacity == 1f && noContactDamageTimer <= 0; } @@ -1265,18 +1265,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index ac1bba95a2..0dcdbf0711 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -515,18 +515,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 45f && NPC.Opacity == 1f && noContactDamageTimer <= 0; } @@ -630,18 +630,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.life <= 0) { - for (int num193 = 0; num193 < 2; num193++) + for (int i = 0; i < 2; i++) { Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int j = 0; j < 20; j++) { - int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[plasmaDust].noGravity = true; + Main.dust[plasmaDust].velocity *= 3f; + plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[plasmaDust].velocity *= 2f; + Main.dust[plasmaDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 16f694fa92..3ea8d6943c 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -65,17 +65,17 @@ namespace CalamityMod.NPCs.HiveMind NPC.rotation = NPC.velocity.X * 0.05f; - Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); - float num1373 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector167.X; - float num1374 = Main.player[NPC.target].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); - float num1376 = speed / num1375; - num1373 *= num1376; - num1374 *= num1376; + Vector2 targetDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); + float playerXDist = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - targetDirection.X; + float playerYDist = Main.player[NPC.target].Center.Y - targetDirection.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + float timeToReachTarget = speed / playerDistance; + playerXDist *= timeToReachTarget; + playerYDist *= timeToReachTarget; NPC.ai[0] -= 1f; - if (num1375 < 200f || NPC.ai[0] > 0f) + if (playerDistance < 200f || NPC.ai[0] > 0f) { - if (num1375 < 200f) + if (playerDistance < 200f) { NPC.ai[0] = 20f; } @@ -89,17 +89,17 @@ namespace CalamityMod.NPCs.HiveMind } return; } - NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; - NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) + NPC.velocity.X = (NPC.velocity.X * 50f + playerXDist) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + playerYDist) / 51f; + if (playerDistance < 350f) { - NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; - NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 10f + playerXDist) / 11f; + NPC.velocity.Y = (NPC.velocity.Y * 10f + playerYDist) / 11f; } - if (num1375 < 300f) + if (playerDistance < 300f) { - NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; - NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 7f + playerXDist) / 8f; + NPC.velocity.Y = (NPC.velocity.Y * 7f + playerYDist) / 8f; } } diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 5cb35d4be0..ac0d023d96 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -63,59 +63,59 @@ namespace CalamityMod.NPCs.HiveMind bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; NPC.TargetClosest(); - float num1164 = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 8f : revenge ? 4.5f : 4f; - float num1165 = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 1f : revenge ? 0.8f : 0.75f; + float npcSpeed = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 8f : revenge ? 4.5f : 4f; + float velocityMult = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 1f : revenge ? 0.8f : 0.75f; if (BossRushEvent.BossRushActive) { - num1164 *= 2f; - num1165 *= 2f; + npcSpeed *= 2f; + velocityMult *= 2f; } - Vector2 vector133 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num1166 = Main.player[NPC.target].Center.X - vector133.X; - float num1167 = Main.player[NPC.target].Center.Y - vector133.Y - ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 500f : 400f); - float num1168 = (float)Math.Sqrt(num1166 * num1166 + num1167 * num1167); - if (num1168 < ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : 20f)) + Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.Center.Y); + float playerXDist = Main.player[NPC.target].Center.X - npcCenter.X; + float playerYDist = Main.player[NPC.target].Center.Y - npcCenter.Y - ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 500f : 400f); + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + if (playerDistance < ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : 20f)) { - num1166 = NPC.velocity.X; - num1167 = NPC.velocity.Y; + playerXDist = NPC.velocity.X; + playerYDist = NPC.velocity.Y; } else { - num1168 = num1164 / num1168; - num1166 *= num1168; - num1167 *= num1168; + playerDistance = npcSpeed / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; } - if (NPC.velocity.X < num1166) + if (NPC.velocity.X < playerXDist) { - NPC.velocity.X = NPC.velocity.X + num1165; - if (NPC.velocity.X < 0f && num1166 > 0f) + NPC.velocity.X = NPC.velocity.X + velocityMult; + if (NPC.velocity.X < 0f && playerXDist > 0f) { - NPC.velocity.X = NPC.velocity.X + num1165 * 2f; + NPC.velocity.X = NPC.velocity.X + velocityMult * 2f; } } - else if (NPC.velocity.X > num1166) + else if (NPC.velocity.X > playerXDist) { - NPC.velocity.X = NPC.velocity.X - num1165; - if (NPC.velocity.X > 0f && num1166 < 0f) + NPC.velocity.X = NPC.velocity.X - velocityMult; + if (NPC.velocity.X > 0f && playerXDist < 0f) { - NPC.velocity.X = NPC.velocity.X - num1165 * 2f; + NPC.velocity.X = NPC.velocity.X - velocityMult * 2f; } } - if (NPC.velocity.Y < num1167) + if (NPC.velocity.Y < playerYDist) { - NPC.velocity.Y = NPC.velocity.Y + num1165; - if (NPC.velocity.Y < 0f && num1167 > 0f) + NPC.velocity.Y = NPC.velocity.Y + velocityMult; + if (NPC.velocity.Y < 0f && playerYDist > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num1165 * 2f; + NPC.velocity.Y = NPC.velocity.Y + velocityMult * 2f; } } - else if (NPC.velocity.Y > num1167) + else if (NPC.velocity.Y > playerYDist) { - NPC.velocity.Y = NPC.velocity.Y - num1165; - if (NPC.velocity.Y > 0f && num1167 < 0f) + NPC.velocity.Y = NPC.velocity.Y - velocityMult; + if (NPC.velocity.Y > 0f && playerYDist < 0f) { - NPC.velocity.Y = NPC.velocity.Y - num1165 * 2f; + NPC.velocity.Y = NPC.velocity.Y - velocityMult * 2f; } } if (NPC.position.X + NPC.width > Main.player[NPC.target].position.X && NPC.position.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width && NPC.position.Y + NPC.height < Main.player[NPC.target].position.Y && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && Main.netMode != NetmodeID.MultiplayerClient) @@ -124,12 +124,12 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.ai[0] >= (Main.getGoodWorld ? 12f : 24f)) { NPC.ai[0] = 0f; - int num1169 = (int)(NPC.position.X + 10f + Main.rand.Next(NPC.width - 20)); - int num1170 = (int)(NPC.position.Y + NPC.height + 4f); + int shaderainXPos = (int)(NPC.position.X + 10f + Main.rand.Next(NPC.width - 20)); + int shaderainYos = (int)(NPC.position.Y + NPC.height + 4f); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); float randomXVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.rand.NextFloat() * 5f : 0f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), num1169, num1170, randomXVelocity, 4f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shaderainXPos, shaderainYos, randomXVelocity, 4f, type, damage, 0f, Main.myPlayer); } } } diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 7eae50d146..f8799cd8c3 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -60,8 +60,8 @@ namespace CalamityMod.NPCs.HiveMind bool getFuckedAI = Main.zenithWorld; - int num750 = CalamityGlobalNPC.hiveMind; - if (num750 < 0 || !Main.npc[num750].active) + int hiveMind = CalamityGlobalNPC.hiveMind; + if (hiveMind < 0 || !Main.npc[hiveMind].active) { NPC.life = 0; NPC.HitEffect(); @@ -71,7 +71,7 @@ namespace CalamityMod.NPCs.HiveMind } if (NPC.ai[3] > 0f) - num750 = (int)NPC.ai[3] - 1; + hiveMind = (int)NPC.ai[3] - 1; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -88,45 +88,44 @@ namespace CalamityMod.NPCs.HiveMind NPC.TargetClosest(true); - float num751 = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; - float num752 = Main.getGoodWorld ? 256f : 128f; - Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); - float num189 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - vector22.X; - float num190 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt(num189 * num189 + num190 * num190); - float num754 = Main.npc[num750].position.X + (Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (Main.npc[num750].height / 2); - Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + NPC.ai[0]; - float num757 = num755 + NPC.ai[1]; - float num758 = num756 - vector93.X; - float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt(num758 * num758 + num759 * num759); - num760 = num752 / num760; - num758 *= num760; - num759 *= num760; - if (NPC.position.X < num754 + num758) + float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; + Vector2 randomLocationVector = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - randomLocationVector.X; + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - randomLocationVector.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float hiveMindX = Main.npc[hiveMind].position.X + (Main.npc[hiveMind].width / 2); + float hiveMindY = Main.npc[hiveMind].position.Y + (Main.npc[hiveMind].height / 2); + Vector2 hiveMindPos = new Vector2(hiveMindX, hiveMindY); + float randomPosX = hiveMindX + NPC.ai[0]; + float randomPosY = hiveMindY + NPC.ai[1]; + float finalRandPosX = randomPosX - hiveMindPos.X; + float finalRandPosY = randomPosY - hiveMindPos.Y; + float finalRandDistance = (float)Math.Sqrt(finalRandPosX * finalRandPosX + finalRandPosY * finalRandPosY); + finalRandDistance = (Main.getGoodWorld ? 256f : 128f) / finalRandDistance; + finalRandPosX *= finalRandDistance; + finalRandPosY *= finalRandDistance; + if (NPC.position.X < hiveMindX + finalRandPosX) { - NPC.velocity.X = NPC.velocity.X + num751; - if (NPC.velocity.X < 0f && num758 > 0f) + NPC.velocity.X = NPC.velocity.X + relocateSpeed; + if (NPC.velocity.X < 0f && finalRandPosX > 0f) NPC.velocity.X = NPC.velocity.X * 0.8f; } - else if (NPC.position.X > num754 + num758) + else if (NPC.position.X > hiveMindX + finalRandPosX) { - NPC.velocity.X = NPC.velocity.X - num751; - if (NPC.velocity.X > 0f && num758 < 0f) + NPC.velocity.X = NPC.velocity.X - relocateSpeed; + if (NPC.velocity.X > 0f && finalRandPosX < 0f) NPC.velocity.X = NPC.velocity.X * 0.8f; } - if (NPC.position.Y < num755 + num759) + if (NPC.position.Y < hiveMindY + finalRandPosY) { - NPC.velocity.Y = NPC.velocity.Y + num751; - if (NPC.velocity.Y < 0f && num759 > 0f) + NPC.velocity.Y = NPC.velocity.Y + relocateSpeed; + if (NPC.velocity.Y < 0f && finalRandPosY > 0f) NPC.velocity.Y = NPC.velocity.Y * 0.8f; } - else if (NPC.position.Y > num755 + num759) + else if (NPC.position.Y > hiveMindY + finalRandPosY) { - NPC.velocity.Y = NPC.velocity.Y - num751; - if (NPC.velocity.Y > 0f && num759 < 0f) + NPC.velocity.Y = NPC.velocity.Y - relocateSpeed; + if (NPC.velocity.Y > 0f && finalRandPosY < 0f) NPC.velocity.Y = NPC.velocity.Y * 0.8f; } @@ -152,26 +151,26 @@ namespace CalamityMod.NPCs.HiveMind NPC.TargetClosest(true); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - float num941 = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; + float projSpeed = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; if (Main.getGoodWorld) - num941 *= 2.4f; + projSpeed *= 2.4f; - Vector2 vector104 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2)); - float num942 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector104.X; - float num943 = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; + Vector2 projDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2)); + float playerX = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - projDirection.X; + float playerY = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - projDirection.Y; + float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY); + playerDist = projSpeed / playerDist; + playerX *= playerDist; + playerY *= playerDist; int type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); int damage = type == ProjectileID.CursedFlameHostile ? 30 : NPC.GetProjectileDamage(type); - Vector2 projectileVelocity = new Vector2(num942, num943); + Vector2 projectileVelocity = new Vector2(playerX, playerY); if (type == ProjectileID.CursedFlameHostile) { Vector2 v = Main.player[NPC.target].Center - NPC.Center - Main.player[NPC.target].velocity * 20f; - projectileVelocity = v.SafeNormalize(Vector2.UnitY) * num941; + projectileVelocity = v.SafeNormalize(Vector2.UnitY) * projSpeed; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector104, projectileVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projDirection, projectileVelocity, type, damage, 0f, Main.myPlayer); NPC.netUpdate = true; } } diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index 62bcc4dc41..d03b7d9c41 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -62,8 +62,8 @@ namespace CalamityMod.NPCs.HiveMind bool getFuckedAI = Main.zenithWorld; - int num750 = CalamityGlobalNPC.hiveMind; - if (num750 < 0 || !Main.npc[num750].active) + int hiveMind = CalamityGlobalNPC.hiveMind; + if (hiveMind < 0 || !Main.npc[hiveMind].active) { NPC.life = 0; NPC.HitEffect(); @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.HiveMind } if (NPC.ai[3] > 0f) - num750 = (int)NPC.ai[3] - 1; + hiveMind = (int)NPC.ai[3] - 1; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -90,45 +90,44 @@ namespace CalamityMod.NPCs.HiveMind NPC.TargetClosest(true); - float num751 = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; - float num752 = Main.getGoodWorld ? 192f : 96f; - Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); - float num189 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - vector22.X; - float num190 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt(num189 * num189 + num190 * num190); - float num754 = Main.npc[num750].position.X + (Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (Main.npc[num750].height / 2); - Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + NPC.ai[0]; - float num757 = num755 + NPC.ai[1]; - float num758 = num756 - vector93.X; - float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt(num758 * num758 + num759 * num759); - num760 = num752 / num760; - num758 *= num760; - num759 *= num760; - if (NPC.position.X < num754 + num758) + float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; + Vector2 randomRelocateVector = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - randomRelocateVector.X; + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - randomRelocateVector.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float hiveMindX = Main.npc[hiveMind].position.X + (Main.npc[hiveMind].width / 2); + float hiveMindY = Main.npc[hiveMind].position.Y + (Main.npc[hiveMind].height / 2); + Vector2 hiveMindPos = new Vector2(hiveMindX, hiveMindY); + float randomPosX = hiveMindX + NPC.ai[0]; + float randomPosY = hiveMindY + NPC.ai[1]; + float finalRandPosX = randomPosX - hiveMindPos.X; + float finalRandPosY = randomPosY - hiveMindPos.Y; + float finalRandDistance = (float)Math.Sqrt(finalRandPosX * finalRandPosX + finalRandPosY * finalRandPosY); + finalRandDistance = (Main.getGoodWorld ? 192f : 96f) / finalRandDistance; + finalRandPosX *= finalRandDistance; + finalRandPosY *= finalRandDistance; + if (NPC.position.X < hiveMindX + finalRandPosX) { - NPC.velocity.X = NPC.velocity.X + num751; - if (NPC.velocity.X < 0f && num758 > 0f) + NPC.velocity.X = NPC.velocity.X + relocateSpeed; + if (NPC.velocity.X < 0f && finalRandPosX > 0f) NPC.velocity.X = NPC.velocity.X * 0.8f; } - else if (NPC.position.X > num754 + num758) + else if (NPC.position.X > hiveMindX + finalRandPosX) { - NPC.velocity.X = NPC.velocity.X - num751; - if (NPC.velocity.X > 0f && num758 < 0f) + NPC.velocity.X = NPC.velocity.X - relocateSpeed; + if (NPC.velocity.X > 0f && finalRandPosX < 0f) NPC.velocity.X = NPC.velocity.X * 0.8f; } - if (NPC.position.Y < num755 + num759) + if (NPC.position.Y < hiveMindY + finalRandPosY) { - NPC.velocity.Y = NPC.velocity.Y + num751; - if (NPC.velocity.Y < 0f && num759 > 0f) + NPC.velocity.Y = NPC.velocity.Y + relocateSpeed; + if (NPC.velocity.Y < 0f && finalRandPosY > 0f) NPC.velocity.Y = NPC.velocity.Y * 0.8f; } - else if (NPC.position.Y > num755 + num759) + else if (NPC.position.Y > hiveMindY + finalRandPosY) { - NPC.velocity.Y = NPC.velocity.Y - num751; - if (NPC.velocity.Y > 0f && num759 < 0f) + NPC.velocity.Y = NPC.velocity.Y - relocateSpeed; + if (NPC.velocity.Y > 0f && finalRandPosY < 0f) NPC.velocity.Y = NPC.velocity.Y * 0.8f; } @@ -154,26 +153,26 @@ namespace CalamityMod.NPCs.HiveMind NPC.TargetClosest(true); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - float num941 = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; + float projSpeed = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; if (Main.getGoodWorld) - num941 *= 2.4f; + projSpeed *= 2.4f; - Vector2 vector104 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2)); - float num942 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector104.X; - float num943 = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; + Vector2 projDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2)); + float playerX = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - projDirection.X; + float playerY = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - projDirection.Y; + float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY); + playerDist = projSpeed / playerDist; + playerX *= playerDist; + playerY *= playerDist; int type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); int damage = type == ProjectileID.CursedFlameHostile ? 30 : NPC.GetProjectileDamage(type); - Vector2 projectileVelocity = new Vector2(num942, num943); + Vector2 projectileVelocity = new Vector2(playerX, playerY); if (type == ProjectileID.CursedFlameHostile) { Vector2 v = Main.player[NPC.target].Center - NPC.Center - Main.player[NPC.target].velocity * 20f; - projectileVelocity = v.SafeNormalize(Vector2.UnitY) * num941; + projectileVelocity = v.SafeNormalize(Vector2.UnitY) * projSpeed; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector104, projectileVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projDirection, projectileVelocity, type, damage, 0f, Main.myPlayer); NPC.netUpdate = true; } } diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index d4f7e75840..0d711521f0 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -526,15 +526,15 @@ namespace CalamityMod.NPCs.HiveMind { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)(NPC.lifeMax * 0.05); - if ((NPC.life + num660) < NPC.ai[3]) + int fivePercentHP = (int)(NPC.lifeMax * 0.05); + if ((NPC.life + fivePercentHP) < NPC.ai[3]) { NPC.ai[3] = NPC.life; int maxSpawns = bossRush ? 10 : death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); int maxDankSpawns = bossRush ? 4 : death ? Main.rand.Next(2, 4) : revenge ? 2 : expertMode ? Main.rand.Next(1, 3) : 1; - for (int num662 = 0; num662 < maxSpawns; num662++) + for (int i = 0; i < maxSpawns; i++) { int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32)); @@ -543,10 +543,10 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.CountNPCS(ModContent.NPCType()) < maxDankSpawns) type = ModContent.NPCType(); - int num664 = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type); - Main.npc[num664].SetDefaults(type); - if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + int fivePercentMinions = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type); + Main.npc[fivePercentMinions].SetDefaults(type); + if (Main.netMode == NetmodeID.Server && fivePercentMinions < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, fivePercentMinions, 0f, 0f, 0f, 0, 0, 0); } return; @@ -571,21 +571,21 @@ namespace CalamityMod.NPCs.HiveMind NPC.scale += 0.0165f; NPC.alpha -= 4; - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); - Main.dust[num622].velocity *= 2f; + int burrowedDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); + Main.dust[burrowedDust].velocity *= 2f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[burrowedDust].scale = 0.5f; + Main.dust[burrowedDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } for (int i = 0; i < 2; i++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 3.5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); - Main.dust[num624].velocity *= 1f; + int burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale); + Main.dust[burrowedDust2].noGravity = true; + Main.dust[burrowedDust2].velocity *= 3.5f; + burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); + Main.dust[burrowedDust2].velocity *= 1f; } } else if (burrowTimer == -60) @@ -612,21 +612,21 @@ namespace CalamityMod.NPCs.HiveMind NPC.scale -= 0.0165f; NPC.alpha += 4; - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); - Main.dust[num622].velocity *= 2f; + int burrowedDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); + Main.dust[burrowedDust].velocity *= 2f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[burrowedDust].scale = 0.5f; + Main.dust[burrowedDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } for (int i = 0; i < 2; i++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 3.5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); - Main.dust[num624].velocity *= 1f; + int burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale); + Main.dust[burrowedDust2].noGravity = true; + Main.dust[burrowedDust2].velocity *= 3.5f; + burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); + Main.dust[burrowedDust2].velocity *= 1f; } } else if (burrowTimer == 0) @@ -1019,18 +1019,18 @@ namespace CalamityMod.NPCs.HiveMind { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 60f && NPC.alpha == 0 && NPC.scale == 1f; // No damage while not fully visible or shrunk } @@ -1103,23 +1103,23 @@ namespace CalamityMod.NPCs.HiveMind NPC.height = 150; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int killDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f); + Main.dust[killDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[killDust].scale = 0.5f; + Main.dust[killDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int killDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 3f); + Main.dust[killDust2].noGravity = true; + Main.dust[killDust2].velocity *= 5f; + killDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f); + Main.dust[killDust2].velocity *= 2f; } } } diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 69e6ba6dfd..6007a3c6b1 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -248,17 +248,17 @@ namespace CalamityMod.NPCs.Leviathan { if (NPC.ai[3] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - int num6 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI); - NPC.ai[3] = num6 + 1; + int iceShieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[3] = iceShieldSpawn + 1; NPC.localAI[1] = -1f; NPC.localAI[2] += 1f; NPC.netUpdate = true; - Main.npc[num6].ai[0] = NPC.whoAmI; - Main.npc[num6].netUpdate = true; + Main.npc[iceShieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[iceShieldSpawn].netUpdate = true; } - int num7 = (int)NPC.ai[3] - 1; - if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) + int iceShieldCheck = (int)NPC.ai[3] - 1; + if (iceShieldCheck != -1 && Main.npc[iceShieldCheck].active && Main.npc[iceShieldCheck].type == ModContent.NPCType()) NPC.dontTakeDamage = true; else { @@ -287,8 +287,8 @@ namespace CalamityMod.NPCs.Leviathan { NPC.dontTakeDamage = false; - int num7 = (int)NPC.ai[3] - 1; - if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) + int iceShieldCheck = (int)NPC.ai[3] - 1; + if (iceShieldCheck != -1 && Main.npc[iceShieldCheck].active && Main.npc[iceShieldCheck].type == ModContent.NPCType()) NPC.dontTakeDamage = true; } @@ -395,11 +395,11 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.ai[0] == -1f) { int random = ((phase2 && expertMode && !leviAlive) || phase4 || death) ? 4 : 3; - int num618; - do num618 = Main.rand.Next(random); - while (num618 == NPC.ai[1] || num618 == 1); + int nextAttack; + do nextAttack = Main.rand.Next(random); + while (nextAttack == NPC.ai[1] || nextAttack == 1); - NPC.ai[0] = num618; + NPC.ai[0] = nextAttack; if (NPC.ai[0] != 3f) { @@ -422,13 +422,13 @@ namespace CalamityMod.NPCs.Leviathan NPC.rotation = NPC.velocity.X * 0.02f; NPC.spriteDirection = NPC.direction; - Vector2 vector118 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num1055 = player.position.X + (player.width / 2) - vector118.X; - float num1056 = player.position.Y + (player.height / 2) - 200f * NPC.scale - vector118.Y; - float num1057 = (float)Math.Sqrt(num1055 * num1055 + num1056 * num1056); + Vector2 anahitaPos = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float playerXDist = player.position.X + (player.width / 2) - anahitaPos.X; + float playerYDist = player.position.Y + (player.height / 2) - 200f * NPC.scale - anahitaPos.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); NPC.Calamity().newAI[0] += 1f; - if (num1057 < 600f * NPC.scale || NPC.Calamity().newAI[0] >= 180f) + if (playerDistance < 600f * NPC.scale || NPC.Calamity().newAI[0] >= 180f) { NPC.ai[0] = 1f; NPC.ai[1] = 0f; @@ -482,41 +482,41 @@ namespace CalamityMod.NPCs.Leviathan else if (NPC.ai[0] == 1f) { NPC.rotation = NPC.velocity.X * 0.02f; - Vector2 vector119 = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale); - Vector2 vector120 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num1058 = player.position.X + (player.width / 2) - vector120.X; - float num1059 = player.position.Y + (player.height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); + Vector2 bubbleSpawnPos = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale); + Vector2 restingPos = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float restingPlayerXDist = player.position.X + (player.width / 2) - restingPos.X; + float restingPlayerYDist = player.position.Y + (player.height / 2) - restingPos.Y; + float restingPlayerDistance = (float)Math.Sqrt(restingPlayerXDist * restingPlayerXDist + restingPlayerYDist * restingPlayerYDist); NPC.ai[1] += 1f; - int num638 = 0; - for (int num639 = 0; num639 < 255; num639++) + int activePlayerAmt = 0; + for (int i = 0; i < 255; i++) { - if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f) - num638++; + if (Main.player[i].active && !Main.player[i].dead && (vector - Main.player[i].Center).Length() < 1000f) + activePlayerAmt++; } - NPC.ai[1] += num638 / 2; + NPC.ai[1] += activePlayerAmt / 2; - bool flag103 = false; - float num640 = 20f; + bool spawnedBubble = false; + float bubbleDelay = 20f; if (!leviAlive || phase4) - num640 -= death ? 15f * (1f - lifeRatio) : 12f * (1f - lifeRatio); + bubbleDelay -= death ? 15f * (1f - lifeRatio) : 12f * (1f - lifeRatio); - if (NPC.ai[1] > num640) + if (NPC.ai[1] > bubbleDelay) { NPC.ai[1] = 0f; NPC.ai[2] += 1f; - flag103 = true; + spawnedBubble = true; } - if (Collision.CanHit(vector119, 1, 1, player.position, player.width, player.height) && flag103) + if (Collision.CanHit(bubbleSpawnPos, 1, 1, player.position, player.width, player.height) && spawnedBubble) { SoundEngine.PlaySound(SoundID.Item85, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, NPCID.DetonatingBubble); + int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)bubbleSpawnPos.X, (int)bubbleSpawnPos.Y, NPCID.DetonatingBubble); Main.npc[spawn].target = NPC.target; - Main.npc[spawn].velocity = player.Center - vector119; + Main.npc[spawn].velocity = player.Center - bubbleSpawnPos; Main.npc[spawn].velocity.Normalize(); Main.npc[spawn].velocity *= bubbleVelocity; Main.npc[spawn].netUpdate = true; @@ -524,7 +524,7 @@ namespace CalamityMod.NPCs.Leviathan } } - if (num1060 > 600f * NPC.scale) + if (restingPlayerDistance > 600f * NPC.scale) { float maxVelocityY = death ? 3f : 4f; float maxVelocityX = death ? 7f : 8f; @@ -594,7 +594,7 @@ namespace CalamityMod.NPCs.Leviathan if (Main.getGoodWorld) velocity *= 1.15f; - Vector2 vector3 = Vector2.Normalize(targetVector - vector - NPC.velocity) * velocity; + Vector2 chargeSetupLocation = Vector2.Normalize(targetVector - vector - NPC.velocity) * velocity; float acceleration = death ? 0.28f : 0.25f; acceleration += 0.2f * enrageScale; @@ -602,7 +602,7 @@ namespace CalamityMod.NPCs.Leviathan acceleration *= 1.15f; if (Math.Abs(NPC.Center.Y - targetVector.Y) > 50f * NPC.scale || Math.Abs(NPC.Center.X - player.Center.X) > 350f * NPC.scale) - NPC.SimpleFlyMovement(vector3, acceleration); + NPC.SimpleFlyMovement(chargeSetupLocation, acceleration); NPC.ai[1] += 1f; @@ -742,10 +742,10 @@ namespace CalamityMod.NPCs.Leviathan NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); // Direction - int num22 = Math.Sign(player.Center.X - vector.X); - if (num22 != 0) + int chargeDirection = Math.Sign(player.Center.X - vector.X); + if (chargeDirection != 0) { - NPC.direction = num22; + NPC.direction = chargeDirection; if (NPC.spriteDirection == 1) NPC.rotation += MathHelper.Pi; @@ -764,12 +764,12 @@ namespace CalamityMod.NPCs.Leviathan if (CalamityWorld.LegendaryMode && CalamityWorld.revenge && NPC.ai[1] % 5f == 0f) { SoundEngine.PlaySound(SoundID.Item85, NPC.Center); - Vector2 vector119 = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale); + Vector2 bubbleSpawnPos = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale); if (Main.netMode != NetmodeID.MultiplayerClient) { - int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, NPCID.DetonatingBubble); + int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)bubbleSpawnPos.X, (int)bubbleSpawnPos.Y, NPCID.DetonatingBubble); Main.npc[spawn].target = NPC.target; - Main.npc[spawn].velocity = player.Center - vector119; + Main.npc[spawn].velocity = player.Center - bubbleSpawnPos; Main.npc[spawn].velocity.Normalize(); Main.npc[spawn].velocity *= bubbleVelocity; Main.npc[spawn].netUpdate = true; @@ -778,16 +778,16 @@ namespace CalamityMod.NPCs.Leviathan } // Spawn dust - int num24 = 7; - for (int j = 0; j < num24; j++) + int dustAmt = 7; + for (int j = 0; j < dustAmt; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector; + Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (dustAmt / 2 - 1)) * MathHelper.Pi / dustAmt) + vector; Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= NPC.velocity; + int waterDust = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); + Main.dust[waterDust].noGravity = true; + Main.dust[waterDust].noLight = true; + Main.dust[waterDust].velocity /= 4f; + Main.dust[waterDust].velocity -= NPC.velocity; } NPC.ai[1] += 1f; @@ -804,20 +804,20 @@ namespace CalamityMod.NPCs.Leviathan // Rotation when charging private void ChargeRotation(Player player, Vector2 vector) { - float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); + float playerDirection = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); if (NPC.spriteDirection == 1) - num17 += MathHelper.Pi; - if (num17 < 0f) - num17 += MathHelper.TwoPi; - if (num17 > MathHelper.TwoPi) - num17 -= MathHelper.TwoPi; + playerDirection += MathHelper.Pi; + if (playerDirection < 0f) + playerDirection += MathHelper.TwoPi; + if (playerDirection > MathHelper.TwoPi) + playerDirection -= MathHelper.TwoPi; - float num18 = 0.04f; + float rotationSpeed = 0.04f; if (NPC.ai[0] == 4f) - num18 = 0f; + rotationSpeed = 0f; - if (num18 != 0f) - NPC.rotation = NPC.rotation.AngleTowards(num17, num18); + if (rotationSpeed != 0f) + NPC.rotation = NPC.rotation.AngleTowards(playerDirection, rotationSpeed); } // Move to charge location @@ -829,21 +829,21 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.localAI[0] == 0f) NPC.localAI[0] = (int)distance * Math.Sign((vector - player.Center).X); - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(NPC.localAI[0], -distance) - vector - NPC.velocity) * 12f; + Vector2 chargeSetupLocation = Vector2.Normalize(player.Center + new Vector2(NPC.localAI[0], -distance) - vector - NPC.velocity) * 12f; float acceleration = revenge ? 0.75f : 0.5f; if (Main.getGoodWorld) acceleration *= 1.15f; - NPC.SimpleFlyMovement(vector3, acceleration); + NPC.SimpleFlyMovement(chargeSetupLocation, acceleration); // Rotation - int num22 = Math.Sign(player.Center.X - vector.X); - if (num22 != 0) + int chargeDirection = Math.Sign(player.Center.X - vector.X); + if (chargeDirection != 0) { - if (NPC.ai[1] == 0f && num22 != NPC.direction) + if (NPC.ai[1] == 0f && chargeDirection != NPC.direction) NPC.rotation += MathHelper.Pi; - NPC.direction = num22; + NPC.direction = chargeDirection; if (NPC.spriteDirection != -NPC.direction) NPC.rotation += MathHelper.Pi; diff --git a/NPCs/Leviathan/AnahitasIceShield.cs b/NPCs/Leviathan/AnahitasIceShield.cs index a6ac289bdc..61989a90a1 100644 --- a/NPCs/Leviathan/AnahitasIceShield.cs +++ b/NPCs/Leviathan/AnahitasIceShield.cs @@ -56,28 +56,28 @@ namespace CalamityMod.NPCs.Leviathan public override void AI() { - int num989 = (int)NPC.ai[0]; - if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType()) + int anahitaID = (int)NPC.ai[0]; + if (Main.npc[anahitaID].active && Main.npc[anahitaID].type == ModContent.NPCType()) { if (NPC.alpha > 100 && NPC.ai[1] == 0f) NPC.alpha -= 2; - if (Main.npc[num989].damage == 0) + if (Main.npc[anahitaID].damage == 0) NPC.ai[1] = 1f; else NPC.ai[1] = 0f; if (NPC.ai[1] == 1f) - NPC.alpha = Main.npc[num989].alpha; + NPC.alpha = Main.npc[anahitaID].alpha; - NPC.dontTakeDamage = Main.npc[num989].damage == 0; - NPC.rotation = Main.npc[num989].rotation; - NPC.spriteDirection = Main.npc[num989].direction; + NPC.dontTakeDamage = Main.npc[anahitaID].damage == 0; + NPC.rotation = Main.npc[anahitaID].rotation; + NPC.spriteDirection = Main.npc[anahitaID].direction; NPC.velocity = Vector2.Zero; - NPC.position = Main.npc[num989].Center; + NPC.position = Main.npc[anahitaID].Center; NPC.position.X = NPC.position.X - (NPC.width / 2) + ((NPC.spriteDirection == 1) ? -20f : 20f) * NPC.scale; NPC.position.Y = NPC.position.Y - (NPC.height / 2) - (int)(30 * NPC.scale); - NPC.gfxOffY = Main.npc[num989].gfxOffY; + NPC.gfxOffY = Main.npc[anahitaID].gfxOffY; Lighting.AddLight((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16, 0f, 0.8f, 1.1f); return; } diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index eb1a83bbe9..4d238e6259 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -123,32 +123,30 @@ namespace CalamityMod.NPCs.Leviathan if (!sirenAlive || leviathanInPhase4) inertia *= 0.75f; - float num1006 = 0.111111117f * inertia; if (NPC.ai[0] == 0f) { - float scaleFactor6 = bossRush ? 14f : death ? 12f : revenge ? 11f : expertMode ? 10f : 8f; + float lungeSpeed = bossRush ? 14f : death ? 12f : revenge ? 11f : expertMode ? 10f : 8f; if (!sirenAlive || leviathanInPhase4) - scaleFactor6 *= 1.25f; + lungeSpeed *= 1.25f; - Vector2 center4 = NPC.Center; - Vector2 center5 = Main.player[NPC.target].Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * 300f * NPC.scale; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); + Vector2 npcCenter = NPC.Center; + Vector2 targetCenter = Main.player[NPC.target].Center; + Vector2 targetDirection = targetCenter - npcCenter; + Vector2 beginLungeYDist = targetDirection - Vector2.UnitY * 300f * NPC.scale; + float targetDist = targetDirection.Length(); + targetDirection = Vector2.Normalize(targetDirection) * lungeSpeed; + beginLungeYDist = Vector2.Normalize(beginLungeYDist) * lungeSpeed; + bool canHitPlayer = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); if (NPC.ai[3] >= 120f) { - flag64 = true; + canHitPlayer = true; } - float num1014 = 8f; - flag64 = flag64 && vector126.ToRotation() > MathHelper.Pi / num1014 && vector126.ToRotation() < MathHelper.Pi - MathHelper.Pi / num1014; - if (num1013 > 800f * NPC.scale || !flag64) + canHitPlayer = canHitPlayer && targetDirection.ToRotation() > MathHelper.Pi / 8f && targetDirection.ToRotation() < MathHelper.Pi - MathHelper.Pi / 8f; + if (targetDist > 800f * NPC.scale || !canHitPlayer) { - NPC.velocity.X = (NPC.velocity.X * (inertia - 1f) + vector127.X) / inertia; - NPC.velocity.Y = (NPC.velocity.Y * (inertia - 1f) + vector127.Y) / inertia; - if (!flag64) + NPC.velocity.X = (NPC.velocity.X * (inertia - 1f) + beginLungeYDist.X) / inertia; + NPC.velocity.Y = (NPC.velocity.Y * (inertia - 1f) + beginLungeYDist.Y) / inertia; + if (!canHitPlayer) { NPC.ai[3] += 1f; if (NPC.ai[3] == 120f) @@ -164,8 +162,8 @@ namespace CalamityMod.NPCs.Leviathan else { NPC.ai[0] = 1f; - NPC.ai[2] = vector126.X; - NPC.ai[3] = vector126.Y; + NPC.ai[2] = targetDirection.X; + NPC.ai[3] = targetDirection.Y; NPC.netUpdate = true; } } @@ -187,8 +185,8 @@ namespace CalamityMod.NPCs.Leviathan else if (NPC.ai[0] == 2f) { NPC.ai[1] += 1f; - bool flag65 = NPC.Center.Y + 50f > Main.player[NPC.target].Center.Y; - if ((NPC.ai[1] >= 90f && flag65) || NPC.velocity.Length() < ((!sirenAlive || leviathanInPhase4) ? 10f : 8f)) + bool doLunge = NPC.Center.Y + 50f > Main.player[NPC.target].Center.Y; + if ((NPC.ai[1] >= 90f && doLunge) || NPC.velocity.Length() < ((!sirenAlive || leviathanInPhase4) ? 10f : 8f)) { NPC.ai[0] = 3f; NPC.ai[1] = 45f; @@ -199,15 +197,15 @@ namespace CalamityMod.NPCs.Leviathan } else { - Vector2 center6 = NPC.Center; - Vector2 center7 = Main.player[NPC.target].Center; - Vector2 vec2 = center7 - center6; + Vector2 npcCenterAgain = NPC.Center; + Vector2 targetCenterAgain = Main.player[NPC.target].Center; + Vector2 vec2 = targetCenterAgain - npcCenterAgain; vec2.Normalize(); if (vec2.HasNaNs()) { vec2 = new Vector2((float)NPC.direction, 0f); } - NPC.velocity = (NPC.velocity * (inertia - 1f) + vec2 * (NPC.velocity.Length() + num1006)) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + vec2 * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia; } } else if (NPC.ai[0] == 3f) diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 94c8a5138b..79137af19c 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.Leviathan bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - Vector2 vector = NPC.Center; + Vector2 npcCenter = NPC.Center; // Is in spawning animation float spawnAnimationTime = 180f; @@ -187,14 +187,14 @@ namespace CalamityMod.NPCs.Leviathan extrapitch = Main.zenithWorld ? 0.3f : 0f; if (Main.rand.NextBool(600) && !spawnAnimation) - SoundEngine.PlaySound(((sirenAlive && !death) ? soundChoice : soundChoiceRage) with { Pitch = soundChoice.Pitch + extrapitch }, vector); + SoundEngine.PlaySound(((sirenAlive && !death) ? soundChoice : soundChoiceRage) with { Pitch = soundChoice.Pitch + extrapitch }, npcCenter); // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[NPC.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + if (Vector2.Distance(Main.player[NPC.target].Center, npcCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) NPC.TargetClosest(); Player player = Main.player[NPC.target]; @@ -233,11 +233,11 @@ namespace CalamityMod.NPCs.Leviathan NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, npcCenter) > 5600f) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, npcCenter) > 5600f) { if (NPC.velocity.Y < -3f) NPC.velocity.Y = -3f; @@ -284,8 +284,8 @@ namespace CalamityMod.NPCs.Leviathan if (calamityGlobalNPC.newAI[3] == 10f) { - SoundEngine.PlaySound(EmergeSound, vector); - SoundEngine.PlaySound(soundChoiceRage with { Pitch = soundChoiceRage.Pitch + extrapitch }, vector); + SoundEngine.PlaySound(EmergeSound, npcCenter); + SoundEngine.PlaySound(soundChoiceRage with { Pitch = soundChoiceRage.Pitch + extrapitch }, npcCenter); } NPC.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); @@ -297,62 +297,62 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.ai[0] == 0f) { - float num412 = (sirenAlive && !phase4) ? 3.5f : 7f; - float num413 = (sirenAlive && !phase4) ? 0.1f : 0.2f; - num412 += 2f * enrageScale; - num413 += 0.05f * enrageScale; + float hoverSpeed = (sirenAlive && !phase4) ? 3.5f : 7f; + float hoverAcceleration = (sirenAlive && !phase4) ? 0.1f : 0.2f; + hoverSpeed += 2f * enrageScale; + hoverAcceleration += 0.05f * enrageScale; if (expertMode && (!sirenAlive || phase4)) { - num412 += death ? 6f * (1f - lifeRatio) : 3.5f * (1f - lifeRatio); - num413 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); + hoverSpeed += death ? 6f * (1f - lifeRatio) : 3.5f * (1f - lifeRatio); + hoverAcceleration += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); } if (Main.getGoodWorld) { - num412 *= 1.15f; - num413 *= 1.15f; + hoverSpeed *= 1.15f; + hoverAcceleration *= 1.15f; } - int num414 = 1; - if (vector.X < player.position.X + player.width) - num414 = -1; + int posXSign = 1; + if (npcCenter.X < player.position.X + player.width) + posXSign = -1; - Vector2 vector40 = vector; - float num415 = player.Center.X + (num414 * ((sirenAlive && !phase4) ? 1000f : 800f) * NPC.scale) - vector40.X; - float num416 = player.Center.Y - vector40.Y; - float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); - num417 = num412 / num417; - num415 *= num417; - num416 *= num417; + Vector2 leviCenter = npcCenter; + float xDestination = player.Center.X + (posXSign * ((sirenAlive && !phase4) ? 1000f : 800f) * NPC.scale) - leviCenter.X; + float yDestination = player.Center.Y - leviCenter.Y; + float destinationDist = (float)Math.Sqrt(xDestination * xDestination + yDestination * yDestination); + destinationDist = hoverSpeed / destinationDist; + xDestination *= destinationDist; + yDestination *= destinationDist; - if (NPC.velocity.X < num415) + if (NPC.velocity.X < xDestination) { - NPC.velocity.X += num413; - if (NPC.velocity.X < 0f && num415 > 0f) - NPC.velocity.X += num413; + NPC.velocity.X += hoverAcceleration; + if (NPC.velocity.X < 0f && xDestination > 0f) + NPC.velocity.X += hoverAcceleration; } - else if (NPC.velocity.X > num415) + else if (NPC.velocity.X > xDestination) { - NPC.velocity.X -= num413; - if (NPC.velocity.X > 0f && num415 < 0f) - NPC.velocity.X -= num413; + NPC.velocity.X -= hoverAcceleration; + if (NPC.velocity.X > 0f && xDestination < 0f) + NPC.velocity.X -= hoverAcceleration; } - if (NPC.velocity.Y < num416) + if (NPC.velocity.Y < yDestination) { - NPC.velocity.Y += num413; - if (NPC.velocity.Y < 0f && num416 > 0f) - NPC.velocity.Y += num413; + NPC.velocity.Y += hoverAcceleration; + if (NPC.velocity.Y < 0f && yDestination > 0f) + NPC.velocity.Y += hoverAcceleration; } - else if (NPC.velocity.Y > num416) + else if (NPC.velocity.Y > yDestination) { - NPC.velocity.Y -= num413; - if (NPC.velocity.Y > 0f && num416 < 0f) - NPC.velocity.Y -= num413; + NPC.velocity.Y -= hoverAcceleration; + if (NPC.velocity.Y > 0f && yDestination < 0f) + NPC.velocity.Y -= hoverAcceleration; } - float playerLocation = vector.X - player.Center.X; + float playerLocation = npcCenter.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -381,9 +381,9 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.ai[2] >= 75f) { NPC.ai[2] = 0f; - vector40 = new Vector2(vector.X, vector.Y + 20f); - num415 = vector40.X + 1000f * NPC.direction - vector40.X; - num416 = player.Center.Y - vector40.Y; + leviCenter = new Vector2(npcCenter.X, npcCenter.Y + 20f); + xDestination = leviCenter.X + 1000f * NPC.direction - leviCenter.X; + yDestination = player.Center.Y - leviCenter.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -399,28 +399,28 @@ namespace CalamityMod.NPCs.Leviathan if (!sirenAlive || phase4) speed += 3f * (1f - lifeRatio); - num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); - num417 = speed / num417; - num415 *= num417; - num416 *= num417; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; + destinationDist = (float)Math.Sqrt(xDestination * xDestination + yDestination * yDestination); + destinationDist = speed / destinationDist; + xDestination *= destinationDist; + yDestination *= destinationDist; + leviCenter.X += xDestination * 4f; + leviCenter.Y += yDestination * 4f; if (Main.zenithWorld) { type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? ProjectileID.BouncyBoulder : ProjectileID.Boulder; - vector40.Y -= 5; //Shoot a bit more up since boulders are affected by gravity + leviCenter.Y -= 5; //Shoot a bit more up since boulders are affected by gravity damage *= 2; } - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), vector40.X, vector40.Y, num415, num416, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), leviCenter.X, leviCenter.Y, xDestination, yDestination, type, damage, 0f, Main.myPlayer); if (Main.zenithWorld) Main.projectile[proj].scale *= 5f; if (soundDelay <= 0) { soundDelay = 120; - SoundEngine.PlaySound(RoarMeteorSound with { Pitch = RoarMeteorSound.Pitch + extrapitch }, vector); + SoundEngine.PlaySound(RoarMeteorSound with { Pitch = RoarMeteorSound.Pitch + extrapitch }, npcCenter); } } } @@ -428,79 +428,79 @@ namespace CalamityMod.NPCs.Leviathan } else if (NPC.ai[0] == 1f) { - Vector2 vector119 = new Vector2(vector.X, NPC.position.Y + NPC.height * 0.8f); - Vector2 vector120 = vector; - float num1058 = player.Center.X - vector120.X; - float num1059 = player.Center.Y - vector120.Y; - float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); + Vector2 aberrationSpawn = new Vector2(npcCenter.X, NPC.position.Y + NPC.height * 0.8f); + Vector2 leviCenterAberration = npcCenter; + float playerXDist = player.Center.X - leviCenterAberration.X; + float playerYDist = player.Center.Y - leviCenterAberration.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); NPC.ai[1] += 1f; - int num638 = 0; - for (int num639 = 0; num639 < Main.maxPlayers; num639++) + int activePlayerAmt = 0; + for (int i = 0; i < Main.maxPlayers; i++) { - if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f) - num638++; + if (Main.player[i].active && !Main.player[i].dead && (npcCenter - Main.player[i].Center).Length() < 1000f) + activePlayerAmt++; } - NPC.ai[1] += num638 / 2; + NPC.ai[1] += activePlayerAmt / 2; - bool flag103 = false; - float num640 = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 20f : (!sirenAlive || phase4) ? 60f : 40f; - if (NPC.ai[1] > num640) + bool spawnedAberration = false; + float aberrationSpawnDelay = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 20f : (!sirenAlive || phase4) ? 60f : 40f; + if (NPC.ai[1] > aberrationSpawnDelay) { NPC.ai[1] = 0f; NPC.ai[2] += 1f; - flag103 = true; + spawnedAberration = true; } int spawnLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10 : (sirenAlive && !phase4) ? 1 : (death ? 2 : 3); - if (flag103 && NPC.CountNPCS(ModContent.NPCType()) < spawnLimit) + if (spawnedAberration && NPC.CountNPCS(ModContent.NPCType()) < spawnLimit) { - SoundEngine.PlaySound(soundChoice with { Pitch = soundChoice.Pitch + extrapitch }, vector); + SoundEngine.PlaySound(soundChoice with { Pitch = soundChoice.Pitch + extrapitch }, npcCenter); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)aberrationSpawn.X, (int)aberrationSpawn.Y, ModContent.NPCType()); } - if (num1060 > ((sirenAlive && !phase4) ? 1000f : 800f) * NPC.scale) + if (playerDistance > ((sirenAlive && !phase4) ? 1000f : 800f) * NPC.scale) { - float num1064 = (sirenAlive && !phase4) ? 0.05f : 0.065f; - num1064 += 0.04f * enrageScale; + float aberrationAccel = (sirenAlive && !phase4) ? 0.05f : 0.065f; + aberrationAccel += 0.04f * enrageScale; if (expertMode && (!sirenAlive || phase4)) - num1064 += death ? 0.05f * (1f - lifeRatio) : 0.03f * (1f - lifeRatio); + aberrationAccel += death ? 0.05f * (1f - lifeRatio) : 0.03f * (1f - lifeRatio); - vector120 = vector119; - num1058 = player.Center.X - vector120.X; - num1059 = player.Center.Y - vector120.Y; + leviCenterAberration = aberrationSpawn; + playerXDist = player.Center.X - leviCenterAberration.X; + playerYDist = player.Center.Y - leviCenterAberration.Y; - if (NPC.velocity.X < num1058) + if (NPC.velocity.X < playerXDist) { - NPC.velocity.X += num1064; - if (NPC.velocity.X < 0f && num1058 > 0f) - NPC.velocity.X += num1064; + NPC.velocity.X += aberrationAccel; + if (NPC.velocity.X < 0f && playerXDist > 0f) + NPC.velocity.X += aberrationAccel; } - else if (NPC.velocity.X > num1058) + else if (NPC.velocity.X > playerXDist) { - NPC.velocity.X -= num1064; - if (NPC.velocity.X > 0f && num1058 < 0f) - NPC.velocity.X -= num1064; + NPC.velocity.X -= aberrationAccel; + if (NPC.velocity.X > 0f && playerXDist < 0f) + NPC.velocity.X -= aberrationAccel; } - if (NPC.velocity.Y < num1059) + if (NPC.velocity.Y < playerYDist) { - NPC.velocity.Y += num1064; - if (NPC.velocity.Y < 0f && num1059 > 0f) - NPC.velocity.Y += num1064; + NPC.velocity.Y += aberrationAccel; + if (NPC.velocity.Y < 0f && playerYDist > 0f) + NPC.velocity.Y += aberrationAccel; } - else if (NPC.velocity.Y > num1059) + else if (NPC.velocity.Y > playerYDist) { - NPC.velocity.Y -= num1064; - if (NPC.velocity.Y > 0f && num1059 < 0f) - NPC.velocity.Y -= num1064; + NPC.velocity.Y -= aberrationAccel; + if (NPC.velocity.Y > 0f && playerYDist < 0f) + NPC.velocity.Y -= aberrationAccel; } } else NPC.velocity *= 0.9f; - float playerLocation = vector.X - player.Center.X; + float playerLocation = npcCenter.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -515,7 +515,7 @@ namespace CalamityMod.NPCs.Leviathan } else if (NPC.ai[0] == 2f) { - Vector2 distFromPlayer = player.Center - vector; + Vector2 distFromPlayer = player.Center - npcCenter; float chargeAmt = death ? (phase4 ? 3f : phase3 ? 2f : 1f) : 1f; if (NPC.ai[1] >= chargeAmt * 2f || distFromPlayer.Length() > 2400f) { @@ -535,16 +535,16 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.ai[1] % 2f == 0f) { - int num24 = 7; - for (int j = 0; j < num24; j++) + int dustAmt = 7; + for (int j = 0; j < dustAmt; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= NPC.velocity; + Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (dustAmt / 2 - 1)) * MathHelper.Pi / dustAmt) + npcCenter; + Vector2 dustRotation = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int waterDust = Dust.NewDust(arg_E1C_0 + dustRotation, 0, 0, 172, dustRotation.X * 2f, dustRotation.Y * 2f, 100, default, 1.4f); + Main.dust[waterDust].noGravity = true; + Main.dust[waterDust].noLight = true; + Main.dust[waterDust].velocity /= 4f; + Main.dust[waterDust].velocity -= NPC.velocity; } if (Math.Abs(NPC.position.Y + (NPC.height / 2) - (player.position.Y + (player.height / 2))) < 20f) @@ -552,72 +552,72 @@ namespace CalamityMod.NPCs.Leviathan NPC.ai[1] += 1f; NPC.ai[2] = 0f; - float num1044 = revenge ? 20f : 18f; - num1044 += 2f * enrageScale; + float lineupSpeed = revenge ? 20f : 18f; + lineupSpeed += 2f * enrageScale; if (revenge && (!sirenAlive || phase4)) - num1044 += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); + lineupSpeed += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); if (Main.getGoodWorld) - num1044 *= 1.15f; + lineupSpeed *= 1.15f; - Vector2 vector117 = vector; - float num1045 = player.Center.X - vector117.X; - float num1046 = player.Center.Y - vector117.Y; - float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046); - num1047 = num1044 / num1047; - NPC.velocity.X = num1045 * num1047; - NPC.velocity.Y = num1046 * num1047; + Vector2 leviChargeCenter = npcCenter; + float playerXDistCharge = player.Center.X - leviChargeCenter.X; + float playerYDistCharge = player.Center.Y - leviChargeCenter.Y; + float playerDistanceCharge = (float)Math.Sqrt(playerXDistCharge * playerXDistCharge + playerYDistCharge * playerYDistCharge); + playerDistanceCharge = lineupSpeed / playerDistanceCharge; + NPC.velocity.X = playerXDistCharge * playerDistanceCharge; + NPC.velocity.Y = playerYDistCharge * playerDistanceCharge; - float playerLocation = vector.X - player.Center.X; + float playerLocation = npcCenter.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - SoundEngine.PlaySound(RoarChargeSound with { Pitch = RoarChargeSound.Pitch + extrapitch }, vector); + SoundEngine.PlaySound(RoarChargeSound with { Pitch = RoarChargeSound.Pitch + extrapitch }, npcCenter); return; } - float num1048 = revenge ? 7.5f : 6.5f; - float num1049 = revenge ? 0.12f : 0.11f; - num1048 += 2f * enrageScale; - num1049 += 0.04f * enrageScale; + float chargeSpeed = revenge ? 7.5f : 6.5f; + float chargeAcceleration = revenge ? 0.12f : 0.11f; + chargeSpeed += 2f * enrageScale; + chargeAcceleration += 0.04f * enrageScale; if (revenge && (!sirenAlive || phase4)) { - num1048 += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); - num1049 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); + chargeSpeed += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); + chargeAcceleration += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); } if (Main.getGoodWorld) { - num1048 *= 1.15f; - num1049 *= 1.15f; + chargeSpeed *= 1.15f; + chargeAcceleration *= 1.15f; } - if (vector.Y < player.Center.Y) - NPC.velocity.Y += num1049; + if (npcCenter.Y < player.Center.Y) + NPC.velocity.Y += chargeAcceleration; else - NPC.velocity.Y -= num1049; + NPC.velocity.Y -= chargeAcceleration; - if (NPC.velocity.Y < -num1048) - NPC.velocity.Y = -num1048; - if (NPC.velocity.Y > num1048) - NPC.velocity.Y = num1048; + if (NPC.velocity.Y < -chargeSpeed) + NPC.velocity.Y = -chargeSpeed; + if (NPC.velocity.Y > chargeSpeed) + NPC.velocity.Y = chargeSpeed; - if (Math.Abs(vector.X - player.Center.X) > chargeDistance + 200f) - NPC.velocity.X += num1049 * NPC.direction; - else if (Math.Abs(vector.X - player.Center.X) < chargeDistance) - NPC.velocity.X -= num1049 * NPC.direction; + if (Math.Abs(npcCenter.X - player.Center.X) > chargeDistance + 200f) + NPC.velocity.X += chargeAcceleration * NPC.direction; + else if (Math.Abs(npcCenter.X - player.Center.X) < chargeDistance) + NPC.velocity.X -= chargeAcceleration * NPC.direction; else NPC.velocity.X *= 0.8f; - if (NPC.velocity.X < -num1048) - NPC.velocity.X = -num1048; - if (NPC.velocity.X > num1048) - NPC.velocity.X = num1048; + if (NPC.velocity.X < -chargeSpeed) + NPC.velocity.X = -chargeSpeed; + if (NPC.velocity.X > chargeSpeed) + NPC.velocity.X = chargeSpeed; - float playerLocation2 = vector.X - player.Center.X; + float playerLocation2 = npcCenter.X - player.Center.X; NPC.direction = playerLocation2 < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; } @@ -630,30 +630,30 @@ namespace CalamityMod.NPCs.Leviathan NPC.spriteDirection = NPC.direction; - int num1051 = 1; - if (vector.X < player.Center.X) - num1051 = -1; - if (NPC.direction == num1051 && Math.Abs(vector.X - player.Center.X) > chargeDistance) + int chargeXDirectSign = 1; + if (npcCenter.X < player.Center.X) + chargeXDirectSign = -1; + if (NPC.direction == chargeXDirectSign && Math.Abs(npcCenter.X - player.Center.X) > chargeDistance) NPC.ai[2] = 1f; if (NPC.ai[2] != 1f) return; - float playerLocation = vector.X - player.Center.X; + float playerLocation = npcCenter.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; NPC.velocity *= 0.9f; - float num1052 = revenge ? 0.11f : 0.1f; - num1052 += 0.02f * enrageScale; + float chargeStopSpeed = revenge ? 0.11f : 0.1f; + chargeStopSpeed += 0.02f * enrageScale; if (revenge && (!sirenAlive || phase4)) { NPC.velocity *= death ? MathHelper.Lerp(0.75f, 1f, lifeRatio) : MathHelper.Lerp(0.81f, 1f, lifeRatio); - num1052 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); + chargeStopSpeed += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); } - if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < num1052) + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < chargeStopSpeed) { NPC.ai[2] = 0f; NPC.ai[1] += 1f; @@ -743,23 +743,23 @@ namespace CalamityMod.NPCs.Leviathan NPC.position.Y = NPC.position.Y + (NPC.height / 2); NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[bloody].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[bloody].scale = 0.5f; + Main.dust[bloody].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int bloody2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); + Main.dust[bloody2].noGravity = true; + Main.dust[bloody2].velocity *= 5f; + bloody2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[bloody2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) { From f27d9d75ef8c4d9bfd3b53f993d1278d32e6a3fc Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 23 Oct 2023 12:20:18 -0400 Subject: [PATCH 15/43] Old Duke, Perforators, PBG --- NPCs/OldDuke/OldDuke.cs | 224 +++++---- NPCs/OldDuke/OldDukeToothBall.cs | 74 +-- NPCs/OldDuke/SulphurousSharkron.cs | 64 ++- NPCs/Perforator/PerforatorBodyLarge.cs | 60 +-- NPCs/Perforator/PerforatorBodyMedium.cs | 74 +-- NPCs/Perforator/PerforatorBodySmall.cs | 60 +-- NPCs/Perforator/PerforatorHeadLarge.cs | 228 ++++----- NPCs/Perforator/PerforatorHeadMedium.cs | 222 ++++----- NPCs/Perforator/PerforatorHeadSmall.cs | 228 ++++----- NPCs/Perforator/PerforatorHive.cs | 98 ++-- NPCs/Perforator/PerforatorTailLarge.cs | 60 +-- NPCs/Perforator/PerforatorTailMedium.cs | 58 +-- NPCs/Perforator/PerforatorTailSmall.cs | 60 +-- .../PlagueHomingMissile.cs | 128 +++--- NPCs/PlaguebringerGoliath/PlagueMine.cs | 58 +-- .../PlaguebringerGoliath.cs | 432 +++++++++--------- 16 files changed, 1060 insertions(+), 1068 deletions(-) diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 939dde1693..03101af13f 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -136,13 +136,13 @@ namespace CalamityMod.NPCs.OldDuke bool tired = NPC.Calamity().newAI[1] == 1f; if (NPC.ai[0] == 0f || NPC.ai[0] == 5f || NPC.ai[0] == 10f || NPC.ai[0] == 12f) { - int num114 = tired ? 14 : 7; + int frameChangeFrequency = tired ? 14 : 7; if (NPC.ai[0] == 5f || NPC.ai[0] == 12f) { - num114 = tired ? 12 : 6; + frameChangeFrequency = tired ? 12 : 6; } NPC.frameCounter += 1D; - if (NPC.frameCounter > num114) + if (NPC.frameCounter > frameChangeFrequency) { NPC.frameCounter = 0D; NPC.frame.Y += frameHeight; @@ -162,8 +162,8 @@ namespace CalamityMod.NPCs.OldDuke } if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f || NPC.ai[0] == -1f) { - int num115 = 120; - if (NPC.ai[2] < (num115 - 50) || NPC.ai[2] > (num115 - 10)) + int frameChangeGateValue = 120; + if (NPC.ai[2] < (frameChangeGateValue - 50) || NPC.ai[2] > (frameChangeGateValue - 10)) { NPC.frameCounter += 1D; if (NPC.frameCounter > 7D) @@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.OldDuke else { NPC.frame.Y = frameHeight * 5; - if (NPC.ai[2] > (num115 - 40) && NPC.ai[2] < (num115 - 15)) + if (NPC.ai[2] > (frameChangeGateValue - 40) && NPC.ai[2] < (frameChangeGateValue - 15)) { NPC.frame.Y = frameHeight * 6; } @@ -187,8 +187,8 @@ namespace CalamityMod.NPCs.OldDuke } if (NPC.ai[0] == 4f || NPC.ai[0] == 9f) { - int num116 = 180; - if (NPC.ai[2] < (num116 - 60) || NPC.ai[2] > (num116 - 20)) + int secondFrameChangeGateValue = 180; + if (NPC.ai[2] < (secondFrameChangeGateValue - 60) || NPC.ai[2] > (secondFrameChangeGateValue - 20)) { NPC.frameCounter += 1D; if (NPC.frameCounter > 7D) @@ -204,7 +204,7 @@ namespace CalamityMod.NPCs.OldDuke else { NPC.frame.Y = frameHeight * 5; - if (NPC.ai[2] > (num116 - 50) && NPC.ai[2] < (num116 - 25)) + if (NPC.ai[2] > (secondFrameChangeGateValue - 50) && NPC.ai[2] < (secondFrameChangeGateValue - 25)) { NPC.frame.Y = frameHeight * 6; } @@ -220,43 +220,43 @@ namespace CalamityMod.NPCs.OldDuke spriteEffects = SpriteEffects.FlipHorizontally; } Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2); Color color = drawColor; - Color color36 = Color.White; - float amount9 = 0f; - bool flag8 = NPC.ai[0] > 4f; - bool flag9 = NPC.ai[0] > 9f && NPC.ai[0] <= 12f; - int num150 = 120; - int num151 = 60; - if (flag9) + Color drawLerpColor = Color.White; + float drawLerpValue = 0f; + bool halfTiredBuffColor = NPC.ai[0] > 4f; + bool tiredBuffColor = NPC.ai[0] > 9f && NPC.ai[0] <= 12f; + int ai2Compare = 120; + int buffColorDivisor = 60; + if (tiredBuffColor) { color = CalamityGlobalNPC.buffColor(color, 0.4f, 0.8f, 0.4f, 1f); } - else if (flag8) + else if (halfTiredBuffColor) { color = CalamityGlobalNPC.buffColor(color, 0.5f, 0.7f, 0.5f, 1f); } - else if (NPC.ai[0] == 4f && NPC.ai[2] > num150) + else if (NPC.ai[0] == 4f && NPC.ai[2] > ai2Compare) { - float num152 = NPC.ai[2] - num150; - num152 /= num151; - color = CalamityGlobalNPC.buffColor(color, 1f - 0.5f * num152, 1f - 0.3f * num152, 1f - 0.5f * num152, 1f); + float buffColorDampener = NPC.ai[2] - ai2Compare; + buffColorDampener /= buffColorDivisor; + color = CalamityGlobalNPC.buffColor(color, 1f - 0.5f * buffColorDampener, 1f - 0.3f * buffColorDampener, 1f - 0.5f * buffColorDampener, 1f); } - int num153 = 10; - int num154 = 2; + int afterimageAmt = 10; + int afterimageIncrement = 2; if (NPC.ai[0] == -1f) { - num153 = 0; + afterimageAmt = 0; } if (NPC.ai[0] == 0f || NPC.ai[0] == 5f || NPC.ai[0] == 10f || NPC.ai[0] == 12f) { - num153 = 7; + afterimageAmt = 7; } if (NPC.ai[0] == 1f || NPC.ai[0] == 6f || NPC.ai[0] > 9f) { - color36 = Color.Lime; - amount9 = 0.5f; + drawLerpColor = Color.Lime; + drawLerpValue = 0.5f; } else { @@ -265,140 +265,138 @@ namespace CalamityMod.NPCs.OldDuke if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += num154) + for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { - Color color38 = color; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = color; + afterimageColor = Color.Lerp(afterimageColor, drawLerpColor, drawLerpValue); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - int num156 = 0; - float num157 = 0f; - float scaleFactor9 = 0f; + int secondAfterimageAmt = 0; + float afterimageOpacity = 0f; + float afterimageScale = 0f; if (NPC.ai[0] == -1f) { - num156 = 0; + secondAfterimageAmt = 0; } if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f) { - int num158 = 60; - int num159 = 30; - if (NPC.ai[2] > num158) + if (NPC.ai[2] > 60) { - num156 = 6; - num157 = 1f - (float)Math.Cos((NPC.ai[2] - num158) / num159 * MathHelper.TwoPi); - num157 /= 3f; - scaleFactor9 = 40f; + secondAfterimageAmt = 6; + afterimageOpacity = 1f - (float)Math.Cos((NPC.ai[2] - 60) / 30 * MathHelper.TwoPi); + afterimageOpacity /= 3f; + afterimageScale = 40f; } } - if ((NPC.ai[0] == 4f || NPC.ai[0] == 9f) && NPC.ai[2] > num150) + if ((NPC.ai[0] == 4f || NPC.ai[0] == 9f) && NPC.ai[2] > ai2Compare) { - num156 = 6; - num157 = 1f - (float)Math.Cos((NPC.ai[2] - num150) / num151 * MathHelper.TwoPi); - num157 /= 3f; - scaleFactor9 = 60f; + secondAfterimageAmt = 6; + afterimageOpacity = 1f - (float)Math.Cos((NPC.ai[2] - ai2Compare) / buffColorDivisor * MathHelper.TwoPi); + afterimageOpacity /= 3f; + afterimageScale = 60f; } if (NPC.ai[0] == 12f) { - num156 = 6; - num157 = 1f - (float)Math.Cos(NPC.ai[2] / 30f * MathHelper.TwoPi); - num157 /= 3f; - scaleFactor9 = 20f; + secondAfterimageAmt = 6; + afterimageOpacity = 1f - (float)Math.Cos(NPC.ai[2] / 30f * MathHelper.TwoPi); + afterimageOpacity /= 3f; + afterimageScale = 20f; } if (CalamityConfig.Instance.Afterimages) { - for (int num160 = 0; num160 < num156; num160++) + for (int j = 0; j < secondAfterimageAmt; j++) { - Color color39 = drawColor; - color39 = Color.Lerp(color39, color36, amount9); - color39 = NPC.GetAlpha(color39); - color39 *= 1f - num157; - Vector2 vector42 = NPC.Center + (num160 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos; - vector42 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector42 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector42, NPC.frame, color39, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color secondAfterimageColor = drawColor; + secondAfterimageColor = Color.Lerp(secondAfterimageColor, drawLerpColor, drawLerpValue); + secondAfterimageColor = NPC.GetAlpha(secondAfterimageColor); + secondAfterimageColor *= 1f - afterimageOpacity; + Vector2 secondAfterimagePos = NPC.Center + (j / (float)secondAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * afterimageOpacity - screenPos; + secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Color color2 = drawColor; - color2 = Color.Lerp(color2, color36, amount9); - color2 = NPC.GetAlpha(color2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, (NPC.ai[0] > 9f ? color2 : NPC.GetAlpha(drawColor)), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color finalDrawColor = drawColor; + finalDrawColor = Color.Lerp(finalDrawColor, drawLerpColor, drawLerpValue); + finalDrawColor = NPC.GetAlpha(finalDrawColor); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (NPC.ai[0] > 9f ? finalDrawColor : NPC.GetAlpha(drawColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (NPC.ai[0] >= 4f && NPC.Calamity().newAI[1] != 1f) { texture2D15 = ModContent.Request("CalamityMod/NPCs/OldDuke/OldDukeGlow").Value; - Color color40 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - color36 = Color.Yellow; + Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); + drawLerpColor = Color.Yellow; - amount9 = 1f; - num157 = 0.5f; - scaleFactor9 = 10f; - num154 = 1; + drawLerpValue = 1f; + afterimageOpacity = 0.5f; + afterimageScale = 10f; + afterimageIncrement = 1; if (NPC.ai[0] == 4f || NPC.ai[0] == 9f) { - float num161 = NPC.ai[2] - num150; - num161 /= num151; - color36 *= num161; - color40 *= num161; + float otherAfterimageOpacity = NPC.ai[2] - ai2Compare; + otherAfterimageOpacity /= buffColorDivisor; + drawLerpColor *= otherAfterimageOpacity; + yellowLerpColor *= otherAfterimageOpacity; } if (NPC.ai[0] == 12f) { - float num162 = NPC.ai[2]; - num162 /= 30f; - if (num162 > 0.5f) + float ai2Opacity = NPC.ai[2]; + ai2Opacity /= 30f; + if (ai2Opacity > 0.5f) { - num162 = 1f - num162; + ai2Opacity = 1f - ai2Opacity; } - num162 *= 2f; - num162 = 1f - num162; - color36 *= num162; - color40 *= num162; + ai2Opacity *= 2f; + ai2Opacity = 1f - ai2Opacity; + drawLerpColor *= ai2Opacity; + yellowLerpColor *= ai2Opacity; } if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163 += num154) + for (int k = 1; k < afterimageAmt; k += afterimageIncrement) { - Color color41 = color40; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color yellowAfterimageColor = yellowLerpColor; + yellowAfterimageColor = Color.Lerp(yellowAfterimageColor, drawLerpColor, drawLerpValue); + yellowAfterimageColor *= (afterimageAmt - k) / 15f; + Vector2 yellowAfterimagePos = NPC.oldPos[k] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + yellowAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + yellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, yellowAfterimagePos, NPC.frame, yellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } - for (int num164 = 1; num164 < num156; num164++) + for (int l = 1; l < secondAfterimageAmt; l++) { - Color color42 = color40; - color42 = Color.Lerp(color42, color36, amount9); - color42 = NPC.GetAlpha(color42); - color42 *= 1f - num157; - Vector2 vector45 = NPC.Center + (num164 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos; - vector45 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector45 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector45, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color secondYellowAfterimageColor = yellowLerpColor; + secondYellowAfterimageColor = Color.Lerp(secondYellowAfterimageColor, drawLerpColor, drawLerpValue); + secondYellowAfterimageColor = NPC.GetAlpha(secondYellowAfterimageColor); + secondYellowAfterimageColor *= 1f - afterimageOpacity; + Vector2 secondYellowAfterimagePos = NPC.Center + (l / (float)secondAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * afterimageOpacity - screenPos; + secondYellowAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + secondYellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, secondYellowAfterimagePos, NPC.frame, secondYellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color40, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, yellowLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } return false; @@ -486,16 +484,16 @@ namespace CalamityMod.NPCs.OldDuke { if (NPC.life > 0) { - int num211 = 0; - while (num211 < hit.Damage / NPC.lifeMax * 100.0) + int onHitDust = 0; + while (onHitDust < hit.Damage / NPC.lifeMax * 100.0) { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); - num211++; + onHitDust++; } } else { - for (int num212 = 0; num212 < 150; num212++) + for (int r = 0; r < 150; r++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 2 * hit.HitDirection, -2f, 0, default, 1f); } diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index cf758da41b..88cd360c59 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -116,18 +116,18 @@ namespace CalamityMod.NPCs.OldDuke velocity += Vector2.Distance(player.Center, NPC.Center) * speedUpMult; } - Vector2 vector167 = new Vector2(NPC.Center.X + NPC.direction * 20, NPC.Center.Y + 6f); - float num1373 = player.position.X + player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); - float num1376 = velocity / num1375; - num1373 *= num1376; - num1374 *= num1376; + Vector2 toothBallDirection = new Vector2(NPC.Center.X + NPC.direction * 20, NPC.Center.Y + 6f); + float targetXDist = player.position.X + player.width * 0.5f - toothBallDirection.X; + float targetYDist = player.Center.Y - toothBallDirection.Y; + float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); + float toothBallSpeed = velocity / targetDistance; + targetXDist *= toothBallSpeed; + targetYDist *= toothBallSpeed; NPC.ai[2] -= Main.rand.Next(6); - if (num1375 < 300f || NPC.ai[2] > 0f) + if (targetDistance < 300f || NPC.ai[2] > 0f) { - if (num1375 < 300f) + if (targetDistance < 300f) NPC.ai[2] = 100f; if (NPC.velocity.X < 0f) @@ -139,27 +139,27 @@ namespace CalamityMod.NPCs.OldDuke } float inertia = 50f; - NPC.velocity.X = (NPC.velocity.X * inertia + num1373) / (inertia + 1f); - NPC.velocity.Y = (NPC.velocity.Y * inertia + num1374) / (inertia + 1f); + NPC.velocity.X = (NPC.velocity.X * inertia + targetXDist) / (inertia + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia + targetYDist) / (inertia + 1f); - float num1247 = bossRush ? 0.65f : 0.5f; - for (int num1248 = 0; num1248 < Main.maxNPCs; num1248++) + float toothBallAccel = bossRush ? 0.65f : 0.5f; + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num1248].active) + if (Main.npc[i].active) { - if (num1248 != NPC.whoAmI && Main.npc[num1248].type == NPC.type) + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) { - if (Vector2.Distance(NPC.Center, Main.npc[num1248].Center) < 48f) + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 48f) { - if (NPC.position.X < Main.npc[num1248].position.X) - NPC.velocity.X -= num1247; + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X -= toothBallAccel; else - NPC.velocity.X += num1247; + NPC.velocity.X += toothBallAccel; - if (NPC.position.Y < Main.npc[num1248].position.Y) - NPC.velocity.Y -= num1247; + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y -= toothBallAccel; else - NPC.velocity.Y += num1247; + NPC.velocity.Y += toothBallAccel; } } } @@ -185,8 +185,8 @@ namespace CalamityMod.NPCs.OldDuke Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255 * 0.1f, type, damage, 0f, Main.myPlayer, vector255.X, vector255.Y); + Vector2 toothSpikeRotation = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, toothSpikeRotation * 0.1f, type, damage, 0f, Main.myPlayer, toothSpikeRotation.X, toothSpikeRotation.Y); } if (Main.expertMode) @@ -243,26 +243,26 @@ namespace CalamityMod.NPCs.OldDuke NPC.position.X = NPC.position.X - NPC.width / 2; NPC.position.Y = NPC.position.Y - NPC.height / 2; - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[bloody].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[bloody].scale = 0.5f; + Main.dust[bloody].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } - Main.dust[num622].noGravity = true; + Main.dust[bloody].noGravity = true; } - for (int num623 = 0; num623 < 30; num623++) + for (int j = 0; j < 30; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; + int toxicDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); + Main.dust[toxicDust].noGravity = true; + Main.dust[toxicDust].velocity *= 5f; + toxicDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + Main.dust[toxicDust].velocity *= 2f; + Main.dust[toxicDust].noGravity = true; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index ef740b7903..d75a67bd55 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -141,11 +141,11 @@ namespace CalamityMod.NPCs.OldDuke // Fly towards the target float scaleFactor2 = NPC.velocity.Length(); - Vector2 vector17 = Main.player[NPC.target].Center - NPC.Center; - vector17.Normalize(); - vector17 *= scaleFactor2; + Vector2 targetDistance = Main.player[NPC.target].Center - NPC.Center; + targetDistance.Normalize(); + targetDistance *= scaleFactor2; float inertia = bossRush ? 20f : death ? 23f : revenge ? 25f : expertMode ? 27f : 30f; - NPC.velocity = (NPC.velocity * (inertia - 1f) + vector17) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + targetDistance) / inertia; NPC.velocity.Normalize(); NPC.velocity *= scaleFactor2; } @@ -241,30 +241,28 @@ namespace CalamityMod.NPCs.OldDuke spriteEffects = SpriteEffects.None; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.Lime; - float amount9 = 0.5f; - int num153 = 10; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + int afterimageAmt = 10; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.Lime, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -299,25 +297,25 @@ namespace CalamityMod.NPCs.OldDuke NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity.Y *= 6f; - Main.dust[num622].velocity.X *= 3f; + int toxicDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + Main.dust[toxicDust].velocity.Y *= 6f; + Main.dust[toxicDust].velocity.X *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[toxicDust].scale = 0.5f; + Main.dust[toxicDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity.X *= 2f; + int bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); + Main.dust[bloody].noGravity = true; + Main.dust[bloody].velocity.Y *= 10f; + bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[bloody].velocity.X *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 144c1e393d..b75c658e6d 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetX = (float)((int)(targetX / 16f) * 16); + targetY = (float)((int)(targetY / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetX -= segmentPosition.X; + targetY -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = NPC.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + int npcWidth = NPC.width; + targetDistance = (targetDistance - (float)npcWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + targetX; + NPC.position.Y = NPC.position.Y + targetY; - if (num191 < 0f) + if (targetX < 0f) NPC.spriteDirection = 1; - else if (num191 > 0f) + else if (targetX > 0f) NPC.spriteDirection = -1; } } @@ -147,17 +147,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAlt").Value : TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAltGlow").Value : ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 5adbea1d33..8a2da84097 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -105,11 +105,11 @@ namespace CalamityMod.NPCs.Perforator { NPC.type = ModContent.NPCType(); int whoAmI = NPC.whoAmI; - float num25 = NPC.life / (float)NPC.lifeMax; - float num26 = NPC.ai[0]; + float lifeRatio = NPC.life / (float)NPC.lifeMax; + float ai0 = NPC.ai[0]; NPC.SetDefaultsKeepPlayerInteraction(NPC.type); - NPC.life = (int)(NPC.lifeMax * num25); - NPC.ai[0] = num26; + NPC.life = (int)(NPC.lifeMax * lifeRatio); + NPC.ai[0] = ai0; NPC.TargetClosest(true); NPC.netUpdate = true; NPC.whoAmI = whoAmI; @@ -117,11 +117,11 @@ namespace CalamityMod.NPCs.Perforator if (!Main.npc[(int)NPC.ai[0]].active || Main.npc[(int)NPC.ai[0]].aiStyle != NPC.aiStyle) { int whoAmI2 = NPC.whoAmI; - float num27 = NPC.life / (float)NPC.lifeMax; - float num28 = NPC.ai[1]; + float otherLifeRatio = NPC.life / (float)NPC.lifeMax; + float ai1 = NPC.ai[1]; NPC.SetDefaultsKeepPlayerInteraction(NPC.type); - NPC.life = (int)(NPC.lifeMax * num27); - NPC.ai[1] = num28; + NPC.life = (int)(NPC.lifeMax * otherLifeRatio); + NPC.ai[1] = ai1; NPC.TargetClosest(true); NPC.netUpdate = true; NPC.whoAmI = whoAmI2; @@ -131,40 +131,40 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - Vector2 vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num39 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num40 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num39 = (int)(num39 / 16f) * 16; - num40 = (int)(num40 / 16f) * 16; - vector2.X = (int)(vector2.X / 16f) * 16; - vector2.Y = (int)(vector2.Y / 16f) * 16; - num39 -= vector2.X; - num40 -= vector2.Y; - float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + segmentDirection.X = (int)(segmentDirection.X / 16f) * 16; + segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16; + targetX -= segmentDirection.X; + targetY -= segmentDirection.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num39 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector2.X; - num40 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector2.Y; + segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentDirection.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentDirection.Y; } catch { } - NPC.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2; - num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - int num53 = NPC.width; - num53 = (int)(num53 * NPC.scale); - num52 = (num52 - num53) / num52; - num39 *= num52; - num40 *= num52; + NPC.rotation = (float)Math.Atan2(targetY, targetX) + MathHelper.PiOver2; + targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + int npcWidth = NPC.width; + npcWidth = (int)(npcWidth * NPC.scale); + targetDistance = (targetDistance - npcWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X += num39; - NPC.position.Y += num40; + NPC.position.X += targetX; + NPC.position.Y += targetY; } } @@ -175,17 +175,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyMediumGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 04d1dfe88d..8cacdd5260 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetX = (float)((int)(targetX / 16f) * 16); + targetY = (float)((int)(targetY / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetX -= segmentPosition.X; + targetY -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = NPC.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + int npcWidth = NPC.width; + targetDistance = (targetDistance - (float)npcWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + targetX; + NPC.position.Y = NPC.position.Y + targetY; - if (num191 < 0f) + if (targetX < 0f) NPC.spriteDirection = 1; - else if (num191 > 0f) + else if (targetX > 0f) NPC.spriteDirection = -1; } } @@ -147,17 +147,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodySmallGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 494c59dfdb..74c0216cc6 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -180,10 +180,10 @@ namespace CalamityMod.NPCs.Perforator { int Previous = NPC.whoAmI; int maxLength = death ? 27 : revenge ? 24 : expertMode ? 21 : 15; - for (int num36 = 0; num36 < maxLength; num36++) + for (int segments = 0; segments < maxLength; segments++) { int lol; - if (num36 >= 0 && num36 < maxLength - 1) + if (segments >= 0 && segments < maxLength - 1) { lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } @@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.Perforator { lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } - if (num36 % 2 == 0) + if (segments % 2 == 0) { Main.npc[lol].localAI[3] = 1f; } @@ -206,32 +206,32 @@ namespace CalamityMod.NPCs.Perforator } } - int num12 = (int)(NPC.position.X / 16f) - 1; - int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; - int num14 = (int)(NPC.position.Y / 16f) - 1; - int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; - if (num12 < 0) + int tilePositionX = (int)(NPC.position.X / 16f) - 1; + int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int tilePositionY = (int)(NPC.position.Y / 16f) - 1; + int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; + if (tilePositionX < 0) { - num12 = 0; + tilePositionX = 0; } - if (num13 > Main.maxTilesX) + if (tileWidthPosX > Main.maxTilesX) { - num13 = Main.maxTilesX; + tileWidthPosX = Main.maxTilesX; } - if (num14 < 0) + if (tilePositionY < 0) { - num14 = 0; + tilePositionY = 0; } - if (num15 > Main.maxTilesY) + if (tileWidthPosY > Main.maxTilesY) { - num15 = Main.maxTilesY; + tileWidthPosY = Main.maxTilesY; } - bool flag2 = lungeUpward; - if (!flag2) + bool shouldFly = lungeUpward; + if (!shouldFly) { - for (int k = num12; k < num13; k++) + for (int k = tilePositionX; k < tileWidthPosX; k++) { - for (int l = num14; l < num15; l++) + for (int l = tilePositionY; l < tileWidthPosY; l++) { if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) { @@ -240,36 +240,36 @@ namespace CalamityMod.NPCs.Perforator vector2.Y = (float)(l * 16); if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) { - flag2 = true; + shouldFly = true; break; } } } } } - if (!flag2) + if (!shouldFly) { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int num16 = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; - bool flag3 = true; + int stopFlyingRadius = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; + bool outsideFlyingRadius = true; if (NPC.position.Y > player.position.Y) { for (int m = 0; m < 255; m++) { if (Main.player[m].active) { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - stopFlyingRadius, (int)Main.player[m].position.Y - stopFlyingRadius, stopFlyingRadius * 2, stopFlyingRadius * 2); if (rectangle.Intersects(rectangle2)) { - flag3 = false; + outsideFlyingRadius = false; break; } } } - if (flag3) + if (outsideFlyingRadius) { - flag2 = true; + shouldFly = true; } } } @@ -278,15 +278,15 @@ namespace CalamityMod.NPCs.Perforator NPC.localAI[1] = 0f; } - float num17 = 16f; + float fallSpeed = 16f; if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) { - flag2 = false; + shouldFly = false; NPC.velocity.Y += 1f; if ((double)NPC.position.Y > Main.worldSurface * 16.0) { NPC.velocity.Y += 1f; - num17 = 32f; + fallSpeed = 32f; } if ((double)NPC.position.Y > Main.rockLayer * 16.0) { @@ -329,21 +329,21 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().newAI[3] = -300f; } - float num18 = speed; - float num19 = turnSpeed; + float speedCopy = speed; + float turnSpeedCopy = turnSpeed; float burrowDistance = bossRush ? 500f : 800f; float burrowTarget = player.Center.Y + burrowDistance; float lungeTarget = NPC.Calamity().newAI[2]; - Vector2 vector3 = NPC.Center; - float num20 = player.Center.X; - float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + Vector2 npcCenter = NPC.Center; + float playerX = player.Center.X; + float targettingPosition = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; + playerX = (float)((int)(playerX / 16f) * 16); + targettingPosition = (float)((int)(targettingPosition / 16f) * 16); + npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16); + npcCenter.Y = (float)((int)(npcCenter.Y / 16f) * 16); + playerX -= npcCenter.X; + targettingPosition -= npcCenter.Y; + float targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); // Lunge up towards target if (burrow && NPC.Center.Y >= burrowTarget - 16f) @@ -375,45 +375,45 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().newAI[1] = 0f; } - if (!flag2) + if (!shouldFly) { NPC.TargetClosest(true); NPC.velocity.Y = NPC.velocity.Y + 0.15f; - if (NPC.velocity.Y > num17) + if (NPC.velocity.Y > fallSpeed) { - NPC.velocity.Y = num17; + NPC.velocity.Y = fallSpeed; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.4) { if (NPC.velocity.X < 0f) { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; } else { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; } } - else if (NPC.velocity.Y == num17) + else if (NPC.velocity.Y == fallSpeed) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } } else if (NPC.velocity.Y > 4f) { if (NPC.velocity.X < 0f) { - NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f; } else { - NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f; } } } @@ -421,131 +421,131 @@ namespace CalamityMod.NPCs.Perforator { if (NPC.soundDelay == 0) { - float num24 = num22 / 40f; - if (num24 < 10f) + float soundDelay = targetDistance / 40f; + if (soundDelay < 10f) { - num24 = 10f; + soundDelay = 10f; } - if (num24 > 20f) + if (soundDelay > 20f) { - num24 = 20f; + soundDelay = 20f; } - NPC.soundDelay = (int)num24; + NPC.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = num17 / num22; - num20 *= num27; - num21 *= num27; - if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) + targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); + float absoluteTargetX = Math.Abs(playerX); + float absoluteTargetPos = Math.Abs(targettingPosition); + float timeToReachTarget = fallSpeed / targetDistance; + playerX *= timeToReachTarget; + targettingPosition *= timeToReachTarget; + if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num19; + NPC.velocity.X = NPC.velocity.X + turnSpeedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num19; + NPC.velocity.X = NPC.velocity.X - turnSpeedCopy; } - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y + num19; + NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y - num19; + NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy; } } - if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) + if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + speedCopy; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - speedCopy; } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) + if ((double)Math.Abs(targettingPosition) < (double)fallSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f; } else { - NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) + if ((double)Math.Abs(playerX) < (double)fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 2f; } else { - NPC.velocity.X = NPC.velocity.X - num18 * 2f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 2f; } } } - else if (num25 > num26) + else if (absoluteTargetX > absoluteTargetPos) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < playerX) { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.5) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + speedCopy; } else { - NPC.velocity.Y = NPC.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - speedCopy; } } } else { - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targettingPosition) { - NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.5) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } else { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } } } } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - if (flag2) + if (shouldFly) { if (NPC.localAI[0] != 1f) { @@ -577,17 +577,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadLargeGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 0ae36f78f6..5b958674a2 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -163,70 +163,70 @@ namespace CalamityMod.NPCs.Perforator } // Movement - int num29 = (int)(NPC.position.X / 16f) - 1; - int num30 = (int)((NPC.position.X + NPC.width) / 16f) + 2; - int num31 = (int)(NPC.position.Y / 16f) - 1; - int num32 = (int)((NPC.position.Y + NPC.height) / 16f) + 2; - if (num29 < 0) - num29 = 0; - if (num30 > Main.maxTilesX) - num30 = Main.maxTilesX; - if (num31 < 0) - num31 = 0; - if (num32 > Main.maxTilesY) - num32 = Main.maxTilesY; + int tilePositionX = (int)(NPC.position.X / 16f) - 1; + int tileWidthPosX = (int)((NPC.position.X + NPC.width) / 16f) + 2; + int tilePositionY = (int)(NPC.position.Y / 16f) - 1; + int tileWidthPosY = (int)((NPC.position.Y + NPC.height) / 16f) + 2; + if (tilePositionX < 0) + tilePositionX = 0; + if (tileWidthPosX > Main.maxTilesX) + tileWidthPosX = Main.maxTilesX; + if (tilePositionY < 0) + tilePositionY = 0; + if (tileWidthPosY > Main.maxTilesY) + tileWidthPosY = Main.maxTilesY; // Fly or not - bool flag2 = false; - if (!flag2) + bool shouldFly = false; + if (!shouldFly) { - for (int num33 = num29; num33 < num30; num33++) + for (int i = tilePositionX; i < tileWidthPosX; i++) { - for (int num34 = num31; num34 < num32; num34++) + for (int j = tilePositionY; j < tileWidthPosY; j++) { - if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].HasUnactuatedTile && (Main.tileSolid[Main.tile[num33, num34].TileType] || (Main.tileSolidTop[Main.tile[num33, num34].TileType] && Main.tile[num33, num34].TileFrameY == 0))) || Main.tile[num33, num34].LiquidAmount > 64)) + if (Main.tile[i, j] != null && ((Main.tile[i, j].HasUnactuatedTile && (Main.tileSolid[Main.tile[i, j].TileType] || (Main.tileSolidTop[Main.tile[i, j].TileType] && Main.tile[i, j].TileFrameY == 0))) || Main.tile[i, j].LiquidAmount > 64)) { Vector2 vector; - vector.X = num33 * 16; - vector.Y = num34 * 16; + vector.X = i * 16; + vector.Y = j * 16; if (NPC.position.X + NPC.width > vector.X && NPC.position.X < vector.X + 16f && NPC.position.Y + NPC.height > vector.Y && NPC.position.Y < vector.Y + 16f) { - flag2 = true; - if (Main.rand.NextBool(100) && Main.tile[num33, num34].HasUnactuatedTile) + shouldFly = true; + if (Main.rand.NextBool(100) && Main.tile[i, j].HasUnactuatedTile) { - WorldGen.KillTile(num33, num34, true, true, false); + WorldGen.KillTile(i, j, true, true, false); } } } } } } - if (!flag2) + if (!shouldFly) { Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int num35 = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; - bool flag3 = true; - for (int num36 = 0; num36 < Main.maxPlayers; num36++) + int stopFlyingRadius = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; + bool outsideFlyRadius = true; + for (int k = 0; k < Main.maxPlayers; k++) { - if (Main.player[num36].active) + if (Main.player[k].active) { - Rectangle rectangle2 = new Rectangle((int)Main.player[num36].position.X - num35, (int)Main.player[num36].position.Y - num35, num35 * 2, num35 * 2); + Rectangle rectangle2 = new Rectangle((int)Main.player[k].position.X - stopFlyingRadius, (int)Main.player[k].position.Y - stopFlyingRadius, stopFlyingRadius * 2, stopFlyingRadius * 2); if (rectangle.Intersects(rectangle2)) { - flag3 = false; + outsideFlyRadius = false; break; } } } - if (flag3) - flag2 = true; + if (outsideFlyRadius) + shouldFly = true; } float fallSpeed = 16f; if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) { NPC.TargetClosest(false); - flag2 = false; + shouldFly = false; NPC.velocity.Y += 1f; if (NPC.position.Y > Main.worldSurface * 16.0) { @@ -235,31 +235,31 @@ namespace CalamityMod.NPCs.Perforator } if (NPC.position.Y > Main.rockLayer * 16.0) { - for (int num957 = 0; num957 < Main.maxNPCs; num957++) + for (int p = 0; p < Main.maxNPCs; p++) { - if (Main.npc[num957].type == NPC.type || Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType()) + if (Main.npc[p].type == NPC.type || Main.npc[p].type == ModContent.NPCType() || Main.npc[p].type == ModContent.NPCType()) { - Main.npc[num957].active = false; + Main.npc[p].active = false; } } } } // Velocity and acceleration - float num37 = speed; - float num38 = turnSpeed; + float speedCopy = speed; + float turnSpeedCopy = turnSpeed; Vector2 vector2 = NPC.Center; - float num39 = player.Center.X; - float num40 = player.Center.Y; + float targetX = player.Center.X; + float targetY = player.Center.Y; - num39 = (int)(num39 / 16f) * 16; - num40 = (int)(num40 / 16f) * 16; + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; vector2.X = (int)(vector2.X / 16f) * 16; vector2.Y = (int)(vector2.Y / 16f) * 16; - num39 -= vector2.X; - num40 -= vector2.Y; - float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); + targetX -= vector2.X; + targetY -= vector2.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); // Prevent new heads from being slowed when they spawn if (NPC.Calamity().newAI[1] < 3f) @@ -267,10 +267,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().newAI[1] += 1f; // Set velocity for when a new head spawns - NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (num37 * (death ? 0.3f : 0.2f)); + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (speedCopy * (death ? 0.3f : 0.2f)); } - if (!flag2) + if (!shouldFly) { NPC.velocity.Y += 0.15f; if (NPC.velocity.Y > fallSpeed) @@ -279,23 +279,23 @@ namespace CalamityMod.NPCs.Perforator if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.4) { if (NPC.velocity.X < 0f) - NPC.velocity.X -= num38 * 1.1f; + NPC.velocity.X -= turnSpeedCopy * 1.1f; else - NPC.velocity.X += num38 * 1.1f; + NPC.velocity.X += turnSpeedCopy * 1.1f; } else if (NPC.velocity.Y == fallSpeed) { - if (NPC.velocity.X < num39) - NPC.velocity.X += num38; - else if (NPC.velocity.X > num39) - NPC.velocity.X -= num38; + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy; } else if (NPC.velocity.Y > 4f) { if (NPC.velocity.X < 0f) - NPC.velocity.X += num38 * 0.9f; + NPC.velocity.X += turnSpeedCopy * 0.9f; else - NPC.velocity.X -= num38 * 0.9f; + NPC.velocity.X -= turnSpeedCopy * 0.9f; } } else @@ -303,99 +303,99 @@ namespace CalamityMod.NPCs.Perforator // Sound if (NPC.soundDelay == 0) { - float num54 = num52 / 40f; - if (num54 < 10f) - num54 = 10f; - if (num54 > 20f) - num54 = 20f; + float soundDelay = targetDistance / 40f; + if (soundDelay < 10f) + soundDelay = 10f; + if (soundDelay > 20f) + soundDelay = 20f; - NPC.soundDelay = (int)num54; + NPC.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } - num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - float num55 = Math.Abs(num39); - float num56 = Math.Abs(num40); - float num57 = fallSpeed / num52; - num39 *= num57; - num40 *= num57; + targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float absoluteTargetX = Math.Abs(targetX); + float absoluteTargetY = Math.Abs(targetY); + float timeToReachTarget = fallSpeed / targetDistance; + targetX *= timeToReachTarget; + targetY *= timeToReachTarget; - if (((NPC.velocity.X > 0f && num39 > 0f) || (NPC.velocity.X < 0f && num39 < 0f)) && ((NPC.velocity.Y > 0f && num40 > 0f) || (NPC.velocity.Y < 0f && num40 < 0f))) + if (((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f)) && ((NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f))) { - if (NPC.velocity.X < num39) - NPC.velocity.X += num38; - else if (NPC.velocity.X > num39) - NPC.velocity.X -= num38; + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy; - if (NPC.velocity.Y < num40) - NPC.velocity.Y += num38; - else if (NPC.velocity.Y > num40) - NPC.velocity.Y -= num38; + if (NPC.velocity.Y < targetY) + NPC.velocity.Y += turnSpeedCopy; + else if (NPC.velocity.Y > targetY) + NPC.velocity.Y -= turnSpeedCopy; } - if ((NPC.velocity.X > 0f && num39 > 0f) || (NPC.velocity.X < 0f && num39 < 0f) || (NPC.velocity.Y > 0f && num40 > 0f) || (NPC.velocity.Y < 0f && num40 < 0f)) + if ((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f) || (NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f)) { - if (NPC.velocity.X < num39) - NPC.velocity.X += num37; - else if (NPC.velocity.X > num39) - NPC.velocity.X -= num37; + if (NPC.velocity.X < targetX) + NPC.velocity.X += speedCopy; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= speedCopy; - if (NPC.velocity.Y < num40) - NPC.velocity.Y += num37; - else if (NPC.velocity.Y > num40) - NPC.velocity.Y -= num37; + if (NPC.velocity.Y < targetY) + NPC.velocity.Y += speedCopy; + else if (NPC.velocity.Y > targetY) + NPC.velocity.Y -= speedCopy; - if (Math.Abs(num40) < fallSpeed * 0.2 && ((NPC.velocity.X > 0f && num39 < 0f) || (NPC.velocity.X < 0f && num39 > 0f))) + if (Math.Abs(targetY) < fallSpeed * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) - NPC.velocity.Y += num37 * 2f; + NPC.velocity.Y += speedCopy * 2f; else - NPC.velocity.Y -= num37 * 2f; + NPC.velocity.Y -= speedCopy * 2f; } - if (Math.Abs(num39) < fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && num40 < 0f) || (NPC.velocity.Y < 0f && num40 > 0f))) + if (Math.Abs(targetX) < fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) - NPC.velocity.X += num37 * 2f; + NPC.velocity.X += speedCopy * 2f; else - NPC.velocity.X -= num37 * 2f; + NPC.velocity.X -= speedCopy * 2f; } } - else if (num55 > num56) + else if (absoluteTargetX > absoluteTargetY) { - if (NPC.velocity.X < num39) - NPC.velocity.X += num37 * 1.1f; - else if (NPC.velocity.X > num39) - NPC.velocity.X -= num37 * 1.1f; + if (NPC.velocity.X < targetX) + NPC.velocity.X += speedCopy * 1.1f; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= speedCopy * 1.1f; if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.5) { if (NPC.velocity.Y > 0f) - NPC.velocity.Y += num37; + NPC.velocity.Y += speedCopy; else - NPC.velocity.Y -= num37; + NPC.velocity.Y -= speedCopy; } } else { - if (NPC.velocity.Y < num40) - NPC.velocity.Y += num37 * 1.1f; - else if (NPC.velocity.Y > num40) - NPC.velocity.Y -= num37 * 1.1f; + if (NPC.velocity.Y < targetY) + NPC.velocity.Y += speedCopy * 1.1f; + else if (NPC.velocity.Y > targetY) + NPC.velocity.Y -= speedCopy * 1.1f; if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.5) { if (NPC.velocity.X > 0f) - NPC.velocity.X += num37; + NPC.velocity.X += speedCopy; else - NPC.velocity.X -= num37; + NPC.velocity.X -= speedCopy; } } } NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; - if (flag2) + if (shouldFly) { if (NPC.localAI[0] != 1f) NPC.netUpdate = true; @@ -423,17 +423,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadMediumGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 79a4a64044..dd79644dc6 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -157,10 +157,10 @@ namespace CalamityMod.NPCs.Perforator { int Previous = NPC.whoAmI; int maxLength = death ? 9 : revenge ? 8 : expertMode ? 7 : 5; - for (int num36 = 0; num36 < maxLength; num36++) + for (int segments = 0; segments < maxLength; segments++) { int lol; - if (num36 >= 0 && num36 < maxLength - 1) + if (segments >= 0 && segments < maxLength - 1) { lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } @@ -179,32 +179,32 @@ namespace CalamityMod.NPCs.Perforator } } - int num12 = (int)(NPC.position.X / 16f) - 1; - int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; - int num14 = (int)(NPC.position.Y / 16f) - 1; - int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; - if (num12 < 0) + int tilePositionX = (int)(NPC.position.X / 16f) - 1; + int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int tilePositionY = (int)(NPC.position.Y / 16f) - 1; + int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; + if (tilePositionX < 0) { - num12 = 0; + tilePositionX = 0; } - if (num13 > Main.maxTilesX) + if (tileWidthPosX > Main.maxTilesX) { - num13 = Main.maxTilesX; + tileWidthPosX = Main.maxTilesX; } - if (num14 < 0) + if (tilePositionY < 0) { - num14 = 0; + tilePositionY = 0; } - if (num15 > Main.maxTilesY) + if (tileWidthPosY > Main.maxTilesY) { - num15 = Main.maxTilesY; + tileWidthPosY = Main.maxTilesY; } - bool flag2 = false; - if (!flag2) + bool shouldFly = false; + if (!shouldFly) { - for (int k = num12; k < num13; k++) + for (int k = tilePositionX; k < tileWidthPosX; k++) { - for (int l = num14; l < num15; l++) + for (int l = tilePositionY; l < tileWidthPosY; l++) { if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) { @@ -213,36 +213,36 @@ namespace CalamityMod.NPCs.Perforator vector2.Y = (float)(l * 16); if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) { - flag2 = true; + shouldFly = true; break; } } } } } - if (!flag2) + if (!shouldFly) { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int num16 = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; - bool flag3 = true; + int stopFlyingRadius = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; + bool outsideFlyRadius = true; if (NPC.position.Y > player.position.Y) { for (int m = 0; m < 255; m++) { if (Main.player[m].active) { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - stopFlyingRadius, (int)Main.player[m].position.Y - stopFlyingRadius, stopFlyingRadius * 2, stopFlyingRadius * 2); if (rectangle.Intersects(rectangle2)) { - flag3 = false; + outsideFlyRadius = false; break; } } } - if (flag3) + if (outsideFlyRadius) { - flag2 = true; + shouldFly = true; } } } @@ -250,15 +250,15 @@ namespace CalamityMod.NPCs.Perforator { NPC.localAI[1] = 0f; } - float num17 = 16f; + float maxChargeSpeed = 16f; if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) { - flag2 = false; + shouldFly = false; NPC.velocity.Y += 1f; if ((double)NPC.position.Y > Main.worldSurface * 16.0) { NPC.velocity.Y += 1f; - num17 = 32f; + maxChargeSpeed = 32f; } if ((double)NPC.position.Y > Main.rockLayer * 16.0) { @@ -279,7 +279,7 @@ namespace CalamityMod.NPCs.Perforator //GFB movement if (NPC.ai[0] >= 300f && CalamityGlobalNPC.perfHive >= 0) { - flag2 = false; + shouldFly = false; NPC Hive = Main.npc[CalamityGlobalNPC.perfHive]; Vector2 targetDistance = Hive.Center - NPC.Center; @@ -304,57 +304,57 @@ namespace CalamityMod.NPCs.Perforator //Normal movement else { - float num18 = speed; - float num19 = turnSpeed; - Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num20 = player.position.X + (float)(player.width / 2); - float num21 = player.position.Y + (float)(player.height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (!flag2) + float speedCopy = speed; + float turnSpeedCopy = turnSpeed; + Vector2 npcCenter = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetX = player.position.X + (float)(player.width / 2); + float targetY = player.position.Y + (float)(player.height / 2); + targetX = (float)((int)(targetX / 16f) * 16); + targetY = (float)((int)(targetY / 16f) * 16); + npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16); + npcCenter.Y = (float)((int)(npcCenter.Y / 16f) * 16); + targetX -= npcCenter.X; + targetY -= npcCenter.Y; + float targetDistance = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + if (!shouldFly) { NPC.TargetClosest(true); NPC.velocity.Y = NPC.velocity.Y + 0.15f; - if (NPC.velocity.Y > num17) + if (NPC.velocity.Y > maxChargeSpeed) { - NPC.velocity.Y = num17; + NPC.velocity.Y = maxChargeSpeed; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.4) { if (NPC.velocity.X < 0f) { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; } else { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; } } - else if (NPC.velocity.Y == num17) + else if (NPC.velocity.Y == maxChargeSpeed) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < targetX) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > targetX) { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } } else if (NPC.velocity.Y > 4f) { if (NPC.velocity.X < 0f) { - NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f; } else { - NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f; } } } @@ -362,132 +362,132 @@ namespace CalamityMod.NPCs.Perforator { if (NPC.soundDelay == 0) { - float num24 = num22 / 40f; - if (num24 < 10f) + float soundDelay = targetDistance / 40f; + if (soundDelay < 10f) { - num24 = 10f; + soundDelay = 10f; } - if (num24 > 20f) + if (soundDelay > 20f) { - num24 = 20f; + soundDelay = 20f; } - NPC.soundDelay = (int)num24; + NPC.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = num17 / num22; - num20 *= num27; - num21 *= num27; - if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) + targetDistance = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + float absoluteTargetX = Math.Abs(targetX); + float absoluteTargetY = Math.Abs(targetY); + float timeToReachTarget = maxChargeSpeed / targetDistance; + targetX *= timeToReachTarget; + targetY *= timeToReachTarget; + if (((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f)) && ((NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f))) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < targetX) { - NPC.velocity.X = NPC.velocity.X + num19; + NPC.velocity.X = NPC.velocity.X + turnSpeedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > targetX) { - NPC.velocity.X = NPC.velocity.X - num19; + NPC.velocity.X = NPC.velocity.X - turnSpeedCopy; } - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targetY) { - NPC.velocity.Y = NPC.velocity.Y + num19; + NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targetY) { - NPC.velocity.Y = NPC.velocity.Y - num19; + NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy; } } - if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) + if ((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f) || (NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f)) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < targetX) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > targetX) { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targetY) { - NPC.velocity.Y = NPC.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + speedCopy; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targetY) { - NPC.velocity.Y = NPC.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - speedCopy; } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) + if ((double)Math.Abs(targetY) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f; } else { - NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) + if ((double)Math.Abs(targetX) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 2f; } else { - NPC.velocity.X = NPC.velocity.X - num18 * 2f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 2f; } } } - else if (num25 > num26) + else if (absoluteTargetX > absoluteTargetY) { - if (NPC.velocity.X < num20) + if (NPC.velocity.X < targetX) { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; } - else if (NPC.velocity.X > num20) + else if (NPC.velocity.X > targetX) { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + speedCopy; } else { - NPC.velocity.Y = NPC.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - speedCopy; } } } else { - if (NPC.velocity.Y < num21) + if (NPC.velocity.Y < targetY) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f; } - else if (NPC.velocity.Y > num21) + else if (NPC.velocity.Y > targetY) { - NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + speedCopy; } else { - NPC.velocity.X = NPC.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - speedCopy; } } } } } NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - if (flag2) + if (shouldFly) { if (NPC.localAI[0] != 1f) { @@ -519,17 +519,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 glowmaskDrawLocation = NPC.Center - screenPos; + glowmaskDrawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + glowmaskDrawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadSmallGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index fb2b257f33..7eddc1ae75 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -240,8 +240,8 @@ namespace CalamityMod.NPCs.Perforator { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)(NPC.lifeMax * (Main.getGoodWorld ? 0.15 : 0.25)); - if ((NPC.life + num660) < NPC.ai[3]) + int wormSpawnGateValue = (int)(NPC.lifeMax * (Main.getGoodWorld ? 0.15 : 0.25)); + if ((NPC.life + wormSpawnGateValue) < NPC.ai[3]) { NPC.ai[3] = NPC.life; int wormType = ModContent.NPCType(); @@ -276,24 +276,24 @@ namespace CalamityMod.NPCs.Perforator SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.Center); - for (int num621 = 0; num621 < 16; num621++) + for (int i = 0; i < 16; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 2f; + int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); + Main.dust[ichorDust].velocity *= 2f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.25f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[ichorDust].scale = 0.25f; + Main.dust[ichorDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 32; num623++) + for (int j = 0; j < 32; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 3f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f); + Main.dust[bloodDust].noGravity = true; + Main.dust[bloodDust].velocity *= 3f; + bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[bloodDust].velocity *= 2f; } } } @@ -329,16 +329,16 @@ namespace CalamityMod.NPCs.Perforator SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.Center); - for (int num621 = 0; num621 < 32; num621++) + for (int i = 0; i < 32; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); - float dustVelocityYAdd = Math.Abs(Main.dust[num622].velocity.Y) * 0.5f; - if (Main.dust[num622].velocity.Y < 0f) - Main.dust[num622].velocity.Y = 2f + dustVelocityYAdd; + int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); + float dustVelocityYAdd = Math.Abs(Main.dust[ichorDust].velocity.Y) * 0.5f; + if (Main.dust[ichorDust].velocity.Y < 0f) + Main.dust[ichorDust].velocity.Y = 2f + dustVelocityYAdd; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.25f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[ichorDust].scale = 0.25f; + Main.dust[ichorDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } @@ -393,24 +393,24 @@ namespace CalamityMod.NPCs.Perforator NPC.localAI[0] = 0f; SoundEngine.PlaySound(SoundID.NPCHit20, NPC.Center); - for (int num621 = 0; num621 < 8; num621++) + for (int i = 0; i < 8; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); + Main.dust[ichorDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.25f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[ichorDust].scale = 0.25f; + Main.dust[ichorDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 16; num623++) + for (int j = 0; j < 16; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f); + Main.dust[bloodDust].noGravity = true; + Main.dust[bloodDust].velocity *= 5f; + bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[bloodDust].velocity *= 2f; } int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); @@ -487,17 +487,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHiveGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -609,23 +609,23 @@ namespace CalamityMod.NPCs.Perforator NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[ichorDust].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[ichorDust].scale = 0.5f; + Main.dust[ichorDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f); + Main.dust[bloodDust].noGravity = true; + Main.dust[bloodDust].velocity *= 5f; + bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[bloodDust].velocity *= 2f; } } } diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 3ba822c041..decd23463b 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetX = (float)((int)(targetX / 16f) * 16); + targetY = (float)((int)(targetY / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetX -= segmentPosition.X; + targetY -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = NPC.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + int npcWidth = NPC.width; + targetDistance = (targetDistance - (float)npcWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + targetX; + NPC.position.Y = NPC.position.Y + targetY; - if (num191 < 0f) + if (targetX < 0f) NPC.spriteDirection = 1; - else if (num191 > 0f) + else if (targetX > 0f) NPC.spriteDirection = -1; } } @@ -147,17 +147,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailLargeGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 3f89c5fada..a87c5bab46 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - Vector2 vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num39 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num40 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num39 = (int)(num39 / 16f) * 16; - num40 = (int)(num40 / 16f) * 16; - vector2.X = (int)(vector2.X / 16f) * 16; - vector2.Y = (int)(vector2.Y / 16f) * 16; - num39 -= vector2.X; - num40 -= vector2.Y; - float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + segmentDirection.X = (int)(segmentDirection.X / 16f) * 16; + segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16; + targetX -= segmentDirection.X; + targetY -= segmentDirection.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num39 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector2.X; - num40 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector2.Y; + segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentDirection.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentDirection.Y; } catch { } - NPC.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2; - num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - int num53 = NPC.width; - num53 = (int)(num53 * NPC.scale); - num52 = (num52 - num53) / num52; - num39 *= num52; - num40 *= num52; + NPC.rotation = (float)Math.Atan2(targetY, targetX) + MathHelper.PiOver2; + targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + int npcWidth = NPC.width; + npcWidth = (int)(npcWidth * NPC.scale); + targetDistance = (targetDistance - npcWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X += num39; - NPC.position.Y += num40; + NPC.position.X += targetX; + NPC.position.Y += targetY; } } @@ -146,17 +146,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailMediumGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 79e5c04b0f..f64eadc007 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetX = (float)((int)(targetX / 16f) * 16); + targetY = (float)((int)(targetY / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetX -= segmentPosition.X; + targetY -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = NPC.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + int npcWidth = NPC.width; + targetDistance = (targetDistance - (float)npcWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + targetX; + NPC.position.Y = NPC.position.Y + targetY; - if (num191 < 0f) + if (targetX < 0f) NPC.spriteDirection = 1; - else if (num191 > 0f) + else if (targetX > 0f) NPC.spriteDirection = -1; } } @@ -147,17 +147,17 @@ namespace CalamityMod.NPCs.Perforator spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailSmallGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index 7895b13f7c..f60f882457 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -56,32 +56,32 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Math.Abs(NPC.velocity.X) >= 3f || Math.Abs(NPC.velocity.Y) >= 3f) { - float num247 = 0f; - float num248 = 0f; + float dustXOffset = 0f; + float dustYOffset = 0f; if (Main.rand.NextBool()) { - num247 = NPC.velocity.X * 0.5f; - num248 = NPC.velocity.Y * 0.5f; + dustXOffset = NPC.velocity.X * 0.5f; + dustYOffset = NPC.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(NPC.position.X + 3f + num247, NPC.position.Y + 3f + num248) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 6, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(NPC.position.X + 3f + num247, NPC.position.Y + 3f + num248) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 31, 0f, 0f, 100, default, 0.25f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int smokyFire = Dust.NewDust(new Vector2(NPC.position.X + 3f + dustXOffset, NPC.position.Y + 3f + dustYOffset) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 6, 0f, 0f, 100, default, 0.5f); + Main.dust[smokyFire].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[smokyFire].velocity *= 0.2f; + Main.dust[smokyFire].noGravity = true; + smokyFire = Dust.NewDust(new Vector2(NPC.position.X + 3f + dustXOffset, NPC.position.Y + 3f + dustYOffset) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 31, 0f, 0f, 100, default, 0.25f); + Main.dust[smokyFire].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[smokyFire].velocity *= 0.05f; } else if (Main.rand.NextBool(4)) { - int num252 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2)).RotatedBy((double)NPC.rotation, default) * 1.1f; - num252 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2 - 6)).RotatedBy((double)NPC.rotation, default) * 1.1f; + int smokyFire2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 31, 0f, 0f, 100, default, 0.5f); + Main.dust[smokyFire2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[smokyFire2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[smokyFire2].noGravity = true; + Main.dust[smokyFire2].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2)).RotatedBy((double)NPC.rotation, default) * 1.1f; + smokyFire2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 6, 0f, 0f, 100, default, 1f); + Main.dust[smokyFire2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[smokyFire2].noGravity = true; + Main.dust[smokyFire2].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2 - 6)).RotatedBy((double)NPC.rotation, default) * 1.1f; } NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; @@ -98,8 +98,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[0] = 1f; NPC.ai[1] = (float)Player.FindClosest(NPC.position, NPC.width, NPC.height); NPC.netUpdate = true; - float num754 = NPC.velocity.Length(); - NPC.velocity = Vector2.Normalize(NPC.velocity) * (num754 + 1f); + float npcSpeed = NPC.velocity.Length(); + NPC.velocity = Vector2.Normalize(NPC.velocity) * (npcSpeed + 1f); } else if (NPC.ai[0] == 1f) { @@ -117,9 +117,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { NPC.noTileCollide = true; Vector2 v3 = Main.player[(int)NPC.ai[1]].Center - NPC.Center; - float num760 = NPC.velocity.ToRotation(); - float num761 = v3.ToRotation(); - float angle = num761 - num760; + float facingDirection = NPC.velocity.ToRotation(); + float playerDirection = v3.ToRotation(); + float angle = playerDirection - facingDirection; angle = MathHelper.WrapAngle(angle); NPC.velocity = NPC.velocity.RotatedBy(angle * 0.2); } @@ -159,49 +159,47 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 5; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color secondAfterimageColor = redLerpColor; + secondAfterimageColor = Color.Lerp(secondAfterimageColor, Color.White, 0.5f); + secondAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 secondAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + secondAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -222,25 +220,25 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.width = NPC.height = Main.zenithWorld ? 300 : 216; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int greenPlague = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[greenPlague].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[greenPlague].scale = 0.5f; + Main.dust[greenPlague].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } - Main.dust[num622].noGravity = true; + Main.dust[greenPlague].noGravity = true; } - for (int num623 = 0; num623 < 30; num623++) + for (int j = 0; j < 30; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; + int greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[greenPlague2].noGravity = true; + Main.dust[greenPlague2].velocity *= 5f; + greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[greenPlague2].velocity *= 2f; + Main.dust[greenPlague2].noGravity = true; } return true; } diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 7bf16570f0..4b5d876202 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -86,16 +86,16 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.TargetClosest(true); float velocity = (bossRush ? 14f : death ? 12f : revenge ? 10f : 8f) + NPC.ai[3] * 0.04f; - Vector2 vector167 = new Vector2(NPC.Center.X + (float)(NPC.direction * 20), NPC.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = velocity / num1375; - num1373 *= num1376; - num1374 *= num1376; + Vector2 npcDirection = new Vector2(NPC.Center.X + (float)(NPC.direction * 20), NPC.Center.Y + 6f); + float targetX = player.position.X + (float)player.width * 0.5f - npcDirection.X; + float targetY = player.Center.Y - npcDirection.Y; + float targetDistance = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + float npcSpeed = velocity / targetDistance; + targetX *= npcSpeed; + targetY *= npcSpeed; float inertia = (bossRush ? 35f : death ? 40f : revenge ? 45f : 50f) - NPC.ai[3] * 0.25f; - NPC.velocity.X = (NPC.velocity.X * inertia + num1373) / (inertia + 1f); - NPC.velocity.Y = (NPC.velocity.Y * inertia + num1374) / (inertia + 1f); + NPC.velocity.X = (NPC.velocity.X * inertia + targetX) / (inertia + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia + targetY) / (inertia + 1f); } public override void FindFrame(int frameHeight) @@ -115,17 +115,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -152,25 +152,25 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.width = NPC.height = Main.zenithWorld ? 300 : 216; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int greenPlague = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[greenPlague].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[greenPlague].scale = 0.5f; + Main.dust[greenPlague].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } - Main.dust[num622].noGravity = true; + Main.dust[greenPlague].noGravity = true; } - for (int num623 = 0; num623 < 30; num623++) + for (int j = 0; j < 30; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; + int greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[greenPlague2].noGravity = true; + Main.dust[greenPlague2].velocity *= 5f; + greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); + Main.dust[greenPlague2].velocity *= 2f; + Main.dust[greenPlague2].noGravity = true; } return true; } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 2f53501477..6b7f5bfe78 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -202,11 +202,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 vectorCenter = NPC.Center; // Count nearby players - int num1038 = 0; - for (int num1039 = 0; num1039 < Main.maxPlayers; num1039++) + int activePlayers = 0; + for (int i = 0; i < Main.maxPlayers; i++) { - if (Main.player[num1039].active && !Main.player[num1039].dead && (vectorCenter - Main.player[num1039].Center).Length() < 1000f) - num1038++; + if (Main.player[i].active && !Main.player[i].dead && (vectorCenter - Main.player[i].Center).Length() < 1000f) + activePlayers++; } // Get a target @@ -305,11 +305,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num596; - do num596 = MissileCountdown == 1 ? 4 : Main.rand.Next(4); - while (num596 == NPC.ai[1] || num596 == 1); + int attackSwitch; + do attackSwitch = MissileCountdown == 1 ? 4 : Main.rand.Next(4); + while (attackSwitch == NPC.ai[1] || attackSwitch == 1); - if (num596 == 0 && diagonalDash && distFromPlayer.Length() < 1800f) + if (attackSwitch == 0 && diagonalDash && distFromPlayer.Length() < 1800f) { do { @@ -330,7 +330,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[3] = -chargeDistance; } - NPC.ai[0] = num596; + NPC.ai[0] = attackSwitch; NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.TargetClosest(); @@ -348,20 +348,20 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Charge phase else if (NPC.ai[0] == 0f) { - float num1044 = revenge ? 28f : 26f; + float chargeSpeed = revenge ? 28f : 26f; if (phase2) - num1044 += 1f; + chargeSpeed += 1f; if (phase3) - num1044 += 1f; + chargeSpeed += 1f; if (phase4) - num1044 += 1f; + chargeSpeed += 1f; if (phase5) - num1044 += 1f; + chargeSpeed += 1f; - num1044 += 2f * enrageScale; + chargeSpeed += 2f * enrageScale; - int num1043 = (int)Math.Ceiling(2f + enrageScale); - if ((NPC.ai[1] > (2 * num1043) && NPC.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) + int phaseSwitchTimer = (int)Math.Ceiling(2f + enrageScale); + if ((NPC.ai[1] > (2 * phaseSwitchTimer) && NPC.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) { NPC.ai[0] = -1f; NPC.ai[1] = 0f; @@ -383,10 +383,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { float playerLocation = vectorCenter.X - player.Center.X; - float num620 = 20f; - num620 += 20f * enrageScale; + float chargeThresholdY = 20f; + chargeThresholdY += 20f * enrageScale; - if (Math.Abs(NPC.Center.Y - (player.Center.Y - chargeDistance)) < num620) + if (Math.Abs(NPC.Center.Y - (player.Center.Y - chargeDistance)) < chargeThresholdY) { if (diagonalDash) { @@ -410,13 +410,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[1] += 1f; NPC.ai[2] = 0f; - float num1045 = player.position.X + (player.width / 2) - vectorCenter.X; - float num1046 = player.position.Y + (player.height / 2) - vectorCenter.Y; - float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046); + float targetX = player.position.X + (player.width / 2) - vectorCenter.X; + float targetY = player.position.Y + (player.height / 2) - vectorCenter.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); - num1047 = num1044 / num1047; - NPC.velocity.X = num1045 * num1047; - NPC.velocity.Y = num1046 * num1047; + targetDistance = chargeSpeed / targetDistance; + NPC.velocity.X = targetX * targetDistance; + NPC.velocity.Y = targetY * targetDistance; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); calamityGlobalNPC.newAI[1] = NPC.velocity.X; @@ -437,42 +437,42 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float num1048 = revenge ? 14f : 12f; - float num1049 = revenge ? 0.25f : 0.22f; + float maxLineUpSpeedY = revenge ? 14f : 12f; + float lineUpAccelY = revenge ? 0.25f : 0.22f; if (phase2) { - num1048 += 1f; - num1049 += 0.05f; + maxLineUpSpeedY += 1f; + lineUpAccelY += 0.05f; } if (phase4) { - num1048 += 1f; - num1049 += 0.05f; + maxLineUpSpeedY += 1f; + lineUpAccelY += 0.05f; } - num1048 += 1.5f * enrageScale; - num1049 += 0.25f * enrageScale; + maxLineUpSpeedY += 1.5f * enrageScale; + lineUpAccelY += 0.25f * enrageScale; if (vectorCenter.Y < (player.Center.Y - chargeDistance)) - NPC.velocity.Y += num1049; + NPC.velocity.Y += lineUpAccelY; else - NPC.velocity.Y -= num1049; + NPC.velocity.Y -= lineUpAccelY; - if (NPC.velocity.Y < -num1048) - NPC.velocity.Y = -num1048; - if (NPC.velocity.Y > num1048) - NPC.velocity.Y = num1048; + if (NPC.velocity.Y < -maxLineUpSpeedY) + NPC.velocity.Y = -maxLineUpSpeedY; + if (NPC.velocity.Y > maxLineUpSpeedY) + NPC.velocity.Y = maxLineUpSpeedY; if (Math.Abs(vectorCenter.X - player.Center.X) > 650f) - NPC.velocity.X += num1049 * NPC.direction; + NPC.velocity.X += lineUpAccelY * NPC.direction; else if (Math.Abs(vectorCenter.X - player.Center.X) < 500f) - NPC.velocity.X -= num1049 * NPC.direction; + NPC.velocity.X -= lineUpAccelY * NPC.direction; else NPC.velocity.X *= 0.8f; - if (NPC.velocity.X < -num1048) - NPC.velocity.X = -num1048; - if (NPC.velocity.X > num1048) - NPC.velocity.X = num1048; + if (NPC.velocity.X < -maxLineUpSpeedY) + NPC.velocity.X = -maxLineUpSpeedY; + if (NPC.velocity.X > maxLineUpSpeedY) + NPC.velocity.X = maxLineUpSpeedY; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -491,20 +491,20 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.spriteDirection = NPC.direction; - int num1050 = revenge ? 525 : 550; + int stopChargeXDist = revenge ? 525 : 550; if (phase4) - num1050 = revenge ? 450 : 475; + stopChargeXDist = revenge ? 450 : 475; else if (phase3) - num1050 = revenge ? 475 : 500; + stopChargeXDist = revenge ? 475 : 500; else if (phase2) - num1050 = revenge ? 500 : 525; - num1050 -= (int)(25f * enrageScale); + stopChargeXDist = revenge ? 500 : 525; + stopChargeXDist -= (int)(25f * enrageScale); - int num1051 = 1; + int chargeDirectionXSign = 1; if (vectorCenter.X < player.Center.X) - num1051 = -1; + chargeDirectionXSign = -1; - if (NPC.direction == num1051 && (Math.Abs(vectorCenter.X - player.Center.X) > num1050 || Math.Abs(vectorCenter.Y - player.Center.Y) > num1050)) + if (NPC.direction == chargeDirectionXSign && (Math.Abs(vectorCenter.X - player.Center.X) > stopChargeXDist || Math.Abs(vectorCenter.Y - player.Center.Y) > stopChargeXDist)) NPC.ai[2] = 1f; if (enrageScale > 0 && NPC.ai[2] == 1f) @@ -516,7 +516,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.frameCounter = 4; // Velocity fix if PBG slowed - if (NPC.velocity.Length() < num1044) + if (NPC.velocity.Length() < chargeSpeed) NPC.velocity = new Vector2(calamityGlobalNPC.newAI[1], calamityGlobalNPC.newAI[2]); calamityGlobalNPC.newAI[0] += 1f; @@ -530,13 +530,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { try { - int num430 = (int)(NPC.Center.X / 16f); - int num431 = (int)(NPC.Center.Y / 16f); - if (!WorldGen.SolidTile(num430, num431) && Main.tile[num430, num431].LiquidAmount == 0) + int tilePositionX = (int)(NPC.Center.X / 16f); + int tilePositionY = (int)(NPC.Center.Y / 16f); + if (!WorldGen.SolidTile(tilePositionX, tilePositionY) && Main.tile[tilePositionX, tilePositionY].LiquidAmount == 0) { - Main.tile[num430, num431].LiquidAmount = (byte)Main.rand.Next(50, 150); - Main.tile[num430, num431].Get().LiquidType = LiquidID.Honey; - WorldGen.SquareTileFrame(num430, num431); + Main.tile[tilePositionX, tilePositionY].LiquidAmount = (byte)Main.rand.Next(50, 150); + Main.tile[tilePositionX, tilePositionY].Get().LiquidType = LiquidID.Honey; + WorldGen.SquareTileFrame(tilePositionX, tilePositionY); } } catch @@ -557,26 +557,26 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath charging = false; NPC.velocity *= 0.9f; - float num1052 = revenge ? 0.12f : 0.1f; + float slowedVelocityThreshold = revenge ? 0.12f : 0.1f; if (phase2) { NPC.velocity *= 0.98f; - num1052 += 0.05f; + slowedVelocityThreshold += 0.05f; } if (phase3) { NPC.velocity *= 0.98f; - num1052 += 0.05f; + slowedVelocityThreshold += 0.05f; } if (phase4) { NPC.velocity *= 0.98f; - num1052 += 0.05f; + slowedVelocityThreshold += 0.05f; } if (enrageScale > 0) NPC.velocity *= 0.95f; - if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < num1052) + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < slowedVelocityThreshold) { NPC.ai[2] = 0f; NPC.ai[1] += 1f; @@ -592,12 +592,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - float num1055 = player.position.X + (player.width / 2) - vectorCenter.X; - float num1056 = player.position.Y + (player.height / 2) - 200f - vectorCenter.Y; - float num1057 = (float)Math.Sqrt(num1055 * num1055 + num1056 * num1056); + float playerXDist = player.position.X + (player.width / 2) - vectorCenter.X; + float playerYDist = player.position.Y + (player.height / 2) - 200f - vectorCenter.Y; + float playerTotalDist = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); calamityGlobalNPC.newAI[0] += 1f; - if (num1057 < 600f || calamityGlobalNPC.newAI[0] >= 180f) + if (playerTotalDist < 600f || calamityGlobalNPC.newAI[0] >= 180f) { NPC.ai[0] = (phase3 || bossRush) ? 5f : 1f; NPC.ai[1] = 0f; @@ -622,53 +622,53 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (NPC.ai[0] == 1f) { charging = false; - Vector2 vector119 = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); - vector119.X += NPC.direction * 120; - float num1058 = player.position.X + (player.width / 2) - vectorCenter.X; - float num1059 = player.position.Y + (player.height / 2) - vectorCenter.Y; - float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); + Vector2 missileSpawnPos = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); + missileSpawnPos.X += NPC.direction * 120; + float playerMissileX = player.position.X + (player.width / 2) - vectorCenter.X; + float playerMissileY = player.position.Y + (player.height / 2) - vectorCenter.Y; + float playerMissileDist = (float)Math.Sqrt(playerMissileX * playerMissileX + playerMissileY * playerMissileY); NPC.ai[1] += 1f; - NPC.ai[1] += num1038 / 2; + NPC.ai[1] += activePlayers / 2; if (phase2) NPC.ai[1] += 0.5f; - bool flag103 = false; + bool shouldSpawnMissiles = false; if (NPC.ai[1] > 40f - 12f * enrageScale) { NPC.ai[1] = 0f; NPC.ai[2] += 1f; - flag103 = true; + shouldSpawnMissiles = true; } - if (flag103) + if (shouldSpawnMissiles) { SoundEngine.PlaySound(SoundID.NPCHit8, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 2) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)missileSpawnPos.X, (int)missileSpawnPos.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); float npcSpeed = (revenge ? 9f : 7f) + enrageScale * 2f; - float num1071 = player.position.X + player.width * 0.5f - vector119.X; - float num1072 = player.position.Y + player.height * 0.5f - vector119.Y; - float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); + float projXDist = player.position.X + player.width * 0.5f - missileSpawnPos.X; + float projYDist = player.position.Y + player.height * 0.5f - missileSpawnPos.Y; + float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); - num1073 = npcSpeed / num1073; - num1071 *= num1073; - num1072 *= num1073; + projDistance = npcSpeed / projDistance; + projXDist *= projDistance; + projYDist *= projDistance; - int num1062 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); - Main.npc[num1062].velocity.X = num1071; - Main.npc[num1062].velocity.Y = num1072; - Main.npc[num1062].netUpdate = true; + int plagueMissile = NPC.NewNPC(NPC.GetSource_FromAI(), (int)missileSpawnPos.X, (int)missileSpawnPos.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); + Main.npc[plagueMissile].velocity.X = projXDist; + Main.npc[plagueMissile].velocity.Y = projYDist; + Main.npc[plagueMissile].netUpdate = true; } } // Move closer if too far away - if (num1060 > 600f) + if (playerMissileDist > 600f) Movement(100f, 350f, 450f, player, enrageScale); else NPC.velocity *= 0.9f; @@ -697,15 +697,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (NPC.ai[0] == 5f) { charging = false; - Vector2 vector119 = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); - vector119.X += NPC.direction * 120; - float num1058 = player.position.X + (player.width / 2) - vectorCenter.X; - float num1059 = player.position.Y + (player.height / 2) - vectorCenter.Y; - float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); + Vector2 missileSpawnPos = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); + missileSpawnPos.X += NPC.direction * 120; + float playerMissileX = player.position.X + (player.width / 2) - vectorCenter.X; + float playerMissileY = player.position.Y + (player.height / 2) - vectorCenter.Y; + float playerMissileDist = (float)Math.Sqrt(playerMissileX * playerMissileX + playerMissileY * playerMissileY); NPC.ai[1] += 1f; - NPC.ai[1] += num1038 / 2; - bool flag103 = false; + NPC.ai[1] += activePlayers / 2; + bool shouldSpawnMissiles = false; if (phase4) NPC.ai[1] += 0.5f; if (phase5) @@ -718,39 +718,39 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { NPC.ai[1] = 0f; NPC.ai[2] += 1f; - flag103 = true; + shouldSpawnMissiles = true; } - if (flag103) + if (shouldSpawnMissiles) { SoundEngine.PlaySound(SoundID.Item88,NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 3) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)missileSpawnPos.X, (int)missileSpawnPos.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); float npcSpeed = (revenge ? 11f : 9f) + enrageScale * 2f; - float num1071 = player.position.X + player.width * 0.5f - vector119.X; - float num1072 = player.position.Y + player.height * 0.5f - vector119.Y; - float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); + float projXDist = player.position.X + player.width * 0.5f - missileSpawnPos.X; + float projYDist = player.position.Y + player.height * 0.5f - missileSpawnPos.Y; + float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); - num1073 = npcSpeed / num1073; - num1071 *= num1073; - num1072 *= num1073; - num1071 += Main.rand.Next(-20, 21) * 0.05f; - num1072 += Main.rand.Next(-20, 21) * 0.05f; + projDistance = npcSpeed / projDistance; + projXDist *= projDistance; + projYDist *= projDistance; + projXDist += Main.rand.Next(-20, 21) * 0.05f; + projYDist += Main.rand.Next(-20, 21) * 0.05f; - int num1062 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); - Main.npc[num1062].velocity.X = num1071; - Main.npc[num1062].velocity.Y = num1072; - Main.npc[num1062].netUpdate = true; + int plagueMissile = NPC.NewNPC(NPC.GetSource_FromAI(), (int)missileSpawnPos.X, (int)missileSpawnPos.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); + Main.npc[plagueMissile].velocity.X = projXDist; + Main.npc[plagueMissile].velocity.Y = projYDist; + Main.npc[plagueMissile].netUpdate = true; } } // Move closer if too far away - if (num1060 > 600f) + if (playerMissileDist > 600f) Movement(100f, 350f, 450f, player, enrageScale); else NPC.velocity *= 0.9f; @@ -778,14 +778,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Stinger phase else if (NPC.ai[0] == 3f) { - Vector2 vector121 = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); - vector121.X += NPC.direction * 120; + Vector2 stingerSpawnPos = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); + stingerSpawnPos.X += NPC.direction * 120; NPC.ai[1] += 1f; - int num650 = phase5 ? 20 : (phase3 ? 25 : 30); - num650 -= (int)Math.Ceiling(5f * enrageScale); + int stingerFireDelay = phase5 ? 20 : (phase3 ? 25 : 30); + stingerFireDelay -= (int)Math.Ceiling(5f * enrageScale); - if (NPC.ai[1] % num650 == (num650 - 1) && vectorCenter.Y < player.position.Y) + if (NPC.ai[1] % stingerFireDelay == (stingerFireDelay - 1) && vectorCenter.Y < player.position.Y) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); @@ -794,12 +794,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float projectileSpeed = revenge ? 6f : 5f; projectileSpeed += 2f * enrageScale; - float num1071 = player.position.X + player.width * 0.5f - vector121.X; - float num1072 = player.position.Y + player.height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); - num1073 = projectileSpeed / num1073; - num1071 *= num1073; - num1072 *= num1073; + float projXDist = player.position.X + player.width * 0.5f - stingerSpawnPos.X; + float projYDist = player.position.Y + player.height * 0.5f - stingerSpawnPos.Y; + float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); + projDistance = projectileSpeed / projDistance; + projXDist *= projDistance; + projYDist *= projDistance; int type = ModContent.ProjectileType(); switch ((int)NPC.ai[2]) @@ -823,7 +823,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector121.X, vector121.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, challengeAmt, player.position.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), stingerSpawnPos.X, stingerSpawnPos.Y, projXDist, projYDist, type, damage, 0f, Main.myPlayer, challengeAmt, player.position.Y); NPC.netUpdate = true; } @@ -838,7 +838,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - if (NPC.ai[1] > num650 * 10f) + if (NPC.ai[1] > stingerFireDelay * 10f) { NPC.ai[0] = -1f; NPC.ai[1] = 3f; @@ -857,12 +857,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Missile charge else if (NPC.ai[0] == 4f) { - float num1044 = revenge ? 28f : 26f; + float chargeSpeed = revenge ? 28f : 26f; - num1044 += 3f * enrageScale; + chargeSpeed += 3f * enrageScale; - int num1043 = (int)Math.Ceiling(2f + enrageScale); - if (NPC.ai[1] > (2 * num1043) && NPC.ai[1] % 2f == 0f) + int phaseSwitchTimer = (int)Math.Ceiling(2f + enrageScale); + if (NPC.ai[1] > (2 * phaseSwitchTimer) && NPC.ai[1] % 2f == 0f) { MissileCountdown = 0; NPC.ai[0] = -1f; @@ -883,10 +883,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { float playerLocation = vectorCenter.X - player.Center.X; - float num620 = 20f; - num620 += 20 * enrageScale; + float chargeThresholdY = 20f; + chargeThresholdY += 20 * enrageScale; - if (Math.Abs(vectorCenter.Y - (player.Center.Y - 500f)) < num620) + if (Math.Abs(vectorCenter.Y - (player.Center.Y - 500f)) < chargeThresholdY) { if (MissileCountdown == 1) { @@ -942,13 +942,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[1] += 1f; NPC.ai[2] = 0f; - float num1045 = player.position.X + (player.width / 2) - vectorCenter.X; - float num1046 = player.position.Y - 500f + (player.height / 2) - vectorCenter.Y; - float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046); + float targetX = player.position.X + (player.width / 2) - vectorCenter.X; + float targetY = player.position.Y - 500f + (player.height / 2) - vectorCenter.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); - num1047 = num1044 / num1047; - NPC.velocity.X = num1045 * num1047; - NPC.velocity.Y = num1046 * num1047; + targetDistance = chargeSpeed / targetDistance; + NPC.velocity.X = targetX * targetDistance; + NPC.velocity.Y = targetY * targetDistance; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); NPC.direction = playerLocation < 0 ? 1 : -1; @@ -964,32 +964,32 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float num1048 = revenge ? 16f : 14f; - float num1049 = revenge ? 0.2f : 0.18f; - num1048 += 1.5f * enrageScale; - num1049 += 0.25f * enrageScale; + float maxLineUpSpeedY = revenge ? 16f : 14f; + float lineUpAccelY = revenge ? 0.2f : 0.18f; + maxLineUpSpeedY += 1.5f * enrageScale; + lineUpAccelY += 0.25f * enrageScale; if (vectorCenter.Y < player.Center.Y - 500f) - NPC.velocity.Y += num1049; + NPC.velocity.Y += lineUpAccelY; else - NPC.velocity.Y -= num1049; + NPC.velocity.Y -= lineUpAccelY; - if (NPC.velocity.Y < -num1048) - NPC.velocity.Y = -num1048; - if (NPC.velocity.Y > num1048) - NPC.velocity.Y = num1048; + if (NPC.velocity.Y < -maxLineUpSpeedY) + NPC.velocity.Y = -maxLineUpSpeedY; + if (NPC.velocity.Y > maxLineUpSpeedY) + NPC.velocity.Y = maxLineUpSpeedY; if (Math.Abs(vectorCenter.X - player.Center.X) > 600f) - NPC.velocity.X += num1049 * NPC.direction; + NPC.velocity.X += lineUpAccelY * NPC.direction; else if (Math.Abs(vectorCenter.X - player.Center.X) < 300f) - NPC.velocity.X -= num1049 * NPC.direction; + NPC.velocity.X -= lineUpAccelY * NPC.direction; else NPC.velocity.X *= 0.8f; - if (NPC.velocity.X < -num1048) - NPC.velocity.X = -num1048; - if (NPC.velocity.X > num1048) - NPC.velocity.X = num1048; + if (NPC.velocity.X < -maxLineUpSpeedY) + NPC.velocity.X = -maxLineUpSpeedY; + if (NPC.velocity.X > maxLineUpSpeedY) + NPC.velocity.X = maxLineUpSpeedY; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -1005,12 +1005,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.spriteDirection = NPC.direction; - int num1050 = 600; - int num1051 = 1; + int stopChargeXDist = 600; + int chargeDirectionXSign = 1; if (vectorCenter.X < player.Center.X) - num1051 = -1; - if (NPC.direction == num1051 && Math.Abs(vectorCenter.X - player.Center.X) > num1050) + chargeDirectionXSign = -1; + if (NPC.direction == chargeDirectionXSign && Math.Abs(vectorCenter.X - player.Center.X) > stopChargeXDist) NPC.ai[2] = 1f; if (enrageScale > 0 && NPC.ai[2] == 1f) NPC.velocity *= 0.95f; @@ -1020,8 +1020,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath charging = true; // Velocity fix if PBG slowed - if (NPC.velocity.Length() < num1044) - NPC.velocity.X = num1044 * NPC.direction; + if (NPC.velocity.Length() < chargeSpeed) + NPC.velocity.X = chargeSpeed * NPC.direction; calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] > 90f) @@ -1034,26 +1034,26 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath charging = false; NPC.velocity *= 0.9f; - float num1052 = revenge ? 0.12f : 0.1f; + float slowedVelocityThreshold = revenge ? 0.12f : 0.1f; if (phase3) { NPC.velocity *= 0.9f; - num1052 += 0.05f; + slowedVelocityThreshold += 0.05f; } if (phase4) { NPC.velocity *= 0.9f; - num1052 += 0.05f; + slowedVelocityThreshold += 0.05f; } if (phase5) { NPC.velocity *= 0.9f; - num1052 += 0.05f; + slowedVelocityThreshold += 0.05f; } if (enrageScale > 0) NPC.velocity *= 0.95f; - if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < num1052) + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < slowedVelocityThreshold) { NPC.ai[2] = 0f; NPC.ai[1] += 1f; @@ -1117,18 +1117,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 100f * NPC.scale; } @@ -1152,23 +1152,23 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.height = 200; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int plagueDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + Main.dust[plagueDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[plagueDust].scale = 0.5f; + Main.dust[plagueDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int plagueDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); + Main.dust[plagueDust2].noGravity = true; + Main.dust[plagueDust2].velocity *= 5f; + plagueDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + Main.dust[plagueDust2].velocity *= 2f; } } } @@ -1199,51 +1199,49 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath int frameCount = 3; Rectangle rectangle = new Rectangle(NPC.frame.X, NPC.frame.Y, texture.Width / 2, texture.Height / frameCount); - Vector2 vector11 = rectangle.Size() / 2f; + Vector2 halfSizeTexture = rectangle.Size() / 2f; Vector2 posOffset = new Vector2(charging ? 175 : 125, 0); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 10; + int afterimageAmt = 10; if (NPC.ai[0] != 0f && NPC.ai[0] != 4f) - num153 = 7; + afterimageAmt = 7; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int j = 1; j < afterimageAmt; j += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + posOffset; - spriteBatch.Draw(texture, vector41, new Rectangle?(rectangle), color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - j) / 15f; + Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + posOffset; + spriteBatch.Draw(texture, afterimagePos, new Rectangle?(rectangle), afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + posOffset; - spriteBatch.Draw(texture, vector43, new Rectangle?(rectangle), NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + posOffset; + spriteBatch.Draw(texture, drawLocation, new Rectangle?(rectangle), NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int k = 1; k < afterimageAmt; k++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(glowTexture.Width, glowTexture.Height / frameCount) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + posOffset; - spriteBatch.Draw(glowTexture, vector44, new Rectangle?(rectangle), color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color otherAfterimageColor = redLerpColor; + otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); + otherAfterimageColor *= (afterimageAmt - k) / 15f; + Vector2 otherAfterimagePos = NPC.oldPos[k] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + otherAfterimagePos -= new Vector2(glowTexture.Width, glowTexture.Height / frameCount) * NPC.scale / 2f; + otherAfterimagePos += halfSizeTexture * NPC.scale + posOffset; + spriteBatch.Draw(glowTexture, otherAfterimagePos, new Rectangle?(rectangle), otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(glowTexture, vector43, new Rectangle?(rectangle), color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(glowTexture, drawLocation, new Rectangle?(rectangle), redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } From a44f26d931fbfb185fdea822a1e1cddacc7ed1cf Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 23 Oct 2023 18:14:54 -0400 Subject: [PATCH 16/43] Polterghast, Guardians, Providence --- NPCs/Polterghast/PhantomFuckYou.cs | 54 ++- NPCs/Polterghast/PolterPhantom.cs | 144 ++++--- NPCs/Polterghast/Polterghast.cs | 361 +++++++++--------- NPCs/Polterghast/PolterghastHook.cs | 168 ++++---- .../ProfanedGuardianCommander.cs | 94 +++-- .../ProfanedGuardianDefender.cs | 89 +++-- .../ProfanedGuardianHealer.cs | 102 +++-- NPCs/ProfanedGuardians/ProfanedRocks.cs | 22 +- NPCs/Providence/ProvSpawnDefense.cs | 50 ++- NPCs/Providence/ProvSpawnHealer.cs | 68 ++-- NPCs/Providence/ProvSpawnOffense.cs | 56 ++- NPCs/Providence/Providence.cs | 104 ++--- 12 files changed, 644 insertions(+), 668 deletions(-) diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index bc79c19f80..a6361ff55d 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -151,30 +151,28 @@ namespace CalamityMod.NPCs.Polterghast spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + int afterimageAmt = 5; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -190,23 +188,23 @@ namespace CalamityMod.NPCs.Polterghast NPC.height = 45; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 2; num621++) + for (int i = 0; i < 2; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[ghostDust].scale = 0.5f; + Main.dust[ghostDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 3f); + Main.dust[ghostDust2].noGravity = true; + Main.dust[ghostDust2].velocity *= 5f; + ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust2].velocity *= 2f; } } } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 02370543e0..d6f60702e6 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -176,9 +176,9 @@ namespace CalamityMod.NPCs.Polterghast // Rotation if (NPC.Calamity().newAI[3] == 0f) { - float num740 = player.Center.X + predictionVector.X - vector.X; - float num741 = player.Center.Y + predictionVector.Y - vector.Y; - NPC.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + float playerXDestination = player.Center.X + predictionVector.X - vector.X; + float playerYDestination = player.Center.Y + predictionVector.Y - vector.Y; + NPC.rotation = (float)Math.Atan2(playerYDestination, playerXDestination) + MathHelper.PiOver2; } else NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; @@ -210,18 +210,18 @@ namespace CalamityMod.NPCs.Polterghast movementLimitX /= numHooks; movementLimitY /= numHooks; - Vector2 vector91 = new Vector2(movementLimitX, movementLimitY); - float num736 = player.Center.X - vector91.X; - float num737 = player.Center.Y - vector91.Y; + Vector2 movementLimitVector = new Vector2(movementLimitX, movementLimitY); + float movementLimitedXDist = player.Center.X - movementLimitVector.X; + float movementLimitedYDist = player.Center.Y - movementLimitVector.Y; if (despawnBoost) { - num737 *= -1f; - num736 *= -1f; + movementLimitedYDist *= -1f; + movementLimitedXDist *= -1f; velocity += 8f; } - float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + float movementLimitedDistance = (float)Math.Sqrt(movementLimitedXDist * movementLimitedXDist + movementLimitedYDist * movementLimitedYDist); float maxDistanceFromHooks = expertMode ? 650f : 500f; if (speedBoost || bossRush) maxDistanceFromHooks += 250f; @@ -238,54 +238,54 @@ namespace CalamityMod.NPCs.Polterghast acceleration += acceleration * 0.15f * (1f - lifeRatio); } - if (num738 >= maxDistanceFromHooks) + if (movementLimitedDistance >= maxDistanceFromHooks) { - num738 = maxDistanceFromHooks / num738; - num736 *= num738; - num737 *= num738; + movementLimitedDistance = maxDistanceFromHooks / movementLimitedDistance; + movementLimitedXDist *= movementLimitedDistance; + movementLimitedYDist *= movementLimitedDistance; } - movementLimitX += num736; - movementLimitY += num737; - vector91 = vector; - num736 = movementLimitX - vector91.X; - num737 = movementLimitY - vector91.Y; - num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + movementLimitX += movementLimitedXDist; + movementLimitY += movementLimitedYDist; + movementLimitVector = vector; + movementLimitedXDist = movementLimitX - movementLimitVector.X; + movementLimitedYDist = movementLimitY - movementLimitVector.Y; + movementLimitedDistance = (float)Math.Sqrt(movementLimitedXDist * movementLimitedXDist + movementLimitedYDist * movementLimitedYDist); - if (num738 < velocity) + if (movementLimitedDistance < velocity) { - num736 = NPC.velocity.X; - num737 = NPC.velocity.Y; + movementLimitedXDist = NPC.velocity.X; + movementLimitedYDist = NPC.velocity.Y; } else { - num738 = velocity / num738; - num736 *= num738; - num737 *= num738; + movementLimitedDistance = velocity / movementLimitedDistance; + movementLimitedXDist *= movementLimitedDistance; + movementLimitedYDist *= movementLimitedDistance; } - if (NPC.velocity.X < num736) + if (NPC.velocity.X < movementLimitedXDist) { NPC.velocity.X += acceleration; - if (NPC.velocity.X < 0f && num736 > 0f) + if (NPC.velocity.X < 0f && movementLimitedXDist > 0f) NPC.velocity.X += acceleration * 2f; } - else if (NPC.velocity.X > num736) + else if (NPC.velocity.X > movementLimitedXDist) { NPC.velocity.X -= acceleration; - if (NPC.velocity.X > 0f && num736 < 0f) + if (NPC.velocity.X > 0f && movementLimitedXDist < 0f) NPC.velocity.X -= acceleration * 2f; } - if (NPC.velocity.Y < num737) + if (NPC.velocity.Y < movementLimitedYDist) { NPC.velocity.Y += acceleration; - if (NPC.velocity.Y < 0f && num737 > 0f) + if (NPC.velocity.Y < 0f && movementLimitedYDist > 0f) NPC.velocity.Y += acceleration * 2f; } - else if (NPC.velocity.Y > num737) + else if (NPC.velocity.Y > movementLimitedYDist) { NPC.velocity.Y -= acceleration; - if (NPC.velocity.Y > 0f && num737 < 0f) + if (NPC.velocity.Y > 0f && movementLimitedYDist < 0f) NPC.velocity.Y -= acceleration * 2f; } } @@ -434,28 +434,26 @@ namespace CalamityMod.NPCs.Polterghast float changeColorGateValue = chargePhaseGateValue - colorChangeTime; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); Color lightRed = new Color(255, 100, 100, 255) * NPC.Opacity; - float amount9 = 0.5f; - int num153 = 7; + int afterimageAmt = 7; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; + Color afterimageColor = drawColor; if (!NPC.IsABestiaryIconDummy && Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) - color38 = Color.Lerp(color38, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); + afterimageColor = Color.Lerp(afterimageColor, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } @@ -464,34 +462,34 @@ namespace CalamityMod.NPCs.Polterghast if (!NPC.IsABestiaryIconDummy && Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) color = Color.Lerp(color, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterPhantomGlow").Value; Color c = Color.Red; if (!NPC.IsABestiaryIconDummy && (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < changeColorGateValue || Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue)) c = Color.Black; - Color color42 = Color.Lerp(Color.White, c, 0.5f); + Color blackWhiteLerp = Color.Lerp(Color.White, c, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Color color43 = color42; - color43 = Color.Lerp(color43, color36, amount9); - color43 = NPC.GetAlpha(color43); - color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 otherAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + otherAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + otherAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color otherAfterimageColor = blackWhiteLerp; + otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); + otherAfterimageColor = NPC.GetAlpha(otherAfterimageColor); + otherAfterimageColor *= (afterimageAmt - j) / 15f; + spriteBatch.Draw(texture2D16, otherAfterimagePos, NPC.frame, otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, blackWhiteLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -547,23 +545,23 @@ namespace CalamityMod.NPCs.Polterghast NPC.height = 90; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[ghostDust].scale = 0.5f; + Main.dust[ghostDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 3f); + Main.dust[ghostDust2].noGravity = true; + Main.dust[ghostDust2].velocity *= 5f; + ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust2].velocity *= 2f; } } } diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 23c136d5f5..05f9fa0d76 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -427,9 +427,9 @@ namespace CalamityMod.NPCs.Polterghast // Rotation if (calamityGlobalNPC.newAI[3] == 0f) { - float num740 = player.Center.X + predictionVector.X - vector.X; - float num741 = player.Center.Y + predictionVector.Y - vector.Y; - NPC.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + float playerXDestination = player.Center.X + predictionVector.X - vector.X; + float playerYDestination = player.Center.Y + predictionVector.Y - vector.Y; + NPC.rotation = (float)Math.Atan2(playerYDestination, playerXDestination) + MathHelper.PiOver2; } else NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; @@ -457,18 +457,18 @@ namespace CalamityMod.NPCs.Polterghast movementLimitX /= numHooks; movementLimitY /= numHooks; - Vector2 vector91 = new Vector2(movementLimitX, movementLimitY); - float num736 = player.Center.X - vector91.X; - float num737 = player.Center.Y - vector91.Y; + Vector2 movementLimitVector = new Vector2(movementLimitX, movementLimitY); + float movementLimitedXDist = player.Center.X - movementLimitVector.X; + float movementLimitedYDist = player.Center.Y - movementLimitVector.Y; if (despawnBoost) { - num737 *= -1f; - num736 *= -1f; + movementLimitedYDist *= -1f; + movementLimitedXDist *= -1f; velocity += 10f; } - float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + float movementLimitedDistance = (float)Math.Sqrt(movementLimitedXDist * movementLimitedXDist + movementLimitedYDist * movementLimitedYDist); float maxDistanceFromHooks = expertMode ? 650f : 500f; if (speedBoost || bossRush) maxDistanceFromHooks += 250f; @@ -481,53 +481,53 @@ namespace CalamityMod.NPCs.Polterghast acceleration += acceleration * 0.15f * (1f - lifeRatio); } - if (num738 >= maxDistanceFromHooks) + if (movementLimitedDistance >= maxDistanceFromHooks) { - num738 = maxDistanceFromHooks / num738; - num736 *= num738; - num737 *= num738; + movementLimitedDistance = maxDistanceFromHooks / movementLimitedDistance; + movementLimitedXDist *= movementLimitedDistance; + movementLimitedYDist *= movementLimitedDistance; } - movementLimitX += num736; - movementLimitY += num737; - num736 = movementLimitX - vector.X; - num737 = movementLimitY - vector.Y; - num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + movementLimitX += movementLimitedXDist; + movementLimitY += movementLimitedYDist; + movementLimitedXDist = movementLimitX - vector.X; + movementLimitedYDist = movementLimitY - vector.Y; + movementLimitedDistance = (float)Math.Sqrt(movementLimitedXDist * movementLimitedXDist + movementLimitedYDist * movementLimitedYDist); - if (num738 < velocity) + if (movementLimitedDistance < velocity) { - num736 = NPC.velocity.X; - num737 = NPC.velocity.Y; + movementLimitedXDist = NPC.velocity.X; + movementLimitedYDist = NPC.velocity.Y; } else { - num738 = velocity / num738; - num736 *= num738; - num737 *= num738; + movementLimitedDistance = velocity / movementLimitedDistance; + movementLimitedXDist *= movementLimitedDistance; + movementLimitedYDist *= movementLimitedDistance; } - if (NPC.velocity.X < num736) + if (NPC.velocity.X < movementLimitedXDist) { NPC.velocity.X += acceleration; - if (NPC.velocity.X < 0f && num736 > 0f) + if (NPC.velocity.X < 0f && movementLimitedXDist > 0f) NPC.velocity.X += acceleration * 2f; } - else if (NPC.velocity.X > num736) + else if (NPC.velocity.X > movementLimitedXDist) { NPC.velocity.X -= acceleration; - if (NPC.velocity.X > 0f && num736 < 0f) + if (NPC.velocity.X > 0f && movementLimitedXDist < 0f) NPC.velocity.X -= acceleration * 2f; } - if (NPC.velocity.Y < num737) + if (NPC.velocity.Y < movementLimitedYDist) { NPC.velocity.Y += acceleration; - if (NPC.velocity.Y < 0f && num737 > 0f) + if (NPC.velocity.Y < 0f && movementLimitedYDist > 0f) NPC.velocity.Y += acceleration * 2f; } - else if (NPC.velocity.Y > num737) + else if (NPC.velocity.Y > movementLimitedYDist) { NPC.velocity.Y -= acceleration; - if (NPC.velocity.Y > 0f && num737 < 0f) + if (NPC.velocity.Y > 0f && movementLimitedYDist < 0f) NPC.velocity.Y -= acceleration * 2f; } } @@ -670,14 +670,14 @@ namespace CalamityMod.NPCs.Polterghast { NPC.localAI[1] = 0f; - bool flag47 = Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + bool notLiningUpCharge = Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); if (NPC.localAI[3] > 0f) { - flag47 = true; + notLiningUpCharge = true; NPC.localAI[3] = 0f; } - if (flag47) + if (notLiningUpCharge) { int type = ModContent.ProjectileType(); if (Main.rand.NextBool(3)) @@ -688,26 +688,26 @@ namespace CalamityMod.NPCs.Polterghast int damage = NPC.GetProjectileDamage(type); - Vector2 vector93 = vector; - float num743 = player.Center.X - vector93.X; - float num744 = player.Center.Y - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + Vector2 firingPosition = vector; + float playerXDist = player.Center.X - firingPosition.X; + float playerYDist = player.Center.Y - firingPosition.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - num745 = baseProjectileVelocity / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + playerDistance = baseProjectileVelocity / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; + firingPosition.X += playerXDist * 3f; + firingPosition.Y += playerYDist * 3f; float rotation = MathHelper.ToRadians(65); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; + float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; double deltaAngle = rotation / 6; double offsetAngle; for (int i = 0; i < 6; i++) { offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = type == ModContent.ProjectileType() ? 450 : 1800; } } @@ -716,26 +716,26 @@ namespace CalamityMod.NPCs.Polterghast int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 vector93 = vector; - float num743 = player.Center.X - vector93.X; - float num744 = player.Center.Y - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + Vector2 firingPosition = vector; + float playerXDist = player.Center.X - firingPosition.X; + float playerYDist = player.Center.Y - firingPosition.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - num745 = (baseProjectileVelocity + 5f) / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + playerDistance = (baseProjectileVelocity + 5f) / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; + firingPosition.X += playerXDist * 3f; + firingPosition.Y += playerYDist * 3f; float rotation = MathHelper.ToRadians(80); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; + float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; double deltaAngle = rotation / 6; double offsetAngle; for (int i = 0; i < 6; i++) { offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = 450; } } @@ -768,24 +768,24 @@ namespace CalamityMod.NPCs.Polterghast Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt5").Type, 1f); } - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust].velocity *= 3f; + Main.dust[ghostDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[ghostDust].scale = 0.5f; + Main.dust[ghostDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + Main.dust[ghostDust2].noGravity = true; + Main.dust[ghostDust2].velocity *= 5f; + ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust2].velocity *= 2f; } } @@ -805,14 +805,14 @@ namespace CalamityMod.NPCs.Polterghast { NPC.localAI[1] = 0f; - bool flag47 = Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + bool notLiningUpCharge = Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); if (NPC.localAI[3] > 0f) { - flag47 = true; + notLiningUpCharge = true; NPC.localAI[3] = 0f; } - if (flag47) + if (notLiningUpCharge) { int type = ModContent.ProjectileType(); if (Main.rand.NextBool(3)) @@ -823,27 +823,27 @@ namespace CalamityMod.NPCs.Polterghast int damage = NPC.GetProjectileDamage(type); - Vector2 vector93 = vector; - float num743 = player.Center.X - vector93.X; - float num744 = player.Center.Y - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + Vector2 firingPosition = vector; + float playerXDist = player.Center.X - firingPosition.X; + float playerYDist = player.Center.Y - firingPosition.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - num745 = (baseProjectileVelocity + 1f) / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + playerDistance = (baseProjectileVelocity + 1f) / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; + firingPosition.X += playerXDist * 3f; + firingPosition.Y += playerYDist * 3f; int numProj = 7; float rotation = MathHelper.ToRadians(80); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; + float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; double deltaAngle = rotation / numProj; double offsetAngle; for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = type == ModContent.ProjectileType() ? 450 : 1800; } } @@ -852,27 +852,27 @@ namespace CalamityMod.NPCs.Polterghast int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 vector93 = vector; - float num743 = player.Center.X - vector93.X; - float num744 = player.Center.Y - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + Vector2 firingPosition = vector; + float playerXDist = player.Center.X - firingPosition.X; + float playerYDist = player.Center.Y - firingPosition.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - num745 = (baseProjectileVelocity + 5f) / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + playerDistance = (baseProjectileVelocity + 5f) / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; + firingPosition.X += playerXDist * 3f; + firingPosition.Y += playerYDist * 3f; int numProj = 7; float rotation = MathHelper.ToRadians(100); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; + float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; double deltaAngle = rotation / numProj; double offsetAngle; for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = 450; } } @@ -922,24 +922,24 @@ namespace CalamityMod.NPCs.Polterghast Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt5").Type, 1f); } - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust].velocity *= 3f; + Main.dust[ghostDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[ghostDust].scale = 0.5f; + Main.dust[ghostDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + Main.dust[ghostDust2].noGravity = true; + Main.dust[ghostDust2].velocity *= 5f; + ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust2].velocity *= 2f; } } @@ -955,21 +955,21 @@ namespace CalamityMod.NPCs.Polterghast NPC.localAI[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { - Vector2 vector93 = vector; - float num743 = player.Center.X - vector93.X; - float num744 = player.Center.Y - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + Vector2 firingPosition = vector; + float playerXDist = player.Center.X - firingPosition.X; + float playerYDist = player.Center.Y - firingPosition.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - num745 = baseProjectileVelocity / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + playerDistance = baseProjectileVelocity / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; + firingPosition.X += playerXDist * 3f; + firingPosition.Y += playerYDist * 3f; int numProj = 6 + (getPissed ? 4 : 2); float rotation = MathHelper.ToRadians(110 + (getPissed ? 15 : 0)); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; + float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; double deltaAngle = rotation / numProj; double offsetAngle; @@ -979,7 +979,7 @@ namespace CalamityMod.NPCs.Polterghast for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -991,24 +991,23 @@ namespace CalamityMod.NPCs.Polterghast { NPC.localAI[2] = 0f; - float num757 = 6f; - Vector2 vector94 = vector; - float num758 = player.Center.X - vector94.X; - float num760 = player.Center.Y - vector94.Y; - float num761 = (float)Math.Sqrt(num758 * num758 + num760 * num760); - num761 = num757 / num761; - num758 *= num761; - num760 *= num761; - vector94.X += num758 * 3f; - vector94.Y += num760 * 3f; + Vector2 spiritSpawn = vector; + float spiritXDist = player.Center.X - spiritSpawn.X; + float spiritYDist = player.Center.Y - spiritSpawn.Y; + float spiritDistance = (float)Math.Sqrt(spiritXDist * spiritXDist + spiritYDist * spiritYDist); + spiritDistance = 6f / spiritDistance; + spiritXDist *= spiritDistance; + spiritYDist *= spiritDistance; + spiritSpawn.X += spiritXDist * 3f; + spiritSpawn.Y += spiritYDist * 3f; if (NPC.CountNPCS(ModContent.NPCType()) < 2 && Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { SoundEngine.PlaySound(PhantomSound, NPC.Center); - int num762 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); - Main.npc[num762].velocity.X = num758; - Main.npc[num762].velocity.Y = num760; - Main.npc[num762].netUpdate = true; + int phantomSpirit = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + Main.npc[phantomSpirit].velocity.X = spiritXDist; + Main.npc[phantomSpirit].velocity.Y = spiritYDist; + Main.npc[phantomSpirit].netUpdate = true; } } @@ -1151,40 +1150,38 @@ namespace CalamityMod.NPCs.Polterghast Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow2").Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 7; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + int afterimageAmt = 7; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 vector43 = NPC.Center - screenPos; vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + vector43 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color c = NPC.IsABestiaryIconDummy ? Color.White : NPC.GetAlpha(drawColor); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, c, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, c, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + Color secondColorLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); Color lightRed = new Color(255, 100, 100, 255); if (threeAM) { - color37 = Color.Red; + secondColorLerp = Color.Red; lightRed = Color.DarkRed; } @@ -1196,34 +1193,34 @@ namespace CalamityMod.NPCs.Polterghast float colorChangeTime = 180f; float changeColorGateValue = chargePhaseGateValue - colorChangeTime; if (NPC.Calamity().newAI[0] > changeColorGateValue) - color37 = Color.Lerp(color37, lightRed, MathHelper.Clamp((NPC.Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); + secondColorLerp = Color.Lerp(secondColorLerp, lightRed, MathHelper.Clamp((NPC.Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); - Color color42 = Color.Lerp(Color.White, (NPC.ai[2] >= changeColorGateValue || NPC.Calamity().newAI[0] > changeColorGateValue) ? Color.Red : Color.Black, 0.5f); + Color veinColor = Color.Lerp(Color.White, (NPC.ai[2] >= changeColorGateValue || NPC.Calamity().newAI[0] > changeColorGateValue) ? Color.Red : Color.Black, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color otherAfterimageColor = secondColorLerp; + otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); + otherAfterimageColor = NPC.GetAlpha(otherAfterimageColor); + otherAfterimageColor *= (afterimageAmt - j) / 15f; + Vector2 otherAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + otherAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + otherAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, otherAfterimagePos, NPC.frame, otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - Color color43 = color42; - color43 = Color.Lerp(color43, color36, amount9); - color43 = NPC.GetAlpha(color43); - color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color veinAfterimageColor = veinColor; + veinAfterimageColor = Color.Lerp(veinAfterimageColor, Color.White, 0.5f); + veinAfterimageColor = NPC.GetAlpha(veinAfterimageColor); + veinAfterimageColor *= (afterimageAmt - j) / 15f; + spriteBatch.Draw(texture2D16, otherAfterimagePos, NPC.frame, veinAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, secondColorLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector43, NPC.frame, veinColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -1309,23 +1306,23 @@ namespace CalamityMod.NPCs.Polterghast NPC.height = 90; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[ghostDust].scale = 0.5f; + Main.dust[ghostDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + Main.dust[ghostDust2].noGravity = true; + Main.dust[ghostDust2].velocity *= 5f; + ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + Main.dust[ghostDust2].velocity *= 2f; } } } diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index 8b8e865ecd..3966ad294b 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -126,10 +126,10 @@ namespace CalamityMod.NPCs.Polterghast Movement(phase2, expertMode, revenge, death, speedBoost, despawnBoost, lifeRatio, tileEnrageMult, player); // Fire projectiles - Vector2 vector17 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num147 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - vector17.X; - float num148 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - vector17.Y; - float num149 = (float)Math.Sqrt(num147 * num147 + num148 * num148); + Vector2 hookPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - hookPosition.X; + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - hookPosition.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); if (chargePhase) { @@ -155,13 +155,13 @@ namespace CalamityMod.NPCs.Polterghast if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 20f) { - float num151 = 10f * tileEnrageMult; + float shotSpeed = 10f * tileEnrageMult; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - num149 = num151 / num149; - num147 *= num149; - num148 *= num149; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector17.X, vector17.Y, num147, num148, type, damage, 0f, Main.myPlayer, 0f, 0f); + targetDistance = shotSpeed / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; + Projectile.NewProjectile(NPC.GetSource_FromAI(), hookPosition.X, hookPosition.Y, targetX, targetY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } return; @@ -184,9 +184,9 @@ namespace CalamityMod.NPCs.Polterghast if (phase2) { - float num740 = Main.player[NPC.target].Center.X - NPC.Center.X; - float num741 = Main.player[NPC.target].Center.Y - NPC.Center.Y; - NPC.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + float playerXDirection = Main.player[NPC.target].Center.X - NPC.Center.X; + float playerYDirection = Main.player[NPC.target].Center.Y - NPC.Center.Y; + NPC.rotation = (float)Math.Atan2(playerYDirection, playerXDirection) + MathHelper.PiOver2; } if (Main.netMode == NetmodeID.MultiplayerClient) @@ -220,9 +220,9 @@ namespace CalamityMod.NPCs.Polterghast if (!despawnBoost && NPC.localAI[0] <= 0f && NPC.ai[0] != 0f) { - for (int num763 = 0; num763 < Main.maxNPCs; num763++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (num763 != NPC.whoAmI && Main.npc[num763].active && Main.npc[num763].type == NPC.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) + if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type && (Main.npc[i].velocity.X != 0f || Main.npc[i].velocity.Y != 0f)) NPC.localAI[0] = 180f; } } @@ -230,34 +230,34 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.localAI[0] <= 0f) { NPC.localAI[0] = 450f; - bool flag50 = false; - int num764 = 0; - while (!flag50 && num764 <= 1000) + bool canMoveToTile = false; + int increment = 0; + while (!canMoveToTile && increment <= 1000) { - num764++; - int num765 = (int)(player.Center.X / 16f); - int num766 = (int)(player.Center.Y / 16f); + increment++; + int playerTileX = (int)(player.Center.X / 16f); + int playerTileY = (int)(player.Center.Y / 16f); if (NPC.ai[0] == 0f) { - num765 = (int)((player.Center.X + Main.npc[CalamityGlobalNPC.ghostBoss].Center.X) / 32f); - num766 = (int)((player.Center.Y + Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y) / 32f); + playerTileX = (int)((player.Center.X + Main.npc[CalamityGlobalNPC.ghostBoss].Center.X) / 32f); + playerTileY = (int)((player.Center.Y + Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y) / 32f); } if (despawnBoost) { - num765 = (int)Main.npc[CalamityGlobalNPC.ghostBoss].position.X / 16; - num766 = (int)(Main.npc[CalamityGlobalNPC.ghostBoss].position.Y + 400f) / 16; + playerTileX = (int)Main.npc[CalamityGlobalNPC.ghostBoss].position.X / 16; + playerTileY = (int)(Main.npc[CalamityGlobalNPC.ghostBoss].position.Y + 400f) / 16; } - int num767 = 20; - num767 += (int)(100f * (num764 / 1000f)); - int num768 = num765 + Main.rand.Next(-num767, num767 + 1); - int num769 = num766 + Main.rand.Next(-num767, num767 + 1); + int randPlayerRadius = 20; + randPlayerRadius += (int)(100f * (increment / 1000f)); + int randTileX = playerTileX + Main.rand.Next(-randPlayerRadius, randPlayerRadius + 1); + int randTileY = playerTileY + Main.rand.Next(-randPlayerRadius, randPlayerRadius + 1); try { - if (WorldGen.SolidTile(num768, num769) || Main.tile[num768, num769].WallType > 0 || chargePhase) + if (WorldGen.SolidTile(randTileX, randTileY) || Main.tile[randTileX, randTileY].WallType > 0 || chargePhase) { - flag50 = true; - NPC.ai[0] = num768; - NPC.ai[1] = num769; + canMoveToTile = true; + NPC.ai[0] = randTileX; + NPC.ai[1] = randTileY; NPC.localAI[1] = Vector2.Distance(NPC.Center, player.Center) * 0.01f; NPC.netUpdate = true; } @@ -281,28 +281,28 @@ namespace CalamityMod.NPCs.Polterghast if (despawnBoost) velocity *= 2f; - Vector2 vector95 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num773 = NPC.ai[0] * 16f - 8f - vector95.X; - float num774 = NPC.ai[1] * 16f - 8f - vector95.Y; - float num775 = (float)Math.Sqrt(num773 * num773 + num774 * num774); - if (num775 < 12f + velocity) + Vector2 hookCenter = new Vector2(NPC.Center.X, NPC.Center.Y); + float hookXDest = NPC.ai[0] * 16f - 8f - hookCenter.X; + float hookYDest = NPC.ai[1] * 16f - 8f - hookCenter.Y; + float hookDestination = (float)Math.Sqrt(hookXDest * hookXDest + hookYDest * hookYDest); + if (hookDestination < 12f + velocity) { - NPC.velocity.X = num773; - NPC.velocity.Y = num774; + NPC.velocity.X = hookXDest; + NPC.velocity.Y = hookYDest; } else { - num775 = velocity / num775; - NPC.velocity.X = num773 * num775; - NPC.velocity.Y = num774 * num775; + hookDestination = velocity / hookDestination; + NPC.velocity.X = hookXDest * hookDestination; + NPC.velocity.Y = hookYDest * hookDestination; } if (!phase2) { - Vector2 vector96 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num776 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - vector96.X; - float num777 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - vector96.Y; - NPC.rotation = (float)Math.Atan2(num777, num776) - 1.57f; + Vector2 hookCenterPassive = new Vector2(NPC.Center.X, NPC.Center.Y); + float polterDirectionX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - hookCenterPassive.X; + float polterDirectionY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - hookCenterPassive.Y; + NPC.rotation = (float)Math.Atan2(polterDirectionY, polterDirectionX) - 1.57f; } } } @@ -327,32 +327,32 @@ namespace CalamityMod.NPCs.Polterghast Vector2 center = NPC.Center; float bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; float bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; - float rotation2 = (float)Math.Atan2(bossCenterY, bossCenterX) - 1.57f; + float chainRotation = (float)Math.Atan2(bossCenterY, bossCenterX) - 1.57f; bool draw = true; while (draw) { int chainWidth = 20; int chainHeight = 52; - float num10 = (float)Math.Sqrt(bossCenterX * bossCenterX + bossCenterY * bossCenterY); - if (num10 < chainHeight) + float polterDistance = (float)Math.Sqrt(bossCenterX * bossCenterX + bossCenterY * bossCenterY); + if (polterDistance < chainHeight) { - chainWidth = (int)num10 - chainHeight + chainWidth; + chainWidth = (int)polterDistance - chainHeight + chainWidth; draw = false; } - num10 = chainWidth / num10; - bossCenterX *= num10; - bossCenterY *= num10; + polterDistance = chainWidth / polterDistance; + bossCenterX *= polterDistance; + bossCenterY *= polterDistance; center.X += bossCenterX; center.Y += bossCenterY; bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; - Color color2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + Color cyanLerpColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) - color2 = Color.Lerp(color2, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); + cyanLerpColor = Color.Lerp(cyanLerpColor, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Width, chainWidth)), color2, rotation2, + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Width, chainWidth)), cyanLerpColor, chainRotation, new Vector2(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } @@ -362,53 +362,51 @@ namespace CalamityMod.NPCs.Polterghast spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + int afterimageAmt = 5; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastHookGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + Color cyanLerp2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) - color37 = Color.Lerp(color37, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); + cyanLerp2 = Color.Lerp(cyanLerp2, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color otherAfterimageColor = cyanLerp2; + otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); + otherAfterimageColor = NPC.GetAlpha(otherAfterimageColor); + otherAfterimageColor *= (afterimageAmt - j) / 15f; + Vector2 otherAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + otherAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + otherAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, otherAfterimagePos, NPC.frame, otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, cyanLerp2, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 4809758d26..e33f3a9999 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -226,7 +226,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 dustLineEnd = shootFrom; Vector2 currentDustPos = default; Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); - Vector2 value5 = new Vector2(2.1f, 2f); + Vector2 dustVelocityMult = new Vector2(2.1f, 2f); int dustSpawned = 0; for (int i = 0; i < maxHealDustIterations; i++) { @@ -237,7 +237,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians dustColor.A = 255; int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = currentDustPos; - Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; + Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * dustVelocityMult * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1f; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; @@ -388,8 +388,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool speedUp = Vector2.Distance(NPC.Center, player.Center) > 960f; - float num1006 = 0.111111117f * inertia; - int totalDustPerProjectile = 15; if (NPC.ai[0] == 0f) @@ -698,7 +696,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians else { inertia *= 1.5f; - NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + num1006)) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia; } // Throw down holy fire while charging @@ -993,65 +991,63 @@ namespace CalamityMod.NPCs.ProfanedGuardians Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Vector2 drawPos = NPC.Center - screenPos; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + int afterimageAmt = 5; if (NPC.ai[0] == 2f) - num153 = 10; + afterimageAmt = 10; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; if (colorOverride != null) - color38 = colorOverride.Value; + afterimageColor = colorOverride.Value; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = drawPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture2D15, vector43, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = drawPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color timeBasedColorLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlowNight").Value; - color37 = Color.Cyan; + timeBasedColorLerp = Color.Cyan; } if (colorOverride != null) - color37 = colorOverride.Value; + timeBasedColorLerp = colorOverride.Value; if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; + Color timeBasedAfterimageColor = timeBasedColorLerp; + timeBasedAfterimageColor = Color.Lerp(timeBasedAfterimageColor, Color.White, 0.5f); + timeBasedAfterimageColor = NPC.GetAlpha(timeBasedAfterimageColor); + timeBasedAfterimageColor *= (afterimageAmt - j) / 15f; if (colorOverride != null) - color41 = colorOverride.Value; + timeBasedAfterimageColor = colorOverride.Value; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 timeBasedAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + timeBasedAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + timeBasedAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, timeBasedAfterimagePos, NPC.frame, timeBasedAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, timeBasedColorLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects @@ -1223,18 +1219,18 @@ namespace CalamityMod.NPCs.ProfanedGuardians Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 80f; } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 3dcd97990d..eaedaa3fc6 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -638,8 +638,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { // Charge towards target float inertia = (bossRush || biomeEnraged) ? 57f : death ? 63f : revenge ? 66f : expertMode ? 69f : 75f; - float num1006 = 0.111111117f * inertia; - NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + num1006)) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia; } // Lay holy bombs while charging @@ -718,65 +717,63 @@ namespace CalamityMod.NPCs.ProfanedGuardians Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Vector2 drawPos = NPC.Center - screenPos; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + int afterimageAmt = 5; if (NPC.ai[0] == 2f) - num153 = 10; + afterimageAmt = 10; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; if (colorOverride != null) - color38 = colorOverride.Value; + afterimageColor = colorOverride.Value; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = drawPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture2D15, vector43, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = drawPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color timeBasedGlowColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlowNight").Value; - color37 = Color.Cyan; + timeBasedGlowColor = Color.Cyan; } if (colorOverride != null) - color37 = colorOverride.Value; + timeBasedGlowColor = colorOverride.Value; if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; + Color timeBasedAfterimageColor = timeBasedGlowColor; + timeBasedAfterimageColor = Color.Lerp(timeBasedAfterimageColor, Color.White, 0.5f); + timeBasedAfterimageColor = NPC.GetAlpha(timeBasedAfterimageColor); + timeBasedAfterimageColor *= (afterimageAmt - j) / 15f; if (colorOverride != null) - color41 = colorOverride.Value; + timeBasedAfterimageColor = colorOverride.Value; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 timeBasedAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + timeBasedAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + timeBasedAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, timeBasedAfterimagePos, NPC.frame, timeBasedAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, timeBasedGlowColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects @@ -905,18 +902,18 @@ namespace CalamityMod.NPCs.ProfanedGuardians Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 80f; } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index b6c0b6583f..3a6d9a2e38 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -433,78 +433,76 @@ namespace CalamityMod.NPCs.ProfanedGuardians Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + int afterimageAmt = 5; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; if (colorOverride != null) - color38 = colorOverride.Value; + afterimageColor = colorOverride.Value; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture2D15, vector43, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color timeBasedDrawColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlowNight").Value; - color37 = Color.Cyan; + timeBasedDrawColor = Color.Cyan; } - Color color42 = Color.Lerp(Color.White, Color.Violet, 0.5f); + Color overrideColor = Color.Lerp(Color.White, Color.Violet, 0.5f); if (colorOverride != null) { - color37 = colorOverride.Value; - color42 = colorOverride.Value; + timeBasedDrawColor = colorOverride.Value; + overrideColor = colorOverride.Value; } if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; + Color timeBasedAfterimageColor = timeBasedDrawColor; + timeBasedAfterimageColor = Color.Lerp(timeBasedAfterimageColor, Color.White, 0.5f); + timeBasedAfterimageColor = NPC.GetAlpha(timeBasedAfterimageColor); + timeBasedAfterimageColor *= (afterimageAmt - j) / 15f; if (colorOverride != null) - color41 = colorOverride.Value; + timeBasedAfterimageColor = colorOverride.Value; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 timeBasedAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + timeBasedAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + timeBasedAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, timeBasedAfterimagePos, NPC.frame, timeBasedAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - Color color43 = color42; - color43 = Color.Lerp(color43, color36, amount9); - color43 = NPC.GetAlpha(color43); - color43 *= (num153 - num163) / 15f; + Color alphaOverrideColor = overrideColor; + alphaOverrideColor = Color.Lerp(alphaOverrideColor, Color.White, 0.5f); + alphaOverrideColor = NPC.GetAlpha(alphaOverrideColor); + alphaOverrideColor *= (afterimageAmt - j) / 15f; if (colorOverride != null) - color43 = colorOverride.Value; + alphaOverrideColor = colorOverride.Value; - spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, timeBasedAfterimagePos, NPC.frame, alphaOverrideColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, timeBasedDrawColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, overrideColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects @@ -554,18 +552,18 @@ namespace CalamityMod.NPCs.ProfanedGuardians Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 80f; } diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index 2f39c24a43..4919b3fdf2 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -340,18 +340,18 @@ namespace CalamityMod.NPCs.ProfanedGuardians { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= (NPC.ai[2] == 6f ? 16f : 22f); } diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 7b2755d913..2744eb6250 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -114,50 +114,48 @@ namespace CalamityMod.NPCs.Providence spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 5; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } Vector2 vector43 = NPC.Center - screenPos; vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + vector43 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color yellowAfterimageColor = yellowLerp; + yellowAfterimageColor = Color.Lerp(yellowAfterimageColor, Color.White, 0.5f); + yellowAfterimageColor = NPC.GetAlpha(yellowAfterimageColor); + yellowAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 yellowAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + yellowAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + yellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, yellowAfterimagePos, NPC.frame, yellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, yellowLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index c32dff5cf3..9644b52742 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -114,59 +114,57 @@ namespace CalamityMod.NPCs.Providence Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 5; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - Color color42 = Color.Lerp(Color.White, Color.Violet, 0.5f); + Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color violetLerp = Color.Lerp(Color.White, Color.Violet, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color yellowAfterimageColor = yellowLerp; + yellowAfterimageColor = Color.Lerp(yellowAfterimageColor, Color.White, 0.5f); + yellowAfterimageColor = NPC.GetAlpha(yellowAfterimageColor); + yellowAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 yellowAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + yellowAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + yellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, yellowAfterimagePos, NPC.frame, yellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - Color color43 = color42; - color43 = Color.Lerp(color43, color36, amount9); - color43 = NPC.GetAlpha(color43); - color43 *= (float)(num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color violetAfterimageColor = violetLerp; + violetAfterimageColor = Color.Lerp(violetAfterimageColor, Color.White, 0.5f); + violetAfterimageColor = NPC.GetAlpha(violetAfterimageColor); + violetAfterimageColor *= (float)(afterimageAmt - j) / 15f; + spriteBatch.Draw(texture2D16, yellowAfterimagePos, NPC.frame, violetAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, yellowLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, violetLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index e80c1bb8c7..45fbb115f9 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -114,52 +114,50 @@ namespace CalamityMod.NPCs.Providence spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 5; if (NPC.ai[0] == 2f) - num153 = 10; + afterimageAmt = 10; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color yellowAfterimageColor = yellowLerpColor; + yellowAfterimageColor = Color.Lerp(yellowAfterimageColor, Color.White, 0.5f); + yellowAfterimageColor = NPC.GetAlpha(yellowAfterimageColor); + yellowAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 yellowAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + yellowAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + yellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, yellowAfterimagePos, NPC.frame, yellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, yellowLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 9e2177bce2..8fc6d65358 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -597,7 +597,7 @@ namespace CalamityMod.NPCs.Providence Vector2 dustLineEnd = NPC.Center; Vector2 currentDustPos = default; Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); - Vector2 value5 = new Vector2(2.1f, 2f); + Vector2 dustVelocityMult = new Vector2(2.1f, 2f); Color dustColor = Main.hslToRgb(Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X, 1f, 0.5f); dustColor.A = 255; for (int i = 0; i < maxHealDustIterations; i++) @@ -607,7 +607,7 @@ namespace CalamityMod.NPCs.Providence currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations); int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = currentDustPos; - Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; + Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * dustVelocityMult * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1f; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; @@ -678,8 +678,8 @@ namespace CalamityMod.NPCs.Providence if (NPC.life > 0) { - int num660 = (int)(NPC.lifeMax * 0.66); - if ((NPC.life + num660) < bossLife) + int guardianHealthThreshold = (int)(NPC.lifeMax * 0.66); + if ((NPC.life + guardianHealthThreshold) < bossLife) { bossLife = NPC.life; SoundEngine.PlaySound(SoundID.Item74, NPC.Center); @@ -743,17 +743,17 @@ namespace CalamityMod.NPCs.Providence calamityGlobalNPC.newAI[0] += 1f; // Distance needed from target to change direction - float num851 = 800f; + float changeDirectionThreshold = 800f; // Increase distance from target when firing molten blasts or holy bombs bool stayAwayFromTarget = AIState == (int)Phase.MoltenBlobs || AIState == (int)Phase.HolyBomb; if (stayAwayFromTarget) - num851 += death ? 240f : revenge ? 180f : 120f; + changeDirectionThreshold += death ? 240f : revenge ? 180f : 120f; // Change X movement path if far enough away from target - if (NPC.Center.X < player.Center.X && flightPath < 0 && distanceX > num851) + if (NPC.Center.X < player.Center.X && flightPath < 0 && distanceX > changeDirectionThreshold) flightPath = 0; - if (NPC.Center.X > player.Center.X && flightPath > 0 && distanceX > num851) + if (NPC.Center.X > player.Center.X && flightPath > 0 && distanceX > changeDirectionThreshold) flightPath = 0; // Velocity and acceleration @@ -796,10 +796,10 @@ namespace CalamityMod.NPCs.Providence if (NPC.velocity.X < -velocity) NPC.velocity.X = -velocity; - float num855 = player.position.Y - (NPC.position.Y + NPC.height); - if (num855 < (laserPhaseSlow ? 150f : 200f)) // 150 + float moveUpThreshold = player.position.Y - (NPC.position.Y + NPC.height); + if (moveUpThreshold < (laserPhaseSlow ? 150f : 200f)) // 150 NPC.velocity.Y -= Main.getGoodWorld ? 0.4f : 0.2f; - if (num855 > (laserPhaseSlow ? 200f : 250f)) // 200 + if (moveUpThreshold > (laserPhaseSlow ? 200f : 250f)) // 200 NPC.velocity.Y += Main.getGoodWorld ? 0.4f : 0.2f; float speedCap = laserPhaseSlow ? 2f : 6f; @@ -1045,21 +1045,21 @@ namespace CalamityMod.NPCs.Providence { Vector2 npcCenter = NPC.Center; npcCenter.X += NPC.velocity.X * 7f; - float num857 = player.position.X + player.width * 0.5f - npcCenter.X; - float num858 = player.Center.Y - npcCenter.Y; - float num859 = (float)Math.Sqrt(num857 * num857 + num858 * num858); + float playerXDist = player.position.X + player.width * 0.5f - npcCenter.X; + float playerYDist = player.Center.Y - npcCenter.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); float velocityBoost = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); - float num860 = (expertMode ? 10.25f : 9f) + velocityBoost; + float projSpeed = (expertMode ? 10.25f : 9f) + velocityBoost; if (revenge) - num860 *= 1.15f; + projSpeed *= 1.15f; - num859 = num860 / num859; - num857 *= num859; - num858 *= num859; + playerDistance = projSpeed / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, num857, num858, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, playerXDist, playerYDist, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); } } else if (NPC.ai[3] < 0f) @@ -1319,29 +1319,29 @@ namespace CalamityMod.NPCs.Providence SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, player2.Center); player2.AddBuff(ModContent.BuffType(), 3000, true); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + int icarusFollyDust = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), player2.width, player2.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + Main.dust[icarusFollyDust].velocity *= 3f; + Main.dust[icarusFollyDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[icarusFollyDust].scale = 0.5f; + Main.dust[icarusFollyDust].fadeIn = 1f + 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(player2.position.X, player2.position.Y), + int icarusFollyDust2 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), player2.width, player2.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + Main.dust[icarusFollyDust2].noGravity = true; + Main.dust[icarusFollyDust2].velocity *= 5f; + icarusFollyDust2 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), player2.width, player2.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; + Main.dust[icarusFollyDust2].velocity *= 2f; + Main.dust[icarusFollyDust2].noGravity = true; } } } @@ -1381,23 +1381,23 @@ namespace CalamityMod.NPCs.Providence { Vector2 npcCenter = NPC.Center; npcCenter.X += NPC.velocity.X * 7f; - float num857 = player.position.X + player.width * 0.5f - npcCenter.X; - float num858 = player.Center.Y - npcCenter.Y; - float num859 = (float)Math.Sqrt(num857 * num857 + num858 * num858); + float playerXDist = player.position.X + player.width * 0.5f - npcCenter.X; + float playerYDist = player.Center.Y - npcCenter.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); float shootBoost2 = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); - float num860 = (expertMode ? 10.25f : 9f) + shootBoost2; + float projSpeed = (expertMode ? 10.25f : 9f) + shootBoost2; if (bossRush) - num860 = 12.75f; + projSpeed = 12.75f; if (revenge) - num860 *= 1.15f; + projSpeed *= 1.15f; - num859 = num860 / num859; - num857 *= num859; - num858 *= num859; + playerDistance = projSpeed / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, num857 * 0.1f, num858, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, playerXDist * 0.1f, playerYDist, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); } } else if (NPC.ai[3] < 0f) @@ -1568,7 +1568,7 @@ namespace CalamityMod.NPCs.Providence Vector2 dustLineEnd = crystalSpawnPos; Vector2 currentDustPos = default; Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); - Vector2 value5 = new Vector2(2.1f, 2f); + Vector2 dustVelocityMult = new Vector2(2.1f, 2f); int dustSpawned = 0; int maxDustLines = 3; int blue = Main.DiscoB; @@ -1583,7 +1583,7 @@ namespace CalamityMod.NPCs.Providence dustColor.A = 255; int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = currentDustPos + new Vector2(32f, 32f).RotatedByRandom(MathHelper.TwoPi) * i; - Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * j / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * j / maxHealDustIterations) * dustVelocityMult * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1f + i; Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; @@ -2116,16 +2116,16 @@ namespace CalamityMod.NPCs.Providence if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < maxAfterimages; num155 += 2) + for (int i = 1; i < maxAfterimages; i += 2) { Color AfterimageColor = drawColor; AfterimageColor = Color.Lerp(AfterimageColor, BaseColor, Brightness); AfterimageColor = NPC.GetAlpha(AfterimageColor); - AfterimageColor *= (maxAfterimages - num155) / 15f; + AfterimageColor *= (maxAfterimages - i) / 15f; if (colorOverride != null) AfterimageColor = colorOverride.Value; - Vector2 AfterimageBodyPosition = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + Vector2 AfterimageBodyPosition = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; AfterimageBodyPosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; AfterimageBodyPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture, AfterimageBodyPosition, NPC.frame, AfterimageColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); @@ -2180,16 +2180,16 @@ namespace CalamityMod.NPCs.Providence if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < maxAfterimages; num163++) + for (int j = 1; j < maxAfterimages; j++) { Color AfterimageWingColor = BaseWingColor; AfterimageWingColor = Color.Lerp(AfterimageWingColor, BaseColor, Brightness); AfterimageWingColor = NPC.GetAlpha(AfterimageWingColor); - AfterimageWingColor *= (maxAfterimages - num163) / 15f; + AfterimageWingColor *= (maxAfterimages - j) / 15f; if (colorOverride != null) AfterimageWingColor = colorOverride.Value; - Vector2 AfterimageGlowPosition = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + Vector2 AfterimageGlowPosition = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; AfterimageGlowPosition -= new Vector2(textureGlow.Width, textureGlow.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; AfterimageGlowPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(textureGlow, AfterimageGlowPosition, NPC.frame, AfterimageWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); @@ -2197,7 +2197,7 @@ namespace CalamityMod.NPCs.Providence Color AfterimageCrystalColor = BaseCrystalColor; AfterimageCrystalColor = Color.Lerp(AfterimageCrystalColor, BaseColor, Brightness); AfterimageCrystalColor = NPC.GetAlpha(AfterimageCrystalColor); - AfterimageCrystalColor *= (maxAfterimages - num163) / 15f; + AfterimageCrystalColor *= (maxAfterimages - j) / 15f; if (colorOverride != null) AfterimageCrystalColor = colorOverride.Value; spriteBatch.Draw(textureGlow2, AfterimageGlowPosition, NPC.frame, AfterimageCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); From f87f3aaefa324fe06b168413d7ffbff7012136d1 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 23 Oct 2023 22:22:16 -0400 Subject: [PATCH 17/43] Ravager, Signus, Slime God, Storm Weaver --- NPCs/Ravager/FlamePillar.cs | 58 ++--- NPCs/Ravager/RavagerBody.cs | 24 +-- NPCs/Ravager/RavagerClawLeft.cs | 116 +++++----- NPCs/Ravager/RavagerClawRight.cs | 116 +++++----- NPCs/Ravager/RavagerHead.cs | 6 +- NPCs/Ravager/RavagerHead2.cs | 98 ++++----- NPCs/Ravager/RockPillar.cs | 66 +++--- NPCs/Signus/CosmicLantern.cs | 60 +++--- NPCs/Signus/CosmicMine.cs | 92 ++++---- NPCs/Signus/Signus.cs | 296 +++++++++++++------------- NPCs/SlimeGod/CrimsonSlimeSpawn2.cs | 36 ++-- NPCs/SlimeGod/CrimulanPaladin.cs | 109 +++++----- NPCs/SlimeGod/EbonianPaladin.cs | 111 +++++----- NPCs/SlimeGod/SlimeGodCore.cs | 81 ++++--- NPCs/SlimeGod/SplitCrimulanPaladin.cs | 131 ++++++------ NPCs/SlimeGod/SplitEbonianPaladin.cs | 129 ++++++----- NPCs/StormWeaver/StormWeaverBody.cs | 92 ++++---- NPCs/StormWeaver/StormWeaverHead.cs | 128 +++++------ NPCs/StormWeaver/StormWeaverTail.cs | 96 ++++----- 19 files changed, 912 insertions(+), 933 deletions(-) diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 7e5d7f7777..4b61c255ff 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -149,17 +149,17 @@ namespace CalamityMod.NPCs.Ravager spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Ravager/FlamePillarGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + Color flameBlue = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, flameBlue, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -176,44 +176,44 @@ namespace CalamityMod.NPCs.Ravager NPC.height = 180; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 30; num621++) + for (int i = 0; i < 30; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 135, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int iceFlame = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 135, 0f, 0f, 100, default, 2f); + Main.dust[iceFlame].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[iceFlame].scale = 0.5f; + Main.dust[iceFlame].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + Main.dust[rockDust].noGravity = true; + Main.dust[rockDust].velocity *= 5f; + rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + Main.dust[rockDust].velocity *= 2f; } } else { - for (int num621 = 0; num621 < 2; num621++) + for (int i = 0; i < 2; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int iceFlame = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + Main.dust[iceFlame].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[iceFlame].scale = 0.5f; + Main.dust[iceFlame].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 2; num623++) + for (int j = 0; j < 2; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + Main.dust[rockDust].noGravity = true; + Main.dust[rockDust].velocity *= 5f; + rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + Main.dust[rockDust].velocity *= 2f; } } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index eabf873fe6..49b2079dd2 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -858,35 +858,35 @@ namespace CalamityMod.NPCs.Ravager spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Vector2 vector = center - screenPos; - vector -= new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value, vector, - NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 glowmaskPosition = center - screenPos; + glowmaskPosition -= new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; + glowmaskPosition += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color glowmaskColor = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); + spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value, glowmaskPosition, + NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); float legOffset = 20f; float headOffset = 75f; - Color color2 = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Color drawLighting = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); if (NPC.IsABestiaryIconDummy) { - color2 = Color.White; + drawLighting = Color.White; legOffset = 60f; headOffset = 0f; } spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value, new Vector2(center.X - screenPos.X + NPC.scale * 28f, center.Y - screenPos.Y + legOffset), //72 new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value.Height)), - color2, 0f, default, NPC.scale, SpriteEffects.None, 0f); + drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value, new Vector2(center.X - screenPos.X - NPC.scale * 112f, center.Y - screenPos.Y + legOffset), //72 new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value.Height)), - color2, 0f, default, NPC.scale, SpriteEffects.None, 0f); + drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.IsABestiaryIconDummy) { spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value, new Vector2(center.X - screenPos.X - NPC.scale * 70f, center.Y - screenPos.Y - NPC.scale * headOffset), new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value.Height)), - color2, 0f, default, NPC.scale, SpriteEffects.None, 0f); + drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); } } diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 7fe4eb3640..202654ffa7 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -81,14 +81,13 @@ namespace CalamityMod.NPCs.Ravager if (NPC.ai[0] == 0f) { NPC.noTileCollide = true; - float num659 = 36f; - Vector2 vector79 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num660 -= 120f; - num661 += 50f; - float num662 = (float)Math.Sqrt(num660 * num660 + num661 * num661); - if (num662 < 12f + num659) + Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.Center.Y); + float ravBodyXDist = Main.npc[CalamityGlobalNPC.scavenger].Center.X - npcCenter.X; + float ravBodyYDist = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - npcCenter.Y; + ravBodyXDist -= 120f; + ravBodyYDist += 50f; + float ravBodyDistance = (float)Math.Sqrt(ravBodyXDist * ravBodyXDist + ravBodyYDist * ravBodyYDist); + if (ravBodyDistance < 48f) { NPC.rotation = 0f; NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(-120f, 50f); @@ -127,9 +126,9 @@ namespace CalamityMod.NPCs.Ravager } else { - num662 = num659 / num662; - NPC.velocity.X = num660 * num662; - NPC.velocity.Y = num661 * num662; + ravBodyDistance = 36f / ravBodyDistance; + NPC.velocity.X = ravBodyXDist * ravBodyDistance; + NPC.velocity.Y = ravBodyYDist * ravBodyDistance; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); } } @@ -139,26 +138,26 @@ namespace CalamityMod.NPCs.Ravager NPC.noTileCollide = true; NPC.collideX = false; NPC.collideY = false; - float num663 = 12f; + float clawSpeed = 12f; if (NPC.life < NPC.lifeMax / 2 || death) { - num663 += 2f; + clawSpeed += 2f; } if (NPC.life < NPC.lifeMax / 3 || death) { - num663 += 2f; + clawSpeed += 2f; } if (NPC.life < NPC.lifeMax / 5 || death) { - num663 += 5f; + clawSpeed += 5f; } - Vector2 vector80 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num664 = Main.player[NPC.target].Center.X - vector80.X; - float num665 = Main.player[NPC.target].Center.Y - vector80.Y; - float num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665); - num666 = num663 / num666; - NPC.velocity.X = num664 * num666; - NPC.velocity.Y = num665 * num666; + Vector2 npcCenterAttack = new Vector2(NPC.Center.X, NPC.Center.Y); + float targetX = Main.player[NPC.target].Center.X - npcCenterAttack.X; + float targetY = Main.player[NPC.target].Center.Y - npcCenterAttack.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + targetDistance = clawSpeed / targetDistance; + NPC.velocity.X = targetX * targetDistance; + NPC.velocity.Y = targetY * targetDistance; NPC.ai[0] = 2f; NPC.rotation = (float)Math.Atan2(-NPC.velocity.Y, -NPC.velocity.X); } @@ -186,15 +185,15 @@ namespace CalamityMod.NPCs.Ravager NPC.noTileCollide = false; } } - Vector2 vector81 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; - float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; - num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; - num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; - num668 += 40f; - num667 -= 110f; - float num669 = (float)Math.Sqrt(num667 * num667 + num668 * num668); - if ((num669 > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) + Vector2 npcCenterRetract = new Vector2(NPC.Center.X, NPC.Center.Y); + float bodyReturnXDist = Main.npc[CalamityGlobalNPC.scavenger].Center.X - npcCenterRetract.X; + float bodyReturnYDist = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - npcCenterRetract.Y; + bodyReturnXDist += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; + bodyReturnYDist += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; + bodyReturnYDist += 40f; + bodyReturnXDist -= 110f; + float bodyReturnDistance = (float)Math.Sqrt(bodyReturnXDist * bodyReturnXDist + bodyReturnYDist * bodyReturnYDist); + if ((bodyReturnDistance > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) { NPC.noTileCollide = true; NPC.ai[0] = 0f; @@ -203,45 +202,44 @@ namespace CalamityMod.NPCs.Ravager else if (NPC.ai[0] == 3f) { NPC.noTileCollide = true; - float num671 = 12f; - float num672 = 0.4f; - Vector2 vector82 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num673 = Main.player[NPC.target].Center.X - vector82.X; - float num674 = Main.player[NPC.target].Center.Y - vector82.Y; - float num675 = (float)Math.Sqrt(num673 * num673 + num674 * num674); - num675 = num671 / num675; - num673 *= num675; - num674 *= num675; - if (NPC.velocity.X < num673) + float velocityMult = 0.4f; + Vector2 clawCenter = new Vector2(NPC.Center.X, NPC.Center.Y); + float playerX = Main.player[NPC.target].Center.X - clawCenter.X; + float playerY = Main.player[NPC.target].Center.Y - clawCenter.Y; + float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY); + playerDist = 12f / playerDist; + playerX *= playerDist; + playerY *= playerDist; + if (NPC.velocity.X < playerX) { - NPC.velocity.X += num672; - if (NPC.velocity.X < 0f && num673 > 0f) + NPC.velocity.X += velocityMult; + if (NPC.velocity.X < 0f && playerX > 0f) { - NPC.velocity.X += num672 * 2f; + NPC.velocity.X += velocityMult * 2f; } } - else if (NPC.velocity.X > num673) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X -= num672; - if (NPC.velocity.X > 0f && num673 < 0f) + NPC.velocity.X -= velocityMult; + if (NPC.velocity.X > 0f && playerX < 0f) { - NPC.velocity.X -= num672 * 2f; + NPC.velocity.X -= velocityMult * 2f; } } - if (NPC.velocity.Y < num674) + if (NPC.velocity.Y < playerY) { - NPC.velocity.Y += num672; - if (NPC.velocity.Y < 0f && num674 > 0f) + NPC.velocity.Y += velocityMult; + if (NPC.velocity.Y < 0f && playerY > 0f) { - NPC.velocity.Y += num672 * 2f; + NPC.velocity.Y += velocityMult * 2f; } } - else if (NPC.velocity.Y > num674) + else if (NPC.velocity.Y > playerY) { - NPC.velocity.Y -= num672; - if (NPC.velocity.Y > 0f && num674 < 0f) + NPC.velocity.Y -= velocityMult; + if (NPC.velocity.Y > 0f && playerY < 0f) { - NPC.velocity.Y -= num672 * 2f; + NPC.velocity.Y -= velocityMult * 2f; } } NPC.rotation = (float)Math.Atan2(-NPC.velocity.Y, -NPC.velocity.X); @@ -302,11 +300,11 @@ namespace CalamityMod.NPCs.Ravager { if (NPC.life > 0) { - int num285 = 0; - while (num285 < hit.Damage / NPC.lifeMax * 100.0) + int dustCounter = 0; + while (dustCounter < hit.Damage / NPC.lifeMax * 100.0) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - num285++; + dustCounter++; } } else diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 91518ff377..205e010f02 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -82,14 +82,13 @@ namespace CalamityMod.NPCs.Ravager if (NPC.ai[0] == 0f) { NPC.noTileCollide = true; - float num659 = 36f; - Vector2 vector79 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num660 += 120f; - num661 += 50f; - float num662 = (float)Math.Sqrt(num660 * num660 + num661 * num661); - if (num662 < 12f + num659) + Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.Center.Y); + float ravBodyXDist = Main.npc[CalamityGlobalNPC.scavenger].Center.X - npcCenter.X; + float ravBodyYDist = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - npcCenter.Y; + ravBodyXDist += 120f; + ravBodyYDist += 50f; + float ravBodyDistance = (float)Math.Sqrt(ravBodyXDist * ravBodyXDist + ravBodyYDist * ravBodyYDist); + if (ravBodyDistance < 48f) { NPC.rotation = 0f; NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(120f, 50f); @@ -128,9 +127,9 @@ namespace CalamityMod.NPCs.Ravager } else { - num662 = num659 / num662; - NPC.velocity.X = num660 * num662; - NPC.velocity.Y = num661 * num662; + ravBodyDistance = 36f / ravBodyDistance; + NPC.velocity.X = ravBodyXDist * ravBodyDistance; + NPC.velocity.Y = ravBodyYDist * ravBodyDistance; NPC.rotation = (float)Math.Atan2(-NPC.velocity.Y, -NPC.velocity.X); } } @@ -140,26 +139,26 @@ namespace CalamityMod.NPCs.Ravager NPC.noTileCollide = true; NPC.collideX = false; NPC.collideY = false; - float num663 = 12f; + float clawSpeed = 12f; if (NPC.life < NPC.lifeMax / 2 || death) { - num663 += 2f; + clawSpeed += 2f; } if (NPC.life < NPC.lifeMax / 3 || death) { - num663 += 2f; + clawSpeed += 2f; } if (NPC.life < NPC.lifeMax / 5 || death) { - num663 += 5f; + clawSpeed += 5f; } - Vector2 vector80 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num664 = Main.player[NPC.target].Center.X - vector80.X; - float num665 = Main.player[NPC.target].Center.Y - vector80.Y; - float num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665); - num666 = num663 / num666; - NPC.velocity.X = num664 * num666; - NPC.velocity.Y = num665 * num666; + Vector2 npcCenterAttack = new Vector2(NPC.Center.X, NPC.Center.Y); + float targetX = Main.player[NPC.target].Center.X - npcCenterAttack.X; + float targetY = Main.player[NPC.target].Center.Y - npcCenterAttack.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + targetDistance = clawSpeed / targetDistance; + NPC.velocity.X = targetX * targetDistance; + NPC.velocity.Y = targetY * targetDistance; NPC.ai[0] = 2f; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); } @@ -187,15 +186,15 @@ namespace CalamityMod.NPCs.Ravager NPC.noTileCollide = false; } } - Vector2 vector81 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; - float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; - num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; - num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; - num668 += 40f; - num667 += 110f; - float num669 = (float)Math.Sqrt(num667 * num667 + num668 * num668); - if ((num669 > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) + Vector2 npcCenterRetract = new Vector2(NPC.Center.X, NPC.Center.Y); + float bodyReturnXDist = Main.npc[CalamityGlobalNPC.scavenger].Center.X - npcCenterRetract.X; + float bodyReturnYDist = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - npcCenterRetract.Y; + bodyReturnXDist += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; + bodyReturnYDist += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; + bodyReturnYDist += 40f; + bodyReturnXDist += 110f; + float bodyReturnDistance = (float)Math.Sqrt(bodyReturnXDist * bodyReturnXDist + bodyReturnYDist * bodyReturnYDist); + if ((bodyReturnDistance > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) { NPC.noTileCollide = true; NPC.ai[0] = 0f; @@ -204,45 +203,44 @@ namespace CalamityMod.NPCs.Ravager else if (NPC.ai[0] == 3f) { NPC.noTileCollide = true; - float num671 = 12f; - float num672 = 0.4f; - Vector2 vector82 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num673 = Main.player[NPC.target].Center.X - vector82.X; - float num674 = Main.player[NPC.target].Center.Y - vector82.Y; - float num675 = (float)Math.Sqrt(num673 * num673 + num674 * num674); - num675 = num671 / num675; - num673 *= num675; - num674 *= num675; - if (NPC.velocity.X < num673) + float velocityMult = 0.4f; + Vector2 clawCenter = new Vector2(NPC.Center.X, NPC.Center.Y); + float playerX = Main.player[NPC.target].Center.X - clawCenter.X; + float playerY = Main.player[NPC.target].Center.Y - clawCenter.Y; + float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY); + playerDist = 12f / playerDist; + playerX *= playerDist; + playerY *= playerDist; + if (NPC.velocity.X < playerX) { - NPC.velocity.X += num672; - if (NPC.velocity.X < 0f && num673 > 0f) + NPC.velocity.X += velocityMult; + if (NPC.velocity.X < 0f && playerX > 0f) { - NPC.velocity.X += num672 * 2f; + NPC.velocity.X += velocityMult * 2f; } } - else if (NPC.velocity.X > num673) + else if (NPC.velocity.X > playerX) { - NPC.velocity.X -= num672; - if (NPC.velocity.X > 0f && num673 < 0f) + NPC.velocity.X -= velocityMult; + if (NPC.velocity.X > 0f && playerX < 0f) { - NPC.velocity.X -= num672 * 2f; + NPC.velocity.X -= velocityMult * 2f; } } - if (NPC.velocity.Y < num674) + if (NPC.velocity.Y < playerY) { - NPC.velocity.Y += num672; - if (NPC.velocity.Y < 0f && num674 > 0f) + NPC.velocity.Y += velocityMult; + if (NPC.velocity.Y < 0f && playerY > 0f) { - NPC.velocity.Y += num672 * 2f; + NPC.velocity.Y += velocityMult * 2f; } } - else if (NPC.velocity.Y > num674) + else if (NPC.velocity.Y > playerY) { - NPC.velocity.Y -= num672; - if (NPC.velocity.Y > 0f && num674 < 0f) + NPC.velocity.Y -= velocityMult; + if (NPC.velocity.Y > 0f && playerY < 0f) { - NPC.velocity.Y -= num672 * 2f; + NPC.velocity.Y -= velocityMult * 2f; } } NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); @@ -303,11 +301,11 @@ namespace CalamityMod.NPCs.Ravager { if (NPC.life > 0) { - int num285 = 0; - while (num285 < hit.Damage / NPC.lifeMax * 100.0) + int dustCounter = 0; + while (dustCounter < hit.Damage / NPC.lifeMax * 100.0) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - num285++; + dustCounter++; } } else diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 5779b396d6..803f524d53 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -112,11 +112,11 @@ namespace CalamityMod.NPCs.Ravager { if (NPC.life > 0) { - int num285 = 0; - while ((double)num285 < hit.Damage / (double)NPC.lifeMax * 100.0) + int dustCounter = 0; + while ((double)dustCounter < hit.Damage / (double)NPC.lifeMax * 100.0) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, (float)hit.HitDirection, -1f, 0, default, 1f); - num285++; + dustCounter++; } } else if (Main.netMode != NetmodeID.MultiplayerClient && !Main.zenithWorld) //GFB does something else diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 4a2cffaa40..543f15d387 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -74,38 +74,38 @@ namespace CalamityMod.NPCs.Ravager NPC.timeLeft = 1800; // Rotation - float num801 = NPC.position.X + (NPC.width / 2) - player.position.X - (player.width / 2); - float num802 = NPC.position.Y + NPC.height - 59f - player.position.Y - (player.height / 2); - float num803 = (float)Math.Atan2(num802, num801) + MathHelper.PiOver2; - if (num803 < 0f) - num803 += MathHelper.TwoPi; - else if (num803 > MathHelper.TwoPi) - num803 -= MathHelper.TwoPi; + float playerXDist = NPC.position.X + (NPC.width / 2) - player.position.X - (player.width / 2); + float playerYDist = NPC.position.Y + NPC.height - 59f - player.position.Y - (player.height / 2); + float headRotation = (float)Math.Atan2(playerYDist, playerXDist) + MathHelper.PiOver2; + if (headRotation < 0f) + headRotation += MathHelper.TwoPi; + else if (headRotation > MathHelper.TwoPi) + headRotation -= MathHelper.TwoPi; - float num804 = 0.1f; - if (NPC.rotation < num803) + float headRotateIncrement = 0.1f; + if (NPC.rotation < headRotation) { - if ((num803 - NPC.rotation) > MathHelper.Pi) - NPC.rotation -= num804; + if ((headRotation - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= headRotateIncrement; else - NPC.rotation += num804; + NPC.rotation += headRotateIncrement; } - else if (NPC.rotation > num803) + else if (NPC.rotation > headRotation) { - if ((NPC.rotation - num803) > MathHelper.Pi) - NPC.rotation += num804; + if ((NPC.rotation - headRotation) > MathHelper.Pi) + NPC.rotation += headRotateIncrement; else - NPC.rotation -= num804; + NPC.rotation -= headRotateIncrement; } - if (NPC.rotation > num803 - num804 && NPC.rotation < num803 + num804) - NPC.rotation = num803; + if (NPC.rotation > headRotation - headRotateIncrement && NPC.rotation < headRotation + headRotateIncrement) + NPC.rotation = headRotation; if (NPC.rotation < 0f) NPC.rotation += MathHelper.TwoPi; else if (NPC.rotation > MathHelper.TwoPi) NPC.rotation -= MathHelper.TwoPi; - if (NPC.rotation > num803 - num804 && NPC.rotation < num803 + num804) - NPC.rotation = num803; + if (NPC.rotation > headRotation - headRotateIncrement && NPC.rotation < headRotation + headRotateIncrement) + NPC.rotation = headRotation; NPC.ai[1] += 1f; bool fireProjectiles = NPC.ai[1] >= (bossRush ? 240f : 480f); @@ -141,52 +141,52 @@ namespace CalamityMod.NPCs.Ravager } } - float num823 = 22f; - float num824 = 0.3f; + float attackMovementVel = 22f; + float attackMovementAccel = 0.3f; if (death) { - num823 += 4f; - num824 += 0.05f; + attackMovementVel += 4f; + attackMovementAccel += 0.05f; } if (provy) { - num823 *= 1.25f; - num824 *= 1.25f; + attackMovementVel *= 1.25f; + attackMovementAccel *= 1.25f; } - Vector2 vector82 = NPC.Center; + Vector2 npcCenter = NPC.Center; float distanceX = NPC.ai[0] % 2f == 0f ? 480f : -480f; float distanceY = fireProjectiles ? -320f : 320f; - float num825 = player.Center.X + (fireProjectiles ? distanceX : 0f) - vector82.X; - float num826 = player.Center.Y + distanceY - vector82.Y; - float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; + float playerXDistAttack = player.Center.X + (fireProjectiles ? distanceX : 0f) - npcCenter.X; + float playerYDistAttack = player.Center.Y + distanceY - npcCenter.Y; + float playerDistanceAttack = (float)Math.Sqrt(playerXDistAttack * playerXDistAttack + playerYDistAttack * playerYDistAttack); + playerDistanceAttack = attackMovementVel / playerDistanceAttack; + playerXDistAttack *= playerDistanceAttack; + playerYDistAttack *= playerDistanceAttack; - if (NPC.velocity.X < num825) + if (NPC.velocity.X < playerXDistAttack) { - NPC.velocity.X += num824; - if (NPC.velocity.X < 0f && num825 > 0f) - NPC.velocity.X += num824; + NPC.velocity.X += attackMovementAccel; + if (NPC.velocity.X < 0f && playerXDistAttack > 0f) + NPC.velocity.X += attackMovementAccel; } - else if (NPC.velocity.X > num825) + else if (NPC.velocity.X > playerXDistAttack) { - NPC.velocity.X -= num824; - if (NPC.velocity.X > 0f && num825 < 0f) - NPC.velocity.X -= num824; + NPC.velocity.X -= attackMovementAccel; + if (NPC.velocity.X > 0f && playerXDistAttack < 0f) + NPC.velocity.X -= attackMovementAccel; } - if (NPC.velocity.Y < num826) + if (NPC.velocity.Y < playerYDistAttack) { - NPC.velocity.Y += num824; - if (NPC.velocity.Y < 0f && num826 > 0f) - NPC.velocity.Y += num824; + NPC.velocity.Y += attackMovementAccel; + if (NPC.velocity.Y < 0f && playerYDistAttack > 0f) + NPC.velocity.Y += attackMovementAccel; } - else if (NPC.velocity.Y > num826) + else if (NPC.velocity.Y > playerYDistAttack) { - NPC.velocity.Y -= num824; - if (NPC.velocity.Y > 0f && num826 < 0f) - NPC.velocity.Y -= num824; + NPC.velocity.Y -= attackMovementAccel; + if (NPC.velocity.Y > 0f && playerYDistAttack < 0f) + NPC.velocity.Y -= attackMovementAccel; } } diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 50a59b8c75..953f224ad4 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -77,23 +77,23 @@ namespace CalamityMod.NPCs.Ravager { SoundEngine.PlaySound(SoundID.Item62, NPC.Center); - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + Main.dust[rockDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[rockDust].scale = 0.5f; + Main.dust[rockDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + Main.dust[rockDust2].noGravity = true; + Main.dust[rockDust2].velocity *= 5f; + rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + Main.dust[rockDust2].velocity *= 2f; } NPC.noTileCollide = true; @@ -151,23 +151,23 @@ namespace CalamityMod.NPCs.Ravager NPC.height = 360; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 30; num621++) + for (int i = 0; i < 30; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + Main.dust[rockDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[rockDust].scale = 0.5f; + Main.dust[rockDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + Main.dust[rockDust2].noGravity = true; + Main.dust[rockDust2].velocity *= 5f; + rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + Main.dust[rockDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) @@ -188,23 +188,23 @@ namespace CalamityMod.NPCs.Ravager } else { - for (int num621 = 0; num621 < 2; num621++) + for (int i = 0; i < 2; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + Main.dust[rockDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[rockDust].scale = 0.5f; + Main.dust[rockDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 2; num623++) + for (int j = 0; j < 2; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + Main.dust[rockDust2].noGravity = true; + Main.dust[rockDust2].velocity *= 5f; + rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + Main.dust[rockDust2].velocity *= 2f; } } } diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 7ae8f2477d..fddafbc722 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -92,9 +92,9 @@ namespace CalamityMod.NPCs.Signus if (NPC.alpha < 0) { NPC.alpha = 0; - int num1262 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 0, default, 0.25f); - Main.dust[num1262].velocity *= 0.1f; - Main.dust[num1262].noGravity = true; + int lightDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 0, default, 0.25f); + Main.dust[lightDust].velocity *= 0.1f; + Main.dust[lightDust].noGravity = true; } bool revenge = CalamityWorld.revenge; @@ -111,50 +111,48 @@ namespace CalamityMod.NPCs.Signus spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 5; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/Signus/CosmicLanternGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color flameAfterimageColor = cyanLerp; + flameAfterimageColor = Color.Lerp(flameAfterimageColor, Color.White, 0.5f); + flameAfterimageColor = NPC.GetAlpha(flameAfterimageColor); + flameAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 flameAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + flameAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + flameAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, flameAfterimagePos, NPC.frame, flameAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, cyanLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Signus/CosmicMine.cs b/NPCs/Signus/CosmicMine.cs index da2bb1d95d..39bbd0604b 100644 --- a/NPCs/Signus/CosmicMine.cs +++ b/NPCs/Signus/CosmicMine.cs @@ -119,18 +119,18 @@ namespace CalamityMod.NPCs.Signus } } - float num1372 = death ? 16f : 14f; + float mineSpeed = death ? 16f : 14f; Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); - float num1373 = player.position.X + player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; + float playerXDist = player.position.X + player.width * 0.5f - vector167.X; + float playerYDist = player.Center.Y - vector167.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + float velocityMult = mineSpeed / playerDistance; + playerXDist *= velocityMult; + playerYDist *= velocityMult; NPC.ai[0] -= 1f; - if (num1375 < 200f || NPC.ai[0] > 0f) + if (playerDistance < 200f || NPC.ai[0] > 0f) { - if (num1375 < 200f) + if (playerDistance < 200f) { NPC.ai[0] = 20f; } @@ -145,17 +145,17 @@ namespace CalamityMod.NPCs.Signus return; } - NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; - NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) + NPC.velocity.X = (NPC.velocity.X * 50f + playerXDist) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + playerYDist) / 51f; + if (playerDistance < 350f) { - NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; - NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 10f + playerXDist) / 11f; + NPC.velocity.Y = (NPC.velocity.Y * 10f + playerYDist) / 11f; } - if (num1375 < 300f) + if (playerDistance < 300f) { - NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; - NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 7f + playerXDist) / 8f; + NPC.velocity.Y = (NPC.velocity.Y * 7f + playerYDist) / 8f; } } @@ -171,30 +171,28 @@ namespace CalamityMod.NPCs.Signus spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + int afterimageAmt = 5; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -208,25 +206,25 @@ namespace CalamityMod.NPCs.Signus NPC.width = NPC.height = 256; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } - Main.dust[num622].noGravity = true; + Main.dust[cosmiliteDust].noGravity = true; } - for (int num623 = 0; num623 < 20; num623++) + for (int j = 0; j < 20; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; + Main.dust[cosmiliteDust2].noGravity = true; } return true; } diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 7d4e7e6e39..9f2f65c90f 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -185,14 +185,14 @@ namespace CalamityMod.NPCs.Signus if (lifeToAlpha < (Main.getGoodWorld ? 100 : 50) && NPC.ai[0] != 1f) { - for (int num1011 = 0; num1011 < 2; num1011++) + for (int i = 0; i < 2; i++) { if (Main.rand.Next(3) < 1) { - int num1012 = Dust.NewDust(vectorCenter - new Vector2(70f), 70 * 2, 70 * 2, (int)CalamityDusts.PurpleCosmilite, NPC.velocity.X * 0.5f, NPC.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; + int cosmiliteDust = Dust.NewDust(vectorCenter - new Vector2(70f), 70 * 2, 70 * 2, (int)CalamityDusts.PurpleCosmilite, NPC.velocity.X * 0.5f, NPC.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[cosmiliteDust].noGravity = true; + Main.dust[cosmiliteDust].velocity *= 0.2f; + Main.dust[cosmiliteDust].fadeIn = 1f; } } } @@ -238,19 +238,19 @@ namespace CalamityMod.NPCs.Signus if (expertMode) speed += death ? 6f * (float)(1D - lifeRatio) : 4f * (float)(1D - lifeRatio); - float num795 = player.Center.X - vectorCenter.X; - float num796 = player.Center.Y - vectorCenter.Y; - float num797 = (float)Math.Sqrt(num795 * num795 + num796 * num796); - num797 = speed / num797; - num795 *= num797; - num796 *= num797; + float playerXDist = player.Center.X - vectorCenter.X; + float playerYDist = player.Center.Y - vectorCenter.Y; + float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + playerDistance = speed / playerDistance; + playerXDist *= playerDistance; + playerYDist *= playerDistance; float inertia2 = 50f; if (Main.getGoodWorld) inertia2 *= 0.5f; - NPC.velocity.X = (NPC.velocity.X * inertia2 + num795) / (inertia2 + 1f); - NPC.velocity.Y = (NPC.velocity.Y * inertia2 + num796) / (inertia2 + 1f); + NPC.velocity.X = (NPC.velocity.X * inertia2 + playerXDist) / (inertia2 + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia2 + playerYDist) / (inertia2 + 1f); } else NPC.knockBackResist = 0f; @@ -284,38 +284,38 @@ namespace CalamityMod.NPCs.Signus NPC.TargetClosest(); - int num1249 = 0; - int num1250; - int num1251; + int maxTeleportTries = 0; + int playerTileX; + int playerTileY; while (true) { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; + maxTeleportTries++; + playerTileX = (int)player.Center.X / 16; + playerTileY = (int)player.Center.Y / 16; int min = 14; int max = 18; if (Main.rand.NextBool()) - num1250 += Main.rand.Next(min, max); + playerTileX += Main.rand.Next(min, max); else - num1250 -= Main.rand.Next(min, max); + playerTileX -= Main.rand.Next(min, max); if (Main.rand.NextBool()) - num1251 += Main.rand.Next(min, max); + playerTileY += Main.rand.Next(min, max); else - num1251 -= Main.rand.Next(min, max); + playerTileY -= Main.rand.Next(min, max); - if (!WorldGen.SolidTile(num1250, num1251)) + if (!WorldGen.SolidTile(playerTileX, playerTileY)) break; - if (num1249 > 100) + if (maxTeleportTries > 100) return; } NPC.ai[0] = 1f; - NPC.ai[1] = num1250; - NPC.ai[2] = num1251; + NPC.ai[1] = playerTileX; + NPC.ai[2] = playerTileY; NPC.netUpdate = true; @@ -350,8 +350,8 @@ namespace CalamityMod.NPCs.Signus for (int n = 0; n < 15; n++) { - int num39 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 90, default, 3f); - Main.dust[num39].noGravity = true; + int cosmiliteDusty = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 90, default, 3f); + Main.dust[cosmiliteDusty].noGravity = true; } NPC.ai[0] = 2f; @@ -371,60 +371,60 @@ namespace CalamityMod.NPCs.Signus { SoundEngine.PlaySound(SoundID.Item122, NPC.Center); - int num660 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType()); + int cosmicMineSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn, 0f, 0f, 0f, 0, 0, 0); - int num661 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 750f), (int)player.position.Y, ModContent.NPCType()); + int cosmicMineSpawn2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 750f), (int)player.position.Y, ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn2, 0f, 0f, 0f, 0, 0, 0); if (stealthTimer >= maxStealth) { - int num662 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 950f), (int)player.position.Y, ModContent.NPCType()); + int stealthCosmicMine = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 950f), (int)player.position.Y, ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num662, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine, 0f, 0f, 0f, 0, 0, 0); - int num663 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 950f), (int)player.position.Y, ModContent.NPCType()); + int stealthCosmicMine2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 950f), (int)player.position.Y, ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num663, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine2, 0f, 0f, 0f, 0, 0, 0); SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); stealthTimer = 0; } - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int teleportDust = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[teleportDust].velocity *= 3f; + Main.dust[teleportDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[teleportDust].scale = 0.5f; + Main.dust[teleportDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } - int num623 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num623].velocity *= 3f; - Main.dust[num623].noGravity = true; + int j = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[j].velocity *= 3f; + Main.dust[j].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num623].scale = 0.5f; - Main.dust[num623].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[j].scale = 0.5f; + Main.dust[j].fadeIn = 1f + 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(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - int num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num625].noGravity = true; - Main.dust[num625].velocity *= 5f; - num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num625].velocity *= 2f; + int teleportDust2 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[teleportDust2].noGravity = true; + Main.dust[teleportDust2].velocity *= 5f; + teleportDust2 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[teleportDust2].velocity *= 2f; + int teleportDusty = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[teleportDusty].noGravity = true; + Main.dust[teleportDusty].velocity *= 5f; + teleportDusty = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[teleportDusty].velocity *= 2f; } } @@ -466,16 +466,15 @@ namespace CalamityMod.NPCs.Signus { if (Main.netMode != NetmodeID.MultiplayerClient) { - float num1070 = 15f; - float num1071 = player.Center.X - vectorCenter.X; - float num1072 = player.Center.Y - vectorCenter.Y; - float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; + float scytheXDist = player.Center.X - vectorCenter.X; + float scytheYDist = player.Center.Y - vectorCenter.Y; + float scytheDistance = (float)Math.Sqrt(scytheXDist * scytheXDist + scytheYDist * scytheYDist); + scytheDistance = 15f / scytheDistance; + scytheXDist *= scytheDistance; + scytheYDist *= scytheDistance; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); + Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, scytheXDist, scytheYDist, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); if (stealthTimer >= maxStealth) { damage *= 2; @@ -483,7 +482,7 @@ namespace CalamityMod.NPCs.Signus for (int i = 0; i < 4; i++) { Vector2 offset = new Vector2(Main.rand.Next(-5, 6), Main.rand.Next(-5, 6)); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, num1071 + offset.X, num1072 + offset.Y, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); + Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, scytheXDist + offset.X, scytheYDist + offset.Y, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); } stealthTimer = 0; } @@ -567,23 +566,23 @@ namespace CalamityMod.NPCs.Signus { type = ModContent.NPCType(); } - int num660 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), type); + int cosmicMineSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), type); if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn, 0f, 0f, 0f, 0, 0, 0); - int num661 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), type); + int cosmicMineSpawn2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), type); if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn2, 0f, 0f, 0f, 0, 0, 0); if (buffed) { - int num662 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX + spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); + int stealthCosmicMine = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX + spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num662, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine, 0f, 0f, 0f, 0, 0, 0); - int num663 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX - spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); + int stealthCosmicMine2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX - spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num663, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine2, 0f, 0f, 0f, 0, 0, 0); } spawnY -= 60; @@ -614,22 +613,19 @@ namespace CalamityMod.NPCs.Signus if (expertMode) velocity += death ? 6f * (float)(1D - lifeRatio) : 4f * (float)(1D - lifeRatio); - Vector2 vector126 = player.Center - vectorCenter; - Vector2 vector127 = vector126 - Vector2.UnitY * 300f; + Vector2 playerCenterDist = player.Center - vectorCenter; + Vector2 playerHoverAboveDist = playerCenterDist - Vector2.UnitY * 300f; - float num1013 = vector126.Length(); + playerCenterDist = Vector2.Normalize(playerCenterDist) * velocity; + playerHoverAboveDist = Vector2.Normalize(playerHoverAboveDist) * velocity; - vector126 = Vector2.Normalize(vector126) * velocity; - vector127 = Vector2.Normalize(vector127) * velocity; - - bool flag64 = Collision.CanHit(vectorCenter, 1, 1, player.Center, 1, 1) || NPC.ai[3] >= 120f; - float num1014 = 8f; - flag64 = flag64 && vector126.ToRotation() > MathHelper.Pi / num1014 && vector126.ToRotation() < MathHelper.Pi - MathHelper.Pi / num1014; - if (num1013 > 1400f || !flag64) + bool canLineUpCharge = Collision.CanHit(vectorCenter, 1, 1, player.Center, 1, 1) || NPC.ai[3] >= 120f; + canLineUpCharge = canLineUpCharge && playerCenterDist.ToRotation() > MathHelper.Pi / 8f && playerCenterDist.ToRotation() < MathHelper.Pi - MathHelper.Pi / 8f; + if (playerCenterDist.Length() > 1400f || !canLineUpCharge) { - NPC.velocity = (NPC.velocity * (inertia - 1f) + vector127) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + playerHoverAboveDist) / inertia; - if (!flag64) + if (!canLineUpCharge) { NPC.ai[3] += 1f; if (NPC.ai[3] == 120f) @@ -641,8 +637,8 @@ namespace CalamityMod.NPCs.Signus else { calamityGlobalNPC.newAI[0] = 1f; - NPC.ai[2] = vector126.X; - NPC.ai[3] = vector126.Y; + NPC.ai[2] = playerCenterDist.X; + NPC.ai[3] = playerCenterDist.Y; NPC.netUpdate = true; } } @@ -694,8 +690,8 @@ namespace CalamityMod.NPCs.Signus } NPC.ai[1] += 1f; - bool flag65 = vectorCenter.Y + 50f > player.Center.Y; - if ((NPC.ai[1] >= 90f && flag65) || NPC.velocity.Length() < 8f) + bool shouldEndCharge = vectorCenter.Y + 50f > player.Center.Y; + if ((NPC.ai[1] >= 90f && shouldEndCharge) || NPC.velocity.Length() < 8f) { calamityGlobalNPC.newAI[0] = 3f; NPC.ai[1] = 30f; @@ -709,12 +705,12 @@ namespace CalamityMod.NPCs.Signus } else { - Vector2 vec2 = player.Center - vectorCenter; - vec2.Normalize(); - if (vec2.HasNaNs()) - vec2 = new Vector2(NPC.direction, 0f); + Vector2 distFromPlayerCenter = player.Center - vectorCenter; + distFromPlayerCenter.Normalize(); + if (distFromPlayerCenter.HasNaNs()) + distFromPlayerCenter = new Vector2(NPC.direction, 0f); - NPC.velocity = (NPC.velocity * (inertia - 1f) + vec2 * (NPC.velocity.Length() + 0.111111117f * inertia)) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + distFromPlayerCenter * (NPC.velocity.Length() + 0.111111117f * inertia)) / inertia; } } else if (calamityGlobalNPC.newAI[0] == 3f) // Slow down after charging and reset @@ -782,7 +778,7 @@ namespace CalamityMod.NPCs.Signus if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - int num153 = 5; + int afterimageAmt = 5; Rectangle frame = NPC.frame; int frameCount = Main.npcFrameCount[NPC.type]; @@ -790,7 +786,7 @@ namespace CalamityMod.NPCs.Signus { NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2").Value; glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2Glow").Value; - num153 = 10; + afterimageAmt = 10; int frameY = 94 * (int)(NPC.frameCounter / 12.0); if (frameY >= 94 * 6) frameY = 0; @@ -800,7 +796,7 @@ namespace CalamityMod.NPCs.Signus { NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt").Value; glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAltGlow").Value; - num153 = 7; + afterimageAmt = 7; } else { @@ -808,9 +804,7 @@ namespace CalamityMod.NPCs.Signus glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusGlow").Value; } - Vector2 vector11 = new Vector2(NPCTexture.Width / 2, NPCTexture.Height / frameCount / 2); - Color color36 = Color.White; - float amount9 = 0.5f; + Vector2 halfSizeTexture = new Vector2(NPCTexture.Width / 2, NPCTexture.Height / frameCount / 2); float scale = NPC.scale; float rotation = NPC.rotation; float offsetY = NPC.gfxOffY; @@ -822,42 +816,42 @@ namespace CalamityMod.NPCs.Signus if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; - vector41 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector41, new Rectangle?(frame), color38 * transparency, rotation, vector11, scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; + afterimagePos += halfSizeTexture * scale + new Vector2(0f, 4f + offsetY); + spriteBatch.Draw(NPCTexture, afterimagePos, new Rectangle?(frame), afterimageColor * transparency, rotation, halfSizeTexture, scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; - vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector43, new Rectangle?(frame), NPC.GetAlpha(drawColor) * transparency, rotation, vector11, scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; + drawLocation += halfSizeTexture * scale + new Vector2(0f, 4f + offsetY); + spriteBatch.Draw(NPCTexture, drawLocation, new Rectangle?(frame), NPC.GetAlpha(drawColor) * transparency, rotation, halfSizeTexture, scale, spriteEffects, 0f); - Color color40 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); + Color eyeGlowColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); if (Main.zenithWorld) { - color40 = Color.MediumBlue; + eyeGlowColor = Color.MediumBlue; } if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color40; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(glowMaskTexture.Width, glowMaskTexture.Height / frameCount) * scale / 2f; - vector44 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(glowMaskTexture, vector44, new Rectangle?(frame), color41, rotation, vector11, scale, spriteEffects, 0f); + Color eyeAfterimageColor = eyeGlowColor; + eyeAfterimageColor = Color.Lerp(eyeAfterimageColor, Color.White, 0.5f); + eyeAfterimageColor = NPC.GetAlpha(eyeAfterimageColor); + eyeAfterimageColor *= (afterimageAmt - j) / 15f; + Vector2 eyeAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + eyeAfterimagePos -= new Vector2(glowMaskTexture.Width, glowMaskTexture.Height / frameCount) * scale / 2f; + eyeAfterimagePos += halfSizeTexture * scale + new Vector2(0f, 4f + offsetY); + spriteBatch.Draw(glowMaskTexture, eyeAfterimagePos, new Rectangle?(frame), eyeAfterimageColor, rotation, halfSizeTexture, scale, spriteEffects, 0f); } } @@ -874,12 +868,12 @@ namespace CalamityMod.NPCs.Signus for (float i = 0; i < 1; i += 0.125f) { - spriteBatch.Draw(glowMaskTexture, vector43 + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, new Rectangle?(frame), outlineColor, rotation, vector11, scale, spriteEffects, 0f); + spriteBatch.Draw(glowMaskTexture, drawLocation + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, new Rectangle?(frame), outlineColor, rotation, halfSizeTexture, scale, spriteEffects, 0f); } CalamityUtils.ExitShaderRegion(spriteBatch); } - spriteBatch.Draw(glowMaskTexture, vector43, new Rectangle?(frame), color40, rotation, vector11, scale, spriteEffects, 0f); + spriteBatch.Draw(glowMaskTexture, drawLocation, new Rectangle?(frame), eyeGlowColor, rotation, halfSizeTexture, scale, spriteEffects, 0f); return false; } @@ -965,23 +959,23 @@ namespace CalamityMod.NPCs.Signus NPC.height = 150; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int teleportDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[teleportDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[teleportDust].scale = 0.5f; + Main.dust[teleportDust].fadeIn = 1f + 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(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int teleportDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[teleportDust2].noGravity = true; + Main.dust[teleportDust2].velocity *= 5f; + teleportDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[teleportDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) { @@ -1000,18 +994,18 @@ namespace CalamityMod.NPCs.Signus { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 60f; } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 5542aebf97..4f189ae655 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -103,11 +103,11 @@ namespace CalamityMod.NPCs.SlimeGod } if (!NPC.wet) { - Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num14 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector3.X; - float num15 = Main.player[NPC.target].position.Y - vector3.Y; - float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.expertMode && num16 < 120f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f) + Vector2 faceDirection = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - faceDirection.X; + float targetY = Main.player[NPC.target].position.Y - faceDirection.Y; + float targetDistance = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + if (Main.expertMode && targetDistance < 120f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f) { NPC.ai[0] = -40f; if (NPC.velocity.Y == 0f) @@ -119,17 +119,17 @@ namespace CalamityMod.NPCs.SlimeGod int projcount = Main.zenithWorld ? 12 : 5; for (int n = 0; n < projcount; n++) { - Vector2 vector4 = new Vector2((float)(n - 2), -4f); - vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Normalize(); - vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector3.X, vector3.Y, vector4.X, vector4.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 spikeDirection = new Vector2((float)(n - 2), -4f); + spikeDirection.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + spikeDirection.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + spikeDirection.Normalize(); + spikeDirection *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), faceDirection.X, faceDirection.Y, spikeDirection.X, spikeDirection.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); spikeTimer = 30f; } } } - else if (num16 < 360f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f) + else if (targetDistance < 360f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f) { NPC.ai[0] = -40f; if (NPC.velocity.Y == 0f) @@ -138,13 +138,13 @@ namespace CalamityMod.NPCs.SlimeGod } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { - num15 = Main.player[NPC.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); - num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - num16 = 6.5f / num16; - num14 *= num16; - num15 *= num16; + targetY = Main.player[NPC.target].position.Y - faceDirection.Y - (float)Main.rand.Next(0, 200); + targetDistance = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY)); + targetDistance = 6.5f / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; spikeTimer = 50f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector3.X, vector3.Y, num14, num15, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), faceDirection.X, faceDirection.Y, targetX, targetY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index fd8b9e4c4d..23bfbfd72c 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -184,34 +184,33 @@ namespace CalamityMod.NPCs.SlimeGod NPC.TargetClosest(false); player = Main.player[NPC.target]; Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 960f; - Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int num5 = 5; - int num8 = 0; - while (num8 < 100) + Point teleportAheadPos = vectorAimedAheadOfTarget.ToTileCoordinates(); + int maxTeleportTries = 0; + while (maxTeleportTries < 100) { - num8++; - int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); - int num10 = Main.rand.Next(point2.Y - num5, point2.Y); - if (Main.tile[num9, num10].HasUnactuatedTile) + maxTeleportTries++; + int teleportPosX = Main.rand.Next(teleportAheadPos.X - 5, teleportAheadPos.X + 6); + int teleportPosY = Main.rand.Next(teleportAheadPos.Y - 5, teleportAheadPos.Y); + if (Main.tile[teleportPosX, teleportPosY].HasUnactuatedTile) continue; - bool flag4 = true; - if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) - flag4 = false; - if (flag4 && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - flag4 = false; + bool canTeleport = true; + if (canTeleport && Main.tile[teleportPosX, teleportPosY].LiquidType == LiquidID.Lava) + canTeleport = false; + if (canTeleport && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + canTeleport = false; - if (flag4) + if (canTeleport) { - NPC.localAI[0] = num9 * 16 + 8; - NPC.localAI[3] = num10 * 16 + 16; + NPC.localAI[0] = teleportPosX * 16 + 8; + NPC.localAI[3] = teleportPosY * 16 + 16; calamityGlobalNPC.newAI[0] = 0f; break; } } // Default teleport if the above conditions aren't met in 100 iterations - if (num8 >= 100) + if (maxTeleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; NPC.localAI[0] = bottom.X; @@ -362,24 +361,24 @@ namespace CalamityMod.NPCs.SlimeGod NPC.spriteDirection = NPC.direction; NPC.TargetClosest(); - Vector2 center40 = player.Center; - center40.Y -= 350f; - Vector2 vector272 = center40 - NPC.Center; + Vector2 targetCenter = player.Center; + targetCenter.Y -= 350f; + Vector2 targetDist = targetCenter - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - vector272 = player.Center - NPC.Center; - vector272.Normalize(); - vector272 *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; - NPC.velocity = (NPC.velocity * 4f + vector272) / 5f; + targetDist = player.Center - NPC.Center; + targetDist.Normalize(); + targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; + NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; if (NPC.ai[1] > 12f) { NPC.ai[1] = 0f; NPC.ai[0] = 1.1f; NPC.ai[2] = 0f; - NPC.velocity = vector272; + NPC.velocity = targetDist; } } else @@ -391,9 +390,9 @@ namespace CalamityMod.NPCs.SlimeGod return; } - vector272.Normalize(); - vector272 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + vector272) / 6f; + targetDist.Normalize(); + targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; + NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } } else if (NPC.ai[0] == 1.1f) @@ -442,8 +441,8 @@ namespace CalamityMod.NPCs.SlimeGod } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(velocity2) * 30f * NPC.scale, velocity2, type, damage, 0f, Main.myPlayer); + Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); } } } @@ -591,11 +590,11 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Crimson; dustColor.A = 150; - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); - Main.dust[num246].noGravity = true; - Main.dust[num246].velocity *= 0.5f; + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[crimsonDust].noGravity = true; + Main.dust[crimsonDust].velocity *= 0.5f; } } else if (NPC.ai[0] == 6f) @@ -625,11 +624,11 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Crimson; dustColor.A = 150; - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); - Main.dust[num246].noGravity = true; - Main.dust[num246].velocity *= 0.5f; + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[crimsonDust].noGravity = true; + Main.dust[crimsonDust].velocity *= 0.5f; } } @@ -638,15 +637,15 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.life > 0) { - float num659 = lifeRatio; - num659 = num659 * 0.5f + 0.75f; - num659 *= scale; + float scaleRatio = lifeRatio; + scaleRatio = scaleRatio * 0.5f + 0.75f; + scaleRatio *= scale; - if (num659 != NPC.scale) + if (scaleRatio != NPC.scale) { NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; - NPC.scale = num659; + NPC.scale = scaleRatio; NPC.width = (int)(150f * NPC.scale); NPC.height = (int)(92f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); @@ -655,25 +654,25 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)NPC.lifeMax * 0.15); - if ((float)(NPC.life + num660) < bossLife) + int slimeSpawnThreshold = (int)((double)NPC.lifeMax * 0.15); + if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); - int num663 = ModContent.NPCType(); + int slimeType = ModContent.NPCType(); if (Main.rand.NextBool(3)) { - num663 = ModContent.NPCType(); + slimeType = ModContent.NPCType(); } - int num664 = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[slimeSpawn].SetDefaults(slimeType); + Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[slimeSpawn].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index ba6c41d255..09a2661ab7 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -177,34 +177,33 @@ namespace CalamityMod.NPCs.SlimeGod NPC.TargetClosest(false); player = Main.player[NPC.target]; Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 960f; - Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int num5 = 5; - int num8 = 0; - while (num8 < 100) + Point teleportAheadPos = vectorAimedAheadOfTarget.ToTileCoordinates(); + int maxTeleportTries = 0; + while (maxTeleportTries < 100) { - num8++; - int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); - int num10 = Main.rand.Next(point2.Y - num5, point2.Y); - if (Main.tile[num9, num10].HasUnactuatedTile) + maxTeleportTries++; + int teleportPosX = Main.rand.Next(teleportAheadPos.X - 5, teleportAheadPos.X + 6); + int teleportPosY = Main.rand.Next(teleportAheadPos.Y - 5, teleportAheadPos.Y); + if (Main.tile[teleportPosX, teleportPosY].HasUnactuatedTile) continue; - bool flag4 = true; - if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) - flag4 = false; - if (flag4 && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - flag4 = false; + bool canTeleport = true; + if (canTeleport && Main.tile[teleportPosX, teleportPosY].LiquidType == LiquidID.Lava) + canTeleport = false; + if (canTeleport && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + canTeleport = false; - if (flag4) + if (canTeleport) { - NPC.localAI[0] = num9 * 16 + 8; - NPC.localAI[3] = num10 * 16 + 16; + NPC.localAI[0] = teleportPosX * 16 + 8; + NPC.localAI[3] = teleportPosY * 16 + 16; calamityGlobalNPC.newAI[0] = 0f; break; } } // Default teleport if the above conditions aren't met in 100 iterations - if (num8 >= 100) + if (maxTeleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; NPC.localAI[0] = bottom.X; @@ -371,24 +370,24 @@ namespace CalamityMod.NPCs.SlimeGod NPC.spriteDirection = NPC.direction; NPC.TargetClosest(); - Vector2 center40 = player.Center; - center40.Y -= 350f; - Vector2 vector272 = center40 - NPC.Center; + Vector2 targetCenter = player.Center; + targetCenter.Y -= 350f; + Vector2 targetDist = targetCenter - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - vector272 = player.Center - NPC.Center; - vector272.Normalize(); - vector272 *= death ? 9f : revenge ? 8f : expertMode ? 7f : 6f; - NPC.velocity = (NPC.velocity * 4f + vector272) / 5f; + targetDist = player.Center - NPC.Center; + targetDist.Normalize(); + targetDist *= death ? 9f : revenge ? 8f : expertMode ? 7f : 6f; + NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; if (NPC.ai[1] > 12f) { NPC.ai[1] = 0f; NPC.ai[0] = 2.1f; NPC.ai[2] = 0f; - NPC.velocity = vector272; + NPC.velocity = targetDist; } } else @@ -400,9 +399,9 @@ namespace CalamityMod.NPCs.SlimeGod return; } - vector272.Normalize(); - vector272 *= (death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + vector272) / 6f; + targetDist.Normalize(); + targetDist *= (death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost; + NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } } else if (NPC.ai[0] == 2.1f) @@ -455,8 +454,8 @@ namespace CalamityMod.NPCs.SlimeGod } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(velocity2) * 30f * NPC.scale, velocity2, type, damage, 0f, Main.myPlayer); + Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); } } } @@ -604,11 +603,11 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); - Main.dust[num246].noGravity = true; - Main.dust[num246].velocity *= 0.5f; + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[corruptDust].noGravity = true; + Main.dust[corruptDust].velocity *= 0.5f; } } else if (NPC.ai[0] == 7f) @@ -638,11 +637,11 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); - Main.dust[num246].noGravity = true; - Main.dust[num246].velocity *= 0.5f; + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[corruptDust].noGravity = true; + Main.dust[corruptDust].velocity *= 0.5f; } } @@ -651,15 +650,15 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.life > 0) { - float num659 = lifeRatio; - num659 = num659 * 0.5f + 0.75f; - num659 *= scale; + float scaleRatio = lifeRatio; + scaleRatio = scaleRatio * 0.5f + 0.75f; + scaleRatio *= scale; - if (num659 != NPC.scale) + if (scaleRatio != NPC.scale) { NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; - NPC.scale = num659; + NPC.scale = scaleRatio; NPC.width = (int)(150f * NPC.scale); NPC.height = (int)(92f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); @@ -668,24 +667,24 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)NPC.lifeMax * 0.2); - if ((float)(NPC.life + num660) < bossLife) + int slimeSpawnThreshold = (int)((double)NPC.lifeMax * 0.2); + if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; - int num661 = Main.rand.Next(1, 3); - for (int num662 = 0; num662 < num661; num662++) + int randSlimeAmt = Main.rand.Next(1, 3); + for (int j = 0; j < randSlimeAmt; j++) { int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); - int num663 = ModContent.NPCType(); - int num664 = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + int slimeType = ModContent.NPCType(); + int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[slimeSpawn].SetDefaults(slimeType); + Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[slimeSpawn].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 8b2dc2225a..ca478c3440 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -221,27 +221,27 @@ namespace CalamityMod.NPCs.SlimeGod NPC.height = 40; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; color.A = 150; - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); - Main.dust[num622].velocity *= 3f; + int slimyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + Main.dust[slimyDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[slimyDust].scale = 0.5f; + Main.dust[slimyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; color.A = 150; - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); - Main.dust[num624].velocity *= 2f; + int slimyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 3f); + Main.dust[slimyDust2].noGravity = true; + Main.dust[slimyDust2].velocity *= 5f; + slimyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + Main.dust[slimyDust2].velocity *= 2f; } // Let the player know that the Slime God isn't dead fr @@ -432,9 +432,9 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.getGoodWorld) flySpeed *= 1.25f; - Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); + Vector2 flyDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); Vector2 flyDestination = GetFlyDestination(player); - Vector2 idealVelocity = (flyDestination - vector167).SafeNormalize(Vector2.UnitY) * flySpeed; + Vector2 idealVelocity = (flyDestination - flyDirection).SafeNormalize(Vector2.UnitY) * flySpeed; float distanceFromFlyDestination = NPC.Distance(flyDestination); @@ -475,11 +475,11 @@ namespace CalamityMod.NPCs.SlimeGod // If multiple slimes are present, and they are all relatively close together, try to stay in their general area. // If they are far apart, try to stay towards the closest slime. // If no slimes exist, or they are all extremely far away, try to stay near the target player instead. - // TODO -- Consider renaming the big slime god's internal names to be more intuitive? - int crimulanSlimeID = ModContent.NPCType(); - int crimulanSlimeSplitID = ModContent.NPCType(); - int ebonianSlimeID = ModContent.NPCType(); - int ebonianSlimeSplitID = ModContent.NPCType(); + + int largeCrimulanPaladin = ModContent.NPCType(); + int splitCrimulanPaladin = ModContent.NPCType(); + int largeEbonianPaladin = ModContent.NPCType(); + int splitEbonianPaladin = ModContent.NPCType(); List largeSlimes = new(); float ignoreGeneralAreaDistanceThreshold = 750f; @@ -489,7 +489,7 @@ namespace CalamityMod.NPCs.SlimeGod for (int i = 0; i < Main.maxNPCs; i++) { int npcType = Main.npc[i].type; - if (npcType != crimulanSlimeID && npcType != crimulanSlimeSplitID && npcType != ebonianSlimeID && npcType != ebonianSlimeSplitID) + if (npcType != largeCrimulanPaladin && npcType != splitCrimulanPaladin && npcType != largeEbonianPaladin && npcType != splitEbonianPaladin) continue; if (!Main.npc[i].active) @@ -539,44 +539,41 @@ namespace CalamityMod.NPCs.SlimeGod { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color24 = NPC.GetAlpha(drawColor); - Color color25 = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); + Color drawColorAlpha = NPC.GetAlpha(drawColor); + Color colorLightingArea = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); Texture2D texture2D3 = TextureAssets.Npc[NPC.type].Value; Texture2D pog = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes").Value; - int num156 = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; - int y3 = num156 * (int)NPC.frameCounter; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - spriteBatch.Draw(texture2D3, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, color24, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); + int frameTexture = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; + int y3 = frameTexture * (int)NPC.frameCounter; + Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, frameTexture); + Vector2 halfRect = rectangle.Size() / 2f; + int twoConst = 2; + int coreID = 1; + spriteBatch.Draw(texture2D3, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); if (Main.zenithWorld) { - spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, color24, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); + spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); } if (!Main.zenithWorld) - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) + while (((twoConst > 0 && coreID < 8) || (twoConst < 0 && coreID > 8)) && CalamityConfig.Instance.Afterimages) { - Color color26 = NPC.GetAlpha(color25); + Color colorLightingAlpha = NPC.GetAlpha(colorLightingArea); { goto IL_6899; } IL_6881: - num161 += num158; + coreID += twoConst; continue; IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) + float trailLengthMult = (float)(8 - coreID); + if (twoConst < 0) { - num164 = (float)(num159 - num161); + trailLengthMult = (float)(1 - coreID); } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f); - Vector2 value4 = NPC.oldPos[num161]; - float num165 = NPC.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + NPC.Size / 2f - screenPos + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + NPC.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, NPC.scale, spriteEffects, 0f); + colorLightingAlpha *= trailLengthMult / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f); + Vector2 drawPosition = NPC.oldPos[coreID]; + float coreRotate = NPC.rotation; + Main.spriteBatch.Draw(texture2D3, drawPosition + NPC.Size / 2f - screenPos + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorLightingAlpha, coreRotate + NPC.rotation * 0f * (float)(coreID - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), halfRect, NPC.scale, spriteEffects, 0f); goto IL_6881; } return false; diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index dc279b91d3..344477b686 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -174,34 +174,33 @@ namespace CalamityMod.NPCs.SlimeGod NPC.TargetClosest(false); player = Main.player[NPC.target]; Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1120f; - Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int num5 = 5; - int num8 = 0; - while (num8 < 100) + Point teleportAheadPos = vectorAimedAheadOfTarget.ToTileCoordinates(); + int maxTeleportTries = 0; + while (maxTeleportTries < 100) { - num8++; - int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); - int num10 = Main.rand.Next(point2.Y - num5, point2.Y); - if (Main.tile[num9, num10].HasUnactuatedTile) + maxTeleportTries++; + int teleportPosX = Main.rand.Next(teleportAheadPos.X - 5, teleportAheadPos.X + 6); + int teleportPosY = Main.rand.Next(teleportAheadPos.Y - 5, teleportAheadPos.Y); + if (Main.tile[teleportPosX, teleportPosY].HasUnactuatedTile) continue; - bool flag4 = true; - if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) - flag4 = false; - if (flag4 && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - flag4 = false; + bool canTeleport = true; + if (canTeleport && Main.tile[teleportPosX, teleportPosY].LiquidType == LiquidID.Lava) + canTeleport = false; + if (canTeleport && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + canTeleport = false; - if (flag4) + if (canTeleport) { - NPC.localAI[0] = num9 * 16 + 8; - NPC.localAI[3] = num10 * 16 + 16; + NPC.localAI[0] = teleportPosX * 16 + 8; + NPC.localAI[3] = teleportPosY * 16 + 16; NPC.ai[3] = 0f; break; } } // Default teleport if the above conditions aren't met in 100 iterations - if (num8 >= 100) + if (maxTeleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; NPC.localAI[0] = bottom.X; @@ -344,24 +343,24 @@ namespace CalamityMod.NPCs.SlimeGod NPC.spriteDirection = NPC.direction; NPC.TargetClosest(); - Vector2 center40 = player.Center; - center40.Y -= 350f; - Vector2 vector272 = center40 - NPC.Center; + Vector2 targetCenter = player.Center; + targetCenter.Y -= 350f; + Vector2 targetDist = targetCenter - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - vector272 = player.Center - NPC.Center; - vector272.Normalize(); - vector272 *= death ? 11f : revenge ? 10f : expertMode ? 9f : 8f; - NPC.velocity = (NPC.velocity * 4f + vector272) / 5f; + targetDist = player.Center - NPC.Center; + targetDist.Normalize(); + targetDist *= death ? 11f : revenge ? 10f : expertMode ? 9f : 8f; + NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; if (NPC.ai[1] > 12f) { NPC.ai[1] = 0f; NPC.ai[0] = 1.1f; NPC.ai[2] = 0f; - NPC.velocity = vector272; + NPC.velocity = targetDist; } } else @@ -373,9 +372,9 @@ namespace CalamityMod.NPCs.SlimeGod return; } - vector272.Normalize(); - vector272 *= (death ? 13f : revenge ? 12f : expertMode ? 11f : 10f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + vector272) / 6f; + targetDist.Normalize(); + targetDist *= (death ? 13f : revenge ? 12f : expertMode ? 11f : 10f) + distanceSpeedBoost; + NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } } else if (NPC.ai[0] == 1.1f) @@ -424,8 +423,8 @@ namespace CalamityMod.NPCs.SlimeGod } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(velocity2) * 30f * NPC.scale, velocity2, type, damage, 0f, Main.myPlayer); + Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); } } } @@ -570,11 +569,11 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Crimson; dustColor.A = 150; - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); - Main.dust[num246].noGravity = true; - Main.dust[num246].velocity *= 0.5f; + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[crimsonDust].noGravity = true; + Main.dust[crimsonDust].velocity *= 0.5f; } } else if (NPC.ai[0] == 6f) @@ -604,11 +603,11 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Crimson; dustColor.A = 150; - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); - Main.dust[num246].noGravity = true; - Main.dust[num246].velocity *= 0.5f; + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[crimsonDust].noGravity = true; + Main.dust[crimsonDust].velocity *= 0.5f; } } @@ -617,15 +616,15 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.life > 0) { - float num659 = lifeRatio; - num659 = num659 * 0.5f + 0.75f; - num659 *= scale; + float scaleRatio = lifeRatio; + scaleRatio = scaleRatio * 0.5f + 0.75f; + scaleRatio *= scale; - if (num659 != NPC.scale) + if (scaleRatio != NPC.scale) { NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; - NPC.scale = num659 * 0.75f; + NPC.scale = scaleRatio * 0.75f; NPC.width = (int)(150f * NPC.scale); NPC.height = (int)(92f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); @@ -634,25 +633,25 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)NPC.lifeMax * 0.15); - if ((float)(NPC.life + num660) < bossLife) + int slimeSpawnThreshold = (int)((double)NPC.lifeMax * 0.15); + if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); - int num663 = ModContent.NPCType(); + int slimeType = ModContent.NPCType(); if (Main.rand.NextBool(3)) { - num663 = ModContent.NPCType(); + slimeType = ModContent.NPCType(); } - int num664 = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[slimeSpawn].SetDefaults(slimeType); + Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[slimeSpawn].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } @@ -696,23 +695,23 @@ namespace CalamityMod.NPCs.SlimeGod NPC.height = 50; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); - Main.dust[num622].velocity *= 3f; + int crimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); + Main.dust[crimDust].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[crimDust].scale = 0.5f; + Main.dust[crimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); - Main.dust[num624].velocity *= 2f; + int crimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 3f); + Main.dust[crimDust2].noGravity = true; + Main.dust[crimDust2].velocity *= 5f; + crimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); + Main.dust[crimDust2].velocity *= 2f; } } } diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index 656e68f6f8..80772fbe31 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -170,34 +170,33 @@ namespace CalamityMod.NPCs.SlimeGod NPC.TargetClosest(false); player = Main.player[NPC.target]; Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1120f; - Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int num5 = 5; - int num8 = 0; - while (num8 < 100) + Point teleportAheadPos = vectorAimedAheadOfTarget.ToTileCoordinates(); + int maxTeleportTries = 0; + while (maxTeleportTries < 100) { - num8++; - int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); - int num10 = Main.rand.Next(point2.Y - num5, point2.Y); - if (Main.tile[num9, num10].HasUnactuatedTile) + maxTeleportTries++; + int teleportPosX = Main.rand.Next(teleportAheadPos.X - 5, teleportAheadPos.X + 6); + int teleportPosY = Main.rand.Next(teleportAheadPos.Y - 5, teleportAheadPos.Y); + if (Main.tile[teleportPosX, teleportPosY].HasUnactuatedTile) continue; - bool flag4 = true; - if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) - flag4 = false; - if (flag4 && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - flag4 = false; + bool canTeleport = true; + if (canTeleport && Main.tile[teleportPosX, teleportPosY].LiquidType == LiquidID.Lava) + canTeleport = false; + if (canTeleport && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + canTeleport = false; - if (flag4) + if (canTeleport) { - NPC.localAI[0] = num9 * 16 + 8; - NPC.localAI[3] = num10 * 16 + 16; + NPC.localAI[0] = teleportPosX * 16 + 8; + NPC.localAI[3] = teleportPosY * 16 + 16; NPC.ai[3] = 0f; break; } } // Default teleport if the above conditions aren't met in 100 iterations - if (num8 >= 100) + if (maxTeleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; NPC.localAI[0] = bottom.X; @@ -357,24 +356,24 @@ namespace CalamityMod.NPCs.SlimeGod NPC.spriteDirection = NPC.direction; NPC.TargetClosest(); - Vector2 center40 = player.Center; - center40.Y -= 350f; - Vector2 vector272 = center40 - NPC.Center; + Vector2 targetCenter = player.Center; + targetCenter.Y -= 350f; + Vector2 targetDist = targetCenter - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - vector272 = player.Center - NPC.Center; - vector272.Normalize(); - vector272 *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; - NPC.velocity = (NPC.velocity * 4f + vector272) / 5f; + targetDist = player.Center - NPC.Center; + targetDist.Normalize(); + targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; + NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; if (NPC.ai[1] > 12f) { NPC.ai[1] = 0f; NPC.ai[0] = 2.1f; NPC.ai[2] = 0f; - NPC.velocity = vector272; + NPC.velocity = targetDist; } } else @@ -386,9 +385,9 @@ namespace CalamityMod.NPCs.SlimeGod return; } - vector272.Normalize(); - vector272 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + vector272) / 6f; + targetDist.Normalize(); + targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; + NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } } else if (NPC.ai[0] == 2.1f) @@ -441,8 +440,8 @@ namespace CalamityMod.NPCs.SlimeGod } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(velocity2) * 30f * NPC.scale, velocity2, type, damage, 0f, Main.myPlayer); + Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); } } } @@ -587,11 +586,11 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); - Main.dust[num246].noGravity = true; - Main.dust[num246].velocity *= 0.5f; + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[corruptDust].noGravity = true; + Main.dust[corruptDust].velocity *= 0.5f; } } else if (NPC.ai[0] == 7f) @@ -621,11 +620,11 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); - Main.dust[num246].noGravity = true; - Main.dust[num246].velocity *= 0.5f; + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[corruptDust].noGravity = true; + Main.dust[corruptDust].velocity *= 0.5f; } } @@ -634,15 +633,15 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.life > 0) { - float num659 = lifeRatio; - num659 = num659 * 0.5f + 0.75f; - num659 *= scale; + float scaleRatio = lifeRatio; + scaleRatio = scaleRatio * 0.5f + 0.75f; + scaleRatio *= scale; - if (num659 != NPC.scale) + if (scaleRatio != NPC.scale) { NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; - NPC.scale = num659 * 0.75f; + NPC.scale = scaleRatio * 0.75f; NPC.width = (int)(150f * NPC.scale); NPC.height = (int)(92f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); @@ -651,21 +650,21 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)NPC.lifeMax * 0.2); - if ((float)(NPC.life + num660) < bossLife) + int slimeSpawnThreshold = (int)((double)NPC.lifeMax * 0.2); + if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); - int num663 = ModContent.NPCType(); - int num664 = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + int slimeType = ModContent.NPCType(); + int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[slimeSpawn].SetDefaults(slimeType); + Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[slimeSpawn].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } @@ -709,23 +708,23 @@ namespace CalamityMod.NPCs.SlimeGod NPC.height = 50; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); - Main.dust[num622].velocity *= 3f; + int corruptionDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); + Main.dust[corruptionDust].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[corruptionDust].scale = 0.5f; + Main.dust[corruptionDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); - Main.dust[num624].velocity *= 2f; + int corruptionDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 3f); + Main.dust[corruptionDust2].noGravity = true; + Main.dust[corruptionDust2].velocity *= 5f; + corruptionDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); + Main.dust[corruptionDust2].velocity *= 2f; } } } diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index ff92fcd7c0..db749693ef 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -186,11 +186,11 @@ namespace CalamityMod.NPCs.StormWeaver { if (NPC.alpha != 0) { - for (int num934 = 0; num934 < 2; num934++) + for (int i = 0; i < 2; i++) { - int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; + int redDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[redDust].noGravity = true; + Main.dust[redDust].noLight = true; } } @@ -199,41 +199,41 @@ namespace CalamityMod.NPCs.StormWeaver NPC.alpha = 0; } - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; + Vector2 segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + segmentLocation.X = (int)(segmentLocation.X / 16f) * 16; + segmentLocation.Y = (int)(segmentLocation.Y / 16f) * 16; + targetX -= segmentLocation.X; + targetY -= segmentLocation.Y; - float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentLocation.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentLocation.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + MathHelper.PiOver2; + targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); + int npcWidth = NPC.width; + targetDistance = (targetDistance - npcWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + targetX; + NPC.position.Y = NPC.position.Y + targetY; - if (num191 < 0f) + if (targetX < 0f) NPC.spriteDirection = -1; - else if (num191 > 0f) + else if (targetX > 0f) NPC.spriteDirection = 1; } } @@ -263,21 +263,21 @@ namespace CalamityMod.NPCs.StormWeaver chargePhaseGateValue *= 0.5f; Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverBodyNaked").Value : TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(texture.Width / 2, texture.Height / 2); + Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Color color = NPC.GetAlpha(drawColor); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color drawColorAlpha = NPC.GetAlpha(drawColor); if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] > chargeTelegraphGateValue) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] - chargeTelegraphGateValue) / chargeTelegraphTime, 0f, 1f)); + drawColorAlpha = Color.Lerp(drawColorAlpha, Color.Cyan, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] - chargeTelegraphGateValue) / chargeTelegraphTime, 0f, 1f)); else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 60f, 0f, 1f)); + drawColorAlpha = Color.Lerp(drawColorAlpha, Color.Cyan, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 60f, 0f, 1f)); - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, drawColorAlpha, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -329,24 +329,24 @@ namespace CalamityMod.NPCs.StormWeaver NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 20; num621++) + for (int i = 0; i < 20; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 40; num623++) + for (int j = 0; j < 40; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; } } } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index ac81c6044d..14a4949b6a 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -221,11 +221,11 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.alpha != 0) { - for (int num934 = 0; num934 < 2; num934++) + for (int i = 0; i < 2; i++) { - int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; + int redDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[redDust].noGravity = true; + Main.dust[redDust].noLight = true; } } @@ -252,10 +252,10 @@ namespace CalamityMod.NPCs.StormWeaver totalLength = npcCounts - 20; } - for (int num36 = 0; num36 < totalLength; num36++) + for (int segments = 0; segments < totalLength; segments++) { int lol; - if (num36 >= 0 && num36 < totalLength - 1) + if (segments >= 0 && segments < totalLength - 1) lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); else lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); @@ -292,13 +292,13 @@ namespace CalamityMod.NPCs.StormWeaver if ((double)NPC.position.Y < Main.topWorld + 16f) { - for (int num957 = 0; num957 < Main.maxNPCs; num957++) + for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[num957].active && (Main.npc[num957].type == ModContent.NPCType() - || Main.npc[num957].type == ModContent.NPCType() - || Main.npc[num957].type == ModContent.NPCType())) + if (Main.npc[j].active && (Main.npc[j].type == ModContent.NPCType() + || Main.npc[j].type == ModContent.NPCType() + || Main.npc[j].type == ModContent.NPCType())) { - Main.npc[num957].active = false; + Main.npc[j].active = false; } } } @@ -306,13 +306,13 @@ namespace CalamityMod.NPCs.StormWeaver if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 10000f && NPC.life > 0) { - for (int num957 = 0; num957 < Main.maxNPCs; num957++) + for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[num957].type == ModContent.NPCType() - || Main.npc[num957].type == ModContent.NPCType() - || Main.npc[num957].type == ModContent.NPCType()) + if (Main.npc[j].type == ModContent.NPCType() + || Main.npc[j].type == ModContent.NPCType() + || Main.npc[j].type == ModContent.NPCType()) { - Main.npc[num957].active = false; + Main.npc[j].active = false; } } } @@ -588,16 +588,16 @@ namespace CalamityMod.NPCs.StormWeaver } int dustAmt = 5; - for (int num1474 = 0; num1474 < dustAmt; num1474++) + for (int k = 0; k < dustAmt; k++) { - Vector2 vector171 = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; - vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + NPC.Center; - Vector2 value18 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 206, value18.X, value18.Y, 100, default, 3f); - Main.dust[num1475].noGravity = true; - Main.dust[num1475].noLight = true; - Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= NPC.velocity; + Vector2 dustRotation = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; + dustRotation = dustRotation.RotatedBy((k - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + NPC.Center; + Vector2 randDustMovement = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int bluishDust = Dust.NewDust(dustRotation + randDustMovement, 0, 0, 206, randDustMovement.X, randDustMovement.Y, 100, default, 3f); + Main.dust[bluishDust].noGravity = true; + Main.dust[bluishDust].noLight = true; + Main.dust[bluishDust].velocity /= 4f; + Main.dust[bluishDust].velocity -= NPC.velocity; } } else @@ -614,20 +614,20 @@ namespace CalamityMod.NPCs.StormWeaver acceleration *= 1.4f; } - float num48 = velocity * 1.3f; - float num49 = velocity * 0.7f; - float num50 = NPC.velocity.Length(); - if (num50 > 0f) + float fasterVelMult = velocity * 1.3f; + float slowerVelMult = velocity * 0.7f; + float weaverSpeed = NPC.velocity.Length(); + if (weaverSpeed > 0f) { - if (num50 > num48) + if (weaverSpeed > fasterVelMult) { NPC.velocity.Normalize(); - NPC.velocity *= num48; + NPC.velocity *= fasterVelMult; } - else if (num50 < num49) + else if (weaverSpeed < slowerVelMult) { NPC.velocity.Normalize(); - NPC.velocity *= num49; + NPC.velocity *= slowerVelMult; } } @@ -660,11 +660,11 @@ namespace CalamityMod.NPCs.StormWeaver source.X += i * 30f - (boltProjectiles * 15f); Vector2 boltVelocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / boltProjectiles))); boltVelocity.X = boltVelocity.X + 3f * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[NPC.target].Center - source; + Vector2 aimDirection = Main.player[NPC.target].Center - source; float ai = Main.rand.Next(100); int type = ProjectileID.CultistBossLightningOrbArc; int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), source, boltVelocity, type, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, boltVelocity, type, damage, 0f, Main.myPlayer, aimDirection.ToRotation(), ai); } } } @@ -688,12 +688,12 @@ namespace CalamityMod.NPCs.StormWeaver npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; targetCenterX -= npcCenter.X; targetCenterY -= npcCenter.Y; - float num193 = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - float num196 = Math.Abs(targetCenterX); - float num197 = Math.Abs(targetCenterY); - float num198 = velocity / num193; - targetCenterX *= num198; - targetCenterY *= num198; + float targetDistance = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + float absoluteTargetX = Math.Abs(targetCenterX); + float absoluteTargetY = Math.Abs(targetCenterY); + float timeToReachTarget = velocity / targetDistance; + targetCenterX *= timeToReachTarget; + targetCenterY *= timeToReachTarget; if ((NPC.velocity.X > 0f && targetCenterX > 0f) || (NPC.velocity.X < 0f && targetCenterX < 0f) || (NPC.velocity.Y > 0f && targetCenterY > 0f) || (NPC.velocity.Y < 0f && targetCenterY < 0f)) { @@ -735,7 +735,7 @@ namespace CalamityMod.NPCs.StormWeaver } else { - if (num196 > num197) + if (absoluteTargetX > absoluteTargetY) { if (NPC.velocity.X < targetCenterX) NPC.velocity.X = NPC.velocity.X + acceleration * 1.1f; @@ -827,21 +827,21 @@ namespace CalamityMod.NPCs.StormWeaver chargePhaseGateValue *= 0.5f; Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked").Value : TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(texture.Width / 2, texture.Height / 2); + Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Color color = NPC.GetAlpha(drawColor); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color drawColorAlpha = NPC.GetAlpha(drawColor); if (calamityGlobalNPC.newAI[0] > chargeTelegraphGateValue) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((calamityGlobalNPC.newAI[0] - chargeTelegraphGateValue) / chargeTelegraphTime, 0f, 1f)); + drawColorAlpha = Color.Lerp(drawColorAlpha, Color.Cyan, MathHelper.Clamp((calamityGlobalNPC.newAI[0] - chargeTelegraphGateValue) / chargeTelegraphTime, 0f, 1f)); else if (NPC.localAI[3] > 0f) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp(NPC.localAI[3] / 60f, 0f, 1f)); + drawColorAlpha = Color.Lerp(drawColorAlpha, Color.Cyan, MathHelper.Clamp(NPC.localAI[3] / 60f, 0f, 1f)); - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, drawColorAlpha, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -892,34 +892,34 @@ namespace CalamityMod.NPCs.StormWeaver NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 20; num621++) + for (int i = 0; i < 20; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 40; num623++) + for (int j = 0; j < 40; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; } } } public override bool CheckDead() { - for (int num569 = 0; num569 < Main.maxNPCs; num569++) + for (int k = 0; k < Main.maxNPCs; k++) { - if (Main.npc[num569].active && (Main.npc[num569].type == ModContent.NPCType() || Main.npc[num569].type == ModContent.NPCType())) - Main.npc[num569].life = 0; + if (Main.npc[k].active && (Main.npc[k].type == ModContent.NPCType() || Main.npc[k].type == ModContent.NPCType())) + Main.npc[k].life = 0; } return true; diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index e50b446d82..3ff0f7a02e 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -178,11 +178,11 @@ namespace CalamityMod.NPCs.StormWeaver { if (NPC.alpha != 0) { - for (int num934 = 0; num934 < 2; num934++) + for (int i = 0; i < 2; i++) { - int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; + int redDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[redDust].noGravity = true; + Main.dust[redDust].noLight = true; } } @@ -191,41 +191,41 @@ namespace CalamityMod.NPCs.StormWeaver NPC.alpha = 0; } - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; + Vector2 segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + segmentLocation.X = (int)(segmentLocation.X / 16f) * 16; + segmentLocation.Y = (int)(segmentLocation.Y / 16f) * 16; + targetX -= segmentLocation.X; + targetY -= segmentLocation.Y; - float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentLocation.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentLocation.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + MathHelper.PiOver2; + targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); + int npcWidth = NPC.width; + targetDistance = (targetDistance - npcWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; + NPC.position.X = NPC.position.X + targetX; + NPC.position.Y = NPC.position.Y + targetY; - if (num191 < 0f) + if (targetX < 0f) NPC.spriteDirection = -1; - else if (num191 > 0f) + else if (targetX > 0f) NPC.spriteDirection = 1; } } @@ -255,28 +255,28 @@ namespace CalamityMod.NPCs.StormWeaver chargePhaseGateValue *= 0.5f; Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailNaked").Value : TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(texture.Width / 2, texture.Height / 2); + Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Color color = NPC.GetAlpha(drawColor); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color drawColorAlpha = NPC.GetAlpha(drawColor); if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] > chargeTelegraphGateValue) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] - chargeTelegraphGateValue) / chargeTelegraphTime, 0f, 1f)); + drawColorAlpha = Color.Lerp(drawColorAlpha, Color.Cyan, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] - chargeTelegraphGateValue) / chargeTelegraphTime, 0f, 1f)); else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 60f, 0f, 1f)); + drawColorAlpha = Color.Lerp(drawColorAlpha, Color.Cyan, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 60f, 0f, 1f)); - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, drawColorAlpha, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (!phase2) { texture = ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailGlow").Value; Color rainbowBecauseWhyTheFuckNot = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - Color color37 = Color.Lerp(Color.White, rainbowBecauseWhyTheFuckNot, 0.5f); - spriteBatch.Draw(texture, vector2, NPC.frame, color37, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + Color drawColorAlpha37 = Color.Lerp(Color.White, rainbowBecauseWhyTheFuckNot, 0.5f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, drawColorAlpha37, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } return false; @@ -323,24 +323,24 @@ namespace CalamityMod.NPCs.StormWeaver NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 20; num621++) + for (int i = 0; i < 20; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[cosmiliteDust].scale = 0.5f; + Main.dust[cosmiliteDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 40; num623++) + for (int j = 0; j < 40; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[cosmiliteDust2].noGravity = true; + Main.dust[cosmiliteDust2].velocity *= 5f; + cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[cosmiliteDust2].velocity *= 2f; } } } From e595bdd8ad1c025746b5040d41040f05464e3a99 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 24 Oct 2023 00:16:20 -0400 Subject: [PATCH 18/43] Supreme Calamitas and Yharon --- NPCs/SupremeCalamitas/SepulcherBody.cs | 10 +- NPCs/SupremeCalamitas/SepulcherHead.cs | 120 ++-- NPCs/SupremeCalamitas/SepulcherTail.cs | 72 +-- NPCs/SupremeCalamitas/SoulSeekerSupreme.cs | 74 ++- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 82 ++- NPCs/SupremeCalamitas/SupremeCataclysm.cs | 22 +- NPCs/SupremeCalamitas/SupremeCatastrophe.cs | 22 +- NPCs/Yharon/Yharon.cs | 608 ++++++++++---------- 8 files changed, 502 insertions(+), 508 deletions(-) diff --git a/NPCs/SupremeCalamitas/SepulcherBody.cs b/NPCs/SupremeCalamitas/SepulcherBody.cs index 34c639e08e..499ffeb018 100644 --- a/NPCs/SupremeCalamitas/SepulcherBody.cs +++ b/NPCs/SupremeCalamitas/SepulcherBody.cs @@ -122,12 +122,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = NPC.localAI[3] / 2f % 2f == 0f ? ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherBodyAlt").Value : TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/SupremeCalamitas/SepulcherHead.cs b/NPCs/SupremeCalamitas/SepulcherHead.cs index 6ebb211642..3b33ce86eb 100644 --- a/NPCs/SupremeCalamitas/SepulcherHead.cs +++ b/NPCs/SupremeCalamitas/SepulcherHead.cs @@ -191,131 +191,131 @@ namespace CalamityMod.NPCs.SupremeCalamitas else NPC.Opacity = MathHelper.Clamp(NPC.Opacity + 0.165f, 0f, 1f); - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - float num188 = BossRushEvent.BossRushActive ? 12.5f : 10f; - float num189 = BossRushEvent.BossRushActive ? 0.125f : 0.1f; + Vector2 segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + float sepMaxSpeed = BossRushEvent.BossRushActive ? 12.5f : 10f; + float sepAcceleration = BossRushEvent.BossRushActive ? 0.125f : 0.1f; - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = NPC.velocity.Length(); - if (num50 > 0f) + float fasterMaxSpeed = sepMaxSpeed * 1.3f; + float slowerMaxSpeed = sepMaxSpeed * 0.7f; + float currentSpeed = NPC.velocity.Length(); + if (currentSpeed > 0f) { - if (num50 > num48) + if (currentSpeed > fasterMaxSpeed) { NPC.velocity.Normalize(); - NPC.velocity *= num48; + NPC.velocity *= fasterMaxSpeed; } - else if (num50 < num49) + else if (currentSpeed < slowerMaxSpeed) { NPC.velocity.Normalize(); - NPC.velocity *= num49; + NPC.velocity *= slowerMaxSpeed; } } - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - float num196 = Math.Abs(num191); - float num197 = Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + segmentLocation.X = (int)(segmentLocation.X / 16f) * 16; + segmentLocation.Y = (int)(segmentLocation.Y / 16f) * 16; + targetX -= segmentLocation.X; + targetY -= segmentLocation.Y; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float absoluteTargetX = Math.Abs(targetX); + float absoluteTargetY = Math.Abs(targetY); + float timeToReachTarget = sepMaxSpeed / targetDistance; + targetX *= timeToReachTarget; + targetY *= timeToReachTarget; + if ((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f) || (NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f)) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < targetX) { - NPC.velocity.X = NPC.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + sepAcceleration; } else { - if (NPC.velocity.X > num191) + if (NPC.velocity.X > targetX) { - NPC.velocity.X = NPC.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - sepAcceleration; } } - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < targetY) { - NPC.velocity.Y = NPC.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + sepAcceleration; } else { - if (NPC.velocity.Y > num192) + if (NPC.velocity.Y > targetY) { - NPC.velocity.Y = NPC.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - sepAcceleration; } } - if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(targetY) < sepMaxSpeed * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y + sepAcceleration * 2f; } else { - NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - sepAcceleration * 2f; } } - if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(targetX) < sepMaxSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X + sepAcceleration * 2f; //changed from 2 } else { - NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X - sepAcceleration * 2f; //changed from 2 } } } else { - if (num196 > num197) + if (absoluteTargetX > absoluteTargetY) { - if (NPC.velocity.X < num191) + if (NPC.velocity.X < targetX) { - NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X + sepAcceleration * 1.1f; //changed from 1.1 } - else if (NPC.velocity.X > num191) + else if (NPC.velocity.X > targetX) { - NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X - sepAcceleration * 1.1f; //changed from 1.1 } - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < sepMaxSpeed * 0.5) { if (NPC.velocity.Y > 0f) { - NPC.velocity.Y = NPC.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + sepAcceleration; } else { - NPC.velocity.Y = NPC.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - sepAcceleration; } } } else { - if (NPC.velocity.Y < num192) + if (NPC.velocity.Y < targetY) { - NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + sepAcceleration * 1.1f; } - else if (NPC.velocity.Y > num192) + else if (NPC.velocity.Y > targetY) { - NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - sepAcceleration * 1.1f; } - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < sepMaxSpeed * 0.5) { if (NPC.velocity.X > 0f) { - NPC.velocity.X = NPC.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + sepAcceleration; } else { - NPC.velocity.X = NPC.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - sepAcceleration; } } } @@ -333,12 +333,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/SupremeCalamitas/SepulcherTail.cs b/NPCs/SupremeCalamitas/SepulcherTail.cs index f6f30ac093..4f11f7283b 100644 --- a/NPCs/SupremeCalamitas/SepulcherTail.cs +++ b/NPCs/SupremeCalamitas/SepulcherTail.cs @@ -69,16 +69,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.realLife = (int)NPC.ai[2]; } - bool flag = false; + bool shouldDie = false; if (NPC.ai[1] <= 0f) { - flag = true; + shouldDie = true; } else if (Main.npc[(int)NPC.ai[1]].life <= 0 || NPC.life <= 0) { - flag = true; + shouldDie = true; } - if (flag) + if (shouldDie) { NPC.life = 0; NPC.HitEffect(0, 10.0); @@ -89,11 +89,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.alpha != 0) { - for (int num934 = 0; num934 < 2; num934++) + for (int i = 0; i < 2; i++) { - int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; + int redDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[redDust].noGravity = true; + Main.dust[redDust].noLight = true; } } NPC.alpha -= 42; @@ -108,41 +108,41 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.alpha = Main.npc[(int)NPC.ai[2]].alpha; } - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + Vector2 segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + targetX = (int)(targetX / 16f) * 16; + targetY = (int)(targetY / 16f) * 16; + segmentLocation.X = (int)(segmentLocation.X / 16f) * 16; + segmentLocation.Y = (int)(segmentLocation.Y / 16f) * 16; + targetX -= segmentLocation.X; + targetY -= segmentLocation.Y; + float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; + segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentLocation.X; + targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentLocation.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; - num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + 1.57f; + targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY); + int npcWidth = NPC.width; + targetDistance = (targetDistance - npcWidth) / targetDistance; + targetX *= targetDistance; + targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; - if (num191 < 0f) + NPC.position.X = NPC.position.X + targetX; + NPC.position.Y = NPC.position.Y + targetY; + if (targetX < 0f) { NPC.spriteDirection = -1; } - else if (num191 > 0f) + else if (targetX > 0f) { NPC.spriteDirection = 1; } @@ -164,12 +164,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index fc97720873..9455c06678 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -187,23 +187,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.height = 50; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 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 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) @@ -223,49 +223,47 @@ namespace CalamityMod.NPCs.SupremeCalamitas spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 2; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 2; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + Color redLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color redAfterimageColor = redLerp; + redAfterimageColor = Color.Lerp(redAfterimageColor, Color.White, 0.5f); + redAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 redAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + redAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + redAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, redAfterimagePos, NPC.frame, redAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index a065b545d6..48fe5c92f4 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -593,14 +593,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnYAdd = 125; } - int num52 = (int)(safeBox.X + (float)(safeBox.Width / 2)) / 16; - int num53 = (int)(safeBox.Y + (float)(safeBox.Height / 2)) / 16; - int num54 = safeBox.Width / 2 / 16 + 1; - for (int num55 = num52 - num54; num55 <= num52 + num54; num55++) + int safeBoxTilesX = (int)(safeBox.X + (float)(safeBox.Width / 2)) / 16; + int safeBoxTilesY = (int)(safeBox.Y + (float)(safeBox.Height / 2)) / 16; + int safeBoxTileWidth = safeBox.Width / 2 / 16 + 1; + for (int i = safeBoxTilesX - safeBoxTileWidth; i <= safeBoxTilesX + safeBoxTileWidth; i++) { - for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) + for (int j = safeBoxTilesY - safeBoxTileWidth; j <= safeBoxTilesY + safeBoxTileWidth; j++) { - if (!WorldGen.InWorld(num55, num56, 2)) + if (!WorldGen.InWorld(i, j, 2)) continue; int xoffset = 0; @@ -612,18 +612,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas yoffset += Main.rand.Next(-maxoffset, maxoffset + 1); } - if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55 + xoffset, num56 + yoffset].HasTile) + if ((i == safeBoxTilesX - safeBoxTileWidth || i == safeBoxTilesX + safeBoxTileWidth || j == safeBoxTilesY - safeBoxTileWidth || j == safeBoxTilesY + safeBoxTileWidth) && !Main.tile[i + xoffset, j + yoffset].HasTile) { - Main.tile[num55 + xoffset, num56 + yoffset].TileType = (ushort)ModContent.TileType(); - Main.tile[num55 + xoffset, num56 + yoffset].Get().HasTile = true; + Main.tile[i + xoffset, j + yoffset].TileType = (ushort)ModContent.TileType(); + Main.tile[i + xoffset, j + yoffset].Get().HasTile = true; } if (Main.netMode == NetmodeID.Server) { - NetMessage.SendTileSquare(-1, num55 + xoffset, num56 + yoffset, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, i + xoffset, j + yoffset, 1, TileChangeType.None); } else { - WorldGen.SquareTileFrame(num55 + xoffset, num56 + yoffset, true); + WorldGen.SquareTileFrame(i + xoffset, j + yoffset, true); } } } @@ -2213,7 +2213,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[2] = 0f; else { - for (int num388 = 0; num388 < 50; num388++) + for (int i = 0; i < 50; i++) Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); SoundEngine.PlaySound(SpawnSound, NPC.Center); @@ -3181,11 +3181,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (cirrus) texture2D15 = inPhase2 ? ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered").Value : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus").Value; - Vector2 vector11 = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2f); + Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2f); Vector2 ponyOrigin = new Vector2(pony.Width / 2f, pony.Height / 30f); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 7; + int afterimageAmt = 7; Rectangle frame = texture2D15.Frame(2, Main.npcFrameCount[NPC.type], NPC.frame.Y / Main.npcFrameCount[NPC.type], NPC.frame.Y % Main.npcFrameCount[NPC.type]); Rectangle ponyFrame = pony.Frame(1, 15, 0, alicornFrame); @@ -3195,22 +3193,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (CalamityConfig.Instance.Afterimages && !(cirrus && NPC.ai[1] == 2f)) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); if (!(cirrus && NPC.ai[1] == 2f)) { @@ -3218,7 +3216,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { // Make the sprite jitter with rage in phase 2. This does not happen in rematches since it would make little sense logically. if (!DownedBossSystem.downedCalamitas) - vector43 += Main.rand.NextVector2Circular(0.25f, 0.7f); + drawLocation += Main.rand.NextVector2Circular(0.25f, 0.7f); // And gain a flaming aura. Color auraColor = NPC.GetAlpha(cirrus ? Color.Pink : Color.Red) * 0.4f; @@ -3226,10 +3224,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas { Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 4f).ToRotationVector2(); rotationalDrawOffset *= MathHelper.Lerp(3f, 4.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); - spriteBatch.Draw(texture2D15, vector43 + rotationalDrawOffset, frame, auraColor, NPC.rotation, vector11, NPC.scale * 1.1f, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation + rotationalDrawOffset, frame, auraColor, NPC.rotation, halfSizeTexture, NPC.scale * 1.1f, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } if (!NPC.IsABestiaryIconDummy) @@ -3369,23 +3367,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.height = 100; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int onHitDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[onHitDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[onHitDust].scale = 0.5f; + Main.dust[onHitDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[onHitDust2].noGravity = true; + Main.dust[onHitDust2].velocity *= 5f; + onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[onHitDust2].velocity *= 2f; } } } diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 0422546da0..e79e7fa71e 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -322,23 +322,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 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 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } // Turn into dust on death. diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 9d9e4cf183..bd4b87d7e7 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -316,23 +316,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 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 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } // Turn into dust on death. diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 9c4d3143bc..ad2d2f192f 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -475,10 +475,10 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity *= 0.98f; - int num1467 = Math.Sign(player.Center.X - NPC.Center.X); - if (num1467 != 0) + int playerFacingDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (playerFacingDirection != 0) { - NPC.direction = num1467; + NPC.direction = playerFacingDirection; NPC.spriteDirection = -NPC.direction; } @@ -501,16 +501,16 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[2] == fireTornadoPhaseTimer - 30) { - int num1468 = 72; - for (int num1469 = 0; num1469 < num1468; num1469++) + int dustAmt = 72; + for (int i = 0; i < dustAmt; i++) { - Vector2 vector169 = Vector2.Normalize(NPC.velocity) * new Vector2(NPC.width / 2f, NPC.height) * 0.75f * 0.5f; - vector169 = vector169.RotatedBy((num1469 - (num1468 / 2 - 1)) * MathHelper.TwoPi / num1468) + NPC.Center; - Vector2 value16 = vector169 - NPC.Center; - int num1470 = Dust.NewDust(vector169 + value16, 0, 0, 244, value16.X * 2f, value16.Y * 2f, 100, default, 1.4f); - Main.dust[num1470].noGravity = true; - Main.dust[num1470].noLight = true; - Main.dust[num1470].velocity = Vector2.Normalize(value16) * 3f; + Vector2 dustRotation = Vector2.Normalize(NPC.velocity) * new Vector2(NPC.width / 2f, NPC.height) * 0.75f * 0.5f; + dustRotation = dustRotation.RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + NPC.Center; + Vector2 dustDirection = dustRotation - NPC.Center; + int orangeDust = Dust.NewDust(dustRotation + dustDirection, 0, 0, 244, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[orangeDust].noGravity = true; + Main.dust[orangeDust].noLight = true; + Main.dust[orangeDust].velocity = Vector2.Normalize(dustDirection) * 3f; } RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); @@ -543,13 +543,13 @@ namespace CalamityMod.NPCs.Yharon else NPC.velocity *= 0.98f; - int num1471 = Math.Sign(player.Center.X - NPC.Center.X); - if (num1471 != 0) + int phaseSwitchFaceDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (phaseSwitchFaceDirection != 0) { - if (NPC.ai[2] == 0f && num1471 != NPC.direction) + if (NPC.ai[2] == 0f && phaseSwitchFaceDirection != NPC.direction) NPC.rotation += pie; - NPC.direction = num1471; + NPC.direction = phaseSwitchFaceDirection; if (NPC.spriteDirection != -NPC.direction) NPC.rotation += pie; @@ -600,9 +600,9 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * chargeSpeed; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - if (num1471 != 0) + if (phaseSwitchFaceDirection != 0) { - NPC.direction = num1471; + NPC.direction = phaseSwitchFaceDirection; if (NPC.spriteDirection == 1) NPC.rotation += pie; @@ -647,9 +647,9 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * chargeSpeed * fastChargeVelocityMultiplier; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - if (num1471 != 0) + if (phaseSwitchFaceDirection != 0) { - NPC.direction = num1471; + NPC.direction = phaseSwitchFaceDirection; if (NPC.spriteDirection == 1) NPC.rotation += pie; @@ -687,11 +687,11 @@ namespace CalamityMod.NPCs.Yharon NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X); Vector2 destination = player.Center + new Vector2(NPC.ai[1], 0); - Vector2 value17 = destination - NPC.Center; - Vector2 vector170 = Vector2.Normalize(value17 - NPC.velocity) * flareBombPhaseVelocity; + Vector2 destinationDist = destination - NPC.Center; + Vector2 flareSpeed = Vector2.Normalize(destinationDist - NPC.velocity) * flareBombPhaseVelocity; if (Vector2.Distance(NPC.Center, destination) > reduceSpeedFlareBombDistance) - NPC.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); + NPC.SimpleFlyMovement(flareSpeed, flareBombPhaseAcceleration); else NPC.velocity *= 0.98f; @@ -708,10 +708,10 @@ namespace CalamityMod.NPCs.Yharon } } - int num1476 = Math.Sign(player.Center.X - NPC.Center.X); - if (num1476 != 0) + int playerFaceDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (playerFaceDirection != 0) { - NPC.direction = num1476; + NPC.direction = playerFaceDirection; if (NPC.spriteDirection != -NPC.direction) NPC.rotation += pie; @@ -815,13 +815,13 @@ namespace CalamityMod.NPCs.Yharon else NPC.velocity *= 0.98f; - int num1477 = Math.Sign(player.Center.X - NPC.Center.X); - if (num1477 != 0) + int playerFaceDirectionFurtherPhases = Math.Sign(player.Center.X - NPC.Center.X); + if (playerFaceDirectionFurtherPhases != 0) { - if (NPC.ai[2] == 0f && num1477 != NPC.direction) + if (NPC.ai[2] == 0f && playerFaceDirectionFurtherPhases != NPC.direction) NPC.rotation += pie; - NPC.direction = num1477; + NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection != -NPC.direction) NPC.rotation += pie; @@ -875,9 +875,9 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * chargeSpeed; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - if (num1477 != 0) + if (playerFaceDirectionFurtherPhases != 0) { - NPC.direction = num1477; + NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) NPC.rotation += pie; @@ -968,9 +968,9 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * chargeSpeed * fastChargeVelocityMultiplier; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - if (num1477 != 0) + if (playerFaceDirectionFurtherPhases != 0) { - NPC.direction = num1477; + NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) NPC.rotation += pie; @@ -986,9 +986,9 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * spinPhaseVelocity; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - if (num1477 != 0) + if (playerFaceDirectionFurtherPhases != 0) { - NPC.direction = num1477; + NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) NPC.rotation += pie; @@ -1170,13 +1170,13 @@ namespace CalamityMod.NPCs.Yharon else NPC.velocity *= 0.98f; - int num1477 = Math.Sign(player.Center.X - NPC.Center.X); - if (num1477 != 0) + int playerFaceDirectionFurtherPhases = Math.Sign(player.Center.X - NPC.Center.X); + if (playerFaceDirectionFurtherPhases != 0) { - if (NPC.ai[2] == 0f && num1477 != NPC.direction) + if (NPC.ai[2] == 0f && playerFaceDirectionFurtherPhases != NPC.direction) NPC.rotation += pie; - NPC.direction = num1477; + NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection != -NPC.direction) NPC.rotation += pie; @@ -1233,9 +1233,9 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * chargeSpeed; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - if (num1477 != 0) + if (playerFaceDirectionFurtherPhases != 0) { - NPC.direction = num1477; + NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) NPC.rotation += pie; @@ -1326,9 +1326,9 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * chargeSpeed * fastChargeVelocityMultiplier; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - if (num1477 != 0) + if (playerFaceDirectionFurtherPhases != 0) { - NPC.direction = num1477; + NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) NPC.rotation += pie; @@ -1344,9 +1344,9 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * spinPhaseVelocity; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - if (num1477 != 0) + if (playerFaceDirectionFurtherPhases != 0) { - NPC.direction = num1477; + NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) NPC.rotation += pie; @@ -1527,11 +1527,11 @@ namespace CalamityMod.NPCs.Yharon NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X); Vector2 destination = player.Center + new Vector2(NPC.ai[1], 0); - Vector2 value17 = destination - NPC.Center; - Vector2 vector170 = Vector2.Normalize(value17 - NPC.velocity) * flareBombPhaseVelocity; + Vector2 destinationDist = destination - NPC.Center; + Vector2 flareSpeed = Vector2.Normalize(destinationDist - NPC.velocity) * flareBombPhaseVelocity; if (Vector2.Distance(NPC.Center, destination) > reduceSpeedFlareBombDistance) - NPC.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); + NPC.SimpleFlyMovement(flareSpeed, flareBombPhaseAcceleration); else NPC.velocity *= 0.98f; @@ -1548,10 +1548,10 @@ namespace CalamityMod.NPCs.Yharon } } - int num1476 = Math.Sign(player.Center.X - NPC.Center.X); - if (num1476 != 0) + int playerFaceDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (playerFaceDirection != 0) { - NPC.direction = num1476; + NPC.direction = playerFaceDirection; if (NPC.spriteDirection != -NPC.direction) NPC.rotation += pie; @@ -1815,26 +1815,26 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity *= 0.98f; } - int num27 = (NPC.Center.X < targetData.Center.X) ? 1 : -1; - NPC.direction = NPC.spriteDirection = num27; + int spriteDirection = (NPC.Center.X < targetData.Center.X) ? 1 : -1; + NPC.direction = NPC.spriteDirection = spriteDirection; NPC.ai[1] += 1f; if (NPC.ai[1] >= phaseSwitchTimer) { - int num28 = 1; + int phase2AttackType = 1; if (phase4) { switch ((int)NPC.ai[3]) { case 0: - num28 = 8; //teleport + phase2AttackType = 8; //teleport break; case 1: case 2: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 3: - num28 = 5; //fire circle + tornado (only once) + fireballs + phase2AttackType = 5; //fire circle + tornado (only once) + fireballs break; } } @@ -1843,52 +1843,52 @@ namespace CalamityMod.NPCs.Yharon switch ((int)NPC.ai[3]) { case 0: - num28 = 6; //tornado + phase2AttackType = 6; //tornado break; case 1: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 2: - num28 = 8; //teleport + phase2AttackType = 8; //teleport break; case 3: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 4: - num28 = 5; //fire circle + phase2AttackType = 5; //fire circle break; case 5: - num28 = Main.rand.NextBool() ? 3 : 4; //fireballs + phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs break; case 6: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 7: - num28 = 8; //teleport + phase2AttackType = 8; //teleport break; case 8: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 9: - num28 = Main.rand.NextBool() ? 4 : 3; //fireballs + phase2AttackType = Main.rand.NextBool() ? 4 : 3; //fireballs break; case 10: - num28 = 6; //tornado + phase2AttackType = 6; //tornado break; case 11: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 12: - num28 = 8; //teleport + phase2AttackType = 8; //teleport break; case 13: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 14: - num28 = 5; //fire circle + phase2AttackType = 5; //fire circle break; case 15: - num28 = Main.rand.NextBool() ? 3 : 4; //fireballs + phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs break; } } @@ -1897,37 +1897,37 @@ namespace CalamityMod.NPCs.Yharon switch ((int)NPC.ai[3]) { case 0: - num28 = 6; //tornado + phase2AttackType = 6; //tornado break; case 1: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 2: - num28 = 2; //charge + phase2AttackType = 2; //charge break; case 3: - num28 = 5; //fire circle + phase2AttackType = 5; //fire circle break; case 4: - num28 = Main.rand.NextBool() ? 3 : 4; //fireballs + phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs break; case 5: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 6: - num28 = 2; //charge + phase2AttackType = 2; //charge break; case 7: - num28 = Main.rand.NextBool() ? 4 : 3; //fireballs + phase2AttackType = Main.rand.NextBool() ? 4 : 3; //fireballs break; case 8: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 9: - num28 = 2; //charge + phase2AttackType = 2; //charge break; case 10: - num28 = 5; //fire circle + phase2AttackType = 5; //fire circle break; } } @@ -1936,33 +1936,33 @@ namespace CalamityMod.NPCs.Yharon switch ((int)NPC.ai[3]) { case 0: - num28 = 6; //tornado + phase2AttackType = 6; //tornado break; case 1: case 2: - num28 = 2; //charge + phase2AttackType = 2; //charge break; case 3: - num28 = Main.rand.NextBool() ? 3 : 4; //fireballs + phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs break; case 4: case 5: - num28 = 7; //fast charge + phase2AttackType = 7; //fast charge break; case 6: - num28 = Main.rand.NextBool() ? 4 : 3; //fireballs + phase2AttackType = Main.rand.NextBool() ? 4 : 3; //fireballs break; case 7: case 8: - num28 = 2; //charge + phase2AttackType = 2; //charge break; case 9: - num28 = 5; //fire circle + phase2AttackType = 5; //fire circle break; } } - if (num28 == 5 && NPC.ai[1] < phaseSwitchTimer + teleportPhaseTimer) + if (phase2AttackType == 5 && NPC.ai[1] < phaseSwitchTimer + teleportPhaseTimer) { NPC.damage = 0; @@ -2025,7 +2025,7 @@ namespace CalamityMod.NPCs.Yharon return; } - if (num28 == 7 && doFastChargeTelegraph) + if (phase2AttackType == 7 && doFastChargeTelegraph) { float newRotation = NPC.AngleTo(targetData.Center); float amount = 0.04f; @@ -2044,7 +2044,7 @@ namespace CalamityMod.NPCs.Yharon return; } - NPC.ai[0] = num28; + NPC.ai[0] = phase2AttackType; NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] += 1f; @@ -2097,7 +2097,7 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[3] >= aiLimit) NPC.ai[3] = 0f; - switch (num28) + switch (phase2AttackType) { case 2: //charge { @@ -2114,9 +2114,9 @@ namespace CalamityMod.NPCs.Yharon } case 3: //fireballs { - Vector2 vector2 = new Vector2((targetData.Center.X > NPC.Center.X) ? 1 : -1, 0f); - NPC.spriteDirection = (vector2.X > 0f) ? 1 : -1; - NPC.velocity = vector2 * -2f; + Vector2 fireSpitFaceDirection = new Vector2((targetData.Center.X > NPC.Center.X) ? 1 : -1, 0f); + NPC.spriteDirection = (fireSpitFaceDirection.X > 0f) ? 1 : -1; + NPC.velocity = fireSpitFaceDirection * -2f; break; } @@ -2167,12 +2167,12 @@ namespace CalamityMod.NPCs.Yharon // Fireball spit charge else if (NPC.ai[0] == 3f) { - int num29 = (NPC.Center.X < targetData.Center.X) ? 1 : -1; + int fireballFaceDirection = (NPC.Center.X < targetData.Center.X) ? 1 : -1; NPC.ai[1] += 1f; if (NPC.ai[1] < fireballBreathTimer) { - Vector2 destination = targetData.Center + new Vector2(num29, 0); + Vector2 destination = targetData.Center + new Vector2(fireballFaceDirection, 0); Vector2 distanceFromDestination = destination - NPC.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - NPC.velocity) * velocity; @@ -2184,7 +2184,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity *= 0.98f; } - NPC.direction = NPC.spriteDirection = num29; + NPC.direction = NPC.spriteDirection = fireballFaceDirection; if (Vector2.Distance(destination, NPC.Center) < 32f) NPC.ai[1] = fireballBreathTimer - 1f; @@ -2232,35 +2232,35 @@ namespace CalamityMod.NPCs.Yharon // Splitting fireball breath else if (NPC.ai[0] == 4f) { - int num31 = (NPC.Center.X < targetData.Center.X) ? 1 : -1; - NPC.ai[2] = num31; + int splitFireFaceDirection = (NPC.Center.X < targetData.Center.X) ? 1 : -1; + NPC.ai[2] = splitFireFaceDirection; if (NPC.ai[1] < splittingFireballBreathTimer) { - Vector2 vector5 = targetData.Center + new Vector2(num31 * -750f, -300f); - Vector2 value2 = NPC.SafeDirectionTo(vector5) * splittingFireballBreathPhaseVelocity; + Vector2 splitFireDestination = targetData.Center + new Vector2(splitFireFaceDirection * -750f, -300f); + Vector2 splitFireFinalVelocity = NPC.SafeDirectionTo(splitFireDestination) * splittingFireballBreathPhaseVelocity; - NPC.velocity = Vector2.Lerp(NPC.velocity, value2, 0.0333333351f); + NPC.velocity = Vector2.Lerp(NPC.velocity, splitFireFinalVelocity, 0.0333333351f); int direction = (NPC.Center.X < targetData.Center.X) ? 1 : -1; NPC.direction = NPC.spriteDirection = direction; - if (Vector2.Distance(vector5, NPC.Center) < 32f) + if (Vector2.Distance(splitFireDestination, NPC.Center) < 32f) NPC.ai[1] = splittingFireballBreathTimer - 1f; } else if (NPC.ai[1] == splittingFireballBreathTimer) { - Vector2 vector6 = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); - vector6.Y *= 0.15f; - vector6 = vector6.SafeNormalize(Vector2.UnitX * NPC.direction); + Vector2 yharonFireballMoveDirection = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); + yharonFireballMoveDirection.Y *= 0.15f; + yharonFireballMoveDirection = yharonFireballMoveDirection.SafeNormalize(Vector2.UnitX * NPC.direction); - NPC.spriteDirection = (vector6.X > 0f) ? 1 : -1; - NPC.rotation = vector6.ToRotation(); + NPC.spriteDirection = (yharonFireballMoveDirection.X > 0f) ? 1 : -1; + NPC.rotation = yharonFireballMoveDirection.ToRotation(); if (NPC.spriteDirection == -1) NPC.rotation += pie; - NPC.velocity = vector6 * splittingFireballBreathPhaseVelocity; + NPC.velocity = yharonFireballMoveDirection * splittingFireballBreathPhaseVelocity; SoundEngine.PlaySound(FireSound, NPC.Center); } else @@ -2270,11 +2270,11 @@ namespace CalamityMod.NPCs.Yharon float xOffset = 30f; Vector2 position = NPC.Center + new Vector2((110f + xOffset) * NPC.direction, -20f).RotatedBy(NPC.rotation); - int num34 = (int)(NPC.ai[1] - splittingFireballBreathTimer + 1f); + int yharonFireballTimer = (int)(NPC.ai[1] - splittingFireballBreathTimer + 1f); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - if (num34 <= splittingFireballBreathTimer2 && num34 % splittingFireballBreathDivisor == 0 && Main.netMode != NetmodeID.MultiplayerClient) + if (yharonFireballTimer <= splittingFireballBreathTimer2 && yharonFireballTimer % splittingFireballBreathDivisor == 0 && Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), position, NPC.velocity, type, damage, 0f, Main.myPlayer, 0f, 0f); } @@ -2363,8 +2363,8 @@ namespace CalamityMod.NPCs.Yharon Vector2 desiredVelocity2 = NPC.SafeDirectionTo(destination2) * velocity * 1.5f; NPC.SimpleFlyMovement(desiredVelocity2, acceleration * 1.5f); - int num35 = (NPC.Center.X < targetData.Center.X) ? 1 : -1; - NPC.direction = NPC.spriteDirection = num35; + int flareRingFaceDirection = (NPC.Center.X < targetData.Center.X) ? 1 : -1; + NPC.direction = NPC.spriteDirection = flareRingFaceDirection; NPC.ai[2] += 1f; if (NPC.Distance(targetData.Center) < 600f || NPC.ai[2] >= 180f) @@ -2525,8 +2525,8 @@ namespace CalamityMod.NPCs.Yharon } } - float num42 = NPC.AngleTo(targetData.Center); - float num43 = 0.04f; + float facingAngle = NPC.AngleTo(targetData.Center); + float rotationSpeed = 0.04f; switch ((int)NPC.ai[0]) { @@ -2534,54 +2534,54 @@ namespace CalamityMod.NPCs.Yharon case 7: case 8: case 9: - num43 = 0f; + rotationSpeed = 0f; break; case 3: if (NPC.ai[1] >= fireballBreathTimer) - num43 = 0f; + rotationSpeed = 0f; break; case 4: - num43 = 0.01f; - num42 = pie; + rotationSpeed = 0.01f; + facingAngle = pie; if (NPC.spriteDirection == 1) - num42 += pie; + facingAngle += pie; break; case 6: - num43 = 0.02f; - num42 = 0f; + rotationSpeed = 0.02f; + facingAngle = 0f; if (NPC.spriteDirection == -1) - num42 -= pie; + facingAngle -= pie; break; } if (NPC.spriteDirection == -1) - num42 += pie; + facingAngle += pie; - if (num43 != 0f) - NPC.rotation = NPC.rotation.AngleTowards(num42, num43); + if (rotationSpeed != 0f) + NPC.rotation = NPC.rotation.AngleTowards(facingAngle, rotationSpeed); } #endregion #region Charge Dust private void ChargeDust(int dustAmt, float pie) { - for (int num1474 = 0; num1474 < dustAmt; num1474++) + for (int i = 0; i < dustAmt; i++) { - Vector2 vector171 = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; - vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + NPC.Center; - Vector2 value18 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); - Main.dust[num1475].noGravity = true; - Main.dust[num1475].noLight = true; - Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= NPC.velocity; + Vector2 dustRotate = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; + dustRotate = dustRotate.RotatedBy((i - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + NPC.Center; + Vector2 dustVel = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int chargeDust = Dust.NewDust(dustRotate + dustVel, 0, 0, 244, dustVel.X * 2f, dustVel.Y * 2f, 100, default, 1.4f); + Main.dust[chargeDust].noGravity = true; + Main.dust[chargeDust].noLight = true; + Main.dust[chargeDust].velocity /= 4f; + Main.dust[chargeDust].velocity -= NPC.velocity; } } #endregion @@ -2615,8 +2615,8 @@ namespace CalamityMod.NPCs.Yharon for (int i = 0; i < totalProjectiles; i++) { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector2, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 2f, 0f); + Vector2 fireSpitFaceDirection = spinningPoint.RotatedBy(radians * i) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, fireSpitFaceDirection, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 2f, 0f); } float newRadialOffset = (int)aiVariableUsed / (timer / 4) % 2f == 0f ? radialOffset : -radialOffset; @@ -2639,8 +2639,8 @@ namespace CalamityMod.NPCs.Yharon float radians = MathHelper.TwoPi / totalProjectiles; for (int i = 0; i < totalProjectiles; i++) { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, ai0, ai1); + Vector2 flareRotationAmt = new Vector2(0f, -velocity).RotatedBy(radians * i); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, flareRotationAmt, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, ai0, ai1); Main.projectile[proj].timeLeft = timeLeft; } } @@ -2668,244 +2668,242 @@ namespace CalamityMod.NPCs.Yharon spriteEffects = ai2 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[NPC.type] / 2); Color color = drawColor; Color invincibleColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - Color color36 = Color.White; + Color lerpEndColor = Color.White; - float amount9 = 0f; + float lerpInterpolateValue = 0f; bool invincible = ai2 && invincibilityCounter < Phase2InvincibilityTime; - bool flag8 = NPC.ai[0] > 5f; - bool flag9 = NPC.ai[0] > 12f; - bool flag10 = startSecondAI; - int num150 = 120; - int num151 = 60; + bool enteredSubphase2 = NPC.ai[0] > 5f; + bool enteredSubphase3 = NPC.ai[0] > 12f; + bool enteredPhase2 = startSecondAI; + int afterimageTimer = 120; + int afterimageColorDivisor = 60; - if (flag10) + if (enteredPhase2) color = CalamityGlobalNPC.buffColor(color, 0.9f, 0.7f, 0.3f, 1f); - else if (flag9) + else if (enteredSubphase3) color = CalamityGlobalNPC.buffColor(color, 0.8f, 0.7f, 0.4f, 1f); - else if (flag8) + else if (enteredSubphase2) color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.5f, 1f); - else if (NPC.ai[0] == 4f && NPC.ai[2] > num150) + else if (NPC.ai[0] == 4f && NPC.ai[2] > afterimageTimer) { - float num152 = NPC.ai[2] - num150; - num152 /= num151; - color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * num152, 1f - 0.3f * num152, 1f - 0.5f * num152, 1f); + float buffColorMult = NPC.ai[2] - afterimageTimer; + buffColorMult /= afterimageColorDivisor; + color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * buffColorMult, 1f - 0.3f * buffColorMult, 1f - 0.5f * buffColorMult, 1f); } - int num153 = 10; - int num154 = 2; + int afterimageAmt = 10; + int afterimageIncrement = 2; if (NPC.ai[0] == -1f) - num153 = 0; + afterimageAmt = 0; if (idlePhases) - num153 = 7; + afterimageAmt = 7; if (invincible) - color36 = invincibleColor; + lerpEndColor = invincibleColor; else if (chargingOrSpawnPhases) { - color36 = Color.Red; - amount9 = 0.5f; + lerpEndColor = Color.Red; + lerpInterpolateValue = 0.5f; } else color = drawColor; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += num154) + for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { - Color color38 = color; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = color; + afterimageColor = Color.Lerp(afterimageColor, lerpEndColor, lerpInterpolateValue); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - int num156 = 0; - float num157 = 0f; - float scaleFactor9 = 0f; + int additionalAfterimageAmt = 0; + float additionalAfterimageOpacity = 0f; + float afterimageScale = 0f; if (NPC.ai[0] == -1f) - num156 = 0; + additionalAfterimageAmt = 0; if (tornadoPhase) { - int num158 = 60; - int num159 = 30; - if (NPC.ai[2] > num158) + if (NPC.ai[2] > 60) { - num156 = 6; - num157 = 1f - (float)Math.Cos((NPC.ai[2] - num158) / num159 * MathHelper.TwoPi); - num157 /= 3f; - scaleFactor9 = 40f; + additionalAfterimageAmt = 6; + additionalAfterimageOpacity = 1f - (float)Math.Cos((NPC.ai[2] - 60) / 30 * MathHelper.TwoPi); + additionalAfterimageOpacity /= 3f; + afterimageScale = 40f; } } - if (newPhasePhase && NPC.ai[2] > num150) + if (newPhasePhase && NPC.ai[2] > afterimageTimer) { - num156 = 6; - num157 = 1f - (float)Math.Cos((NPC.ai[2] - num150) / num151 * MathHelper.TwoPi); - num157 /= 3f; - scaleFactor9 = 60f; + additionalAfterimageAmt = 6; + additionalAfterimageOpacity = 1f - (float)Math.Cos((NPC.ai[2] - afterimageTimer) / afterimageColorDivisor * MathHelper.TwoPi); + additionalAfterimageOpacity /= 3f; + afterimageScale = 60f; } if (pauseAfterTeleportPhase) { - num156 = 6; - num157 = 1f - (float)Math.Cos(NPC.ai[2] / 30f * MathHelper.TwoPi); - num157 /= 3f; - scaleFactor9 = 20f; + additionalAfterimageAmt = 6; + additionalAfterimageOpacity = 1f - (float)Math.Cos(NPC.ai[2] / 30f * MathHelper.TwoPi); + additionalAfterimageOpacity /= 3f; + afterimageScale = 20f; } if (CalamityConfig.Instance.Afterimages) { - for (int num160 = 0; num160 < num156; num160++) + for (int k = 0; k < additionalAfterimageAmt; k++) { - Color color39 = drawColor; - color39 = Color.Lerp(color39, color36, amount9); - color39 = NPC.GetAlpha(color39); - color39 *= 1f - num157; - Vector2 vector42 = NPC.Center + (num160 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos; - vector42 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector42 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector42, NPC.frame, color39, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color additionalAfterimageColor = drawColor; + additionalAfterimageColor = Color.Lerp(additionalAfterimageColor, lerpEndColor, lerpInterpolateValue); + additionalAfterimageColor = NPC.GetAlpha(additionalAfterimageColor); + additionalAfterimageColor *= 1f - additionalAfterimageOpacity; + Vector2 additionalAfterimagePos = NPC.Center + (k / (float)additionalAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * additionalAfterimageOpacity - screenPos; + additionalAfterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + additionalAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, additionalAfterimagePos, NPC.frame, additionalAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector43, NPC.frame, invincible ? invincibleColor : NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, drawLocation, NPC.frame, invincible ? invincibleColor : NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - if (flag8 || NPC.ai[0] == 4f || startSecondAI) + if (enteredSubphase2 || NPC.ai[0] == 4f || startSecondAI) { texture = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowOrange").Value; - Color color40 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Orange, 0.5f) * NPC.Opacity; - color36 = invincible ? invincibleColor : Color.Orange; + Color orangeGlowColor = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Orange, 0.5f) * NPC.Opacity; + lerpEndColor = invincible ? invincibleColor : Color.Orange; Texture2D texture2 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowGreen").Value; - Color color43 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Chartreuse, 0.5f) * NPC.Opacity; - Color color44 = invincible ? invincibleColor : Color.Chartreuse; + Color greenGlowColorOpacity = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Chartreuse, 0.5f) * NPC.Opacity; + Color greenGlowColor = invincible ? invincibleColor : Color.Chartreuse; Texture2D texture3 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowPurple").Value; - Color color45 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.BlueViolet, 0.5f) * NPC.Opacity; - Color color46 = invincible ? invincibleColor : Color.BlueViolet; + Color blueGlowColorOpacity = Color.Lerp(Color.White, invincible ? invincibleColor : Color.BlueViolet, 0.5f) * NPC.Opacity; + Color blueGlowColor = invincible ? invincibleColor : Color.BlueViolet; - amount9 = 1f; - num157 = 0.5f; - scaleFactor9 = 10f; - num154 = 1; + lerpInterpolateValue = 1f; + additionalAfterimageOpacity = 0.5f; + afterimageScale = 10f; + afterimageIncrement = 1; if (newPhasePhase) { - float num161 = NPC.ai[2] - num150; - num161 /= num151; - color36 *= num161; - color40 *= num161; + float glowColorAmplifier = NPC.ai[2] - afterimageTimer; + glowColorAmplifier /= afterimageColorDivisor; + lerpEndColor *= glowColorAmplifier; + orangeGlowColor *= glowColorAmplifier; - if (flag9 || NPC.ai[0] == 10f || startSecondAI) + if (enteredSubphase3 || NPC.ai[0] == 10f || startSecondAI) { - color43 *= num161; - color44 *= num161; + greenGlowColorOpacity *= glowColorAmplifier; + greenGlowColor *= glowColorAmplifier; } - if (flag10 || NPC.ai[0] == 17f) + if (enteredPhase2 || NPC.ai[0] == 17f) { - color45 *= num161; - color46 *= num161; + blueGlowColorOpacity *= glowColorAmplifier; + blueGlowColor *= glowColorAmplifier; } } if (pauseAfterTeleportPhase) { - float num162 = NPC.ai[2]; - num162 /= 30f; + float teleportGlowColorScaler = NPC.ai[2]; + teleportGlowColorScaler /= 30f; - if (num162 > 0.5f) - num162 = 1f - num162; + if (teleportGlowColorScaler > 0.5f) + teleportGlowColorScaler = 1f - teleportGlowColorScaler; - num162 *= 2f; - num162 = 1f - num162; - color36 *= num162; - color40 *= num162; - color43 *= num162; - color44 *= num162; - color45 *= num162; - color46 *= num162; + teleportGlowColorScaler *= 2f; + teleportGlowColorScaler = 1f - teleportGlowColorScaler; + lerpEndColor *= teleportGlowColorScaler; + orangeGlowColor *= teleportGlowColorScaler; + greenGlowColorOpacity *= teleportGlowColorScaler; + greenGlowColor *= teleportGlowColorScaler; + blueGlowColorOpacity *= teleportGlowColorScaler; + blueGlowColor *= teleportGlowColorScaler; } if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163 += num154) + for (int l = 1; l < afterimageAmt; l += afterimageIncrement) { - Color color41 = color40; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color orangeAfterimageColor = orangeGlowColor; + orangeAfterimageColor = Color.Lerp(orangeAfterimageColor, lerpEndColor, lerpInterpolateValue); + orangeAfterimageColor *= (afterimageAmt - l) / 15f; + Vector2 glowmaskAfterimagePos = NPC.oldPos[l] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + glowmaskAfterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + glowmaskAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, glowmaskAfterimagePos, NPC.frame, orangeAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - if (flag9 || NPC.ai[0] == 10f || startSecondAI) + if (enteredSubphase3 || NPC.ai[0] == 10f || startSecondAI) { - Color color47 = color43; - color47 = Color.Lerp(color47, color44, amount9); - color47 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2, vector44, NPC.frame, color47, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color greenAfterimageColor = greenGlowColorOpacity; + greenAfterimageColor = Color.Lerp(greenAfterimageColor, greenGlowColor, lerpInterpolateValue); + greenAfterimageColor *= (afterimageAmt - l) / 15f; + spriteBatch.Draw(texture2, glowmaskAfterimagePos, NPC.frame, greenAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } - if (flag10 || NPC.ai[0] == 17f) + if (enteredPhase2 || NPC.ai[0] == 17f) { - Color color48 = color45; - color48 = Color.Lerp(color48, color46, amount9); - color48 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture3, vector44, NPC.frame, color48, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color blueAfterimageColor = blueGlowColorOpacity; + blueAfterimageColor = Color.Lerp(blueAfterimageColor, blueGlowColor, lerpInterpolateValue); + blueAfterimageColor *= (afterimageAmt - l) / 15f; + spriteBatch.Draw(texture3, glowmaskAfterimagePos, NPC.frame, blueAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - for (int num164 = 1; num164 < num156; num164++) + for (int m = 1; m < additionalAfterimageAmt; m++) { - Color color42 = color40; - color42 = Color.Lerp(color42, color36, amount9); - color42 = NPC.GetAlpha(color42); - color42 *= 1f - num157; - Vector2 vector45 = NPC.Center + (num164 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos; - vector45 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector45 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector45, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color additionalOrangeColor = orangeGlowColor; + additionalOrangeColor = Color.Lerp(additionalOrangeColor, lerpEndColor, lerpInterpolateValue); + additionalOrangeColor = NPC.GetAlpha(additionalOrangeColor); + additionalOrangeColor *= 1f - additionalAfterimageOpacity; + Vector2 additionalGlowmaskPos = NPC.Center + (m / (float)additionalAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * additionalAfterimageOpacity - screenPos; + additionalGlowmaskPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + additionalGlowmaskPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, additionalGlowmaskPos, NPC.frame, additionalOrangeColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - if (flag9 || NPC.ai[0] == 10f || startSecondAI) + if (enteredSubphase3 || NPC.ai[0] == 10f || startSecondAI) { - Color color49 = color43; - color49 = Color.Lerp(color49, color44, amount9); - color49 = NPC.GetAlpha(color49); - color49 *= 1f - num157; - spriteBatch.Draw(texture2, vector45, NPC.frame, color49, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color additionalGreenColor = greenGlowColorOpacity; + additionalGreenColor = Color.Lerp(additionalGreenColor, greenGlowColor, lerpInterpolateValue); + additionalGreenColor = NPC.GetAlpha(additionalGreenColor); + additionalGreenColor *= 1f - additionalAfterimageOpacity; + spriteBatch.Draw(texture2, additionalGlowmaskPos, NPC.frame, additionalGreenColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } - if (flag10 || NPC.ai[0] == 17f) + if (enteredPhase2 || NPC.ai[0] == 17f) { - Color color50 = color45; - color50 = Color.Lerp(color50, color46, amount9); - color50 = NPC.GetAlpha(color50); - color50 *= 1f - num157; - spriteBatch.Draw(texture3, vector45, NPC.frame, color50, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color additionalBlueColor = blueGlowColorOpacity; + additionalBlueColor = Color.Lerp(additionalBlueColor, blueGlowColor, lerpInterpolateValue); + additionalBlueColor = NPC.GetAlpha(additionalBlueColor); + additionalBlueColor *= 1f - additionalAfterimageOpacity; + spriteBatch.Draw(texture3, additionalGlowmaskPos, NPC.frame, additionalBlueColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } } - spriteBatch.Draw(texture, vector43, NPC.frame, color40, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, orangeGlowColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - if (flag9 || NPC.ai[0] == 10f || startSecondAI) - spriteBatch.Draw(texture2, vector43, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + if (enteredSubphase3 || NPC.ai[0] == 10f || startSecondAI) + spriteBatch.Draw(texture2, drawLocation, NPC.frame, greenGlowColorOpacity, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - if (flag10 || NPC.ai[0] == 17f) - spriteBatch.Draw(texture3, vector43, NPC.frame, color45, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + if (enteredPhase2 || NPC.ai[0] == 17f) + spriteBatch.Draw(texture3, drawLocation, NPC.frame, blueGlowColorOpacity, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } return false; @@ -3083,13 +3081,13 @@ namespace CalamityMod.NPCs.Yharon if (idlePhases) { - int num84 = 5; + int frameTimer = 5; if (!startSecondAI && (NPC.ai[0] == 6f || NPC.ai[0] == 13f)) { - num84 = 4; + frameTimer = 4; } NPC.frameCounter += 1D; - if (NPC.frameCounter > num84) + if (NPC.frameCounter > frameTimer) { NPC.frameCounter = 0D; NPC.frame.Y += frameHeight; @@ -3108,8 +3106,8 @@ namespace CalamityMod.NPCs.Yharon if (tornadoPhase) { - int num85 = 90; - if (NPC.ai[2] < num85 - 30 || NPC.ai[2] > num85 - 10) + int tornadoFrameTimer = 90; + if (NPC.ai[2] < tornadoFrameTimer - 30 || NPC.ai[2] > tornadoFrameTimer - 10) { NPC.frameCounter += 1D; if (NPC.frameCounter > 5D) @@ -3125,7 +3123,7 @@ namespace CalamityMod.NPCs.Yharon else { NPC.frame.Y = frameHeight * 5; - if (NPC.ai[2] > num85 - 20 && NPC.ai[2] < num85 - 15) + if (NPC.ai[2] > tornadoFrameTimer - 20 && NPC.ai[2] < tornadoFrameTimer - 15) { NPC.frame.Y = frameHeight * 6; } @@ -3134,8 +3132,8 @@ namespace CalamityMod.NPCs.Yharon if (newPhasePhase) { - int num86 = 180; - if (NPC.ai[2] < num86 - 60 || NPC.ai[2] > num86 - 20) + int newPhaseFrameTimer = 180; + if (NPC.ai[2] < newPhaseFrameTimer - 60 || NPC.ai[2] > newPhaseFrameTimer - 20) { NPC.frameCounter += 1D; if (NPC.frameCounter > 5D) @@ -3151,7 +3149,7 @@ namespace CalamityMod.NPCs.Yharon else { NPC.frame.Y = frameHeight * 5; - if (NPC.ai[2] > num86 - 50 && NPC.ai[2] < num86 - 25) + if (NPC.ai[2] > newPhaseFrameTimer - 50 && NPC.ai[2] < newPhaseFrameTimer - 25) { NPC.frame.Y = frameHeight * 6; } @@ -3183,23 +3181,23 @@ namespace CalamityMod.NPCs.Yharon NPC.height = 280; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int fieryDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[fieryDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[fieryDust].scale = 0.5f; + Main.dust[fieryDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fieryDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[fieryDust2].noGravity = true; + Main.dust[fieryDust2].velocity *= 5f; + fieryDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[fieryDust2].velocity *= 2f; } // Turn into dust on death. From 33247ba4f43eb8bc8382253a028a98079fa03154 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 24 Oct 2023 20:40:52 -0400 Subject: [PATCH 19/43] Brain, Cultist, Destroyer --- .../Bosses/BrainOfCthulhuAI.cs | 182 ++++--- NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs | 460 +++++++++--------- .../VanillaNPCOverrides/Bosses/DestroyerAI.cs | 297 ++++++----- 3 files changed, 468 insertions(+), 471 deletions(-) diff --git a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs index 00af992ebc..c0cd590fb0 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs @@ -47,16 +47,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.localAI[0] = 1f; int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountRevDeath(); - for (int num789 = 0; num789 < brainOfCthuluCreepersCount; num789++) + for (int i = 0; i < brainOfCthuluCreepersCount; i++) { - float num790 = npc.Center.X; - float num791 = npc.Center.Y; - num790 += Main.rand.Next(-npc.width, npc.width); - num791 += Main.rand.Next(-npc.height, npc.height); + float brainX = npc.Center.X; + float brainY = npc.Center.Y; + brainX += Main.rand.Next(-npc.width, npc.width); + brainY += Main.rand.Next(-npc.height, npc.height); - int num792 = NPC.NewNPC(npc.GetSource_FromAI(), (int)num790, (int)num791, NPCID.Creeper, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num792].velocity = new Vector2(Main.rand.Next(-30, 31) * 0.1f, Main.rand.Next(-30, 31) * 0.1f); - Main.npc[num792].netUpdate = true; + int creeperSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)brainX, (int)brainY, NPCID.Creeper, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[creeperSpawn].velocity = new Vector2(Main.rand.Next(-30, 31) * 0.1f, Main.rand.Next(-30, 31) * 0.1f); + Main.npc[creeperSpawn].netUpdate = true; } } @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 395, 1f); } - for (int num794 = 0; num794 < 20; num794++) + for (int j = 0; j < 20; j++) Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); SoundEngine.PlaySound(SoundID.Roar, npc.position); @@ -129,21 +129,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[0] != -6f) { // Rubber band movement - Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); - float num795 = Main.player[npc.target].Center.X - vector98.X; - float num796 = Main.player[npc.target].Center.Y - vector98.Y; - float num797 = (float)Math.Sqrt(num795 * num795 + num796 * num796); + Vector2 brainCenter = new Vector2(npc.Center.X, npc.Center.Y); + float targetXDist = Main.player[npc.target].Center.X - brainCenter.X; + float targetYDist = Main.player[npc.target].Center.Y - brainCenter.Y; + float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); float velocityScale = death ? 4f : 2f; float velocityBoost = velocityScale * (1f - lifeRatio); - float num798 = 8f + velocityBoost + 3f * enrageScale; + float nonChargeSpeed = 8f + velocityBoost + 3f * enrageScale; if (Main.getGoodWorld) - num798 *= 1.15f; + nonChargeSpeed *= 1.15f; - num797 = num798 / num797; - num795 *= num797; - num796 *= num797; - npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; + targetDistance = nonChargeSpeed / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + npc.velocity.X = (npc.velocity.X * 50f + targetXDist) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + targetYDist) / 51f; } // Charge, -6 @@ -216,8 +216,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Velocity - int var = 120; - float velocity = MathHelper.TwoPi / (var * 0.75f); + float velocity = MathHelper.TwoPi / (120 * 0.75f); npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.ai[1]); npc.ai[2] += 1f; @@ -284,19 +283,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.justHit) npc.localAI[1] -= Main.rand.Next(random); - float num799 = 60f; - if (npc.localAI[1] >= num799) + if (npc.localAI[1] >= 60f) { npc.localAI[1] = 0f; npc.TargetClosest(); - int num800 = 0; - int num801; - int num802; + int numTeleportTries = 0; + int teleportTileX; + int teleportTileY; while (true) { - num800++; - num801 = (int)Main.player[npc.target].Center.X / 16; - num802 = (int)Main.player[npc.target].Center.Y / 16; + numTeleportTries++; + teleportTileX = (int)Main.player[npc.target].Center.X / 16; + teleportTileY = (int)Main.player[npc.target].Center.Y / 16; int min = 14; int max = 17; @@ -305,25 +303,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses max += teleportDistanceIncrease; if (Main.rand.NextBool()) - num801 += Main.rand.Next(min, max); + teleportTileX += Main.rand.Next(min, max); else - num801 -= Main.rand.Next(min, max); + teleportTileX -= Main.rand.Next(min, max); if (Main.rand.NextBool()) - num802 += Main.rand.Next(min, max); + teleportTileY += Main.rand.Next(min, max); else - num802 -= Main.rand.Next(min, max); + teleportTileY -= Main.rand.Next(min, max); - if (!WorldGen.SolidTile(num801, num802)) + if (!WorldGen.SolidTile(teleportTileX, teleportTileY)) break; - if (num800 > 100) + if (numTeleportTries > 100) goto Block_2784; } npc.ai[3] = 0f; npc.ai[0] = npc.ai[0] == -7f ? -8f : -2f; - npc.ai[1] = num801; - npc.ai[2] = num802; + npc.ai[1] = teleportTileX; + npc.ai[2] = teleportTileY; npc.netUpdate = true; npc.netSpam = 0; Block_2784: @@ -423,24 +421,24 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Move towards target - Vector2 vector99 = new Vector2(npc.Center.X, npc.Center.Y); - float num803 = Main.player[npc.target].Center.X - vector99.X; - float num804 = Main.player[npc.target].Center.Y - vector99.Y; - float num805 = (float)Math.Sqrt(num803 * num803 + num804 * num804); - float num806 = (death ? 2f : 1f) + (creeperScale * 0.1f); + Vector2 brainCenterPhase1 = new Vector2(npc.Center.X, npc.Center.Y); + float targetXDistPhase1 = Main.player[npc.target].Center.X - brainCenterPhase1.X; + float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y; + float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1); + float maxMoveVelocity = (death ? 2f : 1f) + (creeperScale * 0.1f); if (Main.getGoodWorld) - num806 *= 2f; + maxMoveVelocity *= 2f; - if (num805 < num806) + if (targetDistancePhase1 < maxMoveVelocity) { - npc.velocity.X = num803; - npc.velocity.Y = num804; + npc.velocity.X = targetXDistPhase1; + npc.velocity.Y = targetYDistPhase1; } else { - num805 = num806 / num805; - npc.velocity.X = num803 * num805; - npc.velocity.Y = num804 * num805; + targetDistancePhase1 = maxMoveVelocity / targetDistancePhase1; + npc.velocity.X = targetXDistPhase1 * targetDistancePhase1; + npc.velocity.Y = targetYDistPhase1 * targetDistancePhase1; } // Pick a teleport location @@ -454,40 +452,40 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.localAI[1] = 0f; npc.TargetClosest(); - int num809 = 0; - int num810; - int num811; + int phase1TeleportTries = 0; + int phase1TeleportTileX; + int phase1TeleportTileY; while (true) { - num809++; - num810 = (int)Main.player[npc.target].Center.X / 16; - num811 = (int)Main.player[npc.target].Center.Y / 16; + phase1TeleportTries++; + phase1TeleportTileX = (int)Main.player[npc.target].Center.X / 16; + phase1TeleportTileY = (int)Main.player[npc.target].Center.Y / 16; int min = 18 + teleportDistanceIncrease; int max = 26 + teleportDistanceIncrease; if (Main.rand.NextBool()) - num810 += Main.rand.Next(min, max); + phase1TeleportTileX += Main.rand.Next(min, max); else - num810 -= Main.rand.Next(min, max); + phase1TeleportTileX -= Main.rand.Next(min, max); if (Main.rand.NextBool()) - num811 += Main.rand.Next(min, max); + phase1TeleportTileY += Main.rand.Next(min, max); else - num811 -= Main.rand.Next(min, max); + phase1TeleportTileY -= Main.rand.Next(min, max); - if (!WorldGen.SolidTile(num810, num811) && Collision.CanHit(new Vector2(num810 * 16, num811 * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (!WorldGen.SolidTile(phase1TeleportTileX, phase1TeleportTileY) && Collision.CanHit(new Vector2(phase1TeleportTileX * 16, phase1TeleportTileY * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { break; } - if (num809 > 100) + if (phase1TeleportTries > 100) { goto Block_2801; } } npc.ai[0] = 1f; - npc.ai[1] = num810; - npc.ai[2] = num811; + npc.ai[1] = phase1TeleportTileX; + npc.ai[2] = phase1TeleportTileY; npc.netUpdate = true; Block_2801: ; @@ -575,21 +573,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Stay near Brain if (npc.ai[0] == 0f) { - Vector2 vector100 = new Vector2(npc.Center.X, npc.Center.Y); - float num812 = Main.npc[NPC.crimsonBoss].Center.X - vector100.X; - float num813 = Main.npc[NPC.crimsonBoss].Center.Y - vector100.Y; - float num814 = (float)Math.Sqrt(num812 * num812 + num813 * num813); + Vector2 creeperCenter = new Vector2(npc.Center.X, npc.Center.Y); + float brainXDist = Main.npc[NPC.crimsonBoss].Center.X - creeperCenter.X; + float brainYDist = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenter.Y; + float brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); float velocity = death ? 10f : 7f; velocity += 4f * enrageScale; // Max distance from Brain - if (num814 > 90f) + if (brainDistance > 90f) { - num814 = velocity / num814; - num812 *= num814; - num813 *= num814; - npc.velocity.X = (npc.velocity.X * 15f + num812) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num813) / 16f; + brainDistance = velocity / brainDistance; + brainXDist *= brainDistance; + brainYDist *= brainDistance; + npc.velocity.X = (npc.velocity.X * 15f + brainXDist) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + brainYDist) / 16f; return false; } @@ -607,13 +605,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.ai[1] = 0f; npc.TargetClosest(); - vector100 = new Vector2(npc.Center.X, npc.Center.Y); - num812 = Main.player[npc.target].Center.X - vector100.X; - num813 = Main.player[npc.target].Center.Y - vector100.Y; - num814 = (float)Math.Sqrt(num812 * num812 + num813 * num813); - num814 = velocity / num814; - npc.velocity.X = num812 * num814; - npc.velocity.Y = num813 * num814; + creeperCenter = new Vector2(npc.Center.X, npc.Center.Y); + brainXDist = Main.player[npc.target].Center.X - creeperCenter.X; + brainYDist = Main.player[npc.target].Center.Y - creeperCenter.Y; + brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); + brainDistance = velocity / brainDistance; + npc.velocity.X = brainXDist * brainDistance; + npc.velocity.Y = brainYDist * brainDistance; npc.ai[0] = 1f; npc.netUpdate = true; } @@ -624,26 +622,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { float chargeVelocity = death ? 10f : 7f; chargeVelocity += 4f * enrageScale; - Vector2 value2 = Main.player[npc.target].Center - npc.Center; - value2.Normalize(); + Vector2 targetDirection = Main.player[npc.target].Center - npc.Center; + targetDirection.Normalize(); if (Main.getGoodWorld) { - value2 *= 12f; - npc.velocity = (npc.velocity * 49f + value2) / 50f; + targetDirection *= 12f; + npc.velocity = (npc.velocity * 49f + targetDirection) / 50f; } else { - value2 *= chargeVelocity; - npc.velocity = (npc.velocity * 99f + value2) / 100f; + targetDirection *= chargeVelocity; + npc.velocity = (npc.velocity * 99f + targetDirection) / 100f; } - Vector2 vector101 = new Vector2(npc.Center.X, npc.Center.Y); - float num815 = Main.npc[NPC.crimsonBoss].Center.X - vector101.X; - float num816 = Main.npc[NPC.crimsonBoss].Center.Y - vector101.Y; - float num817 = (float)Math.Sqrt(num815 * num815 + num816 * num816); + Vector2 creeperCenterCharge = new Vector2(npc.Center.X, npc.Center.Y); + float brainXDistCharge = Main.npc[NPC.crimsonBoss].Center.X - creeperCenterCharge.X; + float brainYDistCharge = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenterCharge.Y; + float brainDistanceCharge = (float)Math.Sqrt(brainXDistCharge * brainXDistCharge + brainYDistCharge * brainYDistCharge); // Return to Brain - if (num817 > 700f || npc.justHit) + if (brainDistanceCharge > 700f || npc.justHit) npc.ai[0] = 0f; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs index b58ab7914f..c174ecf722 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs @@ -240,9 +240,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[2] = 10f; - int num14 = Math.Sign(player.Center.X - npc.Center.X); - if (num14 != 0) - npc.direction = npc.spriteDirection = num14; + int facePlayerDirection = Math.Sign(player.Center.X - npc.Center.X); + if (facePlayerDirection != 0) + npc.direction = npc.spriteDirection = facePlayerDirection; npc.ai[1] += 1f; if (npc.ai[1] >= idleTime & isCultist) @@ -315,13 +315,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Movement case 0: // Set a location to move to - float num16 = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - npc.Center).Length() / 50f); - if (num16 == 0f) - num16 = 1f; + float teleportLocation = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - npc.Center).Length() / 50f); + if (teleportLocation == 0f) + teleportLocation = 1f; // Add self and clones to list List list2 = new List(); - int num17 = 0; + int cloneAmt = 0; list2.Add(npc.whoAmI); for (int k = 0; k < Main.maxNPCs; k++) { @@ -330,31 +330,31 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Move self and clones to location - bool flag5 = list2.Count % 2 == 0; + bool cloneAmtIsEven = list2.Count % 2 == 0; foreach (int current2 in list2) { NPC nPC2 = Main.npc[current2]; Vector2 center2 = nPC2.Center; - float num18 = (num17 + flag5.ToInt() + 1) / 2 * MathHelper.TwoPi * 0.4f / list2.Count; - if (num17 % 2 == 1) + float cloneOffset = (cloneAmt + cloneAmtIsEven.ToInt() + 1) / 2 * MathHelper.TwoPi * 0.4f / list2.Count; + if (cloneAmt % 2 == 1) { - num18 *= -1f; + cloneOffset *= -1f; } if (list2.Count == 1) { - num18 = 0f; + cloneOffset = 0f; } - Vector2 value = new Vector2(0f, -1f).RotatedBy(num18) * new Vector2(150f, 200f); - Vector2 value2 = player.Center + value - center2; + Vector2 cloneRotation = new Vector2(0f, -1f).RotatedBy(cloneOffset) * new Vector2(150f, 200f); + Vector2 finalClonePos = player.Center + cloneRotation - center2; nPC2.ai[0] = 1f; - nPC2.ai[1] = num16; - nPC2.velocity = value2 / num16 * 2f; + nPC2.ai[1] = teleportLocation; + nPC2.velocity = finalClonePos / teleportLocation * 2f; if (npc.whoAmI >= nPC2.whoAmI) { nPC2.position -= nPC2.velocity; } nPC2.netUpdate = true; - num17++; + cloneAmt++; } break; @@ -448,18 +448,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses NPC nPC3 = Main.npc[current3]; Vector2 center3 = nPC3.Center; - int num19 = Math.Sign(player.Center.X - center3.X); - if (num19 != 0) - nPC3.direction = nPC3.spriteDirection = num19; + int cloneFacePlayerDirection = Math.Sign(player.Center.X - center3.X); + if (cloneFacePlayerDirection != 0) + nPC3.direction = nPC3.spriteDirection = cloneFacePlayerDirection; vec = Vector2.Normalize(player.Center - center3); if (vec.HasNaNs()) vec = new Vector2(npc.direction, 0f); - Vector2 vector = center3 + new Vector2(npc.direction * 30, 12f); - Vector2 vector2 = vec * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - vector2 = vector2.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector, vector2, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); + Vector2 shadowFireballDirection = center3 + new Vector2(npc.direction * 30, 12f); + Vector2 shadowFireballVelocity = vec * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); + shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(0.52359879016876221); + Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } } @@ -469,9 +469,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (vec.HasNaNs()) vec = new Vector2(npc.direction, 0f); - Vector2 vector3 = npc.Center + new Vector2(npc.direction * 30, 12f); - Vector2 vector4 = vec * iceMistSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector3, vector4, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f); + Vector2 iceMistDirection = npc.Center + new Vector2(npc.direction * 30, 12f); + Vector2 iceMistVelocity = vec * iceMistSpeed; + Projectile.NewProjectile(npc.GetSource_FromAI(), iceMistDirection, iceMistVelocity, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f); } } @@ -491,19 +491,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.localAI[2] = 11f; - Vector2 vec2 = Vector2.Normalize(player.Center - npc.Center); - if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); + Vector2 playerDirection = Vector2.Normalize(player.Center - npc.Center); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % fireballFireRate == 0) { if ((int)(npc.ai[1] - 4f) / fireballFireRate == 2) { List list4 = new List(); - for (int num20 = 0; num20 < Main.maxNPCs; num20++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num20].active && Main.npc[num20].type == NPCID.CultistBossClone && Main.npc[num20].ai[3] == npc.whoAmI) - list4.Add(num20); + if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == npc.whoAmI) + list4.Add(i); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -513,36 +513,36 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses NPC nPC4 = Main.npc[current4]; Vector2 center4 = nPC4.Center; - int num21 = Math.Sign(player.Center.X - center4.X); - if (num21 != 0) - nPC4.direction = nPC4.spriteDirection = num21; + int cloneFireballFaceDirection = Math.Sign(player.Center.X - center4.X); + if (cloneFireballFaceDirection != 0) + nPC4.direction = nPC4.spriteDirection = cloneFireballFaceDirection; - vec2 = Vector2.Normalize(player.Center - center4); - if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); + playerDirection = Vector2.Normalize(player.Center - center4); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); - Vector2 vector5 = center4 + new Vector2(npc.direction * 30, 12f); - Vector2 vector6 = vec2 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - vector6 = vector6.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector5, vector6, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); + Vector2 shadowFireballDirection = center4 + new Vector2(npc.direction * 30, 12f); + Vector2 shadowFireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); + shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(0.52359879016876221); + Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } } } - int num23 = Math.Sign(player.Center.X - npc.Center.X); - if (num23 != 0) - npc.direction = npc.spriteDirection = num23; + int cultistFireballFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (cultistFireballFaceDirection != 0) + npc.direction = npc.spriteDirection = cultistFireballFaceDirection; if (Main.netMode != NetmodeID.MultiplayerClient) { - vec2 = Vector2.Normalize(player.Center - npc.Center); - if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); + playerDirection = Vector2.Normalize(player.Center - npc.Center); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); - Vector2 vector7 = npc.Center + new Vector2(npc.direction * 30, 12f); - Vector2 vector8 = vec2 * (fireballSpeed + (float)Main.rand.NextDouble() * 4f); - vector8 = vector8.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector7, vector8, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer); + Vector2 fireballDirection = npc.Center + new Vector2(npc.direction * 30, 12f); + Vector2 fireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 4f); + fireballVelocity = fireballVelocity.RotatedByRandom(0.52359879016876221); + Projectile.NewProjectile(npc.GetSource_FromAI(), fireballDirection, fireballVelocity, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer); } } @@ -568,10 +568,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if ((npc.ai[1] == 20f & isCultist) && Main.netMode != NetmodeID.MultiplayerClient) { List list5 = new List(); - for (int num25 = 0; num25 < Main.maxNPCs; num25++) + for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[num25].active && Main.npc[num25].type == NPCID.CultistBossClone && Main.npc[num25].ai[3] == npc.whoAmI) - list5.Add(num25); + if (Main.npc[j].active && Main.npc[j].type == NPCID.CultistBossClone && Main.npc[j].ai[3] == npc.whoAmI) + list5.Add(j); } foreach (int current5 in list5) @@ -579,18 +579,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses NPC nPC5 = Main.npc[current5]; Vector2 center5 = nPC5.Center; - int num26 = Math.Sign(player.Center.X - center5.X); - if (num26 != 0) - nPC5.direction = nPC5.spriteDirection = num26; + int clonePlayerFaceDirection = Math.Sign(player.Center.X - center5.X); + if (clonePlayerFaceDirection != 0) + nPC5.direction = nPC5.spriteDirection = clonePlayerFaceDirection; - Vector2 vec3 = Vector2.Normalize(player.Center - center5); - if (vec3.HasNaNs()) - vec3 = new Vector2(npc.direction, 0f); + Vector2 playerDirection = Vector2.Normalize(player.Center - center5); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); - Vector2 vector9 = center5 + new Vector2(npc.direction * 30, 12f); - Vector2 vector10 = vec3 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - vector10 = vector10.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector9.X, vector9.Y, vector10.X, vector10.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); + Vector2 shadowFireballDirection = center5 + new Vector2(npc.direction * 30, 12f); + Vector2 shadowFireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); + shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(0.52359879016876221); + Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection.X, shadowFireballDirection.Y, shadowFireballVelocity.X, shadowFireballVelocity.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y - 100f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); @@ -618,8 +618,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] >= 0f && npc.ai[1] < 30f) { dontTakeDamage = true; - float num28 = (npc.ai[1] - 0f) / 30f; - npc.alpha = (int)(num28 * 255f); + float cultistAlphaControl = (npc.ai[1] - 0f) / 30f; + npc.alpha = (int)(cultistAlphaControl * 255f); } else if (npc.ai[1] >= 30f && npc.ai[1] < 90f) { @@ -630,57 +630,57 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 spinningpoint = new Vector2(180f, 0f); List list6 = new List(); - for (int num29 = 0; num29 < Main.maxNPCs; num29++) + for (int k = 0; k < Main.maxNPCs; k++) { - if (Main.npc[num29].active && Main.npc[num29].type == NPCID.CultistBossClone && Main.npc[num29].ai[3] == npc.whoAmI) - list6.Add(num29); + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) + list6.Add(k); } - int num30 = 6 - list6.Count; - if (num30 > 2) - num30 = 2; + int potentialExtraClones = 6 - list6.Count; + if (potentialExtraClones > 2) + potentialExtraClones = 2; - int num31 = list6.Count + num30 + 1; - float[] array = new float[num31]; - for (int num32 = 0; num32 < array.Length; num32++) - array[num32] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy(num32 * MathHelper.TwoPi / num31 - MathHelper.PiOver2), player.Center); + int newCloneAmt = list6.Count + potentialExtraClones + 1; + float[] array = new float[newCloneAmt]; + for (int cloneInc = 0; cloneInc < array.Length; cloneInc++) + array[cloneInc] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy(cloneInc * MathHelper.TwoPi / newCloneAmt - MathHelper.PiOver2), player.Center); - int num33 = 0; - for (int num34 = 1; num34 < array.Length; num34++) + int rotateDistance = 0; + for (int j = 1; j < array.Length; j++) { - if (array[num33] > array[num34]) - num33 = num34; + if (array[rotateDistance] > array[j]) + rotateDistance = j; } - if (num33 < num31 / 2) - num33 += num31 / 2; + if (rotateDistance < newCloneAmt / 2) + rotateDistance += newCloneAmt / 2; else - num33 -= num31 / 2; + rotateDistance -= newCloneAmt / 2; - int num35 = num30; - for (int num36 = 0; num36 < array.Length; num36++) + int clonesToSpawn = potentialExtraClones; + for (int k = 0; k < array.Length; k++) { - if (num33 != num36) + if (rotateDistance != k) { - Vector2 vector11 = npc.Center + spinningpoint.RotatedBy(num36 * MathHelper.TwoPi / num31 - MathHelper.PiOver2); - if (num35-- > 0) + Vector2 cloneRotation = npc.Center + spinningpoint.RotatedBy(k * MathHelper.TwoPi / newCloneAmt - MathHelper.PiOver2); + if (clonesToSpawn-- > 0) { - int num37 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector11.X, (int)vector11.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI); - Main.npc[num37].ai[3] = npc.whoAmI; - Main.npc[num37].netUpdate = true; - Main.npc[num37].localAI[1] = npc.localAI[1]; + int cloneSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)cloneRotation.X, (int)cloneRotation.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI); + Main.npc[cloneSpawn].ai[3] = npc.whoAmI; + Main.npc[cloneSpawn].netUpdate = true; + Main.npc[cloneSpawn].localAI[1] = npc.localAI[1]; } else { - int num38 = list6[-num35 - 1]; - Main.npc[num38].Center = vector11; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num38, 0f, 0f, 0f, 0, 0, 0); + int currentClone = list6[-clonesToSpawn - 1]; + Main.npc[currentClone].Center = cloneRotation; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, currentClone, 0f, 0f, 0f, 0, 0, 0); } } } npc.ai[2] = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - npc.Center += spinningpoint.RotatedBy(num33 * MathHelper.TwoPi / num31 - MathHelper.PiOver2); + npc.Center += spinningpoint.RotatedBy(rotateDistance * MathHelper.TwoPi / newCloneAmt - MathHelper.PiOver2); npc.netUpdate = true; list6.Clear(); } @@ -690,50 +690,50 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (isCultist) { - Vector2 vector12 = Main.projectile[(int)npc.ai[2]].Center; - vector12 -= npc.Center; - if (vector12 == Vector2.Zero) - vector12 = -Vector2.UnitY; + Vector2 ritualCenterDirection = Main.projectile[(int)npc.ai[2]].Center; + ritualCenterDirection -= npc.Center; + if (ritualCenterDirection == Vector2.Zero) + ritualCenterDirection = -Vector2.UnitY; - vector12.Normalize(); + ritualCenterDirection.Normalize(); - if (Math.Abs(vector12.Y) < 0.77f) + if (Math.Abs(ritualCenterDirection.Y) < 0.77f) npc.localAI[2] = 11f; - else if (vector12.Y < 0f) + else if (ritualCenterDirection.Y < 0f) npc.localAI[2] = 12f; else npc.localAI[2] = 10f; - int num39 = Math.Sign(vector12.X); - if (num39 != 0) - npc.direction = npc.spriteDirection = num39; + int ritualFaceDirection = Math.Sign(ritualCenterDirection.X); + if (ritualFaceDirection != 0) + npc.direction = npc.spriteDirection = ritualFaceDirection; } else { - Vector2 vector13 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - vector13 -= npc.Center; - if (vector13 == Vector2.Zero) - vector13 = -Vector2.UnitY; + Vector2 ritualCenterFailDirection = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + ritualCenterFailDirection -= npc.Center; + if (ritualCenterFailDirection == Vector2.Zero) + ritualCenterFailDirection = -Vector2.UnitY; - vector13.Normalize(); + ritualCenterFailDirection.Normalize(); - if (Math.Abs(vector13.Y) < 0.77f) + if (Math.Abs(ritualCenterFailDirection.Y) < 0.77f) npc.localAI[2] = 11f; - else if (vector13.Y < 0f) + else if (ritualCenterFailDirection.Y < 0f) npc.localAI[2] = 12f; else npc.localAI[2] = 10f; - int num40 = Math.Sign(vector13.X); - if (num40 != 0) - npc.direction = npc.spriteDirection = num40; + int ritualFailFaceDirection = Math.Sign(ritualCenterFailDirection.X); + if (ritualFailFaceDirection != 0) + npc.direction = npc.spriteDirection = ritualFailFaceDirection; } } else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) { dontTakeDamage = true; - float num41 = (npc.ai[1] - 90f) / 30f; - npc.alpha = 255 - (int)(num41 * 255f); + float ritualAlphaControl = (npc.ai[1] - 90f) / 30f; + npc.alpha = 255 - (int)(ritualAlphaControl * 255f); } else if (npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual) { @@ -741,43 +741,43 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (isCultist) { - Vector2 vector14 = Main.projectile[(int)npc.ai[2]].Center; - vector14 -= npc.Center; - if (vector14 == Vector2.Zero) - vector14 = -Vector2.UnitY; + Vector2 ritualTimeAlmostUpCenterDirection = Main.projectile[(int)npc.ai[2]].Center; + ritualTimeAlmostUpCenterDirection -= npc.Center; + if (ritualTimeAlmostUpCenterDirection == Vector2.Zero) + ritualTimeAlmostUpCenterDirection = -Vector2.UnitY; - vector14.Normalize(); + ritualTimeAlmostUpCenterDirection.Normalize(); - if (Math.Abs(vector14.Y) < 0.77f) + if (Math.Abs(ritualTimeAlmostUpCenterDirection.Y) < 0.77f) npc.localAI[2] = 11f; - else if (vector14.Y < 0f) + else if (ritualTimeAlmostUpCenterDirection.Y < 0f) npc.localAI[2] = 12f; else npc.localAI[2] = 10f; - int num42 = Math.Sign(vector14.X); - if (num42 != 0) - npc.direction = npc.spriteDirection = num42; + int ritualTimeAlmostUpFaceDirection = Math.Sign(ritualTimeAlmostUpCenterDirection.X); + if (ritualTimeAlmostUpFaceDirection != 0) + npc.direction = npc.spriteDirection = ritualTimeAlmostUpFaceDirection; } else { - Vector2 vector15 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - vector15 -= npc.Center; - if (vector15 == Vector2.Zero) - vector15 = -Vector2.UnitY; + Vector2 ritualTimeUpCenterDirection = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + ritualTimeUpCenterDirection -= npc.Center; + if (ritualTimeUpCenterDirection == Vector2.Zero) + ritualTimeUpCenterDirection = -Vector2.UnitY; - vector15.Normalize(); + ritualTimeUpCenterDirection.Normalize(); - if (Math.Abs(vector15.Y) < 0.77f) + if (Math.Abs(ritualTimeUpCenterDirection.Y) < 0.77f) npc.localAI[2] = 11f; - else if (vector15.Y < 0f) + else if (ritualTimeUpCenterDirection.Y < 0f) npc.localAI[2] = 12f; else npc.localAI[2] = 10f; - int num43 = Math.Sign(vector15.X); - if (num43 != 0) - npc.direction = npc.spriteDirection = num43; + int ritualTimeUpFaceDirection = Math.Sign(ritualTimeUpCenterDirection.X); + if (ritualTimeUpFaceDirection != 0) + npc.direction = npc.spriteDirection = ritualTimeUpFaceDirection; } } @@ -813,19 +813,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.localAI[2] = 11f; - Vector2 vec4 = Vector2.Normalize(player.Center - npc.Center); - if (vec4.HasNaNs()) - vec4 = new Vector2(npc.direction, 0f); + Vector2 playerDirection = Vector2.Normalize(player.Center - npc.Center); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % ancientLightSpawnRate == 0) { if ((int)(npc.ai[1] - 4f) / ancientLightSpawnRate == 2) { List list7 = new List(); - for (int num44 = 0; num44 < Main.maxNPCs; num44++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num44].active && Main.npc[num44].type == NPCID.CultistBossClone && Main.npc[num44].ai[3] == npc.whoAmI) - list7.Add(num44); + if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == npc.whoAmI) + list7.Add(i); } foreach (int current6 in list7) @@ -833,36 +833,36 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses NPC nPC6 = Main.npc[current6]; Vector2 center6 = nPC6.Center; - int num45 = Math.Sign(player.Center.X - center6.X); - if (num45 != 0) - nPC6.direction = nPC6.spriteDirection = num45; + int cloneFaceDirection = Math.Sign(player.Center.X - center6.X); + if (cloneFaceDirection != 0) + nPC6.direction = nPC6.spriteDirection = cloneFaceDirection; } } - int num47 = Math.Sign(player.Center.X - npc.Center.X); - if (num47 != 0) - npc.direction = npc.spriteDirection = num47; + int cultistFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (cultistFaceDirection != 0) + npc.direction = npc.spriteDirection = cultistFaceDirection; if (Main.netMode != NetmodeID.MultiplayerClient) { - vec4 = Vector2.Normalize(player.Center - npc.Center); - if (vec4.HasNaNs()) - vec4 = new Vector2(npc.direction, 0f); + playerDirection = Vector2.Normalize(player.Center - npc.Center); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); - Vector2 vector18 = npc.Center + new Vector2(npc.direction * 30, 12f); + Vector2 ancientLightShootDirection = npc.Center + new Vector2(npc.direction * 30, 12f); float scaleFactor = death ? 6f : 4f; - float num48 = MathHelper.ToRadians(15f); - int num49 = 0; + float ancientLightSpread = MathHelper.ToRadians(15f); + int ancientLightInc = 0; float totalAncientLights = 5f; - while (num49 < totalAncientLights) + while (ancientLightInc < totalAncientLights) { - Vector2 vector19 = vec4 * scaleFactor; - vector19 = vector19.RotatedBy(num48 * num49 - (MathHelper.Pi / totalAncientLights * 2f - num48) / 2f); + Vector2 ancientLightSpeed = playerDirection * scaleFactor; + ancientLightSpeed = ancientLightSpeed.RotatedBy(ancientLightSpread * ancientLightInc - (MathHelper.Pi / totalAncientLights * 2f - ancientLightSpread) / 2f); float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; - int num50 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector18.X, (int)vector18.Y + 7, NPCID.AncientLight, 0, 0f, ai, vector19.X, vector19.Y, 255); - Main.npc[num50].velocity = vector19; - num49++; + int ancientLightProj = NPC.NewNPC(npc.GetSource_FromAI(), (int)ancientLightShootDirection.X, (int)ancientLightShootDirection.Y + 7, NPCID.AncientLight, 0, 0f, ai, ancientLightSpeed.X, ancientLightSpeed.Y, 255); + Main.npc[ancientLightProj].velocity = ancientLightSpeed; + ancientLightInc++; } } } @@ -886,19 +886,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % 20f == 0f) { List list8 = new List(); - for (int num51 = 0; num51 < Main.maxNPCs; num51++) + for (int k = 0; k < Main.maxNPCs; k++) { - if (Main.npc[num51].active && Main.npc[num51].type == NPCID.CultistBossClone && Main.npc[num51].ai[3] == npc.whoAmI) - list8.Add(num51); + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) + list8.Add(k); } - int num52 = list8.Count + 1; - if (num52 > 2) - num52 = 2; + int ancientDoomAmt = list8.Count + 1; + if (ancientDoomAmt > 2) + ancientDoomAmt = 2; - int num53 = Math.Sign(player.Center.X - npc.Center.X); - if (num53 != 0) - npc.direction = npc.spriteDirection = num53; + int ancientDoomFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (ancientDoomFaceDirection != 0) + npc.direction = npc.spriteDirection = ancientDoomFaceDirection; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -915,32 +915,32 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else { // Spawn Ancient Dooms randomly around the target - for (int num54 = 0; num54 < num52; num54++) + for (int i = 0; i < ancientDoomAmt; i++) { - Point point = npc.Center.ToTileCoordinates(); - Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector20 = Main.player[npc.target].Center - npc.Center; + Point cultistCenterTileCoords = npc.Center.ToTileCoordinates(); + Point targetCenterTileCoords = Main.player[npc.target].Center.ToTileCoordinates(); + Vector2 targetDistanceDoom = Main.player[npc.target].Center - npc.Center; - int num55 = 20; - int num56 = 3; - int num57 = 7; - int num58 = 2; - int num59 = 0; - bool flag6 = vector20.Length() > 2800f; - while (!flag6 && num59 < 100) + int randSpawnOffset = 20; + int cultistCenterSpawnOffset = 3; + int targetCenterSpawnOffset = 7; + int tileCollisionRange = 2; + int spawnAttempts = 0; + bool doomSufficientlyFar = targetDistanceDoom.Length() > 2800f; + while (!doomSufficientlyFar && spawnAttempts < 100) { - num59++; - int num60 = Main.rand.Next(point2.X - num55, point2.X + num55 + 1); - int num61 = Main.rand.Next(point2.Y - num55, point2.Y + num55 + 1); - if ((num61 < point2.Y - num57 || num61 > point2.Y + num57 || num60 < point2.X - num57 || num60 > point2.X + num57) && (num61 < point.Y - num56 || num61 > point.Y + num56 || num60 < point.X - num56 || num60 > point.X + num56) && !Main.tile[num60, num61].HasUnactuatedTile) + spawnAttempts++; + int ancientDoomSpawnX = Main.rand.Next(targetCenterTileCoords.X - randSpawnOffset, targetCenterTileCoords.X + randSpawnOffset + 1); + int ancientDoomSpawnY = Main.rand.Next(targetCenterTileCoords.Y - randSpawnOffset, targetCenterTileCoords.Y + randSpawnOffset + 1); + if ((ancientDoomSpawnY < targetCenterTileCoords.Y - targetCenterSpawnOffset || ancientDoomSpawnY > targetCenterTileCoords.Y + targetCenterSpawnOffset || ancientDoomSpawnX < targetCenterTileCoords.X - targetCenterSpawnOffset || ancientDoomSpawnX > targetCenterTileCoords.X + targetCenterSpawnOffset) && (ancientDoomSpawnY < cultistCenterTileCoords.Y - cultistCenterSpawnOffset || ancientDoomSpawnY > cultistCenterTileCoords.Y + cultistCenterSpawnOffset || ancientDoomSpawnX < cultistCenterTileCoords.X - cultistCenterSpawnOffset || ancientDoomSpawnX > cultistCenterTileCoords.X + cultistCenterSpawnOffset) && !Main.tile[ancientDoomSpawnX, ancientDoomSpawnY].HasUnactuatedTile) { - bool flag7 = true; - if (flag7 && Collision.SolidTiles(num60 - num58, num60 + num58, num61 - num58, num61 + num58)) - flag7 = false; + bool notInsideTiles = true; + if (notInsideTiles && Collision.SolidTiles(ancientDoomSpawnX - tileCollisionRange, ancientDoomSpawnX + tileCollisionRange, ancientDoomSpawnY - tileCollisionRange, ancientDoomSpawnY + tileCollisionRange)) + notInsideTiles = false; - if (flag7) + if (notInsideTiles) { - NPC.NewNPC(npc.GetSource_FromAI(), num60 * 16 + 8, num61 * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); + NPC.NewNPC(npc.GetSource_FromAI(), ancientDoomSpawnX * 16 + 8, ancientDoomSpawnY * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); break; } } @@ -1009,35 +1009,35 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[0] = 1f; npc.velocity.X = npc.ai[2]; npc.velocity.Y = npc.ai[3]; - for (int num1492 = 0; num1492 < 13; num1492++) + for (int i = 0; i < 13; i++) { - int num1493 = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); - Main.dust[num1493].noGravity = true; - Main.dust[num1493].fadeIn = 1f; - Dust dust = Main.dust[num1493]; + int ancientLight = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); + Main.dust[ancientLight].noGravity = true; + Main.dust[ancientLight].fadeIn = 1f; + Dust dust = Main.dust[ancientLight]; dust.velocity *= 4f; - Main.dust[num1493].noLight = true; + Main.dust[ancientLight].noLight = true; } } // Spawn dust - for (int num1494 = 0; num1494 < 2; num1494++) + for (int j = 0; j < 2; j++) { if (Main.rand.Next(10 - (int)Math.Min(7f, npc.velocity.Length())) < 1) { - int num1495 = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); - Main.dust[num1495].noGravity = true; - Dust dust = Main.dust[num1495]; + int ancientLight2 = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); + Main.dust[ancientLight2].noGravity = true; + Dust dust = Main.dust[ancientLight2]; dust.velocity *= 0.2f; - Main.dust[num1495].fadeIn = 0.4f; + Main.dust[ancientLight2].fadeIn = 0.4f; if (Main.rand.NextBool(6)) { - dust = Main.dust[num1495]; + dust = Main.dust[ancientLight2]; dust.velocity *= 5f; - Main.dust[num1495].noLight = true; + Main.dust[ancientLight2].noLight = true; } else - Main.dust[num1495].velocity = npc.DirectionFrom(Main.dust[num1495].position) * Main.dust[num1495].velocity.Length(); + Main.dust[ancientLight2].velocity = npc.DirectionFrom(Main.dust[ancientLight2].position) * Main.dust[ancientLight2].velocity.Length(); } } @@ -1142,33 +1142,33 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.rand.NextBool(6)) { - Vector2 spinningpoint4 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust17 = Main.dust[Dust.NewDust(npc.Center - spinningpoint4 * 20f, 0, 0, 27, 0f, 0f, 0, default, 1f)]; - dust17.noGravity = true; - dust17.position = npc.Center - spinningpoint4 * Main.rand.Next(10, 21) * npc.scale; - dust17.velocity = spinningpoint4.RotatedBy(MathHelper.PiOver2) * 4f; - dust17.scale = 0.5f + Main.rand.NextFloat(); - dust17.fadeIn = 0.5f; + Vector2 shadowflameDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust shadowflameDust = Main.dust[Dust.NewDust(npc.Center - shadowflameDustRotate * 20f, 0, 0, 27, 0f, 0f, 0, default, 1f)]; + shadowflameDust.noGravity = true; + shadowflameDust.position = npc.Center - shadowflameDustRotate * Main.rand.Next(10, 21) * npc.scale; + shadowflameDust.velocity = shadowflameDustRotate.RotatedBy(MathHelper.PiOver2) * 4f; + shadowflameDust.scale = 0.5f + Main.rand.NextFloat(); + shadowflameDust.fadeIn = 0.5f; } if (Main.rand.NextBool(6)) { - Vector2 spinningpoint5 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust18 = Main.dust[Dust.NewDust(npc.Center - spinningpoint5 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; - dust18.noGravity = true; - dust18.position = npc.Center - spinningpoint5 * 20f * npc.scale; - dust18.velocity = spinningpoint5.RotatedBy(-MathHelper.PiOver2) * 2f; - dust18.scale = 0.5f + Main.rand.NextFloat(); - dust18.fadeIn = 0.5f; + Vector2 darkDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust darkDust = Main.dust[Dust.NewDust(npc.Center - darkDustRotate * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; + darkDust.noGravity = true; + darkDust.position = npc.Center - darkDustRotate * 20f * npc.scale; + darkDust.velocity = darkDustRotate.RotatedBy(-MathHelper.PiOver2) * 2f; + darkDust.scale = 0.5f + Main.rand.NextFloat(); + darkDust.fadeIn = 0.5f; } if (Main.rand.NextBool(6)) { - Vector2 vector254 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust19 = Main.dust[Dust.NewDust(npc.Center - vector254 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; - dust19.position = npc.Center - vector254 * 20f * npc.scale; - dust19.velocity = Vector2.Zero; - dust19.scale = 0.5f + Main.rand.NextFloat(); - dust19.fadeIn = 0.5f; - dust19.noLight = true; + Vector2 darkDustRotate2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust darkDust2 = Main.dust[Dust.NewDust(npc.Center - darkDustRotate2 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; + darkDust2.position = npc.Center - darkDustRotate2 * 20f * npc.scale; + darkDust2.velocity = Vector2.Zero; + darkDust2.scale = 0.5f + Main.rand.NextFloat(); + darkDust2.fadeIn = 0.5f; + darkDust2.noLight = true; } npc.localAI[0] += 0.05235988f; @@ -1192,8 +1192,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, vector255, type, damage, 0f, Main.myPlayer); + Vector2 doomProjRotate = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, doomProjRotate, type, damage, 0f, Main.myPlayer); } } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs index e8b1f4f4cf..c357eceaa0 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs @@ -290,36 +290,36 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + npc.height) / 16f) + 2; + int tilePosX = (int)(npc.position.X / 16f) - 1; + int tileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; + int tilePosY = (int)(npc.position.Y / 16f) - 1; + int tileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; - if (num12 < 0) - num12 = 0; - if (num13 > Main.maxTilesX) - num13 = Main.maxTilesX; - if (num14 < 0) - num14 = 0; - if (num15 > Main.maxTilesY) - num15 = Main.maxTilesY; + if (tilePosX < 0) + tilePosX = 0; + if (tileWidthPosX > Main.maxTilesX) + tileWidthPosX = Main.maxTilesX; + if (tilePosY < 0) + tilePosY = 0; + if (tileWidthPosY > Main.maxTilesY) + tileWidthPosY = Main.maxTilesY; // Fly or not - bool flag2 = flyAtTarget; - if (!flag2) + bool shouldFly = flyAtTarget; + if (!shouldFly) { - for (int k = num12; k < num13; k++) + for (int k = tilePosX; k < tileWidthPosX; k++) { - for (int l = num14; l < num15; l++) + for (int l = tilePosY; l < tileWidthPosY; l++) { if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) { - Vector2 vector2; - vector2.X = k * 16; - vector2.Y = l * 16; - if (npc.position.X + npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + Vector2 tileConvertedPosition; + tileConvertedPosition.X = k * 16; + tileConvertedPosition.Y = l * 16; + if (npc.position.X + npc.width > tileConvertedPosition.X && npc.position.X < tileConvertedPosition.X + 16f && npc.position.Y + npc.height > tileConvertedPosition.Y && npc.position.Y < tileConvertedPosition.Y + 16f) { - flag2 = true; + shouldFly = true; break; } } @@ -328,17 +328,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Start flying if target is not within a certain distance - if (!flag2) + if (!shouldFly) { npc.localAI[1] = 1f; if (npc.type == NPCID.TheDestroyer) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num16 = 1000; + int noFlyZone = 1000; int heightReduction = death ? 400 : (int)(400f * (1f - lifeRatio)); int height = 1800 - heightReduction; - bool flag3 = true; + bool outsideNoFlyZone = true; if (npc.position.Y > player.position.Y) { @@ -346,16 +346,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (Main.player[m].active) { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, height); - if (rectangle.Intersects(rectangle2)) + Rectangle noFlyRectangle = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height); + if (rectangle.Intersects(noFlyRectangle)) { - flag3 = false; + outsideNoFlyZone = false; break; } } } - if (flag3) - flag2 = true; + if (outsideNoFlyZone) + shouldFly = true; } } } @@ -366,7 +366,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float fallSpeed = 16f; if (player.dead) { - flag2 = false; + shouldFly = false; npc.velocity.Y += 2f; if (npc.position.Y > Main.worldSurface * 16.0) @@ -412,25 +412,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses turnSpeed *= 1.2f; } - Vector2 vector3 = npc.Center; - float num20 = player.position.X + (player.width / 2); - float num21 = player.position.Y + (player.height / 2); - num20 = (int)(num20 / 16f) * 16; - num21 = (int)(num21 / 16f) * 16; - vector3.X = (int)(vector3.X / 16f) * 16; - vector3.Y = (int)(vector3.Y / 16f) * 16; - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); + Vector2 npcCenter = npc.Center; + float targetTilePosX = player.position.X + (player.width / 2); + float targetTilePosY = player.position.Y + (player.height / 2); + targetTilePosX = (int)(targetTilePosX / 16f) * 16; + targetTilePosY = (int)(targetTilePosY / 16f) * 16; + npcCenter.X = (int)(npcCenter.X / 16f) * 16; + npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; + targetTilePosX -= npcCenter.X; + targetTilePosY -= npcCenter.Y; + float targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { - int num23 = (int)(44f * npc.scale); + int mechdusaSegmentScale = (int)(44f * npc.scale); try { - vector3 = npc.Center; - num20 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; + npcCenter = npc.Center; + targetTilePosX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - npcCenter.X; + targetTilePosY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - npcCenter.Y; } catch { @@ -438,31 +438,31 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (mechdusaCurvedSpineSegmentIndex > 0) { - float num25 = (float)num23 - (float)num23 * (((float)mechdusaCurvedSpineSegmentIndex - 1f) * 0.1f); - if (num25 < 0f) - num25 = 0f; + float absoluteTilePosX = (float)mechdusaSegmentScale - (float)mechdusaSegmentScale * (((float)mechdusaCurvedSpineSegmentIndex - 1f) * 0.1f); + if (absoluteTilePosX < 0f) + absoluteTilePosX = 0f; - if (num25 > (float)num23) - num25 = num23; + if (absoluteTilePosX > (float)mechdusaSegmentScale) + absoluteTilePosX = mechdusaSegmentScale; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) + num25 - vector3.Y; + targetTilePosY = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) + absoluteTilePosX - npcCenter.Y; } - npc.rotation = (float)Math.Atan2(num21, num20) + MathHelper.PiOver2; - num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); + npc.rotation = (float)Math.Atan2(targetTilePosY, targetTilePosX) + MathHelper.PiOver2; + targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); if (mechdusaCurvedSpineSegmentIndex > 0) - num23 = num23 / mechdusaCurvedSpineSegments * mechdusaCurvedSpineSegmentIndex; + mechdusaSegmentScale = mechdusaSegmentScale / mechdusaCurvedSpineSegments * mechdusaCurvedSpineSegmentIndex; - num22 = (num22 - num23) / num22; - num20 *= num22; - num21 *= num22; + targetTileDist = (targetTileDist - mechdusaSegmentScale) / targetTileDist; + targetTilePosX *= targetTileDist; + targetTilePosY *= targetTileDist; npc.velocity = Vector2.Zero; - npc.position.X += num20; - npc.position.Y += num21; + npc.position.X += targetTilePosX; + npc.position.Y += targetTilePosY; } else { - if (!flag2) + if (!shouldFly) { npc.velocity.Y += 0.15f; if (npc.velocity.Y > fallSpeed) @@ -477,9 +477,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.velocity.Y == fallSpeed) { - if (npc.velocity.X < num20) + if (npc.velocity.X < targetTilePosX) npc.velocity.X += speed; - else if (npc.velocity.X > num20) + else if (npc.velocity.X > targetTilePosX) npc.velocity.X -= speed; } else if (npc.velocity.Y > 4f) @@ -494,29 +494,29 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.soundDelay == 0) { - float num24 = num22 / 40f; - if (num24 < 10f) - num24 = 10f; - if (num24 > 20f) - num24 = 20f; + float soundDelay = targetTileDist / 40f; + if (soundDelay < 10f) + soundDelay = 10f; + if (soundDelay > 20f) + soundDelay = 20f; - npc.soundDelay = (int)num24; + npc.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, npc.position); } - num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = fallSpeed / num22; - num20 *= num27; - num21 *= num27; + targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); + float absoluteTilePosX = Math.Abs(targetTilePosX); + float absoluteTilePosY = Math.Abs(targetTilePosY); + float tileToReachTarget = fallSpeed / targetTileDist; + targetTilePosX *= tileToReachTarget; + targetTilePosY *= tileToReachTarget; - bool flag6 = false; + bool flyWyvernMovement = false; if (flyAtTarget) { - if (((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f) || (npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && num22 < 400f) + if (((npc.velocity.X > 0f && targetTilePosX < 0f) || (npc.velocity.X < 0f && targetTilePosX > 0f) || (npc.velocity.Y > 0f && targetTilePosY < 0f) || (npc.velocity.Y < 0f && targetTilePosY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && targetTileDist < 400f) { - flag6 = true; + flyWyvernMovement = true; if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < fallSpeed) npc.velocity *= 1.1f; @@ -524,7 +524,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.Y > player.position.Y) { - flag6 = true; + flyWyvernMovement = true; if (Math.Abs(npc.velocity.X) < fallSpeed / 2f) { @@ -538,42 +538,42 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - if (!flag6) + if (!flyWyvernMovement) { if (!flyAtTarget) { - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + if (((npc.velocity.X > 0f && targetTilePosX > 0f) || (npc.velocity.X < 0f && targetTilePosX < 0f)) && ((npc.velocity.Y > 0f && targetTilePosY > 0f) || (npc.velocity.Y < 0f && targetTilePosY < 0f))) { - if (npc.velocity.X < num20) + if (npc.velocity.X < targetTilePosX) npc.velocity.X += turnSpeed; - else if (npc.velocity.X > num20) + else if (npc.velocity.X > targetTilePosX) npc.velocity.X -= turnSpeed; - if (npc.velocity.Y < num21) + if (npc.velocity.Y < targetTilePosY) npc.velocity.Y += turnSpeed; - else if (npc.velocity.Y > num21) + else if (npc.velocity.Y > targetTilePosY) npc.velocity.Y -= turnSpeed; } } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + if ((npc.velocity.X > 0f && targetTilePosX > 0f) || (npc.velocity.X < 0f && targetTilePosX < 0f) || (npc.velocity.Y > 0f && targetTilePosY > 0f) || (npc.velocity.Y < 0f && targetTilePosY < 0f)) { - if (npc.velocity.X < num20) + if (npc.velocity.X < targetTilePosX) npc.velocity.X += speed; - else if (npc.velocity.X > num20) + else if (npc.velocity.X > targetTilePosX) npc.velocity.X -= speed; - if (npc.velocity.Y < num21) + if (npc.velocity.Y < targetTilePosY) npc.velocity.Y += speed; - else if (npc.velocity.Y > num21) + else if (npc.velocity.Y > targetTilePosY) npc.velocity.Y -= speed; - if (Math.Abs(num21) < fallSpeed * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + if (Math.Abs(targetTilePosY) < fallSpeed * 0.2 && ((npc.velocity.X > 0f && targetTilePosX < 0f) || (npc.velocity.X < 0f && targetTilePosX > 0f))) { if (npc.velocity.Y > 0f) npc.velocity.Y += speed * 2f; else npc.velocity.Y -= speed * 2f; } - if (Math.Abs(num20) < fallSpeed * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + if (Math.Abs(targetTilePosX) < fallSpeed * 0.2 && ((npc.velocity.Y > 0f && targetTilePosY < 0f) || (npc.velocity.Y < 0f && targetTilePosY > 0f))) { if (npc.velocity.X > 0f) npc.velocity.X += speed * 2f; @@ -581,11 +581,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.X -= speed * 2f; } } - else if (num25 > num26) + else if (absoluteTilePosX > absoluteTilePosY) { - if (npc.velocity.X < num20) + if (npc.velocity.X < targetTilePosX) npc.velocity.X += speed * 1.1f; - else if (npc.velocity.X > num20) + else if (npc.velocity.X > targetTilePosX) npc.velocity.X -= speed * 1.1f; if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) @@ -598,9 +598,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { - if (npc.velocity.Y < num21) + if (npc.velocity.Y < targetTilePosY) npc.velocity.Y += speed * 1.1f; - else if (npc.velocity.Y > num21) + else if (npc.velocity.Y > targetTilePosY) npc.velocity.Y -= speed * 1.1f; if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) @@ -618,7 +618,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.type == NPCID.TheDestroyer) { - if (flag2) + if (shouldFly) { if (npc.localAI[0] != 1f) npc.netUpdate = true; @@ -642,14 +642,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { NPC nPC = Main.npc[NPC.mechQueen]; Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); - Vector2 vector4 = new Vector2(0f, 100f); - Vector2 spinningpoint = mechQueenCenter + vector4; - float num30 = nPC.velocity.X * 0.025f; - spinningpoint = spinningpoint.RotatedBy(num30, mechQueenCenter); + Vector2 mechdusaSpinningVector = new Vector2(0f, 100f); + Vector2 spinningpoint = mechQueenCenter + mechdusaSpinningVector; + float mechdusaRotation = nPC.velocity.X * 0.025f; + spinningpoint = spinningpoint.RotatedBy(mechdusaRotation, mechQueenCenter); npc.position = spinningpoint - npc.Size / 2f + nPC.velocity; npc.velocity.X = 0f; npc.velocity.Y = 0f; - npc.rotation = num30 * 0.75f + (float)Math.PI; + npc.rotation = mechdusaRotation * 0.75f + (float)Math.PI; } return false; @@ -671,16 +671,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float velocity = bossRush ? 8f : 6f; float acceleration = bossRush ? 0.1f : 0.05f; - Vector2 vector = npc.Center; - float num4 = targetData.Center.X; - float num5 = targetData.Center.Y; - num4 = (int)(num4 / 8f) * 8; - num5 = (int)(num5 / 8f) * 8; - vector.X = (int)(vector.X / 8f) * 8; - vector.Y = (int)(vector.Y / 8f) * 8; - num4 -= vector.X; - num5 -= vector.Y; - float distanceFromTarget = (float)Math.Sqrt(num4 * num4 + num5 * num5); + Vector2 probeCenter = npc.Center; + float probeTargetX = targetData.Center.X; + float probeTargetY = targetData.Center.Y; + probeTargetX = (int)(probeTargetX / 8f) * 8; + probeTargetY = (int)(probeTargetY / 8f) * 8; + probeCenter.X = (int)(probeCenter.X / 8f) * 8; + probeCenter.Y = (int)(probeCenter.Y / 8f) * 8; + probeTargetX -= probeCenter.X; + probeTargetY -= probeCenter.Y; + float distanceFromTarget = (float)Math.Sqrt(probeTargetX * probeTargetX + probeTargetY * probeTargetY); float distance2 = distanceFromTarget; bool farAwayFromTarget = false; @@ -689,27 +689,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (distanceFromTarget == 0f) { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; + probeTargetX = npc.velocity.X; + probeTargetY = npc.velocity.Y; } else { distanceFromTarget = velocity / distanceFromTarget; - num4 *= distanceFromTarget; - num5 *= distanceFromTarget; + probeTargetX *= distanceFromTarget; + probeTargetY *= distanceFromTarget; } for (int i = 0; i < Main.maxNPCs; i++) { if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) { - Vector2 value42 = Main.npc[i].Center - npc.Center; - if (value42.Length() < (npc.width + npc.height)) + Vector2 otherProbeDist = Main.npc[i].Center - npc.Center; + if (otherProbeDist.Length() < (npc.width + npc.height)) { - value42.SafeNormalize(Vector2.UnitY); - value42 *= -0.1f; - npc.velocity += value42; - Main.npc[i].velocity -= value42; + otherProbeDist.SafeNormalize(Vector2.UnitY); + otherProbeDist *= -0.1f; + npc.velocity += otherProbeDist; + Main.npc[i].velocity -= otherProbeDist; } } } @@ -733,8 +733,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (targetDead) { - num4 = npc.direction * velocity / 2f; - num5 = -velocity / 2f; + probeTargetX = npc.direction * velocity / 2f; + probeTargetY = -velocity / 2f; } if (npc.ai[3] != 0f) @@ -742,18 +742,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (NPC.IsMechQueenUp) { NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 vector2 = new Vector2(26f * npc.ai[3], 0f); - int num9 = (int)npc.ai[2]; - if (num9 < 0 || num9 >= Main.maxNPCs) + Vector2 tileConvertedPosition = new Vector2(26f * npc.ai[3], 0f); + int mechdusaProbe = (int)npc.ai[2]; + if (mechdusaProbe < 0 || mechdusaProbe >= Main.maxNPCs) { - num9 = NPC.FindFirstNPC(NPCID.TheDestroyer); - npc.ai[2] = num9; + mechdusaProbe = NPC.FindFirstNPC(NPCID.TheDestroyer); + npc.ai[2] = mechdusaProbe; npc.netUpdate = true; } - if (num9 > -1) + if (mechdusaProbe > -1) { - NPC nPC2 = Main.npc[num9]; + NPC nPC2 = Main.npc[mechdusaProbe]; if (!nPC2.active || nPC2.type != NPCID.TheDestroyer) { npc.dontTakeDamage = false; @@ -764,7 +764,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { - Vector2 spinningpoint = nPC2.Center + vector2; + Vector2 spinningpoint = nPC2.Center + tileConvertedPosition; spinningpoint = spinningpoint.RotatedBy(nPC2.rotation, nPC2.Center); npc.Center = spinningpoint; npc.velocity = nPC.velocity; @@ -793,14 +793,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.dontTakeDamage = false; - if (npc.velocity.X < num4) + if (npc.velocity.X < probeTargetX) npc.velocity.X += acceleration; - else if (npc.velocity.X > num4) + else if (npc.velocity.X > probeTargetX) npc.velocity.X -= acceleration; - if (npc.velocity.Y < num5) + if (npc.velocity.Y < probeTargetY) npc.velocity.Y += acceleration; - else if (npc.velocity.Y > num5) + else if (npc.velocity.Y > probeTargetY) npc.velocity.Y -= acceleration; } @@ -817,12 +817,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int type = ProjectileID.PinkLaser; int damage = npc.GetProjectileDamage(type); int totalProjectiles = (CalamityWorld.death || bossRush) ? 3 : 1; - Vector2 vector3 = new Vector2(num4, num5); + Vector2 npcCenter = new Vector2(probeTargetX, probeTargetY); if (NPC.IsMechQueenUp) { Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; float projectileVelocity = 8f; - vector3 = v.SafeNormalize(Vector2.UnitY) * projectileVelocity; + npcCenter = v.SafeNormalize(Vector2.UnitY) * projectileVelocity; } for (int i = 0; i < totalProjectiles; i++) { @@ -838,29 +838,29 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses velocityMultiplier = 0.8f; break; } - Projectile.NewProjectile(npc.GetSource_FromAI(), vector, vector3 * velocityMultiplier, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), probeCenter, npcCenter * velocityMultiplier, type, damage, 0f, Main.myPlayer); } npc.netUpdate = true; } } - if (num4 > 0f) + if (probeTargetX > 0f) { npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(num5, num4); + npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX); } - if (num4 < 0f) + if (probeTargetX < 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(num5, num4) + MathHelper.Pi; + npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX) + MathHelper.Pi; } - float num12 = -0.7f; + float tilePosX = -0.7f; if (npc.collideX) { npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * num12; + npc.velocity.X = npc.oldVelocity.X * tilePosX; if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) npc.velocity.X = 2f; if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) @@ -870,7 +870,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.collideY) { npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * num12; + npc.velocity.Y = npc.oldVelocity.Y * tilePosX; if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5) npc.velocity.Y = 2f; if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5) @@ -879,7 +879,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (farAwayFromTarget) { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + if ((npc.velocity.X > 0f && probeTargetX > 0f) || (npc.velocity.X < 0f && probeTargetX < 0f)) { if (Math.Abs(npc.velocity.X) < (NPC.IsMechQueenUp ? 5f : 12f)) npc.velocity.X *= 1.05f; @@ -892,9 +892,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Vector2 center = npc.GetTargetData().Center; Vector2 v2 = center - npc.Center; - int num28 = 120; - if (v2.Length() < (float)num28) - npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * num28; + if (v2.Length() < 120f) + npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * 120; } if (targetDead) From a8080e10dac6d6833546b6882293a476191f346e Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 25 Oct 2023 12:02:38 -0400 Subject: [PATCH 20/43] Dread, Duke Fishron, EoW, Empress --- .../Bosses/DreadnautilusAI.cs | 168 ++--- .../Bosses/DukeFishronAI.cs | 238 +++---- .../Bosses/EaterOfWorldsAI.cs | 270 ++++---- .../Bosses/EmpressofLightAI.cs | 594 +++++++++--------- 4 files changed, 632 insertions(+), 638 deletions(-) diff --git a/NPCs/VanillaNPCOverrides/Bosses/DreadnautilusAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DreadnautilusAI.cs index 902e3d8937..e7b1f039f3 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DreadnautilusAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DreadnautilusAI.cs @@ -79,25 +79,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case -1: { npc.velocity *= 0.98f; - int num15 = Math.Sign(nPCAimedTarget.Center.X - npc.Center.X); - if (num15 != 0) + int spawnFaceDirection = Math.Sign(nPCAimedTarget.Center.X - npc.Center.X); + if (spawnFaceDirection != 0) { - npc.direction = num15; + npc.direction = spawnFaceDirection; npc.spriteDirection = -npc.direction; } if (npc.localAI[1] == 0f && npc.alpha < 100) { npc.localAI[1] = 1f; - int num16 = 36; - for (int l = 0; l < num16; l++) + int dustAmt = 36; + for (int l = 0; l < dustAmt; l++) { npc.position += npc.netOffset; - Vector2 value3 = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((l - (num16 / 2 - 1)) * ((float)Math.PI * 2f) / num16) + npc.Center; - Vector2 value4 = value3 - npc.Center; - int num17 = Dust.NewDust(value3 + value4, 0, 0, 5, value4.X * 2f, value4.Y * 2f, 100, default, 1.4f); - Main.dust[num17].noGravity = true; - Main.dust[num17].velocity = Vector2.Normalize(value4) * 3f; + Vector2 dustRotation = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((l - (dustAmt / 2 - 1)) * ((float)Math.PI * 2f) / dustAmt) + npc.Center; + Vector2 dustVelocity = dustRotation - npc.Center; + int spawnDustBlood = Dust.NewDust(dustRotation + dustVelocity, 0, 0, 5, dustVelocity.X * 2f, dustVelocity.Y * 2f, 100, default, 1.4f); + Main.dust[spawnDustBlood].noGravity = true; + Main.dust[spawnDustBlood].velocity = Vector2.Normalize(dustVelocity) * 3f; npc.position -= npc.netOffset; } } @@ -141,27 +141,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } npc.direction = (npc.Center.X < nPCAimedTarget.Center.X) ? 1 : (-1); - float num13 = npc.Center.DirectionTo(nPCAimedTarget.Center).ToRotation() - 213f / 452f * npc.spriteDirection; + float faceTargetDirection = npc.Center.DirectionTo(nPCAimedTarget.Center).ToRotation() - 213f / 452f * npc.spriteDirection; if (npc.spriteDirection == -1) - num13 += (float)Math.PI; + faceTargetDirection += (float)Math.PI; if (npc.spriteDirection != npc.direction) { npc.spriteDirection = npc.direction; npc.rotation = 0f - npc.rotation; - num13 = 0f - num13; + faceTargetDirection = 0f - faceTargetDirection; } - npc.rotation = npc.rotation.AngleTowards(num13, 0.02f); + npc.rotation = npc.rotation.AngleTowards(faceTargetDirection, 0.02f); npc.ai[1] += 1f; if (npc.ai[1] > phaseSwitchPhaseTime) { - int num14 = (int)npc.ai[3]; - if (num14 % 7 == 3 && NPC.CountNPCS(NPCID.BloodSquid) < maxBloodSquids) + int attackPicker = (int)npc.ai[3]; + if (attackPicker % 7 == 3 && NPC.CountNPCS(NPCID.BloodSquid) < maxBloodSquids) { attackType = 3; } - else if (num14 % 2 == 0) + else if (attackPicker % 2 == 0) { SoundEngine.PlaySound(SoundID.Item170, npc.Center); attackType = 2; @@ -180,16 +180,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case 1: { npc.direction = (!(npc.Center.X < nPCAimedTarget.Center.X)) ? 1 : (-1); - float num18 = npc.Center.DirectionFrom(nPCAimedTarget.Center).ToRotation() - 213f / 452f * npc.spriteDirection; + float chargeFaceDirection = npc.Center.DirectionFrom(nPCAimedTarget.Center).ToRotation() - 213f / 452f * npc.spriteDirection; if (npc.spriteDirection == -1) - num18 += (float)Math.PI; + chargeFaceDirection += (float)Math.PI; - bool flag2 = npc.ai[1] < dashChargeUpPhaseTime; - if (npc.spriteDirection != npc.direction && flag2) + bool shouldStartCharge = npc.ai[1] < dashChargeUpPhaseTime; + if (npc.spriteDirection != npc.direction && shouldStartCharge) { npc.spriteDirection = npc.direction; npc.rotation = 0f - npc.rotation; - num18 = 0f - num18; + chargeFaceDirection = 0f - chargeFaceDirection; } if (npc.ai[1] < dashChargeUpPhaseTime) @@ -198,23 +198,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.Item172, npc.Center); npc.velocity *= 0.95f; - npc.rotation = npc.rotation.AngleLerp(num18, 0.02f); + npc.rotation = npc.rotation.AngleLerp(chargeFaceDirection, 0.02f); npc.position += npc.netOffset; npc.BloodNautilus_GetMouthPositionAndRotation(out Vector2 mouthPosition4, out Vector2 mouthDirection4); - Dust dust6 = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 60f - new Vector2(40f), 80, 80, 16, 0f, 0f, 150, Color.Transparent, 0.6f); - dust6.fadeIn = 1f; - dust6.velocity = dust6.position.DirectionTo(mouthPosition4 + Main.rand.NextVector2Circular(15f, 15f)) * dust6.velocity.Length(); - dust6.noGravity = true; - dust6 = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 100f - new Vector2(30f), 60, 60, 16, 0f, 0f, 100, Color.Transparent, 0.9f); - dust6.fadeIn = 1.5f; - dust6.velocity = dust6.position.DirectionTo(mouthPosition4 + Main.rand.NextVector2Circular(15f, 15f)) * (dust6.velocity.Length() + 5f); - dust6.noGravity = true; + Dust chargeUpDust = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 60f - new Vector2(40f), 80, 80, 16, 0f, 0f, 150, Color.Transparent, 0.6f); + chargeUpDust.fadeIn = 1f; + chargeUpDust.velocity = chargeUpDust.position.DirectionTo(mouthPosition4 + Main.rand.NextVector2Circular(15f, 15f)) * chargeUpDust.velocity.Length(); + chargeUpDust.noGravity = true; + chargeUpDust = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 100f - new Vector2(30f), 60, 60, 16, 0f, 0f, 100, Color.Transparent, 0.9f); + chargeUpDust.fadeIn = 1.5f; + chargeUpDust.velocity = chargeUpDust.position.DirectionTo(mouthPosition4 + Main.rand.NextVector2Circular(15f, 15f)) * (chargeUpDust.velocity.Length() + 5f); + chargeUpDust.noGravity = true; npc.position -= npc.netOffset; } else if (npc.ai[1] < dashChargeUpPhaseTime + dashPhaseTime) { npc.position += npc.netOffset; - npc.rotation = npc.rotation.AngleLerp(num18, 0.07f); + npc.rotation = npc.rotation.AngleLerp(chargeFaceDirection, 0.07f); npc.BloodNautilus_GetMouthPositionAndRotation(out Vector2 mouthPosition5, out Vector2 mouthDirection5); // Dash directly towards the target until within 15 tiles of the target, and then continue in the same direction for 18 frames (15 frames in Death Mode) @@ -228,12 +228,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int m = 0; m < 4; m++) { - Dust dust7 = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 60f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f); - dust7.velocity = dust7.position.DirectionFrom(mouthPosition5 + Main.rand.NextVector2Circular(5f, 5f)) * dust7.velocity.Length(); - dust7.position -= mouthDirection5 * 60f; - dust7 = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 100f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f); - dust7.velocity = dust7.position.DirectionFrom(mouthPosition5 + Main.rand.NextVector2Circular(10f, 10f)) * (dust7.velocity.Length() + 5f); - dust7.position -= mouthDirection5 * 100f; + Dust chargeBloodDust = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 60f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f); + chargeBloodDust.velocity = chargeBloodDust.position.DirectionFrom(mouthPosition5 + Main.rand.NextVector2Circular(5f, 5f)) * chargeBloodDust.velocity.Length(); + chargeBloodDust.position -= mouthDirection5 * 60f; + chargeBloodDust = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 100f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f); + chargeBloodDust.velocity = chargeBloodDust.position.DirectionFrom(mouthPosition5 + Main.rand.NextVector2Circular(10f, 10f)) * (chargeBloodDust.velocity.Length() + 5f); + chargeBloodDust.position -= mouthDirection5 * 100f; } npc.position -= npc.netOffset; @@ -250,18 +250,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case 2: { npc.direction = (npc.Center.X < nPCAimedTarget.Center.X) ? 1 : (-1); - float num10 = npc.Center.DirectionTo(nPCAimedTarget.Center).ToRotation() - 213f / 452f * npc.spriteDirection; + float bloodProjFaceDirection = npc.Center.DirectionTo(nPCAimedTarget.Center).ToRotation() - 213f / 452f * npc.spriteDirection; if (npc.spriteDirection == -1) - num10 += (float)Math.PI; + bloodProjFaceDirection += (float)Math.PI; if (npc.spriteDirection != npc.direction) { npc.spriteDirection = npc.direction; npc.rotation = 0f - npc.rotation; - num10 = 0f - num10; + bloodProjFaceDirection = 0f - bloodProjFaceDirection; } - npc.rotation = npc.rotation.AngleLerp(num10, 0.2f); + npc.rotation = npc.rotation.AngleLerp(bloodProjFaceDirection, 0.2f); if (npc.ai[1] < bloodSpitChargeUpPhaseTime) { npc.position += npc.netOffset; @@ -269,14 +269,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.BloodNautilus_GetMouthPositionAndRotation(out Vector2 mouthPosition2, out Vector2 mouthDirection2); if (Main.rand.Next(4) != 0) { - Dust dust3 = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 60f - new Vector2(60f), 120, 120, 16, 0f, 0f, 150, Color.Transparent, 0.6f); - dust3.fadeIn = 1f; - dust3.velocity = dust3.position.DirectionTo(mouthPosition2 + Main.rand.NextVector2Circular(15f, 15f)) * (dust3.velocity.Length() + 3f); - dust3.noGravity = true; - dust3 = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 100f - new Vector2(80f), 160, 160, 16, 0f, 0f, 100, Color.Transparent, 0.9f); - dust3.fadeIn = 1.5f; - dust3.velocity = dust3.position.DirectionTo(mouthPosition2 + Main.rand.NextVector2Circular(15f, 15f)) * (dust3.velocity.Length() + 5f); - dust3.noGravity = true; + Dust bloodProjChargeUpDust = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 60f - new Vector2(60f), 120, 120, 16, 0f, 0f, 150, Color.Transparent, 0.6f); + bloodProjChargeUpDust.fadeIn = 1f; + bloodProjChargeUpDust.velocity = bloodProjChargeUpDust.position.DirectionTo(mouthPosition2 + Main.rand.NextVector2Circular(15f, 15f)) * (bloodProjChargeUpDust.velocity.Length() + 3f); + bloodProjChargeUpDust.noGravity = true; + bloodProjChargeUpDust = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 100f - new Vector2(80f), 160, 160, 16, 0f, 0f, 100, Color.Transparent, 0.9f); + bloodProjChargeUpDust.fadeIn = 1.5f; + bloodProjChargeUpDust.velocity = bloodProjChargeUpDust.position.DirectionTo(mouthPosition2 + Main.rand.NextVector2Circular(15f, 15f)) * (bloodProjChargeUpDust.velocity.Length() + 5f); + bloodProjChargeUpDust.noGravity = true; } npc.position -= npc.netOffset; @@ -285,23 +285,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.position += npc.netOffset; npc.velocity *= 0.9f; - float num11 = (npc.ai[1] - bloodSpitChargeUpPhaseTime) % (bloodSpitPhaseTime / numBloodSpitVolleys); + float bloodProjShootTimer = (npc.ai[1] - bloodSpitChargeUpPhaseTime) % (bloodSpitPhaseTime / numBloodSpitVolleys); npc.BloodNautilus_GetMouthPositionAndRotation(out Vector2 mouthPosition3, out Vector2 mouthDirection3); - if (num11 < bloodSpitPhaseTime / numBloodSpitVolleys * 0.8f) + if (bloodProjShootTimer < bloodSpitPhaseTime / numBloodSpitVolleys * 0.8f) { for (int i = 0; i < 5; i++) { - Dust dust4 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 50f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f); - dust4.velocity = dust4.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(5f, 5f)) * dust4.velocity.Length(); - dust4.position -= mouthDirection3 * 60f; - dust4 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 90f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f); - dust4.velocity = dust4.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(10f, 10f)) * (dust4.velocity.Length() + 5f); - dust4.position -= mouthDirection3 * 100f; + Dust bloodProjShootDust = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 50f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f); + bloodProjShootDust.velocity = bloodProjShootDust.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(5f, 5f)) * bloodProjShootDust.velocity.Length(); + bloodProjShootDust.position -= mouthDirection3 * 60f; + bloodProjShootDust = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 90f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f); + bloodProjShootDust.velocity = bloodProjShootDust.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(10f, 10f)) * (bloodProjShootDust.velocity.Length() + 5f); + bloodProjShootDust.position -= mouthDirection3 * 100f; } } // Spit blood spread - if ((int)num11 == 0) + if ((int)bloodProjShootTimer == 0) { // Recoil away with each spit npc.velocity += mouthDirection3 * -8f; @@ -309,12 +309,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn dust with each spit for (int j = 0; j < 20; j++) { - Dust dust5 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 60f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f); - dust5.velocity = dust5.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(5f, 5f)) * dust5.velocity.Length(); - dust5.position -= mouthDirection3 * 60f; - dust5 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 100f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f); - dust5.velocity = dust5.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(10f, 10f)) * (dust5.velocity.Length() + 5f); - dust5.position -= mouthDirection3 * 100f; + Dust bloodProjShootDust2 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 60f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f); + bloodProjShootDust2.velocity = bloodProjShootDust2.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(5f, 5f)) * bloodProjShootDust2.velocity.Length(); + bloodProjShootDust2.position -= mouthDirection3 * 60f; + bloodProjShootDust2 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 100f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f); + bloodProjShootDust2.velocity = bloodProjShootDust2.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(10f, 10f)) * (bloodProjShootDust2.velocity.Length() + 5f); + bloodProjShootDust2.position -= mouthDirection3 * 100f; } // Spawn projectiles @@ -352,8 +352,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] < bloodSquidPhaseTime) { npc.position += npc.netOffset; - float num9 = MathHelper.Clamp(1f - npc.ai[1] / bloodSquidPhaseTime * 1.5f, 0f, 1f); - npc.velocity = Vector2.Lerp(value2: new Vector2(0f, num9 * -1.5f), value1: npc.velocity, amount: 0.03f); + float bloodSquidVelClamp = MathHelper.Clamp(1f - npc.ai[1] / bloodSquidPhaseTime * 1.5f, 0f, 1f); + npc.velocity = Vector2.Lerp(value2: new Vector2(0f, bloodSquidVelClamp * -1.5f), value1: npc.velocity, amount: 0.03f); npc.velocity = Vector2.Zero; npc.rotation = npc.rotation.AngleLerp(targetAngle, 0.02f); npc.BloodNautilus_GetMouthPositionAndRotation(out Vector2 _, out Vector2 _); @@ -362,9 +362,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Lighting.AddLight(npc.Center, new Vector3(1f, 0.5f, 0.5f) * scaleFactor2); if (Main.rand.Next(3) != 0) { - Dust dust2 = Dust.NewDustDirect(npc.Center - new Vector2(6f), 12, 12, 5, 0f, 0f, 60, Color.Transparent, 1.4f); - dust2.position += new Vector2(npc.spriteDirection * 12, 12f); - dust2.velocity *= 0.1f; + Dust bloodSquidSpawnDust = Dust.NewDustDirect(npc.Center - new Vector2(6f), 12, 12, 5, 0f, 0f, 60, Color.Transparent, 1.4f); + bloodSquidSpawnDust.position += new Vector2(npc.spriteDirection * 12, 12f); + bloodSquidSpawnDust.velocity *= 0.1f; } npc.position -= npc.netOffset; @@ -406,30 +406,30 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode == NetmodeID.MultiplayerClient || !Main.player[npc.target].active || Main.player[npc.target].dead || npc.Distance(Main.player[npc.target].Center) > 2000f) return; - Point point = npc.Center.ToTileCoordinates(); - Point point2 = point; - int num = 20; - int num2 = 3; - int num3 = 8; - int num4 = 2; + Point npcCenterTileCoords = npc.Center.ToTileCoordinates(); + Point npcCenterTileCoordsCopy = npcCenterTileCoords; + int bloodTearRandSpawnOffset = 20; + int npcCenterTileRadius = 3; + int npcCenterCopyTileRadius = 8; + int bloodTearSpawnTileRadius = 2; int attempts = 0; - int num6; - int num7; + int bloodTearTileX; + int bloodTearTileY; while (true) { if (attempts >= 100) return; attempts++; - num6 = Main.rand.Next(point2.X - num, point2.X + num + 1); - num7 = Main.rand.Next(point2.Y - num, point2.Y + num + 1); - if ((num7 < point2.Y - num3 || num7 > point2.Y + num3 || num6 < point2.X - num3 || num6 > point2.X + num3) && (num7 < point.Y - num2 || num7 > point.Y + num2 || num6 < point.X - num2 || num6 > point.X + num2) && !Main.tile[num6, num7].HasUnactuatedTile) + bloodTearTileX = Main.rand.Next(npcCenterTileCoordsCopy.X - bloodTearRandSpawnOffset, npcCenterTileCoordsCopy.X + bloodTearRandSpawnOffset + 1); + bloodTearTileY = Main.rand.Next(npcCenterTileCoordsCopy.Y - bloodTearRandSpawnOffset, npcCenterTileCoordsCopy.Y + bloodTearRandSpawnOffset + 1); + if ((bloodTearTileY < npcCenterTileCoordsCopy.Y - npcCenterCopyTileRadius || bloodTearTileY > npcCenterTileCoordsCopy.Y + npcCenterCopyTileRadius || bloodTearTileX < npcCenterTileCoordsCopy.X - npcCenterCopyTileRadius || bloodTearTileX > npcCenterTileCoordsCopy.X + npcCenterCopyTileRadius) && (bloodTearTileY < npcCenterTileCoords.Y - npcCenterTileRadius || bloodTearTileY > npcCenterTileCoords.Y + npcCenterTileRadius || bloodTearTileX < npcCenterTileCoords.X - npcCenterTileRadius || bloodTearTileX > npcCenterTileCoords.X + npcCenterTileRadius) && !Main.tile[bloodTearTileX, bloodTearTileY].HasUnactuatedTile) { bool spawnBloodTear = true; - if (spawnBloodTear && Main.tile[num6, num7].LiquidType == LiquidID.Lava) + if (spawnBloodTear && Main.tile[bloodTearTileX, bloodTearTileY].LiquidType == LiquidID.Lava) spawnBloodTear = false; - if (spawnBloodTear && Collision.SolidTiles(num6 - num4, num6 + num4, num7 - num4, num7 + num4)) + if (spawnBloodTear && Collision.SolidTiles(bloodTearTileX - bloodTearSpawnTileRadius, bloodTearTileX + bloodTearSpawnTileRadius, bloodTearTileY - bloodTearSpawnTileRadius, bloodTearTileY + bloodTearSpawnTileRadius)) spawnBloodTear = false; if (spawnBloodTear && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) @@ -440,7 +440,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - Projectile.NewProjectile(npc.GetSource_FromAI(), num6 * 16 + 8, num7 * 16 + 8, 0f, 0f, ProjectileID.BloodNautilusTears, 0, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), bloodTearTileX * 16 + 8, bloodTearTileY * 16 + 8, 0f, 0f, ProjectileID.BloodNautilusTears, 0, 0f, Main.myPlayer); } } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs index 31c08e97cb..338ce7f742 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs @@ -236,18 +236,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - float num17 = (float)Math.Atan2(rotationVector.Y, rotationVector.X); + float rotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); if (npc.spriteDirection == 1) - num17 += MathHelper.Pi; - if (num17 < 0f) - num17 += MathHelper.TwoPi; - if (num17 > MathHelper.TwoPi) - num17 -= MathHelper.TwoPi; + rotationSpeed += MathHelper.Pi; + if (rotationSpeed < 0f) + rotationSpeed += MathHelper.TwoPi; + if (rotationSpeed > MathHelper.TwoPi) + rotationSpeed -= MathHelper.TwoPi; if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) - num17 = 0f; + rotationSpeed = 0f; if (rateOfRotation != 0f) - npc.rotation = npc.rotation.AngleTowards(num17, rateOfRotation); + npc.rotation = npc.rotation.AngleTowards(rotationSpeed, rateOfRotation); // Alpha adjustments if (npc.ai[0] != -1f && npc.ai[0] < 9f) @@ -270,10 +270,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity *= 0.98f; // Direction - int num19 = Math.Sign(player.Center.X - npc.Center.X); - if (num19 != 0) + int faceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (faceDirection != 0) { - npc.direction = num19; + npc.direction = faceDirection; npc.spriteDirection = -npc.direction; } @@ -294,15 +294,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn dust and play sound if (npc.ai[2] == sharknadoPhaseTimer - 30) { - int num20 = 36; - for (int i = 0; i < num20; i++) + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) { - Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (num20 / 2 - 1)) * MathHelper.TwoPi / num20) + npc.Center; - Vector2 vector2 = dust - npc.Center; - int num21 = Dust.NewDust(dust + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); - Main.dust[num21].noGravity = true; - Main.dust[num21].noLight = true; - Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; + Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + npc.Center; + Vector2 sharknadoDustDirection = dust - npc.Center; + int sharknadoDust = Dust.NewDust(dust + sharknadoDustDirection, 0, 0, 172, sharknadoDustDirection.X * 2f, sharknadoDustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[sharknadoDust].noGravity = true; + Main.dust[sharknadoDust].noLight = true; + Main.dust[sharknadoDust].velocity = Vector2.Normalize(sharknadoDustDirection) * 3f; } SoundEngine.PlaySound(SoundID.Zombie20,npc.Center); @@ -325,17 +325,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(vector3, idlePhaseAcceleration); + Vector2 idlePhaseDirection = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(idlePhaseDirection, idlePhaseAcceleration); // Rotation and direction - int num22 = Math.Sign(player.Center.X - npc.Center.X); - if (num22 != 0) + int playerFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (playerFaceDirection != 0) { - if (npc.ai[2] == 0f && num22 != npc.direction) + if (npc.ai[2] == 0f && playerFaceDirection != npc.direction) npc.rotation += MathHelper.Pi; - npc.direction = num22; + npc.direction = playerFaceDirection; if (npc.spriteDirection != -npc.direction) npc.rotation += MathHelper.Pi; @@ -347,7 +347,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] += 1f; if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) { - int num23 = 0; + int attackPicker = 0; switch ((int)npc.ai[3]) { case 0: @@ -360,23 +360,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case 7: case 8: case 9: - num23 = 1; + attackPicker = 1; break; case 10: npc.ai[3] = 1f; - num23 = 2; + attackPicker = 2; break; case 11: npc.ai[3] = 0f; - num23 = 3; + attackPicker = 3; break; } if (phase2) - num23 = 4; + attackPicker = 4; // Set velocity for charge - if (num23 == 1) + if (attackPicker == 1) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -387,9 +387,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction - if (num22 != 0) + if (playerFaceDirection != 0) { - npc.direction = num22; + npc.direction = playerFaceDirection; if (npc.spriteDirection == 1) npc.rotation += MathHelper.Pi; @@ -399,7 +399,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Bubbles - else if (num23 == 2) + else if (attackPicker == 2) { npc.ai[0] = 2f; npc.ai[1] = 0f; @@ -407,7 +407,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Spawn sharknadoes - else if (num23 == 3) + else if (attackPicker == 3) { npc.ai[0] = 3f; npc.ai[1] = 0f; @@ -415,7 +415,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Go to phase 2 - else if (num23 == 4) + else if (attackPicker == 4) { npc.ai[0] = 4f; npc.ai[1] = 0f; @@ -433,16 +433,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity *= 1.01f; // Spawn dust - int num24 = 7; - for (int j = 0; j < num24; j++) + int chargeDustAmt = 7; + for (int j = 0; j < chargeDustAmt; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + npc.Center; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (chargeDustAmt / 2 - 1)) * MathHelper.Pi / chargeDustAmt) + npc.Center; + Vector2 chargeDustDirection = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int chargeDust = Dust.NewDust(arg_E1C_0 + chargeDustDirection, 0, 0, 172, chargeDustDirection.X * 2f, chargeDustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[chargeDust].noGravity = true; + Main.dust[chargeDust].noLight = true; + Main.dust[chargeDust].velocity /= 4f; + Main.dust[chargeDust].velocity -= npc.velocity; } npc.ai[2] += 1f; @@ -464,8 +464,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); - Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * bubbleBelchPhaseVelocity; - npc.SimpleFlyMovement(vector5, bubbleBelchPhaseAcceleration); + Vector2 bubbleAttackDirection = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * bubbleBelchPhaseVelocity; + npc.SimpleFlyMovement(bubbleAttackDirection, bubbleBelchPhaseAcceleration); // Play sounds and spawn bubbles if (npc.ai[2] == 0f) @@ -477,16 +477,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector6 = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector6.X, (int)vector6.Y + 45, NPCID.DetonatingBubble); + Vector2 bubbleSpawnDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; + NPC.NewNPC(npc.GetSource_FromAI(), (int)bubbleSpawnDirection.X, (int)bubbleSpawnDirection.Y + 45, NPCID.DetonatingBubble); } } // Direction - int num26 = Math.Sign(player.Center.X - npc.Center.X); - if (num26 != 0) + int bubbleSpriteFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (bubbleSpriteFaceDirection != 0) { - npc.direction = num26; + npc.direction = bubbleSpriteFaceDirection; if (npc.spriteDirection != -npc.direction) npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; @@ -516,17 +516,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == sharknadoPhaseTimer - 30) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; + Vector2 sharknadoSpawnerDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; bool normal = Main.rand.NextBool(); float velocityY = normal ? 8f : -4f; float ai1 = normal ? 0f : -1f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector7.X, vector7.Y, npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector7.X, vector7.Y, -(float)npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + Projectile.NewProjectile(npc.GetSource_FromAI(), sharknadoSpawnerDirection.X, sharknadoSpawnerDirection.Y, npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + Projectile.NewProjectile(npc.GetSource_FromAI(), sharknadoSpawnerDirection.X, sharknadoSpawnerDirection.Y, -(float)npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); velocityY = normal ? -4f : 8f; ai1 = normal ? -1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector7.X, vector7.Y, 0f, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + Projectile.NewProjectile(npc.GetSource_FromAI(), sharknadoSpawnerDirection.X, sharknadoSpawnerDirection.Y, 0f, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); } npc.ai[2] += 1f; @@ -570,17 +570,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); - Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(vector8, idlePhaseAcceleration); + Vector2 phase2IdleDirection = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(phase2IdleDirection, idlePhaseAcceleration); // Direction and rotation - int num27 = Math.Sign(player.Center.X - npc.Center.X); - if (num27 != 0) + int phase2SpriteFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase2SpriteFaceDirection != 0) { - if (npc.ai[2] == 0f && num27 != npc.direction) + if (npc.ai[2] == 0f && phase2SpriteFaceDirection != npc.direction) npc.rotation += MathHelper.Pi; - npc.direction = num27; + npc.direction = phase2SpriteFaceDirection; if (npc.spriteDirection != -npc.direction) npc.rotation += MathHelper.Pi; @@ -592,7 +592,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] += 1f; if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) { - int num28 = 0; + int phase2AttackPicker = 0; switch ((int)npc.ai[3]) { case 0: @@ -601,23 +601,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case 3: case 4: case 5: - num28 = 1; + phase2AttackPicker = 1; break; case 6: npc.ai[3] = 1f; - num28 = 2; + phase2AttackPicker = 2; break; case 7: npc.ai[3] = 0f; - num28 = 3; + phase2AttackPicker = 3; break; } if (phase3) - num28 = 4; + phase2AttackPicker = 4; // Set velocity for charge - if (num28 == 1) + if (phase2AttackPicker == 1) { npc.ai[0] = 6f; npc.ai[1] = 0f; @@ -628,9 +628,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction - if (num27 != 0) + if (phase2SpriteFaceDirection != 0) { - npc.direction = num27; + npc.direction = phase2SpriteFaceDirection; if (npc.spriteDirection == 1) npc.rotation += MathHelper.Pi; @@ -640,16 +640,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Set velocity for spin - else if (num28 == 2) + else if (phase2AttackPicker == 2) { // Velocity and rotation npc.velocity = Vector2.Normalize(player.Center - npc.Center) * bubbleSpinPhaseVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction - if (num27 != 0) + if (phase2SpriteFaceDirection != 0) { - npc.direction = num27; + npc.direction = phase2SpriteFaceDirection; if (npc.spriteDirection == 1) npc.rotation += MathHelper.Pi; @@ -663,7 +663,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Spawn cthulhunado - else if (num28 == 3) + else if (phase2AttackPicker == 3) { npc.ai[0] = 8f; npc.ai[1] = 0f; @@ -671,7 +671,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Go to next phase - else if (num28 == 4) + else if (phase2AttackPicker == 4) { npc.ai[0] = 9f; npc.ai[1] = 0f; @@ -689,16 +689,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity *= 1.01f; // Spawn dust - int num29 = 7; - for (int k = 0; k < num29; k++) + int phase2ChargeDustAmt = 7; + for (int k = 0; k < phase2ChargeDustAmt; k++) { - Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (num29 / 2 - 1)) * MathHelper.Pi / num29) + npc.Center; - Vector2 vector9 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num30 = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, 172, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); - Main.dust[num30].noGravity = true; - Main.dust[num30].noLight = true; - Main.dust[num30].velocity /= 4f; - Main.dust[num30].velocity -= npc.velocity; + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (phase2ChargeDustAmt / 2 - 1)) * MathHelper.Pi / phase2ChargeDustAmt) + npc.Center; + Vector2 phase2ChargeDustDirection = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int phase2ChargeDust = Dust.NewDust(arg_1A97_0 + phase2ChargeDustDirection, 0, 0, 172, phase2ChargeDustDirection.X * 2f, phase2ChargeDustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[phase2ChargeDust].noGravity = true; + Main.dust[phase2ChargeDust].noLight = true; + Main.dust[phase2ChargeDust].velocity /= 4f; + Main.dust[phase2ChargeDust].velocity -= npc.velocity; } npc.ai[2] += 1f; @@ -726,17 +726,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; - int num31 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector10.X, (int)vector10.Y + 45, NPCID.DetonatingBubble); - Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * bubbleSpinBubbleVelocity * (CalamityWorld.LegendaryMode ? (Main.rand.NextFloat() + 0.5f) : 1f); - Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = Main.rand.Next(80, 121) / 100f; + Vector2 phase2BubbleSharkronDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; + int phase2Bubbles = NPC.NewNPC(npc.GetSource_FromAI(), (int)phase2BubbleSharkronDirection.X, (int)phase2BubbleSharkronDirection.Y + 45, NPCID.DetonatingBubble); + Main.npc[phase2Bubbles].target = npc.target; + Main.npc[phase2Bubbles].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * bubbleSpinBubbleVelocity * (CalamityWorld.LegendaryMode ? (Main.rand.NextFloat() + 0.5f) : 1f); + Main.npc[phase2Bubbles].netUpdate = true; + Main.npc[phase2Bubbles].ai[3] = Main.rand.Next(80, 121) / 100f; if (npc.ai[2] % (bubbleSpinPhaseDivisor * 5) == 0f) { - int npc2 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector10.X, (int)vector10.Y + 45, NPCID.Sharkron2); - Main.npc[npc2].ai[1] = 89f; + int phase2BubbleSharkrons = NPC.NewNPC(npc.GetSource_FromAI(), (int)phase2BubbleSharkronDirection.X, (int)phase2BubbleSharkronDirection.Y + 45, NPCID.Sharkron2); + Main.npc[phase2BubbleSharkrons].ai[1] = 89f; } } } @@ -846,17 +846,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); // Rotation and direction - int num32 = Math.Sign(player.Center.X - npc.Center.X); - if (num32 != 0) + int phase3SpriteFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase3SpriteFaceDirection != 0) { - if (npc.ai[2] == 0f && num32 != npc.direction) + if (npc.ai[2] == 0f && phase3SpriteFaceDirection != npc.direction) { npc.rotation += MathHelper.Pi; for (int l = 0; l < npc.oldPos.Length; l++) npc.oldPos[l] = Vector2.Zero; } - npc.direction = num32; + npc.direction = phase3SpriteFaceDirection; if (npc.spriteDirection != -npc.direction) npc.rotation += MathHelper.Pi; @@ -868,7 +868,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] += 1f; if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) { - int num33 = 0; + int phase3AttackPicker = 0; if (phase4) { switch ((int)npc.ai[3]) @@ -880,16 +880,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case 5: case 6: case 7: - num33 = 1; + phase3AttackPicker = 1; break; case 3: case 8: - num33 = 2; + phase3AttackPicker = 2; break; } if (death) - num33 = 1; + phase3AttackPicker = 1; } else { @@ -901,18 +901,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case 5: case 6: case 7: - num33 = 1; + phase3AttackPicker = 1; break; case 1: case 4: case 8: - num33 = 2; + phase3AttackPicker = 2; break; } } // Set velocity for charge - if (num33 == 1) + if (phase3AttackPicker == 1) { npc.ai[0] = 11f; npc.ai[1] = 0f; @@ -923,9 +923,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction - if (num32 != 0) + if (phase3SpriteFaceDirection != 0) { - npc.direction = num32; + npc.direction = phase3SpriteFaceDirection; if (npc.spriteDirection == 1) npc.rotation += MathHelper.Pi; @@ -935,7 +935,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Pause - else if (num33 == 2) + else if (phase3AttackPicker == 2) { npc.ai[0] = 12f; npc.ai[1] = 0f; @@ -958,16 +958,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.alpha = 0; // Spawn dust - int num34 = 7; - for (int m = 0; m < num34; m++) + int phase3ChargeDustAmt = 7; + for (int m = 0; m < phase3ChargeDustAmt; m++) { - Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (num34 / 2 - 1)) * MathHelper.Pi / num34) + npc.Center; - Vector2 vector11 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num35 = Dust.NewDust(arg_2444_0 + vector11, 0, 0, 172, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); - Main.dust[num35].noGravity = true; - Main.dust[num35].noLight = true; - Main.dust[num35].velocity /= 4f; - Main.dust[num35].velocity -= npc.velocity; + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (phase3ChargeDustAmt / 2 - 1)) * MathHelper.Pi / phase3ChargeDustAmt) + npc.Center; + Vector2 phase3ChargeDustDirection = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int phase3ChargeDust = Dust.NewDust(arg_2444_0 + phase3ChargeDustDirection, 0, 0, 172, phase3ChargeDustDirection.X * 2f, phase3ChargeDustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[phase3ChargeDust].noGravity = true; + Main.dust[phase3ChargeDust].noLight = true; + Main.dust[phase3ChargeDust].velocity /= 4f; + Main.dust[phase3ChargeDust].velocity -= npc.velocity; } npc.ai[2] += 1f; @@ -1016,17 +1016,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Rotation and direction Vector2 center = player.Center + new Vector2(-npc.ai[1], -200f); npc.Center = center; - int num36 = Math.Sign(player.Center.X - npc.Center.X); - if (num36 != 0) + int phase3PlayerDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase3PlayerDirection != 0) { - if (npc.ai[2] == 0f && num36 != npc.direction) + if (npc.ai[2] == 0f && phase3PlayerDirection != npc.direction) { npc.rotation += MathHelper.Pi; for (int n = 0; n < npc.oldPos.Length; n++) npc.oldPos[n] = Vector2.Zero; } - npc.direction = num36; + npc.direction = phase3PlayerDirection; if (npc.spriteDirection != -npc.direction) npc.rotation += MathHelper.Pi; diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs index 100c87202c..0a5dc04878 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs @@ -103,21 +103,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2.Distance(npc.Center, Main.player[npc.target].Center) > 320f) { calamityGlobalNPC.newAI[0] = 0f; - Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector34.Y; - float num418 = 7f + enrageScale * 2f; - float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); - num351 = num418 / num351; - num349 *= num351; - num350 *= num351; - num350 += npc.velocity.Y * 0.5f; - num349 += npc.velocity.X * 0.5f; - vector34.X -= num349; - vector34.Y -= num350; + Vector2 cursedFlameDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float targetXDirection = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - cursedFlameDirection.X; + float targetYDirection = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - cursedFlameDirection.Y; + float projSpeed = 7f + enrageScale * 2f; + float targetDistance = (float)Math.Sqrt(targetXDirection * targetXDirection + targetYDirection * targetYDirection); + targetDistance = projSpeed / targetDistance; + targetXDirection *= targetDistance; + targetYDirection *= targetDistance; + targetYDirection += npc.velocity.Y * 0.5f; + targetXDirection += npc.velocity.X * 0.5f; + cursedFlameDirection.X -= targetXDirection; + cursedFlameDirection.Y -= targetYDirection; int type = ProjectileID.CursedFlameHostile; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector34.X, vector34.Y, num349, num350, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), cursedFlameDirection.X, cursedFlameDirection.Y, targetXDirection, targetYDirection, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); } } } @@ -233,38 +233,38 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Movement - int num29 = (int)(npc.position.X / 16f) - 1; - int num30 = (int)((npc.position.X + npc.width) / 16f) + 2; - int num31 = (int)(npc.position.Y / 16f) - 1; - int num32 = (int)((npc.position.Y + npc.height) / 16f) + 2; - if (num29 < 0) - num29 = 0; - if (num30 > Main.maxTilesX) - num30 = Main.maxTilesX; - if (num31 < 0) - num31 = 0; - if (num32 > Main.maxTilesY) - num32 = Main.maxTilesY; + int tilePositionX = (int)(npc.position.X / 16f) - 1; + int tileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; + int tilePositionY = (int)(npc.position.Y / 16f) - 1; + int tileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; + if (tilePositionX < 0) + tilePositionX = 0; + if (tileWidthPosX > Main.maxTilesX) + tileWidthPosX = Main.maxTilesX; + if (tilePositionY < 0) + tilePositionY = 0; + if (tileWidthPosY > Main.maxTilesY) + tileWidthPosY = Main.maxTilesY; // Fly or not bool inTiles = false; if (!inTiles) { - for (int num33 = num29; num33 < num30; num33++) + for (int i = tilePositionX; i < tileWidthPosX; i++) { - for (int num34 = num31; num34 < num32; num34++) + for (int j = tilePositionY; j < tileWidthPosY; j++) { - if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].HasUnactuatedTile && (Main.tileSolid[Main.tile[num33, num34].TileType] || (Main.tileSolidTop[Main.tile[num33, num34].TileType] && Main.tile[num33, num34].TileFrameY == 0))) || Main.tile[num33, num34].LiquidAmount > 64)) + if (Main.tile[i, j] != null && ((Main.tile[i, j].HasUnactuatedTile && (Main.tileSolid[Main.tile[i, j].TileType] || (Main.tileSolidTop[Main.tile[i, j].TileType] && Main.tile[i, j].TileFrameY == 0))) || Main.tile[i, j].LiquidAmount > 64)) { Vector2 vector; - vector.X = num33 * 16; - vector.Y = num34 * 16; + vector.X = i * 16; + vector.Y = j * 16; if (npc.position.X + npc.width > vector.X && npc.position.X < vector.X + 16f && npc.position.Y + npc.height > vector.Y && npc.position.Y < vector.Y + 16f) { inTiles = true; - if (Main.rand.NextBool(100) && Main.tile[num33, num34].HasUnactuatedTile) + if (Main.rand.NextBool(100) && Main.tile[i, j].HasUnactuatedTile) { - WorldGen.KillTile(num33, num34, true, true, false); + WorldGen.KillTile(i, j, true, true, false); } } } @@ -274,18 +274,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (!inTiles && npc.type == NPCID.EaterofWorldsHead) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num35 = death ? 700 : 850; - num35 -= (int)(enrageScale * 300f); + int noFlyZone = death ? 700 : 850; + noFlyZone -= (int)(enrageScale * 300f); - if (num35 < 100) - num35 = 100; + if (noFlyZone < 100) + noFlyZone = 100; bool freeMoveAnyway = true; - for (int num36 = 0; num36 < Main.maxPlayers; num36++) + for (int k = 0; k < Main.maxPlayers; k++) { - if (Main.player[num36].active) + if (Main.player[k].active) { - Rectangle rectangle2 = new Rectangle((int)Main.player[num36].position.X - num35, (int)Main.player[num36].position.Y - num35, num35 * 2, num35 * 2); + Rectangle rectangle2 = new Rectangle((int)Main.player[k].position.X - noFlyZone, (int)Main.player[k].position.Y - noFlyZone, noFlyZone * 2, noFlyZone * 2); if (rectangle.Intersects(rectangle2)) { freeMoveAnyway = false; @@ -302,65 +302,65 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float velocityBoost = velocityScale * (1f - lifeRatio); float accelerationScale = (death ? 0.06f : 0.03f) * enrageScale; float accelerationBoost = accelerationScale * (1f - lifeRatio); - float num37 = 12f + velocityBoost; - float num38 = 0.15f + accelerationBoost; + float segmentVelocity = 12f + velocityBoost; + float segmentAcceleration = 0.15f + accelerationBoost; if (phase5) { - num37 += 2.4f * enrageScale; - num38 += 0.03f * enrageScale; + segmentVelocity += 2.4f * enrageScale; + segmentAcceleration += 0.03f * enrageScale; } else if (phase4) { - num37 += 1.2f * enrageScale; - num38 += 0.015f * enrageScale; + segmentVelocity += 1.2f * enrageScale; + segmentAcceleration += 0.015f * enrageScale; } if (Main.getGoodWorld) { - num37 += 4f; - num38 += 0.05f; + segmentVelocity += 4f; + segmentAcceleration += 0.05f; } - Vector2 vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num39 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num40 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 segmentDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float targetPosX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float targetPosY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); - num39 = (int)(num39 / 16f) * 16; - num40 = (int)(num40 / 16f) * 16; - vector2.X = (int)(vector2.X / 16f) * 16; - vector2.Y = (int)(vector2.Y / 16f) * 16; - num39 -= vector2.X; - num40 -= vector2.Y; - float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); + targetPosX = (int)(targetPosX / 16f) * 16; + targetPosY = (int)(targetPosY / 16f) * 16; + segmentDirection.X = (int)(segmentDirection.X / 16f) * 16; + segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16; + targetPosX -= segmentDirection.X; + targetPosY -= segmentDirection.Y; + float targetDistance = (float)Math.Sqrt(targetPosX * targetPosX + targetPosY * targetPosY); // Does this worm segment have a "previous segment" defined? if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try { - vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num39 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector2.X; - num40 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector2.Y; + segmentDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + targetPosX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - segmentDirection.X; + targetPosY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - segmentDirection.Y; } catch { } - npc.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2; - num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - int num53 = npc.width; - num53 = (int)(num53 * npc.scale); + npc.rotation = (float)Math.Atan2(targetPosY, targetPosX) + MathHelper.PiOver2; + targetDistance = (float)Math.Sqrt(targetPosX * targetPosX + targetPosY * targetPosY); + int npcWidth = npc.width; + npcWidth = (int)(npcWidth * npc.scale); if (Main.getGoodWorld) - num53 = 62; + npcWidth = 62; - num52 = (num52 - num53) / num52; - num39 *= num52; - num40 *= num52; + targetDistance = (targetDistance - npcWidth) / targetDistance; + targetPosX *= targetDistance; + targetPosY *= targetDistance; npc.velocity = Vector2.Zero; - npc.position.X += num39; - npc.position.Y += num40; + npc.position.X += targetPosX; + npc.position.Y += targetPosY; } // Otherwise this is a head. (Why does this not just check for head NPC type?) @@ -372,35 +372,35 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.newAI[1] += 1f; // Set velocity for when a new head spawns - npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (num37 * (death ? 0.5f : 0.4f)); + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (segmentVelocity * (death ? 0.5f : 0.4f)); } if (!inTiles) { npc.velocity.Y += death ? 0.15f : 0.11f; - if (npc.velocity.Y > num37) - npc.velocity.Y = num37; + if (npc.velocity.Y > segmentVelocity) + npc.velocity.Y = segmentVelocity; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num37 * 0.4) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.4) { if (npc.velocity.X < 0f) - npc.velocity.X -= num38 * 1.1f; + npc.velocity.X -= segmentAcceleration * 1.1f; else - npc.velocity.X += num38 * 1.1f; + npc.velocity.X += segmentAcceleration * 1.1f; } - else if (npc.velocity.Y == num37) + else if (npc.velocity.Y == segmentVelocity) { - if (npc.velocity.X < num39) - npc.velocity.X += num38; - else if (npc.velocity.X > num39) - npc.velocity.X -= num38; + if (npc.velocity.X < targetPosX) + npc.velocity.X += segmentAcceleration; + else if (npc.velocity.X > targetPosX) + npc.velocity.X -= segmentAcceleration; } else if (npc.velocity.Y > (death ? 6f : 4f)) { if (npc.velocity.X < 0f) - npc.velocity.X += num38 * 0.9f; + npc.velocity.X += segmentAcceleration * 0.9f; else - npc.velocity.X -= num38 * 0.9f; + npc.velocity.X -= segmentAcceleration * 0.9f; } } else @@ -408,31 +408,31 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Sound if (npc.soundDelay == 0) { - float num54 = num52 / 40f; - if (num54 < 10f) - num54 = 10f; - if (num54 > 20f) - num54 = 20f; + float soundDelay = targetDistance / 40f; + if (soundDelay < 10f) + soundDelay = 10f; + if (soundDelay > 20f) + soundDelay = 20f; - npc.soundDelay = (int)num54; + npc.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, npc.position); } - num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - float num55 = Math.Abs(num39); - float num56 = Math.Abs(num40); - float num57 = num37 / num52; - num39 *= num57; - num40 *= num57; + targetDistance = (float)Math.Sqrt(targetPosX * targetPosX + targetPosY * targetPosY); + float absoluteTargetX = Math.Abs(targetPosX); + float absoluteTargetY = Math.Abs(targetPosY); + float timeToReachTarget = segmentVelocity / targetDistance; + targetPosX *= timeToReachTarget; + targetPosY *= timeToReachTarget; // Despawn bool shouldDespawn = npc.type == NPCID.EaterofWorldsHead && Main.player[npc.target].dead; if (shouldDespawn && !bossRush) { bool everyoneDead = true; - for (int num58 = 0; num58 < Main.maxPlayers; num58++) + for (int i = 0; i < Main.maxPlayers; i++) { - if (Main.player[num58].active && !Main.player[num58].dead) + if (Main.player[i].active && !Main.player[i].dead) { everyoneDead = false; break; @@ -444,83 +444,83 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient && (npc.position.Y / 16f) > (Main.rockLayer + Main.maxTilesY) / 2.0) { npc.active = false; - int num59 = (int)npc.ai[0]; + int segmentAmt = (int)npc.ai[0]; - while (num59 > 0 && num59 < Main.maxNPCs && Main.npc[num59].active && Main.npc[num59].aiStyle == npc.aiStyle) + while (segmentAmt > 0 && segmentAmt < Main.maxNPCs && Main.npc[segmentAmt].active && Main.npc[segmentAmt].aiStyle == npc.aiStyle) { - int arg_2853_0 = (int)Main.npc[num59].ai[0]; - Main.npc[num59].active = false; + int arg_2853_0 = (int)Main.npc[segmentAmt].ai[0]; + Main.npc[segmentAmt].active = false; npc.life = 0; if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num59, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentAmt, 0f, 0f, 0f, 0, 0, 0); - num59 = arg_2853_0; + segmentAmt = arg_2853_0; } if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } - num39 = 0f; - num40 = num37; + targetPosX = 0f; + targetPosY = segmentVelocity; } } - if ((npc.velocity.X > 0f && num39 > 0f) || (npc.velocity.X < 0f && num39 < 0f) || (npc.velocity.Y > 0f && num40 > 0f) || (npc.velocity.Y < 0f && num40 < 0f)) + if ((npc.velocity.X > 0f && targetPosX > 0f) || (npc.velocity.X < 0f && targetPosX < 0f) || (npc.velocity.Y > 0f && targetPosY > 0f) || (npc.velocity.Y < 0f && targetPosY < 0f)) { - if (npc.velocity.X < num39) - npc.velocity.X += num38; - else if (npc.velocity.X > num39) - npc.velocity.X -= num38; - if (npc.velocity.Y < num40) - npc.velocity.Y += num38; - else if (npc.velocity.Y > num40) - npc.velocity.Y -= num38; + if (npc.velocity.X < targetPosX) + npc.velocity.X += segmentAcceleration; + else if (npc.velocity.X > targetPosX) + npc.velocity.X -= segmentAcceleration; + if (npc.velocity.Y < targetPosY) + npc.velocity.Y += segmentAcceleration; + else if (npc.velocity.Y > targetPosY) + npc.velocity.Y -= segmentAcceleration; - if (Math.Abs(num40) < num37 * 0.2 && ((npc.velocity.X > 0f && num39 < 0f) || (npc.velocity.X < 0f && num39 > 0f))) + if (Math.Abs(targetPosY) < segmentVelocity * 0.2 && ((npc.velocity.X > 0f && targetPosX < 0f) || (npc.velocity.X < 0f && targetPosX > 0f))) { if (npc.velocity.Y > 0f) - npc.velocity.Y += num38 * 2f; + npc.velocity.Y += segmentAcceleration * 2f; else - npc.velocity.Y -= num38 * 2f; + npc.velocity.Y -= segmentAcceleration * 2f; } - if (Math.Abs(num39) < num37 * 0.2 && ((npc.velocity.Y > 0f && num40 < 0f) || (npc.velocity.Y < 0f && num40 > 0f))) + if (Math.Abs(targetPosX) < segmentVelocity * 0.2 && ((npc.velocity.Y > 0f && targetPosY < 0f) || (npc.velocity.Y < 0f && targetPosY > 0f))) { if (npc.velocity.X > 0f) - npc.velocity.X += num38 * 2f; + npc.velocity.X += segmentAcceleration * 2f; else - npc.velocity.X -= num38 * 2f; + npc.velocity.X -= segmentAcceleration * 2f; } } - else if (num55 > num56) + else if (absoluteTargetX > absoluteTargetY) { - if (npc.velocity.X < num39) - npc.velocity.X += num38 * 1.1f; - else if (npc.velocity.X > num39) - npc.velocity.X -= num38 * 1.1f; + if (npc.velocity.X < targetPosX) + npc.velocity.X += segmentAcceleration * 1.1f; + else if (npc.velocity.X > targetPosX) + npc.velocity.X -= segmentAcceleration * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num37 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) { if (npc.velocity.Y > 0f) - npc.velocity.Y += num38; + npc.velocity.Y += segmentAcceleration; else - npc.velocity.Y -= num38; + npc.velocity.Y -= segmentAcceleration; } } else { - if (npc.velocity.Y < num40) - npc.velocity.Y += num38 * 1.1f; - else if (npc.velocity.Y > num40) - npc.velocity.Y -= num38 * 1.1f; + if (npc.velocity.Y < targetPosY) + npc.velocity.Y += segmentAcceleration * 1.1f; + else if (npc.velocity.Y > targetPosY) + npc.velocity.Y -= segmentAcceleration * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num37 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) { if (npc.velocity.X > 0f) - npc.velocity.X += num38; + npc.velocity.X += segmentAcceleration; else - npc.velocity.X -= num38; + npc.velocity.X -= segmentAcceleration; } } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs index bb9cb49e4d..4f2bb4d12b 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs @@ -100,24 +100,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] > 10f && npc.ai[1] < 150f) { - int num67 = 2; - for (int m = 0; m < num67; m++) + for (int m = 0; m < 2; m++) { - float num68 = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity) * Utils.GetLerpValue(0f, 120f, npc.ai[1], clamped: true); + float dustOpacity = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity) * Utils.GetLerpValue(0f, 120f, npc.ai[1], clamped: true); Color newColor2 = Main.hslToRgb(npc.ai[1] / 180f, 1f, 0.5f); - int num69 = Dust.NewDust(npc.position, npc.width, npc.height, 267, 0f, 0f, 0, newColor2); - Main.dust[num69].position = npc.Center + Main.rand.NextVector2Circular(npc.width * 3f, npc.height * 3f) + new Vector2(0f, -150f); - Main.dust[num69].velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[num69].noGravity = true; - Main.dust[num69].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * num68; - Main.dust[num69].velocity += Vector2.UnitY * 3f; - Main.dust[num69].scale = 0.35f; - if (num69 != 6000) + int rainbow = Dust.NewDust(npc.position, npc.width, npc.height, 267, 0f, 0f, 0, newColor2); + Main.dust[rainbow].position = npc.Center + Main.rand.NextVector2Circular(npc.width * 3f, npc.height * 3f) + new Vector2(0f, -150f); + Main.dust[rainbow].velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * dustOpacity; + Main.dust[rainbow].velocity += Vector2.UnitY * 3f; + Main.dust[rainbow].scale = 0.35f; + if (rainbow != 6000) { - Dust dust2 = Dust.CloneDust(num69); - dust2.scale /= 2f; - dust2.fadeIn *= 0.85f; - dust2.color = new Color(255, 255, 255, 255); + Dust rainbowClone = Dust.CloneDust(rainbow); + rainbowClone.scale /= 2f; + rainbowClone.fadeIn *= 0.85f; + rainbowClone.color = new Color(255, 255, 255, 255); } } } @@ -146,11 +145,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Avoid cheap bullshit. npc.damage = 0; - float num33 = phase2 ? (death ? 10f : 15f) : (death ? 20f : 30f); + float idleTimer = phase2 ? (death ? 10f : 15f) : (death ? 20f : 30f); if (Main.getGoodWorld) - num33 *= 0.5f; - if (num33 < 10f) - num33 = 10f; + idleTimer *= 0.5f; + if (idleTimer < 10f) + idleTimer = 10f; if (npc.ai[1] <= 10f) { @@ -174,52 +173,52 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.Distance(center) > 200f) center -= npc.DirectionTo(center) * 100f; - Vector2 vector2 = center - npc.Center; - float lerpValue = Utils.GetLerpValue(100f, 600f, vector2.Length()); - float num34 = vector2.Length(); + Vector2 targetDirection = center - npc.Center; + float lerpValue = Utils.GetLerpValue(100f, 600f, targetDirection.Length()); + float targetDistance = targetDirection.Length(); float maxVelocity = death ? 24f : 21f; - if (num34 > maxVelocity) - num34 = maxVelocity; + if (targetDistance > maxVelocity) + targetDistance = maxVelocity; - npc.velocity = Vector2.Lerp(vector2.SafeNormalize(Vector2.Zero) * num34, vector2 / 6f, lerpValue); + npc.velocity = Vector2.Lerp(targetDirection.SafeNormalize(Vector2.Zero) * targetDistance, targetDirection / 6f, lerpValue); npc.netUpdate = true; } npc.velocity *= 0.92f; npc.ai[1] += 1f; - if (!(npc.ai[1] >= num33)) + if (!(npc.ai[1] >= idleTimer)) break; - int num35 = (int)npc.ai[2]; - int num36 = 2; - int num37 = 0; + int attackPatternLength = (int)npc.ai[2]; + int attackType = 2; + int attackIncrement = 0; if (!phase2) { - int num38 = num37++; - int num39 = num37++; - int num40 = num37++; - int num41 = num37++; - int num42 = num37++; - int num43 = num37++; - int num44 = num37++; - int num45 = num37++; - int num46 = num37++; - int num47 = num37++; + int phase1Attack1 = attackIncrement++; + int phase1Attack2 = attackIncrement++; + int phase1Attack3 = attackIncrement++; + int phase1Attack4 = attackIncrement++; + int phase1Attack5 = attackIncrement++; + int phase1Attack6 = attackIncrement++; + int phase1Attack7 = attackIncrement++; + int phase1Attack8 = attackIncrement++; + int phase1Attack9 = attackIncrement++; + int phase1Attack10 = attackIncrement++; - if (num35 % num37 == num38) - num36 = 2; + if (attackPatternLength % attackIncrement == phase1Attack1) + attackType = 2; - if (num35 % num37 == num39) - num36 = 6; + if (attackPatternLength % attackIncrement == phase1Attack2) + attackType = 6; - if (num35 % num37 == num40) - num36 = 8; + if (attackPatternLength % attackIncrement == phase1Attack3) + attackType = 8; - if (num35 % num37 == num41) + if (attackPatternLength % attackIncrement == phase1Attack4) { - num36 = 4; + attackType = 4; // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. calamityGlobalNPC.newAI[0] = Main.rand.Next(2); @@ -228,18 +227,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.SyncExtraAI(); } - if (num35 % num37 == num42) - num36 = 5; + if (attackPatternLength % attackIncrement == phase1Attack5) + attackType = 5; - if (num35 % num37 == num43) - num36 = 8; + if (attackPatternLength % attackIncrement == phase1Attack6) + attackType = 8; - if (num35 % num37 == num44) - num36 = 2; + if (attackPatternLength % attackIncrement == phase1Attack7) + attackType = 2; - if (num35 % num37 == num45) + if (attackPatternLength % attackIncrement == phase1Attack8) { - num36 = 4; + attackType = 4; // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. calamityGlobalNPC.newAI[0] = Main.rand.Next(2); @@ -248,32 +247,32 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.SyncExtraAI(); } - if (num35 % num37 == num46) - num36 = 8; + if (attackPatternLength % attackIncrement == phase1Attack9) + attackType = 8; - if (num35 % num37 == num47) - num36 = 5; + if (attackPatternLength % attackIncrement == phase1Attack10) + attackType = 5; if (lifeRatio <= 0.5f) - num36 = 10; + attackType = 10; } if (phase2) { - int num48 = num37++; - int num49 = num37++; - int num50 = num37++; - int num51 = num37++; - int num52 = num37++; - int num53 = num37++; - int num54 = num37++; - int num55 = num37++; - int num56 = num37++; - int num57 = num37++; + int phase2Attack1 = attackIncrement++; + int phase2Attack2 = attackIncrement++; + int phase2Attack3 = attackIncrement++; + int phase2Attack4 = attackIncrement++; + int phase2Attack5 = attackIncrement++; + int phase2Attack6 = attackIncrement++; + int phase2Attack7 = attackIncrement++; + int phase2Attack8 = attackIncrement++; + int phase2Attack9 = attackIncrement++; + int phase2Attack10 = attackIncrement++; - if (num35 % num37 == num48) + if (attackPatternLength % attackIncrement == phase2Attack1) { - num36 = 7; + attackType = 7; // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. calamityGlobalNPC.newAI[2] = Main.rand.Next(2); @@ -282,27 +281,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.SyncExtraAI(); } - if (num35 % num37 == num49) - num36 = 2; + if (attackPatternLength % attackIncrement == phase2Attack2) + attackType = 2; - if (num35 % num37 == num50) - num36 = 8; + if (attackPatternLength % attackIncrement == phase2Attack3) + attackType = 8; - if (num35 % num37 == num52) - num36 = 5; + if (attackPatternLength % attackIncrement == phase2Attack5) + attackType = 5; - if (num35 % num37 == num53) - num36 = 2; + if (attackPatternLength % attackIncrement == phase2Attack6) + attackType = 2; - if (num35 % num37 == num54) - num36 = 6; + if (attackPatternLength % attackIncrement == phase2Attack7) + attackType = 6; - if (num35 % num37 == num54) - num36 = 6; + if (attackPatternLength % attackIncrement == phase2Attack7) + attackType = 6; - if (num35 % num37 == num55) + if (attackPatternLength % attackIncrement == phase2Attack8) { - num36 = 4; + attackType = 4; // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. calamityGlobalNPC.newAI[0] = Main.rand.Next(2); @@ -311,40 +310,40 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.SyncExtraAI(); } - if (num35 % num37 == num56) - num36 = 8; + if (attackPatternLength % attackIncrement == phase2Attack9) + attackType = 8; - if (num35 % num37 == num51) - num36 = 11; + if (attackPatternLength % attackIncrement == phase2Attack4) + attackType = 11; - if (num35 % num37 == num57) - num36 = 12; + if (attackPatternLength % attackIncrement == phase2Attack10) + attackType = 12; } npc.TargetClosest(); NPCAimedTarget targetData5 = npc.GetTargetData(); - bool flag12 = false; + bool despawnFlag = false; if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !bossRush) { if (!Main.dayTime) - flag12 = true; + despawnFlag = true; if (Main.dayTime && Main.time >= 53400.0) - flag12 = true; + despawnFlag = true; } // Despawn. - if (targetData5.Invalid || npc.Distance(targetData5.Center) > despawnDistanceGateValue || flag12) - num36 = 13; + if (targetData5.Invalid || npc.Distance(targetData5.Center) > despawnDistanceGateValue || despawnFlag) + attackType = 13; // Set charge direction. - if (num36 == 8 && targetData5.Center.X > npc.Center.X) - num36 = 9; + if (attackType == 8 && targetData5.Center.X > npc.Center.X) + attackType = 9; - if (num36 != 5 && num36 != 12) + if (attackType != 5 && attackType != 12) npc.velocity = npc.DirectionFrom(targetData5.Center).SafeNormalize(Vector2.Zero).RotatedBy((float)Math.PI / 2f * (targetData5.Center.X > npc.Center.X).ToDirectionInt()) * 24f; - npc.ai[0] = num36; + npc.ai[0] = attackType; npc.ai[1] = 0f; npc.ai[2] += Main.rand.Next(2) + 1f; npc.netUpdate = true; @@ -360,17 +359,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 0f) SoundEngine.PlaySound(SoundID.Item164, npc.Center); - Vector2 value29 = new Vector2(-55f, -30f); + Vector2 randomStreakOffset = new Vector2(-55f, -30f); NPCAimedTarget targetData11 = npc.GetTargetData(); - Vector2 value30 = targetData11.Invalid ? npc.Center : targetData11.Center; - if (npc.Distance(value30 + rainbowStreakDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(value30 + rainbowStreakDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); + Vector2 targetCenter = targetData11.Invalid ? npc.Center : targetData11.Center; + if (npc.Distance(targetCenter + rainbowStreakDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + rainbowStreakDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); if (npc.ai[1] < 60f) - AI_120_HallowBoss_DoMagicEffect(npc.Center + value29, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); + AI_120_HallowBoss_DoMagicEffect(npc.Center + randomStreakOffset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); - int num91 = CalamityWorld.LegendaryMode ? 1 : 2; - if ((int)npc.ai[1] % num91 == 0 && npc.ai[1] < 60f) + int streakSpawnFrequency = CalamityWorld.LegendaryMode ? 1 : 2; + if ((int)npc.ai[1] % streakSpawnFrequency == 0 && npc.ai[1] < 60f) { int projectileType = ProjectileID.HallowBossRainbowStreak; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; @@ -385,7 +384,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + value29, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, ai3); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, ai3); if (Main.rand.NextBool(60) && CalamityWorld.LegendaryMode) { Main.projectile[proj].extraUpdates += 1; @@ -396,11 +395,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn extra homing Rainbow Streaks per player. if (Main.netMode != NetmodeID.MultiplayerClient) { - int num92 = (int)(npc.ai[1] / num91); - for (int num93 = 0; num93 < Main.maxPlayers; num93++) + int multiplayerStreakSpawnFrequency = (int)(npc.ai[1] / streakSpawnFrequency); + for (int i = 0; i < Main.maxPlayers; i++) { - if (npc.Boss_CanShootExtraAt(num93, num92 % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + value29, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, num93, ai3); + if (npc.Boss_CanShootExtraAt(i, multiplayerStreakSpawnFrequency % 3, 3, 2400f)) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, i, ai3); } } } @@ -421,14 +420,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.ai[1] += 1f; NPCAimedTarget targetData8 = npc.GetTargetData(); - Vector2 value19 = targetData8.Invalid ? npc.Center : targetData8.Center; - if (npc.Distance(value19 + phase2AnimationDistance) > num2) - npc.SimpleFlyMovement(npc.DirectionTo(value19 + phase2AnimationDistance).SafeNormalize(Vector2.Zero) * scaleFactor, num); + Vector2 targetCenter = targetData8.Invalid ? npc.Center : targetData8.Center; + if (npc.Distance(targetCenter + phase2AnimationDistance) > 0.5f) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + phase2AnimationDistance).SafeNormalize(Vector2.Zero) * scaleFactor, 4f); if ((int)npc.ai[1] % 180 == 0) { - Vector2 value20 = new Vector2(0f, -100f); - Projectile.NewProjectile(npc.GetSource_FromAI(), targetData8.Center + value20, Vector2.Zero, ProjectileID.HallowBossDeathAurora, num4, 0f, Main.myPlayer); + Vector2 auroraVector = new Vector2(0f, -100f); + Projectile.NewProjectile(npc.GetSource_FromAI(), targetData8.Center + auroraVector, Vector2.Zero, ProjectileID.HallowBossDeathAurora, magicAmt, 0f, Main.myPlayer); } if (npc.ai[1] >= 120f) @@ -457,47 +456,45 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } NPCAimedTarget targetData10 = npc.GetTargetData(); - Vector2 value24 = targetData10.Invalid ? npc.Center : targetData10.Center; - if (npc.Distance(value24 + etherealLanceDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(value24 + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); + Vector2 targetCenter = targetData10.Invalid ? npc.Center : targetData10.Center; + if (npc.Distance(targetCenter + etherealLanceDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); - int num82 = death ? 8 : 12; + int lanceRotation = death ? 8 : 12; if (npc.ai[1] % (dayTimeEnrage ? 2f : 3f) == 0f && npc.ai[1] < 100f) { - int num83 = 1; - for (int n = 0; n < num83; n++) + for (int n = 0; n < 1; n++) { - int num85 = (int)(npc.ai[1] / (dayTimeEnrage ? 2f : 3f)); - Vector2 vector8 = Vector2.UnitX.RotatedBy((float)Math.PI / (num82 * 2) + num85 * ((float)Math.PI / num82)); + int lanceFrequency = (int)(npc.ai[1] / (dayTimeEnrage ? 2f : 3f)); + Vector2 lanceDirection = Vector2.UnitX.RotatedBy((float)Math.PI / (lanceRotation * 2) + lanceFrequency * ((float)Math.PI / lanceRotation)); if (calamityGlobalNPC.newAI[0] == 0f) - vector8.X += (vector8.X > 0f) ? 0.5f : -0.5f; + lanceDirection.X += (lanceDirection.X > 0f) ? 0.5f : -0.5f; - vector8.Normalize(); + lanceDirection.Normalize(); float spawnDistance = 600f; - Vector2 center4 = targetData10.Center; - if (npc.Distance(center4) > 2400f) + Vector2 playerCenter = targetData10.Center; + if (npc.Distance(playerCenter) > 2400f) continue; - if (Vector2.Dot(targetData10.Velocity.SafeNormalize(Vector2.UnitY), vector8) > 0f) - vector8 *= -1f; + if (Vector2.Dot(targetData10.Velocity.SafeNormalize(Vector2.UnitY), lanceDirection) > 0f) + lanceDirection *= -1f; - int num87 = 90; - Vector2 value25 = center4 + targetData10.Velocity * num87; - Vector2 spawnLocation = center4 + vector8 * spawnDistance - targetData10.Velocity * 30f; - if (spawnLocation.Distance(center4) < spawnDistance) + Vector2 targetHoverPos = playerCenter + targetData10.Velocity * 90; + Vector2 spawnLocation = playerCenter + lanceDirection * spawnDistance - targetData10.Velocity * 30f; + if (spawnLocation.Distance(playerCenter) < spawnDistance) { - Vector2 value26 = center4 - spawnLocation; - if (value26 == Vector2.Zero) - value26 = vector8; + Vector2 lanceSpawnDirection = playerCenter - spawnLocation; + if (lanceSpawnDirection == Vector2.Zero) + lanceSpawnDirection = lanceDirection; - spawnLocation = center4 - Vector2.Normalize(value26) * spawnDistance; + spawnLocation = playerCenter - Vector2.Normalize(lanceSpawnDirection) * spawnDistance; } int projectileType = ProjectileID.FairyQueenLance; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - Vector2 v3 = value25 - spawnLocation; + Vector2 v3 = targetHoverPos - spawnLocation; if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / 100f); @@ -505,28 +502,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses continue; // Spawn extra Ethereal Lances per player. - for (int num89 = 0; num89 < Main.maxPlayers; num89++) + for (int j = 0; j < Main.maxPlayers; j++) { - if (!npc.Boss_CanShootExtraAt(num89, num85 % 3, 3, 2400f)) + if (!npc.Boss_CanShootExtraAt(j, lanceFrequency % 3, 3, 2400f)) continue; - Player player2 = Main.player[num89]; - center4 = player2.Center; - if (Vector2.Dot(player2.velocity.SafeNormalize(Vector2.UnitY), vector8) > 0f) - vector8 *= -1f; + Player extraPlayer = Main.player[j]; + playerCenter = extraPlayer.Center; + if (Vector2.Dot(extraPlayer.velocity.SafeNormalize(Vector2.UnitY), lanceDirection) > 0f) + lanceDirection *= -1f; - Vector2 value27 = center4 + player2.velocity * num87; - spawnLocation = center4 + vector8 * spawnDistance - player2.velocity * 30f; - if (spawnLocation.Distance(center4) < spawnDistance) + Vector2 extraPlayerSpawnLocation = playerCenter + extraPlayer.velocity * 90; + spawnLocation = playerCenter + lanceDirection * spawnDistance - extraPlayer.velocity * 30f; + if (spawnLocation.Distance(playerCenter) < spawnDistance) { - Vector2 value28 = center4 - spawnLocation; - if (value28 == Vector2.Zero) - value28 = vector8; + Vector2 extraPlayerSpawnDirection = playerCenter - spawnLocation; + if (extraPlayerSpawnDirection == Vector2.Zero) + extraPlayerSpawnDirection = lanceDirection; - spawnLocation = center4 - Vector2.Normalize(value28) * spawnDistance; + spawnLocation = playerCenter - Vector2.Normalize(extraPlayerSpawnDirection) * spawnDistance; } - v3 = value27 - spawnLocation; + v3 = extraPlayerSpawnLocation - spawnLocation; Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / 100f); } } @@ -556,19 +553,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 0f) SoundEngine.PlaySound(SoundID.Item163, npc.Center); - Vector2 value16 = new Vector2(55f, -30f); - Vector2 value17 = npc.Center + value16; + Vector2 magicSpawnOffset = new Vector2(55f, -30f); + Vector2 everlastingRainbowSpawn = npc.Center + magicSpawnOffset; if (npc.ai[1] < 42f) - AI_120_HallowBoss_DoMagicEffect(npc.Center + value16, 3, Utils.GetLerpValue(0f, 42f, npc.ai[1], clamped: true), npc); + AI_120_HallowBoss_DoMagicEffect(npc.Center + magicSpawnOffset, 3, Utils.GetLerpValue(0f, 42f, npc.ai[1], clamped: true), npc); NPCAimedTarget targetData7 = npc.GetTargetData(); - Vector2 value18 = targetData7.Invalid ? npc.Center : targetData7.Center; - if (npc.Distance(value18 + everlastingRainbowDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(value18 + everlastingRainbowDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); + Vector2 targetCenter = targetData7.Invalid ? npc.Center : targetData7.Center; + if (npc.Distance(targetCenter + everlastingRainbowDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + everlastingRainbowDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); if (npc.ai[1] % 42f == 0f && npc.ai[1] < 42f) { - float num64 = (float)Math.PI * 2f * Main.rand.NextFloat(); + float projRotation = (float)Math.PI * 2f * Main.rand.NextFloat(); float totalProjectiles = CalamityWorld.LegendaryMode ? 30f : death ? (dayTimeEnrage ? 22f : 15f) : (dayTimeEnrage ? 18f : 13f); int projIndex = 0; bool inversePhase2SpreadPattern = Main.rand.NextBool(); @@ -577,8 +574,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int projectileType = ProjectileID.HallowBossLastingRainbow; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - float num66 = i; - Vector2 spinningpoint = Vector2.UnitY.RotatedBy((float)Math.PI / 2f + (float)Math.PI * 2f * num66 + num64); + float projRotationMultiplier = i; + Vector2 spinningpoint = Vector2.UnitY.RotatedBy((float)Math.PI / 2f + (float)Math.PI * 2f * projRotationMultiplier + projRotation); float initialVelocity = death ? 2f : 1.75f; if (dayTimeEnrage && projIndex % 2 == 0) @@ -597,7 +594,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), value17 + spinningpoint.RotatedBy(-MathHelper.PiOver2) * 30f, spinningpoint * initialVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, 0f, num66); + Projectile.NewProjectile(npc.GetSource_FromAI(), everlastingRainbowSpawn + spinningpoint.RotatedBy(-MathHelper.PiOver2) * 30f, spinningpoint * initialVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, 0f, projRotationMultiplier); projIndex++; } @@ -627,27 +624,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float sunDanceGateValue = dayTimeEnrage ? 35f : death ? 40f : 50f; float totalSunDancePhaseTime = totalSunDances * sunDanceGateValue; - Vector2 value7 = new Vector2(0f, -100f); - Vector2 position = npc.Center + value7; + Vector2 sunDanceHoverOffset = new Vector2(0f, -100f); + Vector2 position = npc.Center + sunDanceHoverOffset; NPCAimedTarget targetData2 = npc.GetTargetData(); - Vector2 value8 = targetData2.Invalid ? npc.Center : targetData2.Center; - if (npc.Distance(value8 + sunDanceDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(value8 + sunDanceDistance).SafeNormalize(Vector2.Zero) * velocity * 0.3f, acceleration * 0.7f); + Vector2 targetCenter = targetData2.Invalid ? npc.Center : targetData2.Center; + if (npc.Distance(targetCenter + sunDanceDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + sunDanceDistance).SafeNormalize(Vector2.Zero) * velocity * 0.3f, acceleration * 0.7f); if (npc.ai[1] % sunDanceGateValue == 0f && npc.ai[1] < totalSunDancePhaseTime) { int projectileType = ProjectileID.FairyQueenSunDance; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - int num25 = (int)(npc.ai[1] / sunDanceGateValue); - int num26 = (targetData2.Center.X > npc.Center.X) ? 1 : 0; - float num27 = phase2 ? 8f : 6f; - float num28 = 1f / num27; - for (float num29 = 0f; num29 < 1f; num29 += num28) + int sunDanceDistance = (int)(npc.ai[1] / sunDanceGateValue); + int targetFloatDirection = (targetData2.Center.X > npc.Center.X) ? 1 : 0; + float projAmount = phase2 ? 8f : 6f; + float projRotation = 1f / projAmount; + for (float j = 0f; j < 1f; j += projRotation) { - float num30 = (num29 + num28 * 0.5f + num25 * num28 * 0.5f) % 1f; - float ai = (float)Math.PI * 2f * (num30 + num26); + float projDirection = (j + projRotation * 0.5f + sunDanceDistance * projRotation * 0.5f) % 1f; + float ai = (float)Math.PI * 2f * (projDirection + targetFloatDirection); if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(npc.GetSource_FromAI(), position, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, ai, npc.whoAmI); } @@ -697,9 +694,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.Distance(center3) <= 3200f) { Vector2 lanceWallStartingPosition = Vector2.Zero; - Vector2 vector6 = Vector2.UnitY; - float num77 = 0.4f; - float num78 = 1.4f; + Vector2 lanceWallDirection = Vector2.UnitY; + float lanceWallConvergence = 0.4f; + float lanceWallSizeMult = 1.4f; totalProjectiles += 5f; lanceSpacing += 50f; lanceWallSize *= 0.5f; @@ -722,37 +719,37 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case 0: center3 += new Vector2((0f - lanceWallSize) / 2f, 0f); lanceWallStartingPosition = new Vector2(0f, lanceWallSize); - vector6 = Vector2.UnitX; + lanceWallDirection = Vector2.UnitX; break; case 1: center3 += new Vector2(lanceWallSize / 2f, lanceSpacing / 2f); lanceWallStartingPosition = new Vector2(0f, lanceWallSize); - vector6 = -Vector2.UnitX; + lanceWallDirection = -Vector2.UnitX; break; case 2: - center3 += new Vector2(0f - lanceWallSize, 0f - lanceWallSize) * num77; - lanceWallStartingPosition = new Vector2(lanceWallSize * num78, 0f); - vector6 = new Vector2(1f, 1f); + center3 += new Vector2(0f - lanceWallSize, 0f - lanceWallSize) * lanceWallConvergence; + lanceWallStartingPosition = new Vector2(lanceWallSize * lanceWallSizeMult, 0f); + lanceWallDirection = new Vector2(1f, 1f); break; case 3: - center3 += new Vector2(lanceWallSize * num77 + lanceSpacing / 2f, (0f - lanceWallSize) * num77); - lanceWallStartingPosition = new Vector2((0f - lanceWallSize) * num78, 0f); - vector6 = new Vector2(-1f, 1f); + center3 += new Vector2(lanceWallSize * lanceWallConvergence + lanceSpacing / 2f, (0f - lanceWallSize) * lanceWallConvergence); + lanceWallStartingPosition = new Vector2((0f - lanceWallSize) * lanceWallSizeMult, 0f); + lanceWallDirection = new Vector2(-1f, 1f); break; case 4: - center3 += new Vector2(0f - lanceWallSize, lanceWallSize) * num77; - lanceWallStartingPosition = new Vector2(lanceWallSize * num78, 0f); - vector6 = center3.DirectionTo(targetData9.Center); + center3 += new Vector2(0f - lanceWallSize, lanceWallSize) * lanceWallConvergence; + lanceWallStartingPosition = new Vector2(lanceWallSize * lanceWallSizeMult, 0f); + lanceWallDirection = center3.DirectionTo(targetData9.Center); break; case 5: - center3 += new Vector2(lanceWallSize * num77 + lanceSpacing / 2f, lanceWallSize * num77); - lanceWallStartingPosition = new Vector2((0f - lanceWallSize) * num78, 0f); - vector6 = center3.DirectionTo(targetData9.Center); + center3 += new Vector2(lanceWallSize * lanceWallConvergence + lanceSpacing / 2f, lanceWallSize * lanceWallConvergence); + lanceWallStartingPosition = new Vector2((0f - lanceWallSize) * lanceWallSizeMult, 0f); + lanceWallDirection = center3.DirectionTo(targetData9.Center); break; } @@ -762,12 +759,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (float i = 0f; i <= 1f; i += 1f / totalProjectiles) { Vector2 spawnLocation = center3 + lanceWallStartingPosition * (i - 0.5f) * (expertAttack ? 1f : 2f); - Vector2 v2 = vector6; + Vector2 v2 = lanceWallDirection; if (expertAttack) { - Vector2 value22 = targetData9.Velocity * 20f * i; - Vector2 value23 = spawnLocation.DirectionTo(targetData9.Center + value22); - v2 = Vector2.Lerp(vector6, value23, 0.75f).SafeNormalize(Vector2.UnitY); + Vector2 lanceWallSpawnPredictiveness = targetData9.Velocity * 20f * i; + Vector2 lanceWallSpawnLocation = spawnLocation.DirectionTo(targetData9.Center + lanceWallSpawnPredictiveness); + v2 = Vector2.Lerp(lanceWallDirection, lanceWallSpawnLocation, 0.75f).SafeNormalize(Vector2.UnitY); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -804,7 +801,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses takeDamage = !(npc.ai[1] >= 6f) || !(npc.ai[1] <= 40f); - int num32 = (npc.ai[0] != 8f) ? 1 : (-1); + int chargeDirection = (npc.ai[0] != 8f) ? 1 : (-1); AI_120_HallowBoss_DoMagicEffect(npc.Center, 5, Utils.GetLerpValue(40f, 90f, npc.ai[1], clamped: true), npc); @@ -819,7 +816,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.Item160, npc.Center); NPCAimedTarget targetData3 = npc.GetTargetData(); - destination = (targetData3.Invalid ? npc.Center : targetData3.Center) + new Vector2(num32 * -800f, 0f); + destination = (targetData3.Invalid ? npc.Center : targetData3.Center) + new Vector2(chargeDirection * -800f, 0f); npc.SimpleFlyMovement(npc.DirectionTo(destination).SafeNormalize(Vector2.Zero) * velocity, acceleration * 2f); if (npc.ai[1] == chargeGateValue) @@ -862,16 +859,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn extra homing Rainbow Streaks per player. if (Main.netMode != NetmodeID.MultiplayerClient) { - int num92 = (int)((npc.ai[1] - chargeGateValue - 1f) / rainbowStreakGateValue); - for (int num93 = 0; num93 < Main.maxPlayers; num93++) + int multiplayerStreakSpawnFrequency = (int)((npc.ai[1] - chargeGateValue - 1f) / rainbowStreakGateValue); + for (int i = 0; i < Main.maxPlayers; i++) { - if (npc.Boss_CanShootExtraAt(num93, num92 % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, num93, ai3); + if (npc.Boss_CanShootExtraAt(i, multiplayerStreakSpawnFrequency % 3, 3, 2400f)) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, i, ai3); } } } - npc.velocity = Vector2.Lerp(value2: new Vector2(num32 * 70f, 0f), value1: npc.velocity, amount: 0.05f); + npc.velocity = Vector2.Lerp(value2: new Vector2(chargeDirection * 70f, 0f), value1: npc.velocity, amount: 0.05f); if (npc.ai[1] == chargeGateValue + chargeDuration) npc.velocity *= 0.45f; @@ -949,9 +946,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } NPCAimedTarget targetData6 = npc.GetTargetData(); - Vector2 value11 = targetData6.Invalid ? npc.Center : targetData6.Center; - if (npc.Distance(value11 + etherealLanceDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(value11 + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); + Vector2 targetCenter = targetData6.Invalid ? npc.Center : targetData6.Center; + if (npc.Distance(targetCenter + etherealLanceDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); float etherealLanceGateValue = death ? 5f : 6f; if (dayTimeEnrage) @@ -959,63 +956,60 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] % etherealLanceGateValue == 0f && npc.ai[1] < 100f) { - int num59 = 3; - for (int k = 0; k < num59; k++) + for (int k = 0; k < 3; k++) { - Vector2 vector3 = -targetData6.Velocity; - vector3.SafeNormalize(-Vector2.UnitY); + Vector2 inverseTargetVel = -targetData6.Velocity; + inverseTargetVel.SafeNormalize(-Vector2.UnitY); float spawnDistance = 100f + (k * 100f); - Vector2 center2 = targetData6.Center; - if (npc.Distance(center2) > 2400f) + Vector2 targetCenter = targetData6.Center; + if (npc.Distance(targetCenter) > 2400f) continue; - int num61 = 90; - Vector2 value12 = center2 + targetData6.Velocity * num61; - Vector2 vector4 = center2 + vector3 * spawnDistance; - if (vector4.Distance(center2) < spawnDistance) + Vector2 straightLanceSpawnPredict = targetCenter + targetData6.Velocity * 90; + Vector2 straightLanceSpawnDirection = targetCenter + inverseTargetVel * spawnDistance; + if (straightLanceSpawnDirection.Distance(targetCenter) < spawnDistance) { - Vector2 value13 = center2 - vector4; - if (value13 == Vector2.Zero) - value13 = vector3; + Vector2 straightLanceSpawnLocation = targetCenter - straightLanceSpawnDirection; + if (straightLanceSpawnLocation == Vector2.Zero) + straightLanceSpawnLocation = inverseTargetVel; - vector4 = center2 - Vector2.Normalize(value13) * spawnDistance; + straightLanceSpawnDirection = targetCenter - Vector2.Normalize(straightLanceSpawnLocation) * spawnDistance; } int projectileType = ProjectileID.FairyQueenLance; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - Vector2 v = value12 - vector4; + Vector2 v = straightLanceSpawnPredict - straightLanceSpawnDirection; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector4, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v.ToRotation(), npc.ai[1] / 100f); + Projectile.NewProjectile(npc.GetSource_FromAI(), straightLanceSpawnDirection, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v.ToRotation(), npc.ai[1] / 100f); if (Main.netMode == NetmodeID.MultiplayerClient) continue; - int num62 = (int)(npc.ai[1] / etherealLanceGateValue); + int multiplayerExtraStraightLances = (int)(npc.ai[1] / etherealLanceGateValue); for (int l = 0; l < Main.maxPlayers; l++) { - if (!npc.Boss_CanShootExtraAt(l, num62 % 3, 3, 2400f)) + if (!npc.Boss_CanShootExtraAt(l, multiplayerExtraStraightLances % 3, 3, 2400f)) continue; Player player = Main.player[l]; - vector3 = -player.velocity; - vector3.SafeNormalize(-Vector2.UnitY); - center2 = player.Center; - num61 = 90; - Vector2 value14 = center2 + player.velocity * num61; - vector4 = center2 + vector3 * spawnDistance; - if (vector4.Distance(center2) < spawnDistance) + inverseTargetVel = -player.velocity; + inverseTargetVel.SafeNormalize(-Vector2.UnitY); + targetCenter = player.Center; + Vector2 extraPlayerLancePredict = targetCenter + player.velocity * 90; + straightLanceSpawnDirection = targetCenter + inverseTargetVel * spawnDistance; + if (straightLanceSpawnDirection.Distance(targetCenter) < spawnDistance) { - Vector2 value15 = center2 - vector4; - if (value15 == Vector2.Zero) - value15 = vector3; + Vector2 extraPlayerLanceSpawnLocation = targetCenter - straightLanceSpawnDirection; + if (extraPlayerLanceSpawnLocation == Vector2.Zero) + extraPlayerLanceSpawnLocation = inverseTargetVel; - vector4 = center2 - Vector2.Normalize(value15) * spawnDistance; + straightLanceSpawnDirection = targetCenter - Vector2.Normalize(extraPlayerLanceSpawnLocation) * spawnDistance; } - v = value14 - vector4; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector4, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v.ToRotation(), npc.ai[1] / 100f); + v = extraPlayerLancePredict - straightLanceSpawnDirection; + Projectile.NewProjectile(npc.GetSource_FromAI(), straightLanceSpawnDirection, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v.ToRotation(), npc.ai[1] / 100f); } } } @@ -1037,7 +1031,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Avoid cheap bullshit. npc.damage = 0; - Vector2 value6 = new Vector2(-55f, -30f); + Vector2 projRandomOffset = new Vector2(-55f, -30f); if (npc.ai[1] == 0f) { @@ -1047,24 +1041,24 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity *= 0.95f; - bool flag11 = npc.ai[1] < 60f && npc.ai[1] >= 10f; - if (flag11) - AI_120_HallowBoss_DoMagicEffect(npc.Center + value6, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); + bool shouldSpawnStreaks = npc.ai[1] < 60f && npc.ai[1] >= 10f; + if (shouldSpawnStreaks) + AI_120_HallowBoss_DoMagicEffect(npc.Center + projRandomOffset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); - int num21 = 4; + int stationaryStreakSpawnFrequency = 4; if (dayTimeEnrage) - num21 -= 1; + stationaryStreakSpawnFrequency -= 1; - float num22 = (npc.ai[1] - 10f) / 50f; - if ((int)npc.ai[1] % num21 == 0 && flag11) + float streakHomeTime = (npc.ai[1] - 10f) / 50f; + if ((int)npc.ai[1] % stationaryStreakSpawnFrequency == 0 && shouldSpawnStreaks) { int projectileType = ProjectileID.HallowBossRainbowStreak; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - Vector2 vector = new Vector2(0f, death ? -24f : -22f).RotatedBy((float)Math.PI * 2f * num22); + Vector2 vector = new Vector2(0f, death ? -24f : -22f).RotatedBy((float)Math.PI * 2f * streakHomeTime); if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + value6, vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, num22); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, streakHomeTime); if (Main.rand.NextBool(15) && CalamityWorld.LegendaryMode) { Main.projectile[proj].extraUpdates += 1; @@ -1075,11 +1069,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn extra homing Rainbow Streaks per player. if (Main.netMode != NetmodeID.MultiplayerClient) { - int num23 = (int)(npc.ai[1] % num21); + int extraStationaryStreakSpawnFrequency = (int)(npc.ai[1] % stationaryStreakSpawnFrequency); for (int j = 0; j < Main.maxPlayers; j++) { - if (npc.Boss_CanShootExtraAt(j, num23 % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + value6, vector, projectileType, projectileDamage, 0f, Main.myPlayer, j, num22); + if (npc.Boss_CanShootExtraAt(j, extraStationaryStreakSpawnFrequency % 3, 3, 2400f)) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, vector, projectileType, projectileDamage, 0f, Main.myPlayer, j, streakHomeTime); } } } @@ -1114,47 +1108,47 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses visible = false; - bool flag7 = false; - bool flag8 = false; - if (!flag7) + bool trueDespawnFlag = false; + bool shouldDespawn = false; + if (!trueDespawnFlag) { if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !bossRush) { if (!Main.dayTime) - flag8 = true; + shouldDespawn = true; if (Main.dayTime && Main.time >= 53400.0) - flag8 = true; + shouldDespawn = true; } - flag7 = flag7 || flag8; + trueDespawnFlag = trueDespawnFlag || shouldDespawn; } - if (!flag7) + if (!trueDespawnFlag) { - bool flag9 = targetData.Invalid || npc.Distance(targetData.Center) > despawnDistanceGateValue; - flag7 = flag7 || flag9; + bool hasNoTarget = targetData.Invalid || npc.Distance(targetData.Center) > despawnDistanceGateValue; + trueDespawnFlag = trueDespawnFlag || hasNoTarget; } - npc.alpha = Utils.Clamp(npc.alpha + flag7.ToDirectionInt() * 5, 0, 255); - bool flag10 = npc.alpha == 0 || npc.alpha == 255; + npc.alpha = Utils.Clamp(npc.alpha + trueDespawnFlag.ToDirectionInt() * 5, 0, 255); + bool alphaExtreme = npc.alpha == 0 || npc.alpha == 255; - int num17 = 5; - for (int i = 0; i < num17; i++) + int despawnDustAmt = 5; + for (int i = 0; i < despawnDustAmt; i++) { - float num18 = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity); + float despawnDustOpacity = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity); Color newColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); - int num19 = Dust.NewDust(npc.position - npc.Size * 0.5f, npc.width * 2, npc.height * 2, 267, 0f, 0f, 0, newColor); - Main.dust[num19].position = npc.Center + Main.rand.NextVector2Circular(npc.width, npc.height); - Main.dust[num19].velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[num19].noGravity = true; - Main.dust[num19].scale = 0.9f + Main.rand.NextFloat() * 1.2f; - Main.dust[num19].fadeIn = 0.4f + Main.rand.NextFloat() * 1.2f * num18; - Main.dust[num19].velocity += Vector2.UnitY * -2f; - Main.dust[num19].scale = 0.35f; - if (num19 != 6000) + int despawnRainbowDust = Dust.NewDust(npc.position - npc.Size * 0.5f, npc.width * 2, npc.height * 2, 267, 0f, 0f, 0, newColor); + Main.dust[despawnRainbowDust].position = npc.Center + Main.rand.NextVector2Circular(npc.width, npc.height); + Main.dust[despawnRainbowDust].velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[despawnRainbowDust].noGravity = true; + Main.dust[despawnRainbowDust].scale = 0.9f + Main.rand.NextFloat() * 1.2f; + Main.dust[despawnRainbowDust].fadeIn = 0.4f + Main.rand.NextFloat() * 1.2f * despawnDustOpacity; + Main.dust[despawnRainbowDust].velocity += Vector2.UnitY * -2f; + Main.dust[despawnRainbowDust].scale = 0.35f; + if (despawnRainbowDust != 6000) { - Dust dust = Dust.CloneDust(num19); + Dust dust = Dust.CloneDust(despawnRainbowDust); dust.scale /= 2f; dust.fadeIn *= 0.85f; dust.color = new Color(255, 255, 255, 255); @@ -1162,7 +1156,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } npc.ai[1] += 1f; - if (!(npc.ai[1] >= 20f && flag10)) + if (!(npc.ai[1] >= 20f && alphaExtreme)) break; if (npc.alpha == 255) @@ -1200,51 +1194,51 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses private static void AI_120_HallowBoss_DoMagicEffect(Vector2 spot, int effectType, float progress, NPC npc) { - float num = 4f; - float num2 = 1f; + float magicDustSpawnArea = 4f; + float magicDustColorMult = 1f; float fadeIn = 0f; - float num3 = 0.5f; - int num4 = 2; - int num5 = 267; + float magicDustPosChange = 0.5f; + int magicAmt = 2; + int magicDustType = 267; switch (effectType) { case 1: - num2 = 0.5f; + magicDustColorMult = 0.5f; fadeIn = 2f; - num3 = 0f; + magicDustPosChange = 0f; break; case 2: case 4: - num = 50f; - num2 = 0.5f; + magicDustSpawnArea = 50f; + magicDustColorMult = 0.5f; fadeIn = 0f; - num3 = 0f; - num4 = 4; + magicDustPosChange = 0f; + magicAmt = 4; break; case 3: - num = 30f; - num2 = 0.1f; + magicDustSpawnArea = 30f; + magicDustColorMult = 0.1f; fadeIn = 2.5f; - num3 = 0f; + magicDustPosChange = 0f; break; case 5: if (progress == 0f) { - num4 = 0; + magicAmt = 0; } else { - num4 = 5; - num5 = Main.rand.Next(86, 92); + magicAmt = 5; + magicDustType = Main.rand.Next(86, 92); } if (progress >= 1f) - num4 = 0; + magicAmt = 0; break; } - for (int i = 0; i < num4; i++) + for (int i = 0; i < magicAmt; i++) { - Dust dust = Dust.NewDustPerfect(spot, num5, Main.rand.NextVector2CircularEdge(num, num) * (Main.rand.NextFloat() * (1f - num3) + num3), 0, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), (Main.rand.NextFloat() * 2f + 2f) * num2); + Dust dust = Dust.NewDustPerfect(spot, magicDustType, Main.rand.NextVector2CircularEdge(magicDustSpawnArea, magicDustSpawnArea) * (Main.rand.NextFloat() * (1f - magicDustPosChange) + magicDustPosChange), 0, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), (Main.rand.NextFloat() * 2f + 2f) * magicDustColorMult); dust.fadeIn = fadeIn; dust.noGravity = true; switch (effectType) @@ -1256,11 +1250,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses dust.scale = 3f * Utils.GetLerpValue(0.7f, 0f, progress, clamped: true) * Utils.GetLerpValue(0f, 0.3f, progress, clamped: true); dust.velocity = ((float)Math.PI * 2f * (i / 4f) + (float)Math.PI / 4f).ToRotationVector2() * 8f * Utils.GetLerpValue(1f, 0f, progress, clamped: true); dust.velocity += npc.velocity * 0.3f; - float num6 = 0f; + float magicDustColorChange = 0f; if (effectType == 4) - num6 = 0.5f; + magicDustColorChange = 0.5f; - dust.color = Main.hslToRgb((i / 5f + num6 + progress * 0.5f) % 1f, 1f, 0.5f); + dust.color = Main.hslToRgb((i / 5f + magicDustColorChange + progress * 0.5f) % 1f, 1f, 0.5f); dust.color.A /= 2; dust.alpha = 127; break; From 0b0c1ab1e98c49a07526014d523be50c4e8ae182 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 25 Oct 2023 17:47:15 -0400 Subject: [PATCH 21/43] Eye of Cthulhu, Golem, King Slime --- .../Bosses/EyeOfCthulhuAI.cs | 210 ++++--- NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs | 524 +++++++++--------- .../VanillaNPCOverrides/Bosses/KingSlimeAI.cs | 128 ++--- 3 files changed, 428 insertions(+), 434 deletions(-) diff --git a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs index 9ba225d43b..64d91c5d5d 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool phase3 = lifeRatio < 0.65f; bool phase4 = lifeRatio < 0.55f; bool phase5 = lifeRatio < 0.4f; - float num5 = death ? 15f : 20f; + float lineUpDist = death ? 15f : 20f; float enrageScale = bossRush ? 1f : 0f; if (Main.dayTime || bossRush) @@ -44,58 +44,58 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); bool dead = Main.player[npc.target].dead; - float num6 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); - float num7 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); - float num8 = (float)Math.Atan2(num7, num6) + MathHelper.PiOver2; + float targetXDistance = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float targetYDistance = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + float eyeRotation = (float)Math.Atan2(targetYDistance, targetXDistance) + MathHelper.PiOver2; - if (num8 < 0f) - num8 += MathHelper.TwoPi; - else if (num8 > MathHelper.TwoPi) - num8 -= MathHelper.TwoPi; + if (eyeRotation < 0f) + eyeRotation += MathHelper.TwoPi; + else if (eyeRotation > MathHelper.TwoPi) + eyeRotation -= MathHelper.TwoPi; - float num9 = 0f; + float eyeRotationAcceleration = 0f; if (npc.ai[0] == 0f && npc.ai[1] == 0f) - num9 = 0.02f; + eyeRotationAcceleration = 0.02f; if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) - num9 = 0.05f; + eyeRotationAcceleration = 0.05f; if (npc.ai[0] == 3f && npc.ai[1] == 0f) - num9 = 0.05f; + eyeRotationAcceleration = 0.05f; if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) - num9 = 0.08f; - if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > num5) - num9 = 0.15f; + eyeRotationAcceleration = 0.08f; + if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > lineUpDist) + eyeRotationAcceleration = 0.15f; if (npc.ai[0] == 3f && npc.ai[1] == 5f) - num9 = 0.05f; - num9 *= 1.5f; + eyeRotationAcceleration = 0.05f; + eyeRotationAcceleration *= 1.5f; - if (npc.rotation < num8) + if (npc.rotation < eyeRotation) { - if ((num8 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num9; + if ((eyeRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= eyeRotationAcceleration; else - npc.rotation += num9; + npc.rotation += eyeRotationAcceleration; } - else if (npc.rotation > num8) + else if (npc.rotation > eyeRotation) { - if ((npc.rotation - num8) > MathHelper.Pi) - npc.rotation += num9; + if ((npc.rotation - eyeRotation) > MathHelper.Pi) + npc.rotation += eyeRotationAcceleration; else - npc.rotation -= num9; + npc.rotation -= eyeRotationAcceleration; } - if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) - npc.rotation = num8; + if (npc.rotation > eyeRotation - eyeRotationAcceleration && npc.rotation < eyeRotation + eyeRotationAcceleration) + npc.rotation = eyeRotation; if (npc.rotation < 0f) npc.rotation += MathHelper.TwoPi; else if (npc.rotation > MathHelper.TwoPi) npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) - npc.rotation = num8; + if (npc.rotation > eyeRotation - eyeRotationAcceleration && npc.rotation < eyeRotation + eyeRotationAcceleration) + npc.rotation = eyeRotation; if (Main.rand.NextBool(5)) { - int num10 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); - Dust dust = Main.dust[num10]; + int randomBlood = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); + Dust dust = Main.dust[randomBlood]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; } @@ -134,8 +134,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.SimpleFlyMovement(idealVelocity, hoverAcceleration); npc.ai[2] += 1f; - float num17 = 180f - (death ? 200f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= num17) + float attackSwitchTimer = 180f - (death ? 200f * (1f - lifeRatio) : 0f); + if (npc.ai[2] >= attackSwitchTimer) { npc.ai[1] = 1f; npc.ai[2] = 0f; @@ -155,7 +155,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[3] >= servantSpawnGateValue) { npc.ai[3] = 0f; - npc.rotation = num8; + npc.rotation = eyeRotation; Vector2 servantSpawnVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 6f; Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity * 10f; @@ -170,18 +170,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.NPCHit1, servantSpawnCenter); - int num; - for (int m = 0; m < 10; m = num + 1) + int servantDust; + for (int m = 0; m < 10; m = servantDust + 1) { Dust.NewDust(servantSpawnCenter, 20, 20, 5, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); - num = m; + servantDust = m; } } } } else if (npc.ai[1] == 1f) { - npc.rotation = num8; + npc.rotation = eyeRotation; float chargeSpeed = 8f; chargeSpeed += 5f * enrageScale; if (death) @@ -214,18 +214,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - int num28 = 90; + int chargeDelay = 90; if (death) - num28 -= (int)Math.Round(120f * (1f - lifeRatio)); + chargeDelay -= (int)Math.Round(120f * (1f - lifeRatio)); if (Main.getGoodWorld) - num28 -= 15; + chargeDelay -= 15; - if (npc.ai[2] >= num28) + if (npc.ai[2] >= chargeDelay) { npc.ai[3] += 1f; npc.ai[2] = 0f; npc.TargetClosest(); - npc.rotation = num8; + npc.rotation = eyeRotation; if (npc.ai[3] >= 3f) { @@ -280,12 +280,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity * 10f; if (Main.netMode != NetmodeID.MultiplayerClient) { - int num34 = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num34].velocity.X = servantSpawnVelocity.X; - Main.npc[num34].velocity.Y = servantSpawnVelocity.Y; + int servantSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[servantSpawn].velocity.X = servantSpawnVelocity.X; + Main.npc[servantSpawn].velocity.Y = servantSpawnVelocity.Y; - if (Main.netMode == NetmodeID.Server && num34 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num34, 0f, 0f, 0f, 0, 0, 0); + if (Main.netMode == NetmodeID.Server && servantSpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, servantSpawn, 0f, 0f, 0f, 0, 0, 0); if (CalamityWorld.LegendaryMode) { @@ -323,7 +323,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.Server) { - for (int num35 = 0; num35 < 2; num35++) + for (int phase2Gore = 0; phase2Gore < 2; phase2Gore++) { Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 8, 1f); Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); @@ -331,7 +331,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - for (int num36 = 0; num36 < 20; num36++) + for (int i = 0; i < 20; i++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); } @@ -417,7 +417,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 1f) { SoundEngine.PlaySound(SoundID.ForceRoar, npc.position); - npc.rotation = num8; + npc.rotation = eyeRotation; float chargeSpeed = 6.2f + 4f * (0.75f - lifeRatio); chargeSpeed += 4f * enrageScale; @@ -440,10 +440,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 2f) { - float num46 = 60f; - npc.ai[2] += 1f; - if (npc.ai[2] >= num46) + if (npc.ai[2] >= 60f) { npc.velocity *= 0.96f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) @@ -454,16 +452,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - int num47 = 80; + int phase2ChargeDelay = 80; if (death) - num47 -= (int)Math.Round(40f * (0.75f - lifeRatio)); + phase2ChargeDelay -= (int)Math.Round(40f * (0.75f - lifeRatio)); - if (npc.ai[2] >= num47) + if (npc.ai[2] >= phase2ChargeDelay) { npc.ai[3] += 1f; npc.ai[2] = 0f; npc.TargetClosest(); - npc.rotation = num8; + npc.rotation = eyeRotation; if (npc.ai[3] >= 3f) { @@ -500,68 +498,68 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (Main.netMode != NetmodeID.MultiplayerClient) { float speedBoost = death ? 5f * (0.65f - lifeRatio) : 3.5f * (0.65f - lifeRatio); - float num48 = 18f + speedBoost; - num48 += 10f * enrageScale; + float finalChargeSpeed = 18f + speedBoost; + finalChargeSpeed += 10f * enrageScale; - Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num49 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector10.X; - float num50 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector10.Y; - float num51 = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; - num51 += 10f - num51; + Vector2 eyeChargeDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float targetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyeChargeDirection.X; + float targetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - eyeChargeDirection.Y; + float targetVelocity = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; + targetVelocity += 10f - targetVelocity; - if (num51 < 5f) - num51 = 5f; - if (num51 > 15f) - num51 = 15f; + if (targetVelocity < 5f) + targetVelocity = 5f; + if (targetVelocity > 15f) + targetVelocity = 15f; if (npc.ai[2] == -1f) { - num51 *= 4f; - num48 *= 1.3f; + targetVelocity *= 4f; + finalChargeSpeed *= 1.3f; } - num49 -= Main.player[npc.target].velocity.X * num51; - num50 -= Main.player[npc.target].velocity.Y * num51 / 4f; - num49 *= 1f + Main.rand.Next(-10, 11) * 0.01f; - num50 *= 1f + Main.rand.Next(-10, 11) * 0.01f; + targetX -= Main.player[npc.target].velocity.X * targetVelocity; + targetY -= Main.player[npc.target].velocity.Y * targetVelocity / 4f; + targetX *= 1f + Main.rand.Next(-10, 11) * 0.01f; + targetY *= 1f + Main.rand.Next(-10, 11) * 0.01f; - float num52 = (float)Math.Sqrt(num49 * num49 + num50 * num50); - float num53 = num52; + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float targetDistCopy = targetDistance; - num52 = num48 / num52; - npc.velocity.X = num49 * num52; - npc.velocity.Y = num50 * num52; + targetDistance = finalChargeSpeed / targetDistance; + npc.velocity.X = targetX * targetDistance; + npc.velocity.Y = targetY * targetDistance; npc.velocity.X += Main.rand.Next(-20, 21) * 0.1f; npc.velocity.Y += Main.rand.Next(-20, 21) * 0.1f; - if (num53 < 100f) + if (targetDistCopy < 100f) { if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) { - float num56 = Math.Abs(npc.velocity.X); - float num57 = Math.Abs(npc.velocity.Y); + float absoluteXVel = Math.Abs(npc.velocity.X); + float absoluteYVel = Math.Abs(npc.velocity.Y); if (npc.Center.X > Main.player[npc.target].Center.X) - num57 *= -1f; + absoluteYVel *= -1f; if (npc.Center.Y > Main.player[npc.target].Center.Y) - num56 *= -1f; + absoluteXVel *= -1f; - npc.velocity.X = num57; - npc.velocity.Y = num56; + npc.velocity.X = absoluteYVel; + npc.velocity.Y = absoluteXVel; } } else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) { - float num58 = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; - float num59 = num58; + float absoluteEyeVel = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; + float absoluteEyeVelBackup = absoluteEyeVel; if (npc.Center.X > Main.player[npc.target].Center.X) - num59 *= -1f; + absoluteEyeVelBackup *= -1f; if (npc.Center.Y > Main.player[npc.target].Center.Y) - num58 *= -1f; + absoluteEyeVel *= -1f; - npc.velocity.X = num59; - npc.velocity.Y = num58; + npc.velocity.X = absoluteEyeVelBackup; + npc.velocity.Y = absoluteEyeVel; } npc.ai[1] = 4f; @@ -577,13 +575,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.ForceRoar, npc.position); - float num60 = num5; + float lineUpDistControl = lineUpDist; npc.ai[2] += 1f; - if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) + if (npc.ai[2] == lineUpDistControl && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) npc.ai[2] -= 1f; - if (npc.ai[2] >= num60) + if (npc.ai[2] >= lineUpDistControl) { npc.velocity *= 0.95f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) @@ -594,8 +592,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - float num61 = num60 + 13f; - if (npc.ai[2] >= num61) + float lineUpDistNetUpdate = lineUpDistControl + 13f; + if (npc.ai[2] >= lineUpDistNetUpdate) { npc.netUpdate = true; @@ -624,9 +622,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float hoverSpeed = 8f + speedBoost; float hoverAcceleration = 0.25f + accelerationBoost; - Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector11.X; - float num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) + offset - vector11.Y; + Vector2 eyeLineUpChargeDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float lineUpChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyeLineUpChargeDirection.X; + float lineUpChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) + offset - eyeLineUpChargeDirection.Y; Vector2 hoverDestination = Main.player[npc.target].Center + Vector2.UnitY * offset; bool horizontalCharge = calamityGlobalNPC.newAI[0] == 1f || calamityGlobalNPC.newAI[0] == 3f; @@ -739,13 +737,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.Roar, npc.position); - float num60 = (float)Math.Round(num5 * 2.5f); + float lineUpDistControl = (float)Math.Round(lineUpDist * 2.5f); npc.ai[2] += 1f; - if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) + if (npc.ai[2] == lineUpDistControl && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) npc.ai[2] -= 1f; - if (npc.ai[2] >= num60) + if (npc.ai[2] >= lineUpDistControl) { npc.velocity *= 0.95f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) @@ -756,8 +754,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - float num61 = num60 + 13f; - if (npc.ai[2] >= num61) + float lineUpDistNetUpdate = lineUpDistControl + 13f; + if (npc.ai[2] >= lineUpDistNetUpdate) { npc.netUpdate = true; diff --git a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs index 9758dde5b4..22d960ce8d 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs @@ -59,10 +59,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool turboEnrage = false; if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; + int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; + int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); + Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else @@ -89,13 +89,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Check for body parts - bool flag40 = NPC.AnyNPCs(NPCID.GolemHead); - bool flag41 = NPC.AnyNPCs(NPCID.GolemFistLeft); - bool flag42 = NPC.AnyNPCs(NPCID.GolemFistRight); - npc.dontTakeDamage = (flag40 || flag41 || flag42) && !CalamityWorld.LegendaryMode; + bool headAlive = NPC.AnyNPCs(NPCID.GolemHead); + bool leftFistAlive = NPC.AnyNPCs(NPCID.GolemFistLeft); + bool rightFistAlive = NPC.AnyNPCs(NPCID.GolemFistRight); + npc.dontTakeDamage = (headAlive || leftFistAlive || rightFistAlive) && !CalamityWorld.LegendaryMode; // Phase 2, check for free head - bool flag43 = NPC.AnyNPCs(NPCID.GolemHeadFree); + bool freedHeadAlive = NPC.AnyNPCs(NPCID.GolemHeadFree); // Deactivate torches if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && npc.velocity.Y > 0f) @@ -117,10 +117,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn arm dust if (!Main.getGoodWorld) { - if (!flag41) + if (!leftFistAlive) { - int num642 = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num642]; + int lostLeftFistDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[lostLeftFistDust]; dust.alpha += Main.rand.Next(100); dust.velocity *= 0.2f; dust.velocity.Y -= 0.5f + Main.rand.Next(10) * 0.1f; @@ -128,20 +128,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.rand.NextBool(10)) { - num642 = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); + lostLeftFistDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); if (Main.rand.Next(20) != 0) { - Main.dust[num642].noGravity = true; - dust = Main.dust[num642]; + Main.dust[lostLeftFistDust].noGravity = true; + dust = Main.dust[lostLeftFistDust]; dust.scale *= 1f + Main.rand.Next(10) * 0.1f; dust.velocity.Y -= 1f; } } } - if (!flag42) + if (!rightFistAlive) { - int num643 = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num643]; + int lostRightFistDust = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[lostRightFistDust]; dust.alpha += Main.rand.Next(100); dust.velocity *= 0.2f; dust.velocity.Y -= 0.5f + Main.rand.Next(10) * 0.1f; @@ -149,11 +149,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.rand.NextBool(10)) { - num643 = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); + lostRightFistDust = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); if (Main.rand.Next(20) != 0) { - Main.dust[num643].noGravity = true; - dust = Main.dust[num643]; + Main.dust[lostRightFistDust].noGravity = true; + dust = Main.dust[lostRightFistDust]; dust.scale *= 1f + Main.rand.Next(10) * 0.1f; dust.velocity.Y -= 1f; } @@ -175,7 +175,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y == 0f) { // Laser fire when head is dead - if (Main.netMode != NetmodeID.MultiplayerClient && (!flag40 || turboEnrage || CalamityWorld.LegendaryMode)) + if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage || CalamityWorld.LegendaryMode)) { npc.localAI[1] += 1f; @@ -190,28 +190,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (turboEnrage && Main.getGoodWorld) divisor = 2f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y - 60f); - if (npc.localAI[1] % divisor == 0f && (Vector2.Distance(Main.player[npc.target].Center, vector82) > 160f || !flag43)) + Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 60f); + if (npc.localAI[1] % divisor == 0f && (Vector2.Distance(Main.player[npc.target].Center, projectileFirePos) > 160f || !freedHeadAlive)) { - float num673 = turboEnrage ? 12f : enrage ? 9f : 6f; - float num674 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; - float num675 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; - float num676 = (float)Math.Sqrt(num674 * num674 + num675 * num675); + float laserSpeed = turboEnrage ? 12f : enrage ? 9f : 6f; + float laserTargetXDist = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - projectileFirePos.X; + float laserTargetYDist = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - projectileFirePos.Y; + float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); - num676 = num673 / num676; - num674 *= num676; - num675 *= num676; - vector82.X += num674 * 3f; - vector82.Y += num675 * 3f; + laserTargetDistance = laserSpeed / laserTargetDistance; + laserTargetXDist *= laserTargetDistance; + laserTargetYDist *= laserTargetDistance; + projectileFirePos.X += laserTargetXDist * 3f; + projectileFirePos.Y += laserTargetYDist * 3f; int type = ProjectileID.EyeBeam; int damage = npc.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) { - int num677 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector82.X, vector82.Y, num674, num675, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num677].timeLeft = 480; + int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, laserTargetXDist, laserTargetYDist, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[bodyLaser].timeLeft = 480; if (turboEnrage && Main.getGoodWorld) - Main.projectile[num677].extraUpdates += 1; + Main.projectile[bodyLaser].extraUpdates += 1; } } @@ -233,11 +233,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[1] += 18f; else { - if (!flag41) + if (!leftFistAlive) npc.ai[1] += 6f; - if (!flag42) + if (!rightFistAlive) npc.ai[1] += 6f; - if (!flag40) + if (!headAlive) npc.ai[1] += 6f; } } @@ -266,7 +266,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float speedMult = 1f; float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; - if (distanceBelowTarget > 0f && ((!flag41 && !flag42) || turboEnrage || CalamityWorld.LegendaryMode)) + if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) speedMult += distanceBelowTarget * multiplier; float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; @@ -274,7 +274,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses speedMult = speedMultLimit; if (Main.player[npc.target].position.Y < npc.Bottom.Y) - npc.velocity.Y = ((((!flag43 && !flag40) || turboEnrage || CalamityWorld.LegendaryMode) ? -15.1f : -12.1f) + (enrage ? -4f : 0f)) * speedMult; + npc.velocity.Y = ((((!freedHeadAlive && !headAlive) || turboEnrage || CalamityWorld.LegendaryMode) ? -15.1f : -12.1f) + (enrage ? -4f : 0f)) * speedMult; else npc.velocity.Y = 1f; @@ -308,43 +308,43 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.SyncExtraAI(); // Dust and gore - for (int num644 = (int)npc.position.X - 20; num644 < (int)npc.position.X + npc.width + 40; num644 += 20) + for (int i = (int)npc.position.X - 20; i < (int)npc.position.X + npc.width + 40; i += 20) { - for (int num645 = 0; num645 < 4; num645++) + for (int j = 0; j < 4; j++) { - int num646 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, 31, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num646]; + int fallDust = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, 31, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[fallDust]; dust.velocity *= 0.2f; } if (Main.netMode != NetmodeID.Server) { - int num647 = Gore.NewGore(npc.GetSource_FromAI(), new Vector2(num644 - 20, npc.position.Y + npc.height - 8f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num647]; + int fallGore = Gore.NewGore(npc.GetSource_FromAI(), new Vector2(i - 20, npc.position.Y + npc.height - 8f), default, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[fallGore]; gore.velocity *= 0.4f; } } // Fireball explosion when head is dead - if (Main.netMode != NetmodeID.MultiplayerClient && (!flag40 || turboEnrage || CalamityWorld.LegendaryMode)) + if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage || CalamityWorld.LegendaryMode)) { - for (int num621 = 0; num621 < 10; num621++) + for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity.Y *= 6f; - Main.dust[num622].velocity.X *= 3f; + int fiery = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 2f); + Main.dust[fiery].velocity.Y *= 6f; + Main.dust[fiery].velocity.X *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[fiery].scale = 0.5f; + Main.dust[fiery].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 20; num623++) + for (int j = 0; j < 20; j++) { - int num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity.X *= 2f; + int fiery2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 3f); + Main.dust[fiery2].noGravity = true; + Main.dust[fiery2].velocity.Y *= 10f; + fiery2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 2f); + Main.dust[fiery2].velocity.X *= 2f; } int totalFireballs = 5; @@ -426,8 +426,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses void CustomGravity() { - float gravity = turboEnrage ? (Main.getGoodWorld ? 1.2f : 0.9f) : enrage ? 0.6f : (!flag41 && !flag42) ? 0.45f : 0.3f; - float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (Main.getGoodWorld ? 40f : 30f) : enrage ? 20f : (!flag41 && !flag42) ? 15f : 10f; + float gravity = turboEnrage ? (Main.getGoodWorld ? 1.2f : 0.9f) : enrage ? 0.6f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; + float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (Main.getGoodWorld ? 40f : 30f) : enrage ? 20f : (!leftFistAlive && !rightFistAlive) ? 15f : 10f; npc.velocity.Y += gravity; if (npc.velocity.Y > maxFallSpeed) @@ -435,12 +435,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Despawn - int num649 = turboEnrage ? 7500 : enrage ? 6000 : 4500; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > num649) + int despawnDistance = turboEnrage ? 7500 : enrage ? 6000 : 4500; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > despawnDistance) { npc.TargetClosest(); - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > num649) + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > despawnDistance) { npc.active = false; npc.netUpdate = true; @@ -461,10 +461,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool turboEnrage = false; if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; + int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; + int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); + Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else @@ -499,30 +499,30 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.noTileCollide = true; - float num723 = 25f; - num723 *= (aggression + 3f) / 4f; + float fistSpeed = 25f; + fistSpeed *= (aggression + 3f) / 4f; - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num724 = Main.npc[NPC.golemBoss].Center.X - vector80.X; - float num725 = Main.npc[NPC.golemBoss].Center.Y - vector80.Y; - num725 -= 9f; - num724 = (npc.type != NPCID.GolemFistLeft) ? (num724 + 78f) : (num724 - 84f); + Vector2 fistCenter = new Vector2(npc.Center.X, npc.Center.Y); + float fistXPos = Main.npc[NPC.golemBoss].Center.X - fistCenter.X; + float fistYPos = Main.npc[NPC.golemBoss].Center.Y - fistCenter.Y; + fistYPos -= 9f; + fistXPos = (npc.type != NPCID.GolemFistLeft) ? (fistXPos + 78f) : (fistXPos - 84f); if (Main.getGoodWorld) - num724 = (npc.type != NPCID.GolemFistLeft) ? (num724 - 40f) : (num724 + 40f); + fistXPos = (npc.type != NPCID.GolemFistLeft) ? (fistXPos - 40f) : (fistXPos + 40f); - float num726 = (float)Math.Sqrt(num724 * num724 + num725 * num725); - if (num726 < 12f + num723) + float fistRestDistance = (float)Math.Sqrt(fistXPos * fistXPos + fistYPos * fistYPos); + if (fistRestDistance < 12f + fistSpeed) { npc.rotation = 0f; - npc.velocity.X = num724; - npc.velocity.Y = num725; + npc.velocity.X = fistXPos; + npc.velocity.Y = fistYPos; - float num727 = aggression; - npc.ai[1] += num727; + float fistShootSpeed = aggression; + npc.ai[1] += fistShootSpeed; if (npc.life < npc.lifeMax / 2) - npc.ai[1] += num727; + npc.ai[1] += fistShootSpeed; if (npc.life < npc.lifeMax / 4) - npc.ai[1] += num727; + npc.ai[1] += fistShootSpeed; if (npc.ai[1] >= 40f) { @@ -539,9 +539,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { - num726 = num723 / num726; - npc.velocity.X = num724 * num726; - npc.velocity.Y = num725 * num726; + fistRestDistance = fistSpeed / fistRestDistance; + npc.velocity.X = fistXPos * fistRestDistance; + npc.velocity.Y = fistYPos * fistRestDistance; npc.rotation = (float)Math.Atan2(0f - npc.velocity.Y, 0f - npc.velocity.X); if (npc.type == NPCID.GolemFistLeft) @@ -550,26 +550,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.ai[0] == 1f) { - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num724 = Main.npc[NPC.golemBoss].Center.X - vector80.X; - float num725 = Main.npc[NPC.golemBoss].Center.Y - vector80.Y; - num725 -= 9f; - num724 = (npc.type != NPCID.GolemFistLeft) ? (num724 + 78f) : (num724 - 84f); + Vector2 fistCenter = new Vector2(npc.Center.X, npc.Center.Y); + float fistXPos = Main.npc[NPC.golemBoss].Center.X - fistCenter.X; + float fistYPos = Main.npc[NPC.golemBoss].Center.Y - fistCenter.Y; + fistYPos -= 9f; + fistXPos = (npc.type != NPCID.GolemFistLeft) ? (fistXPos + 78f) : (fistXPos - 84f); if (Main.getGoodWorld) - num724 = (npc.type != NPCID.GolemFistLeft) ? (num724 - 40f) : (num724 + 40f); + fistXPos = (npc.type != NPCID.GolemFistLeft) ? (fistXPos - 40f) : (fistXPos + 40f); npc.ai[1] += 1f; - npc.Center = new Vector2(num724, num725); + npc.Center = new Vector2(fistXPos, fistYPos); npc.rotation = 0f; npc.velocity = Vector2.Zero; if (npc.ai[1] <= 15f) { for (int i = 0; i < 1; i++) { - Vector2 vector3 = Main.rand.NextVector2Circular(80f, 80f); - Vector2 vector4 = vector3 * -1f * 0.05f; - Vector2 vector5 = Main.rand.NextVector2Circular(20f, 20f); - Dust dust = Dust.NewDustPerfect(npc.Center + vector4 + vector3 + vector5, 228, vector4); + Vector2 largeRandDustRadius = Main.rand.NextVector2Circular(80f, 80f); + Vector2 largeRandDustRecoil = largeRandDustRadius * -1f * 0.05f; + Vector2 smallRandDustRadius = Main.rand.NextVector2Circular(20f, 20f); + Dust dust = Dust.NewDustPerfect(npc.Center + largeRandDustRecoil + largeRandDustRadius + smallRandDustRadius, 228, largeRandDustRecoil); dust.fadeIn = 1.5f; dust.scale = 0.5f; if (Main.getGoodWorld) @@ -585,18 +585,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.collideX = false; npc.collideY = false; - float num728 = 20f; - num728 *= (aggression + 3f) / 4f; - if (num728 > 48f) - num728 = 48f; + float fistReturnSpeed = 20f; + fistReturnSpeed *= (aggression + 3f) / 4f; + if (fistReturnSpeed > 48f) + fistReturnSpeed = 48f; - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); - float num729 = Main.player[npc.target].Center.X - vector81.X; - float num730 = Main.player[npc.target].Center.Y - vector81.Y; - float num731 = (float)Math.Sqrt(num729 * num729 + num730 * num730); - num731 = num728 / num731; - npc.velocity.X = num729 * num731; - npc.velocity.Y = num730 * num731; + Vector2 fistCent = new Vector2(npc.Center.X, npc.Center.Y); + float fistTargetXDist = Main.player[npc.target].Center.X - fistCent.X; + float fistTargetYDist = Main.player[npc.target].Center.Y - fistCent.Y; + float fistTargetDistance = (float)Math.Sqrt(fistTargetXDist * fistTargetXDist + fistTargetYDist * fistTargetYDist); + fistTargetDistance = fistReturnSpeed / fistTargetDistance; + npc.velocity.X = fistTargetXDist * fistTargetDistance; + npc.velocity.Y = fistTargetYDist * fistTargetDistance; npc.ai[0] = 2f; npc.ai[1] = 0f; @@ -629,9 +629,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.rand.NextBool()) { - Vector2 vector7 = npc.velocity * 0.5f; - Vector2 vector8 = Main.rand.NextVector2Circular(20f, 20f); - Dust.NewDustPerfect(npc.Center + vector7 + vector8, 306, vector7, 0, Main.OurFavoriteColor).scale = 2f; + Vector2 halfVelocityDust = npc.velocity * 0.5f; + Vector2 randDustRadius = Main.rand.NextVector2Circular(20f, 20f); + Dust.NewDustPerfect(npc.Center + halfVelocityDust + randDustRadius, 306, halfVelocityDust, 0, Main.OurFavoriteColor).scale = 2f; } if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) @@ -651,20 +651,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.noTileCollide = false; } - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num732 = Main.npc[NPC.golemBoss].Center.X - vector82.X; - float num733 = Main.npc[NPC.golemBoss].Center.Y - vector82.Y; - num732 += Main.npc[NPC.golemBoss].velocity.X; - num733 += Main.npc[NPC.golemBoss].velocity.Y; - num733 -= 9f; - num732 = (npc.type != NPCID.GolemFistLeft) ? (num732 + 78f) : (num732 - 84f); - float num734 = (float)Math.Sqrt(num732 * num732 + num733 * num733); + Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y); + float fistGolemDistanceX = Main.npc[NPC.golemBoss].Center.X - projectileFirePos.X; + float fistGolemDistanceY = Main.npc[NPC.golemBoss].Center.Y - projectileFirePos.Y; + fistGolemDistanceX += Main.npc[NPC.golemBoss].velocity.X; + fistGolemDistanceY += Main.npc[NPC.golemBoss].velocity.Y; + fistGolemDistanceY -= 9f; + fistGolemDistanceX = (npc.type != NPCID.GolemFistLeft) ? (fistGolemDistanceX + 78f) : (fistGolemDistanceX - 84f); + float fistGolemDistance = (float)Math.Sqrt(fistGolemDistanceX * fistGolemDistanceX + fistGolemDistanceY * fistGolemDistanceY); if (npc.life < npc.lifeMax / 4) { npc.knockBackResist = 0f; - if (num734 > 700f || npc.collideX || npc.collideY) + if (fistGolemDistance > 700f || npc.collideX || npc.collideY) { npc.noTileCollide = true; npc.ai[0] = 0f; @@ -673,19 +673,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses return false; } - bool flag41 = npc.justHit; - if (flag41) + bool leftFistAlive = npc.justHit; + if (leftFistAlive) { if (npc.life < npc.lifeMax / 2) { if (npc.knockBackResist == 0f) - flag41 = false; + leftFistAlive = false; npc.knockBackResist = 0f; } } - if ((num734 > 600f || npc.collideX || npc.collideY) | flag41) + if ((fistGolemDistance > 600f || npc.collideX || npc.collideY) | leftFistAlive) { npc.noTileCollide = true; npc.ai[0] = 0f; @@ -697,40 +697,39 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses return false; npc.noTileCollide = true; - float num736 = 12f; - float num737 = 0.4f; - Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); - float num738 = Main.player[npc.target].Center.X - vector83.X; - float num739 = Main.player[npc.target].Center.Y - vector83.Y; - float num740 = (float)Math.Sqrt(num738 * num738 + num739 * num739); - num740 = num736 / num740; - num738 *= num740; - num739 *= num740; + float fistAcceleration = 0.4f; + Vector2 returningFistCenter = new Vector2(npc.Center.X, npc.Center.Y); + float returningTargetX = Main.player[npc.target].Center.X - returningFistCenter.X; + float returningTargetY = Main.player[npc.target].Center.Y - returningFistCenter.Y; + float returningTargetDist = (float)Math.Sqrt(returningTargetX * returningTargetX + returningTargetY * returningTargetY); + returningTargetDist = 12f / returningTargetDist; + returningTargetX *= returningTargetDist; + returningTargetY *= returningTargetDist; - if (npc.velocity.X < num738) + if (npc.velocity.X < returningTargetX) { - npc.velocity.X += num737; - if (npc.velocity.X < 0f && num738 > 0f) - npc.velocity.X += num737 * 2f; + npc.velocity.X += fistAcceleration; + if (npc.velocity.X < 0f && returningTargetX > 0f) + npc.velocity.X += fistAcceleration * 2f; } - else if (npc.velocity.X > num738) + else if (npc.velocity.X > returningTargetX) { - npc.velocity.X -= num737; - if (npc.velocity.X > 0f && num738 < 0f) - npc.velocity.X -= num737 * 2f; + npc.velocity.X -= fistAcceleration; + if (npc.velocity.X > 0f && returningTargetX < 0f) + npc.velocity.X -= fistAcceleration * 2f; } - if (npc.velocity.Y < num739) + if (npc.velocity.Y < returningTargetY) { - npc.velocity.Y += num737; - if (npc.velocity.Y < 0f && num739 > 0f) - npc.velocity.Y += num737 * 2f; + npc.velocity.Y += fistAcceleration; + if (npc.velocity.Y < 0f && returningTargetY > 0f) + npc.velocity.Y += fistAcceleration * 2f; } - else if (npc.velocity.Y > num739) + else if (npc.velocity.Y > returningTargetY) { - npc.velocity.Y -= num737; - if (npc.velocity.Y > 0f && num739 < 0f) - npc.velocity.Y -= num737 * 2f; + npc.velocity.Y -= fistAcceleration; + if (npc.velocity.Y > 0f && returningTargetY < 0f) + npc.velocity.Y -= fistAcceleration * 2f; } npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); @@ -771,9 +770,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool death = CalamityWorld.death || bossRush; // Count body parts - bool flag41 = NPC.AnyNPCs(NPCID.GolemFistLeft); - bool flag42 = NPC.AnyNPCs(NPCID.GolemFistRight); - npc.dontTakeDamage = (flag41 || flag42) && !CalamityWorld.LegendaryMode; + bool leftFistAlive = NPC.AnyNPCs(NPCID.GolemFistLeft); + bool rightFistAlive = NPC.AnyNPCs(NPCID.GolemFistRight); + npc.dontTakeDamage = (leftFistAlive || rightFistAlive) && !CalamityWorld.LegendaryMode; // Stay in position on top of body npc.Center = Main.npc[NPC.golemBoss].Center - new Vector2(Main.getGoodWorld ? 2f : 3f, Main.getGoodWorld ? 37f : 57f); @@ -783,10 +782,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool turboEnrage = false; if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; + int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; + int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); + Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else @@ -812,31 +811,30 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[0] == 0f) { npc.ai[1] += 1f; - int num654 = 150; - if (npc.ai[1] < 20f || npc.ai[1] > (num654 - 20)) + if (npc.ai[1] < 20f || npc.ai[1] > 130) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= num654) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 150) { npc.TargetClosest(); npc.ai[1] = 0f; - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y + 10f); - float num655 = turboEnrage ? 12f : enrage ? 10f : 8f; - float num656 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector81.X; - float num657 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector81.Y; - float num658 = (float)Math.Sqrt(num656 * num656 + num657 * num657); + Vector2 headCent = new Vector2(npc.Center.X, npc.Center.Y + 10f); + float headFireballSpeed = turboEnrage ? 12f : enrage ? 10f : 8f; + float headFireballTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - headCent.X; + float headFireballTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - headCent.Y; + float headFireballTargetDist = (float)Math.Sqrt(headFireballTargetX * headFireballTargetX + headFireballTargetY * headFireballTargetY); - num658 = num655 / num658; - num656 *= num658; - num657 *= num658; + headFireballTargetDist = headFireballSpeed / headFireballTargetDist; + headFireballTargetX *= headFireballTargetDist; + headFireballTargetY *= headFireballTargetDist; int type = ProjectileID.Fireball; int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector81.X, vector81.Y, num656, num657, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), headCent.X, headCent.Y, headFireballTargetX, headFireballTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); npc.netUpdate = true; } @@ -846,16 +844,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[0] == 1f) { // Fire projectiles from eye positions - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y + 10f); + Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y + 10f); if (Main.player[npc.target].Center.X < npc.Center.X - npc.width) { npc.localAI[1] = -1f; - vector82.X -= 40f; + projectileFirePos.X -= 40f; } else if (Main.player[npc.target].Center.X > npc.Center.X + npc.width) { npc.localAI[1] = 1f; - vector82.X += 40f; + projectileFirePos.X += 40f; } else npc.localAI[1] = 0f; @@ -864,30 +862,29 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float shootBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); npc.ai[1] += 1f + shootBoost; - int num662 = 240; - if (npc.ai[1] < 20f || npc.ai[1] > (num662 - 20)) + if (npc.ai[1] < 20f || npc.ai[1] > 220) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= num662) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 240) { npc.TargetClosest(); npc.ai[1] = 0f; - float num663 = turboEnrage ? 16f : enrage ? 14f : 12f; - float num664 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; - float num665 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; - float num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665); + float fireballSpeedFistsDed = turboEnrage ? 16f : enrage ? 14f : 12f; + float fireballFistsDedTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - projectileFirePos.X; + float fireballFistsDedTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - projectileFirePos.Y; + float fireballFistsDedTargetDist = (float)Math.Sqrt(fireballFistsDedTargetX * fireballFistsDedTargetX + fireballFistsDedTargetY * fireballFistsDedTargetY); - num666 = num663 / num666; - num664 *= num666; - num665 *= num666; + fireballFistsDedTargetDist = fireballSpeedFistsDed / fireballFistsDedTargetDist; + fireballFistsDedTargetX *= fireballFistsDedTargetDist; + fireballFistsDedTargetY *= fireballFistsDedTargetDist; int type = ProjectileID.Fireball; int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector82.X, vector82.Y, num664, num665, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, fireballFistsDedTargetX, fireballFistsDedTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); npc.netUpdate = true; } @@ -911,34 +908,34 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] == 0f) { - for (int num672 = 0; num672 < 2; num672++) + for (int i = 0; i < 2; i++) { - vector82 = new Vector2(npc.Center.X, npc.Center.Y - 22f); - if (num672 == 0) - vector82.X -= 18f; + projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 22f); + if (i == 0) + projectileFirePos.X -= 18f; else - vector82.X += 18f; + projectileFirePos.X += 18f; - float num673 = 9f; + float laserSpeed = 9f; if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - num673 = 14f; + laserSpeed = 14f; - float num674 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; - float num675 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; - float num676 = (float)Math.Sqrt(num674 * num674 + num675 * num675); + float laserTargetXDist = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - projectileFirePos.X; + float laserTargetYDist = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - projectileFirePos.Y; + float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); - num676 = num673 / num676; - num674 *= num676; - num675 *= num676; - vector82.X += num674 * 3f; - vector82.Y += num675 * 3f; + laserTargetDistance = laserSpeed / laserTargetDistance; + laserTargetXDist *= laserTargetDistance; + laserTargetYDist *= laserTargetDistance; + projectileFirePos.X += laserTargetXDist * 3f; + projectileFirePos.Y += laserTargetYDist * 3f; if (Main.netMode != NetmodeID.MultiplayerClient) { - int num677 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector82.X, vector82.Y, num674, num675, projType, dmg, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num677].timeLeft = enrage ? 480 : 300; + int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, laserTargetXDist, laserTargetYDist, projType, dmg, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[bodyLaser].timeLeft = enrage ? 480 : 300; if (turboEnrage && Main.getGoodWorld) - Main.projectile[num677].extraUpdates += 1; + Main.projectile[bodyLaser].extraUpdates += 1; npc.netUpdate = true; } @@ -946,32 +943,32 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.localAI[1] != 0f) { - vector82 = new Vector2(npc.Center.X, npc.Center.Y - 22f); + projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 22f); if (npc.localAI[1] == -1f) - vector82.X -= 30f; + projectileFirePos.X -= 30f; else if (npc.localAI[1] == 1f) - vector82.X += 30f; + projectileFirePos.X += 30f; - float num678 = 9f; + float extraLaserSpeed = 9f; if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - num678 = 14f; + extraLaserSpeed = 14f; - float num679 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; - float num680 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; - float num681 = (float)Math.Sqrt(num679 * num679 + num680 * num680); + float extraLaserTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - projectileFirePos.X; + float extraLaserTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - projectileFirePos.Y; + float extraLaserTargetDist = (float)Math.Sqrt(extraLaserTargetX * extraLaserTargetX + extraLaserTargetY * extraLaserTargetY); - num681 = num678 / num681; - num679 *= num681; - num680 *= num681; - vector82.X += num679 * 3f; - vector82.Y += num680 * 3f; + extraLaserTargetDist = extraLaserSpeed / extraLaserTargetDist; + extraLaserTargetX *= extraLaserTargetDist; + extraLaserTargetY *= extraLaserTargetDist; + projectileFirePos.X += extraLaserTargetX * 3f; + projectileFirePos.Y += extraLaserTargetY * 3f; if (Main.netMode != NetmodeID.MultiplayerClient) { - int num682 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector82.X, vector82.Y, num679, num680, projType, dmg, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num682].timeLeft = enrage ? 480 : 300; + int extraLasers = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, extraLaserTargetX, extraLaserTargetY, projType, dmg, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[extraLasers].timeLeft = enrage ? 480 : 300; if (turboEnrage && Main.getGoodWorld) - Main.projectile[num682].extraUpdates += 1; + Main.projectile[extraLasers].extraUpdates += 1; npc.netUpdate = true; } @@ -980,7 +977,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Laser fire if arms are dead - if ((!flag41 && !flag42) || death || CalamityWorld.LegendaryMode) + if ((!leftFistAlive && !rightFistAlive) || death || CalamityWorld.LegendaryMode) { npc.ai[0] = 1f; return false; @@ -1031,10 +1028,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool turboEnrage = false; if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; + int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; + int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); + Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else @@ -1054,11 +1051,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Float through tiles or not - bool flag44 = false; + bool canPassThroughTiles = false; if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) || phase3 || turboEnrage) { npc.noTileCollide = true; - flag44 = true; + canPassThroughTiles = true; } else npc.noTileCollide = false; @@ -1153,7 +1150,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float acceleration = enrage ? 0.4f : phase3 ? 0.2f : phase2 ? 0.15f : 0.1f; - // How far Ceaseless Void is from where it's supposed to be + // How far is from where it's supposed to be Vector2 distanceFromDestination = destination - npc.Center; CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); @@ -1175,34 +1172,33 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float shootBoost = death ? 3f * (2f - (lifeRatio + golemLifeRatio)) : 2f * (2f - (lifeRatio + golemLifeRatio)); npc.ai[1] += 1f + shootBoost; - int num705 = 360; - if (npc.ai[1] < 20f || npc.ai[1] > (num705 - 20)) + if (npc.ai[1] < 20f || npc.ai[1] > 340) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; - if (flag44 && !phase3) + if (canPassThroughTiles && !phase3) npc.ai[1] = 20f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= num705 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 360 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { npc.TargetClosest(); npc.ai[1] = 0f; - Vector2 vector88 = new Vector2(npc.Center.X, npc.Center.Y - 10f); - float num706 = turboEnrage ? 8f : enrage ? 6.5f : 5f; - float num709 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector88.X; - float num710 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector88.Y; - float num711 = (float)Math.Sqrt(num709 * num709 + num710 * num710); + Vector2 freeHeadCenter = new Vector2(npc.Center.X, npc.Center.Y - 10f); + float freeHeadSpeed = turboEnrage ? 8f : enrage ? 6.5f : 5f; + float freeHeadTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - freeHeadCenter.X; + float freeHeadTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - freeHeadCenter.Y; + float freeHeadTargetDist = (float)Math.Sqrt(freeHeadTargetX * freeHeadTargetX + freeHeadTargetY * freeHeadTargetY); - num711 = num706 / num711; - num709 *= num711; - num710 *= num711; + freeHeadTargetDist = freeHeadSpeed / freeHeadTargetDist; + freeHeadTargetX *= freeHeadTargetDist; + freeHeadTargetY *= freeHeadTargetDist; int projectileType = phase3 ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; int damage = npc.GetProjectileDamage(projectileType); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), vector88.X, vector88.Y, num709, num710, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadCenter.X, freeHeadCenter.Y, freeHeadTargetX, freeHeadTargetY, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); if (projectileType == ProjectileID.InfernoHostileBolt) { Main.projectile[proj].timeLeft = 300; @@ -1225,50 +1221,50 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 0f; - for (int num713 = 0; num713 < 2; num713++) + for (int i = 0; i < 2; i++) { - Vector2 vector89 = new Vector2(npc.Center.X, npc.Center.Y - 50f); + Vector2 freeHeadProjSpawn = new Vector2(npc.Center.X, npc.Center.Y - 50f); if (Main.getGoodWorld) - vector89.Y += 30f; - if (num713 == 0) - vector89.X -= 14f; - else if (num713 == 1) - vector89.X += 14f; + freeHeadProjSpawn.Y += 30f; + if (i == 0) + freeHeadProjSpawn.X -= 14f; + else if (i == 1) + freeHeadProjSpawn.X += 14f; - float num714 = 5f + shootBoost; - float num717 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector89.X; - float num718 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector89.Y; - float num719 = (float)Math.Sqrt(num717 * num717 + num718 * num718); + float freeHeadProjSpeed = 5f + shootBoost; + float freeHeadProjTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - freeHeadProjSpawn.X; + float freeHeadProjTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - freeHeadProjSpawn.Y; + float freeHeadProjTargetDist = (float)Math.Sqrt(freeHeadProjTargetX * freeHeadProjTargetX + freeHeadProjTargetY * freeHeadProjTargetY); - num719 = num714 / num719; - num717 *= num719; - num718 *= num719; - vector89.X += num717 * 3f; - vector89.Y += num718 * 3f; + freeHeadProjTargetDist = freeHeadProjSpeed / freeHeadProjTargetDist; + freeHeadProjTargetX *= freeHeadProjTargetDist; + freeHeadProjTargetY *= freeHeadProjTargetDist; + freeHeadProjSpawn.X += freeHeadProjTargetX * 3f; + freeHeadProjSpawn.Y += freeHeadProjTargetY * 3f; int type = ProjectileID.EyeBeam; int damage = npc.GetProjectileDamage(type); - int num720 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector89.X, vector89.Y, num717, num718, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num720].timeLeft = enrage ? 480 : 300; + int freeHeadLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadProjSpawn.X, freeHeadProjSpawn.Y, freeHeadProjTargetX, freeHeadProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[freeHeadLaser].timeLeft = enrage ? 480 : 300; if (turboEnrage && Main.getGoodWorld) - Main.projectile[num720].extraUpdates += 1; + Main.projectile[freeHeadLaser].extraUpdates += 1; } } if (!Main.getGoodWorld) { npc.position += npc.netOffset; - int num765 = Main.rand.Next(2) * 2 - 1; - Vector2 vector95 = npc.Bottom + new Vector2((float)(num765 * 22) * npc.scale, -22f * npc.scale); - Dust dust5 = Dust.NewDustPerfect(vector95, 228, ((float)Math.PI / 2f + -(float)Math.PI / 2f * (float)num765 + Main.rand.NextFloatDirection() * ((float)Math.PI / 4f)).ToRotationVector2() * (2f + Main.rand.NextFloat())); - Dust dust = dust5; + int randDustOffset = Main.rand.Next(2) * 2 - 1; + Vector2 randDustPos = npc.Bottom + new Vector2((float)(randDustOffset * 22) * npc.scale, -22f * npc.scale); + Dust getGoodDust = Dust.NewDustPerfect(randDustPos, 228, ((float)Math.PI / 2f + -(float)Math.PI / 2f * (float)randDustOffset + Main.rand.NextFloatDirection() * ((float)Math.PI / 4f)).ToRotationVector2() * (2f + Main.rand.NextFloat())); + Dust dust = getGoodDust; dust.velocity += npc.velocity; - dust5.noGravity = true; - dust5 = Dust.NewDustPerfect(npc.Bottom + new Vector2(Main.rand.NextFloatDirection() * 6f * npc.scale, (Main.rand.NextFloat() * -4f - 8f) * npc.scale), 228, Vector2.UnitY * (2f + Main.rand.NextFloat())); - dust5.fadeIn = 0f; - dust5.scale = 0.7f + Main.rand.NextFloat() * 0.5f; - dust5.noGravity = true; - dust = dust5; + getGoodDust.noGravity = true; + getGoodDust = Dust.NewDustPerfect(npc.Bottom + new Vector2(Main.rand.NextFloatDirection() * 6f * npc.scale, (Main.rand.NextFloat() * -4f - 8f) * npc.scale), 228, Vector2.UnitY * (2f + Main.rand.NextFloat())); + getGoodDust.fadeIn = 0f; + getGoodDust.scale = 0.7f + Main.rand.NextFloat() * 0.5f; + getGoodDust.noGravity = true; + dust = getGoodDust; dust.velocity += npc.velocity; npc.position -= npc.netOffset; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs index 9c90497a5c..9956468308 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs @@ -18,15 +18,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Variables - float num234 = 1f; + float teleportScale = 1f; bool teleporting = false; - bool flag9 = false; + bool teleported = false; npc.aiAction = 0; - float num237 = 2f; + float teleportScaleSpeed = 2f; if (Main.getGoodWorld) { - num237 -= 1f - lifeRatio; - num234 *= num237; + teleportScaleSpeed -= 1f - lifeRatio; + teleportScale *= teleportScaleSpeed; } // Reset damage @@ -53,15 +53,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.Calamity().newAI[0] = 1f; npc.SyncExtraAI(); Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2); - for (int num621 = 0; num621 < 20; num621++) + for (int i = 0; i < 20; i++) { - int num622 = Dust.NewDust(vector, npc.width / 2, npc.height / 2, 90, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 2f; - Main.dust[num622].noGravity = true; + int rubyDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, 90, 0f, 0f, 100, default, 2f); + Main.dust[rubyDust].velocity *= 2f; + Main.dust[rubyDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[rubyDust].scale = 0.5f; + Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } SoundEngine.PlaySound(SoundID.Item38, npc.position); @@ -160,13 +160,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses teleporting = true; npc.aiAction = 1; npc.ai[0] += 1f; - num234 = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); - num234 = 0.5f + num234 * 0.5f; + teleportScale = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); + teleportScale = 0.5f + teleportScale * 0.5f; if (Main.getGoodWorld) - num234 *= num237; + teleportScale *= teleportScaleSpeed; if (npc.ai[0] >= 60f) - flag9 = true; + teleported = true; if (npc.ai[0] == 60f && Main.netMode != NetmodeID.Server) Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -(float)npc.height / 2), npc.velocity, 734, 1f); @@ -185,13 +185,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[0] = 0f; } - if (!flag9) + if (!teleported) { - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num246 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num246].noGravity = true; - dust = Main.dust[num246]; + int slimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); + Main.dust[slimeDust].noGravity = true; + dust = Main.dust[slimeDust]; dust.velocity *= 0.5f; } } @@ -206,10 +206,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses teleporting = true; npc.aiAction = 0; npc.ai[0] += 1f; - num234 = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); - num234 = 0.5f + num234 * 0.5f; + teleportScale = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); + teleportScale = 0.5f + teleportScale * 0.5f; if (Main.getGoodWorld) - num234 *= num237; + teleportScale *= teleportScaleSpeed; if (npc.ai[0] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -226,17 +226,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); } - for (int num247 = 0; num247 < 10; num247++) + for (int j = 0; j < 10; j++) { - int num248 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num248].noGravity = true; - dust = Main.dust[num248]; + int slimyDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); + Main.dust[slimyDust].noGravity = true; + dust = Main.dust[slimyDust]; dust.velocity *= 2f; } } // Don't take damage while teleporting - npc.dontTakeDamage = npc.hide = flag9; + npc.dontTakeDamage = npc.hide = teleported; npc.noTileCollide = false; @@ -324,11 +324,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Change jump velocity else if (npc.target < Main.maxPlayers) { - float num252 = 3f; + float jumpVelocityMult = 3f; if (Main.getGoodWorld) - num252 = 6f; + jumpVelocityMult = 6f; - if ((npc.direction == 1 && npc.velocity.X < num252) || (npc.direction == -1 && npc.velocity.X > 0f - num252)) + if ((npc.direction == 1 && npc.velocity.X < jumpVelocityMult) || (npc.direction == -1 && npc.velocity.X > 0f - jumpVelocityMult)) { if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) npc.velocity.X += (bossRush ? 0.4f : death ? 0.25f : 0.2f) * npc.direction; @@ -348,9 +348,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Spawn dust - int num249 = Dust.NewDust(npc.position, npc.width, npc.height, 4, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[num249].noGravity = true; - dust = Main.dust[num249]; + int idleSlimeDust = Dust.NewDust(npc.position, npc.width, npc.height, 4, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + Main.dust[idleSlimeDust].noGravity = true; + dust = Main.dust[idleSlimeDust]; dust.velocity *= 0.5f; if (npc.life <= 0) @@ -360,7 +360,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float maxScale = death ? (Main.getGoodWorld ? 6f : 3f) : (Main.getGoodWorld ? 3f : 1.25f); float minScale = 0.75f; lifeRatio = lifeRatio * (maxScale - minScale) + minScale; - lifeRatio *= num234; + lifeRatio *= teleportScale; if (lifeRatio != npc.scale) { npc.position.X += npc.width / 2; @@ -375,12 +375,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Slime spawning if (Main.netMode != NetmodeID.MultiplayerClient) { - int num251 = (int)(npc.lifeMax * 0.05); - if (npc.life + num251 < npc.ai[3]) + int slimeSpawnThreshold = (int)(npc.lifeMax * 0.05); + if (npc.life + slimeSpawnThreshold < npc.ai[3]) { npc.ai[3] = npc.life; - int num252 = Main.rand.Next(2, 4); - for (int num253 = 0; num253 < num252; num253++) + int slimeAmt = Main.rand.Next(2, 4); + for (int i = 0; i < slimeAmt; i++) { int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); @@ -431,15 +431,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (CalamityWorld.LegendaryMode) npcType = NPCID.RainbowSlime; - int num255 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, npcType); - Main.npc[num255].SetDefaults(npcType); - Main.npc[num255].velocity.X = Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num255].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num255].ai[0] = -1000 * Main.rand.Next(3); - Main.npc[num255].ai[1] = 0f; + int slimeSpawns = NPC.NewNPC(npc.GetSource_FromAI(), x, y, npcType); + Main.npc[slimeSpawns].SetDefaults(npcType); + Main.npc[slimeSpawns].velocity.X = Main.rand.Next(-15, 16) * 0.1f; + Main.npc[slimeSpawns].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; + Main.npc[slimeSpawns].ai[0] = -1000 * Main.rand.Next(3); + Main.npc[slimeSpawns].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num255 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num255, 0f, 0f, 0f, 0, 0, 0); + if (Main.netMode == NetmodeID.Server && slimeSpawns < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawns, 0f, 0f, 0f, 0, 0, 0); } } } @@ -450,34 +450,34 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.TargetClosest(false); Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 800f; - Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int num235 = 5; - int num238 = 0; - while (num238 < 100) + Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); + int randomPredictiveTeleportOffset = 5; + int teleportTries = 0; + while (teleportTries < 100) { - num238++; - int num239 = Main.rand.Next(point4.X - num235, point4.X + num235 + 1); - int num240 = Main.rand.Next(point4.Y - num235, point4.Y); + teleportTries++; + int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomPredictiveTeleportOffset, predictiveTeleportPoint.X + randomPredictiveTeleportOffset + 1); + int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomPredictiveTeleportOffset, predictiveTeleportPoint.Y); - if (!Main.tile[num239, num240].HasUnactuatedTile) + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) { - bool flag13 = true; - if (flag13 && Main.tile[num239, num240].LiquidType == LiquidID.Lava) - flag13 = false; - if (flag13 && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - flag13 = false; + bool canTeleportToTile = true; + if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) + canTeleportToTile = false; + if (canTeleportToTile && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + canTeleportToTile = false; - if (flag13) + if (canTeleportToTile) { - npc.localAI[1] = num239 * 16 + 8; - npc.localAI[2] = num240 * 16 + 16; + npc.localAI[1] = teleportTileX * 16 + 8; + npc.localAI[2] = teleportTileY * 16 + 16; break; } } } // Default teleport if the above conditions aren't met in 100 iterations - if (num238 >= 100) + if (teleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; npc.localAI[1] = bottom.X; From 0c657427ca8e6775db8b973159f1308dbdc71e3e Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 26 Oct 2023 12:40:26 -0400 Subject: [PATCH 22/43] Moon Lord's code is a crime against humanity Oh yeah, guess I did Plantera and Queen Bee too --- NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs | 1182 ++++++++--------- NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs | 122 +- NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs | 369 +++-- 3 files changed, 831 insertions(+), 842 deletions(-) diff --git a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs index a034bd0db0..50f65d1a90 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs @@ -12,6 +12,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { public static class MoonLordAI { + + // This is the most horrible abomination of code I have ever seen in my life, by a fucking landslide. + // This took hours of my time to attempt to clean up, and quite frankly I'd be surprised if even half of it is accurate. + // I do not want to look at this crime against humanity for a very long time. -CIT + public static readonly SoundStyle DeathrayChargeSound = new("CalamityMod/Sounds/Custom/MoonLordLaserCharge"); public static bool BuffedMoonLordAI(NPC npc, Mod mod) @@ -122,37 +127,37 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; int[] array5 = new int[3]; - int num1155 = 0; - int num; + int handsSpawned = 0; + int totalSpawns; - for (int num1156 = 0; num1156 < 2; num1156 = num + 1) + for (int i = 0; i < 2; i = totalSpawns + 1) { - int num1157 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X + num1156 * 800 - 400, (int)npc.Center.Y - 100, NPCID.MoonLordHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num1157].ai[2] = num1156; - Main.npc[num1157].netUpdate = true; + int handSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X + i * 800 - 400, (int)npc.Center.Y - 100, NPCID.MoonLordHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[handSpawn].ai[2] = i; + Main.npc[handSpawn].netUpdate = true; int[] arg_381A6_0 = array5; - num = num1155; - num1155 = num + 1; - arg_381A6_0[num] = num1157; - num = num1156; + totalSpawns = handsSpawned; + handsSpawned = totalSpawns + 1; + arg_381A6_0[totalSpawns] = handSpawn; + totalSpawns = i; } - int num1158 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y - 400, NPCID.MoonLordHead, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num1158].netUpdate = true; + int headSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y - 400, NPCID.MoonLordHead, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[headSpawn].netUpdate = true; int[] arg_3823F_0 = array5; - num = num1155; - num1155 = num + 1; - arg_3823F_0[num] = num1158; + totalSpawns = handsSpawned; + handsSpawned = totalSpawns + 1; + arg_3823F_0[totalSpawns] = headSpawn; - for (int num1159 = 0; num1159 < 3; num1159 = num + 1) + for (int j = 0; j < 3; j = totalSpawns + 1) { - Main.npc[array5[num1159]].ai[3] = npc.whoAmI; - num = num1159; + Main.npc[array5[j]].ai[3] = npc.whoAmI; + totalSpawns = j; } - for (int num1160 = 0; num1160 < 3; num1160 = num + 1) + for (int k = 0; k < 3; k = totalSpawns + 1) { - npc.localAI[num1160] = array5[num1160]; - num = num1160; + npc.localAI[k] = array5[k]; + totalSpawns = k; } } } @@ -170,9 +175,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num = NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.npc[(int)npc.localAI[2]].Center.X, (int)Main.npc[(int)npc.localAI[2]].Center.Y, NPCID.MoonLordFreeEye); - Main.npc[num].ai[3] = npc.whoAmI; - Main.npc[num].netUpdate = true; + int totalSpawns = NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.npc[(int)npc.localAI[2]].Center.X, (int)Main.npc[(int)npc.localAI[2]].Center.Y, NPCID.MoonLordFreeEye); + Main.npc[totalSpawns].ai[3] = npc.whoAmI; + Main.npc[totalSpawns].netUpdate = true; } } @@ -182,8 +187,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.dontTakeDamage = true; npc.TargetClosest(false); - Vector2 value4 = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); - if (value4.Length() > 20f) + Vector2 targetDistance = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); + if (targetDistance.Length() > 20f) { float velocity = death ? 9.5f : 9.25f; switch (aggressionLevel) @@ -211,7 +216,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.npc[(int)npc.localAI[2]].ai[0] == 1f) velocity -= 2f; - Vector2 desiredVelocity = Vector2.Normalize(value4 - npc.velocity) * velocity; + Vector2 desiredVelocity = Vector2.Normalize(targetDistance - npc.velocity) * velocity; Vector2 velocity2 = npc.velocity; npc.SimpleFlyMovement(desiredVelocity, 0.5f); npc.velocity = Vector2.Lerp(npc.velocity, velocity2, 0.5f); @@ -220,17 +225,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { // Despawn if other parts aren't there - bool flag84 = false; + bool shouldDespawn = false; if (npc.localAI[0] < 0f || npc.localAI[1] < 0f || npc.localAI[2] < 0f) - flag84 = true; + shouldDespawn = true; else if (!Main.npc[(int)npc.localAI[0]].active || Main.npc[(int)npc.localAI[0]].type != NPCID.MoonLordHand) - flag84 = true; + shouldDespawn = true; else if (!Main.npc[(int)npc.localAI[1]].active || Main.npc[(int)npc.localAI[1]].type != NPCID.MoonLordHand) - flag84 = true; + shouldDespawn = true; else if (!Main.npc[(int)npc.localAI[2]].active || Main.npc[(int)npc.localAI[2]].type != NPCID.MoonLordHead) - flag84 = true; + shouldDespawn = true; - if (flag84) + if (shouldDespawn) { npc.life = 0; npc.HitEffect(0, 10.0); @@ -238,15 +243,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Take damage if other parts are down - bool flag85 = true; + bool coreIsOpen = true; if (Main.npc[(int)npc.localAI[0]].Calamity().newAI[0] != 1f) - flag85 = false; + coreIsOpen = false; if (Main.npc[(int)npc.localAI[1]].Calamity().newAI[0] != 1f) - flag85 = false; + coreIsOpen = false; if (Main.npc[(int)npc.localAI[2]].Calamity().newAI[0] != 1f) - flag85 = false; + coreIsOpen = false; - if (flag85) + if (coreIsOpen) { npc.ai[0] = 1f; npc.dontTakeDamage = false; @@ -261,8 +266,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.dontTakeDamage = false; npc.TargetClosest(false); - Vector2 value5 = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); - if (value5.Length() > 20f) + Vector2 targetDistanceVulnerable = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); + if (targetDistanceVulnerable.Length() > 20f) { float velocity = death ? 9.5f : 9.25f; switch (aggressionLevel) @@ -290,10 +295,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.npc[(int)npc.localAI[2]].ai[0] == 1f) velocity -= 2f; - Vector2 desiredVelocity2 = Vector2.Normalize(value5 - npc.velocity) * velocity; - Vector2 velocity3 = npc.velocity; + Vector2 desiredVelocity2 = Vector2.Normalize(targetDistanceVulnerable - npc.velocity) * velocity; + Vector2 currentVelocity = npc.velocity; npc.SimpleFlyMovement(desiredVelocity2, 0.5f); - npc.velocity = Vector2.Lerp(npc.velocity, velocity3, 0.5f); + npc.velocity = Vector2.Lerp(npc.velocity, currentVelocity, 0.5f); } } @@ -302,8 +307,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.dontTakeDamage = true; npc.Calamity().ShouldCloseHPBar = true; - Vector2 value6 = new Vector2(npc.direction, -0.5f); - npc.velocity = Vector2.Lerp(npc.velocity, value6, 0.98f); + Vector2 dyingVelocity = new Vector2(npc.direction, -0.5f); + npc.velocity = Vector2.Lerp(npc.velocity, dyingVelocity, 0.98f); npc.ai[1] += 1f; float ai1 = npc.ai[1]; @@ -334,98 +339,97 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] % 3f == 0f && npc.ai[1] < 580f && npc.ai[1] > 60f) { - Vector2 vector158 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector158 != Vector2.Zero) - vector158.Normalize(); + Vector2 randPositionOffset = Utils.RandomVector2(Main.rand, -1f, 1f); + if (randPositionOffset != Vector2.Zero) + randPositionOffset.Normalize(); - vector158 *= 20f + Main.rand.NextFloat() * 400f; - Vector2 vector159 = npc.Center + vector158; - Point point5 = vector159.ToTileCoordinates(); + randPositionOffset *= 20f + Main.rand.NextFloat() * 400f; + Vector2 npcPosition = npc.Center + randPositionOffset; + Point npcPositionTileCoords = npcPosition.ToTileCoordinates(); - bool flag86 = true; - if (!WorldGen.InWorld(point5.X, point5.Y, 0)) - flag86 = false; - if (flag86 && WorldGen.SolidTile(point5.X, point5.Y)) - flag86 = false; + bool inOpenSpace = true; + if (!WorldGen.InWorld(npcPositionTileCoords.X, npcPositionTileCoords.Y, 0)) + inOpenSpace = false; + if (inOpenSpace && WorldGen.SolidTile(npcPositionTileCoords.X, npcPositionTileCoords.Y)) + inOpenSpace = false; - float num1163 = Main.rand.Next(6, 19); - float num1164 = MathHelper.TwoPi / num1163; - float num1165 = MathHelper.TwoPi * Main.rand.NextFloat(); - float scaleFactor8 = 1f + Main.rand.NextFloat() * 2f; - float num1166 = 1f + Main.rand.NextFloat(); + float randDustAmt = Main.rand.Next(6, 19); + float twoPiOverRand = MathHelper.TwoPi * Main.rand.NextFloat(); + float dustVelocityMult = 1f + Main.rand.NextFloat() * 2f; + float dustScale = 1f + Main.rand.NextFloat(); float fadeIn = 0.4f + Main.rand.NextFloat(); - int num1167 = Utils.SelectRandom(Main.rand, new int[] + int dustType = Utils.SelectRandom(Main.rand, new int[] { 31, 229 }); - if (flag86) + if (inOpenSpace) { - //MoonlordDeathDrama.AddExplosion(vector159); - for (float num1168 = 0f; num1168 < num1163 * 2f; num1168 = ai1 + 1f) + //MoonlordDeathDrama.AddExplosion(npcPosition); + for (float j = 0f; j < randDustAmt * 2f; j = ai1 + 1f) { - Dust dust2 = Main.dust[Dust.NewDust(vector159, 0, 0, 229, 0f, 0f, 0, default, 1f)]; - dust2.noGravity = true; - dust2.position = vector159; - dust2.velocity = Vector2.UnitY.RotatedBy(num1165 + num1164 * num1168) * scaleFactor8 * (Main.rand.NextFloat() * 1.6f + 1.6f); - dust2.fadeIn = fadeIn; - dust2.scale = num1166; - ai1 = num1168; + Dust vortex = Main.dust[Dust.NewDust(npcPosition, 0, 0, 229, 0f, 0f, 0, default, 1f)]; + vortex.noGravity = true; + vortex.position = npcPosition; + vortex.velocity = Vector2.UnitY.RotatedBy(twoPiOverRand + (MathHelper.TwoPi / randDustAmt) * j) * dustVelocityMult * (Main.rand.NextFloat() * 1.6f + 1.6f); + vortex.fadeIn = fadeIn; + vortex.scale = dustScale; + ai1 = j; } } - for (float num1169 = 0f; num1169 < npc.ai[1] / 60f; num1169 = ai1 + 1f) + for (float k = 0f; k < npc.ai[1] / 60f; k = ai1 + 1f) { - Vector2 vector160 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector160 != Vector2.Zero) - vector160.Normalize(); + Vector2 randPosOffset = Utils.RandomVector2(Main.rand, -1f, 1f); + if (randPosOffset != Vector2.Zero) + randPosOffset.Normalize(); - vector160 *= 20f + Main.rand.NextFloat() * 800f; - Vector2 vector161 = npc.Center + vector160; - Point point6 = vector161.ToTileCoordinates(); + randPosOffset *= 20f + Main.rand.NextFloat() * 800f; + Vector2 npcPositioning = npc.Center + randPosOffset; + Point npcPositioningTileCoords = npcPositioning.ToTileCoordinates(); - bool flag87 = true; - if (!WorldGen.InWorld(point6.X, point6.Y, 0)) - flag87 = false; - if (flag87 && WorldGen.SolidTile(point6.X, point6.Y)) - flag87 = false; + bool isInOpenness = true; + if (!WorldGen.InWorld(npcPositioningTileCoords.X, npcPositioningTileCoords.Y, 0)) + isInOpenness = false; + if (isInOpenness && WorldGen.SolidTile(npcPositioningTileCoords.X, npcPositioningTileCoords.Y)) + isInOpenness = false; - if (flag87) + if (isInOpenness) { - Dust dust3 = Main.dust[Dust.NewDust(vector161, 0, 0, num1167, 0f, 0f, 0, default, 1f)]; - dust3.noGravity = true; - dust3.position = vector161; - dust3.velocity = -Vector2.UnitY * scaleFactor8 * (Main.rand.NextFloat() * 0.9f + 1.6f); - dust3.fadeIn = fadeIn; - dust3.scale = num1166; + Dust openDust = Main.dust[Dust.NewDust(npcPositioning, 0, 0, dustType, 0f, 0f, 0, default, 1f)]; + openDust.noGravity = true; + openDust.position = npcPositioning; + openDust.velocity = -Vector2.UnitY * dustVelocityMult * (Main.rand.NextFloat() * 0.9f + 1.6f); + openDust.fadeIn = fadeIn; + openDust.scale = dustScale; } - ai1 = num1169; + ai1 = k; } } if (npc.ai[1] % 15f == 0f && npc.ai[1] < 480f && npc.ai[1] >= 90f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector162 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector162 != Vector2.Zero) - vector162.Normalize(); + Vector2 randomOffset = Utils.RandomVector2(Main.rand, -1f, 1f); + if (randomOffset != Vector2.Zero) + randomOffset.Normalize(); - vector162 *= 20f + Main.rand.NextFloat() * 400f; - bool flag88 = true; - Vector2 vector163 = npc.Center + vector162; - Point point7 = vector163.ToTileCoordinates(); + randomOffset *= 20f + Main.rand.NextFloat() * 400f; + bool stillInTheOpen = true; + Vector2 npcOffsetPos = npc.Center + randomOffset; + Point npcOffsetPosTileCoords = npcOffsetPos.ToTileCoordinates(); - if (!WorldGen.InWorld(point7.X, point7.Y, 0)) - flag88 = false; - if (flag88 && WorldGen.SolidTile(point7.X, point7.Y)) - flag88 = false; + if (!WorldGen.InWorld(npcOffsetPosTileCoords.X, npcOffsetPosTileCoords.Y, 0)) + stillInTheOpen = false; + if (stillInTheOpen && WorldGen.SolidTile(npcOffsetPosTileCoords.X, npcOffsetPosTileCoords.Y)) + stillInTheOpen = false; - if (flag88) + if (stillInTheOpen) { - float num1170 = (Main.rand.Next(4) < 2).ToDirectionInt() * (0.3926991f + MathHelper.PiOver4 * Main.rand.NextFloat()); - Vector2 vector164 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy(num1170) * 6f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector163.X, vector163.Y, vector164.X, vector164.Y, ProjectileID.BlowupSmokeMoonlord, 0, 0f, Main.myPlayer, 0f, 0f); + float smokeRotation = (Main.rand.Next(4) < 2).ToDirectionInt() * (0.3926991f + MathHelper.PiOver4 * Main.rand.NextFloat()); + Vector2 smokePosition = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy(smokeRotation) * 6f; + Projectile.NewProjectile(npc.GetSource_FromAI(), npcOffsetPos.X, npcOffsetPos.Y, smokePosition.X, smokePosition.Y, ProjectileID.BlowupSmokeMoonlord, 0, 0f, Main.myPlayer, 0f, 0f); } } @@ -441,9 +445,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.HitEffect(0, 1337.0); npc.checkDead(); - for (int num1174 = 0; num1174 < Main.maxNPCs; num1174++) + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC5 = Main.npc[num1174]; + NPC nPC5 = Main.npc[i]; if (nPC5.active && (nPC5.type == NPCID.MoonLordHand || nPC5.type == NPCID.MoonLordHead)) { nPC5.active = false; @@ -464,8 +468,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[0] == 3f) { npc.dontTakeDamage = true; - Vector2 value7 = new Vector2(npc.direction, -0.5f); - npc.velocity = Vector2.Lerp(npc.velocity, value7, 0.98f); + Vector2 despawnVelocityLerp = new Vector2(npc.direction, -0.5f); + npc.velocity = Vector2.Lerp(npc.velocity, despawnVelocityLerp, 0.98f); npc.ai[1] += 1f; if (npc.ai[1] < 60f) @@ -473,22 +477,22 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 40f) { - for (int num1171 = 0; num1171 < Main.maxProjectiles; num1171++) + for (int j = 0; j < Main.maxProjectiles; j++) { - Projectile projectile2 = Main.projectile[num1171]; + Projectile projectile2 = Main.projectile[j]; if (projectile2.active && (projectile2.type == ProjectileID.MoonLeech || projectile2.type == ProjectileID.PhantasmalBolt || projectile2.type == ProjectileID.PhantasmalDeathray || projectile2.type == ProjectileID.PhantasmalEye || projectile2.type == ProjectileID.PhantasmalSphere)) { projectile2.active = false; if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, num1171, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, j, 0f, 0f, 0f, 0, 0, 0); } } - for (int num1172 = 0; num1172 < Main.maxNPCs; num1172++) + for (int k = 0; k < Main.maxNPCs; k++) { - NPC nPC4 = Main.npc[num1172]; + NPC nPC4 = Main.npc[k]; if (nPC4.active && nPC4.type == NPCID.MoonLordFreeEye) { nPC4.active = false; @@ -497,9 +501,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - for (int num1173 = 0; num1173 < Main.maxGore; num1173++) + for (int l = 0; l < Main.maxGore; l++) { - Gore gore2 = Main.gore[num1173]; + Gore gore2 = Main.gore[l]; if (gore2.active && gore2.type >= GoreID.MoonLordHeart1 && gore2.type <= GoreID.MoonLordHeart4) gore2.active = false; } @@ -507,9 +511,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] >= 60f) { - for (int num1174 = 0; num1174 < Main.maxNPCs; num1174++) + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC5 = Main.npc[num1174]; + NPC nPC5 = Main.npc[i]; if (nPC5.active && (nPC5.type == NPCID.MoonLordFreeEye || nPC5.type == NPCID.MoonLordHand || nPC5.type == NPCID.MoonLordHead)) { nPC5.active = false; @@ -531,24 +535,24 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Despawn - bool flag89 = false; + bool preventDespawn = false; if (npc.ai[0] == -2f || npc.ai[0] == -1f || npc.ai[0] == -2f || npc.ai[0] == 3f) - flag89 = true; + preventDespawn = true; if (Main.player[npc.target].active && !Main.player[npc.target].dead) - flag89 = true; + preventDespawn = true; - if (!flag89) + if (!preventDespawn) { - for (int num1175 = 0; num1175 < Main.maxPlayers; num1175++) + for (int p = 0; p < Main.maxPlayers; p++) { - if (Main.player[num1175].active && !Main.player[num1175].dead) + if (Main.player[p].active && !Main.player[p].dead) { - flag89 = true; + preventDespawn = true; break; } } } - if (!flag89) + if (!preventDespawn) { npc.ai[0] = 3f; npc.ai[1] = 0f; @@ -582,9 +586,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Main.npc[(int)npc.localAI[2]].netUpdate = true; } - for (int num1176 = 0; num1176 < Main.maxNPCs; num1176++) + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC7 = Main.npc[num1176]; + NPC nPC7 = Main.npc[i]; if (nPC7.active && nPC7.type == NPCID.MoonLordFreeEye) { NPC nPC6 = nPC7; @@ -611,11 +615,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity = Vector2.Zero; npc.Center = Main.npc[(int)npc.ai[3]].Center + new Vector2(0f, -400f); - Vector2 value19 = new Vector2(27f, 59f); - float num1207 = 0f; - float num1208 = 0f; - int num1209 = 0; - int num1210 = 0; + Vector2 boltAndDeathrayVector = new Vector2(27f, 59f); + float attackTimer = 0f; + float attackTimerComparison = 0f; + int headVulnerability = 0; + int deathrayCheck = 0; // Invulnerable if (npc.ai[0] >= 0f || npc.ai[0] == -2f) @@ -638,36 +642,35 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Set up attacks - float num1211 = npc.ai[0]; + float ai0CrossCheck = npc.ai[0]; npc.ai[1] += 1f; - int num1212 = (int)Main.npc[(int)npc.ai[3]].ai[2]; - int num1213 = 2; - int num1214 = 0; - int num1215 = 0; + int attackType = (int)Main.npc[(int)npc.ai[3]].ai[2]; + int fiveFrameCounter = 0; + int attackTimerIncrement = 0; - while (num1214 < 5) + while (fiveFrameCounter < 5) { - num1208 = NPC.MoonLordAttacksArray[num1212, num1213, 1, num1214]; - if (num1208 + num1215 > npc.ai[1]) + attackTimerComparison = NPC.MoonLordAttacksArray[attackType, 2, 1, fiveFrameCounter]; + if (attackTimerComparison + attackTimerIncrement > npc.ai[1]) break; - num1215 += (int)num1208; - int num = num1214; - num1214 = num + 1; + attackTimerIncrement += (int)attackTimerComparison; + int totalSpawns = fiveFrameCounter; + fiveFrameCounter = totalSpawns + 1; } - if (num1214 == 5) + if (fiveFrameCounter == 5) { - num1214 = 0; + fiveFrameCounter = 0; npc.ai[1] = 0f; - num1208 = NPC.MoonLordAttacksArray[num1212, num1213, 1, num1214]; - num1215 = 0; + attackTimerComparison = NPC.MoonLordAttacksArray[attackType, 2, 1, fiveFrameCounter]; + attackTimerIncrement = 0; } - npc.ai[0] = NPC.MoonLordAttacksArray[num1212, num1213, 0, num1214]; - num1207 = (int)npc.ai[1] - num1215; + npc.ai[0] = NPC.MoonLordAttacksArray[attackType, 2, 0, fiveFrameCounter]; + attackTimer = (int)npc.ai[1] - attackTimerIncrement; - if (npc.ai[0] != num1211) + if (npc.ai[0] != ai0CrossCheck) npc.netUpdate = true; } @@ -690,65 +693,61 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Set variables for deathray else if (npc.ai[0] == 0f) { - num1210 = 3; + deathrayCheck = 3; npc.TargetClosest(false); Vector2 v3 = Main.player[npc.target].Center - npc.Center - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; + float deathrayTravelDist = v3.Length() / 500f; + if (deathrayTravelDist > 1f) + deathrayTravelDist = 1f; - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; + deathrayTravelDist = 1f - deathrayTravelDist; + deathrayTravelDist *= 2f; + if (deathrayTravelDist > 1f) + deathrayTravelDist = 1f; npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; + npc.localAI[1] = deathrayTravelDist; npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 1f, 0.2f); } // Deathray if (npc.ai[0] == 1f) { - if (num1207 < 180f) + if (attackTimer < 180f) { npc.localAI[1] -= 0.05f; if (npc.localAI[1] < 0f) npc.localAI[1] = 0f; - if (num1207 >= 60f) + if (attackTimer >= 60f) { Vector2 center20 = npc.Center; // Hopefully it plays - if (num1207 == 60f) + if (attackTimer == 60f) SoundEngine.PlaySound(DeathrayChargeSound, center20); - int num1220 = 0; - if (num1207 >= 120f) - num1220 = 1; + int deathrayAttackDustAmt = 0; + if (attackTimer >= 120f) + deathrayAttackDustAmt = 1; - for (int num1221 = 0; num1221 < 1 + num1220; num1221++) + for (int i = 0; i < 1 + deathrayAttackDustAmt; i++) { - int num1222 = 229; - float num1223 = 0.8f; - if (num1221 % 2 == 1) - { - num1222 = 229; - num1223 = 1.65f; - } + float deathrayAttackDustScale = 0.8f; + if (i % 2 == 1) + deathrayAttackDustScale = 1.65f; - Vector2 vector199 = center20 + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * value19 / 2f; - int num1224 = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, num1222, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); - Main.dust[num1224].velocity = Vector2.Normalize(center20 - vector199) * 3.5f * (10f - num1220 * 2f) / 10f; - Main.dust[num1224].noGravity = true; - Main.dust[num1224].scale = num1223; - Main.dust[num1224].customData = npc; + Vector2 deathrayAttackDustRotation = center20 + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * boltAndDeathrayVector / 2f; + int deathrayAttackDust = Dust.NewDust(deathrayAttackDustRotation - Vector2.One * 8f, 16, 16, 229, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); + Main.dust[deathrayAttackDust].velocity = Vector2.Normalize(center20 - deathrayAttackDustRotation) * 3.5f * (10f - deathrayAttackDustAmt * 2f) / 10f; + Main.dust[deathrayAttackDust].noGravity = true; + Main.dust[deathrayAttackDust].scale = deathrayAttackDustScale; + Main.dust[deathrayAttackDust].customData = npc; } } } - else if (num1207 < num1208 - 15f) + else if (attackTimer < attackTimerComparison - 15f) { if (calamityGlobalNPC.newAI[1] == 0f) { @@ -780,22 +779,22 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - if (num1207 == 180f && Main.netMode != NetmodeID.MultiplayerClient) + if (attackTimer == 180f && Main.netMode != NetmodeID.MultiplayerClient) { int projectileType = ProjectileID.PhantasmalDeathray; int damage = npc.GetProjectileDamage(projectileType); npc.TargetClosest(false); - Vector2 vector200 = Main.player[npc.target].Center - npc.Center; - vector200.Normalize(); + Vector2 deathrayRotationSpeed = Main.player[npc.target].Center - npc.Center; + deathrayRotationSpeed.Normalize(); - float num1225 = -1f; - if (vector200.X < 0f) - num1225 = 1f; + float deathrayRotationDirection = -1f; + if (deathrayRotationSpeed.X < 0f) + deathrayRotationDirection = 1f; - vector200 = vector200.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, vector200.X, vector200.Y, projectileType, damage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); - npc.ai[2] = (vector200.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * num1225; + deathrayRotationSpeed = deathrayRotationSpeed.RotatedBy(-(double)deathrayRotationDirection * MathHelper.TwoPi / 6f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, deathrayRotationSpeed.X, deathrayRotationSpeed.Y, projectileType, damage, 0f, Main.myPlayer, deathrayRotationDirection * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); + npc.ai[2] = (deathrayRotationSpeed.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * deathrayRotationDirection; npc.netUpdate = true; } @@ -803,15 +802,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] > 1f) npc.localAI[1] = 1f; - float num1226 = (npc.ai[2] >= 0f).ToDirectionInt(); - float num1227 = npc.ai[2]; - if (num1227 < 0f) - num1227 *= -1f; + float deathrayFaceDirection = (npc.ai[2] >= 0f).ToDirectionInt(); + float deathrayTimer = npc.ai[2]; + if (deathrayTimer < 0f) + deathrayTimer *= -1f; - num1227 += -(MathHelper.Pi + MathHelper.TwoPi); - num1227 += num1226 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1]; - npc.localAI[0] = num1227; - npc.ai[2] = (num1227 + MathHelper.Pi + MathHelper.TwoPi) * num1226; + deathrayTimer += -(MathHelper.Pi + MathHelper.TwoPi); + deathrayTimer += deathrayFaceDirection * MathHelper.TwoPi / calamityGlobalNPC.newAI[1]; + npc.localAI[0] = deathrayTimer; + npc.ai[2] = (deathrayTimer + MathHelper.Pi + MathHelper.TwoPi) * deathrayFaceDirection; } else { @@ -823,7 +822,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && Main.remixWorld) { - for (int num1268 = 0; num1268 < 30; num1268++) + for (int k = 0; k < 30; k++) { if (!WorldGen.SolidTile((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f))) Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-1599, 1600) * 0.01f, (float)Main.rand.Next(-1599, 1) * 0.01f, ProjectileID.MoonBoulder, 70, 10f); @@ -831,46 +830,46 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - num1210 = 3; + deathrayCheck = 3; } } // Moon Leech thing else if (npc.ai[0] == 2f) { - num1209 = 2; - num1210 = 3; - Vector2 value21 = new Vector2(0f, 216f); + headVulnerability = 2; + deathrayCheck = 3; + Vector2 leechCenterOffset = new Vector2(0f, 216f); - if (num1207 == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (attackTimer == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector201 = npc.Center + value21; - for (int num1228 = 0; num1228 < Main.maxPlayers; num1228++) + Vector2 leechNPCCenter = npc.Center + leechCenterOffset; + for (int i = 0; i < Main.maxPlayers; i++) { - Player player6 = Main.player[num1228]; - if (player6.active && !player6.dead && Vector2.Distance(player6.Center, vector201) <= 3000f) + Player player6 = Main.player[i]; + if (player6.active && !player6.dead && Vector2.Distance(player6.Center, leechNPCCenter) <= 3000f) { - Vector2 vector202 = Main.player[npc.target].Center - vector201; - if (vector202 != Vector2.Zero) - vector202.Normalize(); + Vector2 targetLeechDist = Main.player[npc.target].Center - leechNPCCenter; + if (targetLeechDist != Vector2.Zero) + targetLeechDist.Normalize(); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector201.X, vector201.Y, vector202.X, vector202.Y, ProjectileID.MoonLeech, 0, 0f, Main.myPlayer, npc.whoAmI + 1, num1228); + Projectile.NewProjectile(npc.GetSource_FromAI(), leechNPCCenter.X, leechNPCCenter.Y, targetLeechDist.X, targetLeechDist.Y, ProjectileID.MoonLeech, 0, 0f, Main.myPlayer, npc.whoAmI + 1, i); } } } - if ((num1207 == 120f || num1207 == 150f || num1207 == 180f || num1207 == 210f || num1207 == 240f) && Main.netMode != NetmodeID.MultiplayerClient) + if ((attackTimer == 120f || attackTimer == 150f || attackTimer == 180f || attackTimer == 210f || attackTimer == 240f) && Main.netMode != NetmodeID.MultiplayerClient) { - for (int num1229 = 0; num1229 < Main.maxProjectiles; num1229++) + for (int j = 0; j < Main.maxProjectiles; j++) { - Projectile projectile6 = Main.projectile[num1229]; + Projectile projectile6 = Main.projectile[j]; if (projectile6.active && projectile6.type == ProjectileID.MoonLeech && Main.player[(int)projectile6.ai[1]].FindBuffIndex(BuffID.MoonLeech) != -1) { - Vector2 center21 = Main.player[npc.target].Center; - int num1230 = NPC.NewNPC(npc.GetSource_FromAI(), (int)center21.X, (int)center21.Y, NPCID.MoonLordLeechBlob); - Main.npc[num1230].netUpdate = true; - Main.npc[num1230].ai[0] = npc.whoAmI + 1; - Main.npc[num1230].ai[1] = num1229; + Vector2 targetCenter = Main.player[npc.target].Center; + int moonLeech = NPC.NewNPC(npc.GetSource_FromAI(), (int)targetCenter.X, (int)targetCenter.Y, NPCID.MoonLordLeechBlob); + Main.npc[moonLeech].netUpdate = true; + Main.npc[moonLeech].ai[0] = npc.whoAmI + 1; + Main.npc[moonLeech].ai[1] = j; } } } @@ -879,16 +878,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phantasmal Bolts else if (npc.ai[0] == 3f) { - if (num1207 == 0f) + if (attackTimer == 0f) { npc.TargetClosest(false); npc.netUpdate = true; } Vector2 v4 = Main.player[npc.target].Center - npc.Center; - bool shootFirstBolt = num1207 == num1208 - 14f; - bool shootSecondBolt = num1207 == num1208 - 7f; - bool shootThirdBolt = num1207 == num1208; + bool shootFirstBolt = attackTimer == attackTimerComparison - 14f; + bool shootSecondBolt = attackTimer == attackTimerComparison - 7f; + bool shootThirdBolt = attackTimer == attackTimerComparison; switch (aggressionLevel) { case 6: @@ -916,12 +915,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] > 1f) npc.localAI[1] = 1f; - if (num1207 == num1208 - 35f) + if (attackTimer == attackTimerComparison - 35f) SoundEngine.PlaySound(SoundID.NPCDeath6, npc.position); if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector203 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), value19 * npc.localAI[1]); + Vector2 boltDirection = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), boltAndDeathrayVector * npc.localAI[1]); float velocity = death ? 6.75f : 6.25f; switch (aggressionLevel) @@ -943,28 +942,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - Vector2 vector204 = Vector2.Normalize(v4) * velocity; + Vector2 boltVelocity = Vector2.Normalize(v4) * velocity; int type = ProjectileID.PhantasmalBolt; int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + vector203.X, npc.Center.Y + vector203.Y, vector204.X, vector204.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + boltDirection.X, npc.Center.Y + boltDirection.Y, boltVelocity.X, boltVelocity.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); } } // Dictates whether this npc is vulnerable or not - int num1231 = num1209 * 7; - if (num1231 > npc.localAI[2]) + int headEyeVulnerableCheck = headVulnerability * 7; + if (headEyeVulnerableCheck > npc.localAI[2]) npc.localAI[2] += 1f; - if (num1231 < npc.localAI[2]) + if (headEyeVulnerableCheck < npc.localAI[2]) npc.localAI[2] -= 1f; if (npc.localAI[2] < 0f) npc.localAI[2] = 0f; if (npc.localAI[2] > 14f) npc.localAI[2] = 14f; - int num1232 = num1210 * 5; - if (num1232 > npc.localAI[3]) + int headEyeDeathrayCheck = deathrayCheck * 5; + if (headEyeDeathrayCheck > npc.localAI[3]) npc.localAI[3] += 1f; - if (num1232 < npc.localAI[3]) + if (headEyeDeathrayCheck < npc.localAI[3]) npc.localAI[3] -= 1f; if (npc.localAI[3] < 0f) npc.localAI[2] = 0f; @@ -985,18 +984,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Variables - bool flag90 = npc.ai[2] == 0f; - float num1177 = -flag90.ToDirectionInt(); - npc.spriteDirection = (int)num1177; + bool isLeftHand = npc.ai[2] == 0f; + float handFaceDirection = -isLeftHand.ToDirectionInt(); + npc.spriteDirection = (int)handFaceDirection; npc.dontTakeDamage = npc.frameCounter >= 21.0; if (calamityGlobalNPC.newAI[0] == 1f) npc.dontTakeDamage = true; - Vector2 vector165 = new Vector2(30f, 66f); - float num1178 = 0f; - float num1179 = 0f; - int num1180 = 0; + Vector2 handBehaviorVector = new Vector2(30f, 66f); + float handAttackTimer = 0f; + float handAttackTimerComparison = 0f; + int handFrameCheck = 0; // Go to die if (Main.npc[(int)npc.ai[3]].ai[0] == 2f) @@ -1015,41 +1014,41 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.dontTakeDamage = true; } - float num1181 = npc.ai[0]; + float handAI0CrossCheck = npc.ai[0]; npc.ai[1] += 1f; - int num1182 = (int)Main.npc[(int)npc.ai[3]].ai[2]; - int num1183 = flag90 ? 0 : 1; - int num1184 = 0; - int num1185 = 0; + int handAttackType = (int)Main.npc[(int)npc.ai[3]].ai[2]; + int handType = isLeftHand ? 0 : 1; + int handFiveFrameTimer = 0; + int handAttackTimerIncrement = 0; - while (num1184 < 5) + while (handFiveFrameTimer < 5) { - num1179 = NPC.MoonLordAttacksArray[num1182, num1183, 1, num1184]; - if (num1179 + num1185 > npc.ai[1]) + handAttackTimerComparison = NPC.MoonLordAttacksArray[handAttackType, handType, 1, handFiveFrameTimer]; + if (handAttackTimerComparison + handAttackTimerIncrement > npc.ai[1]) break; - num1185 += (int)num1179; - int num = num1184; - num1184 = num + 1; + handAttackTimerIncrement += (int)handAttackTimerComparison; + int totalSpawns = handFiveFrameTimer; + handFiveFrameTimer = totalSpawns + 1; } - if (num1184 == 5) + if (handFiveFrameTimer == 5) { - num1184 = 0; + handFiveFrameTimer = 0; npc.ai[1] = 0f; - num1179 = NPC.MoonLordAttacksArray[num1182, num1183, 1, num1184]; - num1185 = 0; + handAttackTimerComparison = NPC.MoonLordAttacksArray[handAttackType, handType, 1, handFiveFrameTimer]; + handAttackTimerIncrement = 0; } - npc.ai[0] = NPC.MoonLordAttacksArray[num1182, num1183, 0, num1184]; - num1178 = (int)npc.ai[1] - num1185; - if (npc.ai[0] != num1181) + npc.ai[0] = NPC.MoonLordAttacksArray[handAttackType, handType, 0, handFiveFrameTimer]; + handAttackTimer = (int)npc.ai[1] - handAttackTimerIncrement; + if (npc.ai[0] != handAI0CrossCheck) npc.netUpdate = true; } if (npc.ai[0] == -2f) { - num1180 = 0; + handFrameCheck = 0; npc.dontTakeDamage = true; @@ -1059,18 +1058,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Move else if (npc.ai[0] == 0f) { - num1180 = 3; + handFrameCheck = 3; npc.localAI[1] -= 0.05f; if (npc.localAI[1] < 0f) npc.localAI[1] = 0f; - Vector2 center15 = Main.npc[(int)npc.ai[3]].Center; - Vector2 value10 = center15 + new Vector2(350f * num1177, -100f); - Vector2 vector167 = value10 - npc.Center; + Vector2 handCenter = Main.npc[(int)npc.ai[3]].Center; + Vector2 handMovementVector = handCenter + new Vector2(350f * handFaceDirection, -100f); + Vector2 handMovementDirection = handMovementVector - npc.Center; - if (vector167.Length() > 20f) + if (handMovementDirection.Length() > 20f) { - vector167.Normalize(); + handMovementDirection.Normalize(); float velocity = death ? 7.75f : 7.5f; switch (aggressionLevel) @@ -1096,23 +1095,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - vector167 *= velocity; - Vector2 velocity5 = npc.velocity; + handMovementDirection *= velocity; + Vector2 handVelocity = npc.velocity; - if (vector167 != Vector2.Zero) - npc.SimpleFlyMovement(vector167, 0.3f); + if (handMovementDirection != Vector2.Zero) + npc.SimpleFlyMovement(handMovementDirection, 0.3f); - npc.velocity = Vector2.Lerp(velocity5, npc.velocity, 0.5f); + npc.velocity = Vector2.Lerp(handVelocity, npc.velocity, 0.5f); } } // Phantasmal Eyes else if (npc.ai[0] == 1f) { - num1180 = 0; - int num1186 = 7; - int num1187 = 4; - + handFrameCheck = 0; float divisor = 6f; switch (aggressionLevel) { @@ -1137,26 +1133,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - if (num1178 >= (num1186 * num1187 * 2)) + if (handAttackTimer >= 56) { npc.localAI[1] -= 0.07f; if (npc.localAI[1] < 0f) npc.localAI[1] = 0f; } - else if (num1178 >= (num1186 * num1187)) + else if (handAttackTimer >= 28) { npc.localAI[1] += 0.05f; if (npc.localAI[1] > 0.75f) npc.localAI[1] = 0.75f; - float num1188 = MathHelper.TwoPi * (num1178 % (num1186 * num1187)) / (num1186 * num1187) - MathHelper.PiOver2; - npc.localAI[0] = new Vector2((float)Math.Cos(num1188) * vector165.X, (float)Math.Sin(num1188) * vector165.Y).ToRotation(); + float handLocalAI = MathHelper.TwoPi * (handAttackTimer % 28) / 28 - MathHelper.PiOver2; + npc.localAI[0] = new Vector2((float)Math.Cos(handLocalAI) * handBehaviorVector.X, (float)Math.Sin(handLocalAI) * handBehaviorVector.Y).ToRotation(); - if (num1178 % divisor == 0f) + if (handAttackTimer % divisor == 0f) { - Vector2 value11 = new Vector2(1f * -num1177, 3f); - Vector2 vector168 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), vector165 * npc.localAI[1]); - Vector2 vector169 = npc.Center + Vector2.Normalize(vector168) * vector165.Length() * 0.4f + value11; + Vector2 handAttackVector = new Vector2(1f * -handFaceDirection, 3f); + Vector2 handAttackRotation = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), handBehaviorVector * npc.localAI[1]); + Vector2 handAttackMovement = npc.Center + Vector2.Normalize(handAttackRotation) * handBehaviorVector.Length() * 0.4f + handAttackVector; float velocity = death ? 3.5f : 3f; switch (aggressionLevel) @@ -1178,11 +1174,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - Vector2 vector170 = Vector2.Normalize(vector168) * velocity; - float ai = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * num1177; + Vector2 handAttackDirection = Vector2.Normalize(handAttackRotation) * velocity; + float ai = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * handFaceDirection; int type = ProjectileID.PhantasmalEye; int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), vector169, vector170, type, damage, 0f, Main.myPlayer, 0f, ai); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), handAttackMovement, handAttackDirection, type, damage, 0f, Main.myPlayer, 0f, ai); Main.projectile[proj].timeLeft = 1200; Main.projectile[proj].Calamity().lineColor = bossRush ? 1 : aggressionLevel; } @@ -1193,8 +1189,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] > 0.75f) npc.localAI[1] = 0.75f; - float num1189 = MathHelper.TwoPi * (num1178 % (num1186 * num1187)) / (num1186 * num1187) - MathHelper.PiOver2; - npc.localAI[0] = new Vector2((float)Math.Cos(num1189) * vector165.X, (float)Math.Sin(num1189) * vector165.Y).ToRotation(); + float handPauseDirection = MathHelper.TwoPi * (handAttackTimer % 28) / 28 - MathHelper.PiOver2; + npc.localAI[0] = new Vector2((float)Math.Cos(handPauseDirection) * handBehaviorVector.X, (float)Math.Sin(handPauseDirection) * handBehaviorVector.Y).ToRotation(); } } @@ -1205,10 +1201,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] < 0f) npc.localAI[1] = 0f; - Vector2 center16 = Main.npc[(int)npc.ai[3]].Center; - Vector2 value12 = new Vector2(220f * num1177, -60f) + center16; - value12 += new Vector2(num1177 * 100f, -50f); - Vector2 value13 = new Vector2(400f * num1177, -60f); + Vector2 handCenter = Main.npc[(int)npc.ai[3]].Center; + Vector2 sphereHandDirection = new Vector2(220f * handFaceDirection, -60f) + handCenter; + sphereHandDirection += new Vector2(handFaceDirection * 100f, -50f); + Vector2 sphereHandDirectionMaxBound = new Vector2(400f * handFaceDirection, -60f); float velocityMultiplier = death ? 0.88f : 0.885f; switch (aggressionLevel) @@ -1234,13 +1230,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - if (num1178 < 30f) + if (handAttackTimer < 30f) { - Vector2 vector171 = value12 - npc.Center; - if (vector171 != Vector2.Zero) + Vector2 sphereHandTravelVelocity = sphereHandDirection - npc.Center; + if (sphereHandTravelVelocity != Vector2.Zero) { - Vector2 vector172 = vector171; - vector172.Normalize(); + Vector2 sphereHandTravelDist = sphereHandTravelVelocity; + sphereHandTravelDist.Normalize(); float velocity = death ? 11f : 10f; switch (aggressionLevel) @@ -1266,13 +1262,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - npc.velocity = Vector2.SmoothStep(npc.velocity, vector172 * Math.Min(velocity, vector171.Length()), 0.2f); + npc.velocity = Vector2.SmoothStep(npc.velocity, sphereHandTravelDist * Math.Min(velocity, sphereHandTravelVelocity.Length()), 0.2f); } } - else if (num1178 < 210f) + else if (handAttackTimer < 210f) { - num1180 = 1; - int num1190 = (int)num1178 - 30; + handFrameCheck = 1; + int sphereHandSpeed = (int)handAttackTimer - 30; int divisor = 30; switch (aggressionLevel) @@ -1298,24 +1294,24 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - if (num1190 % divisor == 0 && Main.netMode != NetmodeID.MultiplayerClient) + if (sphereHandSpeed % divisor == 0 && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector173 = new Vector2(5f * num1177, -8f); - int num1191 = num1190 / 30; - vector173.X += (num1191 - 3.5f) * num1177 * 3f; - vector173.Y += (num1191 - 4.5f) * 1f; - vector173 *= 1.2f; + Vector2 sphereFireDirection = new Vector2(5f * handFaceDirection, -8f); + int finalSphereHandSpeed = sphereHandSpeed / 30; + sphereFireDirection.X += (finalSphereHandSpeed - 3.5f) * handFaceDirection * 3f; + sphereFireDirection.Y += (finalSphereHandSpeed - 4.5f) * 1f; + sphereFireDirection *= 1.2f; int type = ProjectileID.PhantasmalSphere; int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, vector173.X, vector173.Y, type, damage, 1f, Main.myPlayer, 0f, npc.whoAmI); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, sphereFireDirection.X, sphereFireDirection.Y, type, damage, 1f, Main.myPlayer, 0f, npc.whoAmI); Main.projectile[proj].timeLeft = 1200; } - Vector2 vector174 = Vector2.SmoothStep(value12, value12 + value13, (num1178 - 30f) / 180f) - npc.Center; - if (vector174 != Vector2.Zero) + Vector2 handSmoothMovement = Vector2.SmoothStep(sphereHandDirection, sphereHandDirection + sphereHandDirectionMaxBound, (handAttackTimer - 30f) / 180f) - npc.Center; + if (handSmoothMovement != Vector2.Zero) { - Vector2 vector175 = vector174; - vector175.Normalize(); + Vector2 handSmoothMoveNormalize = handSmoothMovement; + handSmoothMoveNormalize.Normalize(); float velocity = death ? 26.5f : 24f; switch (aggressionLevel) @@ -1341,34 +1337,34 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - npc.velocity = Vector2.Lerp(npc.velocity, vector175 * Math.Min(velocity, vector174.Length()), 0.5f); + npc.velocity = Vector2.Lerp(npc.velocity, handSmoothMoveNormalize * Math.Min(velocity, handSmoothMovement.Length()), 0.5f); } } - else if (num1178 < 282f) + else if (handAttackTimer < 282f) { - num1180 = 0; + handFrameCheck = 0; npc.velocity *= velocityMultiplier; } - else if (num1178 < 287f) + else if (handAttackTimer < 287f) { - num1180 = 1; + handFrameCheck = 1; npc.velocity *= velocityMultiplier; } - else if (num1178 < 292f) + else if (handAttackTimer < 292f) { - num1180 = 2; + handFrameCheck = 2; npc.velocity *= velocityMultiplier; } - else if (num1178 < 300f) + else if (handAttackTimer < 300f) { - num1180 = 3; + handFrameCheck = 3; - if (num1178 == 292f && Main.netMode != NetmodeID.MultiplayerClient) + if (handAttackTimer == 292f && Main.netMode != NetmodeID.MultiplayerClient) { - int num1193 = Player.FindClosest(npc.position, npc.width, npc.height); - Vector2 vector176 = Vector2.Normalize(Main.player[num1193].Center - (npc.Center + Vector2.UnitY * -350f)); - if (float.IsNaN(vector176.X) || float.IsNaN(vector176.Y)) - vector176 = Vector2.UnitY; + int closestPlayer = Player.FindClosest(npc.position, npc.width, npc.height); + Vector2 sphereVelocity = Vector2.Normalize(Main.player[closestPlayer].Center - (npc.Center + Vector2.UnitY * -350f)); + if (float.IsNaN(sphereVelocity.X) || float.IsNaN(sphereVelocity.Y)) + sphereVelocity = Vector2.UnitY; float velocity = death ? 2.2f : 2f; switch (aggressionLevel) @@ -1394,24 +1390,24 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - vector176 *= velocity; - for (int num1194 = 0; num1194 < Main.maxProjectiles; num1194++) + sphereVelocity *= velocity; + for (int i = 0; i < Main.maxProjectiles; i++) { - Projectile projectile3 = Main.projectile[num1194]; - if (projectile3.active && projectile3.type == ProjectileID.PhantasmalSphere && projectile3.ai[1] == npc.whoAmI && projectile3.ai[0] != -1f) + Projectile currentProjectile = Main.projectile[i]; + if (currentProjectile.active && currentProjectile.type == ProjectileID.PhantasmalSphere && currentProjectile.ai[1] == npc.whoAmI && currentProjectile.ai[0] != -1f) { - projectile3.ai[0] = -1f; - projectile3.velocity = vector176; - projectile3.netUpdate = true; + currentProjectile.ai[0] = -1f; + currentProjectile.velocity = sphereVelocity; + currentProjectile.netUpdate = true; } } } - Vector2 vector177 = Vector2.SmoothStep(value12, value12 + value13, 1f - (num1178 - 270f) / 30f) - npc.Center; - if (vector177 != Vector2.Zero) + Vector2 handPauseSmoothSpeed = Vector2.SmoothStep(sphereHandDirection, sphereHandDirection + sphereHandDirectionMaxBound, 1f - (handAttackTimer - 270f) / 30f) - npc.Center; + if (handPauseSmoothSpeed != Vector2.Zero) { - Vector2 vector178 = vector177; - vector178.Normalize(); + Vector2 handPauseDirection = handPauseSmoothSpeed; + handPauseDirection.Normalize(); float velocity = death ? 19.75f : 17.5f; switch (aggressionLevel) @@ -1437,18 +1433,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - npc.velocity = Vector2.Lerp(npc.velocity, vector178 * Math.Min(velocity, vector177.Length()), 0.1f); + npc.velocity = Vector2.Lerp(npc.velocity, handPauseDirection * Math.Min(velocity, handPauseSmoothSpeed.Length()), 0.1f); } } else { - num1180 = 3; + handFrameCheck = 3; - Vector2 vector179 = value12 - npc.Center; - if (vector179 != Vector2.Zero) + Vector2 handReturnSmoothSpeed = sphereHandDirection - npc.Center; + if (handReturnSmoothSpeed != Vector2.Zero) { - Vector2 vector180 = vector179; - vector180.Normalize(); + Vector2 handReturnDirection = handReturnSmoothSpeed; + handReturnDirection.Normalize(); float velocity = death ? 11f : 10f; switch (aggressionLevel) @@ -1474,7 +1470,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - npc.velocity = Vector2.SmoothStep(npc.velocity, vector180 * Math.Min(velocity, vector179.Length()), 0.2f); + npc.velocity = Vector2.SmoothStep(npc.velocity, handReturnDirection * Math.Min(velocity, handReturnSmoothSpeed.Length()), 0.2f); } } } @@ -1482,16 +1478,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phantasmal Bolts else if (npc.ai[0] == 3f) { - if (num1178 == 0f) + if (handAttackTimer == 0f) { npc.TargetClosest(false); npc.netUpdate = true; } Vector2 v = Main.player[npc.target].Center - npc.Center; - bool shootFirstBolt = num1178 == num1179 - 14f; - bool shootSecondBolt = num1178 == num1179 - 7f; - bool shootThirdBolt = num1178 == num1179; + bool shootFirstBolt = handAttackTimer == handAttackTimerComparison - 14f; + bool shootSecondBolt = handAttackTimer == handAttackTimerComparison - 7f; + bool shootThirdBolt = handAttackTimer == handAttackTimerComparison; switch (aggressionLevel) { case 6: @@ -1520,12 +1516,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] > 1f) npc.localAI[1] = 1f; - if (num1178 == num1179 - 35f) + if (handAttackTimer == handAttackTimerComparison - 35f) SoundEngine.PlaySound(SoundID.NPCDeath6, npc.position); if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector181 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), vector165 * npc.localAI[1]); + Vector2 boltShootDirection = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), handBehaviorVector * npc.localAI[1]); float velocity = death ? 6.75f : 6.25f; switch (aggressionLevel) @@ -1547,39 +1543,39 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - Vector2 vector182 = Vector2.Normalize(v) * velocity; + Vector2 boltShootSpeed = Vector2.Normalize(v) * velocity; int type = ProjectileID.PhantasmalBolt; int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + vector181.X, npc.Center.Y + vector181.Y, vector182.X, vector182.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + boltShootDirection.X, npc.Center.Y + boltShootDirection.Y, boltShootSpeed.X, boltShootSpeed.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); } } // Center - Vector2 center17 = Main.npc[(int)npc.ai[3]].Center; - Vector2 value14 = new Vector2(220f * num1177, -60f) + center17; - Vector2 vector183 = value14 + new Vector2(num1177 * 110f, -150f); - Vector2 vector184 = vector183 + new Vector2(num1177 * 370f, 150f); + Vector2 handCentering = Main.npc[(int)npc.ai[3]].Center; + Vector2 handDirection = new Vector2(220f * handFaceDirection, -60f) + handCentering; + Vector2 minHandFaceDirection = handDirection + new Vector2(handFaceDirection * 110f, -150f); + Vector2 maxHandFaceDirection = minHandFaceDirection + new Vector2(handFaceDirection * 370f, 150f); - if (vector183.X > vector184.X) - Utils.Swap(ref vector183.X, ref vector184.X); - if (vector183.Y > vector184.Y) - Utils.Swap(ref vector183.Y, ref vector184.Y); + if (minHandFaceDirection.X > maxHandFaceDirection.X) + Utils.Swap(ref minHandFaceDirection.X, ref maxHandFaceDirection.X); + if (minHandFaceDirection.Y > maxHandFaceDirection.Y) + Utils.Swap(ref minHandFaceDirection.Y, ref maxHandFaceDirection.Y); - Vector2 value15 = Vector2.Clamp(npc.Center + npc.velocity, vector183, vector184); - if (value15 != npc.Center + npc.velocity) - npc.Center = value15 - npc.velocity; + Vector2 handVelocity = Vector2.Clamp(npc.Center + npc.velocity, minHandFaceDirection, maxHandFaceDirection); + if (handVelocity != npc.Center + npc.velocity) + npc.Center = handVelocity - npc.velocity; // Frames - int num1195 = num1180 * 7; - if (num1195 > npc.frameCounter) + int handFrameTimer = handFrameCheck * 7; + if (handFrameTimer > npc.frameCounter) { - double num1196 = npc.frameCounter; - npc.frameCounter = num1196 + 1.0; + double handFrameControl = npc.frameCounter; + npc.frameCounter = handFrameControl + 1.0; } - if (num1195 < npc.frameCounter) + if (handFrameTimer < npc.frameCounter) { - double num1196 = npc.frameCounter; - npc.frameCounter = num1196 - 1.0; + double handFrameControl = npc.frameCounter; + npc.frameCounter = handFrameControl - 1.0; } if (npc.frameCounter < 0.0) @@ -1631,7 +1627,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.rand.NextBool(420)) SoundEngine.PlaySound(Main.rand.NextBool() ? SoundID.Zombie100 : SoundID.Zombie101, npc.Center); - Vector2 value22 = new Vector2(30f); + Vector2 thirtyVector = new Vector2(30f); if (!Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.MoonLordCore) { @@ -1640,35 +1636,35 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.active = false; } - float num1241 = 0f; - float num1242 = npc.ai[0]; + float secondAttackPicker = 0f; + float ai0Copy = npc.ai[0]; npc.ai[1] += 1f; - int num1243 = 0; - int num1244 = 0; - while (num1243 < 10) + int secondAttackArrayInc = 0; + int secondAttackPickerInc = 0; + while (secondAttackArrayInc < 10) { - num1241 = NPC.MoonLordAttacksArray2[1, num1243]; - if (num1241 + num1244 > npc.ai[1]) + secondAttackPicker = NPC.MoonLordAttacksArray2[1, secondAttackArrayInc]; + if (secondAttackPicker + secondAttackPickerInc > npc.ai[1]) break; - num1244 += (int)num1241; - num1243 += 1; + secondAttackPickerInc += (int)secondAttackPicker; + secondAttackArrayInc += 1; } - if (num1243 == 10) + if (secondAttackArrayInc == 10) { - num1243 = 0; + secondAttackArrayInc = 0; npc.ai[1] = 0f; - num1241 = NPC.MoonLordAttacksArray2[1, num1243]; - num1244 = 0; + secondAttackPicker = NPC.MoonLordAttacksArray2[1, secondAttackArrayInc]; + secondAttackPickerInc = 0; } - npc.ai[0] = NPC.MoonLordAttacksArray2[0, num1243]; - float num1245 = (int)npc.ai[1] - num1244; + npc.ai[0] = NPC.MoonLordAttacksArray2[0, secondAttackArrayInc]; + float secondAttackTimer = (int)npc.ai[1] - secondAttackPickerInc; - if (npc.ai[0] != num1242) + if (npc.ai[0] != ai0Copy) npc.netUpdate = true; if (npc.ai[0] == -1f) @@ -1677,10 +1673,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] > 180f) npc.ai[1] = 0f; - float value23; + float localAI2Lerp; if (npc.ai[1] < 60f) { - value23 = 0.75f; + localAI2Lerp = 0.75f; npc.localAI[0] = 0f; @@ -1690,7 +1686,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.ai[1] < 120f) { - value23 = 1f; + localAI2Lerp = 1f; if (npc.localAI[1] < 0.5f) npc.localAI[1] += 0.025f; @@ -1699,14 +1695,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { - value23 = 1.15f; + localAI2Lerp = 1.15f; npc.localAI[1] -= 0.05f; if (npc.localAI[1] < 0f) npc.localAI[1] = 0f; } - npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], value23, 0.3f); + npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], localAI2Lerp, 0.3f); } if (npc.ai[0] == 0f) @@ -1724,16 +1720,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 1f, 0.2f); float velocity = death ? 38f : 36f; - Vector2 center23 = npc.Center; - Vector2 center24 = Main.player[npc.target].Center; - Vector2 value24 = center24 - center23; - value24 = Vector2.Normalize(value24) * velocity; + Vector2 freeEyeCenter = npc.Center; + Vector2 freeEyeTargetCenter = Main.player[npc.target].Center; + Vector2 freeEyeTargetDistance = freeEyeTargetCenter - freeEyeCenter; + freeEyeTargetDistance = Vector2.Normalize(freeEyeTargetDistance) * velocity; - if (Vector2.Distance(center23, center24) > 300f) + if (Vector2.Distance(freeEyeCenter, freeEyeTargetCenter) > 300f) { - int num1246 = 30; - npc.velocity.X = (npc.velocity.X * (num1246 - 1) + value24.X) / num1246; - npc.velocity.Y = (npc.velocity.Y * (num1246 - 1) + value24.Y) / num1246; + npc.velocity.X = (npc.velocity.X * 29 + freeEyeTargetDistance.X) / 30; + npc.velocity.Y = (npc.velocity.Y * 29 + freeEyeTargetDistance.Y) / 30; } else { @@ -1743,24 +1738,24 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Fly towards Moon Lord Head and stay away from other True Eyes - float num1247 = 0.5f; - for (int num1248 = 0; num1248 < Main.maxNPCs; num1248++) + float freeEyeAccel = 0.5f; + for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[num1248].active) + if (Main.npc[j].active) { - if (num1248 != npc.whoAmI && Main.npc[num1248].type == npc.type) + if (j != npc.whoAmI && Main.npc[j].type == npc.type) { - if (Vector2.Distance(npc.Center, Main.npc[num1248].Center) < 150f) + if (Vector2.Distance(npc.Center, Main.npc[j].Center) < 150f) { - if (npc.position.X < Main.npc[num1248].position.X) - npc.velocity.X = npc.velocity.X - num1247; + if (npc.position.X < Main.npc[j].position.X) + npc.velocity.X = npc.velocity.X - freeEyeAccel; else - npc.velocity.X = npc.velocity.X + num1247; + npc.velocity.X = npc.velocity.X + freeEyeAccel; - if (npc.position.Y < Main.npc[num1248].position.Y) - npc.velocity.Y = npc.velocity.Y - num1247; + if (npc.position.Y < Main.npc[j].position.Y) + npc.velocity.Y = npc.velocity.Y - freeEyeAccel; else - npc.velocity.Y = npc.velocity.Y + num1247; + npc.velocity.Y = npc.velocity.Y + freeEyeAccel; } } } @@ -1770,7 +1765,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[0] == 1f) { - if (num1245 == 0f) + if (secondAttackTimer == 0f) { npc.TargetClosest(false); npc.netUpdate = true; @@ -1788,22 +1783,22 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] > 1f) npc.localAI[1] = 1f; - if (num1245 < 20f) + if (secondAttackTimer < 20f) npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 1.1f, 0.2f); else npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 0.4f, 0.2f); - if (num1245 == num1241 - 35f) + if (secondAttackTimer == secondAttackPicker - 35f) SoundEngine.PlaySound(SoundID.NPCDeath6, npc.position); - if ((num1245 == num1241 - 14f || num1245 == num1241 - 7f || num1245 == num1241) && Main.netMode != NetmodeID.MultiplayerClient) + if ((secondAttackTimer == secondAttackPicker - 14f || secondAttackTimer == secondAttackPicker - 7f || secondAttackTimer == secondAttackPicker) && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector214 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), value22 * npc.localAI[1]); + Vector2 freeEyeBoltDirection = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), thirtyVector * npc.localAI[1]); float velocity = death ? 9f : 8f; - Vector2 vector215 = Vector2.Normalize(v8) * velocity; + Vector2 freeEyeBoltVel = Vector2.Normalize(v8) * velocity; int type = ProjectileID.PhantasmalBolt; int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + vector214.X, npc.Center.Y + vector214.Y, vector215.X, vector215.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + freeEyeBoltDirection.X, npc.Center.Y + freeEyeBoltDirection.Y, freeEyeBoltVel.X, freeEyeBoltVel.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); } } else if (npc.ai[0] == 2f || npc.ai[0] == 4f) @@ -1811,7 +1806,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int type = ProjectileID.PhantasmalSphere; int damage = npc.GetProjectileDamage(type); - if (num1245 < 15f) + if (secondAttackTimer < 15f) { npc.localAI[1] -= 0.07f; if (npc.localAI[1] < 0f) @@ -1823,70 +1818,70 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Length() < 1f) npc.velocity = Vector2.Zero; } - else if (num1245 < 75f) + else if (secondAttackTimer < 75f) { - float num1249 = (num1245 - 15f) / 10f; - int num1250 = 0; - int num1251 = 0; - switch ((int)num1249) + float freeEyeAttackPattern = (secondAttackTimer - 15f) / 10f; + int freeEyeRotateValue = 0; + int freeEyeRotateValue2 = 0; + switch ((int)freeEyeAttackPattern) { case 0: - num1250 = 0; - num1251 = 2; + freeEyeRotateValue = 0; + freeEyeRotateValue2 = 2; break; case 1: - num1250 = 2; - num1251 = 5; + freeEyeRotateValue = 2; + freeEyeRotateValue2 = 5; break; case 2: - num1250 = 5; - num1251 = 3; + freeEyeRotateValue = 5; + freeEyeRotateValue2 = 3; break; case 3: - num1250 = 3; - num1251 = 1; + freeEyeRotateValue = 3; + freeEyeRotateValue2 = 1; break; case 4: - num1250 = 1; - num1251 = 4; + freeEyeRotateValue = 1; + freeEyeRotateValue2 = 4; break; case 5: - num1250 = 4; - num1251 = 0; + freeEyeRotateValue = 4; + freeEyeRotateValue2 = 0; break; } Vector2 spinningpoint2 = Vector2.UnitY * -30f; - Vector2 value25 = spinningpoint2.RotatedBy(num1250 * MathHelper.TwoPi / 6f); - Vector2 value26 = spinningpoint2.RotatedBy(num1251 * MathHelper.TwoPi / 6f); - Vector2 vector216 = Vector2.Lerp(value25, value26, num1249 - (int)num1249); - float value27 = vector216.Length() / 30f; + Vector2 freeEyeRotateLerpValue = spinningpoint2.RotatedBy(freeEyeRotateValue * MathHelper.TwoPi / 6f); + Vector2 freeEyeRotateLerpValue2 = spinningpoint2.RotatedBy(freeEyeRotateValue2 * MathHelper.TwoPi / 6f); + Vector2 freeEyeRotation = Vector2.Lerp(freeEyeRotateLerpValue, freeEyeRotateLerpValue2, freeEyeAttackPattern - (int)freeEyeAttackPattern); + float freeEyeRotationDist = freeEyeRotation.Length() / 30f; - npc.localAI[0] = vector216.ToRotation(); - npc.localAI[1] = MathHelper.Lerp(npc.localAI[1], value27, 0.5f); + npc.localAI[0] = freeEyeRotation.ToRotation(); + npc.localAI[1] = MathHelper.Lerp(npc.localAI[1], freeEyeRotationDist, 0.5f); - for (int num1252 = 0; num1252 < 2; num1252++) + for (int k = 0; k < 2; k++) { - int num1253 = Dust.NewDust(npc.Center + vector216 - Vector2.One * 4f, 0, 0, 229, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num1253]; - dust.velocity += vector216 / 15f; - Main.dust[num1253].noGravity = true; + int trueEyeDust = Dust.NewDust(npc.Center + freeEyeRotation - Vector2.One * 4f, 0, 0, 229, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[trueEyeDust]; + dust.velocity += freeEyeRotation / 15f; + Main.dust[trueEyeDust].noGravity = true; } - if ((num1245 - 15f) % 10f == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if ((secondAttackTimer - 15f) % 10f == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector217 = Vector2.Normalize(vector216); - if (vector217.HasNaNs()) - vector217 = Vector2.UnitY * -1f; + Vector2 trueEyeSphereDirection = Vector2.Normalize(freeEyeRotation); + if (trueEyeSphereDirection.HasNaNs()) + trueEyeSphereDirection = Vector2.UnitY * -1f; float spreadVelocity = death ? 4.5f : 4f; - vector217 *= 4f; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + vector216.X, npc.Center.Y + vector216.Y, vector217.X, vector217.Y, type, 0, 0f, Main.myPlayer, 30f, npc.whoAmI); + trueEyeSphereDirection *= 4f; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + freeEyeRotation.X, npc.Center.Y + freeEyeRotation.Y, trueEyeSphereDirection.X, trueEyeSphereDirection.Y, type, 0, 0f, Main.myPlayer, 30f, npc.whoAmI); Main.projectile[proj].timeLeft = 1200; if (CalamityWorld.LegendaryMode) { - for (int num1268 = 0; num1268 < 3; num1268++) + for (int k = 0; k < 3; k++) { if (!WorldGen.SolidTile((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f))) Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-1599, 1600) * 0.01f, (float)Main.rand.Next(-1599, 1) * 0.01f, ProjectileID.MoonBoulder, 70, 10f); @@ -1896,13 +1891,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { - if (num1245 < 105f) + if (secondAttackTimer < 105f) { npc.localAI[0] = npc.localAI[0].AngleLerp(npc.ai[2] - MathHelper.PiOver2, 0.2f); npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 0.75f, 0.2f); - if (num1245 == 75f) + if (secondAttackTimer == 75f) { npc.TargetClosest(false); @@ -1910,14 +1905,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity = Vector2.UnitY * -7f; - for (int num1255 = 0; num1255 < Main.maxProjectiles; num1255++) + for (int i = 0; i < Main.maxProjectiles; i++) { - Projectile projectile7 = Main.projectile[num1255]; - if (projectile7.active && projectile7.type == type && projectile7.ai[1] == npc.whoAmI && projectile7.ai[0] != -1f) + Projectile trueEyeSpheres = Main.projectile[i]; + if (trueEyeSpheres.active && trueEyeSpheres.type == type && trueEyeSpheres.ai[1] == npc.whoAmI && trueEyeSpheres.ai[0] != -1f) { - Projectile projectile8 = projectile7; - projectile8.velocity += npc.velocity; - projectile7.netUpdate = true; + Projectile trueEyeSphereVel = trueEyeSpheres; + trueEyeSphereVel.velocity += npc.velocity; + trueEyeSpheres.netUpdate = true; } } } @@ -1931,26 +1926,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses return false; } - if (num1245 < 120f) + if (secondAttackTimer < 120f) { SoundEngine.PlaySound(SoundID.Zombie102, npc.Center); - if (num1245 == 105f) + if (secondAttackTimer == 105f) npc.netUpdate = true; float velocity = death ? 13.25f : 12f; - Vector2 velocity6 = (npc.ai[2] - MathHelper.PiOver2).ToRotationVector2() * velocity; - npc.velocity = velocity6 * 2f; + Vector2 trueEyeSphereVelocity = (npc.ai[2] - MathHelper.PiOver2).ToRotationVector2() * velocity; + npc.velocity = trueEyeSphereVelocity * 2f; - for (int num1256 = 0; num1256 < Main.maxProjectiles; num1256++) + for (int i = 0; i < Main.maxProjectiles; i++) { - Projectile projectile9 = Main.projectile[num1256]; - if (projectile9.active && projectile9.type == type && projectile9.ai[1] == npc.whoAmI && projectile9.ai[0] != -1f) + Projectile trueEyeSphereProj = Main.projectile[i]; + if (trueEyeSphereProj.active && trueEyeSphereProj.type == type && trueEyeSphereProj.ai[1] == npc.whoAmI && trueEyeSphereProj.ai[0] != -1f) { - projectile9.ai[0] = -1f; - projectile9.damage = damage; - projectile9.velocity = velocity6; - projectile9.netUpdate = true; + trueEyeSphereProj.ai[0] = -1f; + trueEyeSphereProj.damage = damage; + trueEyeSphereProj.velocity = trueEyeSphereVelocity; + trueEyeSphereProj.netUpdate = true; } } @@ -1963,7 +1958,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.ai[0] == 3f) { - if (num1245 < 15f) + if (secondAttackTimer < 15f) { npc.localAI[1] -= 0.07f; if (npc.localAI[1] < 0f) @@ -1975,17 +1970,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Length() < 1f) npc.velocity = Vector2.Zero; } - else if (num1245 < 45f) + else if (secondAttackTimer < 45f) { npc.localAI[0] = 0f; - npc.localAI[1] = (float)Math.Sin((num1245 - 15f) * MathHelper.TwoPi / 15f) * 0.5f; + npc.localAI[1] = (float)Math.Sin((secondAttackTimer - 15f) * MathHelper.TwoPi / 15f) * 0.5f; if (npc.localAI[1] < 0f) npc.localAI[0] = MathHelper.Pi; } else { - if (num1245 >= 185f) + if (secondAttackTimer >= 185f) { npc.velocity *= 0.88f; @@ -1999,13 +1994,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses return false; } - if (num1245 == 45f) + if (secondAttackTimer == 45f) { npc.ai[2] = Main.rand.NextBool().ToDirectionInt() * MathHelper.TwoPi / 40f; npc.netUpdate = true; } - if ((num1245 - 15f - 30f) % 40f == 0f) + if ((secondAttackTimer - 15f - 30f) % 40f == 0f) npc.ai[2] *= 0.95f; npc.localAI[0] += npc.ai[2]; @@ -2014,34 +2009,34 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] > 1f) npc.localAI[1] = 1f; - Vector2 vector218 = npc.localAI[0].ToRotationVector2() * value22 * npc.localAI[1]; - float scaleFactor10 = MathHelper.Lerp(8f, 20f, (num1245 - 15f - 30f) / 140f); + Vector2 trueEyeDirection = npc.localAI[0].ToRotationVector2() * thirtyVector * npc.localAI[1]; + float trueEyeVelScale = MathHelper.Lerp(8f, 20f, (secondAttackTimer - 15f - 30f) / 140f); - npc.velocity = Vector2.Normalize(vector218) * scaleFactor10; + npc.velocity = Vector2.Normalize(trueEyeDirection) * trueEyeVelScale; npc.rotation = npc.rotation.AngleLerp(npc.velocity.ToRotation() + MathHelper.PiOver2, 0.2f); - if ((num1245 - 15f - 30f) % 10f == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if ((secondAttackTimer - 15f - 30f) % 10f == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector219 = npc.Center + Vector2.Normalize(vector218) * value22.Length() * 0.4f; + Vector2 trueEyeEyeDirection = npc.Center + Vector2.Normalize(trueEyeDirection) * thirtyVector.Length() * 0.4f; float velocity = death ? 6f : 5f; - Vector2 vector220 = Vector2.Normalize(vector218) * velocity; + Vector2 trueEyeEyeSpeed = Vector2.Normalize(trueEyeDirection) * velocity; float ai3 = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * npc.ai[2]; int type = ProjectileID.PhantasmalEye; int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), vector219, vector220, type, damage, 0f, Main.myPlayer, 0f, ai3); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), trueEyeEyeDirection, trueEyeEyeSpeed, type, damage, 0f, Main.myPlayer, 0f, ai3); Main.projectile[proj].timeLeft = 1200; } } } else if (npc.ai[0] == 4f) { - if (num1245 == 0f) + if (secondAttackTimer == 0f) { npc.TargetClosest(false); npc.netUpdate = true; } - if (num1245 < 180f) + if (secondAttackTimer < 180f) { npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 1f, 0.2f); @@ -2053,41 +2048,37 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Length() < 1f) npc.velocity = Vector2.Zero; - if (num1245 >= 60f) + if (secondAttackTimer >= 60f) { - Vector2 center25 = npc.Center; + Vector2 trueEyeCentering = npc.Center; - int num1257 = 0; - if (num1245 >= 120f) - num1257 = 1; + int dustAmt = 0; + if (secondAttackTimer >= 120f) + dustAmt = 1; - for (int num1258 = 0; num1258 < 1 + num1257; num1258++) + for (int j = 0; j < 1 + dustAmt; j++) { - int num1259 = 229; - float num1260 = 0.8f; - if (num1258 % 2 == 1) - { - num1259 = 229; - num1260 = 1.65f; - } + float dustScale = 0.8f; + if (j % 2 == 1) + dustScale = 1.65f; - Vector2 vector221 = center25 + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * value22 / 2f; - int num1261 = Dust.NewDust(vector221 - Vector2.One * 8f, 16, 16, num1259, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); - Main.dust[num1261].velocity = Vector2.Normalize(center25 - vector221) * 3.5f * (10f - num1257 * 2f) / 10f; - Main.dust[num1261].noGravity = true; - Main.dust[num1261].scale = num1260; - Main.dust[num1261].customData = npc; + Vector2 trueEyeDustDirection = trueEyeCentering + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * thirtyVector / 2f; + int trueEyeDust = Dust.NewDust(trueEyeDustDirection - Vector2.One * 8f, 16, 16, 229, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); + Main.dust[trueEyeDust].velocity = Vector2.Normalize(trueEyeCentering - trueEyeDustDirection) * 3.5f * (10f - dustAmt * 2f) / 10f; + Main.dust[trueEyeDust].noGravity = true; + Main.dust[trueEyeDust].scale = dustScale; + Main.dust[trueEyeDust].customData = npc; } } } else { - if (num1245 < num1241 - 15f) + if (secondAttackTimer < secondAttackPicker - 15f) { if (calamityGlobalNPC.newAI[1] == 0f) calamityGlobalNPC.newAI[1] = 600f; - if (num1245 == 180f && Main.netMode != NetmodeID.MultiplayerClient) + if (secondAttackTimer == 180f && Main.netMode != NetmodeID.MultiplayerClient) { // If head is in deathray phase if (Main.npc[(int)Main.npc[(int)npc.ai[3]].localAI[2]].ai[0] == 1f) @@ -2095,18 +2086,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(false); - Vector2 vector222 = Main.player[npc.target].Center - npc.Center; - vector222.Normalize(); + Vector2 deathrayTargetDist = Main.player[npc.target].Center - npc.Center; + deathrayTargetDist.Normalize(); - float num1262 = -1f; - if (vector222.X < 0f) - num1262 = 1f; + float deathraySweepDirection = -1f; + if (deathrayTargetDist.X < 0f) + deathraySweepDirection = 1f; - vector222 = vector222.RotatedBy(-(double)num1262 * MathHelper.TwoPi / 6f); + deathrayTargetDist = deathrayTargetDist.RotatedBy(-(double)deathraySweepDirection * MathHelper.TwoPi / 6f); int type = ProjectileID.PhantasmalDeathray; int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, vector222.X, vector222.Y, type, damage, 0f, Main.myPlayer, num1262 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); - npc.ai[2] = (vector222.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * num1262; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, deathrayTargetDist.X, deathrayTargetDist.Y, type, damage, 0f, Main.myPlayer, deathraySweepDirection * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); + npc.ai[2] = (deathrayTargetDist.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * deathraySweepDirection; npc.netUpdate = true; } @@ -2114,16 +2105,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] > 1f) npc.localAI[1] = 1f; - float num1263 = (npc.ai[2] >= 0f).ToDirectionInt(); - float num1264 = npc.ai[2]; - if (num1264 < 0f) - num1264 *= -1f; + float deathrayRotationDirection = (npc.ai[2] >= 0f).ToDirectionInt(); + float deathrayRotation = npc.ai[2]; + if (deathrayRotation < 0f) + deathrayRotation *= -1f; - num1264 += -(MathHelper.Pi + MathHelper.TwoPi); - num1264 += num1263 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1]; + deathrayRotation += -(MathHelper.Pi + MathHelper.TwoPi); + deathrayRotation += deathrayRotationDirection * MathHelper.TwoPi / calamityGlobalNPC.newAI[1]; - npc.localAI[0] = num1264; - npc.ai[2] = (num1264 + MathHelper.Pi + MathHelper.TwoPi) * num1263; + npc.localAI[0] = deathrayRotation; + npc.ai[2] = (deathrayRotation + MathHelper.Pi + MathHelper.TwoPi) * deathrayRotationDirection; return false; } @@ -2139,13 +2130,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.type == NPCID.MoonLordLeechBlob) { // Variables - float num1265 = 180f; - Vector2 value28 = new Vector2(0f, 216f); - int num1266 = (int)Math.Abs(npc.ai[0]) - 1; - int num1267 = (int)npc.ai[1]; + Vector2 mouthMovement = new Vector2(0f, 216f); + int headNPCType = (int)Math.Abs(npc.ai[0]) - 1; + int moonLordHead = (int)npc.ai[1]; // Despawn - if (!Main.npc[num1266].active || Main.npc[num1266].type != NPCID.MoonLordHead) + if (!Main.npc[headNPCType].active || Main.npc[headNPCType].type != NPCID.MoonLordHead) { npc.life = 0; npc.HitEffect(0, 10.0); @@ -2155,86 +2145,86 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Heal the Moon Lord npc.ai[2] += 1f; - if (npc.ai[2] >= num1265) + if (npc.ai[2] >= 180f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num1268 = (int)Main.npc[num1266].ai[3]; - int num1269 = -1; - int num1270 = -1; - int num1271 = num1266; + int k = (int)Main.npc[headNPCType].ai[3]; + int leftHandHeal = -1; + int rightHandHeal = -1; + int headHeal = headNPCType; - for (int num1272 = 0; num1272 < Main.maxNPCs; num1272++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num1272].active && Main.npc[num1272].ai[3] == num1268) + if (Main.npc[i].active && Main.npc[i].ai[3] == k) { - if (num1269 == -1 && Main.npc[num1272].type == NPCID.MoonLordHand && Main.npc[num1272].ai[2] == 0f) - num1269 = num1272; - if (num1270 == -1 && Main.npc[num1272].type == NPCID.MoonLordHand && Main.npc[num1272].ai[2] == 1f) - num1270 = num1272; - if (num1269 != -1 && num1270 != -1 && num1271 != -1) + if (leftHandHeal == -1 && Main.npc[i].type == NPCID.MoonLordHand && Main.npc[i].ai[2] == 0f) + leftHandHeal = i; + if (rightHandHeal == -1 && Main.npc[i].type == NPCID.MoonLordHand && Main.npc[i].ai[2] == 1f) + rightHandHeal = i; + if (leftHandHeal != -1 && rightHandHeal != -1 && headHeal != -1) break; } } // Heal limits - int num1273 = death ? 1500 : 1250; - int num1274 = Main.npc[num1268].lifeMax - Main.npc[num1268].life; - int num1275 = Main.npc[num1269].lifeMax - Main.npc[num1269].life; - int num1276 = Main.npc[num1270].lifeMax - Main.npc[num1270].life; - int num1277 = Main.npc[num1271].lifeMax - Main.npc[num1271].life; + int maxHealAmt = death ? 1500 : 1250; + int totalHealth = Main.npc[k].lifeMax - Main.npc[k].life; + int leftHandHealth = Main.npc[leftHandHeal].lifeMax - Main.npc[leftHandHeal].life; + int rightHandHealth = Main.npc[rightHandHeal].lifeMax - Main.npc[rightHandHeal].life; + int headHealth = Main.npc[headHeal].lifeMax - Main.npc[headHeal].life; // Healing - if (num1277 > 0 && num1273 > 0) + if (headHealth > 0 && maxHealAmt > 0) { - int num1278 = num1277 - num1273; - if (num1278 > 0) + int maxHealthFailsafe = headHealth - maxHealAmt; + if (maxHealthFailsafe > 0) { - num1278 = 0; + maxHealthFailsafe = 0; } - int num1279 = num1273 + num1278; - num1273 -= num1279; - NPC nPC6 = Main.npc[num1271]; - nPC6.life += num1279; - NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1271].Center, new Vector2(50f)), num1279, true); + int headHealingAmt = maxHealAmt + maxHealthFailsafe; + maxHealAmt -= headHealingAmt; + NPC nPC6 = Main.npc[headHeal]; + nPC6.life += headHealingAmt; + NPC.HealEffect(Utils.CenteredRectangle(Main.npc[headHeal].Center, new Vector2(50f)), headHealingAmt, true); } - if (num1274 > 0 && num1273 > 0) + if (totalHealth > 0 && maxHealAmt > 0) { - int num1280 = num1274 - num1273; - if (num1280 > 0) + int totalHealthFailsafe = totalHealth - maxHealAmt; + if (totalHealthFailsafe > 0) { - num1280 = 0; + totalHealthFailsafe = 0; } - int num1281 = num1273 + num1280; - num1273 -= num1281; - NPC nPC6 = Main.npc[num1268]; - nPC6.life += num1281; - NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1268].Center, new Vector2(50f)), num1281, true); + int totalHealingAmt = maxHealAmt + totalHealthFailsafe; + maxHealAmt -= totalHealingAmt; + NPC nPC6 = Main.npc[k]; + nPC6.life += totalHealingAmt; + NPC.HealEffect(Utils.CenteredRectangle(Main.npc[k].Center, new Vector2(50f)), totalHealingAmt, true); } - if (num1275 > 0 && num1273 > 0) + if (leftHandHealth > 0 && maxHealAmt > 0) { - int num1282 = num1275 - num1273; - if (num1282 > 0) + int leftHandHealthFailsafe = leftHandHealth - maxHealAmt; + if (leftHandHealthFailsafe > 0) { - num1282 = 0; + leftHandHealthFailsafe = 0; } - int num1283 = num1273 + num1282; - num1273 -= num1283; - NPC nPC6 = Main.npc[num1269]; - nPC6.life += num1283; - NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1269].Center, new Vector2(50f)), num1283, true); + int leftHandHealingAmt = maxHealAmt + leftHandHealthFailsafe; + maxHealAmt -= leftHandHealingAmt; + NPC nPC6 = Main.npc[leftHandHeal]; + nPC6.life += leftHandHealingAmt; + NPC.HealEffect(Utils.CenteredRectangle(Main.npc[leftHandHeal].Center, new Vector2(50f)), leftHandHealingAmt, true); } - if (num1276 > 0 && num1273 > 0) + if (rightHandHealth > 0 && maxHealAmt > 0) { - int num1284 = num1276 - num1273; - if (num1284 > 0) + int rightHandHealthFailsafe = rightHandHealth - maxHealAmt; + if (rightHandHealthFailsafe > 0) { - num1284 = 0; + rightHandHealthFailsafe = 0; } - int num1285 = num1273 + num1284; - NPC nPC6 = Main.npc[num1270]; - nPC6.life += num1285; - NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1270].Center, new Vector2(50f)), num1285, true); + int rightHandHealingAmt = maxHealAmt + rightHandHealthFailsafe; + NPC nPC6 = Main.npc[rightHandHeal]; + nPC6.life += rightHandHealingAmt; + NPC.HealEffect(Utils.CenteredRectangle(Main.npc[rightHandHeal].Center, new Vector2(50f)), rightHandHealingAmt, true); } } @@ -2247,26 +2237,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Move towards the Moon Lord mouth npc.velocity = Vector2.Zero; - npc.Center = Vector2.Lerp(Main.projectile[num1267].Center, Main.npc[(int)Math.Abs(npc.ai[0]) - 1].Center + value28, npc.ai[2] / num1265); + npc.Center = Vector2.Lerp(Main.projectile[moonLordHead].Center, Main.npc[(int)Math.Abs(npc.ai[0]) - 1].Center + mouthMovement, npc.ai[2] / 180f); // Emit dust Vector2 spinningpoint3 = Vector2.UnitY * -npc.height / 2f; - for (int num1286 = 0; num1286 < 4; num1286++) + for (int i = 0; i < 4; i++) { - int num1287 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(num1286 * MathHelper.TwoPi / 6f), 0, 0, 229, 0f, 0f, 0, default, 1f); - Main.dust[num1287].velocity = -Vector2.UnitY; - Main.dust[num1287].noGravity = true; - Main.dust[num1287].scale = 0.7f; - Main.dust[num1287].customData = npc; + int leechDust = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(i * MathHelper.TwoPi / 6f), 0, 0, 229, 0f, 0f, 0, default, 1f); + Main.dust[leechDust].velocity = -Vector2.UnitY; + Main.dust[leechDust].noGravity = true; + Main.dust[leechDust].scale = 0.7f; + Main.dust[leechDust].customData = npc; } spinningpoint3 = Vector2.UnitY * -npc.height / 6f; - for (int num1288 = 0; num1288 < 2; num1288++) + for (int j = 0; j < 2; j++) { - int num1289 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(num1288 * MathHelper.TwoPi / 6f), 0, 0, 229, 0f, -2f, 0, default, 1f); - Main.dust[num1289].noGravity = true; - Main.dust[num1289].scale = 1.5f; - Main.dust[num1289].customData = npc; + int leechDust2 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(j * MathHelper.TwoPi / 6f), 0, 0, 229, 0f, -2f, 0, default, 1f); + Main.dust[leechDust2].noGravity = true; + Main.dust[leechDust2].scale = 1.5f; + Main.dust[leechDust2].customData = npc; } } return false; diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index 5d9e8ebfd4..c4479e2103 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -846,9 +846,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Set timer to new amount if a different hook is currently moving if (!despawn && npc.localAI[0] <= 0f && npc.ai[0] != 0f) { - for (int num763 = 0; num763 < Main.maxNPCs; num763++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && (Main.npc[i].velocity.X != 0f || Main.npc[i].velocity.Y != 0f)) npc.localAI[0] = Main.rand.Next(60, 301); } } @@ -860,39 +860,39 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[0] = Main.rand.Next(300, 601); // Pick location - bool flag50 = false; - int num764 = 0; - while (!flag50 && num764 <= 1000) + bool hookCanMove = false; + int hookMoveTries = 0; + while (!hookCanMove && hookMoveTries <= 1000) { - num764++; + hookMoveTries++; - int num765 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.X / 16f); - int num766 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.Y / 16f); + int targetTilePosX = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.X / 16f); + int targetTilePosY = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.Y / 16f); if (npc.ai[0] == 0f) { - num765 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.X + Main.npc[NPC.plantBoss].Center.X) / 32f); - num766 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.Y + Main.npc[NPC.plantBoss].Center.Y) / 32f); + targetTilePosX = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.X + Main.npc[NPC.plantBoss].Center.X) / 32f); + targetTilePosY = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.Y + Main.npc[NPC.plantBoss].Center.Y) / 32f); } if (despawn) { - num765 = (int)Main.npc[NPC.plantBoss].position.X / 16; - num766 = (int)(Main.npc[NPC.plantBoss].position.Y + 400f) / 16; + targetTilePosX = (int)Main.npc[NPC.plantBoss].position.X / 16; + targetTilePosY = (int)(Main.npc[NPC.plantBoss].position.Y + 400f) / 16; } - int num767 = 20; - num767 += (int)(100f * (num764 / 1000f)); - int num768 = num765 + Main.rand.Next(-num767, num767 + 1); - int num769 = num766 + Main.rand.Next(-num767, num767 + 1); + int hookTileOffset = 20; + hookTileOffset += (int)(100f * (hookMoveTries / 1000f)); + int hookTileX = targetTilePosX + Main.rand.Next(-hookTileOffset, hookTileOffset + 1); + int hookTileY = targetTilePosY + Main.rand.Next(-hookTileOffset, hookTileOffset + 1); try { - if (WorldGen.SolidTile(num768, num769) || (Main.tile[num768, num769].WallType > 0 && (num764 > 500 || lifeRatio < 0.5f))) + if (WorldGen.SolidTile(hookTileX, hookTileY) || (Main.tile[hookTileX, hookTileY].WallType > 0 && (hookMoveTries > 500 || lifeRatio < 0.5f))) { - flag50 = true; - npc.ai[0] = num768; - npc.ai[1] = num769; + hookCanMove = true; + npc.ai[0] = hookTileX; + npc.ai[1] = hookTileY; npc.netUpdate = true; } } @@ -915,11 +915,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses velocity *= 2f; // Moving to new location - Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); - float num773 = npc.ai[0] * 16f - 8f - vector95.X; - float num774 = npc.ai[1] * 16f - 8f - vector95.Y; - float num775 = (float)Math.Sqrt(num773 * num773 + num774 * num774); - if (num775 < 12f + velocity) + Vector2 hookCenter = new Vector2(npc.Center.X, npc.Center.Y); + float hookMoveX = npc.ai[0] * 16f - 8f - hookCenter.X; + float hookMoveY = npc.ai[1] * 16f - 8f - hookCenter.Y; + float hookMoveDistance = (float)Math.Sqrt(hookMoveX * hookMoveX + hookMoveY * hookMoveY); + if (hookMoveDistance < 12f + velocity) { if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && npc.localAI[3] == 1f) { @@ -927,24 +927,24 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses WorldGen.SpawnPlanteraThorns(npc.Center); } - npc.velocity.X = num773; - npc.velocity.Y = num774; + npc.velocity.X = hookMoveX; + npc.velocity.Y = hookMoveY; } else { if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) npc.localAI[3] = 1f; - num775 = velocity / num775; - npc.velocity.X = num773 * num775; - npc.velocity.Y = num774 * num775; + hookMoveDistance = velocity / hookMoveDistance; + npc.velocity.X = hookMoveX * hookMoveDistance; + npc.velocity.Y = hookMoveY * hookMoveDistance; } // Rotation - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num776 = Main.npc[NPC.plantBoss].Center.X - vector96.X; - float num777 = Main.npc[NPC.plantBoss].Center.Y - vector96.Y; - npc.rotation = (float)Math.Atan2(num777, num776) - MathHelper.PiOver2; + Vector2 hookCenterRotation = new Vector2(npc.Center.X, npc.Center.Y); + float plantXDirection = Main.npc[NPC.plantBoss].Center.X - hookCenterRotation.X; + float plantYDirection = Main.npc[NPC.plantBoss].Center.Y - hookCenterRotation.Y; + npc.rotation = (float)Math.Atan2(plantYDirection, plantXDirection) - MathHelper.PiOver2; } return false; @@ -1019,13 +1019,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Velocity and acceleration - float num779 = death ? 2.4f : 1.6f; + float tentacleAcceleration = death ? 2.4f : 1.6f; float extendedDistanceFromPlantera = (1f - lifeRatio) * 2f; - float num780 = 100f + (extendedDistanceFromPlantera * 300f); + float tentacleVelocity = 100f + (extendedDistanceFromPlantera * 300f); float deceleration = (death ? 0.5f : 0.8f) / (1f + extendedDistanceFromPlantera); if (Main.getGoodWorld) - num779 += 4f; + tentacleAcceleration += 4f; // Despawn if Plantera is gone if (!Main.npc[plantBoss].active) @@ -1036,37 +1036,37 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Movement Vector2 planteraCenter = Main.npc[plantBoss].Center; - float num784 = planteraCenter.X + npc.ai[0]; - float num785 = planteraCenter.Y + npc.ai[1]; - float num786 = num784 - planteraCenter.X; - float num787 = num785 - planteraCenter.Y; - float num788 = (float)Math.Sqrt(num786 * num786 + num787 * num787); - num788 = num780 / num788; - num786 *= num788; - num787 *= num788; + float plantXOffset = planteraCenter.X + npc.ai[0]; + float plantYOffset = planteraCenter.Y + npc.ai[1]; + float plantXDist = plantXOffset - planteraCenter.X; + float plantYDist = plantYOffset - planteraCenter.Y; + float plantTotalDist = (float)Math.Sqrt(plantXDist * plantXDist + plantYDist * plantYDist); + plantTotalDist = tentacleVelocity / plantTotalDist; + plantXDist *= plantTotalDist; + plantYDist *= plantTotalDist; - if (npc.position.X < planteraCenter.X + num786) + if (npc.position.X < planteraCenter.X + plantXDist) { - npc.velocity.X += num779; - if (npc.velocity.X < 0f && num786 > 0f) + npc.velocity.X += tentacleAcceleration; + if (npc.velocity.X < 0f && plantXDist > 0f) npc.velocity.X *= deceleration; } - else if (npc.position.X > planteraCenter.X + num786) + else if (npc.position.X > planteraCenter.X + plantXDist) { - npc.velocity.X -= num779; - if (npc.velocity.X > 0f && num786 < 0f) + npc.velocity.X -= tentacleAcceleration; + if (npc.velocity.X > 0f && plantXDist < 0f) npc.velocity.X *= deceleration; } - if (npc.position.Y < planteraCenter.Y + num787) + if (npc.position.Y < planteraCenter.Y + plantYDist) { - npc.velocity.Y += num779; - if (npc.velocity.Y < 0f && num787 > 0f) + npc.velocity.Y += tentacleAcceleration; + if (npc.velocity.Y < 0f && plantYDist > 0f) npc.velocity.Y *= deceleration; } - else if (npc.position.Y > planteraCenter.Y + num787) + else if (npc.position.Y > planteraCenter.Y + plantYDist) { - npc.velocity.Y -= num779; - if (npc.velocity.Y > 0f && num787 < 0f) + npc.velocity.Y -= tentacleAcceleration; + if (npc.velocity.Y > 0f && plantYDist < 0f) npc.velocity.Y *= deceleration; } @@ -1081,15 +1081,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y = -velocityLimit; // Direction and rotation - if (num786 > 0f) + if (plantXDist > 0f) { npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(num787, num786); + npc.rotation = (float)Math.Atan2(plantYDist, plantXDist); } - if (num786 < 0f) + if (plantXDist < 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(num787, num786) + MathHelper.Pi; + npc.rotation = (float)Math.Atan2(plantYDist, plantXDist) + MathHelper.Pi; } return false; diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs index 2f17fbc3cc..ef2300c683 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs @@ -31,10 +31,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool death = CalamityWorld.death || bossRush; bool enrage = true; - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; + int targetTileX = (int)Main.player[npc.target].Center.X / 16; + int targetTileY = (int)Main.player[npc.target].Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); + Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); if (tile.WallType == WallID.HiveUnsafe) enrage = false; @@ -69,12 +69,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool phase5 = lifeRatio < 0.1f; // Despawn - float num616 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); + float distanceFromTarget = Vector2.Distance(npc.Center, Main.player[npc.target].Center); if (npc.ai[0] != 5f) { if (npc.timeLeft < 60) npc.timeLeft = 60; - if (num616 > 3000f) + if (distanceFromTarget > 3000f) npc.ai[0] = 4f; } if (Main.player[npc.target].dead) @@ -186,9 +186,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] % 2f == 0f) { // Initiate charge - float num620 = 20f; - num620 += 20f * enrageScale; - if (Math.Abs(npc.position.Y + (npc.height / 2) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2))) < num620) + float chargeDistance = 20f; + chargeDistance += 20f * enrageScale; + if (Math.Abs(npc.position.Y + (npc.height / 2) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2))) < chargeDistance) { // Set AI variables and speed npc.localAI[0] = 1f; @@ -196,13 +196,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 0f; // Get target location - Vector2 vector74 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num599 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector74.X; - float num600 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector74.Y; - float num601 = (float)Math.Sqrt(num599 * num599 + num600 * num600); - num601 = speed / num601; - npc.velocity.X = num599 * num601; - npc.velocity.Y = num600 * num601; + Vector2 beeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float targetXDist = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - beeLocation.X; + float targetYDist = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - beeLocation.Y; + float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); + targetDistance = speed / targetDistance; + npc.velocity.X = targetXDist * targetDistance; + npc.velocity.Y = targetYDist * targetDistance; // Face the correct direction and play charge sound float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; @@ -215,54 +215,54 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Velocity variables npc.localAI[0] = 0f; - float num602 = 12f; - float num603 = 0.15f; + float chargeVelocity = 12f; + float chargeAcceleration = 0.15f; if (phase2) { - num602 += 1.5f; - num603 += 0.0625f; + chargeVelocity += 1.5f; + chargeAcceleration += 0.0625f; } if (phase3) { - num602 += 1.5f; - num603 += 0.0625f; + chargeVelocity += 1.5f; + chargeAcceleration += 0.0625f; } if (phase4) { - num602 += 1.5f; - num603 += 0.0625f; + chargeVelocity += 1.5f; + chargeAcceleration += 0.0625f; } if (phase5) { - num602 += 1.5f; - num603 += 0.0625f; + chargeVelocity += 1.5f; + chargeAcceleration += 0.0625f; } - num602 += 3f * enrageScale; - num603 += 0.5f * enrageScale; + chargeVelocity += 3f * enrageScale; + chargeAcceleration += 0.5f * enrageScale; // Velocity calculations if (npc.position.Y + (npc.height / 2) < Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2)) - npc.velocity.Y += num603; + npc.velocity.Y += chargeAcceleration; else - npc.velocity.Y -= num603; + npc.velocity.Y -= chargeAcceleration; - if (npc.velocity.Y < -num602) - npc.velocity.Y = -num602; - if (npc.velocity.Y > num602) - npc.velocity.Y = num602; + if (npc.velocity.Y < -chargeVelocity) + npc.velocity.Y = -chargeVelocity; + if (npc.velocity.Y > chargeVelocity) + npc.velocity.Y = chargeVelocity; if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > 500f) - npc.velocity.X += num603 * npc.direction; + npc.velocity.X += chargeAcceleration * npc.direction; else if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) < 300f) - npc.velocity.X -= num603 * npc.direction; + npc.velocity.X -= chargeAcceleration * npc.direction; else npc.velocity.X *= 0.8f; // Limit velocity - if (npc.velocity.X < -num602) - npc.velocity.X = -num602; - if (npc.velocity.X > num602) - npc.velocity.X = num602; + if (npc.velocity.X < -chargeVelocity) + npc.velocity.X = -chargeVelocity; + if (npc.velocity.X > chargeVelocity) + npc.velocity.X = chargeVelocity; // Face the correct direction float playerLocation2 = npc.Center.X - Main.player[npc.target].Center.X; @@ -285,31 +285,31 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.spriteDirection = npc.direction; // Charging distance from player - int num604 = 450; + int chargingDistance = 450; if (phase4) - num604 = 350; + chargingDistance = 350; else if (phase2) - num604 = 400; - num604 -= (int)(100f * enrageScale); + chargingDistance = 400; + chargingDistance -= (int)(100f * enrageScale); // Get which side of the player the boss is on - int num605 = 1; + int chargeDirection = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) - num605 = -1; + chargeDirection = -1; // If boss is in correct position, slow down, if not, reset - bool flag35 = false; - if (npc.direction == num605 && Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > num604) + bool shouldCharge = false; + if (npc.direction == chargeDirection && Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > chargingDistance) { npc.ai[2] = 1f; - flag35 = true; + shouldCharge = true; } - if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > num604 * 1.5f) + if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > chargingDistance * 1.5f) { npc.ai[2] = 1f; - flag35 = true; + shouldCharge = true; } - if (enrageScale > 0f && flag35) + if (enrageScale > 0f && shouldCharge) npc.velocity *= 0.5f; // Keep moving @@ -338,26 +338,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[0] = 0f; npc.velocity *= 0.9f; - float num606 = 0.1f; + float chargeDeceleration = 0.1f; if (phase3) { npc.velocity *= 0.9f; - num606 += 0.05f; + chargeDeceleration += 0.05f; } if (phase4) { npc.velocity *= 0.9f; - num606 += 0.05f; + chargeDeceleration += 0.05f; } if (phase5) { npc.velocity *= 0.9f; - num606 += 0.05f; + chargeDeceleration += 0.05f; } if (enrageScale > 0f) npc.velocity *= 0.7f; - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num606) + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < chargeDeceleration) { npc.ai[2] = 0f; npc.ai[1] += 1f; @@ -380,15 +380,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.spriteDirection = npc.direction; // Get target location - float num608 = 0.1f; - Vector2 vector75 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num609 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector75.X; - float num610 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 200f - vector75.Y; - float num611 = (float)Math.Sqrt(num609 * num609 + num610 * num610); + float beeAttackAccel = 0.1f; + Vector2 beeAttackPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float beeAttackTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - beeAttackPosition.X; + float beeAttackTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 200f - beeAttackPosition.Y; + float beeAttackTargetDist = (float)Math.Sqrt(beeAttackTargetX * beeAttackTargetX + beeAttackTargetY * beeAttackTargetY); // Go to bee spawn phase calamityGlobalNPC.newAI[0] += 1f; - if (num611 < (death ? 400f : 300f) || calamityGlobalNPC.newAI[0] >= 180f) + if (beeAttackTargetDist < (death ? 400f : 300f) || calamityGlobalNPC.newAI[0] >= 180f) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -399,29 +399,29 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Velocity calculations - if (npc.velocity.X < num609) + if (npc.velocity.X < beeAttackTargetX) { - npc.velocity.X += num608; - if (npc.velocity.X < 0f && num609 > 0f) - npc.velocity.X += num608; + npc.velocity.X += beeAttackAccel; + if (npc.velocity.X < 0f && beeAttackTargetX > 0f) + npc.velocity.X += beeAttackAccel; } - else if (npc.velocity.X > num609) + else if (npc.velocity.X > beeAttackTargetX) { - npc.velocity.X -= num608; - if (npc.velocity.X > 0f && num609 < 0f) - npc.velocity.X -= num608; + npc.velocity.X -= beeAttackAccel; + if (npc.velocity.X > 0f && beeAttackTargetX < 0f) + npc.velocity.X -= beeAttackAccel; } - if (npc.velocity.Y < num610) + if (npc.velocity.Y < beeAttackTargetY) { - npc.velocity.Y += num608; - if (npc.velocity.Y < 0f && num610 > 0f) - npc.velocity.Y += num608; + npc.velocity.Y += beeAttackAccel; + if (npc.velocity.Y < 0f && beeAttackTargetY > 0f) + npc.velocity.Y += beeAttackAccel; } - else if (npc.velocity.Y > num610) + else if (npc.velocity.Y > beeAttackTargetY) { - npc.velocity.Y -= num608; - if (npc.velocity.Y > 0f && num610 < 0f) - npc.velocity.Y -= num608; + npc.velocity.Y -= beeAttackAccel; + if (npc.velocity.Y > 0f && beeAttackTargetY < 0f) + npc.velocity.Y -= beeAttackAccel; } } @@ -431,21 +431,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[0] = 0f; // Get target location and spawn bees from ass - Vector2 vector76 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 vector77 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num612 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector77.X; - float num613 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector77.Y; - float num614 = (float)Math.Sqrt(num612 * num612 + num613 * num613); + Vector2 beeSpawnLocation = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 queenBeeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float beeSpawnTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - queenBeeLocation.X; + float beeSpawnTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - queenBeeLocation.Y; + float beeSpawnTargetDist = (float)Math.Sqrt(beeSpawnTargetX * beeSpawnTargetX + beeSpawnTargetY * beeSpawnTargetY); // Bee spawn timer npc.ai[1] += 1f; - int num638 = 0; - for (int num639 = 0; num639 < 255; num639++) + int beeSpawnTimer = 0; + for (int i = 0; i < 255; i++) { - if (Main.player[num639].active && !Main.player[num639].dead && (npc.Center - Main.player[num639].Center).Length() < 1000f) - num638++; + if (Main.player[i].active && !Main.player[i].dead && (npc.Center - Main.player[i].Center).Length() < 1000f) + beeSpawnTimer++; } - npc.ai[1] += num638 / 2; + npc.ai[1] += beeSpawnTimer / 2; if (phase2) npc.ai[1] += 0.25f; if (phase3) @@ -456,8 +456,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[1] += 0.25f; bool spawnBee = false; - float num640 = 15f - 12f * enrageScale; - if (npc.ai[1] > num640) + float beeSpawnCheck = 15f - 12f * enrageScale; + if (npc.ai[1] > beeSpawnCheck) { npc.ai[1] = 0f; npc.ai[2] += 1f; @@ -465,7 +465,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Spawn bees or hornets - if (Collision.CanHit(vector76, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) + if (Collision.CanHit(beeSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -479,7 +479,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses spawnType = NPCID.Hellbat; } - int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector76.X, (int)vector76.Y, spawnType); + int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, spawnType); Main.npc[spawn].velocity = Main.player[npc.target].Center - npc.Center; Main.npc[spawn].velocity.Normalize(); Main.npc[spawn].velocity *= 5f; @@ -490,39 +490,39 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Velocity calculations if target is too far away - if (num614 > 400f || !Collision.CanHit(new Vector2(vector76.X, vector76.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (beeSpawnTargetDist > 400f || !Collision.CanHit(new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float num617 = 14f; - float num618 = 0.1f; - vector77 = vector76; - num612 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector77.X; - num613 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector77.Y; - num614 = (float)Math.Sqrt(num612 * num612 + num613 * num613); - num614 = num617 / num614; + float beeAttackHoverSpeed = 14f; + float beeAttackHoverAccel = 0.1f; + queenBeeLocation = beeSpawnLocation; + beeSpawnTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - queenBeeLocation.X; + beeSpawnTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - queenBeeLocation.Y; + beeSpawnTargetDist = (float)Math.Sqrt(beeSpawnTargetX * beeSpawnTargetX + beeSpawnTargetY * beeSpawnTargetY); + beeSpawnTargetDist = beeAttackHoverSpeed / beeSpawnTargetDist; - if (npc.velocity.X < num612) + if (npc.velocity.X < beeSpawnTargetX) { - npc.velocity.X += num618; - if (npc.velocity.X < 0f && num612 > 0f) - npc.velocity.X += num618; + npc.velocity.X += beeAttackHoverAccel; + if (npc.velocity.X < 0f && beeSpawnTargetX > 0f) + npc.velocity.X += beeAttackHoverAccel; } - else if (npc.velocity.X > num612) + else if (npc.velocity.X > beeSpawnTargetX) { - npc.velocity.X -= num618; - if (npc.velocity.X > 0f && num612 < 0f) - npc.velocity.X -= num618; + npc.velocity.X -= beeAttackHoverAccel; + if (npc.velocity.X > 0f && beeSpawnTargetX < 0f) + npc.velocity.X -= beeAttackHoverAccel; } - if (npc.velocity.Y < num613) + if (npc.velocity.Y < beeSpawnTargetY) { - npc.velocity.Y += num618; - if (npc.velocity.Y < 0f && num613 > 0f) - npc.velocity.Y += num618; + npc.velocity.Y += beeAttackHoverAccel; + if (npc.velocity.Y < 0f && beeSpawnTargetY > 0f) + npc.velocity.Y += beeAttackHoverAccel; } - else if (npc.velocity.Y > num613) + else if (npc.velocity.Y > beeSpawnTargetY) { - npc.velocity.Y -= num618; - if (npc.velocity.Y > 0f && num613 < 0f) - npc.velocity.Y -= num618; + npc.velocity.Y -= beeAttackHoverAccel; + if (npc.velocity.Y > 0f && beeSpawnTargetY < 0f) + npc.velocity.Y -= beeAttackHoverAccel; } } else @@ -547,114 +547,114 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[0] == 3f) { // Get target location and shoot from ass - Vector2 vector78 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 vector79 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num621 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector79.X; - float num622 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector79.Y; - float num623 = (float)Math.Sqrt(num621 * num621 + num622 * num622); + Vector2 stingerSpawnLocation = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 stingerQueenBeeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float stingerAttackTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - stingerQueenBeeLocation.X; + float stingerAttackTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - stingerQueenBeeLocation.Y; + float stingerAttackTargetDist = (float)Math.Sqrt(stingerAttackTargetX * stingerAttackTargetX + stingerAttackTargetY * stingerAttackTargetY); npc.ai[1] += 1f; - int num650 = phase4 ? 15 : phase3 ? 20 : phase2 ? 25 : 30; - num650 -= (int)Math.Ceiling(5f * enrageScale); - if (num650 < 3) - num650 = 3; + int stingerAttackTimer = phase4 ? 15 : phase3 ? 20 : phase2 ? 25 : 30; + stingerAttackTimer -= (int)Math.Ceiling(5f * enrageScale); + if (stingerAttackTimer < 3) + stingerAttackTimer = 3; // Fire stingers - if (npc.ai[1] % num650 == (num650 - 1) && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (npc.ai[1] % stingerAttackTimer == (stingerAttackTimer - 1) && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(stingerSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { SoundEngine.PlaySound(SoundID.Item17, npc.position); if (Main.netMode != NetmodeID.MultiplayerClient) { - float num624 = 5f; + float stingerSpeed = 5f; if (phase3) - num624 += 1f; - num624 += 2f * enrageScale; + stingerSpeed += 1f; + stingerSpeed += 2f * enrageScale; - float num625 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector78.X; - float num626 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector78.Y; - float num627 = (float)Math.Sqrt(num625 * num625 + num626 * num626); - num627 = num624 / num627; - num625 *= num627; - num626 *= num627; + float stingerTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - stingerSpawnLocation.X; + float stingerTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - stingerSpawnLocation.Y; + float stingerTargetDist = (float)Math.Sqrt(stingerTargetX * stingerTargetX + stingerTargetY * stingerTargetY); + stingerTargetDist = stingerSpeed / stingerTargetDist; + stingerTargetX *= stingerTargetDist; + stingerTargetY *= stingerTargetDist; int type = Main.zenithWorld ? (phase3 ? ModContent.ProjectileType() : ProjectileID.FlamingWood) : ProjectileID.QueenBeeStinger; - int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), vector78.X, vector78.Y, num625, num626, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); + int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation.X, stingerSpawnLocation.Y, stingerTargetX, stingerTargetY, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); Main.projectile[projectile].timeLeft = 600; Main.projectile[projectile].extraUpdates = 1; } } // Movement calculations - float num620 = 0.075f; - num620 += 0.2f * enrageScale; - if (!Collision.CanHit(new Vector2(vector78.X, vector78.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + float stingerAttackAccel = 0.075f; + stingerAttackAccel += 0.2f * enrageScale; + if (!Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - num620 = 0.1f; + stingerAttackAccel = 0.1f; if (enrageScale > 0f) - num620 = 0.5f; + stingerAttackAccel = 0.5f; - vector79 = vector78; - num621 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector79.X; - num622 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector79.Y; + stingerQueenBeeLocation = stingerSpawnLocation; + stingerAttackTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - stingerQueenBeeLocation.X; + stingerAttackTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - stingerQueenBeeLocation.Y; - if (npc.velocity.X < num621) + if (npc.velocity.X < stingerAttackTargetX) { - npc.velocity.X += num620; - if (npc.velocity.X < 0f && num621 > 0f) - npc.velocity.X += num620; + npc.velocity.X += stingerAttackAccel; + if (npc.velocity.X < 0f && stingerAttackTargetX > 0f) + npc.velocity.X += stingerAttackAccel; } - else if (npc.velocity.X > num621) + else if (npc.velocity.X > stingerAttackTargetX) { - npc.velocity.X -= num620; - if (npc.velocity.X > 0f && num621 < 0f) - npc.velocity.X -= num620; + npc.velocity.X -= stingerAttackAccel; + if (npc.velocity.X > 0f && stingerAttackTargetX < 0f) + npc.velocity.X -= stingerAttackAccel; } - if (npc.velocity.Y < num622) + if (npc.velocity.Y < stingerAttackTargetY) { - npc.velocity.Y += num620; - if (npc.velocity.Y < 0f && num622 > 0f) - npc.velocity.Y += num620; + npc.velocity.Y += stingerAttackAccel; + if (npc.velocity.Y < 0f && stingerAttackTargetY > 0f) + npc.velocity.Y += stingerAttackAccel; } - else if (npc.velocity.Y > num622) + else if (npc.velocity.Y > stingerAttackTargetY) { - npc.velocity.Y -= num620; - if (npc.velocity.Y > 0f && num622 < 0f) - npc.velocity.Y -= num620; + npc.velocity.Y -= stingerAttackAccel; + if (npc.velocity.Y > 0f && stingerAttackTargetY < 0f) + npc.velocity.Y -= stingerAttackAccel; } } - else if (num623 > 100f) + else if (stingerAttackTargetDist > 100f) { float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - if (npc.velocity.X < num621) + if (npc.velocity.X < stingerAttackTargetX) { - npc.velocity.X += num620; - if (npc.velocity.X < 0f && num621 > 0f) - npc.velocity.X += num620 * 2f; + npc.velocity.X += stingerAttackAccel; + if (npc.velocity.X < 0f && stingerAttackTargetX > 0f) + npc.velocity.X += stingerAttackAccel * 2f; } - else if (npc.velocity.X > num621) + else if (npc.velocity.X > stingerAttackTargetX) { - npc.velocity.X -= num620; - if (npc.velocity.X > 0f && num621 < 0f) - npc.velocity.X -= num620 * 2f; + npc.velocity.X -= stingerAttackAccel; + if (npc.velocity.X > 0f && stingerAttackTargetX < 0f) + npc.velocity.X -= stingerAttackAccel * 2f; } - if (npc.velocity.Y < num622) + if (npc.velocity.Y < stingerAttackTargetY) { - npc.velocity.Y += num620; - if (npc.velocity.Y < 0f && num622 > 0f) - npc.velocity.Y += num620 * 2f; + npc.velocity.Y += stingerAttackAccel; + if (npc.velocity.Y < 0f && stingerAttackTargetY > 0f) + npc.velocity.Y += stingerAttackAccel * 2f; } - else if (npc.velocity.Y > num622) + else if (npc.velocity.Y > stingerAttackTargetY) { - npc.velocity.Y -= num620; - if (npc.velocity.Y > 0f && num622 < 0f) - npc.velocity.Y -= num620 * 2f; + npc.velocity.Y -= stingerAttackAccel; + if (npc.velocity.Y > 0f && stingerAttackTargetY < 0f) + npc.velocity.Y -= stingerAttackAccel * 2f; } } // Go to a random phase - if (npc.ai[1] > num650 * 15f) + if (npc.ai[1] > stingerAttackTimer * 15f) { npc.ai[0] = -1f; npc.ai[1] = 3f; @@ -665,14 +665,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[0] == 4f) { npc.localAI[0] = 1f; - float num661 = 14f; - float num662 = 14f; + float despawnVelMult = 14f; - Vector2 value2 = Main.player[npc.target].Center - npc.Center; - value2.Normalize(); - value2 *= num661; + Vector2 despawnTargetDist = Main.player[npc.target].Center - npc.Center; + despawnTargetDist.Normalize(); + despawnTargetDist *= 14f; - npc.velocity = (npc.velocity * num662 + value2) / (num662 + 1f); + npc.velocity = (npc.velocity * despawnVelMult + despawnTargetDist) / (despawnVelMult + 1f); if (npc.velocity.X < 0f) npc.direction = -1; else @@ -680,7 +679,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.spriteDirection = npc.direction; - if (num616 < 2000f) + if (distanceFromTarget < 2000f) { npc.ai[0] = -1f; npc.localAI[0] = 0f; From 57f5e7ae68ce2c087f522faeb42e6d7033b010c8 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 26 Oct 2023 21:57:33 -0400 Subject: [PATCH 23/43] Queen Slime, Skeletron, Skeletron Prime --- .../Bosses/QueenSlimeAI.cs | 162 +++---- .../VanillaNPCOverrides/Bosses/SkeletronAI.cs | 425 +++++++++--------- .../Bosses/SkeletronPrimeAI.cs | 378 ++++++++-------- 3 files changed, 480 insertions(+), 485 deletions(-) diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs index c6ab749eeb..8dbf151dbc 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs @@ -21,8 +21,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - float num3 = 1f; - bool flag = false; + float slimeScale = 1f; + bool teleported = false; bool phase2 = lifeRatio <= 0.5f; bool phase3 = lifeRatio <= 0.4f; bool phase4 = lifeRatio <= 0.2f; @@ -71,34 +71,34 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; npc.TargetClosest(faceTarget: false); Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 800f; - Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int num5 = 5; - int num8 = 0; - while (num8 < 100) + Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); + int randomTeleportOffset = 5; + int teleportTries = 0; + while (teleportTries < 100) { - num8++; - int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); - int num10 = Main.rand.Next(point2.Y - num5, point2.Y); - if (Main.tile[num9, num10].HasUnactuatedTile) + teleportTries++; + int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomTeleportOffset, predictiveTeleportPoint.X + randomTeleportOffset + 1); + int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomTeleportOffset, predictiveTeleportPoint.Y); + if (Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) continue; - bool flag4 = true; - if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) - flag4 = false; - if (flag4 && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - flag4 = false; + bool canTeleportToTile = true; + if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) + canTeleportToTile = false; + if (canTeleportToTile && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + canTeleportToTile = false; - if (flag4) + if (canTeleportToTile) { - npc.localAI[1] = num9 * 16 + 8; - npc.localAI[2] = num10 * 16 + 16; + npc.localAI[1] = teleportTileX * 16 + 8; + npc.localAI[2] = teleportTileY * 16 + 16; npc.ai[3] = 0f; break; } } // Default teleport if the above conditions aren't met in 100 iterations - if (num8 >= 100) + if (teleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; npc.localAI[1] = bottom.X; @@ -121,11 +121,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { - float num13 = npc.ai[3]; + float teleportNetUpdate = npc.ai[3]; npc.ai[3] -= 1f; if (npc.ai[3] < 0f) { - if (Main.netMode != NetmodeID.MultiplayerClient && num13 > 0f) + if (Main.netMode != NetmodeID.MultiplayerClient && teleportNetUpdate > 0f) npc.netUpdate = true; npc.ai[3] = 0f; @@ -254,8 +254,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = 0f; npc.ai[1] += 1f; float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; - num3 = MathHelper.Clamp(npc.ai[1] / teleportEndTime, 0f, 1f); - num3 = 0.5f + num3 * 0.5f; + slimeScale = MathHelper.Clamp(npc.ai[1] / teleportEndTime, 0f, 1f); + slimeScale = 0.5f + slimeScale * 0.5f; if (npc.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) { npc.ai[0] = 0f; @@ -274,11 +274,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Emit teleport dust Color newColor2 = NPC.AI_121_QueenSlime_GetDustColor(); newColor2.A = 150; - for (int num26 = 0; num26 < 10; num26++) + for (int i = 0; i < 10; i++) { - int num27 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 50, newColor2, 1.5f); - Main.dust[num27].noGravity = true; - Main.dust[num27].velocity *= 2f; + int queenSlimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 50, newColor2, 1.5f); + Main.dust[queenSlimeDust].noGravity = true; + Main.dust[queenSlimeDust].velocity *= 2f; } break; @@ -292,11 +292,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = 0f; npc.ai[1] += 1f; float teleportTime = bossRush ? 20f : death ? 30f : 40f; - num3 = MathHelper.Clamp((teleportTime - npc.ai[1]) / teleportTime, 0f, 1f); - num3 = 0.5f + num3 * 0.5f; + slimeScale = MathHelper.Clamp((teleportTime - npc.ai[1]) / teleportTime, 0f, 1f); + slimeScale = 0.5f + slimeScale * 0.5f; if (npc.ai[1] >= teleportTime) - flag = true; + teleported = true; // Spawn crown gore if (npc.ai[1] == teleportTime) @@ -317,15 +317,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Emit teleport dust - if (!flag) + if (!teleported) { Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); newColor.A = 150; for (int n = 0; n < 10; n++) { - int num25 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 50, newColor, 1.5f); - Main.dust[num25].noGravity = true; - Main.dust[num25].velocity *= 0.5f; + int queenSlimeDust2 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 50, newColor, 1.5f); + Main.dust[queenSlimeDust2].noGravity = true; + Main.dust[queenSlimeDust2].velocity *= 0.5f; } } @@ -402,11 +402,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.target >= Main.maxPlayers) break; - float num19 = bossRush ? 6.5f : death ? 5.5f : 4.5f; + float jumpVelocity = bossRush ? 6.5f : death ? 5.5f : 4.5f; if (Main.getGoodWorld) - num19 = 7f; + jumpVelocity = 7f; - if ((npc.direction == 1 && npc.velocity.X < num19) || (npc.direction == -1 && npc.velocity.X > 0f - num19)) + if ((npc.direction == 1 && npc.velocity.X < jumpVelocity) || (npc.direction == -1 && npc.velocity.X > 0f - jumpVelocity)) { if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) npc.velocity.X += (bossRush ? 0.5f : death ? 0.35f : 0.3f) * npc.direction; @@ -442,12 +442,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.noTileCollide = false; npc.noGravity = false; - int num20 = 30; + int slamDelay = 30; if (phase2) - num20 = 10; + slamDelay = 10; if (Main.getGoodWorld) - num20 = 0; + slamDelay = 0; if (npc.velocity.Y == 0f) { @@ -479,10 +479,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int l = 0; l < 20; l++) { - int num21 = Dust.NewDust(npc.Bottom - new Vector2(npc.width / 2, 30f), npc.width, 30, 31, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor()); - Main.dust[num21].noGravity = true; - Main.dust[num21].velocity.Y = -5f + Main.rand.NextFloat() * -3f; - Main.dust[num21].velocity.X *= 7f; + int slamDust = Dust.NewDust(npc.Bottom - new Vector2(npc.width / 2, 30f), npc.width, 30, 31, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor()); + Main.dust[slamDust].noGravity = true; + Main.dust[slamDust].velocity.Y = -5f + Main.rand.NextFloat() * -3f; + Main.dust[slamDust].velocity.X *= 7f; } npc.Calamity().newAI[0] = npc.ai[0]; @@ -492,28 +492,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 0f; npc.netUpdate = true; } - else if (npc.ai[1] >= num20) + else if (npc.ai[1] >= slamDelay) { for (int m = 0; m < 4; m++) { Vector2 position = npc.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, Main.rand.Next(8)); - int num22 = Dust.NewDust(position, 2, 2, 31, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.4f); - Main.dust[num22].position = position; - Main.dust[num22].noGravity = true; - Main.dust[num22].velocity.Y = npc.velocity.Y * 0.9f; - Main.dust[num22].velocity.X = (Main.rand.NextBool() ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f; + int slamDust2 = Dust.NewDust(position, 2, 2, 31, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.4f); + Main.dust[slamDust2].position = position; + Main.dust[slamDust2].noGravity = true; + Main.dust[slamDust2].velocity.Y = npc.velocity.Y * 0.9f; + Main.dust[slamDust2].velocity.X = (Main.rand.NextBool() ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f; } } npc.velocity.X *= 0.8f; - float num23 = npc.ai[1]; + float slamNetUpdate = npc.ai[1]; npc.ai[1] += 1f; - if (npc.ai[1] >= num20) + if (npc.ai[1] >= slamDelay) { - if (num23 < num20) + if (slamNetUpdate < slamDelay) npc.netUpdate = true; - if (phase2 && npc.ai[1] > (num20 + 120)) + if (phase2 && npc.ai[1] > (slamDelay + 120)) { npc.Calamity().newAI[0] = npc.ai[0]; npc.SyncExtraAI(); @@ -526,18 +526,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } npc.velocity.Y += bossRush ? 2f : death ? 1.75f : 1.5f; - float num24 = bossRush ? 15.99f : death ? 15.5f : 15f; + float slamVelocity = bossRush ? 15.99f : death ? 15.5f : 15f; if (Main.getGoodWorld) { npc.velocity.Y += 1f; - num24 = 15.99f; + slamVelocity = 15.99f; } if (npc.velocity.Y == 0f) npc.velocity.Y = 0.01f; - if (npc.velocity.Y >= num24) - npc.velocity.Y = num24; + if (npc.velocity.Y >= slamVelocity) + npc.velocity.Y = slamVelocity; // Cascade of crystals in phase 3 or 4 while falling down if (((npc.ai[0] == 4f && phase3) || phase4) && npc.ai[1] % 12f == 0f) @@ -709,21 +709,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - float num16 = 100f; + float slamDustRadius = 100f; for (int k = 0; k < 4; k++) { - Vector2 vector2 = npc.Center + Main.rand.NextVector2CircularEdge(num16, num16); + Vector2 slamDustArea = npc.Center + Main.rand.NextVector2CircularEdge(slamDustRadius, slamDustRadius); if (!phase2) - vector2 += new Vector2(0f, 20f); + slamDustArea += new Vector2(0f, 20f); - Vector2 v = vector2 - npc.Center; + Vector2 v = slamDustArea - npc.Center; v = v.SafeNormalize(Vector2.Zero) * -8f; - int num17 = Dust.NewDust(vector2, 2, 2, 31, v.X, v.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.8f); - Main.dust[num17].position = vector2; - Main.dust[num17].noGravity = true; - Main.dust[num17].alpha = 250; - Main.dust[num17].velocity = v; - Main.dust[num17].customData = npc; + int superSlamDust = Dust.NewDust(slamDustArea, 2, 2, 31, v.X, v.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.8f); + Main.dust[superSlamDust].position = slamDustArea; + Main.dust[superSlamDust].noGravity = true; + Main.dust[superSlamDust].alpha = 250; + Main.dust[superSlamDust].velocity = v; + Main.dust[superSlamDust].customData = npc; } if (phase2) @@ -733,14 +733,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Don't take damage while teleporting - npc.dontTakeDamage = npc.hide = flag; + npc.dontTakeDamage = npc.hide = teleported; // Adjust size with HP - if (num3 != npc.scale) + if (slimeScale != npc.scale) { npc.position.X += npc.width / 2; npc.position.Y += npc.height; - npc.scale = num3; + npc.scale = slimeScale; npc.width = (int)(114f * npc.scale); npc.height = (int)(100f * npc.scale); npc.position.X -= npc.width / 2; @@ -765,8 +765,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - int num28 = (int)(npc.lifeMax * (CalamityWorld.LegendaryMode ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f)); - if (!((npc.life + num28) < npc.localAI[0])) + int slimeSpawnThreshold = (int)(npc.lifeMax * (CalamityWorld.LegendaryMode ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f)); + if (!((npc.life + slimeSpawnThreshold) < npc.localAI[0])) return false; npc.localAI[0] = npc.life; @@ -793,14 +793,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } - int num32 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, typeToSpawn); - Main.npc[num32].SetDefaults(typeToSpawn); - Main.npc[num32].velocity.X = Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num32].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num32].ai[0] = -500 * Main.rand.Next(3); - Main.npc[num32].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num32 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num32); + int slimeScale2 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, typeToSpawn); + Main.npc[slimeScale2].SetDefaults(typeToSpawn); + Main.npc[slimeScale2].velocity.X = Main.rand.Next(-15, 16) * 0.1f; + Main.npc[slimeScale2].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; + Main.npc[slimeScale2].ai[0] = -500 * Main.rand.Next(3); + Main.npc[slimeScale2].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && slimeScale2 < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeScale2); return false; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index 271967206e..8cfb3b2349 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -61,37 +61,37 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses void SpawnHands() { - int num155 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[num155].ai[0] = -1f; - Main.npc[num155].ai[1] = npc.whoAmI; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; + int skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[skeletronHand].ai[0] = -1f; + Main.npc[skeletronHand].ai[1] = npc.whoAmI; + Main.npc[skeletronHand].target = npc.target; + Main.npc[skeletronHand].netUpdate = true; - num155 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[num155].ai[0] = 1f; - Main.npc[num155].ai[1] = npc.whoAmI; - Main.npc[num155].ai[3] = 150f; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; + skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[skeletronHand].ai[0] = 1f; + Main.npc[skeletronHand].ai[1] = npc.whoAmI; + Main.npc[skeletronHand].ai[3] = 150f; + Main.npc[skeletronHand].target = npc.target; + Main.npc[skeletronHand].netUpdate = true; // Spawn two additional hands with different attack timings if (death) { - num155 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[num155].ai[0] = -1f; - Main.npc[num155].Calamity().newAI[0] = -1f; - Main.npc[num155].ai[1] = npc.whoAmI; - Main.npc[num155].ai[3] = respawnHands ? -75f : 0f; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; + skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[skeletronHand].ai[0] = -1f; + Main.npc[skeletronHand].Calamity().newAI[0] = -1f; + Main.npc[skeletronHand].ai[1] = npc.whoAmI; + Main.npc[skeletronHand].ai[3] = respawnHands ? -75f : 0f; + Main.npc[skeletronHand].target = npc.target; + Main.npc[skeletronHand].netUpdate = true; - num155 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[num155].ai[0] = 1f; - Main.npc[num155].Calamity().newAI[0] = -1f; - Main.npc[num155].ai[1] = npc.whoAmI; - Main.npc[num155].ai[3] = respawnHands ? 75f : 150f; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; + skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[skeletronHand].ai[0] = 1f; + Main.npc[skeletronHand].Calamity().newAI[0] = -1f; + Main.npc[skeletronHand].ai[1] = npc.whoAmI; + Main.npc[skeletronHand].ai[3] = respawnHands ? 75f : 150f; + Main.npc[skeletronHand].target = npc.target; + Main.npc[skeletronHand].netUpdate = true; } } } @@ -115,17 +115,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Hand immunity - int num156 = 0; - for (int num157 = 0; num157 < Main.maxNPCs; num157++) + int numHandsAlive = 0; + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num157].active && Main.npc[num157].type == NPCID.SkeletronHand) - num156++; + if (Main.npc[i].active && Main.npc[i].type == NPCID.SkeletronHand) + numHandsAlive++; } - bool handsDead = num156 == 0; + bool handsDead = numHandsAlive == 0; npc.chaseable = handsDead; - calamityGlobalNPC.DR = num156 > 0 ? 0.9999f : 0.05f; - calamityGlobalNPC.unbreakableDR = num156 > 0; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = num156 > 0; + calamityGlobalNPC.DR = numHandsAlive > 0 ? 0.9999f : 0.05f; + calamityGlobalNPC.unbreakableDR = numHandsAlive > 0; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = numHandsAlive > 0; // Teleport if (handsDead || phase2) @@ -140,28 +140,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Fire magic bolt after teleport if (Main.netMode != NetmodeID.MultiplayerClient) { - float num151 = 2f + (distance * 0.005f); - if (num151 > 6f) - num151 = 6f; + float magicBoltSpeed = 2f + (distance * 0.005f); + if (magicBoltSpeed > 6f) + magicBoltSpeed = 6f; int type = ProjectileID.Skull; int damage = npc.GetProjectileDamage(type); int numProj = Main.getGoodWorld ? 22 : death ? 5 : 3; - float num743 = Main.player[npc.target].Center.X - npc.Center.X; - float num744 = Main.player[npc.target].Center.Y - npc.Center.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + float boltTargetXDist = Main.player[npc.target].Center.X - npc.Center.X; + float boltTargetYDist = Main.player[npc.target].Center.Y - npc.Center.Y; + float boltTargetDistance = (float)Math.Sqrt(boltTargetXDist * boltTargetXDist + boltTargetYDist * boltTargetYDist); - num745 = num151 / num745; - num743 *= num745; - num744 *= num745; + boltTargetDistance = magicBoltSpeed / boltTargetDistance; + boltTargetXDist *= boltTargetDistance; + boltTargetYDist *= boltTargetDistance; Vector2 center = npc.Center; - center.X += num743 * 5f; - center.Y += num744 * 5f; + center.X += boltTargetXDist * 5f; + center.Y += boltTargetYDist * 5f; float rotation = MathHelper.ToRadians(Main.getGoodWorld ? 180 : 60); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; + float baseSpeed = (float)Math.Sqrt(boltTargetXDist * boltTargetXDist + boltTargetYDist * boltTargetYDist); + double startAngle = Math.Atan2(boltTargetXDist, boltTargetYDist) - rotation / 2; double deltaAngle = rotation / numProj; double offsetAngle; @@ -178,9 +178,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Teleport dust for (int m = 0; m < 30; m++) { - int num39 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); - Main.dust[num39].noGravity = true; - Main.dust[num39].velocity.X = Main.dust[num39].velocity.X * 2f; + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity.X = Main.dust[teleportDust].velocity.X * 2f; } } @@ -198,29 +198,29 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 value53 = npc.Center + new Vector2(npc.direction * 20, 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); - int num1453 = 26; - int num1454 = 4; - int num1455 = 22; - int num1457 = 0; + Vector2 skullFaceDirection = npc.Center + new Vector2(npc.direction * 20, 6f); + Vector2 skullTargetDirection = Main.player[npc.target].Center - skullFaceDirection; + Point skullTileCoords = npc.Center.ToTileCoordinates(); + Point targetTileCoords = Main.player[npc.target].Center.ToTileCoordinates(); + int randomTeleportOffset = 26; + int skullPositionOffset = 4; + int targetPositionOffset = 22; + int teleportTries = 0; - bool flag106 = false; - if (vector251.Length() > 2000f) - flag106 = true; + bool targetTooFar = false; + if (skullTargetDirection.Length() > 2000f) + targetTooFar = true; - while (!flag106 && num1457 < 100) + while (!targetTooFar && teleportTries < 100) { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].HasUnactuatedTile) + teleportTries++; + int teleportTileX = Main.rand.Next(targetTileCoords.X - randomTeleportOffset, targetTileCoords.X + randomTeleportOffset + 1); + int teleportTileY = Main.rand.Next(targetTileCoords.Y - randomTeleportOffset, targetTileCoords.Y + randomTeleportOffset + 1); + if ((teleportTileY < targetTileCoords.Y - targetPositionOffset || teleportTileY > targetTileCoords.Y + targetPositionOffset || teleportTileX < targetTileCoords.X - targetPositionOffset || teleportTileX > targetTileCoords.X + targetPositionOffset) && (teleportTileY < skullTileCoords.Y - skullPositionOffset || teleportTileY > skullTileCoords.Y + skullPositionOffset || teleportTileX < skullTileCoords.X - skullPositionOffset || teleportTileX > skullTileCoords.X + skullPositionOffset) && !Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) { // New location params - calamityGlobalNPC.newAI[2] = num1458 * 16 - npc.width / 2; - calamityGlobalNPC.newAI[3] = num1459 * 16 - npc.height; + calamityGlobalNPC.newAI[2] = teleportTileX * 16 - npc.width / 2; + calamityGlobalNPC.newAI[3] = teleportTileY * 16 - npc.height; npc.SyncExtraAI(); break; } @@ -233,8 +233,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int m = 0; m < 5; m++) { Vector2 position = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); - int num39 = Dust.NewDust(position, npc.width, npc.height, 27, 0f, 0f, 200, default, 2f); - Main.dust[num39].noGravity = true; + int teleportDust = Dust.NewDust(position, npc.width, npc.height, 27, 0f, 0f, 200, default, 2f); + Main.dust[teleportDust].noGravity = true; } } @@ -257,9 +257,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Teleport dust for (int m = 0; m < 30; m++) { - int num39 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); - Main.dust[num39].noGravity = true; - Main.dust[num39].velocity.X = Main.dust[num39].velocity.X * 2f; + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity.X = Main.dust[teleportDust].velocity.X * 2f; } // New location @@ -278,38 +278,38 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Skull shooting if (handsDead && npc.ai[1] == 0f) { - float num158 = bossRush ? 10f : phase2 ? (60f - (death ? 30f * (1f - lifeRatio) : 0f)) : 75f; + float skullProjFrequency = bossRush ? 10f : phase2 ? (60f - (death ? 30f * (1f - lifeRatio) : 0f)) : 75f; if (Main.getGoodWorld) - num158 *= 0.8f; - num158 = (float)Math.Ceiling(num158); + skullProjFrequency *= 0.8f; + skullProjFrequency = (float)Math.Ceiling(skullProjFrequency); - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] % num158 == 0f && calamityGlobalNPC.newAI[1] > 45f) + if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] % skullProjFrequency == 0f && calamityGlobalNPC.newAI[1] > 45f) { - Vector2 vector18 = npc.Center; - float num159 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector18.X; - float num160 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector18.Y; - float num161 = (float)Math.Sqrt(num159 * num159 + num160 * num160); - if (Collision.CanHit(vector18, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + Vector2 skullFiringPos = npc.Center; + float skullProjTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - skullFiringPos.X; + float skullProjTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - skullFiringPos.Y; + float skullProjTargetDist = (float)Math.Sqrt(skullProjTargetX * skullProjTargetX + skullProjTargetY * skullProjTargetY); + if (Collision.CanHit(skullFiringPos, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float num162 = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; - float num163 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; - float num164 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector18.Y; - float num165 = (float)Math.Sqrt(num163 * num163 + num164 * num164); - num165 = num162 / num165; - num163 *= num165; - num164 *= num165; + float skullProjSpeed = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; + float skullProjTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - skullFiringPos.X; + float skullProjTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - skullFiringPos.Y; + float skullProjTargetDist = (float)Math.Sqrt(skullProjTargetX * skullProjTargetX + skullProjTargetY * skullProjTargetY); + skullProjTargetDist = skullProjSpeed / skullProjTargetDist; + skullProjTargetX *= skullProjTargetDist; + skullProjTargetY *= skullProjTargetDist; int spread = bossRush ? 100 : 50; - Vector2 vector19 = new Vector2(num163 + Main.rand.Next(-spread, spread + 1) * 0.01f, num164 + Main.rand.Next(-spread, spread + 1) * 0.01f); - vector19.Normalize(); - vector19 *= num162; - vector19 += npc.velocity; - num163 = vector19.X; - num164 = vector19.Y; + Vector2 skullProjDirection = new Vector2(skullProjTargetX + Main.rand.Next(-spread, spread + 1) * 0.01f, skullProjTargetY + Main.rand.Next(-spread, spread + 1) * 0.01f); + skullProjDirection.Normalize(); + skullProjDirection *= skullProjSpeed; + skullProjDirection += npc.velocity; + skullProjTargetX = skullProjDirection.X; + skullProjTargetY = skullProjDirection.Y; int type = ProjectileID.Skull; int damage = npc.GetProjectileDamage(type); - vector18 += vector19 * 5f; - int num168 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector18.X, vector18.Y, num163, num164, type, damage, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num168].timeLeft = 300; + skullFiringPos += skullProjDirection * 5f; + int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos.X, skullFiringPos.Y, skullProjTargetX, skullProjTargetY, type, damage, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[skullProjectile].timeLeft = 300; npc.netUpdate = true; } @@ -337,58 +337,58 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = npc.velocity.X / 15f; - float num169 = 0.04f + (death ? 0.04f * (1f - lifeRatio) : 0f); - float num170 = 3.5f - (death ? 1f - lifeRatio : 0f); - float num171 = 0.08f + (death ? 0.04f * (1f - lifeRatio) : 0f); - float num172 = 8.5f - (death ? 2f * (1f - lifeRatio) : 0f); + float headYAcceleration = 0.04f + (death ? 0.04f * (1f - lifeRatio) : 0f); + float headYTopSpeed = 3.5f - (death ? 1f - lifeRatio : 0f); + float headXAcceleration = 0.08f + (death ? 0.04f * (1f - lifeRatio) : 0f); + float headXTopSpeed = 8.5f - (death ? 2f * (1f - lifeRatio) : 0f); if (Main.getGoodWorld) { - num169 += 0.01f; - num170 += 1f; - num171 += 0.05f; - num172 += 2f; + headYAcceleration += 0.01f; + headYTopSpeed += 1f; + headXAcceleration += 0.05f; + headXTopSpeed += 2f; } if (bossRush) { - num169 *= 1.25f; - num170 *= 0.75f; - num171 *= 1.25f; - num172 *= 0.75f; + headYAcceleration *= 1.25f; + headYTopSpeed *= 0.75f; + headXAcceleration *= 1.25f; + headXTopSpeed *= 0.75f; } if (npc.position.Y > Main.player[npc.target].position.Y - 250f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y -= num169; - if (npc.velocity.Y > num170) - npc.velocity.Y = num170; + npc.velocity.Y -= headYAcceleration; + if (npc.velocity.Y > headYTopSpeed) + npc.velocity.Y = headYTopSpeed; } else if (npc.position.Y < Main.player[npc.target].position.Y - 250f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y += num169; - if (npc.velocity.Y < -num170) - npc.velocity.Y = -num170; + npc.velocity.Y += headYAcceleration; + if (npc.velocity.Y < -headYTopSpeed) + npc.velocity.Y = -headYTopSpeed; } if (npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; - npc.velocity.X -= num171; - if (npc.velocity.X > num172) - npc.velocity.X = num172; + npc.velocity.X -= headXAcceleration; + if (npc.velocity.X > headXTopSpeed) + npc.velocity.X = headXTopSpeed; } if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; - npc.velocity.X += num171; - if (npc.velocity.X < -num172) - npc.velocity.X = -num172; + npc.velocity.X += headXAcceleration; + if (npc.velocity.X < -headXTopSpeed) + npc.velocity.X = -headXTopSpeed; } } @@ -402,21 +402,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (NPC.CountNPCS(NPCID.DarkCaster) < 6) { - int num167 = 1000; - for (int num168 = 0; num168 < num167; num168++) + for (int i = 0; i < 1000; i++) { - int num169 = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); - int num170; - for (num170 = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); num170 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num169, num170); num170++) + int headYAcceleration = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); + int headYTopSpeed; + for (headYTopSpeed = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); headYTopSpeed < Main.maxTilesY - 10 && !WorldGen.SolidTile(headYAcceleration, headYTopSpeed); headYTopSpeed++) { } - num170--; - if (!WorldGen.SolidTile(num169, num170)) + headYTopSpeed--; + if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) { - int num171 = NPC.NewNPC(npc.GetSource_FromAI(), num169 * 16 + 8, num170 * 16, NPCID.DarkCaster); - if (Main.netMode == NetmodeID.Server && num171 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171); + int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DarkCaster); + if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); break; } @@ -427,21 +426,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (!NPC.AnyNPCs(NPCID.DiabolistWhite)) { - int num167 = 1000; - for (int num168 = 0; num168 < num167; num168++) + for (int i = 0; i < 1000; i++) { - int num169 = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); - int num170; - for (num170 = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); num170 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num169, num170); num170++) + int headYAcceleration = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); + int headYTopSpeed; + for (headYTopSpeed = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); headYTopSpeed < Main.maxTilesY - 10 && !WorldGen.SolidTile(headYAcceleration, headYTopSpeed); headYTopSpeed++) { } - num170--; - if (!WorldGen.SolidTile(num169, num170)) + headYTopSpeed--; + if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) { - int num171 = NPC.NewNPC(npc.GetSource_FromAI(), num169 * 16 + 8, num170 * 16, NPCID.DiabolistWhite); - if (Main.netMode == NetmodeID.Server && num171 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171); + int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DiabolistWhite); + if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); break; } @@ -466,21 +464,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.DarkCaster) < 6) { - int num167 = 1000; - for (int num168 = 0; num168 < num167; num168++) + for (int j = 0; j < 1000; j++) { - int num169 = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); - int num170; - for (num170 = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); num170 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num169, num170); num170++) + int headYAcceleration = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); + int headYTopSpeed; + for (headYTopSpeed = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); headYTopSpeed < Main.maxTilesY - 10 && !WorldGen.SolidTile(headYAcceleration, headYTopSpeed); headYTopSpeed++) { } - num170--; - if (!WorldGen.SolidTile(num169, num170)) + headYTopSpeed--; + if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) { - int num171 = NPC.NewNPC(npc.GetSource_FromAI(), num169 * 16 + 8, num170 * 16, NPCID.DarkCaster); - if (Main.netMode == NetmodeID.Server && num171 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171); + int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DarkCaster); + if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); break; } @@ -498,30 +495,30 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } npc.rotation += npc.direction * 0.3f; - Vector2 vector20 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num173 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector20.X; - float num174 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector20.Y; - float num175 = (float)Math.Sqrt(num173 * num173 + num174 * num174); + Vector2 headSpinPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float headSpinTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - headSpinPos.X; + float headSpinTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - headSpinPos.Y; + float headSpinTargetDist = (float)Math.Sqrt(headSpinTargetX * headSpinTargetX + headSpinTargetY * headSpinTargetY); // Increase speed while charging npc.damage = (int)(npc.defDamage * 1.3); - float num176 = bossRush ? 9f : 4.5f; + float headSpinVelocityMult = bossRush ? 9f : 4.5f; float velocityBoost = death ? 1f : 1f - lifeRatio; if (handsDead || bossRush) - num176 += velocityBoost; + headSpinVelocityMult += velocityBoost; - if (num175 > 150f) + if (headSpinTargetDist > 150f) { - float baseDistanceVelocityMult = 1f + MathHelper.Clamp((num175 - 150f) * 0.0015f, 0.05f, 1.5f); - num176 *= baseDistanceVelocityMult; + float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headSpinTargetDist - 150f) * 0.0015f, 0.05f, 1.5f); + headSpinVelocityMult *= baseDistanceVelocityMult; } if (Main.getGoodWorld) - num176 *= 1.3f; + headSpinVelocityMult *= 1.3f; - num175 = num176 / num175; - npc.velocity.X = num173 * num175; - npc.velocity.Y = num174 * num175; + headSpinTargetDist = headSpinVelocityMult / headSpinTargetDist; + npc.velocity.X = headSpinTargetX * headSpinTargetDist; + npc.velocity.Y = headSpinTargetY * headSpinTargetDist; } // Daytime enrage @@ -531,13 +528,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.DR = 0.9999f; calamityGlobalNPC.unbreakableDR = true; npc.rotation += npc.direction * 0.3f; - Vector2 vector21 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num177 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector21.X; - float num178 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector21.Y; - float num179 = (float)Math.Sqrt(num177 * num177 + num178 * num178); - num179 = 8f / num179; - npc.velocity.X = num177 * num179; - npc.velocity.Y = num178 * num179; + Vector2 enrageSpinPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float enrageSpinTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - enrageSpinPos.X; + float enrageSpinTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - enrageSpinPos.Y; + float enrageSpinTargetDist = (float)Math.Sqrt(enrageSpinTargetX * enrageSpinTargetX + enrageSpinTargetY * enrageSpinTargetY); + enrageSpinTargetDist = 8f / enrageSpinTargetDist; + npc.velocity.X = enrageSpinTargetX * enrageSpinTargetDist; + npc.velocity.Y = enrageSpinTargetY * enrageSpinTargetDist; } // Despawn @@ -552,19 +549,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Emit dust - if (npc.ai[1] != 2f && npc.ai[1] != 3f && num156 != 0) + if (npc.ai[1] != 2f && npc.ai[1] != 3f && numHandsAlive != 0) { - int num180 = Dust.NewDust(new Vector2(npc.position.X + (npc.width / 2) - 15f - npc.velocity.X * 5f, npc.position.Y + npc.height - 2f), 30, 10, 5, -npc.velocity.X * 0.2f, 3f, 0, default, 2f); - Main.dust[num180].noGravity = true; - Main.dust[num180].velocity.X = Main.dust[num180].velocity.X * 1.3f; - Main.dust[num180].velocity.X = Main.dust[num180].velocity.X + npc.velocity.X * 0.4f; - Main.dust[num180].velocity.Y = Main.dust[num180].velocity.Y + (2f + npc.velocity.Y); - for (int num181 = 0; num181 < 2; num181++) + int idleDust = Dust.NewDust(new Vector2(npc.position.X + (npc.width / 2) - 15f - npc.velocity.X * 5f, npc.position.Y + npc.height - 2f), 30, 10, 5, -npc.velocity.X * 0.2f, 3f, 0, default, 2f); + Main.dust[idleDust].noGravity = true; + Main.dust[idleDust].velocity.X = Main.dust[idleDust].velocity.X * 1.3f; + Main.dust[idleDust].velocity.X = Main.dust[idleDust].velocity.X + npc.velocity.X * 0.4f; + Main.dust[idleDust].velocity.Y = Main.dust[idleDust].velocity.Y + (2f + npc.velocity.Y); + for (int j = 0; j < 2; j++) { - num180 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 120f), npc.width, 60, 5, npc.velocity.X, npc.velocity.Y, 0, default, 2f); - Main.dust[num180].noGravity = true; - Main.dust[num180].velocity -= npc.velocity; - Main.dust[num180].velocity.Y = Main.dust[num180].velocity.Y + 5f; + idleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 120f), npc.width, 60, 5, npc.velocity.X, npc.velocity.Y, 0, default, 2f); + Main.dust[idleDust].noGravity = true; + Main.dust[idleDust].velocity -= npc.velocity; + Main.dust[idleDust].velocity.Y = Main.dust[idleDust].velocity.Y + 5f; } } @@ -610,9 +607,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Teleport dust for (int m = 0; m < 10; m++) { - int num39 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); - Main.dust[num39].noGravity = true; - Main.dust[num39].velocity.X = Main.dust[num39].velocity.X * 2f; + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity.X = Main.dust[teleportDust].velocity.X * 2f; } // New location @@ -726,20 +723,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - Vector2 vector22 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num182 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector22.X; - float num183 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector22.Y; - float num184 = (float)Math.Sqrt(num182 * num182 + num183 * num183); - npc.rotation = (float)Math.Atan2(num183, num182) + MathHelper.PiOver2; + Vector2 handCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float handIdleXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - handCurrentPos.X; + float handIdleYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - handCurrentPos.Y; + float handIdleDist = (float)Math.Sqrt(handIdleXPos * handIdleXPos + handIdleYPos * handIdleYPos); + npc.rotation = (float)Math.Atan2(handIdleYPos, handIdleXPos) + MathHelper.PiOver2; return false; } if (npc.ai[2] == 1f) { - Vector2 vector23 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num185 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector23.X; - float num186 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector23.Y; - float num187 = (float)Math.Sqrt(num185 * num185 + num186 * num186); - npc.rotation = (float)Math.Atan2(num186, num185) + MathHelper.PiOver2; + Vector2 handCurrentPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float handDrawbackXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - handCurrentPosition.X; + float handDrawbackYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - handCurrentPosition.Y; + float handDrawbackDist = (float)Math.Sqrt(handDrawbackXPos * handDrawbackXPos + handDrawbackYPos * handDrawbackYPos); + npc.rotation = (float)Math.Atan2(handDrawbackYPos, handDrawbackXPos) + MathHelper.PiOver2; npc.velocity.X *= 0.95f; npc.velocity.Y -= 0.2f; @@ -750,13 +747,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.TargetClosest(); npc.ai[2] = 2f; - vector23 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num185 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector23.X; - num186 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector23.Y; - num187 = (float)Math.Sqrt(num185 * num185 + num186 * num186); - num187 = 22f / num187; - npc.velocity.X = num185 * num187; - npc.velocity.Y = num186 * num187; + handCurrentPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + handDrawbackXPos = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - handCurrentPosition.X; + handDrawbackYPos = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - handCurrentPosition.Y; + handDrawbackDist = (float)Math.Sqrt(handDrawbackXPos * handDrawbackXPos + handDrawbackYPos * handDrawbackYPos); + handDrawbackDist = 22f / handDrawbackDist; + npc.velocity.X = handDrawbackXPos * handDrawbackDist; + npc.velocity.Y = handDrawbackYPos * handDrawbackDist; npc.netUpdate = true; } } @@ -770,11 +767,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.ai[2] == 4f) { - Vector2 vector24 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num188 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector24.X; - float num189 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector24.Y; - float num190 = (float)Math.Sqrt(num188 * num188 + num189 * num189); - npc.rotation = (float)Math.Atan2(num189, num188) + MathHelper.PiOver2; + Vector2 handStrikeCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float handStrikeXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - handStrikeCurrentPos.X; + float handStrikeYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - handStrikeCurrentPos.Y; + float handStrikeDist = (float)Math.Sqrt(handStrikeXPos * handStrikeXPos + handStrikeYPos * handStrikeYPos); + npc.rotation = (float)Math.Atan2(handStrikeYPos, handStrikeXPos) + MathHelper.PiOver2; npc.velocity.Y *= 0.95f; npc.velocity.X += 0.2f * -npc.ai[0]; @@ -787,13 +784,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.TargetClosest(); npc.ai[2] = 5f; - vector24 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num188 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector24.X; - num189 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector24.Y; - num190 = (float)Math.Sqrt(num188 * num188 + num189 * num189); - num190 = 23f / num190; - npc.velocity.X = num188 * num190; - npc.velocity.Y = num189 * num190; + handStrikeCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + handStrikeXPos = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - handStrikeCurrentPos.X; + handStrikeYPos = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - handStrikeCurrentPos.Y; + handStrikeDist = (float)Math.Sqrt(handStrikeXPos * handStrikeXPos + handStrikeYPos * handStrikeYPos); + handStrikeDist = 23f / handStrikeDist; + npc.velocity.X = handStrikeXPos * handStrikeDist; + npc.velocity.Y = handStrikeYPos * handStrikeDist; npc.netUpdate = true; } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index 159a652c59..fab85f1c45 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -209,15 +209,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float velocityX = 7f - (death ? 3.5f * (1f - lifeRatio) : 0f); float acceleration = 0.1f + (death ? 0.05f * (1f - lifeRatio) : 0f); - float num500 = 0f; - float num501 = 0f; - float num502 = 0f; - int num503 = ((!(Main.player[npc.target].Center.X < npc.Center.X)) ? 1 : (-1)); + float headDecelerationUpDist = 0f; + float headDecelerationDownDist = 0f; + float headDecelerationHorizontalDist = 0f; + int headHorizontalDirection = ((!(Main.player[npc.target].Center.X < npc.Center.X)) ? 1 : (-1)); if (NPC.IsMechQueenUp) { - num502 = -150f * (float)num503; - num500 = -100f; - num501 = -100f; + headDecelerationHorizontalDist = -150f * (float)headHorizontalDirection; + headDecelerationUpDist = -100f; + headDecelerationDownDist = -100f; } if (!cannonAlive) @@ -252,7 +252,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.player[npc.target].HoldingTrueMeleeWeapon()) acceleration *= 0.5f; - if (npc.position.Y > Main.player[npc.target].position.Y - (400f + num500)) + if (npc.position.Y > Main.player[npc.target].position.Y - (400f + headDecelerationUpDist)) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y > velocityY) npc.velocity.Y = velocityY; } - else if (npc.position.Y < Main.player[npc.target].position.Y - (450f + num501)) + else if (npc.position.Y < Main.player[npc.target].position.Y - (450f + headDecelerationDownDist)) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.9f; @@ -273,7 +273,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y = -velocityY; } - if (npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (400f + num502)) + if (npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (400f + headDecelerationHorizontalDist)) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.9f; @@ -283,7 +283,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X > velocityX) npc.velocity.X = velocityX; } - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - (400f + num502)) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - (400f + headDecelerationHorizontalDist)) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.9f; @@ -321,8 +321,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f); + Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(laserFireDirection) * 30f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; } calamityGlobalNPC.newAI[3] += 1f; @@ -351,10 +351,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else npc.rotation += npc.direction * 0.3f; - Vector2 vector48 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num455 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector48.X; - float num456 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector48.Y; - float num457 = (float)Math.Sqrt(num455 * num455 + num456 * num456); + Vector2 headPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float headTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - headPosition.X; + float headTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - headPosition.Y; + float headTargetDistance = (float)Math.Sqrt(headTargetX * headTargetX + headTargetY * headTargetY); float speed = bossRush ? 9f : 6f; if (phase2) @@ -362,30 +362,30 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (phase3) speed += 0.5f; - if (num457 > 150f) + if (headTargetDistance > 150f) { - float baseDistanceVelocityMult = 1f + MathHelper.Clamp((num457 - 150f) * 0.0015f, 0.05f, 1.5f); + float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headTargetDistance - 150f) * 0.0015f, 0.05f, 1.5f); speed *= baseDistanceVelocityMult; } if (NPC.IsMechQueenUp) { - float num508 = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f); - speed *= num508; + float mechdusaSpeedMult = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f); + speed *= mechdusaSpeedMult; } - num457 = speed / num457; - npc.velocity.X = num455 * num457; - npc.velocity.Y = num456 * num457; + headTargetDistance = speed / headTargetDistance; + npc.velocity.X = headTargetX * headTargetDistance; + npc.velocity.Y = headTargetY * headTargetDistance; if (NPC.IsMechQueenUp) { - float num509 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); - if (num509 < 0.1f) - num509 = 0f; + float mechdusaAccelMult = Vector2.Distance(npc.Center, Main.player[npc.target].Center); + if (mechdusaAccelMult < 0.1f) + mechdusaAccelMult = 0f; - if (num509 < speed) - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * num509; + if (mechdusaAccelMult < speed) + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * mechdusaAccelMult; } } @@ -401,21 +401,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else npc.rotation += npc.direction * 0.3f; - Vector2 vector49 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num458 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector49.X; - float num459 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector49.Y; - float num460 = (float)Math.Sqrt(num458 * num458 + num459 * num459); + Vector2 enragedHeadPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float enragedHeadTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - enragedHeadPosition.X; + float enragedHeadTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - enragedHeadPosition.Y; + float enragedHeadTargetDist = (float)Math.Sqrt(enragedHeadTargetX * enragedHeadTargetX + enragedHeadTargetY * enragedHeadTargetY); - float num461 = 10f; - num461 += num460 / 100f; - if (num461 < 8f) - num461 = 8f; - if (num461 > 32f) - num461 = 32f; + float enragedHeadSpeed = 10f; + enragedHeadSpeed += enragedHeadTargetDist / 100f; + if (enragedHeadSpeed < 8f) + enragedHeadSpeed = 8f; + if (enragedHeadSpeed > 32f) + enragedHeadSpeed = 32f; - num460 = num461 / num460; - npc.velocity.X = num458 * num460; - npc.velocity.Y = num459 * num460; + enragedHeadTargetDist = enragedHeadSpeed / enragedHeadTargetDist; + npc.velocity.X = enragedHeadTargetX * enragedHeadTargetDist; + npc.velocity.Y = enragedHeadTargetY * enragedHeadTargetDist; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -423,28 +423,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[0] >= 60f) { npc.localAI[0] = 0f; - Vector2 vector16 = npc.Center; - if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + Vector2 headCenter = npc.Center; + if (Collision.CanHit(headCenter, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float num159 = 7f; - float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt(num160 * num160 + num161 * num161); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; + float enragedHeadSpeed = 7f; + float enragedHeadSkullTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - headCenter.X + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - headCenter.Y + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); + enragedHeadSkullTargetDist = enragedHeadSpeed / enragedHeadSkullTargetDist; + enragedHeadSkullTargetX *= enragedHeadSkullTargetDist; + enragedHeadSkullTargetY *= enragedHeadSkullTargetDist; - Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); + Vector2 value = new Vector2(enragedHeadSkullTargetX * 1f + Main.rand.Next(-50, 51) * 0.01f, enragedHeadSkullTargetY * 1f + Main.rand.Next(-50, 51) * 0.01f); value.Normalize(); - value *= num159; + value *= enragedHeadSpeed; value += npc.velocity; - num160 = value.X; - num161 = value.Y; + enragedHeadSkullTargetX = value.X; + enragedHeadSkullTargetY = value.Y; int type = ProjectileID.Skull; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector16.X, vector16.Y, num160, num161, type, 250, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 300; + headCenter += value * 5f; + int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, 250, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[enragedSkulls].timeLeft = 300; } } } @@ -455,19 +455,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (NPC.IsMechQueenUp) { - int num514 = NPC.FindFirstNPC(NPCID.Retinazer); - if (num514 >= 0) - Main.npc[num514].EncourageDespawn(5); + int mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Retinazer); + if (mechdusaBossDespawning >= 0) + Main.npc[mechdusaBossDespawning].EncourageDespawn(5); - num514 = NPC.FindFirstNPC(NPCID.Spazmatism); - if (num514 >= 0) - Main.npc[num514].EncourageDespawn(5); + mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Spazmatism); + if (mechdusaBossDespawning >= 0) + Main.npc[mechdusaBossDespawning].EncourageDespawn(5); if (!NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.Spazmatism)) { - num514 = NPC.FindFirstNPC(NPCID.TheDestroyer); - if (num514 >= 0) - Main.npc[num514].Transform(NPCID.TheDestroyerTail); + mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.TheDestroyer); + if (mechdusaBossDespawning >= 0) + Main.npc[mechdusaBossDespawning].Transform(NPCID.TheDestroyerTail); npc.EncourageDespawn(5); } @@ -540,27 +540,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector16 = npc.Center; - float num159 = 4f + (death ? 2f * (1f - lifeRatio) : 0f); - float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt(num160 * num160 + num161 * num161); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; + Vector2 headCenter = npc.Center; + float enragedHeadSpeed = 4f + (death ? 2f * (1f - lifeRatio) : 0f); + float enragedHeadSkullTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - headCenter.X + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - headCenter.Y + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); + enragedHeadSkullTargetDist = enragedHeadSpeed / enragedHeadSkullTargetDist; + enragedHeadSkullTargetX *= enragedHeadSkullTargetDist; + enragedHeadSkullTargetY *= enragedHeadSkullTargetDist; - Vector2 value = new Vector2(num160 + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f, num161 + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f); + Vector2 value = new Vector2(enragedHeadSkullTargetX + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f, enragedHeadSkullTargetY + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f); value.Normalize(); - value *= num159; - num160 = value.X; - num161 = value.Y; + value *= enragedHeadSpeed; + enragedHeadSkullTargetX = value.X; + enragedHeadSkullTargetY = value.Y; int type = ProjectileID.Skull; int damage = npc.GetProjectileDamage(type); - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector16.X, vector16.Y, num160, num161, type, damage, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 480; - Main.projectile[num165].tileCollide = false; + headCenter += value * 5f; + int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, damage, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[enragedSkulls].timeLeft = 480; + Main.projectile[enragedSkulls].tileCollide = false; } } @@ -772,11 +772,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - Vector2 vector62 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num506 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector62.X; - float num507 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector62.Y; - float num508 = (float)Math.Sqrt(num506 * num506 + num507 * num507); - npc.rotation = (float)Math.Atan2(num507, num506) - MathHelper.PiOver2; + Vector2 laserArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float laserArmTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - laserArmPosition.X; + float laserArmTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - laserArmPosition.Y; + float laserArmTargetDist = (float)Math.Sqrt(laserArmTargetX * laserArmTargetX + laserArmTargetY * laserArmTargetY); + npc.rotation = (float)Math.Atan2(laserArmTargetY, laserArmTargetX) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) { @@ -793,15 +793,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.localAI[0] = 0f; npc.TargetClosest(); - float num509 = bossRush ? 5f : 4f; + float laserSpeed = bossRush ? 5f : 4f; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); - num508 = num509 / num508; - num506 *= num508; - num507 *= num508; - vector62.X += num506 * 30f; - vector62.Y += num507 * 30f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector62.X, vector62.Y, num506, num507, type, damage, 0f, Main.myPlayer, 1f, 0f); + laserArmTargetDist = laserSpeed / laserArmTargetDist; + laserArmTargetX *= laserArmTargetDist; + laserArmTargetY *= laserArmTargetDist; + laserArmPosition.X += laserArmTargetX * 30f; + laserArmPosition.Y += laserArmTargetY * 30f; + Projectile.NewProjectile(npc.GetSource_FromAI(), laserArmPosition.X, laserArmPosition.Y, laserArmTargetX, laserArmTargetY, type, damage, 0f, Main.myPlayer, 1f, 0f); } } } @@ -830,10 +830,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - Vector2 vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector63.X; - float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector63.Y; - npc.rotation = (float)Math.Atan2(num514, num513) - MathHelper.PiOver2; + Vector2 laserRingArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float laserRingTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - laserRingArmPosition.X; + float laserRingTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - laserRingArmPosition.Y; + npc.rotation = (float)Math.Atan2(laserRingTargetY, laserRingTargetX) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) { @@ -861,8 +861,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-laserVelocityX, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f); + Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(laserFireDirection) * 30f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; } npc.localAI[1] += 1f; @@ -1041,11 +1041,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) npc.timeLeft = 10; - Vector2 vector60 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num492 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector60.X; - float num493 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector60.Y; - float num494 = (float)Math.Sqrt(num492 * num492 + num493 * num493); - npc.rotation = (float)Math.Atan2(num493, num492) - MathHelper.PiOver2; + Vector2 cannonArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float cannonArmTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - cannonArmPosition.X; + float cannonArmTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - cannonArmPosition.Y; + float cannonArmTargetDist = (float)Math.Sqrt(cannonArmTargetX * cannonArmTargetX + cannonArmTargetY * cannonArmTargetY); + npc.rotation = (float)Math.Atan2(cannonArmTargetY, cannonArmTargetX) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) { @@ -1063,25 +1063,24 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.Item62, npc.Center); npc.localAI[0] = 0f; npc.TargetClosest(); - float num495 = 0.5f; int type = ProjectileID.RocketSkeleton; int damage = npc.GetProjectileDamage(type); - num494 = num495 / num494; - num492 *= num494; - num493 *= num494; - vector60.X += num492 * 30f; - vector60.Y += num493 * 30f; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), vector60.X, vector60.Y, num492, num493, type, damage, 0f, Main.myPlayer, npc.target, 1f); + cannonArmTargetDist = 0.5f / cannonArmTargetDist; + cannonArmTargetX *= cannonArmTargetDist; + cannonArmTargetY *= cannonArmTargetDist; + cannonArmPosition.X += cannonArmTargetX * 30f; + cannonArmPosition.Y += cannonArmTargetY * 30f; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), cannonArmPosition.X, cannonArmPosition.Y, cannonArmTargetX, cannonArmTargetY, type, damage, 0f, Main.myPlayer, npc.target, 1f); Main.projectile[proj].timeLeft = 600; } } } else { - Vector2 vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num499 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector61.X; - float num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector61.Y; - npc.rotation = (float)Math.Atan2(num500, num499) - MathHelper.PiOver2; + Vector2 cannonSpreadArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float cannonSpreadArmTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - cannonSpreadArmPosition.X; + float cannonSpreadArmTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - cannonSpreadArmPosition.Y; + npc.rotation = (float)Math.Atan2(cannonSpreadArmTargetY, cannonSpreadArmTargetX) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) { @@ -1099,17 +1098,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.Item62, npc.Center); npc.localAI[0] = 0f; npc.TargetClosest(); - float num502 = 0.5f; int type = ProjectileID.RocketSkeleton; int damage = npc.GetProjectileDamage(type); - Vector2 value19 = Main.player[npc.target].Center - npc.Center; - value19.Normalize(); - value19 *= num502; + Vector2 cannonSpreadTargetDist = Main.player[npc.target].Center - npc.Center; + cannonSpreadTargetDist.Normalize(); + cannonSpreadTargetDist *= 0.5f; int numProj = bossRush ? 5 : 3; float rotation = MathHelper.ToRadians(bossRush ? 8 : 5); for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Vector2 perturbedSpeed = cannonSpreadTargetDist.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 30f, perturbedSpeed, type, damage, 0f, Main.myPlayer, npc.target, 1f); Main.projectile[proj].timeLeft = 600; } @@ -1137,18 +1135,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.spriteDirection = -(int)npc.ai[0]; // Where the vice should be in relation to the head - Vector2 vector55 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num477 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector55.X; - float num478 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector55.Y; - float num479 = (float)Math.Sqrt(num477 * num477 + num478 * num478); + Vector2 viceArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float viceArmIdleXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - viceArmPosition.X; + float viceArmIdleYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmPosition.Y; + float viceArmIdleDistance = (float)Math.Sqrt(viceArmIdleXPos * viceArmIdleXPos + viceArmIdleYPos * viceArmIdleYPos); // Return the vice to its proper location in relation to the head if it's too far away if (npc.ai[2] != 99f) { - if (num479 > 800f) + if (viceArmIdleDistance > 800f) npc.ai[2] = 99f; } - else if (num479 < 400f) + else if (viceArmIdleDistance < 400f) npc.ai[2] = 0f; // Despawn if head is gone @@ -1318,10 +1316,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.X = -velocityX2; } - Vector2 vector57 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num483 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector57.X; - float num484 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector57.Y; - npc.rotation = (float)Math.Atan2(num484, num483) + MathHelper.PiOver2; + Vector2 viceArmReelbackCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float viceArmReelbackXDest = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - viceArmReelbackCurrentPos.X; + float viceArmReelbackYDest = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmReelbackCurrentPos.Y; + npc.rotation = (float)Math.Atan2(viceArmReelbackYDest, viceArmReelbackXDest) + MathHelper.PiOver2; return false; } @@ -1331,10 +1329,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; - Vector2 vector58 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num486 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 280f * npc.ai[0] - vector58.X; - float num487 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector58.Y; - npc.rotation = (float)Math.Atan2(num487, num486) + MathHelper.PiOver2; + Vector2 viceArmChargePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float viceArmChargeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 280f * npc.ai[0] - viceArmChargePosition.X; + float viceArmChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmChargePosition.Y; + npc.rotation = (float)Math.Atan2(viceArmChargeTargetY, viceArmChargeTargetX) + MathHelper.PiOver2; npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; npc.velocity.X += 0.5f; @@ -1355,13 +1353,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 2f; npc.TargetClosest(); - vector58 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num486 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector58.X; - num487 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector58.Y; - float num488 = (float)Math.Sqrt(num486 * num486 + num487 * num487); - num488 = chargeVelocity / num488; - npc.velocity.X = num486 * num488; - npc.velocity.Y = num487 * num488; + viceArmChargePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + viceArmChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - viceArmChargePosition.X; + viceArmChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - viceArmChargePosition.Y; + float viceArmChargeTargetDist = (float)Math.Sqrt(viceArmChargeTargetX * viceArmChargeTargetX + viceArmChargeTargetY * viceArmChargeTargetY); + viceArmChargeTargetDist = chargeVelocity / viceArmChargeTargetDist; + npc.velocity.X = viceArmChargeTargetX * viceArmChargeTargetDist; + npc.velocity.Y = viceArmChargeTargetY * viceArmChargeTargetDist; npc.netUpdate = true; } } @@ -1396,10 +1394,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Different type of charge else if (npc.ai[2] == 4f) { - Vector2 vector59 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num489 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector59.X; - float num490 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector59.Y; - npc.rotation = (float)Math.Atan2(num490, num489) + MathHelper.PiOver2; + Vector2 viceArmOtherChargePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float viceArmOtherChargeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - viceArmOtherChargePosition.X; + float viceArmOtherChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmOtherChargePosition.Y; + npc.rotation = (float)Math.Atan2(viceArmOtherChargeTargetY, viceArmOtherChargeTargetX) + MathHelper.PiOver2; npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; @@ -1419,13 +1417,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 5f; npc.TargetClosest(); - vector59 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num489 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector59.X; - num490 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector59.Y; - float num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); - num491 = chargeVelocity / num491; - npc.velocity.X = num489 * num491; - npc.velocity.Y = num490 * num491; + viceArmOtherChargePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + viceArmOtherChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - viceArmOtherChargePosition.X; + viceArmOtherChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - viceArmOtherChargePosition.Y; + float viceArmOtherChargeTargetDist = (float)Math.Sqrt(viceArmOtherChargeTargetX * viceArmOtherChargeTargetX + viceArmOtherChargeTargetY * viceArmOtherChargeTargetY); + viceArmOtherChargeTargetDist = chargeVelocity / viceArmOtherChargeTargetDist; + npc.velocity.X = viceArmOtherChargeTargetX * viceArmOtherChargeTargetDist; + npc.velocity.Y = viceArmOtherChargeTargetY * viceArmOtherChargeTargetDist; npc.netUpdate = true; } } @@ -1471,17 +1469,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) npc.TargetClosest(); - Vector2 vector50 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num462 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector50.X; - float num463 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector50.Y; - float num464 = (float)Math.Sqrt(num462 * num462 + num463 * num463); + Vector2 sawArmLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float sawArmIdleXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - sawArmLocation.X; + float sawArmIdleYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmLocation.Y; + float sawArmIdleDistance = (float)Math.Sqrt(sawArmIdleXPos * sawArmIdleXPos + sawArmIdleYPos * sawArmIdleYPos); if (npc.ai[2] != 99f) { - if (num464 > 800f) + if (sawArmIdleDistance > 800f) npc.ai[2] = 99f; } - else if (num464 < 400f) + else if (sawArmIdleDistance < 400f) npc.ai[2] = 0f; npc.spriteDirection = -(int)npc.ai[0]; @@ -1646,19 +1644,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.X = -velocityX; } - Vector2 vector52 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num468 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector52.X; - float num469 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector52.Y; - npc.rotation = (float)Math.Atan2(num469, num468) + MathHelper.PiOver2; + Vector2 sawArmReelbackCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float sawArmReelbackXDest = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - sawArmReelbackCurrentPos.X; + float sawArmReelbackYDest = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmReelbackCurrentPos.Y; + npc.rotation = (float)Math.Atan2(sawArmReelbackYDest, sawArmReelbackXDest) + MathHelper.PiOver2; return false; } if (npc.ai[2] == 1f) { - Vector2 vector53 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num471 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector53.X; - float num472 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector53.Y; - npc.rotation = (float)Math.Atan2(num472, num471) + MathHelper.PiOver2; + Vector2 sawArmChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float sawArmChargeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - sawArmChargePos.X; + float sawArmChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmChargePos.Y; + npc.rotation = (float)Math.Atan2(sawArmChargeTargetY, sawArmChargeTargetX) + MathHelper.PiOver2; npc.velocity.X *= 0.95f; npc.velocity.Y -= 0.5f; @@ -1677,13 +1675,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 2f; npc.TargetClosest(); - vector53 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num471 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector53.X; - num472 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector53.Y; - float num473 = (float)Math.Sqrt(num471 * num471 + num472 * num472); - num473 = chargeVelocity / num473; - npc.velocity.X = num471 * num473; - npc.velocity.Y = num472 * num473; + sawArmChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + sawArmChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - sawArmChargePos.X; + sawArmChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - sawArmChargePos.Y; + float sawArmChargeTargetDist = (float)Math.Sqrt(sawArmChargeTargetX * sawArmChargeTargetX + sawArmChargeTargetY * sawArmChargeTargetY); + sawArmChargeTargetDist = chargeVelocity / sawArmChargeTargetDist; + npc.velocity.X = sawArmChargeTargetX * sawArmChargeTargetDist; + npc.velocity.Y = sawArmChargeTargetY * sawArmChargeTargetDist; npc.netUpdate = true; } } @@ -1706,37 +1704,37 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (!viceAlive) chargeVelocity += 1.5f; - Vector2 vector54 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num474 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector54.X; - float num475 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector54.Y; - float num476 = (float)Math.Sqrt(num474 * num474 + num475 * num475); - num476 = chargeVelocity / num476; - num474 *= num476; - num475 *= num476; + Vector2 sawArmOtherChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float sawArmOtherChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - sawArmOtherChargePos.X; + float sawArmOtherChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - sawArmOtherChargePos.Y; + float sawArmOtherChargeTargetDist = (float)Math.Sqrt(sawArmOtherChargeTargetX * sawArmOtherChargeTargetX + sawArmOtherChargeTargetY * sawArmOtherChargeTargetY); + sawArmOtherChargeTargetDist = chargeVelocity / sawArmOtherChargeTargetDist; + sawArmOtherChargeTargetX *= sawArmOtherChargeTargetDist; + sawArmOtherChargeTargetY *= sawArmOtherChargeTargetDist; float acceleration = bossRush ? 0.3f : death ? 0.1f : 0.08f; - if (npc.velocity.X > num474) + if (npc.velocity.X > sawArmOtherChargeTargetX) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.9f; npc.velocity.X -= acceleration; } - if (npc.velocity.X < num474) + if (npc.velocity.X < sawArmOtherChargeTargetX) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.9f; npc.velocity.X += acceleration; } - if (npc.velocity.Y > num475) + if (npc.velocity.Y > sawArmOtherChargeTargetY) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; npc.velocity.Y -= acceleration; } - if (npc.velocity.Y < num475) + if (npc.velocity.Y < sawArmOtherChargeTargetY) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.9f; @@ -1756,10 +1754,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - vector54 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num474 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector54.X; - num475 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector54.Y; - npc.rotation = (float)Math.Atan2(num475, num474) + MathHelper.PiOver2; + sawArmOtherChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + sawArmOtherChargeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - sawArmOtherChargePos.X; + sawArmOtherChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmOtherChargePos.Y; + npc.rotation = (float)Math.Atan2(sawArmOtherChargeTargetY, sawArmOtherChargeTargetX) + MathHelper.PiOver2; return false; } From 758a37b9eacfe3d9b239e69e2b400f45e8d84b7d Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 27 Oct 2023 09:23:07 -0400 Subject: [PATCH 24/43] The Twins and Wall of Flesh --- NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs | 1222 ++++++++--------- .../Bosses/WallOfFleshAI.cs | 239 ++-- 2 files changed, 726 insertions(+), 735 deletions(-) diff --git a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs index b7f95d1cdb..00c33bf5ac 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs @@ -21,43 +21,43 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); } bool dead2 = Main.player[npc.target].dead; - float num399 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); - float num400 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); - float num401 = (float)Math.Atan2(num400, num399) + 1.57f; - if (num401 < 0f) + float trueMeleeRetiTargetXDist = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float trueMeleeRetiTargetYDist = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + float trueMeleeRetiTargetDistance = (float)Math.Atan2(trueMeleeRetiTargetYDist, trueMeleeRetiTargetXDist) + 1.57f; + if (trueMeleeRetiTargetDistance < 0f) { - num401 += MathHelper.TwoPi; + trueMeleeRetiTargetDistance += MathHelper.TwoPi; } - else if (num401 > MathHelper.TwoPi) + else if (trueMeleeRetiTargetDistance > MathHelper.TwoPi) { - num401 -= MathHelper.TwoPi; + trueMeleeRetiTargetDistance -= MathHelper.TwoPi; } - float num402 = 0.1f; - if (npc.rotation < num401) + float trueMeleeRetiReducedAccel = 0.1f; + if (npc.rotation < trueMeleeRetiTargetDistance) { - if ((double)(num401 - npc.rotation) > MathHelper.Pi) + if ((double)(trueMeleeRetiTargetDistance - npc.rotation) > MathHelper.Pi) { - npc.rotation -= num402; + npc.rotation -= trueMeleeRetiReducedAccel; } else { - npc.rotation += num402; + npc.rotation += trueMeleeRetiReducedAccel; } } - else if (npc.rotation > num401) + else if (npc.rotation > trueMeleeRetiTargetDistance) { - if ((double)(npc.rotation - num401) > MathHelper.Pi) + if ((double)(npc.rotation - trueMeleeRetiTargetDistance) > MathHelper.Pi) { - npc.rotation += num402; + npc.rotation += trueMeleeRetiReducedAccel; } else { - npc.rotation -= num402; + npc.rotation -= trueMeleeRetiReducedAccel; } } - if (npc.rotation > num401 - num402 && npc.rotation < num401 + num402) + if (npc.rotation > trueMeleeRetiTargetDistance - trueMeleeRetiReducedAccel && npc.rotation < trueMeleeRetiTargetDistance + trueMeleeRetiReducedAccel) { - npc.rotation = num401; + npc.rotation = trueMeleeRetiTargetDistance; } if (npc.rotation < 0f) { @@ -67,22 +67,22 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.rotation -= MathHelper.TwoPi; } - if (npc.rotation > num401 - num402 && npc.rotation < num401 + num402) + if (npc.rotation > trueMeleeRetiTargetDistance - trueMeleeRetiReducedAccel && npc.rotation < trueMeleeRetiTargetDistance + trueMeleeRetiReducedAccel) { - npc.rotation = num401; + npc.rotation = trueMeleeRetiTargetDistance; } if (Main.rand.NextBool(5)) { - int num403 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f); - Main.dust[num403].velocity.X *= 0.5f; - Main.dust[num403].velocity.Y *= 0.1f; + int retinazerDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f); + Main.dust[retinazerDust].velocity.X *= 0.5f; + Main.dust[retinazerDust].velocity.Y *= 0.1f; } if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) { - for (int num381 = 0; num381 < Main.maxNPCs; num381++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (num381 != npc.whoAmI && Main.npc[num381].active && (Main.npc[num381].type == NPCID.Retinazer || Main.npc[num381].type == NPCID.Spazmatism) && Main.npc[num381].timeLeft - 1 > npc.timeLeft) - npc.timeLeft = Main.npc[num381].timeLeft - 1; + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) + npc.timeLeft = Main.npc[i].timeLeft - 1; } } @@ -100,61 +100,61 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.HitSound = SoundID.NPCHit4; if (npc.ai[1] == 0f) { - float num421 = 8f; - float num422 = 0.15f; + float retinazerMaxSpeed = 8f; + float retinazerAccel = 0.15f; if (Main.expertMode) { - num421 = 9.5f; - num422 = 0.175f; + retinazerMaxSpeed = 9.5f; + retinazerAccel = 0.175f; } if (Main.getGoodWorld) { - num421 *= 1.15f; - num422 *= 1.15f; + retinazerMaxSpeed *= 1.15f; + retinazerAccel *= 1.15f; } // Reduce acceleration if target is holding a true melee weapon if (Main.player[npc.target].HoldingTrueMeleeWeapon()) { - num421 *= 0.75f; - num422 *= 0.5f; + retinazerMaxSpeed *= 0.75f; + retinazerAccel *= 0.5f; } - Vector2 vector39 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num423 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector39.X; - float num424 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector39.Y; - float num425 = (float)Math.Sqrt(num423 * num423 + num424 * num424); - num425 = num421 / num425; - num423 *= num425; - num424 *= num425; - if (npc.velocity.X < num423) + Vector2 retinazerPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float retinazerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPosition.X; + float retinazerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - retinazerPosition.Y; + float retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); + retinazerTargetDist = retinazerMaxSpeed / retinazerTargetDist; + retinazerTargetX *= retinazerTargetDist; + retinazerTargetY *= retinazerTargetDist; + if (npc.velocity.X < retinazerTargetX) { - npc.velocity.X += num422; - if (npc.velocity.X < 0f && num423 > 0f) + npc.velocity.X += retinazerAccel; + if (npc.velocity.X < 0f && retinazerTargetX > 0f) { - npc.velocity.X += num422; + npc.velocity.X += retinazerAccel; } } - else if (npc.velocity.X > num423) + else if (npc.velocity.X > retinazerTargetX) { - npc.velocity.X -= num422; - if (npc.velocity.X > 0f && num423 < 0f) + npc.velocity.X -= retinazerAccel; + if (npc.velocity.X > 0f && retinazerTargetX < 0f) { - npc.velocity.X -= num422; + npc.velocity.X -= retinazerAccel; } } - if (npc.velocity.Y < num424) + if (npc.velocity.Y < retinazerTargetY) { - npc.velocity.Y += num422; - if (npc.velocity.Y < 0f && num424 > 0f) + npc.velocity.Y += retinazerAccel; + if (npc.velocity.Y < 0f && retinazerTargetY > 0f) { - npc.velocity.Y += num422; + npc.velocity.Y += retinazerAccel; } } - else if (npc.velocity.Y > num424) + else if (npc.velocity.Y > retinazerTargetY) { - npc.velocity.Y -= num422; - if (npc.velocity.Y > 0f && num424 < 0f) + npc.velocity.Y -= retinazerAccel; + if (npc.velocity.Y > 0f && retinazerTargetY < 0f) { - npc.velocity.Y -= num422; + npc.velocity.Y -= retinazerAccel; } } npc.ai[2] += 1f; @@ -166,10 +166,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); npc.netUpdate = true; } - vector39 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num423 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector39.X; - num424 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector39.Y; - npc.rotation = (float)Math.Atan2(num424, num423) - 1.57f; + retinazerPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + retinazerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPosition.X; + retinazerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPosition.Y; + npc.rotation = (float)Math.Atan2(retinazerTargetY, retinazerTargetX) - 1.57f; if (Main.netMode == NetmodeID.MultiplayerClient) { return false; @@ -194,89 +194,88 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; - float num426 = 8.5f; + float retinazerLaserSpeed = 8.5f; int attackDamage_ForProjectiles4 = Main.expertMode ? 23 : 25; - int num427 = 100; if (Main.expertMode) { - num426 = 10f; + retinazerLaserSpeed = 10f; } - num425 = (float)Math.Sqrt(num423 * num423 + num424 * num424); - num425 = num426 / num425; - num423 *= num425; - num424 *= num425; - vector39.X += num423 * 15f; - vector39.Y += num424 * 15f; - int num428 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector39.X, vector39.Y, num423, num424, num427, attackDamage_ForProjectiles4, 0f, Main.myPlayer); + retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); + retinazerTargetDist = retinazerLaserSpeed / retinazerTargetDist; + retinazerTargetX *= retinazerTargetDist; + retinazerTargetY *= retinazerTargetDist; + retinazerPosition.X += retinazerTargetX * 15f; + retinazerPosition.Y += retinazerTargetY * 15f; + int retinazerLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPosition.X, retinazerPosition.Y, retinazerTargetX, retinazerTargetY, 100, attackDamage_ForProjectiles4, 0f, Main.myPlayer); } return false; } - int num429 = 1; + int retinazerFaceDirection = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) { - num429 = -1; + retinazerFaceDirection = -1; } - float num430 = 8f; - float num431 = 0.2f; + float retinazerSpeedPhase2 = 8f; + float retinazerAccelPhase2 = 0.2f; if (Main.expertMode) { - num430 = 9.5f; - num431 = 0.25f; + retinazerSpeedPhase2 = 9.5f; + retinazerAccelPhase2 = 0.25f; } if (Main.getGoodWorld) { - num430 *= 1.15f; - num431 *= 1.15f; + retinazerSpeedPhase2 *= 1.15f; + retinazerAccelPhase2 *= 1.15f; } // Reduce acceleration if target is holding a true melee weapon if (Main.player[npc.target].HoldingTrueMeleeWeapon()) { - num430 *= 0.75f; - num431 *= 0.5f; + retinazerSpeedPhase2 *= 0.75f; + retinazerAccelPhase2 *= 0.5f; } - Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num432 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num429 * 340) - vector40.X; - float num433 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector40.Y; - float num434 = (float)Math.Sqrt(num432 * num432 + num433 * num433); - num434 = num430 / num434; - num432 *= num434; - num433 *= num434; - if (npc.velocity.X < num432) + Vector2 retinazerPhase2Pos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float retinazerPhase2TargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (retinazerFaceDirection * 340) - retinazerPhase2Pos.X; + float retinazerPhase2TargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase2Pos.Y; + float retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); + retinazerPhase2TargetDist = retinazerSpeedPhase2 / retinazerPhase2TargetDist; + retinazerPhase2TargetX *= retinazerPhase2TargetDist; + retinazerPhase2TargetY *= retinazerPhase2TargetDist; + if (npc.velocity.X < retinazerPhase2TargetX) { - npc.velocity.X += num431; - if (npc.velocity.X < 0f && num432 > 0f) + npc.velocity.X += retinazerAccelPhase2; + if (npc.velocity.X < 0f && retinazerPhase2TargetX > 0f) { - npc.velocity.X += num431; + npc.velocity.X += retinazerAccelPhase2; } } - else if (npc.velocity.X > num432) + else if (npc.velocity.X > retinazerPhase2TargetX) { - npc.velocity.X -= num431; - if (npc.velocity.X > 0f && num432 < 0f) + npc.velocity.X -= retinazerAccelPhase2; + if (npc.velocity.X > 0f && retinazerPhase2TargetX < 0f) { - npc.velocity.X -= num431; + npc.velocity.X -= retinazerAccelPhase2; } } - if (npc.velocity.Y < num433) + if (npc.velocity.Y < retinazerPhase2TargetY) { - npc.velocity.Y += num431; - if (npc.velocity.Y < 0f && num433 > 0f) + npc.velocity.Y += retinazerAccelPhase2; + if (npc.velocity.Y < 0f && retinazerPhase2TargetY > 0f) { - npc.velocity.Y += num431; + npc.velocity.Y += retinazerAccelPhase2; } } - else if (npc.velocity.Y > num433) + else if (npc.velocity.Y > retinazerPhase2TargetY) { - npc.velocity.Y -= num431; - if (npc.velocity.Y > 0f && num433 < 0f) + npc.velocity.Y -= retinazerAccelPhase2; + if (npc.velocity.Y > 0f && retinazerPhase2TargetY < 0f) { - npc.velocity.Y -= num431; + npc.velocity.Y -= retinazerAccelPhase2; } } - vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num432 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector40.X; - num433 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector40.Y; - npc.rotation = (float)Math.Atan2(num433, num432) - 1.57f; + retinazerPhase2Pos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + retinazerPhase2TargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPhase2Pos.X; + retinazerPhase2TargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase2Pos.Y; + npc.rotation = (float)Math.Atan2(retinazerPhase2TargetY, retinazerPhase2TargetX) - 1.57f; if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; @@ -303,16 +302,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; - float num435 = 9f; int attackDamage_ForProjectiles5 = Main.expertMode ? 17 : 18; - int num436 = 100; - num434 = (float)Math.Sqrt(num432 * num432 + num433 * num433); - num434 = num435 / num434; - num432 *= num434; - num433 *= num434; - vector40.X += num432 * 15f; - vector40.Y += num433 * 15f; - int num437 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector40.X, vector40.Y, num432, num433, num436, attackDamage_ForProjectiles5, 0f, Main.myPlayer); + retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); + retinazerPhase2TargetDist = 9f / retinazerPhase2TargetDist; + retinazerPhase2TargetX *= retinazerPhase2TargetDist; + retinazerPhase2TargetY *= retinazerPhase2TargetDist; + retinazerPhase2Pos.X += retinazerPhase2TargetX * 15f; + retinazerPhase2Pos.Y += retinazerPhase2TargetY * 15f; + int retinazerPhase2Laser = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2Pos.X, retinazerPhase2Pos.Y, retinazerPhase2TargetX, retinazerPhase2TargetY, 100, attackDamage_ForProjectiles5, 0f, Main.myPlayer); } } npc.ai[2] += 1f; @@ -369,56 +366,56 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool enrage = lifeRatio < 0.25f; // I'm not commenting this entire fucking thing, already did spaz, I'm not doing ret - float num376 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); - float num377 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + float retinazerHoverXDest = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float retinazerHoverYDest = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); - float num378 = (float)Math.Atan2(num377, num376) + MathHelper.PiOver2; - if (num378 < 0f) - num378 += MathHelper.TwoPi; - else if (num378 > MathHelper.TwoPi) - num378 -= MathHelper.TwoPi; + float retinazerHoverRotation = (float)Math.Atan2(retinazerHoverYDest, retinazerHoverXDest) + MathHelper.PiOver2; + if (retinazerHoverRotation < 0f) + retinazerHoverRotation += MathHelper.TwoPi; + else if (retinazerHoverRotation > MathHelper.TwoPi) + retinazerHoverRotation -= MathHelper.TwoPi; - float num379 = 0.1f; - if (npc.rotation < num378) + float retinazerRotationSpeed = 0.1f; + if (npc.rotation < retinazerHoverRotation) { - if ((num378 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num379; + if ((retinazerHoverRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= retinazerRotationSpeed; else - npc.rotation += num379; + npc.rotation += retinazerRotationSpeed; } - else if (npc.rotation > num378) + else if (npc.rotation > retinazerHoverRotation) { - if ((npc.rotation - num378) > MathHelper.Pi) - npc.rotation += num379; + if ((npc.rotation - retinazerHoverRotation) > MathHelper.Pi) + npc.rotation += retinazerRotationSpeed; else - npc.rotation -= num379; + npc.rotation -= retinazerRotationSpeed; } - if (npc.rotation > num378 - num379 && npc.rotation < num378 + num379) - npc.rotation = num378; + if (npc.rotation > retinazerHoverRotation - retinazerRotationSpeed && npc.rotation < retinazerHoverRotation + retinazerRotationSpeed) + npc.rotation = retinazerHoverRotation; if (npc.rotation < 0f) npc.rotation += MathHelper.TwoPi; else if (npc.rotation > MathHelper.TwoPi) npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > num378 - num379 && npc.rotation < num378 + num379) - npc.rotation = num378; + if (npc.rotation > retinazerHoverRotation - retinazerRotationSpeed && npc.rotation < retinazerHoverRotation + retinazerRotationSpeed) + npc.rotation = retinazerHoverRotation; if (Main.rand.NextBool(5)) { - int num380 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); - Dust dust = Main.dust[num380]; + int retiDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); + Dust dust = Main.dust[retiDust]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; } if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) { - for (int num381 = 0; num381 < Main.maxNPCs; num381++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (num381 != npc.whoAmI && Main.npc[num381].active && (Main.npc[num381].type == NPCID.Retinazer || Main.npc[num381].type == NPCID.Spazmatism) && Main.npc[num381].timeLeft - 1 > npc.timeLeft) - npc.timeLeft = Main.npc[num381].timeLeft - 1; + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) + npc.timeLeft = Main.npc[i].timeLeft - 1; } } @@ -428,11 +425,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { NPC nPC = Main.npc[NPC.mechQueen]; Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); - Vector2 vector42 = new Vector2(-150f, -250f); - vector42 *= 0.75f; - float num418 = nPC.velocity.X * 0.025f; - mechQueenSpacing = mechQueenCenter + vector42; - mechQueenSpacing = mechQueenSpacing.RotatedBy(num418, mechQueenCenter); + Vector2 eyePosition = new Vector2(-150f, -250f); + eyePosition *= 0.75f; + float mechdusaRotation = nPC.velocity.X * 0.025f; + mechQueenSpacing = mechQueenCenter + eyePosition; + mechQueenSpacing = mechQueenSpacing.RotatedBy(mechdusaRotation, mechQueenCenter); } npc.reflectsProjectiles = false; @@ -451,85 +448,84 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.ai[1] == 0f) { - float num382 = 8.25f; - float num383 = 0.115f; - num382 += 4f * enrageScale; - num383 += 0.05f * enrageScale; + float retinazerPhase1MaxSpeed = 8.25f; + float retinazerPhase1Acceleration = 0.115f; + retinazerPhase1MaxSpeed += 4f * enrageScale; + retinazerPhase1Acceleration += 0.05f * enrageScale; if (death) { - num382 += 8f * (1f - lifeRatio); - num383 += 0.1f * (1f - lifeRatio); + retinazerPhase1MaxSpeed += 8f * (1f - lifeRatio); + retinazerPhase1Acceleration += 0.1f * (1f - lifeRatio); } if (Main.getGoodWorld) { - num382 *= 1.15f; - num383 *= 1.15f; + retinazerPhase1MaxSpeed *= 1.15f; + retinazerPhase1Acceleration *= 1.15f; } - int num384 = 1; + int retinazerFaceDirection = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - num384 = -1; + retinazerFaceDirection = -1; - Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num385 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num384 * 300) - vector40.X; - float num386 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector40.Y; + Vector2 retinazerPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float retinazerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (retinazerFaceDirection * 300) - retinazerPosition.X; + float retinazerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - retinazerPosition.Y; if (NPC.IsMechQueenUp) { - num382 = 14f; - num385 = mechQueenSpacing.X; - num386 = mechQueenSpacing.Y; - num385 -= vector40.X; - num386 -= vector40.Y; + retinazerPhase1MaxSpeed = 14f; + retinazerTargetX = mechQueenSpacing.X; + retinazerTargetY = mechQueenSpacing.Y; + retinazerTargetX -= retinazerPosition.X; + retinazerTargetY -= retinazerPosition.Y; } - float num387 = (float)Math.Sqrt(num385 * num385 + num386 * num386); - float num388 = num387; + float retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); + float retinazerTargetDistCopy = retinazerTargetDist; if (NPC.IsMechQueenUp) { - if (num387 > num382) + if (retinazerTargetDist > retinazerPhase1MaxSpeed) { - num387 = num382 / num387; - num385 *= num387; - num386 *= num387; + retinazerTargetDist = retinazerPhase1MaxSpeed / retinazerTargetDist; + retinazerTargetX *= retinazerTargetDist; + retinazerTargetY *= retinazerTargetDist; } - float num426 = 60f; - npc.velocity.X = (npc.velocity.X * (num426 - 1f) + num385) / num426; - npc.velocity.Y = (npc.velocity.Y * (num426 - 1f) + num386) / num426; + npc.velocity.X = (npc.velocity.X * 59f + retinazerTargetX) / 60f; + npc.velocity.Y = (npc.velocity.Y * 59f + retinazerTargetY) / 60f; } else { - num387 = num382 / num387; - num385 *= num387; - num386 *= num387; + retinazerTargetDist = retinazerPhase1MaxSpeed / retinazerTargetDist; + retinazerTargetX *= retinazerTargetDist; + retinazerTargetY *= retinazerTargetDist; - if (npc.velocity.X < num385) + if (npc.velocity.X < retinazerTargetX) { - npc.velocity.X += num383; - if (npc.velocity.X < 0f && num385 > 0f) - npc.velocity.X += num383; + npc.velocity.X += retinazerPhase1Acceleration; + if (npc.velocity.X < 0f && retinazerTargetX > 0f) + npc.velocity.X += retinazerPhase1Acceleration; } - else if (npc.velocity.X > num385) + else if (npc.velocity.X > retinazerTargetX) { - npc.velocity.X -= num383; - if (npc.velocity.X > 0f && num385 < 0f) - npc.velocity.X -= num383; + npc.velocity.X -= retinazerPhase1Acceleration; + if (npc.velocity.X > 0f && retinazerTargetX < 0f) + npc.velocity.X -= retinazerPhase1Acceleration; } - if (npc.velocity.Y < num386) + if (npc.velocity.Y < retinazerTargetY) { - npc.velocity.Y += num383; - if (npc.velocity.Y < 0f && num386 > 0f) - npc.velocity.Y += num383; + npc.velocity.Y += retinazerPhase1Acceleration; + if (npc.velocity.Y < 0f && retinazerTargetY > 0f) + npc.velocity.Y += retinazerPhase1Acceleration; } - else if (npc.velocity.Y > num386) + else if (npc.velocity.Y > retinazerTargetY) { - npc.velocity.Y -= num383; - if (npc.velocity.Y > 0f && num386 < 0f) - npc.velocity.Y -= num383; + npc.velocity.Y -= retinazerPhase1Acceleration; + if (npc.velocity.Y > 0f && retinazerTargetY < 0f) + npc.velocity.Y -= retinazerPhase1Acceleration; } } @@ -550,7 +546,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - else if (npc.position.Y + npc.height < Main.player[npc.target].position.Y && num388 < 400f) + else if (npc.position.Y + npc.height < Main.player[npc.target].position.Y && retinazerTargetDistCopy < 400f) { if (!Main.player[npc.target].dead) { @@ -562,25 +558,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[3] >= laserGateValue) { npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num385 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector40.X; - num386 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector40.Y; + retinazerPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + retinazerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPosition.X; + retinazerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPosition.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { - float num389 = 10.5f; - num389 += 3f * enrageScale; + float retinazerSpeed = 10.5f; + retinazerSpeed += 3f * enrageScale; int type = ProjectileID.EyeLaser; int damage = npc.GetProjectileDamage(type); - num387 = (float)Math.Sqrt(num385 * num385 + num386 * num386); - num387 = num389 / num387; - num385 *= num387; - num386 *= num387; - vector40.X += num385 * 15f; - vector40.Y += num386 * 15f; + retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); + retinazerTargetDist = retinazerSpeed / retinazerTargetDist; + retinazerTargetX *= retinazerTargetDist; + retinazerTargetY *= retinazerTargetDist; + retinazerPosition.X += retinazerTargetX * 15f; + retinazerPosition.Y += retinazerTargetY * 15f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector40.X, vector40.Y, num385, num386, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPosition.X, retinazerPosition.Y, retinazerTargetX, retinazerTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -588,21 +584,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 1f) { - npc.rotation = num378; - float num393 = 15f; - num393 += 10f * enrageScale; + npc.rotation = retinazerHoverRotation; + float retinazerChargeSpeed = 15f; + retinazerChargeSpeed += 10f * enrageScale; if (death) - num393 += 12f * (1f - lifeRatio); + retinazerChargeSpeed += 12f * (1f - lifeRatio); if (Main.getGoodWorld) - num393 += 2f; + retinazerChargeSpeed += 2f; - Vector2 vector41 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num394 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector41.X; - float num395 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector41.Y; - float num396 = (float)Math.Sqrt(num394 * num394 + num395 * num395); - num396 = num393 / num396; - npc.velocity.X = num394 * num396; - npc.velocity.Y = num395 * num396; + Vector2 retinazerChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float retinazerChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerChargePos.X; + float retinazerChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerChargePos.Y; + float retinazerChargeTargetDist = (float)Math.Sqrt(retinazerChargeTargetX * retinazerChargeTargetX + retinazerChargeTargetY * retinazerChargeTargetY); + retinazerChargeTargetDist = retinazerChargeSpeed / retinazerChargeTargetDist; + npc.velocity.X = retinazerChargeTargetX * retinazerChargeTargetDist; + npc.velocity.Y = retinazerChargeTargetY * retinazerChargeTargetDist; npc.ai[1] = 2f; } else if (npc.ai[1] == 2f) @@ -628,7 +624,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[3] += 1f; npc.ai[2] = 0f; npc.TargetClosest(); - npc.rotation = num378; + npc.rotation = retinazerHoverRotation; if (npc.ai[3] >= 3f) { npc.ai[1] = 0f; @@ -683,7 +679,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.Server) { - for (int num397 = 0; num397 < 2; num397++) + for (int i = 0; i < 2; i++) { Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 143, 1f); Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); @@ -691,7 +687,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - for (int num398 = 0; num398 < 20; num398++) + for (int j = 0; j < 20; j++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); } @@ -731,80 +727,80 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 0f) { - float num399 = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); - float num400 = 0.175f + (death ? 0.05f * (0.7f - lifeRatio) : 0f); - num399 += 4.5f * enrageScale; - num400 += 0.075f * enrageScale; + float retinazerPhase2MaxSpeed = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); + float retinazerPhase2Accel = 0.175f + (death ? 0.05f * (0.7f - lifeRatio) : 0f); + retinazerPhase2MaxSpeed += 4.5f * enrageScale; + retinazerPhase2Accel += 0.075f * enrageScale; if (Main.getGoodWorld) { - num399 *= 1.15f; - num400 *= 1.15f; + retinazerPhase2MaxSpeed *= 1.15f; + retinazerPhase2Accel *= 1.15f; } // Reduce acceleration if target is holding a true melee weapon if (Main.player[npc.target].HoldingTrueMeleeWeapon()) { - num399 *= 0.75f; - num400 *= 0.5f; + retinazerPhase2MaxSpeed *= 0.75f; + retinazerPhase2Accel *= 0.5f; } - Vector2 vector42 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num401 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector42.X; - float num402 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector42.Y; + Vector2 eyePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float retinazerPhase2TargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyePosition.X; + float retinazerPhase2TargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - eyePosition.Y; if (NPC.IsMechQueenUp) { - num399 = 14f; - num401 = mechQueenSpacing.X; - num402 = mechQueenSpacing.Y; - num401 -= vector42.X; - num402 -= vector42.Y; + retinazerPhase2MaxSpeed = 14f; + retinazerPhase2TargetX = mechQueenSpacing.X; + retinazerPhase2TargetY = mechQueenSpacing.Y; + retinazerPhase2TargetX -= eyePosition.X; + retinazerPhase2TargetY -= eyePosition.Y; } - float num403 = (float)Math.Sqrt(num401 * num401 + num402 * num402); + float retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); if (NPC.IsMechQueenUp) { - if (num403 > num399) + if (retinazerPhase2TargetDist > retinazerPhase2MaxSpeed) { - num403 = num399 / num403; - num401 *= num403; - num402 *= num403; + retinazerPhase2TargetDist = retinazerPhase2MaxSpeed / retinazerPhase2TargetDist; + retinazerPhase2TargetX *= retinazerPhase2TargetDist; + retinazerPhase2TargetY *= retinazerPhase2TargetDist; } - npc.velocity.X = (npc.velocity.X * 4f + num401) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + num402) / 5f; + npc.velocity.X = (npc.velocity.X * 4f + retinazerPhase2TargetX) / 5f; + npc.velocity.Y = (npc.velocity.Y * 4f + retinazerPhase2TargetY) / 5f; } else { - num403 = num399 / num403; - num401 *= num403; - num402 *= num403; + retinazerPhase2TargetDist = retinazerPhase2MaxSpeed / retinazerPhase2TargetDist; + retinazerPhase2TargetX *= retinazerPhase2TargetDist; + retinazerPhase2TargetY *= retinazerPhase2TargetDist; - if (npc.velocity.X < num401) + if (npc.velocity.X < retinazerPhase2TargetX) { - npc.velocity.X += num400; - if (npc.velocity.X < 0f && num401 > 0f) - npc.velocity.X += num400; + npc.velocity.X += retinazerPhase2Accel; + if (npc.velocity.X < 0f && retinazerPhase2TargetX > 0f) + npc.velocity.X += retinazerPhase2Accel; } - else if (npc.velocity.X > num401) + else if (npc.velocity.X > retinazerPhase2TargetX) { - npc.velocity.X -= num400; - if (npc.velocity.X > 0f && num401 < 0f) - npc.velocity.X -= num400; + npc.velocity.X -= retinazerPhase2Accel; + if (npc.velocity.X > 0f && retinazerPhase2TargetX < 0f) + npc.velocity.X -= retinazerPhase2Accel; } - if (npc.velocity.Y < num402) + if (npc.velocity.Y < retinazerPhase2TargetY) { - npc.velocity.Y += num400; - if (npc.velocity.Y < 0f && num402 > 0f) - npc.velocity.Y += num400; + npc.velocity.Y += retinazerPhase2Accel; + if (npc.velocity.Y < 0f && retinazerPhase2TargetY > 0f) + npc.velocity.Y += retinazerPhase2Accel; } - else if (npc.velocity.Y > num402) + else if (npc.velocity.Y > retinazerPhase2TargetY) { - npc.velocity.Y -= num400; - if (npc.velocity.Y > 0f && num402 < 0f) - npc.velocity.Y -= num400; + npc.velocity.Y -= retinazerPhase2Accel; + if (npc.velocity.Y > 0f && retinazerPhase2TargetY < 0f) + npc.velocity.Y -= retinazerPhase2Accel; } } @@ -819,10 +815,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - vector42 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num401 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector42.X; - num402 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector42.Y; - npc.rotation = (float)Math.Atan2(num402, num401) - MathHelper.PiOver2; + eyePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + retinazerPhase2TargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyePosition.X; + retinazerPhase2TargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - eyePosition.Y; + npc.rotation = (float)Math.Atan2(retinazerPhase2TargetY, retinazerPhase2TargetX) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -833,23 +829,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (canHit || !spazAlive || enrage) { npc.localAI[1] = 0f; - float num404 = 10f; - num404 += enrageScale; + float retinazerPhase2LaserSpeed = 10f; + retinazerPhase2LaserSpeed += enrageScale; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); - num403 = (float)Math.Sqrt(num401 * num401 + num402 * num402); - num403 = num404 / num403; - num401 *= num403; - num402 *= num403; - vector42.X += num401 * 15f; - vector42.Y += num402 * 15f; + retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); + retinazerPhase2TargetDist = retinazerPhase2LaserSpeed / retinazerPhase2TargetDist; + retinazerPhase2TargetX *= retinazerPhase2TargetDist; + retinazerPhase2TargetY *= retinazerPhase2TargetDist; + eyePosition.X += retinazerPhase2TargetX * 15f; + eyePosition.Y += retinazerPhase2TargetY * 15f; if (canHit) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector42.X, vector42.Y, num401, num402, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition.X, eyePosition.Y, retinazerPhase2TargetX, retinazerPhase2TargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); else { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), vector42.X, vector42.Y, num401, num402, type, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition.X, eyePosition.Y, retinazerPhase2TargetX, retinazerPhase2TargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft = 300; } @@ -861,65 +857,65 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.ai[1] == 1f) { - int num408 = 1; + int retinazerPhase2FaceDirection = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - num408 = -1; + retinazerPhase2FaceDirection = -1; - float num409 = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); - float num410 = 0.25f + (death ? 0.075f * (0.7f - lifeRatio) : 0f); - num409 += 4.5f * enrageScale; - num410 += 0.15f * enrageScale; + float retinazerPhase2RapidFireMaxSpeed = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); + float retinazerPhase2RapidFireAccel = 0.25f + (death ? 0.075f * (0.7f - lifeRatio) : 0f); + retinazerPhase2RapidFireMaxSpeed += 4.5f * enrageScale; + retinazerPhase2RapidFireAccel += 0.15f * enrageScale; if (Main.getGoodWorld) { - num409 *= 1.15f; - num410 *= 1.15f; + retinazerPhase2RapidFireMaxSpeed *= 1.15f; + retinazerPhase2RapidFireAccel *= 1.15f; } // Reduce acceleration if target is holding a true melee weapon if (Main.player[npc.target].HoldingTrueMeleeWeapon()) { - num409 *= 0.75f; - num410 *= 0.5f; + retinazerPhase2RapidFireMaxSpeed *= 0.75f; + retinazerPhase2RapidFireAccel *= 0.5f; } - Vector2 vector43 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num411 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num408 * 340) - vector43.X; - float num412 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector43.Y; - float num413 = (float)Math.Sqrt(num411 * num411 + num412 * num412); - num413 = num409 / num413; - num411 *= num413; - num412 *= num413; + Vector2 retinazerPhase2RapidFirePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float retinazerPhase2RapidFireTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (retinazerPhase2FaceDirection * 340) - retinazerPhase2RapidFirePos.X; + float retinazerPhase2RapidFireTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase2RapidFirePos.Y; + float retinazerPhase2RapidFireTargetDist = (float)Math.Sqrt(retinazerPhase2RapidFireTargetX * retinazerPhase2RapidFireTargetX + retinazerPhase2RapidFireTargetY * retinazerPhase2RapidFireTargetY); + retinazerPhase2RapidFireTargetDist = retinazerPhase2RapidFireMaxSpeed / retinazerPhase2RapidFireTargetDist; + retinazerPhase2RapidFireTargetX *= retinazerPhase2RapidFireTargetDist; + retinazerPhase2RapidFireTargetY *= retinazerPhase2RapidFireTargetDist; - if (npc.velocity.X < num411) + if (npc.velocity.X < retinazerPhase2RapidFireTargetX) { - npc.velocity.X += num410; - if (npc.velocity.X < 0f && num411 > 0f) - npc.velocity.X += num410; + npc.velocity.X += retinazerPhase2RapidFireAccel; + if (npc.velocity.X < 0f && retinazerPhase2RapidFireTargetX > 0f) + npc.velocity.X += retinazerPhase2RapidFireAccel; } - else if (npc.velocity.X > num411) + else if (npc.velocity.X > retinazerPhase2RapidFireTargetX) { - npc.velocity.X -= num410; - if (npc.velocity.X > 0f && num411 < 0f) - npc.velocity.X -= num410; + npc.velocity.X -= retinazerPhase2RapidFireAccel; + if (npc.velocity.X > 0f && retinazerPhase2RapidFireTargetX < 0f) + npc.velocity.X -= retinazerPhase2RapidFireAccel; } - if (npc.velocity.Y < num412) + if (npc.velocity.Y < retinazerPhase2RapidFireTargetY) { - npc.velocity.Y += num410; - if (npc.velocity.Y < 0f && num412 > 0f) - npc.velocity.Y += num410; + npc.velocity.Y += retinazerPhase2RapidFireAccel; + if (npc.velocity.Y < 0f && retinazerPhase2RapidFireTargetY > 0f) + npc.velocity.Y += retinazerPhase2RapidFireAccel; } - else if (npc.velocity.Y > num412) + else if (npc.velocity.Y > retinazerPhase2RapidFireTargetY) { - npc.velocity.Y -= num410; - if (npc.velocity.Y > 0f && num412 < 0f) - npc.velocity.Y -= num410; + npc.velocity.Y -= retinazerPhase2RapidFireAccel; + if (npc.velocity.Y > 0f && retinazerPhase2RapidFireTargetY < 0f) + npc.velocity.Y -= retinazerPhase2RapidFireAccel; } - vector43 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num411 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector43.X; - num412 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector43.Y; - npc.rotation = (float)Math.Atan2(num412, num411) - MathHelper.PiOver2; + retinazerPhase2RapidFirePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + retinazerPhase2RapidFireTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPhase2RapidFirePos.X; + retinazerPhase2RapidFireTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase2RapidFirePos.Y; + npc.rotation = (float)Math.Atan2(retinazerPhase2RapidFireTargetY, retinazerPhase2RapidFireTargetX) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -930,22 +926,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (canHit || !spazAlive || enrage) { npc.localAI[1] = 0f; - float num414 = 9f; int type = ProjectileID.DeathLaser; int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); - num413 = (float)Math.Sqrt(num411 * num411 + num412 * num412); - num413 = num414 / num413; - num411 *= num413; - num412 *= num413; - vector43.X += num411 * 15f; - vector43.Y += num412 * 15f; + retinazerPhase2RapidFireTargetDist = (float)Math.Sqrt(retinazerPhase2RapidFireTargetX * retinazerPhase2RapidFireTargetX + retinazerPhase2RapidFireTargetY * retinazerPhase2RapidFireTargetY); + retinazerPhase2RapidFireTargetDist = 9f / retinazerPhase2RapidFireTargetDist; + retinazerPhase2RapidFireTargetX *= retinazerPhase2RapidFireTargetDist; + retinazerPhase2RapidFireTargetY *= retinazerPhase2RapidFireTargetDist; + retinazerPhase2RapidFirePos.X += retinazerPhase2RapidFireTargetX * 15f; + retinazerPhase2RapidFirePos.Y += retinazerPhase2RapidFireTargetY * 15f; if (canHit) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector43.X, vector43.Y, num411, num412, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos.X, retinazerPhase2RapidFirePos.Y, retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); else { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), vector43.X, vector43.Y, num411, num412, type, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos.X, retinazerPhase2RapidFirePos.Y, retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft = 300; } @@ -968,23 +963,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 2f) { // Set rotation and velocity - npc.rotation = num378; - float num450 = 22f + (death ? 8f * (0.7f - lifeRatio) : 0f); - num450 += 10f * enrageScale; + npc.rotation = retinazerHoverRotation; + float retinazerPhase3ChargeSpeed = 22f + (death ? 8f * (0.7f - lifeRatio) : 0f); + retinazerPhase3ChargeSpeed += 10f * enrageScale; if (!spazAlive) - num450 += 2f; + retinazerPhase3ChargeSpeed += 2f; if (Main.getGoodWorld) - num450 += 2f; + retinazerPhase3ChargeSpeed += 2f; - Vector2 vector47 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num451 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector47.X; - float num452 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector47.Y; - float num453 = (float)Math.Sqrt(num451 * num451 + num452 * num452); - num453 = num450 / num453; - npc.velocity.X = num451 * num453; - npc.velocity.Y = num452 * num453; + Vector2 retinazerPhase3ChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float retinazerPhase3ChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPhase3ChargePos.X; + float retinazerPhase3ChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase3ChargePos.Y; + float retinazerPhase3ChargeTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeTargetX * retinazerPhase3ChargeTargetX + retinazerPhase3ChargeTargetY * retinazerPhase3ChargeTargetY); + retinazerPhase3ChargeTargetDist = retinazerPhase3ChargeSpeed / retinazerPhase3ChargeTargetDist; + npc.velocity.X = retinazerPhase3ChargeTargetX * retinazerPhase3ChargeTargetDist; + npc.velocity.Y = retinazerPhase3ChargeTargetY * retinazerPhase3ChargeTargetDist; npc.ai[1] = 3f; } @@ -1018,30 +1013,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] % fireRate == 0f) { - Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); + Vector2 retinazerPhase3ChargeLaserPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float retinazerPhase3ChargeLaserTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPhase3ChargeLaserPos.X; + float retinazerPhase3ChargeLaserTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase3ChargeLaserPos.Y; + float retinazerPhase3ChargeLaserTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeLaserTargetX * retinazerPhase3ChargeLaserTargetX + retinazerPhase3ChargeLaserTargetY * retinazerPhase3ChargeLaserTargetY); if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(SoundID.Item33, npc.position); - - float num353 = 6f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num349 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector34.X; - num350 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); - num351 = num353 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349; - vector34.Y += num350; + retinazerPhase3ChargeLaserPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + retinazerPhase3ChargeLaserTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - retinazerPhase3ChargeLaserPos.X; + retinazerPhase3ChargeLaserTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - retinazerPhase3ChargeLaserPos.Y; + retinazerPhase3ChargeLaserTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeLaserTargetX * retinazerPhase3ChargeLaserTargetX + retinazerPhase3ChargeLaserTargetY * retinazerPhase3ChargeLaserTargetY); + retinazerPhase3ChargeLaserTargetDist = 6f / retinazerPhase3ChargeLaserTargetDist; + retinazerPhase3ChargeLaserTargetX *= retinazerPhase3ChargeLaserTargetDist; + retinazerPhase3ChargeLaserTargetY *= retinazerPhase3ChargeLaserTargetDist; + retinazerPhase3ChargeLaserPos.X += retinazerPhase3ChargeLaserTargetX; + retinazerPhase3ChargeLaserPos.Y += retinazerPhase3ChargeLaserTargetY; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector34.X, vector34.Y, num349, num350, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase3ChargeLaserPos.X, retinazerPhase3ChargeLaserPos.Y, retinazerPhase3ChargeLaserTargetX, retinazerPhase3ChargeLaserTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -1055,7 +1048,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 0f; npc.ai[3] += 1f; npc.TargetClosest(); - npc.rotation = num378; + npc.rotation = retinazerHoverRotation; float maxChargeAmt = spazAlive ? 2f : 4f; if (npc.ai[3] >= maxChargeAmt) { @@ -1070,58 +1063,58 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Get in position for charge else if (npc.ai[1] == 4f) { - int num62 = spazAlive ? 600 : 500; - float num63 = 12f + (death ? 4f * (0.7f - lifeRatio) : 0f); - float num64 = 0.3f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); + int chargeLineUpDist = spazAlive ? 600 : 500; + float chargeSpeed = 12f + (death ? 4f * (0.7f - lifeRatio) : 0f); + float chargeAccel = 0.3f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); if (spazAlive) { - num63 *= 0.75f; - num64 *= 0.75f; + chargeSpeed *= 0.75f; + chargeAccel *= 0.75f; } if (Main.getGoodWorld) { - num63 *= 1.15f; - num64 *= 1.15f; + chargeSpeed *= 1.15f; + chargeAccel *= 1.15f; } - int num408 = 1; + int retinazerPhase2FaceDirection = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - num408 = -1; + retinazerPhase2FaceDirection = -1; - Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num62 * num408) - vector11.X; - float num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector11.Y; - float num67 = (float)Math.Sqrt(num65 * num65 + num66 * num66); + Vector2 spazmatismRetDeadChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float chargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (chargeLineUpDist * retinazerPhase2FaceDirection) - spazmatismRetDeadChargePos.X; + float chargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismRetDeadChargePos.Y; + float chargeTargetDist = (float)Math.Sqrt(chargeTargetX * chargeTargetX + chargeTargetY * chargeTargetY); - num67 = num63 / num67; - num65 *= num67; - num66 *= num67; + chargeTargetDist = chargeSpeed / chargeTargetDist; + chargeTargetX *= chargeTargetDist; + chargeTargetY *= chargeTargetDist; - if (npc.velocity.X < num65) + if (npc.velocity.X < chargeTargetX) { - npc.velocity.X += num64; - if (npc.velocity.X < 0f && num65 > 0f) - npc.velocity.X += num64; + npc.velocity.X += chargeAccel; + if (npc.velocity.X < 0f && chargeTargetX > 0f) + npc.velocity.X += chargeAccel; } - else if (npc.velocity.X > num65) + else if (npc.velocity.X > chargeTargetX) { - npc.velocity.X -= num64; - if (npc.velocity.X > 0f && num65 < 0f) - npc.velocity.X -= num64; + npc.velocity.X -= chargeAccel; + if (npc.velocity.X > 0f && chargeTargetX < 0f) + npc.velocity.X -= chargeAccel; } - if (npc.velocity.Y < num66) + if (npc.velocity.Y < chargeTargetY) { - npc.velocity.Y += num64; - if (npc.velocity.Y < 0f && num66 > 0f) - npc.velocity.Y += num64; + npc.velocity.Y += chargeAccel; + if (npc.velocity.Y < 0f && chargeTargetY > 0f) + npc.velocity.Y += chargeAccel; } - else if (npc.velocity.Y > num66) + else if (npc.velocity.Y > chargeTargetY) { - npc.velocity.Y -= num64; - if (npc.velocity.Y > 0f && num66 < 0f) - npc.velocity.Y -= num64; + npc.velocity.Y -= chargeAccel; + if (npc.velocity.Y > 0f && chargeTargetY < 0f) + npc.velocity.Y -= chargeAccel; } // Take 1.25 or 1 second to get in position, then charge @@ -1195,47 +1188,47 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; } - float num420 = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; - if (num420 < 0f) - num420 += MathHelper.TwoPi; - else if (num420 > MathHelper.TwoPi) - num420 -= MathHelper.TwoPi; + float spazmatismRotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; + if (spazmatismRotation < 0f) + spazmatismRotation += MathHelper.TwoPi; + else if (spazmatismRotation > MathHelper.TwoPi) + spazmatismRotation -= MathHelper.TwoPi; - float num421 = 0.15f; + float spazmatismRotateSpeed = 0.15f; if (NPC.IsMechQueenUp && npc.ai[0] == 3f && npc.ai[1] == 0f) - num421 *= 0.25f; + spazmatismRotateSpeed *= 0.25f; - if (npc.rotation < num420) + if (npc.rotation < spazmatismRotation) { - if ((num420 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num421; + if ((spazmatismRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= spazmatismRotateSpeed; else - npc.rotation += num421; + npc.rotation += spazmatismRotateSpeed; } - else if (npc.rotation > num420) + else if (npc.rotation > spazmatismRotation) { - if ((npc.rotation - num420) > MathHelper.Pi) - npc.rotation += num421; + if ((npc.rotation - spazmatismRotation) > MathHelper.Pi) + npc.rotation += spazmatismRotateSpeed; else - npc.rotation -= num421; + npc.rotation -= spazmatismRotateSpeed; } - if (npc.rotation > num420 - num421 && npc.rotation < num420 + num421) - npc.rotation = num420; + if (npc.rotation > spazmatismRotation - spazmatismRotateSpeed && npc.rotation < spazmatismRotation + spazmatismRotateSpeed) + npc.rotation = spazmatismRotation; if (npc.rotation < 0f) npc.rotation += MathHelper.TwoPi; else if (npc.rotation > MathHelper.TwoPi) npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > num420 - num421 && npc.rotation < num420 + num421) - npc.rotation = num420; + if (npc.rotation > spazmatismRotation - spazmatismRotateSpeed && npc.rotation < spazmatismRotation + spazmatismRotateSpeed) + npc.rotation = spazmatismRotation; // Dust if (Main.rand.NextBool(5)) { - int num422 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); - Dust dust = Main.dust[num422]; + int spazDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); + Dust dust = Main.dust[spazDust]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; } @@ -1243,10 +1236,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Despawn Twins at the same time if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) { - for (int num423 = 0; num423 < Main.maxNPCs; num423++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (num423 != npc.whoAmI && Main.npc[num423].active && (Main.npc[num423].type == NPCID.Retinazer || Main.npc[num423].type == NPCID.Spazmatism) && Main.npc[num423].timeLeft - 1 > npc.timeLeft) - npc.timeLeft = Main.npc[num423].timeLeft - 1; + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) + npc.timeLeft = Main.npc[i].timeLeft - 1; } } @@ -1256,11 +1249,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { NPC nPC2 = Main.npc[NPC.mechQueen]; Vector2 mechQueenCenter2 = nPC2.GetMechQueenCenter(); - Vector2 vector48 = new Vector2(150f, -250f); - vector48 *= 0.75f; - float num462 = nPC2.velocity.X * 0.025f; - mechQueenSpacing = mechQueenCenter2 + vector48; - mechQueenSpacing = mechQueenSpacing.RotatedBy(num462, mechQueenCenter2); + Vector2 mechdusaSpacingVector = new Vector2(150f, -250f); + mechdusaSpacingVector *= 0.75f; + float mechdusaSpacingVel = nPC2.velocity.X * 0.025f; + mechQueenSpacing = mechQueenCenter2 + mechdusaSpacingVector; + mechQueenSpacing = mechQueenSpacing.RotatedBy(mechdusaSpacingVel, mechQueenCenter2); } npc.reflectsProjectiles = false; @@ -1283,82 +1276,82 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 0f) { // Velocity - float num424 = 12f; - float num425 = 0.4f; - num424 += 6f * enrageScale; - num425 += 0.2f * enrageScale; + float spazmatismFireballMaxSpeed = 12f; + float spazmatismFireballAccel = 0.4f; + spazmatismFireballMaxSpeed += 6f * enrageScale; + spazmatismFireballAccel += 0.2f * enrageScale; if (death) { - num424 += 9f * (1f - lifeRatio); - num425 += 0.3f * (1f - lifeRatio); + spazmatismFireballMaxSpeed += 9f * (1f - lifeRatio); + spazmatismFireballAccel += 0.3f * (1f - lifeRatio); } if (Main.getGoodWorld) { - num424 *= 1.15f; - num425 *= 1.15f; + spazmatismFireballMaxSpeed *= 1.15f; + spazmatismFireballAccel *= 1.15f; } - int num426 = 1; + int spazmatismFireballFaceDirection = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - num426 = -1; + spazmatismFireballFaceDirection = -1; - Vector2 vector44 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num427 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num426 * 400) - vector44.X; - float num428 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector44.Y; + Vector2 spazmatismFireballPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float spazmatismFireballTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (spazmatismFireballFaceDirection * 400) - spazmatismFireballPos.X; + float spazmatismFireballTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismFireballPos.Y; if (NPC.IsMechQueenUp) { - num424 = 14f; - num427 = mechQueenSpacing.X; - num428 = mechQueenSpacing.Y; - num427 -= vector44.X; - num428 -= vector44.Y; + spazmatismFireballMaxSpeed = 14f; + spazmatismFireballTargetX = mechQueenSpacing.X; + spazmatismFireballTargetY = mechQueenSpacing.Y; + spazmatismFireballTargetX -= spazmatismFireballPos.X; + spazmatismFireballTargetY -= spazmatismFireballPos.Y; } - float num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); + float spazmatismFireballTargetDist = (float)Math.Sqrt(spazmatismFireballTargetX * spazmatismFireballTargetX + spazmatismFireballTargetY * spazmatismFireballTargetY); if (NPC.IsMechQueenUp) { - if (num429 > num424) + if (spazmatismFireballTargetDist > spazmatismFireballMaxSpeed) { - num429 = num424 / num429; - num427 *= num429; - num428 *= num429; + spazmatismFireballTargetDist = spazmatismFireballMaxSpeed / spazmatismFireballTargetDist; + spazmatismFireballTargetX *= spazmatismFireballTargetDist; + spazmatismFireballTargetY *= spazmatismFireballTargetDist; } - npc.velocity.X = (npc.velocity.X * 4f + num427) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + num428) / 5f; + npc.velocity.X = (npc.velocity.X * 4f + spazmatismFireballTargetX) / 5f; + npc.velocity.Y = (npc.velocity.Y * 4f + spazmatismFireballTargetY) / 5f; } else { - num429 = num424 / num429; - num427 *= num429; - num428 *= num429; + spazmatismFireballTargetDist = spazmatismFireballMaxSpeed / spazmatismFireballTargetDist; + spazmatismFireballTargetX *= spazmatismFireballTargetDist; + spazmatismFireballTargetY *= spazmatismFireballTargetDist; - if (npc.velocity.X < num427) + if (npc.velocity.X < spazmatismFireballTargetX) { - npc.velocity.X += num425; - if (npc.velocity.X < 0f && num427 > 0f) - npc.velocity.X += num425; + npc.velocity.X += spazmatismFireballAccel; + if (npc.velocity.X < 0f && spazmatismFireballTargetX > 0f) + npc.velocity.X += spazmatismFireballAccel; } - else if (npc.velocity.X > num427) + else if (npc.velocity.X > spazmatismFireballTargetX) { - npc.velocity.X -= num425; - if (npc.velocity.X > 0f && num427 < 0f) - npc.velocity.X -= num425; + npc.velocity.X -= spazmatismFireballAccel; + if (npc.velocity.X > 0f && spazmatismFireballTargetX < 0f) + npc.velocity.X -= spazmatismFireballAccel; } - if (npc.velocity.Y < num428) + if (npc.velocity.Y < spazmatismFireballTargetY) { - npc.velocity.Y += num425; - if (npc.velocity.Y < 0f && num428 > 0f) - npc.velocity.Y += num425; + npc.velocity.Y += spazmatismFireballAccel; + if (npc.velocity.Y < 0f && spazmatismFireballTargetY > 0f) + npc.velocity.Y += spazmatismFireballAccel; } - else if (npc.velocity.Y > num428) + else if (npc.velocity.Y > spazmatismFireballTargetY) { - npc.velocity.Y -= num425; - if (npc.velocity.Y > 0f && num428 < 0f) - npc.velocity.Y -= num425; + npc.velocity.Y -= spazmatismFireballAccel; + if (npc.velocity.Y > 0f && spazmatismFireballTargetY < 0f) + npc.velocity.Y -= spazmatismFireballAccel; } } @@ -1387,26 +1380,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[3] >= 30f) { npc.ai[3] = 0f; - vector44 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num427 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector44.X; - num428 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector44.Y; + spazmatismFireballPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + spazmatismFireballTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismFireballPos.X; + spazmatismFireballTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismFireballPos.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { - float num430 = 15f; - num430 += 3f * enrageScale; + float cursedFireballSpeed = 15f; + cursedFireballSpeed += 3f * enrageScale; int type = ProjectileID.CursedFlameHostile; int damage = npc.GetProjectileDamage(type); - num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); - num429 = num430 / num429; - num427 *= num429; - num428 *= num429; - num427 += Main.rand.Next(-10, 11) * 0.05f; - num428 += Main.rand.Next(-10, 11) * 0.05f; - vector44.X += num427 * 4f; - vector44.Y += num428 * 4f; + spazmatismFireballTargetDist = (float)Math.Sqrt(spazmatismFireballTargetX * spazmatismFireballTargetX + spazmatismFireballTargetY * spazmatismFireballTargetY); + spazmatismFireballTargetDist = cursedFireballSpeed / spazmatismFireballTargetDist; + spazmatismFireballTargetX *= spazmatismFireballTargetDist; + spazmatismFireballTargetY *= spazmatismFireballTargetDist; + spazmatismFireballTargetX += Main.rand.Next(-10, 11) * 0.05f; + spazmatismFireballTargetY += Main.rand.Next(-10, 11) * 0.05f; + spazmatismFireballPos.X += spazmatismFireballTargetX * 4f; + spazmatismFireballPos.Y += spazmatismFireballTargetY * 4f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector44.X, vector44.Y, num427, num428, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFireballPos.X, spazmatismFireballPos.Y, spazmatismFireballTargetX, spazmatismFireballTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -1416,21 +1409,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 1f) { // Rotation and velocity - npc.rotation = num420; - float num434 = 16f; - num434 += 8f * enrageScale; + npc.rotation = spazmatismRotation; + float spazmatismPhase1ChargeSpeed = 16f; + spazmatismPhase1ChargeSpeed += 8f * enrageScale; if (death) - num434 += 12f * (1f - lifeRatio); + spazmatismPhase1ChargeSpeed += 12f * (1f - lifeRatio); if (Main.getGoodWorld) - num434 *= 1.2f; + spazmatismPhase1ChargeSpeed *= 1.2f; - Vector2 vector45 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num435 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector45.X; - float num436 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector45.Y; - float num437 = (float)Math.Sqrt(num435 * num435 + num436 * num436); - num437 = num434 / num437; - npc.velocity.X = num435 * num437; - npc.velocity.Y = num436 * num437; + Vector2 spazmatismPhase1ChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float spazmatismPhase1ChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismPhase1ChargePos.X; + float spazmatismPhase1ChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismPhase1ChargePos.Y; + float spazmatismPhase1ChargeTargetDist = (float)Math.Sqrt(spazmatismPhase1ChargeTargetX * spazmatismPhase1ChargeTargetX + spazmatismPhase1ChargeTargetY * spazmatismPhase1ChargeTargetY); + spazmatismPhase1ChargeTargetDist = spazmatismPhase1ChargeSpeed / spazmatismPhase1ChargeTargetDist; + npc.velocity.X = spazmatismPhase1ChargeTargetX * spazmatismPhase1ChargeTargetDist; + npc.velocity.Y = spazmatismPhase1ChargeTargetY * spazmatismPhase1ChargeTargetDist; npc.ai[1] = 2f; } else if (npc.ai[1] == 2f) @@ -1459,7 +1452,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[3] += 1f; npc.ai[2] = 0f; npc.TargetClosest(); - npc.rotation = num420; + npc.rotation = spazmatismRotation; float totalCharges = 8f; if (death) totalCharges -= (float)Math.Round(16f * (1f - lifeRatio)); @@ -1523,7 +1516,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.Server) { - for (int num438 = 0; num438 < 2; num438++) + for (int i = 0; i < 2; i++) { Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 144, 1f); Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); @@ -1531,7 +1524,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - for (int num439 = 0; num439 < 20; num439++) + for (int j = 0; j < 20; j++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); } @@ -1576,61 +1569,61 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Shadowflamethrower phase if (npc.ai[1] == 0f) { - float num440 = 6.2f + (death ? 2f * (0.7f - lifeRatio) : 0f); - float num441 = 0.1f + (death ? 0.03f * (0.7f - lifeRatio) : 0f); - num440 += 4f * enrageScale; - num441 += 0.06f * enrageScale; + float spazmatismFlamethrowerMaxSpeed = 6.2f + (death ? 2f * (0.7f - lifeRatio) : 0f); + float spazmatismFlamethrowerAccel = 0.1f + (death ? 0.03f * (0.7f - lifeRatio) : 0f); + spazmatismFlamethrowerMaxSpeed += 4f * enrageScale; + spazmatismFlamethrowerAccel += 0.06f * enrageScale; - int num442 = 1; + int spazmatismFlamethrowerFaceDirection = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - num442 = -1; + spazmatismFlamethrowerFaceDirection = -1; - Vector2 vector46 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num443 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num442 * 180) - vector46.X; - float num444 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector46.Y; - float num445 = (float)Math.Sqrt(num443 * num443 + num444 * num444); + Vector2 spazmatismFlamethrowerPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float spazmatismFlamethrowerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (spazmatismFlamethrowerFaceDirection * 180) - spazmatismFlamethrowerPos.X; + float spazmatismFlamethrowerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismFlamethrowerPos.Y; + float spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); if (!NPC.IsMechQueenUp) { // Boost speed if too far from target - if (num445 > 300f) - num440 += 0.5f; - if (num445 > 400f) - num440 += 0.5f; + if (spazmatismFlamethrowerTargetDist > 300f) + spazmatismFlamethrowerMaxSpeed += 0.5f; + if (spazmatismFlamethrowerTargetDist > 400f) + spazmatismFlamethrowerMaxSpeed += 0.5f; if (Main.getGoodWorld) { - num440 *= 1.15f; - num441 *= 1.15f; + spazmatismFlamethrowerMaxSpeed *= 1.15f; + spazmatismFlamethrowerAccel *= 1.15f; } - num445 = num440 / num445; - num443 *= num445; - num444 *= num445; + spazmatismFlamethrowerTargetDist = spazmatismFlamethrowerMaxSpeed / spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetX *= spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetY *= spazmatismFlamethrowerTargetDist; - if (npc.velocity.X < num443) + if (npc.velocity.X < spazmatismFlamethrowerTargetX) { - npc.velocity.X += num441; - if (npc.velocity.X < 0f && num443 > 0f) - npc.velocity.X += num441; + npc.velocity.X += spazmatismFlamethrowerAccel; + if (npc.velocity.X < 0f && spazmatismFlamethrowerTargetX > 0f) + npc.velocity.X += spazmatismFlamethrowerAccel; } - else if (npc.velocity.X > num443) + else if (npc.velocity.X > spazmatismFlamethrowerTargetX) { - npc.velocity.X -= num441; - if (npc.velocity.X > 0f && num443 < 0f) - npc.velocity.X -= num441; + npc.velocity.X -= spazmatismFlamethrowerAccel; + if (npc.velocity.X > 0f && spazmatismFlamethrowerTargetX < 0f) + npc.velocity.X -= spazmatismFlamethrowerAccel; } - if (npc.velocity.Y < num444) + if (npc.velocity.Y < spazmatismFlamethrowerTargetY) { - npc.velocity.Y += num441; - if (npc.velocity.Y < 0f && num444 > 0f) - npc.velocity.Y += num441; + npc.velocity.Y += spazmatismFlamethrowerAccel; + if (npc.velocity.Y < 0f && spazmatismFlamethrowerTargetY > 0f) + npc.velocity.Y += spazmatismFlamethrowerAccel; } - else if (npc.velocity.Y > num444) + else if (npc.velocity.Y > spazmatismFlamethrowerTargetY) { - npc.velocity.Y -= num441; - if (npc.velocity.Y > 0f && num444 < 0f) - npc.velocity.Y -= num441; + npc.velocity.Y -= spazmatismFlamethrowerAccel; + if (npc.velocity.Y > 0f && spazmatismFlamethrowerTargetY < 0f) + npc.velocity.Y -= spazmatismFlamethrowerAccel; } } @@ -1665,38 +1658,38 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.localAI[1] = 0f; - float num446 = 6f; - num446 += 2f * enrageScale; + float spazmatismShadowFireballSpeed = 6f; + spazmatismShadowFireballSpeed += 2f * enrageScale; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - vector46 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num443 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector46.X; - num444 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector46.Y; - num445 = (float)Math.Sqrt(num443 * num443 + num444 * num444); - num445 = num446 / num445; - num443 *= num445; - num444 *= num445; - num444 += Main.rand.Next(-10, 11) * 0.01f; - num443 += Main.rand.Next(-10, 11) * 0.01f; - num444 += npc.velocity.Y * 0.5f; - num443 += npc.velocity.X * 0.5f; - vector46.X -= num443 * 1f; - vector46.Y -= num444 * 1f; + spazmatismFlamethrowerPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + spazmatismFlamethrowerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismFlamethrowerPos.X; + spazmatismFlamethrowerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismFlamethrowerPos.Y; + spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); + spazmatismFlamethrowerTargetDist = spazmatismShadowFireballSpeed / spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetX *= spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetY *= spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetY += Main.rand.Next(-10, 11) * 0.01f; + spazmatismFlamethrowerTargetX += Main.rand.Next(-10, 11) * 0.01f; + spazmatismFlamethrowerTargetY += npc.velocity.Y * 0.5f; + spazmatismFlamethrowerTargetX += npc.velocity.X * 0.5f; + spazmatismFlamethrowerPos.X -= spazmatismFlamethrowerTargetX * 1f; + spazmatismFlamethrowerPos.Y -= spazmatismFlamethrowerTargetY * 1f; if (NPC.IsMechQueenUp) { - Vector2 vector52 = (npc.rotation + (float)Math.PI / 2f).ToRotationVector2() * num446 + npc.velocity * 0.5f; - num443 = vector52.X; - num444 = vector52.Y; - vector46 = npc.Center - vector52 * 3f; + Vector2 mechdusaSpazShadowFireballPos = (npc.rotation + (float)Math.PI / 2f).ToRotationVector2() * spazmatismShadowFireballSpeed + npc.velocity * 0.5f; + spazmatismFlamethrowerTargetX = mechdusaSpazShadowFireballPos.X; + spazmatismFlamethrowerTargetY = mechdusaSpazShadowFireballPos.Y; + spazmatismFlamethrowerPos = npc.Center - mechdusaSpazShadowFireballPos * 3f; } if (canHit) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector46.X, vector46.Y, num443, num444, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos.X, spazmatismFlamethrowerPos.Y, spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); else { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), vector46.X, vector46.Y, num443, num444, type, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos.X, spazmatismFlamethrowerPos.Y, spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].tileCollide = false; } } @@ -1705,24 +1698,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (NPC.IsMechQueenUp) { - num440 = 14f; - num443 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector46.X; - num444 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector46.Y; - num443 = mechQueenSpacing.X; - num444 = mechQueenSpacing.Y; - num443 -= vector46.X; - num444 -= vector46.Y; - num445 = (float)Math.Sqrt(num443 * num443 + num444 * num444); - if (num445 > num440) + spazmatismFlamethrowerMaxSpeed = 14f; + spazmatismFlamethrowerTargetX = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - spazmatismFlamethrowerPos.X; + spazmatismFlamethrowerTargetY = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - spazmatismFlamethrowerPos.Y; + spazmatismFlamethrowerTargetX = mechQueenSpacing.X; + spazmatismFlamethrowerTargetY = mechQueenSpacing.Y; + spazmatismFlamethrowerTargetX -= spazmatismFlamethrowerPos.X; + spazmatismFlamethrowerTargetY -= spazmatismFlamethrowerPos.Y; + spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); + if (spazmatismFlamethrowerTargetDist > spazmatismFlamethrowerMaxSpeed) { - num445 = num440 / num445; - num443 *= num445; - num444 *= num445; + spazmatismFlamethrowerTargetDist = spazmatismFlamethrowerMaxSpeed / spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetX *= spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetY *= spazmatismFlamethrowerTargetDist; } - int num490 = 60; - npc.velocity.X = (npc.velocity.X * (float)(num490 - 1) + num443) / (float)num490; - npc.velocity.Y = (npc.velocity.Y * (float)(num490 - 1) + num444) / (float)num490; + npc.velocity.X = (npc.velocity.X * 59f + spazmatismFlamethrowerTargetX) / 60f; + npc.velocity.Y = (npc.velocity.Y * 59f + spazmatismFlamethrowerTargetY) / 60f; } } @@ -1736,14 +1728,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.Roar, npc.position); // Set rotation and velocity - npc.rotation = num420; - float num450 = 16.75f + (death ? 5f * (0.7f - lifeRatio) : 0f); - num450 += 8f * enrageScale; + npc.rotation = spazmatismRotation; + float spazmatismPhase2ChargeSpeed = 16.75f + (death ? 5f * (0.7f - lifeRatio) : 0f); + spazmatismPhase2ChargeSpeed += 8f * enrageScale; if (Main.getGoodWorld) - num450 *= 1.2f; + spazmatismPhase2ChargeSpeed *= 1.2f; Vector2 distanceVector = Main.player[npc.target].Center - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * num450; + npc.velocity = Vector2.Normalize(distanceVector) * spazmatismPhase2ChargeSpeed; npc.ai[1] = 2f; return false; } @@ -1772,7 +1764,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[3] += 1f; npc.ai[2] = 0f; npc.TargetClosest(); - npc.rotation = num420; + npc.rotation = spazmatismRotation; if (npc.ai[3] >= 5f) { npc.ai[1] = 0f; @@ -1808,38 +1800,38 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (Main.netMode != NetmodeID.MultiplayerClient) { // Velocity - float num48 = 20f + (death ? 6f * (0.7f - lifeRatio) : 0f); - num48 += 10f * enrageScale; + float spazmatismPhase3ChargeSpeed = 20f + (death ? 6f * (0.7f - lifeRatio) : 0f); + spazmatismPhase3ChargeSpeed += 10f * enrageScale; if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) - num48 *= 1.3f; + spazmatismPhase3ChargeSpeed *= 1.3f; if (Main.getGoodWorld) - num48 *= 1.2f; + spazmatismPhase3ChargeSpeed *= 1.2f; Vector2 distanceVector = Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * num48; + npc.velocity = Vector2.Normalize(distanceVector) * spazmatismPhase3ChargeSpeed; if (retAlive) { - Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num49 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector10.X; - float num50 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector10.Y; - float num51 = (float)Math.Sqrt(num49 * num49 + num50 * num50); - float num52 = num51; + Vector2 spazmatismPhase3ChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float spazmatismPhase3ChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismPhase3ChargePos.X; + float spazmatismPhase3ChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismPhase3ChargePos.Y; + float spazmatismPhase3ChargeTargetDist = (float)Math.Sqrt(spazmatismPhase3ChargeTargetX * spazmatismPhase3ChargeTargetX + spazmatismPhase3ChargeTargetY * spazmatismPhase3ChargeTargetY); + float spazmatismPhase3ChargeTargetDistCopy = spazmatismPhase3ChargeTargetDist; - if (num52 < 100f) + if (spazmatismPhase3ChargeTargetDistCopy < 100f) { if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) { - float num56 = Math.Abs(npc.velocity.X); - float num57 = Math.Abs(npc.velocity.Y); + float absoluteSpazXVel = Math.Abs(npc.velocity.X); + float absoluteSpazYVel = Math.Abs(npc.velocity.Y); if (npc.Center.X > Main.player[npc.target].Center.X) - num57 *= -1f; + absoluteSpazYVel *= -1f; if (npc.Center.Y > Main.player[npc.target].Center.Y) - num56 *= -1f; + absoluteSpazXVel *= -1f; - npc.velocity.X = num57; - npc.velocity.Y = num56; + npc.velocity.X = absoluteSpazYVel; + npc.velocity.Y = absoluteSpazXVel; } } } @@ -1858,15 +1850,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.Roar, npc.position); - float num60 = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f) - (float)Math.Round(death ? 14f * (0.7f - lifeRatio) : 0f); + float spazmatismRetDeadChargeSpeed = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f) - (float)Math.Round(death ? 14f * (0.7f - lifeRatio) : 0f); npc.ai[2] += 1f; - if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < (retAlive ? 200f : 150f)) + if (npc.ai[2] == spazmatismRetDeadChargeSpeed && Vector2.Distance(npc.position, Main.player[npc.target].position) < (retAlive ? 200f : 150f)) npc.ai[2] -= 1f; // Slow down - if (npc.ai[2] >= num60) + if (npc.ai[2] >= spazmatismRetDeadChargeSpeed) { npc.velocity *= 0.93f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) @@ -1878,8 +1870,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; // Charge 3 times - float num61 = num60 + 25f; - if (npc.ai[2] >= num61) + float spazmatismRetDeadChargeTimer = spazmatismRetDeadChargeSpeed + 25f; + if (npc.ai[2] >= spazmatismRetDeadChargeTimer) { npc.netUpdate = true; @@ -1895,54 +1887,54 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Get in position for charge else if (npc.ai[1] == 5f) { - float num62 = retAlive ? 600f : 500f; - float num63 = 16f + (death ? 5f * (0.7f - lifeRatio) : 0f); - float num64 = 0.4f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); + float chargeLineUpDist = retAlive ? 600f : 500f; + float chargeSpeed = 16f + (death ? 5f * (0.7f - lifeRatio) : 0f); + float chargeAccel = 0.4f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); if (retAlive) { - num63 *= 0.75f; - num64 *= 0.75f; + chargeSpeed *= 0.75f; + chargeAccel *= 0.75f; } if (Main.getGoodWorld) { - num63 *= 1.15f; - num64 *= 1.15f; + chargeSpeed *= 1.15f; + chargeAccel *= 1.15f; } - Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector11.X; - float num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) + num62 - vector11.Y; - float num67 = (float)Math.Sqrt(num65 * num65 + num66 * num66); + Vector2 spazmatismRetDeadChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float chargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismRetDeadChargePos.X; + float chargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) + chargeLineUpDist - spazmatismRetDeadChargePos.Y; + float chargeTargetDist = (float)Math.Sqrt(chargeTargetX * chargeTargetX + chargeTargetY * chargeTargetY); - num67 = num63 / num67; - num65 *= num67; - num66 *= num67; + chargeTargetDist = chargeSpeed / chargeTargetDist; + chargeTargetX *= chargeTargetDist; + chargeTargetY *= chargeTargetDist; - if (npc.velocity.X < num65) + if (npc.velocity.X < chargeTargetX) { - npc.velocity.X += num64; - if (npc.velocity.X < 0f && num65 > 0f) - npc.velocity.X += num64; + npc.velocity.X += chargeAccel; + if (npc.velocity.X < 0f && chargeTargetX > 0f) + npc.velocity.X += chargeAccel; } - else if (npc.velocity.X > num65) + else if (npc.velocity.X > chargeTargetX) { - npc.velocity.X -= num64; - if (npc.velocity.X > 0f && num65 < 0f) - npc.velocity.X -= num64; + npc.velocity.X -= chargeAccel; + if (npc.velocity.X > 0f && chargeTargetX < 0f) + npc.velocity.X -= chargeAccel; } - if (npc.velocity.Y < num66) + if (npc.velocity.Y < chargeTargetY) { - npc.velocity.Y += num64; - if (npc.velocity.Y < 0f && num66 > 0f) - npc.velocity.Y += num64; + npc.velocity.Y += chargeAccel; + if (npc.velocity.Y < 0f && chargeTargetY > 0f) + npc.velocity.Y += chargeAccel; } - else if (npc.velocity.Y > num66) + else if (npc.velocity.Y > chargeTargetY) { - npc.velocity.Y -= num64; - if (npc.velocity.Y > 0f && num66 < 0f) - npc.velocity.Y -= num64; + npc.velocity.Y -= chargeAccel; + if (npc.velocity.Y > 0f && chargeTargetY < 0f) + npc.velocity.Y -= chargeAccel; } npc.ai[2] += 1f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs index 6c2175e31f..8a233d561f 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs @@ -44,28 +44,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (NPC.CountNPCS(NPCID.FireImp) < 4) { - int num351 = 1000; - for (int num352 = 0; num352 < num351; num352++) + for (int i = 0; i < 1000; i++) { - int num353 = (int)(npc.Center.X / 16f); - int num354 = (int)(npc.Center.Y / 16f); + int targetTileX = (int)(npc.Center.X / 16f); + int targetTileY = (int)(npc.Center.Y / 16f); if (npc.target >= 0) { - num353 = (int)(Main.player[npc.target].Center.X / 16f); - num354 = (int)(Main.player[npc.target].Center.Y / 16f); + targetTileX = (int)(Main.player[npc.target].Center.X / 16f); + targetTileY = (int)(Main.player[npc.target].Center.Y / 16f); } - num353 += Main.rand.Next(-50, 51); - for (num354 += Main.rand.Next(-50, 51); num354 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num353, num354); num354++) + targetTileX += Main.rand.Next(-50, 51); + for (targetTileY += Main.rand.Next(-50, 51); targetTileY < Main.maxTilesY - 10 && !WorldGen.SolidTile(targetTileX, targetTileY); targetTileY++) { } - num354--; - if (!WorldGen.SolidTile(num353, num354)) + targetTileY--; + if (!WorldGen.SolidTile(targetTileX, targetTileY)) { - int num355 = NPC.NewNPC(npc.GetSource_FromAI(), num353 * 16 + 8, num354 * 16, 24); - if (Main.netMode == NetmodeID.Server && num355 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num355); + int impSpawn = NPC.NewNPC(npc.GetSource_FromAI(), targetTileX * 16 + 8, targetTileY * 16, 24); + if (Main.netMode == NetmodeID.Server && impSpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, impSpawn); break; } @@ -93,17 +92,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Leech spawn if (npc.ai[2] > 0f && npc.ai[1] > 60f) { - int num330 = phase3 ? 3 : 2; + int leechAmt = phase3 ? 3 : 2; npc.ai[2] += 1f; npc.ai[1] = 0f; - if (npc.ai[2] > num330) + if (npc.ai[2] > leechAmt) npc.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - int num331 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + (npc.height / 2) + 20f), NPCID.LeechHead, 1); - Main.npc[num331].velocity.X = npc.direction * 9; + int leechSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + (npc.height / 2) + 20f), NPCID.LeechHead, 1); + Main.npc[leechSpawn].velocity.X = npc.direction * 9; if (phase2) { @@ -131,79 +130,79 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Main.wofNPCIndex = npc.whoAmI; // Set eye positions - int num332 = (int)(npc.position.X / 16f); - int num333 = (int)((npc.position.X + npc.width) / 16f); - int num334 = (int)((npc.position.Y + (npc.height / 2)) / 16f); - int num335 = 0; - int num336 = num334 + 7; - while (num335 < 15 && num336 > Main.UnderworldLayer) + int currentEyeTileCenterX = (int)(npc.position.X / 16f); + int currentEyeTileWidthX = (int)((npc.position.X + npc.width) / 16f); + int currentEyeTileHeightY = (int)((npc.position.Y + (npc.height / 2)) / 16f); + int eyeMovementTries = 0; + int eyeMovementTileY = currentEyeTileHeightY + 7; + while (eyeMovementTries < 15 && eyeMovementTileY > Main.UnderworldLayer) { - num336++; - for (int num337 = num332; num337 <= num333; num337++) + eyeMovementTileY++; + for (int eyeMovementTileX = currentEyeTileCenterX; eyeMovementTileX <= currentEyeTileWidthX; eyeMovementTileX++) { try { - if (WorldGen.SolidTile(num337, num336) || Main.tile[num337, num336].LiquidAmount > 0) - num335++; + if (WorldGen.SolidTile(eyeMovementTileX, eyeMovementTileY) || Main.tile[eyeMovementTileX, eyeMovementTileY].LiquidAmount > 0) + eyeMovementTries++; } catch - { num335 += 15; } + { eyeMovementTries += 15; } } } - num336 += 4; + eyeMovementTileY += 4; if (Main.wofDrawAreaBottom == -1) - Main.wofDrawAreaBottom = num336 * 16; - else if (Main.wofDrawAreaBottom > num336 * 16) + Main.wofDrawAreaBottom = eyeMovementTileY * 16; + else if (Main.wofDrawAreaBottom > eyeMovementTileY * 16) { Main.wofDrawAreaBottom--; - if (Main.wofDrawAreaBottom < num336 * 16) - Main.wofDrawAreaBottom = num336 * 16; + if (Main.wofDrawAreaBottom < eyeMovementTileY * 16) + Main.wofDrawAreaBottom = eyeMovementTileY * 16; } - else if (Main.wofDrawAreaBottom < num336 * 16) + else if (Main.wofDrawAreaBottom < eyeMovementTileY * 16) { Main.wofDrawAreaBottom++; - if (Main.wofDrawAreaBottom > num336 * 16) - Main.wofDrawAreaBottom = num336 * 16; + if (Main.wofDrawAreaBottom > eyeMovementTileY * 16) + Main.wofDrawAreaBottom = eyeMovementTileY * 16; } - num335 = 0; - num336 = num334 - 7; - while (num335 < 15 && num336 < Main.maxTilesY - 10) + eyeMovementTries = 0; + eyeMovementTileY = currentEyeTileHeightY - 7; + while (eyeMovementTries < 15 && eyeMovementTileY < Main.maxTilesY - 10) { - num336--; - for (int num338 = num332; num338 <= num333; num338++) + eyeMovementTileY--; + for (int i = currentEyeTileCenterX; i <= currentEyeTileWidthX; i++) { try { - if (WorldGen.SolidTile(num338, num336) || Main.tile[num338, num336].LiquidAmount > 0) - num335++; + if (WorldGen.SolidTile(i, eyeMovementTileY) || Main.tile[i, eyeMovementTileY].LiquidAmount > 0) + eyeMovementTries++; } catch - { num335 += 15; } + { eyeMovementTries += 15; } } } - num336 -= 4; + eyeMovementTileY -= 4; if (Main.wofDrawAreaTop == -1) - Main.wofDrawAreaTop = num336 * 16; - else if (Main.wofDrawAreaTop > num336 * 16) + Main.wofDrawAreaTop = eyeMovementTileY * 16; + else if (Main.wofDrawAreaTop > eyeMovementTileY * 16) { Main.wofDrawAreaTop--; - if (Main.wofDrawAreaTop < num336 * 16) - Main.wofDrawAreaTop = num336 * 16; + if (Main.wofDrawAreaTop < eyeMovementTileY * 16) + Main.wofDrawAreaTop = eyeMovementTileY * 16; } - else if (Main.wofDrawAreaTop < num336 * 16) + else if (Main.wofDrawAreaTop < eyeMovementTileY * 16) { Main.wofDrawAreaTop++; - if (Main.wofDrawAreaTop > num336 * 16) - Main.wofDrawAreaTop = num336 * 16; + if (Main.wofDrawAreaTop > eyeMovementTileY * 16) + Main.wofDrawAreaTop = eyeMovementTileY * 16; } // Set Y position - float num339 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - npc.height / 2; - int num340 = (Main.maxTilesY - 180) * 16; - if (num339 < num340) - num339 = num340; - npc.position.Y = num339; + float mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - npc.height / 2; + int worldBottomTileY = (Main.maxTilesY - 180) * 16; + if (mouthYPosition < worldBottomTileY) + mouthYPosition = worldBottomTileY; + npc.position.Y = mouthYPosition; float targetPosition = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); float npcPosition = npc.position.X + (npc.width / 2); @@ -299,23 +298,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); if (Main.player[npc.target].dead) { - float num359 = float.PositiveInfinity; - int direction2 = 0; - for (int num360 = 0; num360 < Main.maxPlayers; num360++) + float wallVelocity = float.PositiveInfinity; + int wallDirection = 0; + for (int i = 0; i < Main.maxPlayers; i++) { Player player = Main.player[npc.target]; if (player.active) { - float num361 = npc.Distance(player.Center); - if (num359 > num361) + float playerDist = npc.Distance(player.Center); + if (wallVelocity > playerDist) { - num359 = num361; - direction2 = (npc.Center.X < player.Center.X) ? 1 : -1; + wallVelocity = playerDist; + wallDirection = (npc.Center.X < player.Center.X) ? 1 : -1; } } } - npc.direction = direction2; + npc.direction = wallDirection; } npc.velocity.X = npc.direction; @@ -356,23 +355,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Direction npc.spriteDirection = npc.direction; - Vector2 vector37 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num342 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector37.X; - float num343 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector37.Y; - float num344 = (float)Math.Sqrt(num342 * num342 + num343 * num343); - num342 *= num344; - num343 *= num344; + Vector2 mouthLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float mouthTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - mouthLocation.X; + float mouthTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - mouthLocation.Y; + float mouthTargetY = (float)Math.Sqrt(mouthTargetX * mouthTargetX + mouthTargetY * mouthTargetY); + mouthTargetX *= mouthTargetY; + mouthTargetY *= mouthTargetY; // Rotation based on direction if (npc.direction > 0) { if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) > npc.position.X + (npc.width / 2)) - npc.rotation = (float)Math.Atan2(-num343, -num342) + MathHelper.Pi; + npc.rotation = (float)Math.Atan2(-mouthTargetY, -mouthTargetX) + MathHelper.Pi; else npc.rotation = 0f; } else if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) < npc.position.X + (npc.width / 2)) - npc.rotation = (float)Math.Atan2(num343, num342) + MathHelper.Pi; + npc.rotation = (float)Math.Atan2(mouthTargetY, mouthTargetX) + MathHelper.Pi; else npc.rotation = 0f; @@ -401,44 +400,44 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.rand.NextBool(chance)) { - int num346 = 0; + int hungryAmt = 0; float[] array = new float[10]; - for (int num347 = 0; num347 < Main.maxNPCs; num347++) + for (int j = 0; j < Main.maxNPCs; j++) { - if (num346 < 10 && Main.npc[num347].active && Main.npc[num347].type == NPCID.TheHungry) + if (hungryAmt < 10 && Main.npc[j].active && Main.npc[j].type == NPCID.TheHungry) { - array[num346] = Main.npc[num347].ai[0]; - num346++; + array[hungryAmt] = Main.npc[j].ai[0]; + hungryAmt++; } } - int maxValue = 1 + num346 * 2; - if (num346 < 10 && Main.rand.Next(maxValue) <= 1) + int maxValue = 1 + hungryAmt * 2; + if (hungryAmt < 10 && Main.rand.Next(maxValue) <= 1) { - int num348 = -1; - for (int num349 = 0; num349 < 1000; num349++) + int spawnHungryControl = -1; + for (int k = 0; k < 1000; k++) { - int num350 = Main.rand.Next(10); - float num351 = num350 * 0.1f - 0.05f; - bool flag29 = true; - for (int num352 = 0; num352 < num346; num352++) + int randomHungrySpawnValue = Main.rand.Next(10); + float hungryArrayValue = randomHungrySpawnValue * 0.1f - 0.05f; + bool shouldRespawnHungry = true; + for (int i = 0; i < hungryAmt; i++) { - if (num351 == array[num352]) + if (hungryArrayValue == array[i]) { - flag29 = false; + shouldRespawnHungry = false; break; } } - if (flag29) + if (shouldRespawnHungry) { - num348 = num350; + spawnHungryControl = randomHungrySpawnValue; break; } } - if (num348 >= 0) + if (spawnHungryControl >= 0) { - int num353 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num339, NPCID.TheHungry, npc.whoAmI); - Main.npc[num353].ai[0] = num348 * 0.1f - 0.05f; + int hungryRespawns = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); + Main.npc[hungryRespawns].ai[0] = spawnHungryControl * 0.1f - 0.05f; } } } @@ -449,25 +448,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.localAI[0] = 2f; - num339 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; - num339 = (num339 + Main.wofDrawAreaTop) / 2f; - int num354 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num339, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num354].ai[0] = 1f; + mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; + mouthYPosition = (mouthYPosition + Main.wofDrawAreaTop) / 2f; + int eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[eyeSpawn].ai[0] = 1f; - num339 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; - num339 = (num339 + Main.wofDrawAreaBottom) / 2f; - num354 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num339, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num354].ai[0] = -1f; + mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; + mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; + eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[eyeSpawn].ai[0] = -1f; - num339 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; - num339 = (num339 + Main.wofDrawAreaBottom) / 2f; + mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; + mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; - int num; - for (int num355 = 0; num355 < 11; num355 = num + 1) + int hungryIncrement; + for (int j = 0; j < 11; j = hungryIncrement + 1) { - num354 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num339, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num354].ai[0] = num355 * 0.1f - 0.05f; - num = num355; + hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[hungrySpawn].ai[0] = j * 0.1f - 0.05f; + hungryIncrement = j; } } @@ -529,35 +528,35 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.position.Y = expectedPosition; } - Vector2 vector38 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num357 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector38.X; - float num358 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector38.Y; - float num359 = (float)Math.Sqrt(num357 * num357 + num358 * num358); - num357 *= num359; - num358 *= num359; + Vector2 eyeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float eyeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyeLocation.X; + float eyeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - eyeLocation.Y; + float wallVelocity = (float)Math.Sqrt(eyeTargetX * eyeTargetX + eyeTargetY * eyeTargetY); + eyeTargetX *= wallVelocity; + eyeTargetY *= wallVelocity; // Rotation based on direction and whether to fire lasers or not - bool flag30 = true; + bool shouldFireLasers = true; if (npc.direction > 0) { if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) > npc.position.X + (npc.width / 2)) { - npc.rotation = (float)Math.Atan2(-num358, -num357) + MathHelper.Pi; + npc.rotation = (float)Math.Atan2(-eyeTargetY, -eyeTargetX) + MathHelper.Pi; } else { npc.rotation = 0f; - flag30 = false; + shouldFireLasers = false; } } else if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) < npc.position.X + (npc.width / 2)) { - npc.rotation = (float)Math.Atan2(num358, num357) + MathHelper.Pi; + npc.rotation = (float)Math.Atan2(eyeTargetY, eyeTargetX) + MathHelper.Pi; } else { npc.rotation = 0f; - flag30 = false; + shouldFireLasers = false; } // Fire lasers @@ -606,7 +605,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[2] >= 4f) npc.localAI[2] = 0f; - if (flag30) + if (shouldFireLasers) { bool phase2 = lifeRatio < 0.5 || bossRush; float velocity = (fireEnragedLasers ? 3f : 4f) + shootBoost; From 2fd049e730261452d28f18e1b127cc4948470260 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 27 Oct 2023 13:11:48 -0400 Subject: [PATCH 25/43] CalamityAI; should be all boss stuff done --- NPCs/CalamityAI.cs | 1374 ++++++++++++++++++++++---------------------- 1 file changed, 685 insertions(+), 689 deletions(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index abbf1c3288..1862ef59e5 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -238,12 +238,12 @@ namespace CalamityMod.NPCs { int maxLength = getFuckedAI ? 24 : death ? 80 : revenge ? 40 : expertMode ? 35 : 30; int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) + for (int segments = 0; segments < maxLength; segments++) { int lol; - if (num36 >= 0 && num36 < maxLength - 1) + if (segments >= 0 && segments < maxLength - 1) { - if (num36 % 2 == 0) + if (segments % 2 == 0) lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); else lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); @@ -408,85 +408,85 @@ namespace CalamityMod.NPCs } // Velocity and movement - float num188 = 5f; - float num189 = 0.08f; - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float scourgeMaxSpeed = 5f; + float scourgeAcceleration = 0.08f; + Vector2 scourgePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[npc.target].velocity * 20f : Vector2.Zero; - float num191 = player.position.X + (player.width / 2) + predictionVector.X; - float num192 = player.position.Y + (player.height / 2) + predictionVector.Y; + float scourgeTargetX = player.position.X + (player.width / 2) + predictionVector.X; + float scourgeTargetY = player.position.Y + (player.height / 2) + predictionVector.Y; if (head && !doSpiral) { if (calamityGlobalNPC.newAI[0] != 1f) { - num192 += 400; + scourgeTargetY += 400; if (Math.Abs(npc.Center.X - player.Center.X) < 500f) { if (npc.velocity.X > 0f) - num191 = player.Center.X + 600f; + scourgeTargetX = player.Center.X + 600f; else - num191 = player.Center.X - 600f; + scourgeTargetX = player.Center.X - 600f; } } if (calamityGlobalNPC.newAI[0] == 1f) { - num188 = revenge ? 14.4f : 12f; - num189 = revenge ? 0.18f : 0.15f; + scourgeMaxSpeed = revenge ? 14.4f : 12f; + scourgeAcceleration = revenge ? 0.18f : 0.15f; if (expertMode) { - num188 += 2.4f * (1f - lifeRatio); - num189 += 0.03f * (1f - lifeRatio); + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeAcceleration += 0.03f * (1f - lifeRatio); } - num188 += 3f * enrageScale; - num189 += 0.06f * enrageScale; + scourgeMaxSpeed += 3f * enrageScale; + scourgeAcceleration += 0.06f * enrageScale; if (death || getFuckedAI) { - num188 += 5f; - num189 -= getFuckedAI ? 0f : 0.03f; - num188 += Vector2.Distance(player.Center, npc.Center) * 0.001f; - num189 += Vector2.Distance(player.Center, npc.Center) * 0.000045f; + scourgeMaxSpeed += 5f; + scourgeAcceleration -= getFuckedAI ? 0f : 0.03f; + scourgeMaxSpeed += Vector2.Distance(player.Center, npc.Center) * 0.001f; + scourgeAcceleration += Vector2.Distance(player.Center, npc.Center) * 0.000045f; } // Increase acceleration after spiral attack if (npc.localAI[3] > 0f) { float accelerationMultiplier = MathHelper.Lerp(1f, 2f, npc.localAI[3] / colorFadeTimeAfterSpiral); - num189 *= accelerationMultiplier; + scourgeAcceleration *= accelerationMultiplier; } if (Main.getGoodWorld) { - num188 *= 1.15f; - num189 *= 1.15f; + scourgeMaxSpeed *= 1.15f; + scourgeAcceleration *= 1.15f; } } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) + float scourgeHigherSpeed = scourgeMaxSpeed * 1.3f; + float scourgeLowerSpeed = scourgeMaxSpeed * 0.7f; + float scourgeSpeed = npc.velocity.Length(); + if (scourgeSpeed > 0f) { - if (num50 > num48) + if (scourgeSpeed > scourgeHigherSpeed) { npc.velocity.Normalize(); - npc.velocity *= num48; + npc.velocity *= scourgeHigherSpeed; } - else if (num50 < num49) + else if (scourgeSpeed < scourgeLowerSpeed) { npc.velocity.Normalize(); - npc.velocity *= num49; + npc.velocity *= scourgeLowerSpeed; } } } - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); if (!head) { @@ -494,27 +494,27 @@ namespace CalamityMod.NPCs { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + scourgePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + scourgeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - scourgePosition.X; + scourgeTargetY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - scourgePosition.Y; } catch { } - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + npc.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; + scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + int scourgeWidth = npc.width; + scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; + scourgeTargetX *= scourgeTargetDist; + scourgeTargetY *= scourgeTargetDist; npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) + npc.position.X = npc.position.X + scourgeTargetX; + npc.position.Y = npc.position.Y + scourgeTargetY; + if (scourgeTargetX < 0f) { npc.spriteDirection = -1; } - else if (num191 > 0f) + else if (scourgeTargetX > 0f) { npc.spriteDirection = 1; } @@ -522,77 +522,77 @@ namespace CalamityMod.NPCs } else if (!doSpiral) { - float num196 = Math.Abs(num191); - float num197 = Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; + float scourgeAbsoluteTargetX = Math.Abs(scourgeTargetX); + float scourgeAbsoluteTargetY = Math.Abs(scourgeTargetY); + float scourgeTimeToReachTarget = scourgeMaxSpeed / scourgeTargetDist; + scourgeTargetX *= scourgeTimeToReachTarget; + scourgeTargetY *= scourgeTimeToReachTarget; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((npc.velocity.X > 0f && scourgeTargetX > 0f) || (npc.velocity.X < 0f && scourgeTargetX < 0f) || (npc.velocity.Y > 0f && scourgeTargetY > 0f) || (npc.velocity.Y < 0f && scourgeTargetY < 0f)) { - if (npc.velocity.X < num191) + if (npc.velocity.X < scourgeTargetX) { - npc.velocity.X += num189; + npc.velocity.X += scourgeAcceleration; } else { - if (npc.velocity.X > num191) - npc.velocity.X -= num189; + if (npc.velocity.X > scourgeTargetX) + npc.velocity.X -= scourgeAcceleration; } - if (npc.velocity.Y < num192) + if (npc.velocity.Y < scourgeTargetY) { - npc.velocity.Y += num189; + npc.velocity.Y += scourgeAcceleration; } else { - if (npc.velocity.Y > num192) - npc.velocity.Y -= num189; + if (npc.velocity.Y > scourgeTargetY) + npc.velocity.Y -= scourgeAcceleration; } - if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(scourgeTargetY) < scourgeMaxSpeed * 0.2 && ((npc.velocity.X > 0f && scourgeTargetX < 0f) || (npc.velocity.X < 0f && scourgeTargetX > 0f))) { if (npc.velocity.Y > 0f) - npc.velocity.Y += num189 * 2f; + npc.velocity.Y += scourgeAcceleration * 2f; else - npc.velocity.Y -= num189 * 2f; + npc.velocity.Y -= scourgeAcceleration * 2f; } - if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(scourgeTargetX) < scourgeMaxSpeed * 0.2 && ((npc.velocity.Y > 0f && scourgeTargetY < 0f) || (npc.velocity.Y < 0f && scourgeTargetY > 0f))) { if (npc.velocity.X > 0f) - npc.velocity.X += num189 * 2f; + npc.velocity.X += scourgeAcceleration * 2f; else - npc.velocity.X -= num189 * 2f; + npc.velocity.X -= scourgeAcceleration * 2f; } } else { - if (num196 > num197) + if (scourgeAbsoluteTargetX > scourgeAbsoluteTargetY) { - if (npc.velocity.X < num191) - npc.velocity.X += num189 * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X -= num189 * 1.1f; + if (npc.velocity.X < scourgeTargetX) + npc.velocity.X += scourgeAcceleration * 1.1f; + else if (npc.velocity.X > scourgeTargetX) + npc.velocity.X -= scourgeAcceleration * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) { if (npc.velocity.Y > 0f) - npc.velocity.Y += num189; + npc.velocity.Y += scourgeAcceleration; else - npc.velocity.Y -= num189; + npc.velocity.Y -= scourgeAcceleration; } } else { - if (npc.velocity.Y < num192) - npc.velocity.Y += num189 * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= num189 * 1.1f; + if (npc.velocity.Y < scourgeTargetY) + npc.velocity.Y += scourgeAcceleration * 1.1f; + else if (npc.velocity.Y > scourgeTargetY) + npc.velocity.Y -= scourgeAcceleration * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) { if (npc.velocity.X > 0f) - npc.velocity.X += num189; + npc.velocity.X += scourgeAcceleration; else - npc.velocity.X -= num189; + npc.velocity.X -= scourgeAcceleration; } } } @@ -709,7 +709,7 @@ namespace CalamityMod.NPCs int size = (npc.ai[0] == 2f) ? 50 : 35; if (npc.ai[0] != 1f) { - for (int num1011 = 0; num1011 < 2; num1011++) + for (int i = 0; i < 2; i++) { if (Main.rand.Next(3) < dustAmt) { @@ -1350,8 +1350,8 @@ namespace CalamityMod.NPCs // Bullet hells at 70% and 10%, brothers at 40% if (npc.life > 0) { - int num660 = (int)(npc.lifeMax * 0.3); - if ((npc.life + num660) < calamityGlobalNPC.newAI[0]) + int calClonePhaseThreshold = (int)(npc.lifeMax * 0.3); + if ((npc.life + calClonePhaseThreshold) < calamityGlobalNPC.newAI[0]) { calamityGlobalNPC.newAI[0] = npc.life; if (calamityGlobalNPC.newAI[0] <= npc.lifeMax * 0.1) @@ -2028,38 +2028,38 @@ namespace CalamityMod.NPCs enrageScale += 2f; } - float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float num842 = (float)Math.Atan2(num841, num840) + MathHelper.PiOver2; - if (num842 < 0f) - num842 += MathHelper.TwoPi; - else if (num842 > MathHelper.TwoPi) - num842 -= MathHelper.TwoPi; + float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); + float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); + float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; + if (calCloneBroRotation < 0f) + calCloneBroRotation += MathHelper.TwoPi; + else if (calCloneBroRotation > MathHelper.TwoPi) + calCloneBroRotation -= MathHelper.TwoPi; - float num843 = 0.15f; - if (npc.rotation < num842) + float calCloneBroRotationSpeed = 0.15f; + if (npc.rotation < calCloneBroRotation) { - if ((num842 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num843; + if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= calCloneBroRotationSpeed; else - npc.rotation += num843; + npc.rotation += calCloneBroRotationSpeed; } - else if (npc.rotation > num842) + else if (npc.rotation > calCloneBroRotation) { - if ((npc.rotation - num842) > MathHelper.Pi) - npc.rotation += num843; + if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) + npc.rotation += calCloneBroRotationSpeed; else - npc.rotation -= num843; + npc.rotation -= calCloneBroRotationSpeed; } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - npc.rotation = num842; + if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + npc.rotation = calCloneBroRotation; if (npc.rotation < 0f) npc.rotation += MathHelper.TwoPi; else if (npc.rotation > MathHelper.TwoPi) npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - npc.rotation = num842; + if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + npc.rotation = calCloneBroRotation; if (!player.active || player.dead) { @@ -2090,69 +2090,69 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) { - float num861 = 5f; - float num862 = 0.1f; - num861 += 2f * enrageScale; - num862 += 0.06f * enrageScale; + float calCloneBroProjAttackMaxSpeed = 5f; + float calCloneBroProjAttackAccel = 0.1f; + calCloneBroProjAttackMaxSpeed += 2f * enrageScale; + calCloneBroProjAttackAccel += 0.06f * enrageScale; if (Main.getGoodWorld) { - num861 *= 1.15f; - num862 *= 1.15f; + calCloneBroProjAttackMaxSpeed *= 1.15f; + calCloneBroProjAttackAccel *= 1.15f; } - int num863 = 1; + int calCloneBroProjAttackDirection = 1; if (npc.position.X + (npc.width / 2) < player.position.X + player.width) - num863 = -1; + calCloneBroProjAttackDirection = -1; - Vector2 vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num864 = player.position.X + (player.width / 2) + (num863 * 180) - vector86.X; - float num865 = player.position.Y + (player.height / 2) - vector86.Y; - float num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); + Vector2 calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float calCloneBroProjTargetX = player.position.X + (player.width / 2) + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; + float calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); if (expertMode) { - if (num866 > 300f) - num861 += 0.5f; - if (num866 > 400f) - num861 += 0.5f; - if (num866 > 500f) - num861 += 0.55f; - if (num866 > 600f) - num861 += 0.55f; - if (num866 > 700f) - num861 += 0.6f; - if (num866 > 800f) - num861 += 0.6f; + if (calCloneBroProjTargetDist > 300f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 400f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 500f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 600f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 700f) + calCloneBroProjAttackMaxSpeed += 0.6f; + if (calCloneBroProjTargetDist > 800f) + calCloneBroProjAttackMaxSpeed += 0.6f; } - num866 = num861 / num866; - num864 *= num866; - num865 *= num866; + calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; - if (npc.velocity.X < num864) + if (npc.velocity.X < calCloneBroProjTargetX) { - npc.velocity.X += num862; - if (npc.velocity.X < 0f && num864 > 0f) - npc.velocity.X += num862; + npc.velocity.X += calCloneBroProjAttackAccel; + if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) + npc.velocity.X += calCloneBroProjAttackAccel; } - else if (npc.velocity.X > num864) + else if (npc.velocity.X > calCloneBroProjTargetX) { - npc.velocity.X -= num862; - if (npc.velocity.X > 0f && num864 < 0f) - npc.velocity.X -= num862; + npc.velocity.X -= calCloneBroProjAttackAccel; + if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) + npc.velocity.X -= calCloneBroProjAttackAccel; } - if (npc.velocity.Y < num865) + if (npc.velocity.Y < calCloneBroProjTargetY) { - npc.velocity.Y += num862; - if (npc.velocity.Y < 0f && num865 > 0f) - npc.velocity.Y += num862; + npc.velocity.Y += calCloneBroProjAttackAccel; + if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) + npc.velocity.Y += calCloneBroProjAttackAccel; } - else if (npc.velocity.Y > num865) + else if (npc.velocity.Y > calCloneBroProjTargetY) { - npc.velocity.Y -= num862; - if (npc.velocity.Y > 0f && num865 < 0f) - npc.velocity.Y -= num862; + npc.velocity.Y -= calCloneBroProjAttackAccel; + if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) + npc.velocity.Y -= calCloneBroProjAttackAccel; } npc.ai[2] += 1f; @@ -2184,22 +2184,22 @@ namespace CalamityMod.NPCs if (npc.localAI[1] > 12f) { npc.localAI[1] = 0f; - float num867 = NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; - num867 += enrageScale; + float calCloneBroProjSpeed = NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; + calCloneBroProjSpeed += enrageScale; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num864 = player.position.X + (player.width / 2) - vector86.X; - num865 = player.position.Y + (player.height / 2) - vector86.Y; - num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); - num866 = num867 / num866; - num864 *= num866; - num865 *= num866; - num865 += npc.velocity.Y * 0.5f; - num864 += npc.velocity.X * 0.5f; - vector86.X -= num864; - vector86.Y -= num865; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector86.X, vector86.Y, num864, num865, type, damage, 0f, Main.myPlayer, 0f, 0f); + calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; + calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + calCloneBroProjTargetY += npc.velocity.Y * 0.5f; + calCloneBroProjTargetX += npc.velocity.X * 0.5f; + calCloneBroProjLocation.X -= calCloneBroProjTargetX; + calCloneBroProjLocation.Y -= calCloneBroProjTargetY; + Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -2209,24 +2209,24 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 1f) { SoundEngine.PlaySound(SoundID.Roar, npc.Center); - npc.rotation = num842; + npc.rotation = calCloneBroRotation; - float num870 = 14f + (death ? 4f * (1f - lifeRatio) : 0f); - num870 += 3f * enrageScale; + float calCloneBroChargeSpeed = 14f + (death ? 4f * (1f - lifeRatio) : 0f); + calCloneBroChargeSpeed += 3f * enrageScale; if (expertMode) - num870 += 2f; + calCloneBroChargeSpeed += 2f; if (revenge) - num870 += 2f; + calCloneBroChargeSpeed += 2f; if (Main.getGoodWorld) - num870 *= 1.25f; + calCloneBroChargeSpeed *= 1.25f; - Vector2 vector87 = npc.Center; - float num871 = player.Center.X - vector87.X; - float num872 = player.Center.Y - vector87.Y; - float num873 = (float)Math.Sqrt(num871 * num871 + num872 * num872); - num873 = num870 / num873; - npc.velocity.X = num871 * num873; - npc.velocity.Y = num872 * num873; + Vector2 calCloneBroChargeCenter = npc.Center; + float calCloneBroChargeTargetXDist = player.Center.X - calCloneBroChargeCenter.X; + float calCloneBroChargeTargetYDist = player.Center.Y - calCloneBroChargeCenter.Y; + float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); + calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; + npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; + npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; npc.ai[1] = 2f; if (Main.zenithWorld) @@ -2279,7 +2279,7 @@ namespace CalamityMod.NPCs npc.ai[3] += 1f; npc.ai[2] = 0f; npc.target = 255; - npc.rotation = num842; + npc.rotation = calCloneBroRotation; npc.TargetClosest(); if (npc.ai[3] >= 3f) { @@ -2335,38 +2335,38 @@ namespace CalamityMod.NPCs enrageScale += 2f; } - float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float num842 = (float)Math.Atan2(num841, num840) + MathHelper.PiOver2; - if (num842 < 0f) - num842 += MathHelper.TwoPi; - else if (num842 > MathHelper.TwoPi) - num842 -= MathHelper.TwoPi; + float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); + float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); + float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; + if (calCloneBroRotation < 0f) + calCloneBroRotation += MathHelper.TwoPi; + else if (calCloneBroRotation > MathHelper.TwoPi) + calCloneBroRotation -= MathHelper.TwoPi; - float num843 = 0.15f; - if (npc.rotation < num842) + float calCloneBroRotationSpeed = 0.15f; + if (npc.rotation < calCloneBroRotation) { - if ((num842 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num843; + if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= calCloneBroRotationSpeed; else - npc.rotation += num843; + npc.rotation += calCloneBroRotationSpeed; } - else if (npc.rotation > num842) + else if (npc.rotation > calCloneBroRotation) { - if ((npc.rotation - num842) > MathHelper.Pi) - npc.rotation += num843; + if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) + npc.rotation += calCloneBroRotationSpeed; else - npc.rotation -= num843; + npc.rotation -= calCloneBroRotationSpeed; } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - npc.rotation = num842; + if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + npc.rotation = calCloneBroRotation; if (npc.rotation < 0f) npc.rotation += MathHelper.TwoPi; else if (npc.rotation > MathHelper.TwoPi) npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - npc.rotation = num842; + if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + npc.rotation = calCloneBroRotation; if (!player.active || player.dead) { @@ -2397,69 +2397,69 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) { - float num861 = 4.5f; - float num862 = 0.2f; - num861 += 2f * enrageScale; - num862 += 0.1f * enrageScale; + float calCloneBroProjAttackMaxSpeed = 4.5f; + float calCloneBroProjAttackAccel = 0.2f; + calCloneBroProjAttackMaxSpeed += 2f * enrageScale; + calCloneBroProjAttackAccel += 0.1f * enrageScale; if (Main.getGoodWorld) { - num861 *= 1.15f; - num862 *= 1.15f; + calCloneBroProjAttackMaxSpeed *= 1.15f; + calCloneBroProjAttackAccel *= 1.15f; } - int num863 = 1; + int calCloneBroProjAttackDirection = 1; if (npc.Center.X < player.Center.X) - num863 = -1; + calCloneBroProjAttackDirection = -1; - Vector2 vector86 = npc.Center; - float num864 = player.Center.X + (num863 * 180) - vector86.X; - float num865 = player.Center.Y - vector86.Y; - float num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); + Vector2 calCloneBroProjLocation = npc.Center; + float calCloneBroProjTargetX = player.Center.X + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; + float calCloneBroProjTargetY = player.Center.Y - calCloneBroProjLocation.Y; + float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); if (expertMode) { - if (num866 > 300f) - num861 += 0.5f; - if (num866 > 400f) - num861 += 0.5f; - if (num866 > 500f) - num861 += 0.55f; - if (num866 > 600f) - num861 += 0.55f; - if (num866 > 700f) - num861 += 0.6f; - if (num866 > 800f) - num861 += 0.6f; + if (calCloneBroProjTargetDist > 300f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 400f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 500f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 600f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 700f) + calCloneBroProjAttackMaxSpeed += 0.6f; + if (calCloneBroProjTargetDist > 800f) + calCloneBroProjAttackMaxSpeed += 0.6f; } - num866 = num861 / num866; - num864 *= num866; - num865 *= num866; + calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; - if (npc.velocity.X < num864) + if (npc.velocity.X < calCloneBroProjTargetX) { - npc.velocity.X += num862; - if (npc.velocity.X < 0f && num864 > 0f) - npc.velocity.X += num862; + npc.velocity.X += calCloneBroProjAttackAccel; + if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) + npc.velocity.X += calCloneBroProjAttackAccel; } - else if (npc.velocity.X > num864) + else if (npc.velocity.X > calCloneBroProjTargetX) { - npc.velocity.X -= num862; - if (npc.velocity.X > 0f && num864 < 0f) - npc.velocity.X -= num862; + npc.velocity.X -= calCloneBroProjAttackAccel; + if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) + npc.velocity.X -= calCloneBroProjAttackAccel; } - if (npc.velocity.Y < num865) + if (npc.velocity.Y < calCloneBroProjTargetY) { - npc.velocity.Y += num862; - if (npc.velocity.Y < 0f && num865 > 0f) - npc.velocity.Y += num862; + npc.velocity.Y += calCloneBroProjAttackAccel; + if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) + npc.velocity.Y += calCloneBroProjAttackAccel; } - else if (npc.velocity.Y > num865) + else if (npc.velocity.Y > calCloneBroProjTargetY) { - npc.velocity.Y -= num862; - if (npc.velocity.Y > 0f && num865 < 0f) - npc.velocity.Y -= num862; + npc.velocity.Y -= calCloneBroProjAttackAccel; + if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) + npc.velocity.Y -= calCloneBroProjAttackAccel; } npc.ai[2] += 1f; @@ -2491,22 +2491,22 @@ namespace CalamityMod.NPCs if (npc.localAI[1] > 50f) { npc.localAI[1] = 0f; - float num867 = death ? 14f : 12f; - num867 += 3f * enrageScale; + float calCloneBroProjSpeed = death ? 14f : 12f; + calCloneBroProjSpeed += 3f * enrageScale; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num864 = player.position.X + (player.width / 2) - vector86.X; - num865 = player.position.Y + (player.height / 2) - vector86.Y; - num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); - num866 = num867 / num866; - num864 *= num866; - num865 *= num866; - num865 += npc.velocity.Y * 0.5f; - num864 += npc.velocity.X * 0.5f; - vector86.X -= num864; - vector86.Y -= num865; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector86.X, vector86.Y, num864, num865, type, damage, 0f, Main.myPlayer, 0f, 0f); + calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; + calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + calCloneBroProjTargetY += npc.velocity.Y * 0.5f; + calCloneBroProjTargetX += npc.velocity.X * 0.5f; + calCloneBroProjLocation.X -= calCloneBroProjTargetX; + calCloneBroProjLocation.Y -= calCloneBroProjTargetY; + Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -2516,24 +2516,24 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 1f) { SoundEngine.PlaySound(SoundID.Roar, npc.Center); - npc.rotation = num842; + npc.rotation = calCloneBroRotation; - float num870 = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); - num870 += 4f * enrageScale; + float calCloneBroChargeSpeed = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); + calCloneBroChargeSpeed += 4f * enrageScale; if (expertMode) - num870 += 2f; + calCloneBroChargeSpeed += 2f; if (revenge) - num870 += 2f; + calCloneBroChargeSpeed += 2f; if (Main.getGoodWorld) - num870 *= 1.25f; + calCloneBroChargeSpeed *= 1.25f; - Vector2 vector87 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num871 = player.position.X + (player.width / 2) - vector87.X; - float num872 = player.position.Y + (player.height / 2) - vector87.Y; - float num873 = (float)Math.Sqrt(num871 * num871 + num872 * num872); - num873 = num870 / num873; - npc.velocity.X = num871 * num873; - npc.velocity.Y = num872 * num873; + Vector2 calCloneBroChargeCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float calCloneBroChargeTargetXDist = player.position.X + (player.width / 2) - calCloneBroChargeCenter.X; + float calCloneBroChargeTargetYDist = player.position.Y + (player.height / 2) - calCloneBroChargeCenter.Y; + float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); + calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; + npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; + npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; npc.ai[1] = 2f; if (Main.zenithWorld) @@ -2586,7 +2586,7 @@ namespace CalamityMod.NPCs npc.ai[3] += 1f; npc.ai[2] = 0f; npc.TargetClosest(); - npc.rotation = num842; + npc.rotation = calCloneBroRotation; if (npc.ai[3] >= 4f) { npc.ai[1] = 0f; @@ -2755,18 +2755,18 @@ namespace CalamityMod.NPCs { int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - float num1070 = 7f; - float num1071 = player.Center.X - npc.Center.X; - float num1072 = player.Center.Y - npc.Center.Y; - float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, num1071, num1072, type, damage, 0f, Main.myPlayer); + float aureusLaserSpeed = 7f; + float aureusLaserTargetX = player.Center.X - npc.Center.X; + float aureusLaserTargetY = player.Center.Y - npc.Center.Y; + float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY); + aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist; + aureusLaserTargetX *= aureusLaserTargetDist; + aureusLaserTargetY *= aureusLaserTargetDist; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, damage, 0f, Main.myPlayer); for (int i = 0; i < 4; i++) { Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, num1071 + offset.X, num1072 + offset.Y, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, damage, 0f, Main.myPlayer); } } astrumAureus.slimePhase = 1; @@ -2973,19 +2973,19 @@ namespace CalamityMod.NPCs npc.noTileCollide = true; // Walk through tiles if colliding with tiles and player is out of reach - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); + int aureusHitboxWidth = 80; + int aureusHitboxHeight = 20; + Vector2 aureusHitboxTileCollideSize = new Vector2(npc.Center.X - (aureusHitboxWidth / 2), npc.position.Y + npc.height - aureusHitboxHeight); - bool flag52 = false; + bool nearPlayerWalkingThroughTiles = false; if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) - flag52 = true; + nearPlayerWalkingThroughTiles = true; - if (flag52) + if (nearPlayerWalkingThroughTiles) { npc.velocity.Y += 0.5f; } - else if (Collision.SolidCollision(position2, num854, num855)) + else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight)) { if (npc.velocity.Y > 0f) npc.velocity.Y = 0f; @@ -3153,12 +3153,12 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[3] = 0f; // Spawn dust for visual effect - for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) + for (int i = (int)npc.position.X - 20; i < (int)npc.position.X + npc.width + 40; i += 20) { - for (int num623 = 0; num623 < 4; num623++) + for (int j = 0; j < 4; j++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[num624].velocity *= 0.2f; + int stompDust = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; } } @@ -3342,24 +3342,23 @@ namespace CalamityMod.NPCs Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f; Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int num235 = 5; - int num238 = 0; - while (num238 < 100) + int teleportTries = 0; + while (teleportTries < 100) { - num238++; - int num239 = Main.rand.Next(point4.X - num235, point4.X + num235 + 1); - int num240 = Main.rand.Next(point4.Y - num235, point4.Y); + teleportTries++; + int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6); + int teleportTileX = Main.rand.Next(point4.Y - 5, point4.Y); - if (!Main.tile[num239, num240].HasUnactuatedTile) + if (!Main.tile[teleportTileX, teleportTileX].HasUnactuatedTile) { - npc.ai[1] = num239 * 16 + 8; - npc.ai[3] = num240 * 16 + 16; + npc.ai[1] = teleportTileX * 16 + 8; + npc.ai[3] = teleportTileX * 16 + 16; break; } } // Default teleport if the above conditions aren't met in 100 iterations - if (num238 >= 100) + if (teleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; npc.ai[1] = bottom.X; @@ -3412,11 +3411,11 @@ namespace CalamityMod.NPCs } // Emit dust to make the teleport pretty - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity *= 0.5f; } CustomGravity(); @@ -3432,21 +3431,21 @@ namespace CalamityMod.NPCs npc.alpha -= 10; if (npc.alpha <= 0) { - // Spawn slimes + // Spawn Aureus Spawns bool spawnFlag = expertMode; if (NPC.CountNPCS(ModContent.NPCType()) >= 2) spawnFlag = false; if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) { - int slime = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - Main.npc[slime].velocity.Y = -10f; - Main.npc[slime].netUpdate = true; + int aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + Main.npc[aureusSpawn].velocity.Y = -10f; + Main.npc[aureusSpawn].netUpdate = true; if (revenge) { - slime = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - Main.npc[slime].velocity.Y = -15f; - Main.npc[slime].netUpdate = true; + aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + Main.npc[aureusSpawn].velocity.Y = -15f; + Main.npc[aureusSpawn].netUpdate = true; } if (death) @@ -3481,11 +3480,11 @@ namespace CalamityMod.NPCs } // Emit dust to make the teleport pretty - for (int num245 = 0; num245 < 10; num245++) + for (int i = 0; i < 10; i++) { - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity *= 0.5f; } CustomGravity(); @@ -3850,15 +3849,15 @@ namespace CalamityMod.NPCs int Previous = npc.whoAmI; int bodyType = ModContent.NPCType(); int tailType = ModContent.NPCType(); - for (int num36 = 0; num36 < maxLength; num36++) + for (int segments = 0; segments < maxLength; segments++) { int lol; - if (num36 >= 0 && num36 < maxLength - 1) + if (segments >= 0 && segments < maxLength - 1) lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), bodyType, npc.whoAmI); else lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), tailType, npc.whoAmI); - if (num36 % 2 == 0) + if (segments % 2 == 0) Main.npc[lol].localAI[3] = 1f; Main.npc[lol].realLife = npc.whoAmI; @@ -3887,27 +3886,27 @@ namespace CalamityMod.NPCs if (head) { - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + npc.height) / 16f) + 2; + int headTilePositionX = (int)(npc.position.X / 16f) - 1; + int headTileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; + int headTilePositionY = (int)(npc.position.Y / 16f) - 1; + int headTileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; - if (num12 < 0) - num12 = 0; - if (num13 > Main.maxTilesX) - num13 = Main.maxTilesX; - if (num14 < 0) - num14 = 0; - if (num15 > Main.maxTilesY) - num15 = Main.maxTilesY; + if (headTilePositionX < 0) + headTilePositionX = 0; + if (headTileWidthPosX > Main.maxTilesX) + headTileWidthPosX = Main.maxTilesX; + if (headTilePositionY < 0) + headTilePositionY = 0; + if (headTileWidthPosY > Main.maxTilesY) + headTileWidthPosY = Main.maxTilesY; // Fly or not - bool flag2 = flyAtTarget; - if (!flag2) + bool shouldFly = flyAtTarget; + if (!shouldFly) { - for (int k = num12; k < num13; k++) + for (int k = headTilePositionX; k < headTileWidthPosX; k++) { - for (int l = num14; l < num15; l++) + for (int l = headTilePositionY; l < headTileWidthPosY; l++) { if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) { @@ -3916,7 +3915,7 @@ namespace CalamityMod.NPCs vector2.Y = l * 16f; if (npc.position.X + npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) { - flag2 = true; + shouldFly = true; break; } } @@ -3925,15 +3924,15 @@ namespace CalamityMod.NPCs } // Start flying if target is not within a certain distance - if (!flag2) + if (!shouldFly) { npc.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num16 = 200; + int noFlyZone = 200; int heightReduction = death ? 130 : (int)(130f * (1f - lifeRatio)); int height = 400 - heightReduction; - bool flag3 = true; + bool outsideNoFlyZone = true; if (npc.position.Y > player.position.Y) { @@ -3941,16 +3940,16 @@ namespace CalamityMod.NPCs { if (Main.player[m].active) { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, height); + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height); if (rectangle.Intersects(rectangle2)) { - flag3 = false; + outsideNoFlyZone = false; break; } } } - if (flag3) - flag2 = true; + if (outsideNoFlyZone) + shouldFly = true; } } else @@ -3960,7 +3959,7 @@ namespace CalamityMod.NPCs float fallSpeed = deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; if (player.dead) { - flag2 = false; + shouldFly = false; float velocity = 2f; npc.velocity.Y -= velocity; if ((double)npc.position.Y < Main.topWorld + 16f) @@ -3974,17 +3973,17 @@ namespace CalamityMod.NPCs int tailType = ModContent.NPCType(); if ((double)npc.position.Y < Main.topWorld + 16f) { - for (int num957 = 0; num957 < Main.maxNPCs; num957++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num957].type == headType || Main.npc[num957].type == bodyType || Main.npc[num957].type == tailType) + if (Main.npc[i].type == headType || Main.npc[i].type == bodyType || Main.npc[i].type == tailType) { - Main.npc[num957].active = false; + Main.npc[i].active = false; - Main.npc[num957].netUpdate = true; + Main.npc[i].netUpdate = true; // Prevent netUpdate from being blocked by the spam counter. - if (Main.npc[num957].netSpam >= 10) - Main.npc[num957].netSpam = 9; + if (Main.npc[i].netSpam >= 10) + Main.npc[i].netSpam = 9; } } } @@ -4025,17 +4024,17 @@ namespace CalamityMod.NPCs turnSpeed *= 1.15f; } - Vector2 vector3 = npc.Center; - float num20 = player.position.X + (player.width / 2); - float num21 = player.position.Y + (player.height / 2); - num20 = (int)(num20 / 16f) * 16; - num21 = (int)(num21 / 16f) * 16; - vector3.X = (int)(vector3.X / 16f) * 16; - vector3.Y = (int)(vector3.Y / 16f) * 16; - num20 -= vector3.X; - num21 -= vector3.Y; + Vector2 deusCenter = npc.Center; + float deusTargetX = player.position.X + (player.width / 2); + float deusTargetY = player.position.Y + (player.height / 2); + deusTargetX = (int)(deusTargetX / 16f) * 16; + deusTargetY = (int)(deusTargetY / 16f) * 16; + deusCenter.X = (int)(deusCenter.X / 16f) * 16; + deusCenter.Y = (int)(deusCenter.Y / 16f) * 16; + deusTargetX -= deusCenter.X; + deusTargetY -= deusCenter.Y; - if (!flag2) + if (!shouldFly) { npc.velocity.Y += 0.15f; if (npc.velocity.Y > fallSpeed) @@ -4050,9 +4049,9 @@ namespace CalamityMod.NPCs } else if (npc.velocity.Y == fallSpeed) { - if (npc.velocity.X < num20) + if (npc.velocity.X < deusTargetX) npc.velocity.X += speed; - else if (npc.velocity.X > num20) + else if (npc.velocity.X > deusTargetX) npc.velocity.X -= speed; } else if (npc.velocity.Y > 4f) @@ -4065,19 +4064,19 @@ namespace CalamityMod.NPCs } else { - float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = fallSpeed / num22; - num20 *= num27; - num21 *= num27; + float deusTargetDist = (float)Math.Sqrt(deusTargetX * deusTargetX + deusTargetY * deusTargetY); + float deusAbsoluteTargetX = Math.Abs(deusTargetX); + float deusAbsoluteTargetY = Math.Abs(deusTargetY); + float deusTimeToReachTarget = fallSpeed / deusTargetDist; + deusTargetX *= deusTimeToReachTarget; + deusTargetY *= deusTimeToReachTarget; - bool flag6 = false; + bool speedUpWhileFlying = false; if (flyAtTarget) { - if (((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f) || (npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && num22 < 400f) + if (((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f) || (npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && deusTargetDist < 400f) { - flag6 = true; + speedUpWhileFlying = true; if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < fallSpeed) npc.velocity *= 1.1f; @@ -4085,7 +4084,7 @@ namespace CalamityMod.NPCs if (npc.position.Y > player.position.Y) { - flag6 = true; + speedUpWhileFlying = true; if (Math.Abs(npc.velocity.X) < fallSpeed / 2f) { @@ -4099,42 +4098,42 @@ namespace CalamityMod.NPCs } } - if (!flag6) + if (!speedUpWhileFlying) { if (!flyAtTarget) { - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + if (((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f)) && ((npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f))) { - if (npc.velocity.X < num20) + if (npc.velocity.X < deusTargetX) npc.velocity.X += turnSpeed; - else if (npc.velocity.X > num20) + else if (npc.velocity.X > deusTargetX) npc.velocity.X -= turnSpeed; - if (npc.velocity.Y < num21) + if (npc.velocity.Y < deusTargetY) npc.velocity.Y += turnSpeed; - else if (npc.velocity.Y > num21) + else if (npc.velocity.Y > deusTargetY) npc.velocity.Y -= turnSpeed; } } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + if ((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f) || (npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f)) { - if (npc.velocity.X < num20) + if (npc.velocity.X < deusTargetX) npc.velocity.X += speed; - else if (npc.velocity.X > num20) + else if (npc.velocity.X > deusTargetX) npc.velocity.X -= speed; - if (npc.velocity.Y < num21) + if (npc.velocity.Y < deusTargetY) npc.velocity.Y += speed; - else if (npc.velocity.Y > num21) + else if (npc.velocity.Y > deusTargetY) npc.velocity.Y -= speed; - if (Math.Abs(num21) < fallSpeed * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + if (Math.Abs(deusTargetY) < fallSpeed * 0.2 && ((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f))) { if (npc.velocity.Y > 0f) npc.velocity.Y += speed * 2f; else npc.velocity.Y -= speed * 2f; } - if (Math.Abs(num20) < fallSpeed * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + if (Math.Abs(deusTargetX) < fallSpeed * 0.2 && ((npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f))) { if (npc.velocity.X > 0f) npc.velocity.X += speed * 2f; @@ -4142,11 +4141,11 @@ namespace CalamityMod.NPCs npc.velocity.X -= speed * 2f; } } - else if (num25 > num26) + else if (deusAbsoluteTargetX > deusAbsoluteTargetY) { - if (npc.velocity.X < num20) + if (npc.velocity.X < deusTargetX) npc.velocity.X += speed * 1.1f; - else if (npc.velocity.X > num20) + else if (npc.velocity.X > deusTargetX) npc.velocity.X -= speed * 1.1f; if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) @@ -4159,9 +4158,9 @@ namespace CalamityMod.NPCs } else { - if (npc.velocity.Y < num21) + if (npc.velocity.Y < deusTargetY) npc.velocity.Y += speed * 1.1f; - else if (npc.velocity.Y > num21) + else if (npc.velocity.Y > deusTargetY) npc.velocity.Y -= speed * 1.1f; if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) @@ -4175,7 +4174,7 @@ namespace CalamityMod.NPCs } } - if (flag2) + if (shouldFly) { if (npc.localAI[0] != 1f) { @@ -4241,10 +4240,10 @@ namespace CalamityMod.NPCs Vector2 velocity = Vector2.Zero; if (movingMines) { - Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= Main.rand.Next(90, 121) * 0.01f; - velocity = vector15; + Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randomMineMovement.Normalize(); + randomMineMovement *= Main.rand.Next(90, 121) * 0.01f; + velocity = randomMineMovement; } int type = ModContent.ProjectileType(); @@ -4260,18 +4259,18 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - float num941 = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; - Vector2 vector104 = npc.Center; - float num942 = player.position.X + player.width * 0.5f - vector104.X; - float num943 = player.position.Y + player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - Vector2 shootDirection = new Vector2(num942, num943).SafeNormalize(Vector2.UnitY); - Vector2 laserVelocity = shootDirection * num941; + float deusLaserSpeed = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; + Vector2 deusLaserCenter = npc.Center; + float deusLaserTargetX = player.position.X + player.width * 0.5f - deusLaserCenter.X; + float deusLaserTargetY = player.position.Y + player.height * 0.5f - deusLaserCenter.Y; + float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY); + deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist; + deusLaserTargetX *= deusLaserTargetDist; + deusLaserTargetY *= deusLaserTargetDist; + deusLaserCenter.X += deusLaserTargetX * 5f; + deusLaserCenter.Y += deusLaserTargetY * 5f; + Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY); + Vector2 laserVelocity = shootDirection * deusLaserSpeed; int type = shootGodRays ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); if (shootGodRays) @@ -4282,7 +4281,7 @@ namespace CalamityMod.NPCs for (int i = -1; i <= 1; i += 2) { - Vector2 laserStartPos = vector104 + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); + Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); Projectile godRay = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); // Tell this Phased God Ray exactly which way it should be waving. @@ -4290,7 +4289,7 @@ namespace CalamityMod.NPCs } } else - Projectile.NewProjectile(npc.GetSource_FromAI(), vector104, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Projectile.NewProjectile(npc.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); } } } @@ -4302,10 +4301,10 @@ namespace CalamityMod.NPCs Vector2 velocity = Vector2.Zero; if (movingMines) { - Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= Main.rand.Next(30, 121) * 0.01f; - velocity = vector15; + Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randomMineMovement.Normalize(); + randomMineMovement *= Main.rand.Next(30, 121) * 0.01f; + velocity = randomMineMovement; } int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -4316,41 +4315,41 @@ namespace CalamityMod.NPCs } // Follow the head - Vector2 vector18 = npc.Center; - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; + Vector2 segmentCenter = npc.Center; + float segmentTargetX = player.position.X + (player.width / 2); + float segmentTargetY = player.position.Y + (player.height / 2); + segmentTargetX = (int)(segmentTargetX / 16f) * 16; + segmentTargetY = (int)(segmentTargetY / 16f) * 16; + segmentCenter.X = (int)(segmentCenter.X / 16f) * 16; + segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16; + segmentTargetX -= segmentCenter.X; + segmentTargetY -= segmentCenter.Y; if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try { - vector18 = npc.Center; - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + segmentCenter = npc.Center; + segmentTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - segmentCenter.X; + segmentTargetY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - segmentCenter.Y; } catch { } - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + npc.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2; + float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY); + int segmentWidth = npc.width; + segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist; + segmentTargetX *= segmentTargetDist; + segmentTargetY *= segmentTargetDist; npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + npc.position.X = npc.position.X + segmentTargetX; + npc.position.Y = npc.position.Y + segmentTargetY; - if (num191 < 0f) + if (segmentTargetX < 0f) npc.spriteDirection = -1; - else if (num191 > 0f) + else if (segmentTargetX > 0f) npc.spriteDirection = 1; } } @@ -5139,12 +5138,12 @@ namespace CalamityMod.NPCs } } - Vector2 value52 = player.Center - npc.Center; - float scaleFactor16 = 4f + value52.Length() / 100f; - float num1308 = 25f; - value52.Normalize(); - value52 *= scaleFactor16; - npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; + Vector2 follyTargetDirection = player.Center - npc.Center; + float follyTargetDistance = 4f + follyTargetDirection.Length() / 100f; + float follyVelocityMult = 25f; + follyTargetDirection.Normalize(); + follyTargetDirection *= follyTargetDistance; + npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; return; } @@ -5172,22 +5171,22 @@ namespace CalamityMod.NPCs npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; // Fly to target if target is too far away, otherwise get close to target and then slow down - Vector2 value51 = player.Center - npc.Center; - value51.Y -= 200f; - if (value51.Length() > 2800f) + Vector2 follyFlyTargetDirection = player.Center - npc.Center; + follyFlyTargetDirection.Y -= 200f; + if (follyFlyTargetDirection.Length() > 2800f) { npc.TargetClosest(); npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; } - else if (value51.Length() > 240f) + else if (follyFlyTargetDirection.Length() > 240f) { - float scaleFactor15 = 12f + (enrageScale - 1f) * 6f; - float num1306 = 30f; - value51.Normalize(); - value51 *= scaleFactor15; - npc.velocity = (npc.velocity * (num1306 - 1f) + value51) / num1306; + float follyFlySpeed = 12f + (enrageScale - 1f) * 6f; + float follyFlyVelocityMult = 30f; + follyFlyTargetDirection.Normalize(); + follyFlyTargetDirection *= follyFlySpeed; + npc.velocity = (npc.velocity * (follyFlyVelocityMult - 1f) + follyFlyTargetDirection) / follyFlyVelocityMult; } else if (npc.velocity.Length() > 2f) npc.velocity *= 0.95f; @@ -5226,15 +5225,15 @@ namespace CalamityMod.NPCs } else { - int num1307 = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); + int follyAttackPicker = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); if (phase3) - num1307 = 1; + follyAttackPicker = 1; float featherVelocity = 2f + (enrageScale - 1f); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (num1307 == 0 && npc.localAI[3] == 0f) + if (follyAttackPicker == 0 && npc.localAI[3] == 0f) { npc.TargetClosest(); npc.ai[0] = 2f; @@ -5250,7 +5249,7 @@ namespace CalamityMod.NPCs // Birb will do at least 1 different attack before entering this phase again npc.localAI[3] = 1f; } - else if (num1307 == 1) + else if (follyAttackPicker == 1) { npc.TargetClosest(); npc.ai[0] = 3f; @@ -5407,8 +5406,8 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - Vector2 value52 = player.Center - npc.Center; - if (value52.Length() < 800f) + Vector2 follyTargetDirection = player.Center - npc.Center; + if (follyTargetDirection.Length() < 800f) { npc.TargetClosest(); npc.ai[0] = 0f; @@ -5425,11 +5424,11 @@ namespace CalamityMod.NPCs } float velocity = 14f + (enrageScale - 1f) * 4f; - float scaleFactor16 = velocity + value52.Length() / 100f; - float num1308 = 25f; - value52.Normalize(); - value52 *= scaleFactor16; - npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; + float follyTargetDistance = velocity + follyTargetDirection.Length() / 100f; + float follyVelocityMult = 25f; + follyTargetDirection.Normalize(); + follyTargetDirection *= follyTargetDistance; + npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; } // Fly towards target quickly @@ -5459,21 +5458,21 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 1.25f) / 5f; - Vector2 value53 = player.Center - npc.Center; - value53.Y -= 20f; + Vector2 follyQuickFlyTargetDirection = player.Center - npc.Center; + follyQuickFlyTargetDirection.Y -= 20f; npc.ai[2] += 0.0222222228f; if (expertMode) npc.ai[2] += 0.0166666675f; float velocity = 8f + (enrageScale - 1f) * 2f; - float scaleFactor17 = velocity + npc.ai[2] + value53.Length() / 120f; + float follyQuickFlySpeed = velocity + npc.ai[2] + follyQuickFlyTargetDirection.Length() / 120f; if (CalamityWorld.LegendaryMode && revenge) - scaleFactor17 *= 2f; + follyQuickFlySpeed *= 2f; - float num1309 = 20f; - value53.Normalize(); - value53 *= scaleFactor17; - npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309; + float follyQuickFlyVelMult = 20f; + follyQuickFlyTargetDirection.Normalize(); + follyQuickFlyTargetDirection *= follyQuickFlySpeed; + npc.velocity = (npc.velocity * (follyQuickFlyVelMult - 1f) + follyQuickFlyTargetDirection) / follyQuickFlyVelMult; npc.ai[1] += 1f; if (npc.ai[1] >= ((CalamityWorld.LegendaryMode && revenge) ? 90f : 180f)) @@ -5504,12 +5503,12 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - Vector2 value54 = player.Center - npc.Center; - value54.Y -= 12f; + Vector2 follyLineUpTargetDirection = player.Center - npc.Center; + follyLineUpTargetDirection.Y -= 12f; if (npc.Center.X > player.Center.X) - value54.X += chargeDistance; + follyLineUpTargetDirection.X += chargeDistance; else - value54.X -= chargeDistance; + follyLineUpTargetDirection.X -= chargeDistance; float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1f) * 20f; if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < verticalDistanceGateValue) @@ -5528,11 +5527,11 @@ namespace CalamityMod.NPCs npc.ai[1] += 0.0333333351f; float velocity = 16f + (enrageScale - 1f) * 4f; - float scaleFactor18 = velocity + npc.ai[1]; - float num1310 = 4f; - value54.Normalize(); - value54 *= scaleFactor18; - npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310; + float follyLineUpSpeed = velocity + npc.ai[1]; + float follyLineUpVelMult = 4f; + follyLineUpTargetDirection.Normalize(); + follyLineUpTargetDirection *= follyLineUpSpeed; + npc.velocity = (npc.velocity * (follyLineUpVelMult - 1f) + follyLineUpTargetDirection) / follyLineUpVelMult; } // Prepare to charge @@ -5540,13 +5539,13 @@ namespace CalamityMod.NPCs { npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - Vector2 vector206 = player.Center - npc.Center; - vector206.Y -= 12f; - float scaleFactor19 = 28f + (enrageScale - 1f) * 4f; - float num1311 = 8f; - vector206.Normalize(); - vector206 *= scaleFactor19; - npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311; + Vector2 follyChargePrepareTargetDirection = player.Center - npc.Center; + follyChargePrepareTargetDirection.Y -= 12f; + float follyChargePrepareSpeed = 28f + (enrageScale - 1f) * 4f; + float follyChargePrepareVelMult = 8f; + follyChargePrepareTargetDirection.Normalize(); + follyChargePrepareTargetDirection *= follyChargePrepareSpeed; + npc.velocity = (npc.velocity * (follyChargePrepareVelMult - 1f) + follyChargePrepareTargetDirection) / follyChargePrepareVelMult; if (npc.velocity.X < 0f) npc.direction = -1; @@ -5558,7 +5557,7 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; if (npc.ai[1] > 10f) { - npc.velocity = vector206; + npc.velocity = follyChargePrepareTargetDirection; if (npc.velocity.X < 0f) npc.direction = -1; @@ -5693,9 +5692,9 @@ namespace CalamityMod.NPCs bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (npc.ai[1] == 140f || (revenge && npc.ai[1] == 155f) || npc.ai[1] == 170f || gfbSpawnFlag); if (spawnFlag) { - Vector2 vector7 = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); - if (Vector2.Distance(vector7, player.Center) > 150f) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector7.X, (int)vector7.Y, ModContent.NPCType(), npc.whoAmI); + Vector2 follySpawnCenter = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); + if (Vector2.Distance(follySpawnCenter, player.Center) > 150f) + NPC.NewNPC(npc.GetSource_FromAI(), (int)follySpawnCenter.X, (int)follySpawnCenter.Y, ModContent.NPCType(), npc.whoAmI); npc.netUpdate = true; @@ -5738,12 +5737,12 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; + Vector2 follySpawnCenter = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1f); if (ai0 > 3f) ai0 = 3f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector7.X, vector7.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, npc.target + 1); + Projectile.NewProjectile(npc.GetSource_FromAI(), follySpawnCenter.X, follySpawnCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, npc.target + 1); npc.netUpdate = true; @@ -5808,14 +5807,14 @@ namespace CalamityMod.NPCs { if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) { - Vector2 value42 = Main.npc[i].Center - npc.Center; - if (value42.Length() < (npc.width + npc.height)) + Vector2 otherSwarmerDirection = Main.npc[i].Center - npc.Center; + if (otherSwarmerDirection.Length() < (npc.width + npc.height)) { - value42.Normalize(); - value42 *= -0.1f; - npc.velocity += value42; + otherSwarmerDirection.Normalize(); + otherSwarmerDirection *= -0.1f; + npc.velocity += otherSwarmerDirection; NPC nPC6 = Main.npc[i]; - nPC6.velocity -= value42; + nPC6.velocity -= otherSwarmerDirection; } } } @@ -5824,21 +5823,21 @@ namespace CalamityMod.NPCs if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(true); - Vector2 vector240 = Main.player[npc.target].Center - npc.Center; - if (Main.player[npc.target].dead || vector240.Length() > (bossMinion ? 5600f : 2800f)) + Vector2 swarmerTargetDist = Main.player[npc.target].Center - npc.Center; + if (Main.player[npc.target].dead || swarmerTargetDist.Length() > (bossMinion ? 5600f : 2800f)) npc.ai[0] = -1f; } else { - Vector2 vector241 = Main.player[npc.target].Center - npc.Center; - if (npc.ai[0] > 1f && vector241.Length() > 3600f) + Vector2 swarmerCatchUpTargetDist = Main.player[npc.target].Center - npc.Center; + if (npc.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f) npc.ai[0] = 1f; } if (npc.ai[0] == -1f) { - Vector2 value43 = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * 21f + value43) / 10f; + Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f); + npc.velocity = (npc.velocity * 21f + swarmerDespawnVelMult) / 10f; return; } @@ -5847,21 +5846,20 @@ namespace CalamityMod.NPCs npc.TargetClosest(true); npc.spriteDirection = npc.direction; - Vector2 value44 = Main.player[npc.target].Center - npc.Center; - if (value44.Length() > 2800f) + Vector2 swarmerIdleTargetDist = Main.player[npc.target].Center - npc.Center; + if (swarmerIdleTargetDist.Length() > 2800f) { npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; } - else if (value44.Length() > 400f) + else if (swarmerIdleTargetDist.Length() > 400f) { - float scaleFactor20 = (bossMinion ? 9f : 7f) + value44.Length() / 100f + npc.ai[1] / 15f; - float num1377 = 30f; - value44.Normalize(); - value44 *= scaleFactor20; - npc.velocity = (npc.velocity * (num1377 - 1f) + value44) / num1377; + float swarmerIdleSpeed = (bossMinion ? 9f : 7f) + swarmerIdleTargetDist.Length() / 100f + npc.ai[1] / 15f; + swarmerIdleTargetDist.Normalize(); + swarmerIdleTargetDist *= swarmerIdleSpeed; + npc.velocity = (npc.velocity * 29F + swarmerIdleTargetDist) / 30F; if (Main.getGoodWorld && !Main.zenithWorld) npc.velocity *= 1.15f; } @@ -5892,8 +5890,8 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - Vector2 value45 = Main.player[npc.target].Center - npc.Center; - if (value45.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + Vector2 swarmerChargeTargetDist = Main.player[npc.target].Center - npc.Center; + if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -5902,11 +5900,11 @@ namespace CalamityMod.NPCs } npc.ai[2] += 0.0166666675f; - float scaleFactor21 = (bossMinion ? 12f : 9f) + npc.ai[2] + value45.Length() / 150f; - float num1378 = 25f; - value45.Normalize(); - value45 *= scaleFactor21; - npc.velocity = (npc.velocity * (num1378 - 1f) + value45) / num1378; + float swarmerChargeSpeed = (bossMinion ? 12f : 9f) + npc.ai[2] + swarmerChargeTargetDist.Length() / 150f; + float swarmerChargeVelMult = 25f; + swarmerChargeTargetDist.Normalize(); + swarmerChargeTargetDist *= swarmerChargeSpeed; + npc.velocity = (npc.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; if (Main.getGoodWorld && !Main.zenithWorld) npc.velocity *= 1.15f; @@ -5926,13 +5924,13 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.rotation = (npc.rotation * rotationMult * 0.75f + npc.velocity.X * rotationAmt * 1.25f) / 8f; - Vector2 vector242 = Main.player[npc.target].Center - npc.Center; - vector242.Y -= 8f; - float scaleFactor22 = bossMinion ? 18f : 14f; - float num1379 = 8f; - vector242.Normalize(); - vector242 *= scaleFactor22; - npc.velocity = (npc.velocity * (num1379 - 1f) + vector242) / num1379; + Vector2 swarmerDecelerateTargetDist = Main.player[npc.target].Center - npc.Center; + swarmerDecelerateTargetDist.Y -= 8f; + float swarmerDecelerateSpeed = bossMinion ? 18f : 14f; + float swarmerDecelerateVelMult = 8f; + swarmerDecelerateTargetDist.Normalize(); + swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; + npc.velocity = (npc.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; if (Main.getGoodWorld && !Main.zenithWorld) npc.velocity *= 1.15f; @@ -5946,7 +5944,7 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; if (npc.ai[1] > 10f) { - npc.velocity = vector242; + npc.velocity = swarmerDecelerateTargetDist; if (Main.getGoodWorld && !Main.zenithWorld) npc.velocity *= 1.15f; @@ -5971,8 +5969,7 @@ namespace CalamityMod.NPCs npc.velocity *= 1.01f; npc.ai[1] += 1f; - int num1380 = 30; - if (npc.ai[1] > num1380) + if (npc.ai[1] > 30) { if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) { @@ -5982,7 +5979,7 @@ namespace CalamityMod.NPCs return; } - if (npc.ai[1] > (num1380 * 2)) + if (npc.ai[1] > 60) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -6124,16 +6121,15 @@ namespace CalamityMod.NPCs float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; float sharkronVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; - int num9 = 120; - int num10 = 180; - int num12 = 30; + int attackTimer = 120; + int phaseTransitionTimer = 180; + int teleportPauseTimer = 30; int toothBallSpinPhaseDivisor = bossRush ? 27 : death ? 32 : 45; - int num13 = maxToothBallBelches * toothBallSpinPhaseDivisor; - float spinTime = num13 / 2f; + int toothBallSpinTimer = maxToothBallBelches * toothBallSpinPhaseDivisor; + float spinTime = toothBallSpinTimer / 2f; float toothBallSpinToothBallVelocity = bossRush ? 14f : death ? 9.5f : 9f; - float scaleFactor4 = Main.zenithWorld ? 44f : 22f; - float num15 = MathHelper.TwoPi / spinTime; - int num16 = 75; + float spinAttackSpeed = Main.zenithWorld ? 44f : 22f; + float spinSpeed = MathHelper.TwoPi / spinTime; Player player = Main.player[npc.target]; @@ -6324,28 +6320,28 @@ namespace CalamityMod.NPCs } } - float num17 = (float)Math.Atan2(rotationVector.Y, rotationVector.X); + float dukeRotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); if (npc.spriteDirection == 1) - num17 += pie; - if (num17 < 0f) - num17 += MathHelper.TwoPi; - if (num17 > MathHelper.TwoPi) - num17 -= MathHelper.TwoPi; + dukeRotationSpeed += pie; + if (dukeRotationSpeed < 0f) + dukeRotationSpeed += MathHelper.TwoPi; + if (dukeRotationSpeed > MathHelper.TwoPi) + dukeRotationSpeed -= MathHelper.TwoPi; if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f) - num17 = 0f; + dukeRotationSpeed = 0f; if (npc.ai[0] == 8f || npc.ai[0] == 13f) - num17 = pie * 0.1666666667f * npc.spriteDirection; + dukeRotationSpeed = pie * 0.1666666667f * npc.spriteDirection; - if (npc.rotation < num17) + if (npc.rotation < dukeRotationSpeed) { - if (num17 - npc.rotation > pie) + if (dukeRotationSpeed - npc.rotation > pie) npc.rotation -= rateOfRotation; else npc.rotation += rateOfRotation; } - if (npc.rotation > num17) + if (npc.rotation > dukeRotationSpeed) { - if (npc.rotation - num17 > pie) + if (npc.rotation - dukeRotationSpeed > pie) npc.rotation += rateOfRotation; else npc.rotation -= rateOfRotation; @@ -6353,14 +6349,14 @@ namespace CalamityMod.NPCs if ((npc.ai[0] != 8f && npc.ai[0] != 13f) || npc.spriteDirection == 1) { - if (npc.rotation > num17 - rateOfRotation && npc.rotation < num17 + rateOfRotation) - npc.rotation = num17; + if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) + npc.rotation = dukeRotationSpeed; if (npc.rotation < 0f) npc.rotation += MathHelper.TwoPi; if (npc.rotation > MathHelper.TwoPi) npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > num17 - rateOfRotation && npc.rotation < num17 + rateOfRotation) - npc.rotation = num17; + if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) + npc.rotation = dukeRotationSpeed; } // Alpha adjustments @@ -6385,10 +6381,10 @@ namespace CalamityMod.NPCs npc.velocity *= 0.98f; // Direction - int num19 = Math.Sign(player.Center.X - npc.Center.X); - if (num19 != 0) + int dukeFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (dukeFaceDirection != 0) { - npc.direction = num19; + npc.direction = dukeFaceDirection; npc.spriteDirection = -npc.direction; } @@ -6408,24 +6404,24 @@ namespace CalamityMod.NPCs } // Spawn dust and play sound - if (npc.ai[2] == num9 - 30) + if (npc.ai[2] == attackTimer - 30) { - int num20 = 36; - for (int i = 0; i < num20; i++) + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) { - Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (num20 / 2 - 1)) * MathHelper.TwoPi / num20) + npc.Center; + Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + npc.Center; Vector2 vector2 = dust - npc.Center; - int num21 = Dust.NewDust(dust + vector2, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); - Main.dust[num21].noGravity = true; - Main.dust[num21].noLight = true; - Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; + int toxicDust = Dust.NewDust(dust + vector2, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); + Main.dust[toxicDust].noGravity = true; + Main.dust[toxicDust].noLight = true; + Main.dust[toxicDust].velocity = Vector2.Normalize(vector2) * 3f; } modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); } npc.ai[2] += 1f; - if (npc.ai[2] >= num16) + if (npc.ai[2] >= 75) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -6441,17 +6437,17 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(vector3, idlePhaseAcceleration); + Vector2 phase1IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(phase1IdleSpeed, idlePhaseAcceleration); // Rotation and direction - int num22 = Math.Sign(player.Center.X - npc.Center.X); - if (num22 != 0) + int dukeLookAt = Math.Sign(player.Center.X - npc.Center.X); + if (dukeLookAt != 0) { - if (npc.ai[2] == 0f && num22 != npc.direction) + if (npc.ai[2] == 0f && dukeLookAt != npc.direction) npc.rotation += pie; - npc.direction = num22; + npc.direction = dukeLookAt; if (npc.spriteDirection != -npc.direction) npc.rotation += pie; @@ -6465,7 +6461,7 @@ namespace CalamityMod.NPCs npc.ai[2] += 1f; if (npc.ai[2] >= idlePhaseTimer || (phase2 && !phase2AI)) { - int num23 = 0; + int oldDukeAttackPicker = 0; switch ((int)npc.ai[3]) { case 0: @@ -6474,23 +6470,23 @@ namespace CalamityMod.NPCs case 3: case 4: case 5: - num23 = 1; + oldDukeAttackPicker = 1; break; case 6: npc.ai[3] = 1f; - num23 = 2; + oldDukeAttackPicker = 2; break; case 7: npc.ai[3] = 0f; - num23 = 3; + oldDukeAttackPicker = 3; break; } if (phase2) - num23 = 4; + oldDukeAttackPicker = 4; // Set velocity for charge - if (num23 == 1) + if (oldDukeAttackPicker == 1) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -6502,9 +6498,9 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction - if (num22 != 0) + if (dukeLookAt != 0) { - npc.direction = num22; + npc.direction = dukeLookAt; if (npc.spriteDirection == 1) npc.rotation += pie; @@ -6514,7 +6510,7 @@ namespace CalamityMod.NPCs } // Tooth Balls - else if (num23 == 2) + else if (oldDukeAttackPicker == 2) { npc.ai[0] = 2f; npc.ai[1] = 0f; @@ -6522,7 +6518,7 @@ namespace CalamityMod.NPCs } // Call sharks from the sides of the screen - else if (num23 == 3) + else if (oldDukeAttackPicker == 3) { npc.ai[0] = 3f; npc.ai[1] = 0f; @@ -6530,7 +6526,7 @@ namespace CalamityMod.NPCs } // Go to phase 2 - else if (num23 == 4) + else if (oldDukeAttackPicker == 4) { npc.ai[0] = 4f; npc.ai[1] = 0f; @@ -6585,16 +6581,16 @@ namespace CalamityMod.NPCs } // Spawn dust - int num24 = 7; - for (int j = 0; j < num24; j++) + int chargeDustAmt = 7; + for (int j = 0; j < chargeDustAmt; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * pie / num24) + npc.Center; + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (chargeDustAmt / 2 - 1)) * pie / chargeDustAmt) + npc.Center; Vector2 vector4 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; + int chargeDust = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); + Main.dust[chargeDust].noGravity = true; + Main.dust[chargeDust].noLight = true; + Main.dust[chargeDust].velocity /= 4f; + Main.dust[chargeDust].velocity -= npc.velocity; } npc.ai[2] += 1f; @@ -6617,8 +6613,8 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * toothBallBelchPhaseVelocity; - npc.SimpleFlyMovement(vector5, toothBallBelchPhaseAcceleration); + Vector2 toothBallBelchPhaseSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * toothBallBelchPhaseVelocity; + npc.SimpleFlyMovement(toothBallBelchPhaseSpeed, toothBallBelchPhaseAcceleration); // Play sounds and spawn Tooth Balls if (npc.ai[2] == 0f) @@ -6629,9 +6625,9 @@ namespace CalamityMod.NPCs if (npc.ai[2] != 0f) SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - Vector2 vector6 = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; + Vector2 toothBallDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; Vector2 toothBallVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * toothBallFinalVelocity; - Vector2 toothBallSpawnPos = new Vector2(vector6.X, vector6.Y + 45f); + Vector2 toothBallSpawnPos = new Vector2(toothBallDirection.X, toothBallDirection.Y + 45f); if (Main.netMode != NetmodeID.MultiplayerClient) { int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); @@ -6672,10 +6668,10 @@ namespace CalamityMod.NPCs } // Direction - int num26 = Math.Sign(player.Center.X - npc.Center.X); - if (num26 != 0) + int toothBallLookAt = Math.Sign(player.Center.X - npc.Center.X); + if (toothBallLookAt != 0) { - npc.direction = num26; + npc.direction = toothBallLookAt; if (npc.spriteDirection != -npc.direction) npc.rotation += pie; npc.spriteDirection = -npc.direction; @@ -6701,10 +6697,10 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound and spawn sharks - if (npc.ai[2] == num9 - 30) + if (npc.ai[2] == attackTimer - 30) SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - if (npc.ai[2] >= num9 - 90) + if (npc.ai[2] >= attackTimer - 90) { if (npc.ai[2] % 18f == 0f) { @@ -6725,7 +6721,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num9) + if (npc.ai[2] >= attackTimer) { calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; calamityGlobalNPC.newAI[2] = 0f; @@ -6745,10 +6741,10 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Sound - if (npc.ai[2] == num10 - 60) + if (npc.ai[2] == phaseTransitionTimer - 60) modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - if (npc.ai[2] >= num10 - 60) + if (npc.ai[2] >= phaseTransitionTimer - 60) { if (npc.ai[2] % 18f == 0f) { @@ -6769,7 +6765,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num10) + if (npc.ai[2] >= phaseTransitionTimer) { calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; @@ -6790,17 +6786,17 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(vector8, idlePhaseAcceleration); + Vector2 dukePhase2IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(dukePhase2IdleSpeed, idlePhaseAcceleration); // Direction and rotation - int num27 = Math.Sign(player.Center.X - npc.Center.X); - if (num27 != 0) + int phase2FaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase2FaceDirection != 0) { - if (npc.ai[2] == 0f && num27 != npc.direction) + if (npc.ai[2] == 0f && phase2FaceDirection != npc.direction) npc.rotation += pie; - npc.direction = num27; + npc.direction = phase2FaceDirection; if (npc.spriteDirection != -npc.direction) npc.rotation += pie; @@ -6814,30 +6810,30 @@ namespace CalamityMod.NPCs npc.ai[2] += 1f; if (npc.ai[2] >= idlePhaseTimer || (phase3 && !phase3AI)) { - int num28 = 0; + int phase2AttackPicker = 0; switch ((int)npc.ai[3]) { case 0: case 1: case 2: case 3: - num28 = 1; + phase2AttackPicker = 1; break; case 4: npc.ai[3] = 1f; - num28 = 2; + phase2AttackPicker = 2; break; case 5: npc.ai[3] = 0f; - num28 = 3; + phase2AttackPicker = 3; break; } if (phase3) - num28 = 4; + phase2AttackPicker = 4; // Set velocity for charge - if (num28 == 1) + if (phase2AttackPicker == 1) { npc.ai[0] = 6f; npc.ai[1] = 0f; @@ -6849,9 +6845,9 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction - if (num27 != 0) + if (phase2FaceDirection != 0) { - npc.direction = num27; + npc.direction = phase2FaceDirection; if (npc.spriteDirection == 1) npc.rotation += pie; @@ -6861,16 +6857,16 @@ namespace CalamityMod.NPCs } // Set velocity for spin - else if (num28 == 2) + else if (phase2AttackPicker == 2) { // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * scaleFactor4; + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction - if (num27 != 0) + if (phase2FaceDirection != 0) { - npc.direction = num27; + npc.direction = phase2FaceDirection; if (npc.spriteDirection == 1) npc.rotation += pie; @@ -6883,7 +6879,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; } - else if (num28 == 3) + else if (phase2AttackPicker == 3) { npc.ai[0] = 8f; npc.ai[1] = 0f; @@ -6891,7 +6887,7 @@ namespace CalamityMod.NPCs } // Go to next phase - else if (num28 == 4) + else if (phase2AttackPicker == 4) { npc.ai[0] = 9f; npc.ai[1] = 0f; @@ -6946,16 +6942,16 @@ namespace CalamityMod.NPCs } // Spawn dust - int num29 = 7; - for (int k = 0; k < num29; k++) + int phase2ChargeDustAmt = 7; + for (int k = 0; k < phase2ChargeDustAmt; k++) { - Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (num29 / 2 - 1)) * pie / num29) + npc.Center; + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (phase2ChargeDustAmt / 2 - 1)) * pie / phase2ChargeDustAmt) + npc.Center; Vector2 vector9 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num30 = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); - Main.dust[num30].noGravity = true; - Main.dust[num30].noLight = true; - Main.dust[num30].velocity /= 4f; - Main.dust[num30].velocity -= npc.velocity; + int phase2ChargeDust = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); + Main.dust[phase2ChargeDust].noGravity = true; + Main.dust[phase2ChargeDust].noLight = true; + Main.dust[phase2ChargeDust].velocity /= 4f; + Main.dust[phase2ChargeDust].velocity -= npc.velocity; } npc.ai[2] += 1f; @@ -6991,9 +6987,9 @@ namespace CalamityMod.NPCs if (npc.ai[2] != 0f) SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; + Vector2 phase2ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Vector2 toothBallSpawnPos = new Vector2(vector10.X, vector10.Y + 45f); + Vector2 toothBallSpawnPos = new Vector2(phase2ToothBallDirection.X, phase2ToothBallDirection.Y + 45f); if (Main.netMode != NetmodeID.MultiplayerClient) { int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); @@ -7036,11 +7032,11 @@ namespace CalamityMod.NPCs } // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)num15 * (float)npc.direction); - npc.rotation -= num15 * npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * (float)npc.direction); + npc.rotation -= spinSpeed * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= num13) + if (npc.ai[2] >= toothBallSpinTimer) { calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; npc.ai[0] = 5f; @@ -7059,13 +7055,13 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == num9 - 30) + if (npc.ai[2] == attackTimer - 30) { SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; + Vector2 phase2GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); int totalGore = Main.getGoodWorld ? 40 : 20; @@ -7080,12 +7076,12 @@ namespace CalamityMod.NPCs velocityY *= Main.rand.NextFloat() + 0.5f; } - Projectile.NewProjectile(npc.GetSource_FromAI(), vector7.X, vector7.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), phase2GoreDirection.X, phase2GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } - if (npc.ai[2] >= num9 - 90) + if (npc.ai[2] >= attackTimer - 90) { if (npc.ai[2] % 18f == 0f) { @@ -7101,7 +7097,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num9) + if (npc.ai[2] >= attackTimer) { calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; calamityGlobalNPC.newAI[2] = 0f; @@ -7121,10 +7117,10 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Sound - if (npc.ai[2] == num10 - 60) + if (npc.ai[2] == phaseTransitionTimer - 60) modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - if (npc.ai[2] >= num10 - 60) + if (npc.ai[2] >= phaseTransitionTimer - 60) { if (npc.ai[2] % 18f == 0f) { @@ -7145,7 +7141,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num10) + if (npc.ai[2] >= phaseTransitionTimer) { calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; @@ -7175,17 +7171,17 @@ namespace CalamityMod.NPCs npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); // Rotation and direction - int num32 = Math.Sign(player.Center.X - npc.Center.X); - if (num32 != 0) + int phase3FaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase3FaceDirection != 0) { - if (npc.ai[2] == 0f && num32 != npc.direction) + if (npc.ai[2] == 0f && phase3FaceDirection != npc.direction) { npc.rotation += pie; for (int l = 0; l < npc.oldPos.Length; l++) npc.oldPos[l] = Vector2.Zero; } - npc.direction = num32; + npc.direction = phase3FaceDirection; if (npc.spriteDirection != -npc.direction) npc.rotation += pie; @@ -7202,7 +7198,7 @@ namespace CalamityMod.NPCs npc.ai[2] += 1f; if (npc.ai[2] >= idlePhaseTimer) { - int num33 = 0; + int phase3AttackPicker = 0; switch ((int)npc.ai[3]) { case 0: @@ -7211,24 +7207,24 @@ namespace CalamityMod.NPCs case 5: case 6: case 7: - num33 = 1; + phase3AttackPicker = 1; break; case 1: case 8: - num33 = 2; + phase3AttackPicker = 2; break; case 4: npc.ai[3] = 1f; - num33 = 3; + phase3AttackPicker = 3; break; case 9: npc.ai[3] = 6f; - num33 = 4; + phase3AttackPicker = 4; break; } // Set velocity for charge - if (num33 == 1) + if (phase3AttackPicker == 1) { npc.ai[0] = 11f; npc.ai[1] = 0f; @@ -7240,9 +7236,9 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction - if (num32 != 0) + if (phase3FaceDirection != 0) { - npc.direction = num32; + npc.direction = phase3FaceDirection; if (npc.spriteDirection == 1) npc.rotation += pie; @@ -7252,14 +7248,14 @@ namespace CalamityMod.NPCs } // Pause - else if (num33 == 2) + else if (phase3AttackPicker == 2) { npc.ai[0] = 12f; npc.ai[1] = 0f; npc.ai[2] = 0f; } - else if (num33 == 3) + else if (phase3AttackPicker == 3) { npc.ai[0] = 13f; npc.ai[1] = 0f; @@ -7267,16 +7263,16 @@ namespace CalamityMod.NPCs } // Set velocity for spin - else if (num33 == 4) + else if (phase3AttackPicker == 4) { // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * scaleFactor4; + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction - if (num32 != 0) + if (phase3FaceDirection != 0) { - npc.direction = num32; + npc.direction = phase3FaceDirection; if (npc.spriteDirection == 1) npc.rotation += pie; @@ -7337,16 +7333,16 @@ namespace CalamityMod.NPCs } // Spawn dust - int num34 = 7; - for (int m = 0; m < num34; m++) + int phase3ChargeDustAmt = 7; + for (int m = 0; m < phase3ChargeDustAmt; m++) { - Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (num34 / 2 - 1)) * pie / num34) + npc.Center; + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (phase3ChargeDustAmt / 2 - 1)) * pie / phase3ChargeDustAmt) + npc.Center; Vector2 vector11 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num35 = Dust.NewDust(arg_2444_0 + vector11, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); - Main.dust[num35].noGravity = true; - Main.dust[num35].noLight = true; - Main.dust[num35].velocity /= 4f; - Main.dust[num35].velocity -= npc.velocity; + int phase3ChargeDust = Dust.NewDust(arg_2444_0 + vector11, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); + Main.dust[phase3ChargeDust].noGravity = true; + Main.dust[phase3ChargeDust].noLight = true; + Main.dust[phase3ChargeDust].velocity /= 4f; + Main.dust[phase3ChargeDust].velocity -= npc.velocity; } npc.ai[2] += 1f; @@ -7369,7 +7365,7 @@ namespace CalamityMod.NPCs npc.damage = 0; // Alpha - if (npc.alpha < 255 && npc.ai[2] >= num12 - 15f) + if (npc.alpha < 255 && npc.ai[2] >= teleportPauseTimer - 15f) { npc.alpha += 17; if (npc.alpha > 255) @@ -7381,10 +7377,10 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == num12 / 2) + if (npc.ai[2] == teleportPauseTimer / 2) modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num12 / 2) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPauseTimer / 2) { // Teleport location if (npc.ai[1] == 0f) @@ -7393,17 +7389,17 @@ namespace CalamityMod.NPCs // Rotation and direction Vector2 center = player.Center + new Vector2(npc.ai[1], -300f); Vector2 npcCenter = npc.Center = center; - int num36 = Math.Sign(player.Center.X - npcCenter.X); - if (num36 != 0) + int phase3TeleportFaceDirection = Math.Sign(player.Center.X - npcCenter.X); + if (phase3TeleportFaceDirection != 0) { - if (npc.ai[2] == 0f && num36 != npc.direction) + if (npc.ai[2] == 0f && phase3TeleportFaceDirection != npc.direction) { npc.rotation += pie; for (int n = 0; n < npc.oldPos.Length; n++) npc.oldPos[n] = Vector2.Zero; } - npc.direction = num36; + npc.direction = phase3TeleportFaceDirection; if (npc.spriteDirection != -npc.direction) npc.rotation += pie; @@ -7413,7 +7409,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num12) + if (npc.ai[2] >= teleportPauseTimer) { npc.ai[0] = 10f; npc.ai[1] = 0f; @@ -7435,13 +7431,13 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == num9 - 30) + if (npc.ai[2] == attackTimer - 30) { SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; + Vector2 phase3GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); int totalGore = Main.getGoodWorld ? 40 : 20; @@ -7456,12 +7452,12 @@ namespace CalamityMod.NPCs velocityY *= Main.rand.NextFloat() + 0.5f; } - Projectile.NewProjectile(npc.GetSource_FromAI(), vector7.X, vector7.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), phase3GoreDirection.X, phase3GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } - if (npc.ai[2] >= num9 - 90) + if (npc.ai[2] >= attackTimer - 90) { if (npc.ai[2] % 18f == 0f) { @@ -7483,7 +7479,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num9) + if (npc.ai[2] >= attackTimer) { calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; calamityGlobalNPC.newAI[2] = 0f; @@ -7515,9 +7511,9 @@ namespace CalamityMod.NPCs if (npc.ai[2] != 0f) SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; + Vector2 phase3ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Vector2 toothBallSpawnPos = new Vector2(vector10.X, vector10.Y + 45f); + Vector2 toothBallSpawnPos = new Vector2(phase3ToothBallDirection.X, phase3ToothBallDirection.Y + 45f); if (Main.netMode != NetmodeID.MultiplayerClient) { int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); @@ -7560,11 +7556,11 @@ namespace CalamityMod.NPCs } // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)num15 * npc.direction); - npc.rotation -= num15 * npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * npc.direction); + npc.rotation -= spinSpeed * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= num13) + if (npc.ai[2] >= toothBallSpinTimer) { calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; npc.ai[0] = 10f; From fff3a1b673e0df34ea84cb9e701c6cd1a15a8ddb Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 27 Oct 2023 15:04:12 -0400 Subject: [PATCH 26/43] Fixed compile errors --- NPCs/Bumblebirb/Bumblefuck.cs | 26 ++++++++-------- NPCs/CalamityAI.cs | 6 ++-- NPCs/DesertScourge/DesertScourgeTail.cs | 3 +- .../Bosses/EaterOfWorldsAI.cs | 8 ++--- .../Bosses/EmpressofLightAI.cs | 14 ++++----- NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs | 6 ++-- .../VanillaNPCOverrides/Bosses/SkeletronAI.cs | 6 ++-- .../Bosses/SkeletronPrimeAI.cs | 2 +- .../Bosses/WallOfFleshAI.cs | 8 ++--- Projectiles/Boss/BirbAura.cs | 3 +- Projectiles/Boss/BrimstoneRay.cs | 3 +- Projectiles/Boss/BrimstoneTargetRay.cs | 3 +- Projectiles/Boss/ProvidenceHolyRay.cs | 5 ++-- Projectiles/Magic/DarkSparkBeam.cs | 3 +- Projectiles/Magic/LiquidBlade.cs | 2 +- Projectiles/Magic/LiquidBlade2.cs | 2 +- Projectiles/Melee/DragonRageStaff.cs | 3 +- Projectiles/Melee/NebulashFlail.cs | 3 +- Projectiles/Melee/RSSolarFlare.cs | 4 +-- Projectiles/Melee/TyphonsGreedStaff.cs | 2 +- .../Ranged/CorinthPrimeAirburstGrenade.cs | 8 ++--- Projectiles/Ranged/DWArrow.cs | 2 +- Projectiles/Ranged/DaemonsFlameBow.cs | 2 +- Projectiles/Ranged/FlakKrakenGun.cs | 2 +- Projectiles/Ranged/PhangasmBow.cs | 2 +- Projectiles/Ranged/PlanarRipperExplosion.cs | 4 +-- .../Ranged/PlanetaryAnnihilationProj.cs | 22 +++++++------- Projectiles/Ranged/PlasmaExplosion.cs | 4 +-- Projectiles/Ranged/SeasSearingBubble.cs | 4 +-- Projectiles/Ranged/SepticSkewerHarpoon.cs | 12 ++++---- Projectiles/Ranged/Shockblast.cs | 4 +-- Projectiles/Ranged/Sickness.cs | 4 +-- Projectiles/Rogue/CircletMark.cs | 2 +- Projectiles/Rogue/CircletTornado.cs | 2 +- Projectiles/Rogue/DestructionBolt.cs | 2 +- Projectiles/Summon/ForbiddenCircletEater.cs | 4 +-- Projectiles/Summon/SilvaCrystalExplosion.cs | 30 +++++++++---------- Projectiles/Summon/VileFeederSummon.cs | 2 +- Projectiles/Typeless/BlazingStarHeal.cs | 16 +++++----- 39 files changed, 123 insertions(+), 117 deletions(-) diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index f5dca66286..e7e58cbee3 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -230,7 +230,7 @@ namespace CalamityMod.NPCs.Bumblebirb Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Color color = drawColor; - Color drawColor = Color.White; + Color drawingColor = Color.White; float lerpDrawTransition = 0f; int newAITracker = 120; @@ -263,12 +263,12 @@ namespace CalamityMod.NPCs.Bumblebirb } if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) { - drawColor = Color.Yellow; + drawingColor = Color.Yellow; lerpDrawTransition = 0.5f; } else { - color = drawColor; + color = drawingColor; } if (CalamityConfig.Instance.Afterimages) @@ -276,7 +276,7 @@ namespace CalamityMod.NPCs.Bumblebirb for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { Color afterimageColor = color; - afterimageColor = Color.Lerp(afterimageColor, drawColor, lerpDrawTransition); + afterimageColor = Color.Lerp(afterimageColor, drawingColor, lerpDrawTransition); afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; @@ -328,8 +328,8 @@ namespace CalamityMod.NPCs.Bumblebirb { for (int j = 0; j < extraAfterimageAmt; j++) { - Color extraAfterimageColor = drawColor; - extraAfterimageColor = Color.Lerp(extraAfterimageColor, drawColor, lerpDrawTransition); + Color extraAfterimageColor = drawingColor; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, drawingColor, lerpDrawTransition); extraAfterimageColor = NPC.GetAlpha(extraAfterimageColor); extraAfterimageColor *= 1f - extraAfterimageDampener; Vector2 extraAfterimageDrawPos = NPC.Center + ((float)j / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; @@ -339,19 +339,19 @@ namespace CalamityMod.NPCs.Bumblebirb } } - Color mainDrawingColor = drawColor; - mainDrawingColor = Color.Lerp(mainDrawingColor, drawColor, lerpDrawTransition); + Color mainDrawingColor = drawingColor; + mainDrawingColor = Color.Lerp(mainDrawingColor, drawingColor, lerpDrawTransition); mainDrawingColor = NPC.GetAlpha(mainDrawingColor); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(drawColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(drawingColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (phase2) { texture2D15 = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow").Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); - drawColor = Color.Red; + drawingColor = Color.Red; lerpDrawTransition = 1f; extraAfterimageDampener = 0.5f; @@ -362,7 +362,7 @@ namespace CalamityMod.NPCs.Bumblebirb { float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker; glowmaskDampener /= (float)buffColorDampener; - drawColor *= glowmaskDampener; + drawingColor *= glowmaskDampener; glowmaskColor *= glowmaskDampener; } @@ -371,7 +371,7 @@ namespace CalamityMod.NPCs.Bumblebirb for (int k = 1; k < afterimageAmt; k += afterimageIncrement) { Color glowmaskAfterimageColor = glowmaskColor; - glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, drawColor, lerpDrawTransition); + glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, drawingColor, lerpDrawTransition); glowmaskAfterimageColor *= (float)(afterimageAmt - k) / 15f; Vector2 glowmaskAfterimageDrawPos = NPC.oldPos[k] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; @@ -382,7 +382,7 @@ namespace CalamityMod.NPCs.Bumblebirb for (int l = 1; l < extraAfterimageAmt; l++) { Color extraGlowmaskAfterimageColor = glowmaskColor; - extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, drawColor, lerpDrawTransition); + extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, drawingColor, lerpDrawTransition); extraGlowmaskAfterimageColor = NPC.GetAlpha(extraGlowmaskAfterimageColor); extraGlowmaskAfterimageColor *= 1f - extraAfterimageDampener; Vector2 extraGlowmaskAfterimageDrawPos = NPC.Center + ((float)l / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 1862ef59e5..8f9f23e90b 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -3347,12 +3347,12 @@ namespace CalamityMod.NPCs { teleportTries++; int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6); - int teleportTileX = Main.rand.Next(point4.Y - 5, point4.Y); + int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y); - if (!Main.tile[teleportTileX, teleportTileX].HasUnactuatedTile) + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) { npc.ai[1] = teleportTileX * 16 + 8; - npc.ai[3] = teleportTileX * 16 + 16; + npc.ai[3] = teleportTileY * 16 + 16; break; } } diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 733473bad9..cf3751c621 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -131,8 +131,7 @@ namespace CalamityMod.NPCs.DesertScourge } NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f; playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); - int playerDistance = NPC.width; - playerDistance = (playerDistance - (float)playerDistance) / playerDistance; + playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance; playerXPos *= playerDistance; playerYPos *= playerDistance; NPC.velocity = Vector2.Zero; diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs index 0a5dc04878..012513d062 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs @@ -107,10 +107,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float targetXDirection = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - cursedFlameDirection.X; float targetYDirection = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - cursedFlameDirection.Y; float projSpeed = 7f + enrageScale * 2f; - float targetDistance = (float)Math.Sqrt(targetXDirection * targetXDirection + targetYDirection * targetYDirection); - targetDistance = projSpeed / targetDistance; - targetXDirection *= targetDistance; - targetYDirection *= targetDistance; + float flameTargetDistance = (float)Math.Sqrt(targetXDirection * targetXDirection + targetYDirection * targetYDirection); + flameTargetDistance = projSpeed / flameTargetDistance; + targetXDirection *= flameTargetDistance; + targetYDirection *= flameTargetDistance; targetYDirection += npc.velocity.Y * 0.5f; targetXDirection += npc.velocity.X * 0.5f; cursedFlameDirection.X -= targetXDirection; diff --git a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs index 4f2bb4d12b..c24c27ac4a 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs @@ -456,7 +456,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } NPCAimedTarget targetData10 = npc.GetTargetData(); - Vector2 targetCenter = targetData10.Invalid ? npc.Center : targetData10.Center; + targetCenter = targetData10.Invalid ? npc.Center : targetData10.Center; if (npc.Distance(targetCenter + etherealLanceDistance) > movementDistanceGateValue) npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); @@ -559,7 +559,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses AI_120_HallowBoss_DoMagicEffect(npc.Center + magicSpawnOffset, 3, Utils.GetLerpValue(0f, 42f, npc.ai[1], clamped: true), npc); NPCAimedTarget targetData7 = npc.GetTargetData(); - Vector2 targetCenter = targetData7.Invalid ? npc.Center : targetData7.Center; + targetCenter = targetData7.Invalid ? npc.Center : targetData7.Center; if (npc.Distance(targetCenter + everlastingRainbowDistance) > movementDistanceGateValue) npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + everlastingRainbowDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); @@ -628,7 +628,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 position = npc.Center + sunDanceHoverOffset; NPCAimedTarget targetData2 = npc.GetTargetData(); - Vector2 targetCenter = targetData2.Invalid ? npc.Center : targetData2.Center; + targetCenter = targetData2.Invalid ? npc.Center : targetData2.Center; if (npc.Distance(targetCenter + sunDanceDistance) > movementDistanceGateValue) npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + sunDanceDistance).SafeNormalize(Vector2.Zero) * velocity * 0.3f, acceleration * 0.7f); @@ -637,13 +637,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int projectileType = ProjectileID.FairyQueenSunDance; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - int sunDanceDistance = (int)(npc.ai[1] / sunDanceGateValue); + int sunDanceDist = (int)(npc.ai[1] / sunDanceGateValue); int targetFloatDirection = (targetData2.Center.X > npc.Center.X) ? 1 : 0; float projAmount = phase2 ? 8f : 6f; float projRotation = 1f / projAmount; for (float j = 0f; j < 1f; j += projRotation) { - float projDirection = (j + projRotation * 0.5f + sunDanceDistance * projRotation * 0.5f) % 1f; + float projDirection = (j + projRotation * 0.5f + sunDanceDist * projRotation * 0.5f) % 1f; float ai = (float)Math.PI * 2f * (projDirection + targetFloatDirection); if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(npc.GetSource_FromAI(), position, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, ai, npc.whoAmI); @@ -946,7 +946,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } NPCAimedTarget targetData6 = npc.GetTargetData(); - Vector2 targetCenter = targetData6.Invalid ? npc.Center : targetData6.Center; + targetCenter = targetData6.Invalid ? npc.Center : targetData6.Center; if (npc.Distance(targetCenter + etherealLanceDistance) > movementDistanceGateValue) npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); @@ -962,7 +962,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses inverseTargetVel.SafeNormalize(-Vector2.UnitY); float spawnDistance = 100f + (k * 100f); - Vector2 targetCenter = targetData6.Center; + targetCenter = targetData6.Center; if (npc.Distance(targetCenter) > 2400f) continue; diff --git a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs index 50f65d1a90..f998269b25 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs @@ -1561,9 +1561,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (minHandFaceDirection.Y > maxHandFaceDirection.Y) Utils.Swap(ref minHandFaceDirection.Y, ref maxHandFaceDirection.Y); - Vector2 handVelocity = Vector2.Clamp(npc.Center + npc.velocity, minHandFaceDirection, maxHandFaceDirection); - if (handVelocity != npc.Center + npc.velocity) - npc.Center = handVelocity - npc.velocity; + Vector2 handVelocity2 = Vector2.Clamp(npc.Center + npc.velocity, minHandFaceDirection, maxHandFaceDirection); + if (handVelocity2 != npc.Center + npc.velocity) + npc.Center = handVelocity2 - npc.velocity; // Frames int handFrameTimer = handFrameCheck * 7; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index 8cfb3b2349..15fe1fe201 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -292,9 +292,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Collision.CanHit(skullFiringPos, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { float skullProjSpeed = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; - float skullProjTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - skullFiringPos.X; - float skullProjTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - skullFiringPos.Y; - float skullProjTargetDist = (float)Math.Sqrt(skullProjTargetX * skullProjTargetX + skullProjTargetY * skullProjTargetY); + skullProjTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - skullFiringPos.X; + skullProjTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - skullFiringPos.Y; + skullProjTargetDist = (float)Math.Sqrt(skullProjTargetX * skullProjTargetX + skullProjTargetY * skullProjTargetY); skullProjTargetDist = skullProjSpeed / skullProjTargetDist; skullProjTargetX *= skullProjTargetDist; skullProjTargetY *= skullProjTargetDist; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index fab85f1c45..6335f9ee37 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -426,7 +426,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 headCenter = npc.Center; if (Collision.CanHit(headCenter, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float enragedHeadSpeed = 7f; + enragedHeadSpeed = 7f; float enragedHeadSkullTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - headCenter.X + Main.rand.Next(-20, 21); float enragedHeadSkullTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - headCenter.Y + Main.rand.Next(-20, 21); float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); diff --git a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs index 8a233d561f..a904b3cf91 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs @@ -358,9 +358,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 mouthLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float mouthTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - mouthLocation.X; float mouthTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - mouthLocation.Y; - float mouthTargetY = (float)Math.Sqrt(mouthTargetX * mouthTargetX + mouthTargetY * mouthTargetY); - mouthTargetX *= mouthTargetY; - mouthTargetY *= mouthTargetY; + float mouthTargetDist = (float)Math.Sqrt(mouthTargetX * mouthTargetX + mouthTargetY * mouthTargetY); + mouthTargetX *= mouthTargetDist; + mouthTargetY *= mouthTargetDist; // Rotation based on direction if (npc.direction > 0) @@ -464,7 +464,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int hungryIncrement; for (int j = 0; j < 11; j = hungryIncrement + 1) { - hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + int hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[hungrySpawn].ai[0] = j * 0.1f - 0.05f; hungryIncrement = j; } diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index acf28018d7..8e4eb8689f 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -186,7 +186,8 @@ namespace CalamityMod.Projectiles.Boss { return true; } - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 80f * Projectile.scale, ref 0f)) + float reference = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 80f * Projectile.scale, ref reference)) { return true; } diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index ce405338e0..c2034a3e84 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -220,7 +220,8 @@ namespace CalamityMod.Projectiles.Boss { return true; } - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref 0f)) + float reference = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref reference)) { return true; } diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index a50b424938..f662befc2c 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -166,7 +166,8 @@ namespace CalamityMod.Projectiles.Boss { return true; } - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref 0f)) + float reference = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref reference)) { return true; } diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 8f7042980f..382c5620bf 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -198,8 +198,9 @@ namespace CalamityMod.Projectiles.Boss { if (projHitbox.Intersects(targetHitbox)) return true; - - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref 0f)) + + float reference = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref reference)) return true; return false; diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 246baa1deb..a662a09a01 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -281,7 +281,8 @@ namespace CalamityMod.Projectiles.Magic if (projHitbox.Intersects(targetHitbox)) return true; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref 0f)) + float reference = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref reference)) return true; return false; diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index f5d449a3cd..4859ded5cf 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Magic { Color alphaColor = colorArea; alphaColor = Projectile.GetAlpha(alphaColor); - alphaColor *= (float)(num156 - i) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + alphaColor *= (float)(3 - i) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); Vector2 oldPosition = Projectile.oldPos[i]; float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index 17101ae26c..01552c0385 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Magic { Color alphaColor = colorArea; alphaColor = Projectile.GetAlpha(alphaColor); - alphaColor *= (float)(num156 - j) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + alphaColor *= (float)(3 - j) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); Vector2 oldPosition = Projectile.oldPos[j]; float projRotation = Projectile.rotation; SpriteEffects effects = spriteEffects; diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index cdb81fb540..5439eb421a 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -242,7 +242,8 @@ namespace CalamityMod.Projectiles.Melee } float spinning = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); float staffRadiusHit = 110f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + spinning.ToRotationVector2() * -staffRadiusHit, Projectile.Center + spinning.ToRotationVector2() * staffRadiusHit, 23f * Projectile.scale, ref 0f)) + float reference = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + spinning.ToRotationVector2() * -staffRadiusHit, Projectile.Center + spinning.ToRotationVector2() * staffRadiusHit, 23f * Projectile.scale, ref reference)) { return true; } diff --git a/Projectiles/Melee/NebulashFlail.cs b/Projectiles/Melee/NebulashFlail.cs index ecac7d81ad..7cecb49ddd 100644 --- a/Projectiles/Melee/NebulashFlail.cs +++ b/Projectiles/Melee/NebulashFlail.cs @@ -40,7 +40,8 @@ namespace CalamityMod.Projectiles.Melee { return true; } - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref 0f)) + float reference = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref reference)) { return true; } diff --git a/Projectiles/Melee/RSSolarFlare.cs b/Projectiles/Melee/RSSolarFlare.cs index 11dddd101d..6dbe19d7fa 100644 --- a/Projectiles/Melee/RSSolarFlare.cs +++ b/Projectiles/Melee/RSSolarFlare.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee 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 i = 0; i < 20; i++) + for (int j = 0; j < 20; j++) { int shiny = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); Main.dust[shiny].velocity *= 3f; @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[shiny].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int j = 0; j < 35; j++) + for (int k = 0; k < 35; k++) { int shiny2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1f); Main.dust[shiny2].noGravity = true; diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 778538f088..e639bcfc11 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -3,7 +3,7 @@ using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using System; using Terraria; -using Terraria.EnumTimers; +using Terraria.Enums; using Terraria.Localization; using Terraria.ModLoader; diff --git a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs index d426321caa..85e5b57efc 100644 --- a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs +++ b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs @@ -156,9 +156,9 @@ namespace CalamityMod.Projectiles.Ranged if (i < 100) circleSize = 4f; - int dust = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); - float dustX = Main.dust[dust].velocity.X; - float dustY = Main.dust[dust].velocity.Y; + int circleDust = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); + float dustX = Main.dust[circleDust].velocity.X; + float dustY = Main.dust[circleDust].velocity.Y; if (dustX == 0f && dustY == 0f) dustX = 1f; @@ -187,7 +187,7 @@ namespace CalamityMod.Projectiles.Ranged break; } - Dust dust = Main.dust[dust]; + Dust dust = Main.dust[circleDust]; dust.velocity *= 0.5f; dust.velocity.X += dustX; dust.velocity.Y += dustY; diff --git a/Projectiles/Ranged/DWArrow.cs b/Projectiles/Ranged/DWArrow.cs index 376969fc5c..20e9cc8714 100644 --- a/Projectiles/Ranged/DWArrow.cs +++ b/Projectiles/Ranged/DWArrow.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust dusty = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dusty.velocity = Vector2.Zero; - dusty.position -= Projectile.velocity / 5f * (float)num121; + dusty.position -= Projectile.velocity / 5f * (float)i; dusty.noGravity = true; dusty.scale = 0.8f; dusty.noLight = true; diff --git a/Projectiles/Ranged/DaemonsFlameBow.cs b/Projectiles/Ranged/DaemonsFlameBow.cs index 9bcaff3be6..56cf535067 100644 --- a/Projectiles/Ranged/DaemonsFlameBow.cs +++ b/Projectiles/Ranged/DaemonsFlameBow.cs @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Ranged } } Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.rotation = Projectile.velocity.ToRotation() + pi; Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; player.ChangeDir(Projectile.direction); diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index ae9a3bbd5f..9a0413d4b7 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Ranged } } Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.rotation = Projectile.velocity.ToRotation() + pi; Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; player.ChangeDir(Projectile.direction); diff --git a/Projectiles/Ranged/PhangasmBow.cs b/Projectiles/Ranged/PhangasmBow.cs index 28c11d8355..7ef39b949a 100644 --- a/Projectiles/Ranged/PhangasmBow.cs +++ b/Projectiles/Ranged/PhangasmBow.cs @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Ranged } } Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.rotation = Projectile.velocity.ToRotation() + pi; Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; player.ChangeDir(Projectile.direction); diff --git a/Projectiles/Ranged/PlanarRipperExplosion.cs b/Projectiles/Ranged/PlanarRipperExplosion.cs index 5c2eb17c38..7d6cdf2efe 100644 --- a/Projectiles/Ranged/PlanarRipperExplosion.cs +++ b/Projectiles/Ranged/PlanarRipperExplosion.cs @@ -49,8 +49,8 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[dust]; + int boomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[boomDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index 11e3d3efec..4cc9a67a80 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -80,20 +80,20 @@ namespace CalamityMod.Projectiles.Ranged int inc; for (int i = 0; i < 20; i = inc + 1) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, 2.1f); - Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[dust].noGravity = true; - Dust dust = Main.dust[dust]; + int planetDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, 2.1f); + Main.dust[planetDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[planetDust].noGravity = true; + Dust dust = Main.dust[planetDust]; dust.velocity *= 3f; - dust = Main.dust[dust]; + dust = Main.dust[planetDust]; dust.velocity += dustVel * Main.rand.NextFloat(); - dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.1f); - Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[dust]; + planetDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.1f); + Main.dust[planetDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust = Main.dust[planetDust]; dust.velocity *= 2f; - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - dust = Main.dust[dust]; + Main.dust[planetDust].noGravity = true; + Main.dust[planetDust].fadeIn = 1f; + dust = Main.dust[planetDust]; dust.velocity += dustVel * Main.rand.NextFloat(); inc = i; } diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index c579b5895d..6da0c4e9cd 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -77,9 +77,9 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, + int plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Projectile.ai[1] == 1f ? 173 : 221, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[dust]; + Dust dust = Main.dust[plasmaDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; diff --git a/Projectiles/Ranged/SeasSearingBubble.cs b/Projectiles/Ranged/SeasSearingBubble.cs index ac4c5e9213..08b0529cf8 100644 --- a/Projectiles/Ranged/SeasSearingBubble.cs +++ b/Projectiles/Ranged/SeasSearingBubble.cs @@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Ranged float dustVelX = Projectile.velocity.X / 3f * (float)i; float dustVelY = Projectile.velocity.Y / 3f * (float)i; int four = 4; - int dust = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); - Dust dust = Main.dust[dust]; + int seaDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); + Dust dust = Main.dust[seaDust]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 001bf2a433..65af1b6439 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -72,10 +72,10 @@ namespace CalamityMod.Projectiles.Ranged Vector2 halfDist = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float xDist = player.position.X + (float)(player.width / 2) - halfDist.X; float yDist = player.position.Y + (float)(player.height / 2) - halfDist.Y; - float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + float playerDistance = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (Projectile.ai[0] == 0f) { - if (playerDist > 2000f) + if (playerDistance > 2000f) { Projectile.ai[0] = 1f; } @@ -100,13 +100,13 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.rotation = (float)Math.Atan2((double)yDist, (double)xDist) - 1.57f; float returnSpeed = 20f; - if (playerDist < 50f) + if (playerDistance < 50f) { Projectile.Kill(); } - playerDist = returnSpeed / playerDist; - xDist *= playerDist; - yDist *= playerDist; + playerDistance = returnSpeed / playerDistance; + xDist *= playerDistance; + yDist *= playerDistance; Projectile.velocity.X = xDist; Projectile.velocity.Y = yDist; } diff --git a/Projectiles/Ranged/Shockblast.cs b/Projectiles/Ranged/Shockblast.cs index 95b8098c1d..1650910281 100644 --- a/Projectiles/Ranged/Shockblast.cs +++ b/Projectiles/Ranged/Shockblast.cs @@ -49,8 +49,8 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 185); - Dust dust = Main.dust[dust]; + int shockDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 185); + Dust dust = Main.dust[shockDust]; dust.scale = sizeMultiplier; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Ranged/Sickness.cs b/Projectiles/Ranged/Sickness.cs index ebe589bd6f..a36c6fc323 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -71,8 +71,8 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[dust]; + int sickDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[sickDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; diff --git a/Projectiles/Rogue/CircletMark.cs b/Projectiles/Rogue/CircletMark.cs index fe6813fcdc..781e30f5ac 100644 --- a/Projectiles/Rogue/CircletMark.cs +++ b/Projectiles/Rogue/CircletMark.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue dust.customData = Projectile.Center + dustMovement2; dust.fadeIn = 1f; dust.scale = 0.3f; - if (value81.X > -1.2f) + if (dustMovement.X > -1.2f) { dust.velocity.X = 1f + Main.rand.NextFloat(); } diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index 1f74f15205..c5289ddf8f 100644 --- a/Projectiles/Rogue/CircletTornado.cs +++ b/Projectiles/Rogue/CircletTornado.cs @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Rogue spinArea.Y = 0f; spinArea.X = 0f; spinArea += new Vector2(sizeModdingVector2.X, k) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(rectangle9), newSandYellow, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), newSandYellow, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index c92c67cfd2..544ca1c061 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue { Vector2 npcCenter = Main.npc[i].Center; float targetDist = Vector2.Distance(npcCenter, Projectile.Center); - if (targetDist < otherConstant && index == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) + if (targetDist < otherConstant && index == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, npcCenter, 1, 1)) { otherConstant = targetDist; index = i; diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index 8c901b2312..e39b5fe7a9 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -54,8 +54,8 @@ namespace CalamityMod.Projectiles.Summon int dustType = 159; float slowXVel = Projectile.velocity.X / 3f; float slowYVel = Projectile.velocity.Y / 3f; - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[dust]; + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[dusty]; dust.position.X = Projectile.Center.X - slowXVel; dust.position.Y = Projectile.Center.Y - slowYVel; dust.velocity *= 0f; diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index 10b0cae3c2..a5f632ca6e 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -170,13 +170,13 @@ namespace CalamityMod.Projectiles.Summon float dustCount; for (float i = 0f; i < rando; i = dustCount + 1f) { - int dust = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[dust].position = Projectile.Center; - Main.dust[dust].velocity = spinningpoint.RotatedBy((double)(6.28318548f * i / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 2f; - Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dustCloning = Dust.CloneDust(dust); + int killDust = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[killDust].position = Projectile.Center; + Main.dust[killDust].velocity = spinningpoint.RotatedBy((double)(6.28318548f * i / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[killDust].noGravity = true; + Main.dust[killDust].scale = 2f; + Main.dust[killDust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dustCloning = Dust.CloneDust(killDust); Dust dust = dustCloning; dust.scale /= 2f; dust = dustCloning; @@ -186,15 +186,15 @@ namespace CalamityMod.Projectiles.Summon } for (float j = 0f; j < rando; j = dustCount + 1f) { - int dust2 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[dust2].position = Projectile.Center; - Main.dust[dust2].velocity = spinningpoint.RotatedBy((double)(6.28318548f * j / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); - Dust dust = Main.dust[dust2]; + int killDust2 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[killDust2].position = Projectile.Center; + Main.dust[killDust2].velocity = spinningpoint.RotatedBy((double)(6.28318548f * j / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); + Dust dust = Main.dust[killDust2]; dust.velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].scale = Main.rand.NextFloat() * 1f; - Main.dust[dust2].fadeIn = Main.rand.NextFloat() * 2f; - Dust dustCloning2 = Dust.CloneDust(dust2); + Main.dust[killDust2].noGravity = true; + Main.dust[killDust2].scale = Main.rand.NextFloat() * 1f; + Main.dust[killDust2].fadeIn = Main.rand.NextFloat() * 2f; + Dust dustCloning2 = Dust.CloneDust(killDust2); dust = dustCloning2; dust.scale /= 2f; dust = dustCloning2; diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index d2bf443515..adf0cea5fa 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -233,7 +233,7 @@ namespace CalamityMod.Projectiles.Summon } if (projCount >= array2.Length) { - int projCount = 0; + projCount = 0; for (int m = 1; m < array2.Length; m++) { if (array2[m].Y < array2[projCount].Y) diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index 4d213b444a..53ac400cf8 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -76,15 +76,15 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(value, drawPos, null, healGreenDraw, (float)Math.PI / 2f, colorSize, scaledColorLerp1, spriteEffects, 0); - Main.EntitySpriteDraw(value, drawPos, null, healGreenDraw, 0f, colorSize, scaledColorLerp2, spriteEffects, 0); - Main.EntitySpriteDraw(value, drawPos, null, lesserHealGreen, (float)Math.PI / 2f, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, drawPos, null, lesserHealGreen, 0f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, (float)Math.PI / 2f, colorSize, scaledColorLerp1, spriteEffects, 0); + Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, 0f, colorSize, scaledColorLerp2, spriteEffects, 0); + Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, (float)Math.PI / 2f, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, 0f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, drawPos, null, healGreenDraw, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, drawPos, null, healGreenDraw, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(value, drawPos, null, lesserHealGreen, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(value, drawPos, null, lesserHealGreen, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.36f, spriteEffects, 0); return false; } From 01146fc498cb17a353b2e3a5aebcfa2671fa2f2c Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Sat, 28 Oct 2023 21:28:43 +0200 Subject: [PATCH 27/43] Increased Aerialite Pickaxe Pick Power. --- Items/Tools/SkyfringePickaxe.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index c4b3c3350d..b2286779fd 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Tools Item.knockBack = 2.5f; Item.useTime = 9; Item.useAnimation = 16; - Item.pick = 75; + Item.pick = 100; Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; From 08b62ac9daf2710669230a268a72844c61060c4f Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Sat, 28 Oct 2023 21:50:26 +0200 Subject: [PATCH 28/43] Profaned Guardians drop Unholy Essence. 10-15 Unholy Essence in Normal Mode. 15-20 Unholy Essence in Expert Mode and so on. --- NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 4809758d26..f886e52213 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -1189,6 +1189,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType()); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 10, 15, 15, 20)); // Furniture npcLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); From c3fde8b200ffebf0512aca24fdbfa20072369b0f Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Sat, 28 Oct 2023 22:33:06 +0200 Subject: [PATCH 29/43] Night Providence drops more Divine Geodes. Night Providence now drops another stack of 30-40 divine geodes directly, outside of the boss bag (I couldn't find a better way). --- NPCs/Providence/Providence.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 9e2177bce2..fdc3db5671 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -41,6 +41,7 @@ using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.UI; using Filters = Terraria.Graphics.Effects.Filters; namespace CalamityMod.NPCs.Providence @@ -1955,6 +1956,11 @@ namespace CalamityMod.NPCs.Providence Providence prov = info.npc.ModNPC(); return !prov.hasTakenDaytimeDamage; }, ModContent.ItemType(), 1, 4, 4, desc: DropHelper.ProvidenceNightText); + npcLoot.AddIf(info => + { + Providence prov = info.npc.ModNPC(); + return !prov.hasTakenDaytimeDamage; + }, ModContent.ItemType(), 1, 30, 40); // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); From 6a806e955f1445f157320a360322db5a4fe2043e Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Sat, 28 Oct 2023 23:50:53 +0200 Subject: [PATCH 30/43] Dimensional Soul Artifact gives 1.2x multiplicative damage. Done, the tester, will add the tooltip. --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index c062d21627..e51213fca4 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3132,7 +3132,7 @@ namespace CalamityMod.CalPlayer } if (dArtifact) - Player.GetDamage() += 0.25f; + Player.GetDamage() *= 1.2f; if (trippy) Player.GetDamage() += 0.5f; From d3497c411e8f8dc430aba0f3312f31b891595bdc Mon Sep 17 00:00:00 2001 From: Done2222 Date: Sun, 29 Oct 2023 00:56:36 +0300 Subject: [PATCH 31/43] Dimensional Soul Artifact tooltip change to fit the new change --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index c062d21627..e51213fca4 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3132,7 +3132,7 @@ namespace CalamityMod.CalPlayer } if (dArtifact) - Player.GetDamage() += 0.25f; + Player.GetDamage() *= 1.2f; if (trippy) Player.GetDamage() += 0.5f; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index fbba9f7208..ad85e536f2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -548,7 +548,7 @@ DimensionalSoulArtifact: { Tooltip: ''' Power - Boosts all damage by 25%, but at the cost of increasing damage taken by 15% + Multiplies all damage by 1.2x, but at the cost of increasing damage taken by 15% ''' } From 91645dd274f858976782d5a9f0d9786a0956c0fa Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 28 Oct 2023 21:52:31 -0400 Subject: [PATCH 32/43] Verified fixes for all num death to the best of my ability --- NPCs/Bumblebirb/Bumblefuck.cs | 40 +++++++------- NPCs/CalamityAI.cs | 52 +++++++++---------- .../Bosses/EmpressofLightAI.cs | 10 ++-- NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs | 14 +++-- .../VanillaNPCOverrides/Bosses/SkeletronAI.cs | 7 +-- .../Bosses/SkeletronPrimeAI.cs | 6 +-- Projectiles/Boss/BirbAura.cs | 16 +++--- Projectiles/Boss/BrimstoneRay.cs | 14 ++--- Projectiles/Boss/BrimstoneTargetRay.cs | 9 ++-- Projectiles/Boss/ProvidenceHolyRay.cs | 12 ++--- Projectiles/Magic/DarkSparkBeam.cs | 10 ++-- Projectiles/Magic/LiquidBlade.cs | 5 +- Projectiles/Melee/DragonRageStaff.cs | 12 ++--- Projectiles/Melee/NebulashFlail.cs | 6 +-- Projectiles/Melee/RSSolarFlare.cs | 10 ++-- Projectiles/Melee/TyphonsGreedStaff.cs | 4 +- .../Ranged/CorinthPrimeAirburstGrenade.cs | 18 +++---- Projectiles/Ranged/DWArrow.cs | 6 +-- Projectiles/Ranged/DaemonsFlameBow.cs | 4 +- Projectiles/Ranged/FlakKrakenGun.cs | 4 +- Projectiles/Ranged/PhangasmBow.cs | 6 +-- Projectiles/Ranged/PlanarRipperExplosion.cs | 6 +-- .../Ranged/PlanetaryAnnihilationProj.cs | 38 +++++++------- Projectiles/Ranged/PlasmaExplosion.cs | 12 ++--- Projectiles/Ranged/SeasSearingBubble.cs | 6 +-- Projectiles/Ranged/SepticSkewerHarpoon.cs | 7 +-- Projectiles/Ranged/Sickness.cs | 7 +-- Projectiles/Rogue/CircletMark.cs | 4 +- Projectiles/Rogue/CircletTornado.cs | 4 +- Projectiles/Rogue/DestructionBolt.cs | 3 +- Projectiles/Summon/ForbiddenCircletEater.cs | 9 ++-- Projectiles/Summon/SilvaCrystalExplosion.cs | 31 +++++------ Projectiles/Summon/VileFeederSummon.cs | 4 +- Projectiles/Typeless/BlazingStarHeal.cs | 8 +-- 34 files changed, 203 insertions(+), 201 deletions(-) diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index e7e58cbee3..5173fb793e 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -7,6 +9,7 @@ using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -16,16 +19,13 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Potions; namespace CalamityMod.NPCs.Bumblebirb { @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Bumblebirb value.Position.X += 20f; value.Position.Y += 8f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; @@ -85,7 +85,7 @@ namespace CalamityMod.NPCs.Bumblebirb bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck") }); } @@ -230,7 +230,7 @@ namespace CalamityMod.NPCs.Bumblebirb Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Color color = drawColor; - Color drawingColor = Color.White; + Color altColor = Color.White; float lerpDrawTransition = 0f; int newAITracker = 120; @@ -263,12 +263,12 @@ namespace CalamityMod.NPCs.Bumblebirb } if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) { - drawingColor = Color.Yellow; + altColor = Color.Yellow; lerpDrawTransition = 0.5f; } else { - color = drawingColor; + color = altColor; } if (CalamityConfig.Instance.Afterimages) @@ -276,7 +276,7 @@ namespace CalamityMod.NPCs.Bumblebirb for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { Color afterimageColor = color; - afterimageColor = Color.Lerp(afterimageColor, drawingColor, lerpDrawTransition); + afterimageColor = Color.Lerp(afterimageColor, altColor, lerpDrawTransition); afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; @@ -328,8 +328,8 @@ namespace CalamityMod.NPCs.Bumblebirb { for (int j = 0; j < extraAfterimageAmt; j++) { - Color extraAfterimageColor = drawingColor; - extraAfterimageColor = Color.Lerp(extraAfterimageColor, drawingColor, lerpDrawTransition); + Color extraAfterimageColor = altColor; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, altColor, lerpDrawTransition); extraAfterimageColor = NPC.GetAlpha(extraAfterimageColor); extraAfterimageColor *= 1f - extraAfterimageDampener; Vector2 extraAfterimageDrawPos = NPC.Center + ((float)j / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; @@ -339,19 +339,19 @@ namespace CalamityMod.NPCs.Bumblebirb } } - Color mainDrawingColor = drawingColor; - mainDrawingColor = Color.Lerp(mainDrawingColor, drawingColor, lerpDrawTransition); + Color mainDrawingColor = altColor; + mainDrawingColor = Color.Lerp(mainDrawingColor, altColor, lerpDrawTransition); mainDrawingColor = NPC.GetAlpha(mainDrawingColor); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(drawingColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(altColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (phase2) { texture2D15 = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow").Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); - drawingColor = Color.Red; + altColor = Color.Red; lerpDrawTransition = 1f; extraAfterimageDampener = 0.5f; @@ -362,7 +362,7 @@ namespace CalamityMod.NPCs.Bumblebirb { float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker; glowmaskDampener /= (float)buffColorDampener; - drawingColor *= glowmaskDampener; + altColor *= glowmaskDampener; glowmaskColor *= glowmaskDampener; } @@ -371,7 +371,7 @@ namespace CalamityMod.NPCs.Bumblebirb for (int k = 1; k < afterimageAmt; k += afterimageIncrement) { Color glowmaskAfterimageColor = glowmaskColor; - glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, drawingColor, lerpDrawTransition); + glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, altColor, lerpDrawTransition); glowmaskAfterimageColor *= (float)(afterimageAmt - k) / 15f; Vector2 glowmaskAfterimageDrawPos = NPC.oldPos[k] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; @@ -382,7 +382,7 @@ namespace CalamityMod.NPCs.Bumblebirb for (int l = 1; l < extraAfterimageAmt; l++) { Color extraGlowmaskAfterimageColor = glowmaskColor; - extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, drawingColor, lerpDrawTransition); + extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, altColor, lerpDrawTransition); extraGlowmaskAfterimageColor = NPC.GetAlpha(extraGlowmaskAfterimageColor); extraGlowmaskAfterimageColor *= 1f - extraAfterimageDampener; Vector2 extraGlowmaskAfterimageDrawPos = NPC.Center + ((float)l / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 8f9f23e90b..78d3b48537 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; @@ -12,9 +13,8 @@ using CalamityMod.NPCs.Bumblebirb; using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; using CalamityMod.Projectiles.Boss; @@ -22,12 +22,10 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using static CalamityMod.NPCs.ExoMechs.Ares.AresBody; namespace CalamityMod.NPCs { @@ -44,8 +42,8 @@ namespace CalamityMod.NPCs bool getFuckedAI = Main.zenithWorld; - if (head) - CalamityGlobalNPC.aquaticScourge = npc.whoAmI; + if (head) + CalamityGlobalNPC.aquaticScourge = npc.whoAmI; // Adjust hostility and stats bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; @@ -8057,11 +8055,11 @@ namespace CalamityMod.NPCs #endregion #region Swimming AI - // Passiveness: - // 0 = Catfish, Flounder, Frogfish, Viperfish, Moray Eel, Laserfish - // 1 = Blinded Angler - // 2 = Prism-Back, Toxic Minnow - // 3 = Sea Minnow + // Passiveness: + // 0 = Catfish, Flounder, Frogfish, Viperfish, Moray Eel, Laserfish + // 1 = Blinded Angler + // 2 = Prism-Back, Toxic Minnow + // 3 = Sea Minnow public static void PassiveSwimmingAI(NPC npc, Mod mod, int passiveness, float detectRange, float xSpeed, float ySpeed, float speedLimitX, float speedLimitY, float rotation, bool spriteFacesLeft = true) { if (spriteFacesLeft) @@ -8074,7 +8072,7 @@ namespace CalamityMod.NPCs { npc.TargetClosest(true); } - Player target = Main.player[npc.target]; + Player target = Main.player[npc.target]; if (npc.justHit && passiveness != 3) { npc.chaseable = true; @@ -8083,8 +8081,8 @@ namespace CalamityMod.NPCs { bool hasWetTarget = npc.chaseable; npc.TargetClosest(false); - target = Main.player[npc.target]; - // Player detection behavior + target = Main.player[npc.target]; + // Player detection behavior if (passiveness != 2) { if (npc.type == ModContent.NPCType()) @@ -8122,14 +8120,14 @@ namespace CalamityMod.NPCs hasWetTarget = false; } - // Swim back and forth + // Swim back and forth if (!hasWetTarget || passiveness == 2) { if (passiveness == 0) - { + { npc.TargetClosest(true); - target = Main.player[npc.target]; - } + target = Main.player[npc.target]; + } if (npc.collideX) { npc.velocity.X = npc.velocity.X * -1f; @@ -8157,14 +8155,14 @@ namespace CalamityMod.NPCs if (hasWetTarget && passiveness != 2) { npc.TargetClosest(true); - target = Main.player[npc.target]; - // Swim away from the player + target = Main.player[npc.target]; + // Swim away from the player if (passiveness == 3) { npc.velocity.X = npc.velocity.X - (float)npc.direction * xSpeed; npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * ySpeed; } - // Swim toward the player + // Swim toward the player else { npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 2f * xSpeed : CalamityWorld.revenge ? 1.5f * xSpeed : xSpeed); @@ -8202,7 +8200,7 @@ namespace CalamityMod.NPCs } } - // Flounder shoot Sulphuric Mist at the player + // Flounder shoot Sulphuric Mist at the player if (npc.type == ModContent.NPCType()) { if ((target.Center - npc.Center).Length() < 350f) @@ -8228,7 +8226,7 @@ namespace CalamityMod.NPCs } } - // Sea Minnows face away from the player + // Sea Minnows face away from the player if (npc.type == ModContent.NPCType()) { npc.direction *= -1; @@ -8236,7 +8234,7 @@ namespace CalamityMod.NPCs } else { - // No target behavior + // No target behavior npc.velocity.X += (float)npc.direction * 0.1f; if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) { @@ -8279,7 +8277,7 @@ namespace CalamityMod.NPCs } else { - // Out of water behavior + // Out of water behavior if (npc.velocity.Y == 0f) { npc.velocity.X = npc.velocity.X * 0.94f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs index c24c27ac4a..eeebea7535 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs @@ -1,12 +1,12 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -637,13 +637,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int projectileType = ProjectileID.FairyQueenSunDance; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - int sunDanceDist = (int)(npc.ai[1] / sunDanceGateValue); + int sunDanceExtension = (int)(npc.ai[1] / sunDanceGateValue); int targetFloatDirection = (targetData2.Center.X > npc.Center.X) ? 1 : 0; float projAmount = phase2 ? 8f : 6f; float projRotation = 1f / projAmount; for (float j = 0f; j < 1f; j += projRotation) { - float projDirection = (j + projRotation * 0.5f + sunDanceDist * projRotation * 0.5f) % 1f; + float projDirection = (j + projRotation * 0.5f + sunDanceExtension * projRotation * 0.5f) % 1f; float ai = (float)Math.PI * 2f * (projDirection + targetFloatDirection); if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(npc.GetSource_FromAI(), position, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, ai, npc.whoAmI); diff --git a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs index f998269b25..8efb918101 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs @@ -1,22 +1,20 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { + // This is the most horrible abomination of code I have ever seen in my life, by a fucking landslide. + // This took hours of my time to attempt to clean up, and quite frankly I'd be surprised if even half of it is accurate. + // I do not want to look at this crime against humanity for a very long time. -CIT public static class MoonLordAI { - - // This is the most horrible abomination of code I have ever seen in my life, by a fucking landslide. - // This took hours of my time to attempt to clean up, and quite frankly I'd be surprised if even half of it is accurate. - // I do not want to look at this crime against humanity for a very long time. -CIT - public static readonly SoundStyle DeathrayChargeSound = new("CalamityMod/Sounds/Custom/MoonLordLaserCharge"); public static bool BuffedMoonLordAI(NPC npc, Mod mod) diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index 15fe1fe201..c658223715 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -1,11 +1,11 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -288,6 +288,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 skullFiringPos = npc.Center; float skullProjTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - skullFiringPos.X; float skullProjTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - skullFiringPos.Y; + // Ozzatron: noticed this is unused. Leaving as-is for minimal touch. float skullProjTargetDist = (float)Math.Sqrt(skullProjTargetX * skullProjTargetX + skullProjTargetY * skullProjTargetY); if (Collision.CanHit(skullFiringPos, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index 6335f9ee37..a7eb64e482 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index 8e4eb8689f..65f3c62477 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -1,14 +1,14 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Boss { @@ -186,8 +186,8 @@ namespace CalamityMod.Projectiles.Boss { return true; } - float reference = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 80f * Projectile.scale, ref reference)) + float useless = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 80f * Projectile.scale, ref useless)) { return true; } diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index c2034a3e84..0ea9bcbaa3 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -1,17 +1,17 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; -using ReLogic.Content; namespace CalamityMod.Projectiles.Boss { @@ -220,8 +220,8 @@ namespace CalamityMod.Projectiles.Boss { return true; } - float reference = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref reference)) + float useless = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref useless)) { return true; } diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index f662befc2c..7b0aa10e12 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -1,12 +1,13 @@ -using CalamityMod.NPCs.BrimstoneElemental; +using System.IO; +using CalamityMod.NPCs.BrimstoneElemental; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System.IO; using Terraria; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class BrimstoneTargetRay : ModProjectile, ILocalizedModType @@ -166,8 +167,8 @@ namespace CalamityMod.Projectiles.Boss { return true; } - float reference = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref reference)) + float useless = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref useless)) { return true; } diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 382c5620bf..5baa4af276 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; using CalamityMod.NPCs; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; @@ -6,12 +7,11 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; using Terraria; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class ProvidenceHolyRay : ModProjectile, ILocalizedModType @@ -198,9 +198,9 @@ namespace CalamityMod.Projectiles.Boss { if (projHitbox.Intersects(targetHitbox)) return true; - - float reference = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref reference)) + + float useless = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref useless)) return true; return false; diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index a662a09a01..daf5eadd81 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Enums; using Terraria.GameContent.Shaders; @@ -281,8 +281,8 @@ namespace CalamityMod.Projectiles.Magic if (projHitbox.Intersects(targetHitbox)) return true; - float reference = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref reference)) + float useless = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref useless)) return true; return false; diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index 4859ded5cf..6e378be143 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -1,10 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 5439eb421a..5973f399e6 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -1,15 +1,15 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Enums; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner); } - Main.player[Projectile.owner].Calamity().dragonRageCooldown = 60; + Main.player[Projectile.owner].Calamity().dragonRageCooldown = 60; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -242,8 +242,8 @@ namespace CalamityMod.Projectiles.Melee } float spinning = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); float staffRadiusHit = 110f; - float reference = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + spinning.ToRotationVector2() * -staffRadiusHit, Projectile.Center + spinning.ToRotationVector2() * staffRadiusHit, 23f * Projectile.scale, ref reference)) + float useless = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + spinning.ToRotationVector2() * -staffRadiusHit, Projectile.Center + spinning.ToRotationVector2() * staffRadiusHit, 23f * Projectile.scale, ref useless)) { return true; } diff --git a/Projectiles/Melee/NebulashFlail.cs b/Projectiles/Melee/NebulashFlail.cs index 7cecb49ddd..04c51a2b4f 100644 --- a/Projectiles/Melee/NebulashFlail.cs +++ b/Projectiles/Melee/NebulashFlail.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee { @@ -40,8 +40,8 @@ namespace CalamityMod.Projectiles.Melee { return true; } - float reference = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref reference)) + float useless = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref useless)) { return true; } diff --git a/Projectiles/Melee/RSSolarFlare.cs b/Projectiles/Melee/RSSolarFlare.cs index 6dbe19d7fa..ca34f204d8 100644 --- a/Projectiles/Melee/RSSolarFlare.cs +++ b/Projectiles/Melee/RSSolarFlare.cs @@ -1,11 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; + namespace CalamityMod.Projectiles.Melee { public class RSSolarFlare : ModProjectile, ILocalizedModType @@ -84,10 +85,9 @@ namespace CalamityMod.Projectiles.Melee double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (Projectile.owner == Main.myPlayer) { - for (i = 0; i < 1; i++) + for (int i = 0; i < 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index e639bcfc11..6f2d25a352 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Enums; using Terraria.Localization; diff --git a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs index 85e5b57efc..b77d4e0bec 100644 --- a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs +++ b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; +using System; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.NPCs.ExoMechs.Ares; -using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -156,9 +156,9 @@ namespace CalamityMod.Projectiles.Ranged if (i < 100) circleSize = 4f; - int circleDust = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); - float dustX = Main.dust[circleDust].velocity.X; - float dustY = Main.dust[circleDust].velocity.Y; + int circleDustID = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); + float dustX = Main.dust[circleDustID].velocity.X; + float dustY = Main.dust[circleDustID].velocity.Y; if (dustX == 0f && dustY == 0f) dustX = 1f; @@ -187,7 +187,7 @@ namespace CalamityMod.Projectiles.Ranged break; } - Dust dust = Main.dust[circleDust]; + Dust dust = Main.dust[circleDustID]; dust.velocity *= 0.5f; dust.velocity.X += dustX; dust.velocity.Y += dustY; diff --git a/Projectiles/Ranged/DWArrow.cs b/Projectiles/Ranged/DWArrow.cs index 20e9cc8714..6889561097 100644 --- a/Projectiles/Ranged/DWArrow.cs +++ b/Projectiles/Ranged/DWArrow.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/DaemonsFlameBow.cs b/Projectiles/Ranged/DaemonsFlameBow.cs index 56cf535067..1a2fd7c368 100644 --- a/Projectiles/Ranged/DaemonsFlameBow.cs +++ b/Projectiles/Ranged/DaemonsFlameBow.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index 9a0413d4b7..88c4b779db 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Projectiles/Ranged/PhangasmBow.cs b/Projectiles/Ranged/PhangasmBow.cs index 7ef39b949a..22be884ad1 100644 --- a/Projectiles/Ranged/PhangasmBow.cs +++ b/Projectiles/Ranged/PhangasmBow.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/PhangasmGlow").Value; + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/PhangasmGlow").Value; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; diff --git a/Projectiles/Ranged/PlanarRipperExplosion.cs b/Projectiles/Ranged/PlanarRipperExplosion.cs index 7d6cdf2efe..bec0f941ad 100644 --- a/Projectiles/Ranged/PlanarRipperExplosion.cs +++ b/Projectiles/Ranged/PlanarRipperExplosion.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -49,8 +49,8 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int boomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[boomDust]; + int boomDustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[boomDustID]; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index 4cc9a67a80..ad825bdf44 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { @@ -80,31 +80,31 @@ namespace CalamityMod.Projectiles.Ranged int inc; for (int i = 0; i < 20; i = inc + 1) { - int planetDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, 2.1f); - Main.dust[planetDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[planetDust].noGravity = true; - Dust dust = Main.dust[planetDust]; + int dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, 2.1f); + Main.dust[dustID].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[dustID].noGravity = true; + Dust dust = Main.dust[dustID]; dust.velocity *= 3f; - dust = Main.dust[planetDust]; + dust = Main.dust[dustID]; dust.velocity += dustVel * Main.rand.NextFloat(); - planetDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.1f); - Main.dust[planetDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[planetDust]; + dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.1f); + Main.dust[dustID].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust = Main.dust[dustID]; dust.velocity *= 2f; - Main.dust[planetDust].noGravity = true; - Main.dust[planetDust].fadeIn = 1f; - dust = Main.dust[planetDust]; + Main.dust[dustID].noGravity = true; + Main.dust[dustID].fadeIn = 1f; + dust = Main.dust[dustID]; dust.velocity += dustVel * Main.rand.NextFloat(); inc = i; } for (int j = 0; j < 10; j = inc + 1) { - int extraDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); - Main.dust[extraDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; - Main.dust[extraDust].noGravity = true; - Dust dust = Main.dust[extraDust]; + int dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + Main.dust[dustID].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; + Main.dust[dustID].noGravity = true; + Dust dust = Main.dust[dustID]; dust.velocity *= 0.5f; - dust = Main.dust[extraDust]; + dust = Main.dust[dustID]; dust.velocity += dustVel * (0.6f + 0.6f * Main.rand.NextFloat()); inc = j; } diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index 6da0c4e9cd..13b04f4e6a 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -1,9 +1,10 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; + namespace CalamityMod.Projectiles.Ranged { public class PlasmaExplosion : ModProjectile, ILocalizedModType @@ -77,9 +78,8 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, - Projectile.ai[1] == 1f ? 173 : 221, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[plasmaDust]; + int dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Projectile.ai[1] == 1f ? 173 : 221, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[dustID]; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; diff --git a/Projectiles/Ranged/SeasSearingBubble.cs b/Projectiles/Ranged/SeasSearingBubble.cs index 08b0529cf8..b70e45ecf5 100644 --- a/Projectiles/Ranged/SeasSearingBubble.cs +++ b/Projectiles/Ranged/SeasSearingBubble.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Ranged float dustVelX = Projectile.velocity.X / 3f * (float)i; float dustVelY = Projectile.velocity.Y / 3f * (float)i; int four = 4; - int seaDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); - Dust dust = Main.dust[seaDust]; + int dustID = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); + Dust dust = Main.dust[dustID]; dust.noGravity = true; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 65af1b6439..26a209a962 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; + namespace CalamityMod.Projectiles.Ranged { public class SepticSkewerHarpoon : ModProjectile, ILocalizedModType diff --git a/Projectiles/Ranged/Sickness.cs b/Projectiles/Ranged/Sickness.cs index a36c6fc323..a0ef406d36 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -1,8 +1,9 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class Sickness : ModProjectile, ILocalizedModType @@ -71,8 +72,8 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int sickDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[sickDust]; + int dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.5f); + Dust dust = Main.dust[dustID]; dust.noGravity = true; dust.position.X = Projectile.Center.X; dust.position.Y = Projectile.Center.Y; diff --git a/Projectiles/Rogue/CircletMark.cs b/Projectiles/Rogue/CircletMark.cs index 781e30f5ac..8e5e9bbaa9 100644 --- a/Projectiles/Rogue/CircletMark.cs +++ b/Projectiles/Rogue/CircletMark.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index c5289ddf8f..b094a596d1 100644 --- a/Projectiles/Rogue/CircletTornado.cs +++ b/Projectiles/Rogue/CircletTornado.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 544ca1c061..d7dad8bd93 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -1,9 +1,10 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; + namespace CalamityMod.Projectiles.Rogue { public class DestructionBolt : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index e39b5fe7a9..6263c0dca4 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -1,7 +1,8 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class ForbiddenCircletEater : ModProjectile, ILocalizedModType @@ -54,8 +55,8 @@ namespace CalamityMod.Projectiles.Summon int dustType = 159; float slowXVel = Projectile.velocity.X / 3f; float slowYVel = Projectile.velocity.Y / 3f; - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[dusty]; + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[dustID]; dust.position.X = Projectile.Center.X - slowXVel; dust.position.Y = Projectile.Center.Y - slowYVel; dust.velocity *= 0f; diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index a5f632ca6e..07d00b3d43 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class SilvaCrystalExplosion : ModProjectile, ILocalizedModType @@ -170,13 +171,13 @@ namespace CalamityMod.Projectiles.Summon float dustCount; for (float i = 0f; i < rando; i = dustCount + 1f) { - int killDust = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[killDust].position = Projectile.Center; - Main.dust[killDust].velocity = spinningpoint.RotatedBy((double)(6.28318548f * i / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); - Main.dust[killDust].noGravity = true; - Main.dust[killDust].scale = 2f; - Main.dust[killDust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dustCloning = Dust.CloneDust(killDust); + int dustID = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[dustID].position = Projectile.Center; + Main.dust[dustID].velocity = spinningpoint.RotatedBy((double)(6.28318548f * i / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].scale = 2f; + Main.dust[dustID].fadeIn = Main.rand.NextFloat() * 2f; + Dust dustCloning = Dust.CloneDust(dustID); Dust dust = dustCloning; dust.scale /= 2f; dust = dustCloning; @@ -186,15 +187,15 @@ namespace CalamityMod.Projectiles.Summon } for (float j = 0f; j < rando; j = dustCount + 1f) { - int killDust2 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[killDust2].position = Projectile.Center; - Main.dust[killDust2].velocity = spinningpoint.RotatedBy((double)(6.28318548f * j / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); - Dust dust = Main.dust[killDust2]; + int dustID = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[dustID].position = Projectile.Center; + Main.dust[dustID].velocity = spinningpoint.RotatedBy((double)(6.28318548f * j / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); + Dust dust = Main.dust[dustID]; dust.velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[killDust2].noGravity = true; - Main.dust[killDust2].scale = Main.rand.NextFloat() * 1f; - Main.dust[killDust2].fadeIn = Main.rand.NextFloat() * 2f; - Dust dustCloning2 = Dust.CloneDust(killDust2); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].scale = Main.rand.NextFloat() * 1f; + Main.dust[dustID].fadeIn = Main.rand.NextFloat() * 2f; + Dust dustCloning2 = Dust.CloneDust(dustID); dust = dustCloning2; dust.scale /= 2f; dust = dustCloning2; diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index adf0cea5fa..92b93bf355 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -1,8 +1,8 @@ -using CalamityMod.CalPlayer; +using System.IO; using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index 53ac400cf8..c80b4406dd 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { From 85cf0268192a0f6505ff385fb58dd11087b17e96 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Sun, 29 Oct 2023 01:50:58 -0700 Subject: [PATCH 33/43] astral infection biome sight support --- Tiles/Astral/AstralClay.cs | 6 ++++++ Tiles/Astral/AstralDirt.cs | 6 ++++++ Tiles/Astral/AstralGrass.cs | 6 ++++++ Tiles/Astral/AstralMonolith.cs | 6 ++++++ Tiles/Astral/AstralNormalLargePiles.cs | 8 +++++++- Tiles/Astral/AstralNormalMediumPiles.cs | 8 +++++++- Tiles/Astral/AstralNormalSmallPiles.cs | 8 +++++++- Tiles/Astral/AstralNormalStalactite.cs | 8 +++++++- Tiles/Astral/AstralShortPlants.cs | 6 ++++++ Tiles/Astral/AstralStone.cs | 6 ++++++ Tiles/Astral/AstralTallPlants.cs | 6 ++++++ Tiles/Astral/AstralVines.cs | 6 ++++++ Tiles/Astral/NovaeSlag.cs | 6 ++++++ Tiles/AstralDesert/AstralDesertLargePiles.cs | 6 ++++++ Tiles/AstralDesert/AstralDesertMediumPiles.cs | 6 ++++++ Tiles/AstralDesert/AstralDesertSmallPiles.cs | 6 ++++++ Tiles/AstralDesert/AstralDesertStalactite.cs | 6 ++++++ Tiles/AstralDesert/AstralSand.cs | 6 ++++++ Tiles/AstralDesert/AstralSandstone.cs | 6 ++++++ Tiles/AstralDesert/CelestialRemains.cs | 6 ++++++ Tiles/AstralDesert/HardenedAstralSand.cs | 6 ++++++ Tiles/AstralSnow/AstralIce.cs | 6 ++++++ Tiles/AstralSnow/AstralIceLargePiles.cs | 6 ++++++ Tiles/AstralSnow/AstralIceMediumPiles.cs | 6 ++++++ Tiles/AstralSnow/AstralIceSmallPiles.cs | 6 ++++++ Tiles/AstralSnow/AstralIceStalactite.cs | 6 ++++++ Tiles/AstralSnow/AstralSnow.cs | 6 ++++++ 27 files changed, 166 insertions(+), 4 deletions(-) diff --git a/Tiles/Astral/AstralClay.cs b/Tiles/Astral/AstralClay.cs index 69116e461d..4d43e6e647 100644 --- a/Tiles/Astral/AstralClay.cs +++ b/Tiles/Astral/AstralClay.cs @@ -46,5 +46,11 @@ namespace CalamityMod.Tiles.Astral { num = fail ? 1 : 3; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index d795b831bc..6b5601c886 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -69,5 +69,11 @@ namespace CalamityMod.Tiles.Astral { num = fail ? 1 : 3; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralGrass.cs b/Tiles/Astral/AstralGrass.cs index 5286f4af9b..ed4b52e790 100644 --- a/Tiles/Astral/AstralGrass.cs +++ b/Tiles/Astral/AstralGrass.cs @@ -177,5 +177,11 @@ namespace CalamityMod.Tiles.Astral Main.tile[i, j].TileType = (ushort)ModContent.TileType(); } } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index 1b8d10f6d8..57559d0638 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -148,5 +148,11 @@ namespace CalamityMod.Tiles.Astral } return colour; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralNormalLargePiles.cs b/Tiles/Astral/AstralNormalLargePiles.cs index cda376ca8a..514260a871 100644 --- a/Tiles/Astral/AstralNormalLargePiles.cs +++ b/Tiles/Astral/AstralNormalLargePiles.cs @@ -47,6 +47,12 @@ namespace CalamityMod.Tiles.Astral Main.npc[worm].direction *= -1; Main.npc[worm].netUpdate = true; } - } + } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralNormalMediumPiles.cs b/Tiles/Astral/AstralNormalMediumPiles.cs index 5772be900a..8344033cd1 100644 --- a/Tiles/Astral/AstralNormalMediumPiles.cs +++ b/Tiles/Astral/AstralNormalMediumPiles.cs @@ -47,6 +47,12 @@ namespace CalamityMod.Tiles.Astral Main.npc[worm].direction *= -1; Main.npc[worm].netUpdate = true; } - } + } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralNormalSmallPiles.cs b/Tiles/Astral/AstralNormalSmallPiles.cs index d9b0d7ddc9..5ac16fc1d5 100644 --- a/Tiles/Astral/AstralNormalSmallPiles.cs +++ b/Tiles/Astral/AstralNormalSmallPiles.cs @@ -42,6 +42,12 @@ namespace CalamityMod.Tiles.Astral Main.npc[worm].direction *= -1; Main.npc[worm].netUpdate = true; } - } + } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralNormalStalactite.cs b/Tiles/Astral/AstralNormalStalactite.cs index 3532ec83f0..abb434845d 100644 --- a/Tiles/Astral/AstralNormalStalactite.cs +++ b/Tiles/Astral/AstralNormalStalactite.cs @@ -1,4 +1,4 @@ - + using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -45,5 +45,11 @@ namespace CalamityMod.Tiles.Astral { num = fail ? 1 : 4; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralShortPlants.cs b/Tiles/Astral/AstralShortPlants.cs index e8c7c0243e..9bc78c7804 100644 --- a/Tiles/Astral/AstralShortPlants.cs +++ b/Tiles/Astral/AstralShortPlants.cs @@ -64,5 +64,11 @@ namespace CalamityMod.Tiles.Astral yield return new Item(ModContent.ItemType()); } } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralStone.cs b/Tiles/Astral/AstralStone.cs index 84b6a2ef44..8516bb4c0d 100644 --- a/Tiles/Astral/AstralStone.cs +++ b/Tiles/Astral/AstralStone.cs @@ -57,5 +57,11 @@ namespace CalamityMod.Tiles.Astral { num = fail ? 1 : 3; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralTallPlants.cs b/Tiles/Astral/AstralTallPlants.cs index 14ed654c84..6560e98fe7 100644 --- a/Tiles/Astral/AstralTallPlants.cs +++ b/Tiles/Astral/AstralTallPlants.cs @@ -69,5 +69,11 @@ namespace CalamityMod.Tiles.Astral yield return new Item(ModContent.ItemType()); } } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/AstralVines.cs b/Tiles/Astral/AstralVines.cs index 3fc2c89f32..761bad74ab 100644 --- a/Tiles/Astral/AstralVines.cs +++ b/Tiles/Astral/AstralVines.cs @@ -57,5 +57,11 @@ namespace CalamityMod.Tiles.Astral g *= brightness; b *= brightness; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/Astral/NovaeSlag.cs b/Tiles/Astral/NovaeSlag.cs index 493ceafa35..01539703e5 100644 --- a/Tiles/Astral/NovaeSlag.cs +++ b/Tiles/Astral/NovaeSlag.cs @@ -62,5 +62,11 @@ namespace CalamityMod.Tiles.Astral { num = fail ? 1 : 3; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralDesert/AstralDesertLargePiles.cs b/Tiles/AstralDesert/AstralDesertLargePiles.cs index 789a696886..f4335c66b2 100644 --- a/Tiles/AstralDesert/AstralDesertLargePiles.cs +++ b/Tiles/AstralDesert/AstralDesertLargePiles.cs @@ -34,5 +34,11 @@ namespace CalamityMod.Tiles.AstralDesert { num = fail ? 1 : 4; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralDesert/AstralDesertMediumPiles.cs b/Tiles/AstralDesert/AstralDesertMediumPiles.cs index 175eed49ee..da7790fdc4 100644 --- a/Tiles/AstralDesert/AstralDesertMediumPiles.cs +++ b/Tiles/AstralDesert/AstralDesertMediumPiles.cs @@ -34,5 +34,11 @@ namespace CalamityMod.Tiles.AstralDesert { num = fail ? 1 : 4; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralDesert/AstralDesertSmallPiles.cs b/Tiles/AstralDesert/AstralDesertSmallPiles.cs index ce5d98155d..24e267dc3c 100644 --- a/Tiles/AstralDesert/AstralDesertSmallPiles.cs +++ b/Tiles/AstralDesert/AstralDesertSmallPiles.cs @@ -29,5 +29,11 @@ namespace CalamityMod.Tiles.AstralDesert { num = fail ? 1 : 4; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralDesert/AstralDesertStalactite.cs b/Tiles/AstralDesert/AstralDesertStalactite.cs index a242500ccd..92f7adf703 100644 --- a/Tiles/AstralDesert/AstralDesertStalactite.cs +++ b/Tiles/AstralDesert/AstralDesertStalactite.cs @@ -45,5 +45,11 @@ namespace CalamityMod.Tiles.AstralDesert { num = fail ? 1 : 4; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index c281d3ce3a..46c4c4fdb1 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -84,5 +84,11 @@ namespace CalamityMod.Tiles.AstralDesert { DustType = 108; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralDesert/AstralSandstone.cs b/Tiles/AstralDesert/AstralSandstone.cs index f57a84115d..c64c5bb851 100644 --- a/Tiles/AstralDesert/AstralSandstone.cs +++ b/Tiles/AstralDesert/AstralSandstone.cs @@ -55,5 +55,11 @@ namespace CalamityMod.Tiles.AstralDesert { num = fail ? 1 : 3; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralDesert/CelestialRemains.cs b/Tiles/AstralDesert/CelestialRemains.cs index f9657d46a8..03db9266b1 100644 --- a/Tiles/AstralDesert/CelestialRemains.cs +++ b/Tiles/AstralDesert/CelestialRemains.cs @@ -47,5 +47,11 @@ namespace CalamityMod.Tiles.AstralDesert { num = fail ? 1 : 3; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralDesert/HardenedAstralSand.cs b/Tiles/AstralDesert/HardenedAstralSand.cs index 9b9ba056e1..452b866c98 100644 --- a/Tiles/AstralDesert/HardenedAstralSand.cs +++ b/Tiles/AstralDesert/HardenedAstralSand.cs @@ -60,5 +60,11 @@ namespace CalamityMod.Tiles.AstralDesert { num = fail ? 1 : 3; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralSnow/AstralIce.cs b/Tiles/AstralSnow/AstralIce.cs index e5c5a893da..9d3ccb0c09 100644 --- a/Tiles/AstralSnow/AstralIce.cs +++ b/Tiles/AstralSnow/AstralIce.cs @@ -63,5 +63,11 @@ namespace CalamityMod.Tiles.AstralSnow TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); return true; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralSnow/AstralIceLargePiles.cs b/Tiles/AstralSnow/AstralIceLargePiles.cs index 52c63077db..6cd4787eb2 100644 --- a/Tiles/AstralSnow/AstralIceLargePiles.cs +++ b/Tiles/AstralSnow/AstralIceLargePiles.cs @@ -34,5 +34,11 @@ namespace CalamityMod.Tiles.AstralSnow { num = fail ? 1 : 4; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralSnow/AstralIceMediumPiles.cs b/Tiles/AstralSnow/AstralIceMediumPiles.cs index 536e1e0402..b418f845a4 100644 --- a/Tiles/AstralSnow/AstralIceMediumPiles.cs +++ b/Tiles/AstralSnow/AstralIceMediumPiles.cs @@ -34,5 +34,11 @@ namespace CalamityMod.Tiles.AstralSnow { num = fail ? 1 : 4; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralSnow/AstralIceSmallPiles.cs b/Tiles/AstralSnow/AstralIceSmallPiles.cs index 0f35bf2d49..153cdcf7b1 100644 --- a/Tiles/AstralSnow/AstralIceSmallPiles.cs +++ b/Tiles/AstralSnow/AstralIceSmallPiles.cs @@ -29,5 +29,11 @@ namespace CalamityMod.Tiles.AstralSnow { num = fail ? 1 : 4; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralSnow/AstralIceStalactite.cs b/Tiles/AstralSnow/AstralIceStalactite.cs index e5e04ea9b9..b877edd3cf 100644 --- a/Tiles/AstralSnow/AstralIceStalactite.cs +++ b/Tiles/AstralSnow/AstralIceStalactite.cs @@ -44,5 +44,11 @@ namespace CalamityMod.Tiles.AstralSnow { num = fail ? 1 : 4; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } diff --git a/Tiles/AstralSnow/AstralSnow.cs b/Tiles/AstralSnow/AstralSnow.cs index f10bdf21fe..2fcbde0bc9 100644 --- a/Tiles/AstralSnow/AstralSnow.cs +++ b/Tiles/AstralSnow/AstralSnow.cs @@ -53,5 +53,11 @@ namespace CalamityMod.Tiles.AstralSnow TileFraming.GetAdjacencyData(i, j, TileID.SnowBlock, out secondTileAdjacency[i, j]); return true; } + + public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) + { + sightColor = Color.Cyan; + return true; + } } } From 82ac1f2c2bd7014998d44b53afb17254c907db35 Mon Sep 17 00:00:00 2001 From: Done2222 Date: Sun, 29 Oct 2023 15:03:42 +0200 Subject: [PATCH 34/43] violence nerf --- Items/Weapons/Melee/Violence.cs | 2 +- Projectiles/Melee/ViolenceThrownProjectile.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Weapons/Melee/Violence.cs b/Items/Weapons/Melee/Violence.cs index f041aec66d..e4640a714f 100644 --- a/Items/Weapons/Melee/Violence.cs +++ b/Items/Weapons/Melee/Violence.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.height = Item.width = 142; - Item.damage = 404; + Item.damage = 435; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.useTurn = true; diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 0a0bbb4a60..7afda2d432 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 8; Projectile.tileCollide = false; } From be094a1055e179f3360f8e4534172cd382d48b93 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 29 Oct 2023 13:04:59 -0400 Subject: [PATCH 35/43] Fix Boss Checklist integration for EoW + Skeletron --- ModSupport/WeakReferenceSupport.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index b629b91164..4a3153c634 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1013,10 +1013,10 @@ namespace CalamityMod { { "Terraria KingSlime", new List() { ItemType(), ItemType() } }, { "Terraria EyeofCthulhu", new List() { ItemType(), ItemType() } }, - { "Terraria EaterofWorldsHead", new List() { ItemType(), ItemType(), ItemType() } }, + { "Terraria EaterofWorlds", new List() { ItemType(), ItemType(), ItemType() } }, { "Terraria BrainofCthulhu", new List() { ItemType(), ItemType(), ItemType() } }, { "Terraria QueenBee", new List() { ItemType(), ItemType() } }, - { "Terraria SkeletronHead", new List() { ItemType(), ItemType() } }, + { "Terraria Skeletron", new List() { ItemType(), ItemType() } }, { "Terraria WallofFlesh", new List() { ItemType(), ItemType(), ItemType(), ItemType() } }, { "Terraria QueenSlimeBoss", new List() { ItemType(), ItemType() } }, { "Terraria TheTwins", new List() { ItemType(), ItemType(), ItemType() } }, From 1267726354a83c388985ca916361e5268fb0b29a Mon Sep 17 00:00:00 2001 From: AquaSG Date: Sun, 29 Oct 2023 15:24:14 -0400 Subject: [PATCH 36/43] a small price to pay for no sound cutout --- Projectiles/Boss/IceBlast.cs | 2 +- Projectiles/Boss/IceBomb.cs | 2 +- Projectiles/Boss/IceRain.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index 5698e9a9dc..a7c65ab9d4 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); + //SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int i = 0; i < 5; i++) { int iceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, 0f, 0f, 0, default, 1f); diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index 83ce65be43..68c1303b1a 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); + //SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index b15d8e203d..8c97860c8b 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27 with { Volume = SoundID.Item27.Volume * 0.25f }, Projectile.Center); + //SoundEngine.PlaySound(SoundID.Item27 with { Volume = SoundID.Item27.Volume * 0.25f }, Projectile.Center); for (int j = 0; j < 3; j++) { int snowDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 76, 0f, 0f, 0, default, 1f); From c540277d68b04361ab67ae0d017a57e6e9c15d2e Mon Sep 17 00:00:00 2001 From: Done2222 Date: Mon, 30 Oct 2023 00:32:32 +0200 Subject: [PATCH 37/43] Terratomere buff --- Items/Weapons/Melee/Terratomere.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 1c8e2d744d..73678c2313 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 60; Item.height = 66; - Item.damage = 303; + Item.damage = 370; Item.DamageType = DamageClass.Melee; Item.useAnimation = 21; Item.useTime = 21; From 8a1dbfdfc0dc865c06f3e399c2124c989ad0c381 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 30 Oct 2023 16:49:26 -0400 Subject: [PATCH 38/43] Tyrant's Fury -> Brutal Carnage Also fixed tooltips still saying that the buff increases melee damage by 30% instead of 25% --- .../StatBuffs/{TyrantsFury.cs => BrutalCarnage.cs} | 4 ++-- .../{TyrantsFury.png => BrutalCarnage.png} | Bin CalPlayer/CalamityPlayer.cs | 6 +++--- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- Items/Weapons/Melee/BlightedCleaver.cs | 4 ++-- Items/Weapons/Melee/DefiledGreatsword.cs | 4 ++-- Localization/en-US/Mods.CalamityMod.Buffs.hjson | 10 +++++----- .../Mods.CalamityMod.Items.Weapons.Melee.hjson | 8 ++++---- 8 files changed, 19 insertions(+), 19 deletions(-) rename Buffs/StatBuffs/{TyrantsFury.cs => BrutalCarnage.cs} (80%) rename Buffs/StatBuffs/{TyrantsFury.png => BrutalCarnage.png} (100%) diff --git a/Buffs/StatBuffs/TyrantsFury.cs b/Buffs/StatBuffs/BrutalCarnage.cs similarity index 80% rename from Buffs/StatBuffs/TyrantsFury.cs rename to Buffs/StatBuffs/BrutalCarnage.cs index 3f5056cb03..8479469036 100644 --- a/Buffs/StatBuffs/TyrantsFury.cs +++ b/Buffs/StatBuffs/BrutalCarnage.cs @@ -3,7 +3,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { - public class TyrantsFury : ModBuff + public class BrutalCarnage : ModBuff { public override void SetStaticDefaults() { @@ -14,7 +14,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().tFury = true; + player.Calamity().brutalCarnage = true; } } } diff --git a/Buffs/StatBuffs/TyrantsFury.png b/Buffs/StatBuffs/BrutalCarnage.png similarity index 100% rename from Buffs/StatBuffs/TyrantsFury.png rename to Buffs/StatBuffs/BrutalCarnage.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 54a92f8cf7..e9c7fdd3b9 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -868,7 +868,7 @@ namespace CalamityMod.CalPlayer public bool xWrath = false; public bool graxDefense = false; public bool encased = false; - public bool tFury = false; + public bool brutalCarnage = false; public bool omniscience = false; public bool zerg = false; public bool zen = false; @@ -1890,7 +1890,7 @@ namespace CalamityMod.CalPlayer xWrath = false; graxDefense = false; encased = false; - tFury = false; + brutalCarnage = false; omniscience = false; zerg = false; zen = false; @@ -2344,7 +2344,7 @@ namespace CalamityMod.CalPlayer kamiBoost = false; graxDefense = false; encased = false; - tFury = false; + brutalCarnage = false; omniscience = false; zerg = false; zen = false; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index e51213fca4..ae559e4657 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2463,7 +2463,7 @@ namespace CalamityMod.CalPlayer Player.GetDamage() += 0.2f; } - if (tFury) + if (brutalCarnage) { Player.GetDamage() += 0.25f; Player.GetCritChance() += 10; diff --git a/Items/Weapons/Melee/BlightedCleaver.cs b/Items/Weapons/Melee/BlightedCleaver.cs index e377edbac6..d75e8fb973 100644 --- a/Items/Weapons/Melee/BlightedCleaver.cs +++ b/Items/Weapons/Melee/BlightedCleaver.cs @@ -40,13 +40,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - player.AddBuff(ModContent.BuffType(), 180); + player.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Venom, 150); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - player.AddBuff(ModContent.BuffType(), 180); + player.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Venom, 150); } diff --git a/Items/Weapons/Melee/DefiledGreatsword.cs b/Items/Weapons/Melee/DefiledGreatsword.cs index 1f82c57040..ce3095e430 100644 --- a/Items/Weapons/Melee/DefiledGreatsword.cs +++ b/Items/Weapons/Melee/DefiledGreatsword.cs @@ -63,13 +63,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - player.AddBuff(ModContent.BuffType(), 300); + player.AddBuff(ModContent.BuffType(), 300); target.AddBuff(BuffID.Venom, 150); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - player.AddBuff(ModContent.BuffType(), 300); + player.AddBuff(ModContent.BuffType(), 300); target.AddBuff(BuffID.Venom, 150); } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 14daa548aa..f2cf331ae8 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -692,6 +692,11 @@ BrimflameFrenzyBuff: { Description: Dark magic empowers your attacks at the cost of your life } +BrutalCarnage: { + DisplayName: Brutal Carnage + Description: 25% increased melee damage and 10% increased melee crit chance +} + ChiBuff: { DisplayName: Chi Description: You are more resilient @@ -868,11 +873,6 @@ TarraLifeRegen: { Description: Rapid healing } -TyrantsFury: { - DisplayName: Tyrant's Fury - Description: 30% increased melee damage and 10% increased melee crit chance -} - AndromedaCripple: { DisplayName: Andromeda Cripple Description: You're slow diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index c25613a835..4e44e2d64b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -1296,8 +1296,8 @@ DefiledGreatsword: { Tooltip: ''' Fires blazing, hyper, and sunlight blades - Gives the player the tyrant's fury buff on enemy hits - This buff increases melee damage by 30% and melee crit chance by 10% + Gives the player the Brutal Carnage buff on enemy hits + This buff increases melee damage by 25% and melee crit chance by 10% ''' } @@ -1316,8 +1316,8 @@ BlightedCleaver: { Tooltip: ''' Fires homing blazing blades - Gives the player the tyrant's fury buff on enemy hits - This buff increases melee damage by 30% and melee crit chance by 10% + Gives the player the Brutal Carnage buff on enemy hits + This buff increases melee damage by 25% and melee crit chance by 10% ''' } From 4dd6c720325eb7fc8172380cdce8c1724b05f9fb Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 30 Oct 2023 22:12:22 -0400 Subject: [PATCH 39/43] Haunted Scroll and Baleful Harvester resprites --- Items/Weapons/Melee/BalefulHarvester.cs | 4 ++-- Items/Weapons/Melee/BalefulHarvester.png | Bin 1531 -> 2335 bytes Items/Weapons/Summon/HauntedScroll.cs | 4 ++-- Items/Weapons/Summon/HauntedScroll.png | Bin 522 -> 572 bytes .../Melee/BalefulHarvesterProjectile.cs | 14 ++++++++++++-- .../Melee/BalefulHarvesterProjectile.png | Bin 509 -> 2138 bytes 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index c7e42b4d80..35015038ad 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.damage = 90; - Item.width = 66; - Item.height = 66; + Item.width = 74; + Item.height = 86; Item.scale = 1.5f; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/BalefulHarvester.png b/Items/Weapons/Melee/BalefulHarvester.png index d27a4c375f0d8f0bed9dcf60598beecd5b228c3c..7b97d34b12e3cd297dbf4d28bc49cac3be6bc7d7 100644 GIT binary patch literal 2335 zcmV+)3E=jLP)Px-*-1n}RCt{2oJ(w6R~g5DcV_IdW6xmM@gqrblawUnL6Ry!1X77WQHwyz3bA1U zDpaCE?E;CaJj4PC)OEXH(ICMFfyAm(p)CjmksxV_^1w+OhrCSU*l`>?lW{!b$6OZQ z{bqd5_4S-_oZy7>-+1ns`|{l1e6RDJ30Prm{NiSP87>^()RzwcE{znHJic;b3V@bu zD*)+K8i3}etg+vz^Jnk*UK>&BfnMz)R%WG6q$JHv3rLyP0D$MevS107|2yvR`j65Vt|=`?>)b9vL&nuUlTOf7|u|V76lZ3-`+# zdZHY)9HI<_)E4c^&IAAh<>nBe`P>yCnH-f8)YIGPeA56YPYoK|?QP;_i&N9a_(~Dx ziE`AkiBcPMdT<1QSI6!E@TUQ>E$?=iB-JD5#^?kPw@tQ^&SMkySf^wHv$JymN@Bg*z}s-7D~01o6N=h{~+g-|2tyU*=2_CNjJ5CAVQ7sy3=)+Y8>kqvlxP;A080~d|s>pfYuB~|Yh*`)XTcK~pZ#p5WOq@?kKRHFM3a^H=vXICZ8 z41O3wjjaCY_$0DCQI3k)C?fCBu}Nyxb_A|9?ax2`836urTNp06_ z`xduRNkplQswbQD1!Mux)+80y@vB#Xc%91=<*2$|Ps!5S_pyK91ZspGXx|OQb1mE3 z*g2eStNwV%jLU2N@%k`3MmDZg! zuG;^xwLqM(?Nc8G;<=oi!zn=;$#40_R~Eg&`IG+y;Nr>4KrI7MHA<8n_bFNHwuslQ z#(5T5o+w8-6Q#0eSHAb1JpeqpPPTu2LHA9D z=DiyMNbmimv7Zum?yVEX`Rd7)ETYfI6XmExqO!%?0EE{jjY!?DfnP~UT&3i_`c3hU zul!;FfV*!?XVcg-x{6LfdHT*o1x_H_Vo_`Deh zCF!tjE5>BtH~keI2>^1DO`}h`5zhYfjS%AT*^bCtp8w_VfOtG++pLjjX1k~CiE2nO zuXpIB&jL^wmrwNaxOhFaId+_+xspcW>IF4|*WQDcjvxRSId*x){|SIoQKX;BNwV7Z zgame_3AumuikYuI2f*MDerz0X6Q*8pbI%&@^%_x(sQq7)YCvySdkD3hP9yJc|L7D@ z>rSy}g0;SrdP;0ux}1?Z&#>4S^{V$~yH2xZy zEP0|DQ6f>J02Bw#IFY5c$`j?N zSR6GvUeuQX)Vh2-Hl;(Tk)(umM7C)7f{>)PY9gAY3D&gUmm6yi+M7_C3>TeA*4Y`Yp=Vpf>y=B=r}Us#93)BO zuKcH-0-*5zi4bbJqDJuAmE(zWRKu$Pv|hEgS8UJC(P@LMC1z)gYppu6wr>KU@WG`J zVB434G_5*#q8!!m%7t2FEo61�Ke#1iQw*Kq36^*0LmN&zlk_or<<|>pB8}b8nq6 zst}$iN8R(&UH7;oflad&iASuS1G_J&B`ckKgF~0^_0so6b`?V9iE`AkiP9d(Oj^v` z-27Y!wK&S|Indt8n-dbTyY^157I~r^bXxyZob#rY|<#TFkvBOubl2*NYq8!yQQMR|USCx17Zwvs& z9&#^d%M;}&XQGn4ol4`T^t{y6AJi{gJScgh9OX=uM%cEuQ>nMhMBeUElPAhib&1kQ zwK5}KE~$GZ-`y>d_}J3FTkx>T6XmG7M72LA7la6o98%O{4*V)&`{-q$r{&STw{$3#k!ZP)HgK2_zcau&4{IF>WBlz{VI%7k0r$ zqec@GQzN**7|V|)YA6VbJQc8}Es>N`(59GZ{fXzCZ_+vM4eymlUw?AD=$U)x%$<4X zd~@zO_fA*3UAH9XPwfBZOX**~txsei z!pu~j(_E9V6B3#qoGDKa3GLetNc*`C^*leVd*73G_>ss!gqdT?5P_%bS6?rOo`gjY z%#r>~=UG$}G7w?rm~=!C3li>(qKH|d_q3kbaq15_SkZW&$OC)671`QQtqSgcAi@kX z>4?CQpY2{NhvWm0@XVg`(tppAxgx(mc19#5G;LiW?V}$Y6Uo0ogjr(35;5)WyArj+ zr4v8o%z~@#e@K4Hs@4vXH&tIJ5)$5Mtdw?5?In@SCT)is>UG(v!gKP`}{@Q6z@= zOffl1{#GEuY?L#9&u_oNHR8O$UD8vh9=*M?HgRV2#a?N%#>mPNB#znf4>n1qrM%?ry#lRgtVxGfR9mdnj=}5RouP z;f*mTf=3}%u(n98K*o6R<3B}}3~^1{Pts;($rHr5$b7W~dTBDm2(wHo5w}*{o2UVL zhQ3SH9cg8M9p~UTde<`mW6Tz3CsdDwoBc%P1hlqO&T}W ziT?4uzlnqh8?I;(h%gi8C8EDu_X+Sc9*#OAi6K6Apzn8>GEs8Rv3*F}RF99p__;h1 zRV6NtW5Zs}KwF+&DW_T@m8@qJ8!G}4X+-d@liBfZ_x-Bh7m)LF-jl)gcoa!KK$}|P z!-^lJi*e^K*O=67isTPnb-G^Bv`K3T#<^ND5Mh=~jS+Y#)2X}2Se{q`DgNC@4}vPq z)Z6zfQCnB$-i@AhVNfo8;cb<^Hu1AWu`z+?L|+J7pnkOu zeQ<^n01?CnJOMc;2esCS?{_Hqo#fRffcql@5oU>k>WBYzsUET5`!B1fSGDS@GySX} zkukChz45(aQ6aXV&#rYUfhdl#3`CfLQ)5J$1AH_m)AUs&wF7I5nNFQG{4B#Ply<*T z^#>xZln7RodQVT2A-r5+WAtEzzdmW^*W#OcFx! z-7j(R7&ZbCX52WBh&^m;lipLF1fo4os;SkzO!g;OM>sjCdztb0c7d-^{QVfWR5B1@ zmM)JyVI+7@;SoFv30wy$e7%M~563Fb>SFy1R~79<-FsuXY2%RV#1X=#E(xN!Fa`v&p5@(K!jN^E3+i3 z^Dbj)JUQBo5F!`{IbN}V`+FIPFpFeWpLj4WM)>}T=2`FQLfe4|vs6|dfdz@?Ssr)a hNuWR3Wgx;l_#ZYjGMtP2H);R?002ovPDHLkV1mmy%bEZH diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index 5a5c76d627..4b434d2cac 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Summon { Item.damage = 25; Item.mana = 10; - Item.width = 52; - Item.height = 52; + Item.width = 44; + Item.height = 22; Item.useTime = Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; diff --git a/Items/Weapons/Summon/HauntedScroll.png b/Items/Weapons/Summon/HauntedScroll.png index f6199e1553854af4ce6ba5b7980c5701dbb47729..8b5d151c7a60851667e36969c3b1f0faa319bab1 100644 GIT binary patch delta 565 zcmV-50?Pf01iS<;iBL{Q4GJ0x0000DNk~Le0000i0000M2nGNE0J~*=$^ZZW0drDE zLIAGL9O;oE6MqSCNLh0L01m?d01m?e$8V@)0005eNkl`+n5< z+9{EXvpqM@_tbW_^K9pRPle;3nfK0p=n*74_h7%T0e_Yx(=U2bET5j6zGJ1fZTMDr zy?+5kE>k%ie-S#w23iX^CUN&6 zT-#IwTNNQjq(x5(p0CyQ21|02je0Uum2<*(c~y8dasb<}uq?ZI@&sQxci{TAYM6KR z)c6Ga?tjh05|(ivJ;E-RdOtA?^Dk&snDBgyODnMb3Ui(0T^-G=!YnJ9nH_?gedhnF z#JlmVCo@^24o+m%`CYSj@X_u$JTTG=6S-QHPT_l}0T1_d!Q6qy2HRnBl~Au^85XII zg<#$rEGmz;9BZ)L`Q(mA>|2;S8LupP{{XY_{(i+Z>~HqK#Hx%x6^7-G_tPDepSPF1 zDUoN1u)hPPS(M1)ENu0(C7&s{o=fB^#Pbtbme{v2VQH3>S1ytN>DP=}1%mlen6Pv- z9WPq$r`W&nZ<+RWtJOv$3zNT=F5kjLmbRiy3OgL1NTIPl{78^A00000NkvXXu0mjf D%N_y6 literal 522 zcmV+l0`>igP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00CG@L_t(Y$JLg>D+Ey(z<;Cl2T;ld z>#$Qq#F>)2n@z1;w!}d>kdwA)Pa6m2K+1vag~OJclj7t+t1W8wU{RY=`~eQ*u=~lp zcr&xDdVZ((z2^J+zTeE78H3$JE)rk=0X z%j_NlaQR#@{7pU9754y~g=8c%)%<|gOb~nbTV{XlEp=nQZ@DS|JL=?NG2c)SK?WN& zBm93u!e5y(&d?{1C2*hJ{7z{A000tnMObu2SV=}YPjYExZggREX>V=-F@#v`?*IS* M07*qoM6N<$g0QvR82|tP diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 7b6f2a619b..6abc9e648a 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -14,12 +14,13 @@ namespace CalamityMod.Projectiles.Melee { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - Projectile.width = 26; - Projectile.height = 26; + Projectile.width = 46; + Projectile.height = 36; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; @@ -45,6 +46,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 0; } + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 4) + Projectile.frame = 0; + if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) { int npcTracker = (int)Projectile.ai[0]; diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.png b/Projectiles/Melee/BalefulHarvesterProjectile.png index 55fa05c28b79b645c5482c7595a9dd14f1d2522b..da20d1059b716ccd1b9acb508951626f3ff0aba1 100644 GIT binary patch literal 2138 zcmV-g2&MOlP)qH(B00001b5ch_0Itp) z=>Px-6iGxuRCt{2T}^BgM;Lt@3?VU2Fkq)7;-@K96xoW95ZuZEksd0QN|majUV11T z;867p>Y)cXR#lNW(R+HTR9aQ2J+vGsjnqn5j-sX|O%s{OHh&3mz=Yr)zWFwu$fFhsS^Nj^7k@; z2s0kjy}-;edUnvZvp)_1DCa9R0LTn1&(wG9Ap@w*$&=TD~i z&l&(Ex?&apj2)u()?>U5H2_$=Pdk|d6#zi`{79%1Zpu#s06r)@qT^|@Oh1AvKf`F)x5&P=anc?hSa*K^C%zB%c99XtZ}1mo9o zr5X@n#(mG6wXbX@Fk{@&Zf@Pn%lk16lH2=Ee?wc9xi7_PZ{)~csa?$? z>PWQ@<0|})0O$E*(@tI27*+GSnq?xN#~XH+&rnC8RG@9SKqH{bE-G}{=h?Q-7F`{N zguUa1!6R{{DqpLK@vumHWSNrY8Y9cN zL9-D$#??BxigH2T=V~u+dv|zT*qHn4k&W>UGY*jzxF%RC&@p*6sKRJKemknw+ip>K z>fK4(uH9YqM}oFbw~^w|JG{LHxM)Bc?T6928jwRhTtfF=(teg_N&8tQK>@E0iw>)g zX?yr}06>@KIO{Z^ap!(*r2#o+gXLM$e$@JRPY)Ln(Vk^1?bT$Y?;p;JZj**9311 z1){n_v2Qe>UJv({ZgnT}xY2+V!~h^SyBOp>#B^~%-d}^1ZFr_UA?`s{ z<~Wu)i~M|sX3*T#R@Q({b=DOXL&8f7G8<!x&e=BQW2}T2IHbPfx8ESQ)S%@s-VbWm@0D5-NXw}4e zTlcLAhS7ioLQg<@4%pei>vJM~afZjbazYAznO^PfO`D$&L)uH^YWWlV_fP5mj4~TV6c3|aZ9kU6;Xg~@=*Hvr< zVo+JLOcx#NB*q6M(6CCD(SUs7h1Cv?2Bg6YE9`SU#Q1;|7!Ak^MgtOPpBU%-Tv9v` z?1>1fP_&%}6#B!N9+1}{2>E%@G3tfLGT!hQXV_IjeQMJhv&1wrJM(Krj^$Nyui)@&004eM+|4Oj1Je0`EUb_&n%pk6 zx0DY^y)$vlG`1F`FdNht)b>6gPYsB{-J05K&Q%>13TEE;fE2_yFM9ca*a^$Q_PCGo>Ym-SEVMNsB}?cvAh{-J zG$02^S*L4gCyl@mnU;+P`9)GHDa);&QoDgO?THfF_BK;omM{$vkQ z^TcJ12Bh%;%_QT}2(^v|$p9AJ94tsBL^eIt{4qnQs7q(se3~RPR0^?dRQnj?aSg?*lR#kQOxnNFVK!KM%Ky z=2>uI;D>SfyHe~2IwzC}^;vM{_ki57aSf=h$*sT9fCM(INSNOP3J9YCH5*0)YBnOP z0U5^q;tj$0pR2(%Ac$*?{><6z6LPHg3(D?1cVFYYwUhF8Ot=cKM4j>f01|Ry$u;~; QuK)l507*qoM6N<$g5yB=%m4rY literal 509 zcmeAS@N?(olHy`uVBq!ia0vp^Qa~)j!3HGjh1XvOQfx`y?k)`fL2$v|<&%LToCO|{ z#S9F5M?jcysy3fAP>{XE)7O>#J{PaBrQ+$=F0UCF7`r@O978;gC;$2X-=5h{AYY|B zo>4@{=KBo6`8LALa~Zf5fY=n==WMXhoI z{`YqLW;m*Da6o%GU*ZQ(=NJC|8;`$TwqCCT@edG6e4 z-!CVfO zPA_(60|CWaX%N*`F5bW3gXFUF@+qp!X@QMW;nn`{+JEqza{qqwz*b2P#)`d9kN1Y( s{m5+|77s2PV1sG8bp00i_>zopr0I+<+bN~PV From 8ea38a4a72798bcab934dd42eef50c785f1d1e42 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 30 Oct 2023 22:16:09 -0400 Subject: [PATCH 40/43] Fuck I forgor about sweetberries user --- Items/Weapons/Summon/HauntedScroll.cs | 4 ++-- Items/Weapons/Summon/HauntedScroll.png | Bin 572 -> 522 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index 4b434d2cac..5a5c76d627 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Summon { Item.damage = 25; Item.mana = 10; - Item.width = 44; - Item.height = 22; + Item.width = 52; + Item.height = 52; Item.useTime = Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; diff --git a/Items/Weapons/Summon/HauntedScroll.png b/Items/Weapons/Summon/HauntedScroll.png index 8b5d151c7a60851667e36969c3b1f0faa319bab1..f6199e1553854af4ce6ba5b7980c5701dbb47729 100644 GIT binary patch literal 522 zcmV+l0`>igP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00CG@L_t(Y$JLg>D+Ey(z<;Cl2T;ld z>#$Qq#F>)2n@z1;w!}d>kdwA)Pa6m2K+1vag~OJclj7t+t1W8wU{RY=`~eQ*u=~lp zcr&xDdVZ((z2^J+zTeE78H3$JE)rk=0X z%j_NlaQR#@{7pU9754y~g=8c%)%<|gOb~nbTV{XlEp=nQZ@DS|JL=?NG2c)SK?WN& zBm93u!e5y(&d?{1C2*hJ{7z{A000tnMObu2SV=}YPjYExZggREX>V=-F@#v`?*IS* M07*qoM6N<$g0QvR82|tP delta 565 zcmV-50?Pf01iS<;iBL{Q4GJ0x0000DNk~Le0000i0000M2nGNE0J~*=$^ZZW0drDE zLIAGL9O;oE6MqSCNLh0L01m?d01m?e$8V@)0005eNkl`+n5< z+9{EXvpqM@_tbW_^K9pRPle;3nfK0p=n*74_h7%T0e_Yx(=U2bET5j6zGJ1fZTMDr zy?+5kE>k%ie-S#w23iX^CUN&6 zT-#IwTNNQjq(x5(p0CyQ21|02je0Uum2<*(c~y8dasb<}uq?ZI@&sQxci{TAYM6KR z)c6Ga?tjh05|(ivJ;E-RdOtA?^Dk&snDBgyODnMb3Ui(0T^-G=!YnJ9nH_?gedhnF z#JlmVCo@^24o+m%`CYSj@X_u$JTTG=6S-QHPT_l}0T1_d!Q6qy2HRnBl~Au^85XII zg<#$rEGmz;9BZ)L`Q(mA>|2;S8LupP{{XY_{(i+Z>~HqK#Hx%x6^7-G_tPDepSPF1 zDUoN1u)hPPS(M1)ENu0(C7&s{o=fB^#Pbtbme{v2VQH3>S1ytN>DP=}1%mlen6Pv- z9WPq$r`W&nZ<+RWtJOv$3zNT=F5kjLmbRiy3OgL1NTIPl{78^A00000NkvXXu0mjf D%N_y6 From 990f8ca5233cdf19f359cd3e2d83e93045cf786d Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 30 Oct 2023 22:43:40 -0400 Subject: [PATCH 41/43] Alcohol resprites --- Buffs/Alcohol/BloodyMaryBuff.png | Bin 607 -> 694 bytes Buffs/Alcohol/CinnamonRollBuff.png | Bin 584 -> 628 bytes Buffs/Alcohol/FireballBuff.png | Bin 627 -> 634 bytes Buffs/Alcohol/ScrewdriverBuff.png | Bin 622 -> 687 bytes Buffs/Alcohol/TequilaBuff.png | Bin 639 -> 665 bytes Buffs/Alcohol/TequilaSunriseBuff.png | Bin 557 -> 682 bytes Buffs/Alcohol/VodkaBuff.png | Bin 585 -> 671 bytes Items/Potions/Alcohol/BloodyMary.png | Bin 507 -> 467 bytes Items/Potions/Alcohol/CinnamonRoll.png | Bin 410 -> 386 bytes Items/Potions/Alcohol/Fireball.png | Bin 403 -> 404 bytes Items/Potions/Alcohol/Screwdriver.png | Bin 422 -> 402 bytes Items/Potions/Alcohol/Tequila.png | Bin 482 -> 501 bytes Items/Potions/Alcohol/TequilaSunrise.png | Bin 339 -> 460 bytes Items/Potions/Alcohol/Vodka.png | Bin 408 -> 489 bytes 14 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Buffs/Alcohol/BloodyMaryBuff.png b/Buffs/Alcohol/BloodyMaryBuff.png index 04b959506c55e18cebd847d12a9b199c4eb2d49a..9f9d34bf27301fdbc3740e0fe9a2de52d5bde566 100644 GIT binary patch delta 658 zcmV;D0&V@@1hxf`Fn<69XF*Lt006O%3;baP00009a7bBm000id000id0mpBsWB>pH zOG!jQR9HvVmQP3&Q5?tLxT8dd#DWV-xC9Za%Mysl2Kld(kWdpvUV|XQOVCX^6oH+T zphI|zC@*cAN#!9bDp&)HtQN+?s1X!e68bA`yH36D@BOCsp?~DbefxnQpSQci&ij4m z&6}~rUwq|_0_U#4u!P82p!4SF5vhQIhW%<(Ousj-M#TKrIW;2MZa2V_$DY7U^&)-G zWS6F4^Ah0B_{`?BaDSq8JA7^QIn14Ze@V%Fp8W)K0*^Z`z_GDCu=xq}_Qv7$l5UK^;mR%W z{EOFcB-{=&=B#_Hc@H4d9AI+SG?@qjd%O?Te z2Ts;>!mT?Ja7wM#MoS(l#I*9jtP2OkcR~;GZ$bs0Y3C?6zHS+DpU6Ch*@07OHI>FAx`S)tN-aC{J@Q$7jEyP59jV#4AV z>SI2ST7QeK;ZrD`k|z-C1DWJ~sen*jl^PL!%Bd1>XdaFn1uT{z8;ip%5_Upa-M%q97DZYdi>E z6scHjdlw3V;H~1-TOoK5?N!a83R3V7K~xm03PQ(17PvFAApjvYCr=5SJprx`2&3bJS}}>nV&uG z2Vi~w4*;Vt7Jn`4ybB#ltPg?x@F4&Nd*=Wg?)?D3aS{e#_*J_&8ugW#rvP{y;sNTa zcL5L@`DV6fY0q7VPaaD1-QurqS7XU*)vy|~X!}-5T9|BS_5?@o(fPMs| zB#8_o-iX+)z0kqbj&XKQt$Ncs~< zq_tB)!s8Inhh%GHuI)VlzJX3<{QeP;?*K_4nR6+#b18iY3_9DCgx#5;#LZv200=d- z0Pwo0M#;~N%>xh_`KXM`FCeLl-7^5nR%!vA2uR0A%VHnr8nNtHYSM5xX>yuK=J{sb zIf2+$aWk-KNl7H@+`LB2^--T)iPM61rB0hQaCsB|pMS@H0ofvz3;7MM(EtDd07*qo IM6N<$g0z_h^#A|> diff --git a/Buffs/Alcohol/CinnamonRollBuff.png b/Buffs/Alcohol/CinnamonRollBuff.png index 075531eacc35208e68d71faea6966e8add03e85f..dd3033fcccc383d438a5c589afffe534cd0e92d0 100644 GIT binary patch delta 591 zcmV-V0pH z2}wjjR9HvVmS0FyQ5?t5(nf&{>0v2Kdzep(4-F=ZnrnMdB0&a2@mVE;9tL~LhaQar zK?#x}z4#!3feeXB(EK+rLlhKYpcIN@#UjE?WlkpNd+zV1M}IH3m)zM0etdox#=ZCV zyT6@tEbK1@&6fq9eFbR|;ctP;U5-vJo&HPnaxirmw( zeaI)5EF%>05k##`Wnr{CawpaL#W?7_tK=T)#jnT72)nqe9BIxyNe%*9-7 z^)RuMOvBbfFYJ481RF6MzY5D8nD-6B-q|p$?m7^*-G`g%8et+lA!Z=H_ypEzdI3#) z#Z0_R;&v>~e!$Alz_}L~+?_#u-dsBq{|ohIzzF-+B!3(YiCu4GQLGO{z>$MXe+JB` zy`4tLIIHXk;wxK45PVmpo$)lK*MXgt8U+95r^5_>9+1xjoYL!n41If}*)XH%9njZ- zbx(pzr>xqlWdis6Zusql`2QN62VOlC>%?m&?w1SZVd6L==B43N09L01sbG?e?JkIl zYIRk{)#x4&$ dyT~12>;#xq!U^5S-#q{T002ovPDHLkV1ibX63qYr delta 547 zcmV+;0^I%d1jq!CFnG19`7 z5=cU{R&X^CZnUsSybgrK>jDgHq9E}el`4~$j~ z0`bbzy|NPj^R|=%f8F_!&~9%Jm^cc_?yh*?1E9aVUFd_0-vJ0bR!nV&CjrRGs!kZ+ z9tO5|_W-!Db$<-N-qtq&zD#cdaNncG;&nCueeW{>a!bnq__;7I=9!qP=>wo@A|Ukk zFwnO@4nW|Yk}K}q1E4TFUn#=UaW$w;KwrxfX&9VzT*$0k!yX1SVoWTj7AUX$?zs}M zj{yzMghuIAHQuUJXTR=&zlFUFoCUq_lQFQyMZ50N$_ll647CQmBUZN^3s;`ZX%0B#h9DteQJmIHrL5-8p zFXi{44zP&SMk!rX<J<1o{M!Fn<69XF*Lt006O%3;baP00009a7bBm000id000id0mpBsWB>pH z4@pEpR9HvVmPsf?aU91VGo5Tj|9$`W{(oa9yzwIWufVnKF|;A# zEU@zE;CxY5YJ)PR(MPHb1Ja1GXW5oU-{a(L9_FtBTDdkS7?x8}R}AaCJ>dz{IoxAp zEArMP!Nh1u1Dx7Y4io$}Fs$nmWnH^pG{~G?P0VTL;;L8czA6+2( zlLrXl(c6a@9)AOopJMX{)RG0$#U&hIe1b2H?4HxArylEJLGZz+YUvENc-_MV4l%Gv zVJ}Q1H^RDcJxuWT9?-j`z_Fo`@UGbaQv+cgL$Fs(27I2?3HO)f!Spoj2+MGsrWBUL z@0*aICN`a$;i7bQueVoRU>`q!SWaE{7PGM(=Dq>N34b(RjUh^?^-aihVj=QV_-%kV zwA>)B1+hrS_#Gl=aMJ-%LOd1eWPA_5PXQ6-vH<5sxWk{VUPK!c4zJFy!~g#&Ag)gx zk-3`?`uR)TLOFMQv-6$=Fb}-rcc}8yZBpJ4!;c$bgz`4JwnKT|B|YbMhx`^`_APa jAkf4gf@|Bj0YP{LG-TUUvjKGs00000NkvXXu0mjfUy2(L delta 590 zcmV-U0+R646i*V~e(0i62NTN;=$kV{h`F z5(T}b|K+`N?z#7#|Nq^O^BkNb&dtIBka5G4T4oUks48hu8h^Trn=CtYMLsC@=Hc3v zCf?bb2Q*M1Gua`TyPHcaJ9LkW_O}~70F>qme=rgRps=7uiJ$K11)zT5rR8|~D3HuN z+m){b{#e)r&Y8F63+f}$qYEdnV=keO0(OXPMFIFW`yGIz9HC6);bUQsjb1AOeH8c^ z-3Op(`xJovZGZ92CG)YpHvmjLH2_#!8Uo-&-!A~3b>0`_gcgC+-4Lkl2f+K$r}%GO zfs~WbmsbZsb(sf%cj0ybUbjl-V)d7L#OilGsTL!J0|59tg{c0}2mlWXo?A|=?@8Ey zFav<^tLk@Fod9sx-3UOorviZR(kcMu9t{m{(C0#RD1493FxbU z9oEfnE}5?<*1*O6>~6(>Pl4n2p8$x3rT{26cL#WFdI;!W4_t=BFIkG6I1x?TNg&-J z0i6^Wc6BHXhU*Rh&C7lO24mv>Z+um!#BG?*sfif?=1$f6K;D89XIsAkaDQ$9bW%Vv zJ_w3iE=SL_B__?vXEMzSNHVs=tt*hI2UZ@07*qoM6N<$g0)8!Z2$lO diff --git a/Buffs/Alcohol/ScrewdriverBuff.png b/Buffs/Alcohol/ScrewdriverBuff.png index 868d695c582e77a1f18a5c4ffd46d037957bcc82..2c0984bc98063f3066432d33ed9d43ac2320c2f6 100644 GIT binary patch delta 651 zcmV;60(AZE1g`~pH zL`g(JR9HvVmS0FyQ5?t5RIZXTbAsT*ltE7|Ukv{}Xlf`3O56x~@g*9pB5L59Ao!B> zB8?u5o;1mbP*ha3g32_CVN#S}kuB#xtQ@jR*riyW?>WEKE`JX7#hrcN%jb7tj>>m;7g97(XL771KC@}Nl!n0gaItot7Dwfv3u&e}2KNe&qFtiO>2{a>DR*8DeiXt$%PqPY-@-njc7&TT#hXWB;KhN?sGIQtIg z*{a~F6JEG-(gUk|4tT89aOsgEnD7kN!{Z;tHrTSa!+(*7Zg}R3=)m>B&K)qL?k@0# zo*}+Z?_#nWj#3A*U({Oz@yJ^g&-lhQaYEXi$6r!#P8dF6K-d} zB)kLBbAMp2T`4t88KHq)q0%mvqV^&&Y;f;Z&he&(r3d;> z4r}kV*Iw(#K4AO+g1u%&Ub)J>28qj>jxDj8^N82!!vH2+%piT zbMPlPlB?W-CV$YJduqRs^UR)wQ&+!(fuToW-J04N<0nUff#DHQni&TpnNOg$@G@vQ ze-bpu0t~!^``r0_3Nl_ zo$QQ%HG%muYcKd6;X4qoK6Jx4iMxBvq808sRE_C9VXh=cfosL}k%@xhy Xyq}_jh#;8(00000NkvXXu0mjf2_zP% diff --git a/Buffs/Alcohol/TequilaBuff.png b/Buffs/Alcohol/TequilaBuff.png index ca3a7b204e382c8c412681ceb10ac838f191a20c..c005b88c923d851133f8701240ccf351a229d041 100644 GIT binary patch delta 628 zcmV-)0*n3s1epbpFn<69XF*Lt006O%3;baP00009a7bBm000id000id0mpBsWB>pH zE=fc|R9HvVlubxfQ545tPKX;d22{qy%m_u}#~=-%2Bl65l@dZog~3Gx>LL+IQE=m` z4+KAUqDvRz!q66yxX7R>BSO^2=u;?1$3e;%MAJ0C;{NYD6Mr*sHC;G&esK7m$2@rN z{O`PTN%_aI?u!D?jzJqi*jr$7hozD!$aC`py$hvv<+a{%d|O}j?rf|FzQFP&K$B-a zw7^8ui)y$ydle=+y*KoZqb|IGla2W>F;UwAJ9`^p`4SkrGr$y_JkE3lChF?TVNYTb zT$7#w6Mge@uzx6laH1!H-L(zaGqemh{pf{N?Hz2l6~aXHCeUy1VNx8Wp=Z15_Uj$z zv9}p+AO8#+rUP(ea|!JCEyAJ%-WPPkw&B~be0!iFfuCv4RXa?4+_?wGc585%6;g)1 z+(diDeRxLw0E?24cM}qn#6fBc>}tz`mnQhg=BIpum4D8gaGH}xLcdoIrof^kwI#P_ALHkf(@*f`lMgP%JN90ueljhi-zVf`;B|LB${{*~JY}>mZtJhuL4-jPLDA z2OH>ndG9y#n|bg1nfVRxc}OeC@yY{m;+P-m_!dckisBnu$A8lc*Bl2t_&lM-U%r3* zs|P1GmjDY0oHQH6d9bZmYwzv94S?Us_vblJJQ`OH&v|PBnCf~CK*R8TEzceTrt?$2 z(~bi|-97-y+JgY>7X|>xO{@aY(>Uok&U7xahk%=QV_N{+@;?ON-pDWjE&HVaG_}?P z5bhiU;JvZ-*?(jYfsL(g0E*&20oaaz1K{i2Ism;JDd+9ifwc3gOJ@Lxj0^!#-r20? zTbTh4lbEfG0B~`<8nA%Cp_4FNP!GVBl5zn0=I;RM-7hMvRaM|E3ux_|A5=9w=}^^R zo(Cd(Pr}H~Gyvf>71vbe0uWtPdm?!GY{m(NNT@ri8h`pSzkq!NL~jxU0EF7q+6w_$ z`@~FC%QyFem!U}b1r>o-Ycll=r_Em?dEr1t_T z=R!j2U#>@${RBi(|3bhd@tagiW|g?f9s;j@U0TQEPpV$Ui8u_RVv~flXVY}xnaW>i z1Z*OZ<5N?gw>$Gcw1k&0V(Lb&E}C7+-0voP2#5-*@&R}h8_YORh=~qjds>`q$kF1x oW%Z?n0qUO<@ceQAfBqf+0+4&ADN_OTI{*Lx07*qoM6N<$g6Fjz*8l(j diff --git a/Buffs/Alcohol/TequilaSunriseBuff.png b/Buffs/Alcohol/TequilaSunriseBuff.png index 04c3901cafe0daa3f42bab9380a8806e172b5a34..5f5a7a48ed7f4afd0932aa9e74a1538cde87bcfa 100644 GIT binary patch delta 645 zcmV;00($+e1gZs)Fn<69XF*Lt006O%3;baP00009a7bBm000id000id0mpBsWB>pH zKS@MER9HvVmS0FyQ5?sAx{(nw#D|7TN*I<6dyveDmFBBb+%PH%0$)V%LH1TXC_$kQ zuDt~j3`Z13B>GYhp_PdmJ@jw5Qeh@3D9BhthcxES_jk{oyMH#AFM9TYAD?sC-R?PG ze)pW^P?EUry#mk9#c&@Hv%t!$%dQF;JSe@Sk5akwdsrVa?)acSV!niI@O^6qoQ~DC z&#-z4$dx-<%V0D9mkV&^%ssfYEdWys>-|mkmB?uxq(Qv|-kf_TWUTyPQ2}fwx*US< zKD-7G_!i;yntvs@qp}u$9k#_`U%K=pv%?> zpE*_q=YQjFEt$h@Nyf!ji6->-zWym&US~}LJ0{=>zkfr0n){A2@FZ3&YPKEay>3An zM7Zk9xiUq)1SB$v!M}tua6d*>SYoJOF$;=D5}%3MCF;Ee>A11M=f3MUM8q514sP*= zN48%r?g8&}h=N^K_)qj7ESZk7wUsRC0V4sw zb5zK{QhszmA2Ge7d?sAO(?d!2|K2mV097*Xdi_rJSjGH zB3oTPEN9#}|NkDb+xfqrnUNn);0@+UvQQFAN=nIVh=pY1QPSj5UNzq2ITka=IJbMpjpE3EbI#ZIxZnSO z&pr1X3nBRVSy%ufe)yrfUHAd=?6s1kGp$NDp>2O$vJb9zb${b#8@d4~?`zTZpZQh+ z6%`Q7bDehGgpJWXz`PPhP)30$G0`%w>}?C5X_d`nYn*P_$=Pk#GU_N`1ovRCWEbQl zhK*m|JO{v4*9gF=ZvlWLTL}Q3Qa1ouV?}^U3Y=bC0+4$A41nYH9so;M69B%gCjcgc z@wV(}sgR>1BYzmbE9GlZJnxchbrf)4%>m$=kOKsB!C2U0bPi>Gs{wTs5O`N2p&kIw zeSg3%j0Zx@jWE7;7l_~K0Ya4n&lH;?^wQEEh?=P3%y;c!r)_~>1{D0n#-vG}mra1_Cfqwu1002ov KPDHLkU;%=E|LutY diff --git a/Buffs/Alcohol/VodkaBuff.png b/Buffs/Alcohol/VodkaBuff.png index b2c2eb1496164f4b4051f4fef2607e7c9e575331..7a9e6b7150c954cdaa58d80805b30cf2cabf296b 100644 GIT binary patch delta 634 zcmV-=0)_p_1fKpH zG)Y83R9HvVmS0FyQ5?s&?9U!@i7;XPQOtr$>cI!Ipg)Tqqp^sDAbN^kMi|l`f+T{1 zgrIuKUW#4Ls9@Trzt`1OlN_(S|Tc6%Gl z-3bM0qAl9hpJ#9}%ztk{@YQ_7(!lD<8Z0xvvPn16 zJE`B4Ys-f4;pxv;3STQ` zkG1g5pRa%c4!HCIsXP$zTTbXn{MAOT0rpP38<_xL=;ag3xH%5!%H5vJO5(5dZ-qZ< zyCEJ{(*P{}_y9m_%S|QEPPv3R4%lITD-Xc>;)XK*ef?WQHeike+xcApytxAac5|ZU zy7H7mJU8 zO1?ZLuQSg9=xKRu`CfCop&exHr2|rVzguYN@LmTXm48iI&bRA|XU73MNaeM9gZcM? zT6jB`RQSc{9RL#ADG+zv`eBX(Q=Sne;PhMosy#q{{W`+aMzW@nVR?1B>iwn_j5 zKHmaNazH9BeA)xx(jk}F*~}??;ZW&H?%bkI|d+ diff --git a/Items/Potions/Alcohol/BloodyMary.png b/Items/Potions/Alcohol/BloodyMary.png index 935c52c03acc35aed2f3eae9b7dbcd0a9e244dbc..13c6fcf3ef5e96fb9bb679ad5f4f90c4d1b21ce9 100644 GIT binary patch literal 467 zcmV;^0WAKBP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0cc4?K~zXfV`QKZ zaA}MEhcdx{2})B9;B=v6kS2=F%=dnR=_eQNf%U*#CKW0Lq8Og7eg>xL=Rym2b+8LE z3+2K5BS#^2FI{&IOv7CE^%BJ8A8)<|)6{pNGZOLy4RIS|zWkG<+e~7vTj1Zc3E`-tyFqa0h zg1K<8S3pCFUoC`%oMInKN2Hw4X4P`+9om|Mk003P`dxM}%GR*)0002ov JPDHLkV1n7TwM75` literal 507 zcmV@ zi)y&k-qlw2e<4C^o5u?wTpis3h6l@7XJY&#iZwh~PLPg&X(ara5eG*O zrr&gZ}1)F*cLFUA%x4vfWib!i=4V|cp8>2T9 zj=sZNQWGBix&>aAo8az+XVFG86)^SjIkF@!&Ch{%mo9_JYV`JRF9sYdRuc&)2YSHt z*eoc`N2K-KhD2QUXMCs>7e_=GlgHzgq3x|VYWzv8vm@SH>|99?m4zG3mtg>x6y%|KsJPtEqFuZ!1B|gw_19vM1hF zCY2obLzY_nv?UV|PHl xQ48SJ;{Ur`*%L46*6sGd0H)qQO?75Q{1;fGPe diff --git a/Items/Potions/Alcohol/CinnamonRoll.png b/Items/Potions/Alcohol/CinnamonRoll.png index 6fb460058fb2560ad5ac1a72d4bc5dd8e6f00bdb..e6c6fb511c8987a339999cc841ed422487614050 100644 GIT binary patch literal 386 zcmV-|0e$|7P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0T)R`K~zXfW8{}m z{Lg>{KEAlm2xa00Oi-G90J0g~c6@+r8{z&T)vuKM5eA6$E9HKK0hnztKW^Cb0?cQ$ z76(xb{+x_paq8Rn;rTr<9|kt=eF>%mTqLMuV~wmJ*rv(91;G5Z`__W#1MbdX8XZt> z<31a1u#Mj=2wJiJ4498AKTh_B#5475Bm_SH gdJd+^w2^@U0RIYF7m|S6w*UYD07*qoM6N<$g0PdIY5)KL literal 410 zcmV;L0cHM)P)YU6o6kgA^1|T2QJ5`v;YPUHG!4As~e_tfOIA+07`p1Hs|D6#2bQ;xiR19BuULo0r1iM)&bHrxV0ZA$pkX zIw;vLm^IklEP77x1HiQO1;E1FJpkpyeE{OwJOJ854S-BU^@+f#7v&j%-1e5;aaQw~ zU{Fmgrfjxrf}Q~qa*~9c{C@z~1o3R%>U}T-PBp4^8r8b@1lAm=?J)2+k;?HYfYk}p zmWvxc6TG&f0E}mhO!Mo7&T5=Hzo-E4sKvY?2>ws}1$4bt*q|QamjD0&07*qoM6N<$ Ef-$hK{r~^~ diff --git a/Items/Potions/Alcohol/Fireball.png b/Items/Potions/Alcohol/Fireball.png index 2c90f8f28c24f2b5f1550f5ebcf1a8c867841cec..58a484de0e57e931f67a016754616a4caa423252 100644 GIT binary patch delta 378 zcmV-=0fqjP1C#@hBYyw^b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi z!vFvd!vV){sAK>D0VzpDK~y+TV`M-B;SyT^LG)FAQ7~Wo<7+Uz^2Ie2wM2T!n1Ap)m_`TMCYoUS>Y3|c zntZ2zdCSHC!l%9}fHARvd_U@_+k^dBv0*t_00v+s06Ku>OUi9T2XEeBw-E-&w2^@U Y0O#{!6o|)x0RR9107*qoM6N<$fJ z2o7$pq6mHu7Y7#yadGb?6x1$)6bA(<7Mw&VwMbfH<8YV4wStmV|4Z&A|Cb-{-s4U~ zYB@CzK+22(Q2+3JRA~U$^;-aRLMj$4Ixhnt^_X>*PNj`%Uq2irIBWhVY-+xE^N}-8g XM%7t@7$!-M00000NkvXXu0mjfq^_Ud diff --git a/Items/Potions/Alcohol/Screwdriver.png b/Items/Potions/Alcohol/Screwdriver.png index 8a6347e141f71d8f2f5787527b1bef94ca984bf8..e499f35d906fc7cf9e3fef63665fe2e02f3139b3 100644 GIT binary patch literal 402 zcmeAS@N?(olHy`uVBq!ia0vp^d_XM2!3HD)!}=V76k~CayA#8@b22Z19F}xPU!dT| ze(pbstUx|zfk$L9P}5-$W;~w1A_b^H-P6S}#KJ#0MM3a`x5hvAi#`c*k_{QsiDm~G zo|^eRcDD^b|CySVc1oJWpy_yHimy5W?8eSe*lVo69 zAEiG-?Y5hk#@P>F=jzWe+iNN8bN;dk`{h+{)+PKpyy|ztE`1dapJ2IFay&5!``6uk z!1HW>Y!Ryu_wg4EnRyG(CfvH*$L%vYSGmnCPuJ5xEV4$VCy_zq)&>D~##c8xxHV>J zHW~5+oIfVLdV9mi|8rj^^l)D|*T3LL^HD{PHwPx$U`a$lR5*>jl)X*@K@fnyg*!wKFwr|extK^|d;-x%6Jlbt@Kvl0)*2td*3QZ| zFg}EZ+CU>l`7=TA;3S^Ka?t}JMmA2fnV+5gc4l_P#qKQQqI?6(*~Nfe z-5iW^_;cVB_>#>?l2*TVlM`rq1c2VV3k=_NeJ=+LzX`*LDD5WN3W}fKaXQ2+n{ diff --git a/Items/Potions/Alcohol/Tequila.png b/Items/Potions/Alcohol/Tequila.png index fbc599e369268792a6fc01874f655ab377cfd819..6c5178cae7b19ece4eb7a21dd8be68186d3adbc3 100644 GIT binary patch delta 476 zcmV<20VDq61N8%tBYyw^b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi z!vFvd!vV){sAK>D0g6dPK~zXfV`Lxz=DG9zhcdyS?|~thzH;**UcF3En(6?jtuU8* z$4P?uD_1*#X&9Jw{Ti6Y<#PJFSV!F+?BX;{EifM)3_cgb0DsKomv0;Z^K~^G!1REn z3Ze~OvEnKi6AS1c#!|8};IQrO+5zVOH4p;R%opB)>EbdEF#YWDlL1Z@upGxW;Rcuw zbD>`V#Kr3$fGIfW3iAfjmoA@2F^l#thPgDVUI)y-zaQc>xuP>*8U`NqnSg0UM+Gnq zQy0EM98AMpPJcfapSz(B=EFeGa#kn{0!ku(Ls<}Dq;V5WPk5#brfKeCmT(CzuuDC> zVJ?BV0Nv%dfRr30wXC#z38teSNPx|wT^JkkLTqS{-~bCedjv_hxLgbiQMfl2c~J}VuA)|r#(f%AeX{iix1E*j9~y4)-Zs}l~u4XhUG*{_j_QP_AcJq$_o~_ zbQv{gIV4JfX;_(n4qz^Y0ouD5N;AM*{#OCg@*x(y`S2Rbf&f^JLL(P5FaQ7<$%!Aa SH~XFd0000;kMjomFmjRo#8OjA>aI(z(Mg3|`a)LLVdT!$So&9p&E);ebP2h+ zd+aBcHwsYPx#1ZP1_K>z@;j|==^ z1poj532;bRa{vGi!vFvd!vV){sAK>D0bxl*K~zXfV`Lx_9FSx94`qVEg%5mSy5Q3% zuo+BX9u)vV7d;fw0J}sk=?0k3-~*u!#z1J8%joB#I0ad-i+>g_dJN`&Gkpf8x$33B zbo?q=Fikxd^@^d!2B}~hzdV?xo{OF+LtM1K^9)!Z$Q$DK^$)-l94NR$#9`ppUuH19 zluHIoQ{P2b7&*ZL?zg{zX*f8H8nH*A=?4bt*=ZFfzN4J3~25T<}&2SS!#h-=Hi#|cjpqh&?407aV z1Y;NgxdiSS5b%RyG(bBS!GSsyqk*IS5R49}@1n~;As8Jz*vA6KpxA@OAPDGlKrjqY z%|#d`WCA}VJ(e=jnan;DBWUf;d~P~O-yCV%pSHUP4-1;EQ)2Y_n0 zFg~4%82s&Axc~5@L%;nWDTxxO)_3(_D)x{a(WoZ^aMA8Kfbx7MLNcf-^%elxj3>54 zZ^7S!-8_Aa=;x0BTcZDx^w;o+npdB(hCy?CqQpp204nvC16ZC-1HC*ciRMT5yYFAN zM52v9xd6bEBt9I#(%L!ziz_7nPL9t3s2&{xFyXoaaCUz=B%(sTsO@i~E&w-;nk~^c XjEz>7%n>f700000NkvXXu0mjf|GJM5 diff --git a/Items/Potions/Alcohol/Vodka.png b/Items/Potions/Alcohol/Vodka.png index 2e89309b9031fb23579ec2e11dc89e9c3d21c70c..b64f3c0f1b9fb5275b5502108ae0ea2a033a9120 100644 GIT binary patch delta 476 zcmV<20VDpH1L*^h7k?%Q1^@s6^tY;t00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj532;bRa{vGi!vFvd!vV){sAK>D0e(qDK~zXfV`M-BVG?Tpp-eDX_2L$W8W3QD z(j)^6)2cP>!8U5KOM>|uU!DWg=r)sWBZkJ?AD)BpwVx1-3x810Mi>D35ri-B{{drk zKz$owe*FCD3mBsV>e-0PPw0U9e$;5`1!G)*Y#ZU}PtU{}oJLD4CW86letKX!uWk~U zKDK8)n7(x8C|D2m{YVIq??;&5qNDP_0);t&U>XKiZn^|zK|ps$KA0xkMiw4EK`0Xy zz-+ovQw*lzfPV)!Sva#S}=_c4l{lL)8yMIDJcfF z(LcTnEC93d{;S7e8Xat0*afC3w~?0*k_fe=Ou#hT^;HXCT2%m&ayIioNQWp2BtZ9AvP)TN`vWFjNicY{p+W|H2F3{X$F|hguwIXuP70n|R<0XTX(2cQR^^nZF4b|z*3C_LZE6KI`v z-^Txcur;IL3jm!y03Kf-ltx((ZZsk$08M=efU>9qkUl=N^IRT)xo8vsLo)*!W$+^E z7Qp&u27tw>5daQOZ1Zj|uiU49=yk zV@v^Xb6*4?5r5BG!Hj=x+>345fwLpQjjO37(4Nt4TJE Date: Tue, 31 Oct 2023 18:04:08 -0400 Subject: [PATCH 42/43] Add Goblin Tinkerer name Neesh for donator --- NPCs/CalamityGlobalTownNPC.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index b92f7d4d0e..62780c8741 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -111,6 +111,7 @@ namespace CalamityMod.NPCs "Katto", // <@!175972165504466944> (Katto#2858) "Him", // <@!931019614958256139> (@himtheguy1) "Tooshiboots", // <@!333532730593771522> (ulmod) + "Neesh", // <@!175803493464932352> (xjetty) }; private static readonly string[] GolferNames = null; private static readonly string[] GuideNames = @@ -280,7 +281,7 @@ namespace CalamityMod.NPCs "Katsafaros", // <@!190595401328492544> (NavyGuy#2650) "Lucerne", // <@!271954788676141066> (lord_lucerne) "Milo", // <@!401849201597874179> (maskedmilo) - "Octo", // <@!796112889353994281> (OctolingGrimm#8888) + "Octo", // <@!796112889353994281> (OctolingGrimm#8888) }; private static readonly string[] TownCatSiameseNames = null; private static readonly string[] TownCatBlackNames = From 599bcec0a0010e1ebdb936acf4e58021c51f4aaa Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 31 Oct 2023 18:12:30 -0400 Subject: [PATCH 43/43] Astral Slime and Ebonian Blight Slime Banners --- .../Placeables/Banners/AstralSlimeBanner.png | Bin 228 -> 405 bytes .../Banners/EbonianBlightSlimeBanner.png | Bin 198 -> 416 bytes Tiles/MonsterBanner.png | Bin 68793 -> 57686 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Items/Placeables/Banners/AstralSlimeBanner.png b/Items/Placeables/Banners/AstralSlimeBanner.png index f0b29d9d7ef70d0571dc2fdb908feb414b22d9b2..eb3e963b44550e01bd4a0b4672fae1897dfe3409 100644 GIT binary patch delta 378 zcmV-=0fqkL0hI%gB!2;OQb$4nuFf3k00004XF*Lt006O%3;baP00009a7bBm000id z000id0mpBsWB>pGDoI2^R5(v#WPk!w=al~-`n8TCm=6P@SMG!9(|hND)iQy3BmlSu zw)Zc=Sjo=-jQNyBz!)YD10>tPXl>*RcKdfhF|fcp9VIXg1AjtS?ty8}_piV-`8Ie7 ztAPd9{`&x?VIY`E08DRtdkajHZUdBNK(`47U?v|ux0$?nfcv3IfE_G=3)Fr138qQ6 z!N@roYy&JbG9(^=X&9LCLIF&}LXZ4Vg4xvl|09?W1Eq}oVEWwNxfF)dCT%vb050Hn z^%s~X*#;I^Ds#Q?6ykQLBrY%w1N-KE1Jf{dl!wx8Db&>J`V103XMA z?feR+VK$K-N>CbMa&#huh5{jm`49$_B0rQ`U5mkfvH1HC%!h#!%<^EmdUr25p~S!d Y03#7!Sdccqp8x;=07*qoM6N<$g5ndN@&Et; delta 200 zcmV;(05|`Y1LOgaB!8+&L_t(IPh(_&0#oOd|1dT-`t;s8j399^0Rm)e@L>`_v0%%; z4`4n{8whHEIc2@%Yp_XkU#gT2J~P(obVaN2HOR^_(O@H2C_X(apGHAzH4R5(v#WPk!5UhV%-CRXs}^Hs1~CNPf#fMJ7>urinr1MlA6 z1=Hl)05e%m-U2M(F3An1kAC3-(=VQ11Jf{@NVb6mN;9N5YJY%f9&KGP{pAfigkJF) zOp|Q`Mku9PID`2xKU}-A8B9|iN-&c(gT27?r>j@M^wS%U!1U}Bd%-m6p#+OrSq)h* zE#Ykmra$RBf$1-MkAi8T+Yi7r`Jp7I;0N|gfv+u?e_h-JOfT=u0n_A%l9o;~*ko8t z|BK28(|i~Afqv=hYqx>vwdDGN<;xdHTH(1I7W6B!7%aL_t(IPh(_&0t-Hi|1dT-`oyObj399^0Rm)e_^0iFVgb|D z17JQ*8whHEIVCJU7;MstGjCCBh%gZb^H(ig3#J*#)?jIF1~x%fLl(t`$2T5>`NvP5 zLbZWt4d}sIb#*6-4Q<-)_(O@H2C_X(ax~o>L zphoQytF}ZC5q@u<&-eG=^L?H_NJ4Vuy3To>b6(fEUKjGIzBb);j_VgLT%gl|LX0k4 zxW)uLzkl@#@Vm10kN`aVkshalFK8#N5H=lXiw}f1Fx^Wf?D`pxIq8? z{O7N3@4^=sF8tomfjlw}vfXT<31aD-Kjk(Kp%c7T^!6r{@7h})^__oSL(;+Kj4W=k z2pdp7g}L&LupUGay2Gf*r}9o6DwQ-;(!P-v>J95pUFLdwQ`-Md1^t~Q9*ixf?Din7c(EHu>LVXx`79T`)l1OkDHElDgG*A3z+x> zU4LE??B>ji48qq1UuQKeiTN6RbE~GGQ=41(W|HqS>vNpZ+v83*4QHuWL{nM8$L#q+w&A2mC zc3oeQe`=E5Ts%Tsaj@kdrN`t_#N0lVtUOE95W(7+ww^sD?-%}Dis*JR*^HoBG3%Fn zXn9s{)4U(-0T;@>IIWA#;HlR<{#e^qa_Q2IcdER+ZATHYEu!&h19*60K(qN)%uY*L8zitVRWJFyC3kG`IhW$RU-cr%;ZQCS>Fx1X(FE9Bt zJ?>(e?%MNDI<0(MI%0SKdv4Cpi$tBa)Wd(ndOxIWT=uYTw0_+JauC9y%=vrE*MgaM zKHX>dVDPyA08Dh_8rsPwJYctbeU@wFa~RXR+P)PBCi)cqCOswJw0*WD6JrWr^qyCjS#q!Y(3~n{TTZ-s}`5>EliYR z##Dh5vS$4AeZ_1%x2#6R>}S2o$bquE>iBr*XxP~w{FBqO_qf7$Io(8=9G;m$W;pJ# zX1M{=h@|pJK+#PxzIuG1H_NP~{Ix%Vswwd8)F3^slDDz@4@YCc6QM;Wx*})Zf!j=2 zN7&nqj1~iTQ4&rhA66OtRn?GKNeV6XswnGDDI^!Aa=Uzhi}F_EHBYzq;J-*ZbY=`9 z*q;`E5|VK9vso_FYC&0N1riMMxcRDl<(Jd78{hEvWln^8sl{&%c)aFTu)PHf@2Ezq zF{|?7g<+PYAZkQ+@M^J?SMQD?F}NQp$AQ+$9d?!dKR*ndeZTpP4#Kl77kBm}&*kI& zQ<|yQu8t=R5bpS!Zj@KNnD-K)iRiPxs@q~@ONESBR;GvM_41ZpsegtJj6btijfjs2 zx9oTGf(H~rP4mWE+cX*~pz=F|iU5?Nqg1-b)s5NyIQ7><-IEkf5&X@M-shLTqkC4jXVuNX5p{UV^rBr5cJ_afWV#yM_ z=>|7TiV?I>*in5{tLfggU3dc%P>3d2iE>Z;N#97(oC0^)>nTYJE92IW#Cb<#VrudRlpiN%B=#TjnGX5?m zfY%qA2Z~aHaE#peEY8FUf0joK-Msndok+2w5-e^75AyUus{a)>8x_&_Ax`<8&#>8d#`vl>NHy%wHoshyUyNJ3@7mGXu;#H_sX13 z3|5S#l`(`+2>->%8-6uMcdn?FtWt){L+(%6H7sUTIwSMyM5jC*TF`4OaC6v zL(-Gq!q816Gj_&}*3YFzrfh}{u6sr94J^vfF}nrR#95VAk}h=#Y1}bj`7@HAq4`+G zuxW}t(28H;_#5$B*0)rHyZEDRJlMbFAEIsk2s2o4Rq~T+pK=W0X}zWmCLI&Z6@9~7 zepD?>QrN|cA&2{Qi5RC`zd|b~elmPxIiSFTtwzb;>Qig2R+#8IQ4l{Ie~1-7jD)^1 z8>a4vU0a)gk?4+dD?RX#uYL*E`tQqshxU@$R8CvdqVZN9O&l)k)oAXkJ%R~Gc=#HoQkdY=l- zWAo-_ERuU%V0ZIR_cPRKdti4jHFkq1wH}-?f!}$?G=X~kk#~hf@im5sUmbDjXDR9y zj@vnUaQ4$xN-JKSoGEv4%UPYS=HmG2OD$)P-p-|`sR%nu73;i51E?(C%C0o#HJW$s zwJ08;60YgL{nn;;;&1+O;l(kD7|t_zNo7C}H-GVunA!|g%rx>)f2@>cppt$aHzH=) zcP7m=&VH|$G|r@mqX^bPSEx~6SP4Of%RPVfhyI$*g-LkyJ38fm!j6BswxVmy(Z+|P z;rfUqUzYKtHh+cBBp`GzYEI?ciPzKta9sb zq<~Yd<7)$!H*E}-%ev>=7}P@-SMvLX^1)a(hap=9f02+@0l|yYHcdQT_NUy-0fP3- z@qI{WTvPKbN)paC@`_vBHGX5V$wmb8*|UYu=w1**IpuMd=Ajb(OMS*aF%;>uvlnGN zVCt5@igpi0Z;zsmr#}UoAZH@yJ;FX3&UsLNEbl_Vz4pHJ>ti7U%k!Zl&daOvS1P zZZM5L92l3;7}&8VPI977dw*-D9^Rq7;&7_e96ysF7fEgiNLj^Hn>uFw66YB% zVZHG_Zll3$gAJlcT9pFmM$3$(3>Je^3kr3izM-17b>l_XedfE?gq&`*!Da8+GMD3a zr27)4sUcV$FqJTI4NQ_-zjbP(NeyklTF-CmLBjP;W{0wb*h%aYW(#|6ta0-dhno09 zuaPF^gTPJMefcrGZmPjMm8pSyW6OJUwbnJ=(owE1WB8nQDwiS+@vj$iuj0-I4z!n% z#I+sRk!r6!L1%xJRig7`aOZ;;C(b8S>qZjArkX7q>+BV(56PYtOq@?zt?Y(J>?sv- zgX^au61>W|x2qZE(~{j*YeHd77N;#+`Sh+kMBPu=PlUi#YTe0|XND9Zr$|H7*~>yrb2ox)nOACNI^4Pk}1|b($AZ^9R1GL^|DC>sF8qeU>*)Kt71t5PCj<0-OA> zMg~7m(QtxTp0Ey9q~o@j6cQ4`ZC|&zN$`3JjQnrx^S{g#F2@vgX)(T{T^DiTOT`;# zM4NInBt}N|#H@UJZ1QULB+8GFNnEGM(k`>ygpxrk9(Ipft1EVywny(- z8AOpA%rq|)obDKCzTJy)1f_Ac1$tpNf>W-u zV9oR(CdG^NhQ8aSVKgEG5TJ#iL%wpEj+N|x{CA+Z5d1CT(jt)u%znT18d3jA|35U_ z30A^cX)}S>x4-Bq{Nu}9e1{t~Tq^VkrSv#C5xnEYXxH0;0X~J*QYLV1i zghk1U?DSkD(t0sTjz80bh{`f^D}6bPAYYa*l_G?W6(t1ewf1VfbprYg4A%2~+_<5< z;I$x@nTT|DG~#qR#gP7>gw@ambT;vVsakAj{5gEg*jq!A0f}x&9w*d?s zUQvttAZqgXq$S#$U)MKbBdQ@0n^Y&|a>DRYU!C0QgOBcsp~y*JSS2S0eYATiRb+h& zcinqeVEc{2z^|DZ@C{6D(GA}Nj;9g7Oxp@WqEeygOt=z1?v}#-w)uSy3iemkqIa{*Y*FCWH08%yA@J0zql-y(`Hw4u& zkqbX(Z`Ndv1XxkHaBPNjfa#d_ltHT1Hga@DxR>=Lzm8d!iOXn+zE(%D5!d=;Tq%tj zF@2)I9c+}Hwst(Z2__O>X;1?XuWv)8Y;9lintR_Ai#ZlhA$}t{MBWc#l|tWdf_0FB zI`3|AP1^2P2ib7{(-~5%BLuWYj+<+7jf!vC;VF6=7MBeltJcBj=jAt9AP%!+tY=%=l#T+4U;tcfs-$c?5P+|WVkQSbxh~npO-qIxy^<}4{gZpE1W7VsHhf4IcTvTCQE~puMa+x0&N(OTGMX>V{1`TQ(GWMS;5?+OLC7%W z+4QvuW<8CJ?ZqR{W0tN=A^O{dlC9Tq(~7L$_p&i-5ZmF2>0Nquwc#faSK;((@;7{b z2x%QjauXmFOK`>*89YC86^M9C*;so8_FAnLc$Aj}B#wWm`24${9zYH=6G z&|hJ_6AW(aYg3i7rG#Bg)UxF|{$`fU5dQnPcE&xHw58<$hsi&2U%KX!t0qf3?RSru zl!SE*)~;-I2d~d*Z|{_!vfwX_JxPK;uv=pLz4&(PZcw=rm{3g|QoAFmzh-yVz=5F% zs45vumR|?A)rau;PD`2dqzGs^&Jf7gAt9@Ft;S0}zC;bRrd-bQm~R&qkx5!P>w-&& zvl%O(SNQ~@)@-4-F9jGpv*0fLVJnvyXSVB|sle;h0n@+2A*#hl#1Iq$Q;XdoRf-8u zDBCT;b{N*wlE>Mh4Xl?+bowVAj^bd z8P169U;UHC8yn^d2Fo&0s|Zx^1i#98(oGjI3~0z(XRtam2yiIS2kdIlLc4ZIe|2d?(WF4}reC-;ktARYbx^#-`R$Dyb*2Q%H z5FLAb6ic%5|3-S=HAv#r3|TRKpM)(bDKT%0rR_zx*vlFq6Dgc?5ef-WQK_rSDQM_! zX{oqK8)3N*butyF0r7x+Ri+Qzf2dLwejRKsW!EZRW|#liq*B#w=E|17sbXA8$JoUy zgOSt2+wc5V2V+lEe?_1EeCGAM)S`)dVu8kM8TKC7X3waNLH7?tNBN)GJ`A@^y>n=V z`cNu7PQi0j*Vh92$x7G^JW^#xjW2EU3 z3i6JY--0n(lPoHBi`;L0O($(%CYTJe<%H`aMZTWM(XR;+MCL8ZX-p)&AGQSFg}GtK z#-iJjgdzoYcz~xMFZLu;L6wc|_g&kDOv4wd^eoLCG@>8A1C73tFkn zVBVBsP0r8I0}E^HfBS&(6|Q02uV|<3=GWBFim1KYdSBKXP(+uDb)OLvsA+rESIKe9+UpRSEV?+Hv4~SZkyFI3CGY~d7ic9nQYB#>aQ6d^g?=Na&SiU zE7v_<4mVNL@BX@yS&v%uHP9BSqWxxaOcqvcrP@}NJap=1p)`o3P4jrz1GGBOP-IEt zB^GVRlXxqHIDO6#5bB4Fh?CK<2354iwfTPqjN}+evJW_8LMG3gQjJ^%9AN8vEk2;- zfjA=;`}UfE<}@iZF;H(AqAfG&2b}_!%^+Ohf*?YFD^r1JdFsFN< zW4`)*&rbKwo!AMJlJCa9^2Khvy5`2l(*R3+XX`+MEt=QsTTgd+lQK^prbnDt zNNtppCF=wHEN}z47ai+xm>aLMcXO5d3~foVWdCDh8j{@<6A7|Kqgd#_`)| zu=+(%r89>m{O@jg37S9$CIc5pp??t?|FQ(LRtkFXdXH)Q#+|ciEpWnD1#gU%&#HGZ z$nd={cOa}-3#=}K3H&X#D5ry@SmupCfk5P#xYHAqTz@h%ej^rY<%r7d-snbE?`^Kf z$T3rG_zmkT37NA?Yaoc}i=AkZ_I@aY*|3onv1!XLrL9hX{b9$_huMb6F;f|g-Q62k z89W4x^dPk@hOGv9Js|7xe#lsuy|S=<7=TP^ny05yc90jbX&A&%!_Or#WsQ@ekYFVa z|8ED}K`b~9Gqh5%o3PZCz^mS#J7Pv7ZnR*B%zs|3egQt9V5)JcYqUxLc;BT;a%io4}K^%cb z-V{1g=gbbsUgtdf7Y5J!ERuMwmJywffj+CUbeakE-?@iEll4GFX&BdiRb{`{-8fIn zstV`S#iLo4ty;Jb}fAH4oyn!0kjQXO4S#do-jq!uQ2NE(cQdxCi6K zmIz9FF#ug+j=vhI^hd$2ROl)&eDLou!JY73?zuBy4@0*e>szx`W35(S77^mR@O2q% zQlD}sXXD_m`bT+ioLJBg=XbhAYicIOZ`$2D2U!@Z&F`R#{IV|%7B}-&ha|Y)Isc=77W9UsjOeswK?C6$ z<@2j&x3Lv`ID8n!UdC|#=MxAshz^1}#5ac>i+6Fp)dG|JWSNV!a{9{G)WRP;x&NkF zm94udY}^zB;58kQg?)2XjLDl_2l~cAoNPbhhADOiYu(X1;{v5Q$H8d3u6vxnZPCDy zYot-`hB{E&tNt?9ewq(X*W-fR>Tg3}zbLXkvAK1AAq+R|5Llc^a$9m9>cZzBsz^2kAd@Ca5l1L zaD|);S2|^%!nZ%^Pq2_-8ip*b#%{O}LJ4~uXP|g(2i9`6u_wktc_?!@RLYuWfsb&K z+dC)RuRUlN;p68y8iK*P3*@*7HxzkBBjyrNAMM3k?!Ef zICZu7pa!smsT}h#bo38@(swPrN*=TZDONABRf@39zV{#zQ>?B4PcOsfS&+{aX*@|>{Y zb0^NIys`$)D+kPj8`rv10qcX0Rj+PUX0VOpo^+C+qlb2gN0cWrARtw4e2aT@edNW@ z{K$ftd1X+eWu7ea<}-Nt8pM7bEUvz8coilZ4zI~+)3M+QSQq?j+JE5)&UJyuqBzX9s@imzDO#TZUL zYT#%K9op|cNFvLq$q?h+1;CT5PjN$6m!5Kyl7Lsv&N*!!0^k{Xphy@@*XV)RUcS{+YivAJ_=5;EI&qU9mr*KWqb5B>j}9!cykUTm}Rp1r<4i z#~`oQZci00{Un5C>gw$O>}4mHO`>4n`UJAF=sHZFeadEObrM8`$YPi|e*C;|->l*` zw@$<3GU9)sSFm#Ib{?VaLxLRtaG;!Fxt;Q5ykH}dwd)$t)v3e{dw=%nNl$|gXmcX} zmjl@UIh-AUqk%)%hQx#`U>1(p5gA5lcV_{x?5^y73O_5o&}~AODKkh~hUq*z`G<;{ zhzO2Ig!%|&$nk^hRk_=ps(V&i8ghp%Rju1>pz?c)V4HZz4dTO&@o`~xr`R5Y(z8G` zM3$k**fn11>FmWiBcj; zb}#6k#>jz+hMv@rFE3?${731b-7He+orw%+Ktt444g|8Ryx-5nW^lVonluW-Fmc3| zrXjAPAszisApC|XLqt-DBj0xa9T}Ph`mI?RMiHkHOi$}|a0@MNVQ}s||81(6H=Aas z^_gq`#fKOJY0&AsR|$I6#WU z7-&>i#yzK3AAi((D9p)DrDk*ZT^)F^)FC_4F*Y zO#8GPgSeBk5(Bbe+mh1$Qglh^_u!EVone--3}7u@3N{jhV-q8 zA0_e-_cE?Mh2eh4%2`~`g=&(CapDl&ch8!&tjV=+clg@Fu5dVuIe4hfRInL6hp{Vi zMK`8$jaF-qKc}=FMuXI6rP2|~AAPLNY9k^(DSr{K%Dj^UXG{gs#%iPs0_3(2)v zMwrXE3R{LVQ)SYT{c(`#I(|ZoagBEH7iWQcGIVL-IGor}+cPwzWjc3e=!7^(<7)S# zfcFzM@0u%_)!MEYgSe7Ys|316G8Tid3kq;jx5V?pu+c!N2D-K_6n(~u?z6YB8)+xv z$0B_xdQ2jE=Umv|Gj=EAJ`E_~MgJ?voYz#smI)f7+WH8LRb60bBf$)TJ!vvL<{%g@ z3Z8HU^3&SZU%r=Gwe>!_yoX(1%?PXerJx#n?uz8VA=m-E`rElm>wWl09Kq#3+00d> zxurmH{m+tYBahe1Bq=PuP<~~WvBW}-DO{BnWbKXaI2t$QH!RS6gA%}Mtx&t3q0*bm`j7owOZQ~Y&ShbvI%_J+xHWTC%7T*|<&N+vwl7!X6lZ_=vl zJ2_DEZ?XZW-ZbazCcnPjwUF)d>SLl22;*9UDSRT(HEELd!SU-L^%8!oHiR9XaSO?D zC1++bMXPN*u6?7hf}xx5A7eSD;GcJ0YGh;?K^(E8H~>Xi*EL%XS7Pp>-$~8I=)BmH z9*qR7eFta*J!R16lt>746EK=T!`?rq0Y5L|16y0GH_U(_2l9jOwXU%Kl!_h_z#TbR zZ}Y<9fqV+R31eH$xC2(_2W3~fdQ0;YrtY49cK&L&%M5#}|1~t^B($B+`mp#s-fLdn zc%r7$`9kJuHWI)H)3Ww&MICn0jE?|FWEm{*M=wVmL&0JQW4UuqDa|ikPMdjyAHB-_ ztF1>C@-PD^#scolqMS0ub-dpX3bnvSWp68b3QX8Wf1)>fiSK9k^u%cLpF%rCF3oyDu9Y<0 z)mfmbUOQMVl)JmyM83ZQlj$)8FSq0%-j9lEkaQIQ7pJX7)~)ek80xayoJx>AtsL=* z?xp~iS`vo6Csla6QRj^Ev>|qn8?DjS9D#>sWg$=8#6z0JyP^P2$mC52su*Y>k;5>j zK$t?^MURQHA}^d5L(WNC!Pie8Z`?hmqR@NlMCzKhQ>J!X?|-&!G3$2~ZQb}LT!!1e zDFX};*cg1~@oh1DEDd?j87)$U7p;i|hS%?E_*`j3$0G~T=0y9va~E*u8ZuaVwy}jw z?vNDXARYqLZ1s6+g+A;631#S#V)<_$W-l`#xZou7NEKjej$)qPBaHq0b`6<)1fXo! zQlED%HpIMAehmgqAc4J=HN0^yI|3o_^54VmJK6KD1JI5gssU{ymOS;+I%WMR4(Q1j z2Gae^akx;hr?lkQUjYE`Ys^HQK)}I{{pkkDl3hOD+pAxf9d8KG|FKJco!6Gztg}3~ z@5#)(qN+06-+7RE<>$1;_e){JXCjz6a}-RlF&P~)Y>L;5{4144xr&|Q;iWPLT^hO( zZO##a0QQ(0O#wS1w)NX|{2(Hq>=DqH2_7pQ6Vr4rNrOgx&bfS1dfQ2LJ@{+TXIEx{ zB6B)o{rI3&rYJY z8PaKX{HJ6k%xBw{T5=PwFL_E%;a6=TDz46VjDU(eVtvFye1ZI-&xOnFB9R+eN2C8Lm#1M0trU(^@(dkM26H*S z2JwuADeN4s6x{t6GVNoNPd9#Dlx9D5KfK}d=(^7*{sIWS6Fbb^L^`= zRC94>a9?|ynkbzL4>L+m{0_Kp(WX2y(`oOPwWZ~es+vowb1XcP;2^?l{z&}nruXj$)QrKWe|tRU;S0z!89XdEgsx`fb4X*Qzd>v$u(+=s5kHbl8O-5ZDgg}6sMg$ zh0wb3op4Ra%&}g{p|Ih%Le2XjHOwkkQ41YaudnWXsTLRbRZ&+ndhn7jnZ8yGnO{?K zX4B^ocEY25XbtL{OB?81lyPe_|0n$|qBA?hzcQ)9Tu)qbEPUIN)sYkmNP4N|PL;}> z^HmKWr^F?~uvi&W3T?1-eTM@bpj_ax4(}w4ejIZMHU^eBruE{RLr=Egs(q@T(qnN3 zl-X~*!(REEy5-U7cO$S@M9r_q9XNB*OR_h0&l1sjQ9DFGQPyWk?kLggC?w*34vkMh zV63@ut2_Luc*mw+2UD<NZHykz?MB(wuY?`eVw-;QWwqQjep|v23 z-;{GBoSv{Levp)46*A*>Tc9|bKM_gpba+!K?&T4Lh*G%Hfar8cuN3D2+IkBiUENO> zRsn^^Emr=1Dr&DziPMqtlq9;b3>6*|?XqAtEp zIWzmh9=~lDSAX`;(2JWvJXOXfEbj>ht!rt z=DT+rIk-_zm>mEdHH44?E8|X8&BXtT$Qo$}kmRw?e)D!R`j#1BlNEK{Tgq?UDHtNDWBk zs+F324mQ!;bQ6)x+UhN)53lo27A(Xi0*e~>!X71#>b(2HV%)&?cCzC%E;g#7ao5ip z*VDD_vjYp1&~2O}b~rS9U03TSom;aLk_R|BwWWe-(dvn~sNU2l3#~MTtCBq$7zbFV zEvz!7<{SezQ1(4l=5ZRyPO~QhfU8eFR;CXu%{^xBQyUmm5$te??o@bv<{%BSU~Rn< z*h@xqnx04CJ=xMm^YbUbe}=X8+jLy{y(`W6{eOy70?SEu8mb9#kpAv)FK6KYU*C-} zEZopie1)$sr`0?9d=CEwqUUUgu{bL;#>ve{`KdU7G)Qv(>mLpQ$xd+V9CP=euTa|g z)zyY94B961on)ZIf4vi>Xa&cxw&Q$M@LO$+Eo!#n9p`8{AE%NX6J@veP z7}G2(ZX?dyVr3^j{)IipmHR7i^&#?ngjn)1@P3bTKLk;vf||a@YIbghv!Ei@PCNVh zbb;9nQ}2UMXF231Tu@GJe$D2}TLB2cYPXN()?#dIs9VduX3QunFZoK@!jNa;0;Mx@ zmFA8f9deZ~K4*bYj|s6q9i%BrdpqWu;(uHu5t`>wem)0r-LciI59cUh#lLg97E;#? zEW+bIII<`-EowdwG*Q-{j9wat)t=6E=0}H$trMLNbn)Ns)fXU~#@d4_3-K~6C_}*Y zH#Cx?%;RPcrA(}XP*GSs5YAiWN#Clf^!_n7zO(a7gw;Wsd02n{wxSnVPh5by?NwR0 zb7p1UFMBA}HGK$G;gMqXFz;6b!j-8?+y&3WM!N@ZM4Dgy4-$FPKTSPysEqD>{=&jR zzXPG!>7Z;>rhWKqY)l8p{_mXJsMsQhKY=HofDgE!yEn#|bZ1Y)&qMcmeYXQR2i@~G zKvcUN?tFy@8%r(;A)?L^q8UEVaqjC|#1}G^3J-X1qB?Itl!hXIHBy?*-_zT&qB@&> z&(5=f%%F`Q6K!Q`h&ali?2ZE;nmQfZX$qUHR2LU0`t($sm57ql)i+cyKD_xqwPoYE zw~NKq1gXa4&}ZV2RtF&6N+y;aOIAECU_)s9X5XYBy+b9tr#PywU#(l`P(pbS02QTv zH_#76Yq9^6wQ{!^MDjah{Vx^~+jf9HUyv0g@}p|E_Plxlarq_8@;v5QF86)ty!-mB z%GIshJc!%;iEeTfyxx>Y;tp5_NI)L&vop?BzX~K^w3`67{eb%FA;Wa$xgp*+ulfI~ z&uE*<#ZDBe=}dXX10laDcGIg?r1^z%h626@>OJ2oF{`3Qn-Dryyyzd*?NeV_UEvv# zeR*w!w?XMXUOcN)n?g^_9_Vr4ts45IS||2^&hQG`;4I^xTEB)8B}rbK>HX@XyYtb2 z%pk9915|FniRpBItu~XTaqSkkR<2F*FM1Ui!aS99BgiG3}x!jO>SvllJ7KswNJw~W#(R2W{mtV)u_t zAUjJ-eTIQL!PKSiQq$YHy&5Xncm!zG0S&#JNc_K0eLgh=%y6HDr$it$e4oPA4 zBu?7pLUdZ>k}!2v=9RoZpx*)WS|XY={3`_lL@48^Q7QK64=IA$^K2ixWbVssqZYqB zEE(#NobB*Hg%=9vFdNbvML@C<|X@J^!iP8LoWJJA0QX$S)u zYECv1Wd3oxRb>trH!h0~iTtP%Ni=yE<+72bCbh#>WaW|5BUJr7D`;y;RNG+HX(7bl zk6m;GFQg`N4{MbF7#YS@@~v*jU9=b88+Zm1!Oj|>hR~eyJgEjK)g#sSJZP79i9dCM zSU;yH#Bi1$4r3Q?^&w->O&0vSo+G{ni`!%|wpaC~b{de#C-Bf>=ua7+mI;qvCQCA# zmmy{&ilgN|N|^U$G<#2ek1CAv`nAmqkMw-sfT-$!utbElZ|*(8bx%jd%C1{A-{F&5 zD4$WQ<6(A#@Y$}~{E{H}?0E_jbS$F_vjgm;SpSThT|p!j?obXiYup2-^f3&5X!z{? zc|ahzojCFcH#TI?|k*9=i)#wE2Ts#xX8apJ#v?XKU$ zY@c%BUOU&^Bv$^4-Y)R37eb#!aCf`;w5=5=D&YSifM}#4oDs3JOoVx2aVpGFIHH*hNYj&F75k3Tk2P&>NF)w_%e`=W` zzkGd?D%<}4gdF%08yA)oy10$l(4tzKK1!-lVeNZ&nZ|7NJ4|A))Z={vt>K-^77Ay6 zZCN5lFAdC9tnD&OKAnQawtI###Zj)`AB?(yFb%B@Dq|bJU&5y_;;dlWCbsPGMmO{8 zb(vb>$($$`R=-f!i|bYE7P=1gtu$Ga;lM?(y+A;6Ka&+j@yXQRq+g6d3C~tT=^?bd{ZTUhkqgZa;L+Cs@-`)?n(@mbChL*N|9I&Sp05-=(1~|pJ@E5 z2B?=hk4?mShrI{VdzO9Y|4LHwJpdoabjvJ4U?grTL^bz=s~ak64W`(bn}w$!6SA9m z2MlhKM}5`XcGGOv;KN!;88m&Jo$4R4u?N0qs)BUXw~4`P^2KEHQVrIlz;;}e{G&G4 zoxk>fj^a$DOw_|(u2&0J$Zhm(eJ{%Wave>*w*1S1mg!9TmF&0yna>^P@w!&-BD z)xs0P8X&2WlysO_07hF+4-(2mKg{0D2I~!eY7d=U~EDAQsKy8nG>zivB*dG6k=R! zli3ZnaLY|CBlP*Xl)g=%MzKq&&vA)5Lt-b)C&p9xYBOKi$jSF=zT{aS;ER;z`Pg=W z+PJP?=*`T$ciev&(v;bgSRpeN9b%@fO4sE$q~l_IBPb=msUG zhIOOubn?dD@#ZaSEIr)|iuO0qsJ2N7-(x~wy*5&o&pjrI_xw&>Pkq3|MCZl~|C*gm zzeaHDy!vakn(N_>Yf5{^L98p%$&$0;BSSLmJ4emY2QSRHJQLhdpOO2(y*u!{o?5t!lIHo9gggZr^v4SW?hegVBbP9} z%!2+hX;z1c9Io)DzhWHcMdI45F7IRFagGuc_OrxBpp^z}&H>#N3t6F-o|$a!slobB zq_pH0bA-5gDTMXD_`jq+-0hk151ae!6_J72?T_M(+PtQ1v_%gIh9hoSWJeKi0^E ztE1`O`D^(NI50`>eO7d}?N! zfey)@(iTMSQoUK*xSK`CjgBJhQa?py^VrH`l+?nZSc+NX8)`hE!C7w?^I^xSWPzIxU#ziFLtx&rj=AgVRjRmeBG1XsoQ zdzdEt)0Yk!JGi7dN5~=8pFF zm&7Bw(fZZFOco%!kA@0&UF=)6S03{G7zR7fiR-J9fNG1t*N=0^tb5352vb~l9IS^} za|n;H%K3y{|2bqQVajAk>dTcjnEuX5K#b2h@P7r!0&oK%m}46e+-_DEeuuDEhzKYs<6JSU9-L*tq~Y%wV>VWMokltN0=|@O9y2Zv zIsp3>c`54@Rx3lu zbt=Mz2B$kOJIFQB*2{Fno{PIUr`x4pW|-uxoi1I=#VU5wb~kR>#%)}e%#RIQpH|}| z6v*?KCW=>}7P39;qO`_}9RVi>wj=CTwR=+?7OcU6QF_!BuCL){`x zx_v}HO37ptw47&^_}Zt>?W`gRs#1Tq#oVAvEc+aT?GAGd`>d=FmGit&vt#b5%z8Y~ z5yngYY!ixUZT3e&e~fahx!CB<-yvkH^i*FSJnWS5ZQlTz|pT&!gFmeyOAIK5;w$@OJ9D^6AAr%i7aIO5;A-TQj{jBp=#n*YC3Fw$IPp z`mK3}TE|U$I2|wUnHslaLcG;{wQYXW+_uJ~$lp5&cln|ktH^|qvMSw`x5x<|90N!s zyR*kZsp{S7_b?2P1s9(YNx_UK9(Gycu^B@jHM5Ftcz$6|NsVUJaG>BYpfqqZ7YE@u zo|^^>hGAE6o6Tpl1R2pw_!lyir;k1>!!KXWOhCqp6kDa-Lsj$r92y&&oFQ zp25zYF;-N3ROGc(tRiD=PS4h#+RM~}P5D<`5~jJ7G*aZzFS~IwdsvIoLa1YWHgzTg zLB3$+1(8EXpWnRb@OYmZ=i~Q}VL}mkkCJh@&vazy>ArlBwKyvuEz8WF(m%C$&q@ZB zt32}6_?!D;M1Ti@nkOAb(jwzDQmrB%RENF8@1%^sok}|zB%tqR#`t7eMMs2 zXuE%v6lHnZ&wh4!#Y^8MA9d2e&40y#%Qcw+$609}CH|@@l_5>G+|{a}Q~yQ8a?D*` z|2drL^gG2J7p=Zzb|Fj3N4e8_f{0;J_E8vmPhm$gW@sKfiC*%_wlX;330akhV+bfe zHVR8fw9~~H{L9f#+1*J9j}O^tN=HK;izoBbx~on>^ZwV{xc@l}K6MwUiZ0Uv3(?G2 z==&uk2yG83`QCKSZT>se$y1IgZP{@^Ja1(p=i>JBf=NWQfE8McJ5Gr(@XK>1!dn9S z)O+U9j?G0-tHAQU35G}a8~48E694#F0U%Iw&iQwtLFOJm4~9GC;5WVL7z6^yMu79c z$}#ARK+E9P0J<4IuM&*#7pd*SCaxIb32;3|Czs`|p0a)S+bEWVUw)^d7z~1vD5t zu{~ropxRSv%&`{Iatz%p=~-5nV+M``)Yp43nzEViEH>=hKVf?E6}LYf8fC?78eg1H z`Jsf~_?X8Lcwi;N6nv=<<0X3poE2fT(XaVruZ`_$l5_cfP&8+5h4229*K~Jg0vBTn zOxny}XUu;{J-UCH^;VcmQE1Fmb%LM&Z!H#@v zqTVw1MFmXf#sijR;hy{FY6mA9ZG(Hq1_i?C0H;fgXfwoC^y%0AIxmVb72q`~^s!xefkY3Zkn?@TetA4TN_Je* z@UsxdjCoHWDx@g6bjELc3?ozjlo9^=qfO4Wj3&CLRP?$seD4>-m%HgwumO{iD49{z zNI~xfD1Y4ZDm<>m%ziZ;uzdeK>7($z=7L#mzDw#I7~~-G zP`C9&Liy~DhAu;K_hl6(skmb-`ncLshS^6xCm`^n93A5He#{Aj(X2tgntu@&_Df=` zcczVOs-@d%6q=M#7jvE-2*${ga1Dr_B%m@OrBN?FS}>RBZ0gmO1jG;qkRv(QCO8|p zR$@mP-?Uq6=NO#|rnjAZn6OEJwFm;bwaj#&Smy0@RIZ9cr&h!rk-?G~Ih!ohQ9$%b zB;a4LcHUkJ*>;wKP|Ra^6b8xygBbN9Jqo+2UjHx~83sCOpeZ{Kd);>(d0M(^HKGkz zxGL(*^h7QcE@R1WsJWv-Dgyn%J0sC0x z6b{jl1=MLSUPl!vt#205UzC?!r8ReC0yF9~fNYxy(6(EBQi{6#M2)KFa-zBm+NmM9 z!;Z|%7P3Tb#6-6pjL_iPdrOT(y;hg)$n^>!`@LAp+7VJeV6HyVh;;zDsb- z2WcQKNdXcvEGpC{dq`j!OCM9G-%9j z{B6I>qLVTxfv#jECX%IsWK|%oCTXJlZEAm)Y=Q&_he9a7cAC8 zk7^6WEpN-*LY!T*+wMV$R>z*}xa2PPzFr&*1Gp?eag_nB4fw$ItwNmWlKe!DJwo(U zh1k8cb?4RqL$pqt2gHPZBMnfBCayvEm+CVl5gg-eVS>&rx}M&Q&_a8l)H(QJ+M+zr zJ=;kL*nzH=G{Ysu3YRh-KV>p9Zxm`{4NYD-7^MlPdDXi4?eND8J*gw7R!|L+HlppCAW0+YmI(_k!a-P!TTqo|-hnP))<_TN ze^9%vib<9oTjq-=pObMN&jRj#y9+nM(~LjMp1aLGUwa&1W<}N@=g{{m6gIW@piIX3 zN#{$x6d2g|jBlqr6NUj!b98!J>FZ)kl0o5W1mXP%?V*ag?0LvT`WrIa1CqHZFUjAQ z@HRP`%tq>|A1mu27l6Levvyk{T`tad>PH`&d@R_3Z^}Of5W5VJH$jytf86{4_W;gJ znkMtPD*>V<3{H~Yl9DlG-uU=%8VQCncD&Uk-+A*?=f^gJ*;4t&{5`6GZ1qP5$7*;a zIekoavtyX3p>4E{zpFCPz$@LOWRsUFt|x`~^FFB265b=xpw%EVb!-lU=!kulA9#R} z=>b(CKqaSLlt)&G8!D%( zCqTFPe#gHx1&3MUhd+}&L%L0HQN3f9I#`^t2=saw2Vtnp#qF*Cu^svU>(>5DzV`qA z&&jz6RtXC;Wms-|JMul`(`!D)rNr1C#znCHi5gC-7R8-lJ47xW zU&h7W{OO_$lY&_UERo)+OoHr#!+J+e#LT-tbcZLO7j2*N>$jJ`;P$;p+N~23`Sa|1 z0=G96+Hl|zF4jvynPqTUCAH)wgZFnK>}-_nQ{li6TlYM(rgAsy$83KNQPrVy_q&4p zw?8y?yCx!2(qDqC2;G3YWnCbSDq;_oFUMNaFF1F<&iQ*AyvQJt1q` zKv0ww#mkSa9Y>)g(*Nx@U42h#JH25%1Hq9)t8fNYrQS=|6?_FXbN9HtBVQayD_?o| z^hm;8^KXz9y6|Ye&a9YCY$$Xa?@34dwLH5!LqT|G>TGKNN{jb?W1>=e=x_EYTNuEL ziTC-!<_B#y=AqLk7h~8hXB(p2(yWxNzf=@8cGx~)SKg5ZBsfZAwPR62jBOA3VvYva z_aN5R+M@p^6QSCq9qvD?6m7d8zWKu-S6_C)wq+?zOGWC@urV&cq{T9Kyv954uXVI% zzhqLYPJHcya*Go69;$hJ1F90(uwrYoGd}sWYwms~>-yr_g0Vnxu%qer)jNCRlkaZ6 zW?mcn^E%_s_#v{!4-MT-i}og=NgIKFnMb(PFXkL}$J3j1fZl zwQYGGXFoBdJ<$+mu+m3dQ@0bF{xB+%||vSigVt78MxP2LD=;(fj7Rmt1A|MTuC? zfrf~Bl+G^&<(A~Vb5`}gR++BiIY&NM36*lY&KIDHJdsDbeNO6r$1k7_*QbA!e0XJd znIEs-WeVk0@pgr-eWFK+CdE9j5A zW$l-OV7)q|!(tODQ*`O(1Rvu(`mJbsWLAn`@}o_5ik5>Gms8%`rq`s0O5S}PGYrV zC<@NFfKAw9bck3pzovRM+)3}xGwbGgcR2i3ZnCXmY(e{b;Il;{K-9}a=Gp?CBFz-u zNZb1?iHhELD~L53lZ}aZ0fUQdnBDlN1^osbN1s<5cUc1DVpyzzmeQ)E&Pr#K*A(u3 zyd0o%J9nz&%VrRipV79W#UpqiLy0dqfQQ`THn}RMLqzZb^J^mz!e?%b+u96jlRwU< z z{>LD#$(0YzwFq-pn!r9Cv`cin+v0j62?Rb%w?U>F&LFn3z~DlhWP`&X0-5{dfNgh{ z7cIr`@H73M<7V_jD8Du=Lu<2Ow%$BVb9E~?K~OL!O{Y`cSCn$kzX2B;(OC4hqw48- zVq)+YtJ)YXYo+B6TJ>-LeSLp{*r3MSN(AvSp6%K>^)QO26?T#&4MFJJvp0C7jMw@j zws}Pb{WrZTN`&!*rD?>Q1-{?;F6mfpy&94?Vct?R#nL;kgXFjwL^={(8kNNBY9IB4-NtI_~MD?ghjE@^rgi8vAXsEKesK28%VbzFcRyuHKlG>2bhhf{e? z1z_A2fxrX&rm~w01jpgNi;S8N_J1&D*fU_&CJ+@9V@V2L=Qf@>y_xF&uz2_O2i0tC z^KIWsrHNtYH6zP^ADX+=M|a#%lJXmM#ijQs3*p_bZi(V)w$&RuOQpMX?#Sh2;6m0W z8f1v{gk_`jY~#U_uEtaeJPjGs_O7jY5a*{nNlilGhf7w%<1Xf?ME3W=EAwA<*v=Bi zu6C*zLl<|}%ncA0y$+ z*Gg!9sY+6AtbqE)cl^gDOjRG_S?d8OC}v30Z;+~`4v%8|t2fyLum^$n2@M_j+G)bj zjM)6_sdr9slY9JCtnBZ%%qucu!%s|`}O!dsh@@VxmR4*gQ zS0%u_5~W0*6}&d)G!Y<8FA`lR_9%Th^!%=N1EYqjmjA}9?j9!t!KKUj?OFBb$u8n# zo``;&=f-Me#leUX$Xn5!6d6jrl_Ubp#NIV8bhd|z?Jp5ICu6gYzmo= zyT|&GycZ9chiP>e+}4> zhlt<0yfJ(Ab&?2yeJ6aKo|W)~N?c0BcGtAyZ>XwM`z}67bz+u%ej%yb&4*4b_T=&K zQ)*2`qV!UHwfX9ayl*uoVIeUxAUwFaTx>v zUUjQ4s&B{c-K+~GaN(2S#Iyx{2IA|5@5?J&iRK8+1@868{oUVH3vNf<%kU_2rku7& z=f>|0(ixm(OIXq=?EQN@dZ@GB($>V(ZGFLZ8!$ zBX&bMdTt@dJ9olbl?tLe@;z0ehG~Ze_*ke7c83j+kB{Flm)Ccoxu|zp2nkzJgeB(o zL1$>yYPO|^4`rJ>^?V{*vcbE#O(_2?q2LeRt82Nlly!*|7naHI_RAAA6!Ip2m^t>cXS-a3DL72O z|3Rt*RuTSknfRR}`yOck= zVH~>?v$zetV|B8+Ewt(?KIxK#stF7^`t9-i6Dsy<+o8Ei-)qvK#BO2a)}jwAf7tN! z9bfx?x{M zt5iVZbhX81hQyChpO>{&1NvhxT0Azl!cLmL1{BD77ORuyb}kSlif?V#e#?GWAjd2{ z7%2Z5yVh{)b`&+nfW9ZZTC6en-$m~2lb{0D$NsN{1?rJxSR38S6MtmHFscG%1O9_J zsBCxa5dj1Q&3WuAL{-tc;R@SBU6j(Drf=1Gf(XDH#*Wz}h1#>EERhH~_TM8J+e$P$ z)(CS1?#NY$yNjgxnss9^py22m0J~#mYkX46qh^Qv+AF`tK@Lv{A)@x-N(#A^>L!Lu~4MRwsoNS|EjxsuVR zewyq85`!QStXSRnh!o^Vu1d7#V`h62<+QQPO;!RAUrJ-MZ7DUmrLOiA6H1+unRSh zo@$8ArIZ*OiLYsE4v4Ar;xt$7kI5he1Pa~jsRY==e}JHy-P*a+hZNQDQD89ik=lH* z_afw1Qx9sv{EQc-D0iw^<+1IB(nbI%9OTdGqol2`ZAyAE-Z-l*aaL? z%!8uCKXsXL9!9MB9WgCv!v>G&A@?Vridj@8$D(S#Z5T=b)5q>waL`!%(N z*R(tKYg2k%?d>HiO4B-S*;5S9y6?mAS-{c){Z6gc%QUX@ct0z^M3sz~bhs7?Yg;gJ zJsK(-;Cq|wH*#FJ_Nxx!*v89+4Xc+nuFGp$WLHH;0f;+{u-r(+Ucn9E$H}IR>n+2q z8)09}Wgz}0ItT*+rkm5Sn`~O+^bOz6x|Wd;6rlq{Rx35ZMK!Ui03wzu>= zYb9l86-`K2)COFGSRuWS`*$^K^{f+pPwa(h&nLjLP3GpAegoqlFzRW5PRyW9V3&G0 zrh821X5C@ZdmIK=PWCo%_yCB#`E6!u9`bSh)~kVlL1e{8j=m}{mGy%eO8L#6@Bv+! z+{;~o_m1Q=Z$c|GNlA_TV;A&58bWr$?0{v!>FuPOz{|tm5WF385HBA9AT1BNVWZbw zn1LDAP|wc0EJp2l7{iq7)Hq|{(%OA^eM5Vp+ClhntA2*ddZMlNNRGq8z)Q%AGmlCr zNwEg9s3yyNr?fqw?g!_jb(@x7@7#c z&^@SUIy%sB{Sc5ffZ3Jl5&+g!U?=*IMTxu;_0tCUj~3z$KtyFL7Sl0NJ-8BkSqsW9 z5mg(1TPmIJ$A#tOs}F+QG6VF1e~Or`s%S6XrP`|jd|WgwF7>%WS*o`H_K4iqFUa8G zesS?VCqerR!?(FU;ES&?1_eo z(YPO<(+Sb2JCqQ5O{E#{`?(jyDp=k-2o_qXJBhsFwR$FST7g^XE?r3!GFLk#1FVj3 zc(A}u4)uycO$SbrG5PJ$mE}SzXh6)?q=O*W&;bnBXStt_qM6MngT=dM4@Uxzsve^? zC?V0B3)7``{C8l33CJYbrJfL}!;z{;83Ys-$TDq`#QSBM`6hg+WW@j~VP8r2R%mh(dk&d!fTo0lHG<9{zmma!EebL^ zo90EUa$U_8jQvh%NBTjvZJ|Djka6LFhR!cR@l_fkNevgG2`vlvdg4LtTdiuTR*=0p zBT>S%J~sG~Lj;)LR;!Ty`6=Nhc4CTOF6_MnETs%pyNE60MEr(Cjs@&_gIfLK6wii! zsJ%SMU<0nL)oV_wzfM@wae9shCYrT3U^sV>y21ZAkb38*eheP%ZGnh!{$-7?d(l^^ z0R_wf*gPN=3lJy%#49}YzNs2SSDa%=b2?%oM{VUJ0?h6~` zZ>@v{qA-7-D{#g>lv_7wzh00rrLsusMzx#_7|H;MJ_lD|<}0vJ7T^?$4y?C-+19oGX8UV$TTAU-2&R*URc=ik(BwB6R(o$QT5QaV_jtdR0n zs0VeyHD>hDEp4B*mn9#jflcIk{JEIoJHH1TDTSh{ zb@JeznL2vPN$bvT{1-m806@8<4xZ-u0BR=nUPA35R&sHhbXmW8MnP4J#VA>B+fO&m zr<#vV^N~f!+0#q?JC;Xh8ixnK$Gh2GD&)ct3`S8hpQ&`I0JM%^k+R6|TzbYf6nSER z-EDg?emG_?aeVNKro-h^9*L`yb37Lrl;t$~eBqxUe54QF z2w>>TNa>%wrV7HU21x_yNmBmrQ$fA~mkQIy_O7N~I6+Z?b$-Hw8e~MM+LB${EQ4Rw zcW9##peq>_w5Fnm7y5*1LAjorQ1)a6|BzTx_2gY2Uoxrp}Zh=l`7jj_x=iC zEgILqqBBY;+unjQ*&F5RW+zHyMSOPQ9n@_hb#*swae(7zR`mr#gMloh-XW=>Q9A19 z!kVEnuB9gloE$#)V364M%3#UyBH_zi*oo_HXnbNL$Ol!eR{=KZYmLZjrsM-mEuN`+ zT2?4y{jDA2opLs#9RUZ0yGHcd;Lkw3LCn)ff$|asDIp{1)iIegdOYuEGU;(XIXU{UAsHt+0P#wA^Zu36uS1{F7cVw=Hvft0)<#C9 z7=*h_(SY2z4-&J3o`<5)6T7Pub?i8G@RyIW7v=}Ao^9_=!L59|j`^vO6sttqgfq~* zI^#<1cE@jhE2iGN?Kne{pQ0C;tL~0un~p{bHZ5K$`yKX|c>~f(;K!plJ0n=oB+0uyN z+!yrV`E$mSaAxyfH5H9=I-TiQrHO9Ec_Q!>dN}G`BveGJEWv|Roh0K&`H&Rf&+ z5OKvAXc)xJ=_xfHjtqmQ5Q&6VW?5J?G7yTivL*ed6pp-=QuA3!M(Onreva1)NC-$r zw`Fs)8!~_%(T)$gdPH95cHi)7JZ47D16N4*&T!TD{d1CBh>IKI1_& zldBt^32F~&&FV7Xuvg>dGYnM4wbKia@zhZDx&RG=VKkCKcA!soD+IHWdoLky?jiNY zX?k=uAFX~)+LL-UJAKX()=5n}DAYz6SkqHTQ7FoOA8o6Ph((MqcX<8EG~==@7Qq@9b;4{k8{6@9e}L>b z|KB7KS%JED(~zgWvm8luWC;Y2@%%>uQ3fOs4RY68yq6kTVT0Nk0%tyY@~-p$?Tc7S zI}Ylr7=dq_xkjFQ>?wTrVI$$*W_$e@EiOZ^-jHEGADZ0;8qDTnshCR;8hmvN*seu4 z6xcw_&wlW_FWsyyh&j@@i(TVTjeGdchynbL%uXM>OL9i7pD)+jTCGMTF3)|r8;xv_ z>BOZhI4b!lA2?p@`6n@~ITsMBrJ+l9OS0*p-h}%?_f@jNk9u`^yoQ{X$ppi7m}<;2{D?@PZr%g z8w1xvrnNlLh{@M*oe#Y9@gH2^6OFS(?Y~NfxvgL#IE5i_m{D!pN_gWj6#DP1FaHLV zaI8_`H;WF(jC`aXWHgON{<<*0Cu1J$o4>}S@an}hdPMH1Hj8gUiDLr`gjOk-yl6hy zkkoKK7C7I>LGFclSK%P&Th9&cZ8QsBbLnKWoq>gXG3l8=kXqQNPB}hcy$x3X4 zb%iBNOknQ5(0sS)yFGg--u>H2IwF{$4|gzWIktbyHX#Rw8?r0EzmtD#l##z1a?;-z zi8-k|Yi4WfB&4$j>WpKMB>Tul)c#{DgNiYg46OyfyNYe*rqNdrV%;i~gUb48R-Km${*$HE*aJm|)6WaW?E4SEK{KnhHn($OdU3Q^n>QM?Gke zt}V`#0AX z2_m3#0_rfR1VenF#GzBMvTDOMmLqK#&X2yw(tszH2m}z8rX20@WsihSdy#LKA2&+t zTO%IIGLL$`3hKybU-ARz$Z9q1yav!gxu01Y>lh9b2sw_s#Qok>zZv}&v|@Kb1trIH zjC`i2dlj-Ipne;2zlt|Z9d!FG&?Iv^XoOy~Pj(hL7lB?ny<npJM;2&8jZ#tw5~TNkP={o#5DH z9gG%q$T@E+;Qf)k&2=Cn+V+)fCKuY)d0QK&#{t#`EnnNWsz(3WOPohDkOD`mbDjFf zgtnE!eN!!Ku(Jx)yrX@Ys>s6n3oNpy4UU2n=VbZ0;$r-FlTj+Z*?hkOwn>q;h7xbn z4nT-ESqInAMBiw6@k!SX0t6p};D=&8P;-@^gb@|~N*A(!=l!7T;U+61kg~=1;N5j2 zv|9h(RpFZ|?kB3Ddq#MW;M6s^sD0Y`E<(9D+X_5`0-F=sy#acb@6Df#Urp? zS||2FM*uyp1^GMUHMFE_<#+`v+BS_T@ui%UFNgKYTOrG{pt!LR6f6lxcXF6ObkF-X zen-$@_TUvJ4b#~Rd^t!|jy74~6nI@QV)((-x^8N7=n@hJ@!7uER^&C)ycI6P0zO&P zU5GfC7@*#$_dmJ#dQ~Do%*L-6rLACxpZa}0JD3I6q9~;g*81~(eYfN#_e*JY;Bmy;RRGuswvT6iEGX{>EI;OLkWk6JBDFvKitO)z*!7=gXjJb@u`)=MO0`sj5CqIL5Vk*LKw%0t-2t zb@q8U&DSUpv5owjXvFebLWJ8&EAY}x<&n$PO^ghjxt>H(x!(go!DOjLKn?gwX;D$+XKW;>zH{pF2+@fq1U%n*?$8m zjES8nnBnMMzIhP)!rgK^^S5AePh8oGZ-e9uf7U6^2i^=`|Ll0UoQc^H*B*Zcio&WP zH$=(6>ox3x3Cke%V#0i{h|6*lA?oDW2cgni%2D&S>{iOPD!SJv2(qn&q?3IUvZ^WB zsuyKa$UMQB5|(nnD>9@Cp5~=&Ca<9(v(_=tne{h_zEut&G6*w*{Zoit3GbAY)gzt5 zJ+tl4OgHI{1#P#m*7dEk=LFP2;kQHaRUWWQj1+-D#1Kyqm_3|-8`tO6d;-dLd{aRz zwRa{jy0XN~`M9E|KyGM|;d_LZ|3@w?YU@{v<`LAMl$SMA;yMN0!=GQ05!%wjezW=A_Bx{W}XIg-TAPO7ARGYa{?-hbkue)s}kO_o`0FAQK)naR|Am-Rie(m|& zdx{0@c1+OY04^W^AF^9XMb4IvUC) z>Bnm2@FkaXL39eq$k)>~SMve+Csfgz{s%Y%2DIIDTYZ@~wN6_LxX zE7Z!)Zw8S;hLohsu_<_Oani-U+sF318Q--o#Q~+WOfD_4J!{k|LE+7Xc-<5u1`rm9 z+lV&gSE{;BCz_F^LXNVT%+LrdX!5RLeCOc7{Ch?~vYK4LKV}=o^ng*vzx*Fk{m&s$ ze*V57f%rOA9!Txr7=+>g|7cg_4$SCuums2~il?PwR1%`kKN#vbXA|O4Bqe@NnwN?V z$k(?*wrA5+PwyAZWR|0JP9O?yb&`zp4B+g|RB5Bk&$fEC<3pd9{_d6(1HDQxF(=Q; zPNnSJJSFJV;;B}`m)~`h&WbRaIa9}E@`D)3g46hdvCg>J1>yh@Sk8ra0zm?3<%iY? zfY6FYss@CdH`($numlu3KBwVy$`6D2tF6o(8l=}MY@#$QKD`VZ>{F4C(J>u}0d+sU z0JIDRV8-i3$w-`Odrf~~VeiljDDVLmXCs^)Ts~+4Nr?n2$#Y%f$x5@tU`a|N9Thts zG&6Y{1B@hB?p2+?V6Chrm#D?EcBV=mx%e?RGHmE9^KM0skd=N}xSWAvzFGQmx>-{_ zBs~{e;5#FcejdfVBdDuG(2KZ!Ns;e{;4%*89C7?NH|g#3{r1lJwY;FRPU|D7XCOV@ zL;VW|eeBSjndnWsRQH?pQ{as%wYv(@ z9f+R6PkQ{KCJkg=*E)eOxeedFO_o!l@z=Y8f%0EvSK-!UFBb`@OL>A1ovHOqj;lP> zGqFE-a2Kp>G0=7ibV~(#wkC}U(MS3GB-BgsAAl6Pscto$Bm4(vAXj*`+PzaRrM*a~ zbk=IPIuv!q@cR&IDOSq%B{Ceg^W_Ldb5 z7KZyoD&1=`Gfd!&v%N50{nsTlz0F0O6ayO-)Z>?V{1FLBoN+z6>V=({HRrUKKEqRV zQQRYFyJr)nJb|V=S%a87ax^R8+sMDtY#-l)3j)>Y_KplSPXFPfM+>uwRcf{GmxkTg zR!@t<2laiGWA}qW-$blk6q#a~?-G(wNrmK|R!J6Z=(SYGX@SN3wZOEfE9^>bxu_gP z@S-m{?d)O%;Y)4KKt?&JWApm2rIP|ZE@K0pbGFnOe^zZX=Nx{-)!Tse334Bk%(z7f z@~yIU!txpy;w23RU%=fJqM(0~wrp;z0y&A}2%jV%9N(5#FlqP2b`~(+34lkru5N>6 z5F4i&nP8JLlCqMRZvJXpELsOd%>sBs<|eL0WAL=xrpqXc0;81`qFcf3K!*0zcVYm0 zm@&b}g*_AP8D8Ol^$cB~66$~3%1P#EJZDzM>g4%$6t4!h=CiG;H8_KORW4aAzYcu8 zyBx6v{OcH7?Oln^!P|D)SYR;%tk*rNrQ6u#@d8gu!V%V;X<|=IXQhgHG)jMjg_5NhJRZ(OY#yf8|Ko)$B)9bAlwD8Wj-<_-e_m_%m`_hnXb-c{c z)lKiGh(IVgIxNk1e*8OkVt0RCr48uwS4i)xgI$Q!Lm3<5mQB1ve=ihRFn@48PiFVu zEhDAW7?dH%x^7>S(8|7nBy*>(WbX7Og&6tHKhWz;do=OBWxX=j*Kv!cEp1kqJUWZT z+z9D@y@$EV(P$oH_;!j4;;{JTtC^eY{#A0=a0=!x!HTG6f-ne*@I$-{|9T#rtQXJE z=V-fxUos+7F`SLptA|fovZ~!>Z6c08>}0xnR}zkPTtpn_Jdv~mqU6TWL<3@31S03Y zh(YtT_QM1OelU8i52If6BQJ(xaBH>@0nI`JRm9#c4nkrHW^Fp_3p(FLO?>lW0~!L+ zs_L5eRf@kTg3mE(YZRxGe41v|`0T+;)R`eyN$8p4rA&m5JOeDsA>s0EHV7UOL7^oy zF4=5W8=(}-`CHvinCLrldv5Ov{CfllJ{U$Ky=VL#=$T5Kr!-qd!G^pYP55Uq%S4Jp zKF&a#?Q*}8Re*Sqn_%HhPoA#NUm6?)-Q1da2^K*=7~;6X-4YYSmHhd?qmcVoTRaNM zJeSb5Nqe333IAvkh`N04f3AJ7%J~X;($rsX=4~Q9%xXCGRDq7)Z@A}#c@XfRF7*6M za=hj5-?|Dz@4~pDkGSf-=;qd{YUkEF2tHQ$@JM3zeX-knrm@-w3`c}Z&1G8LQ&~N0 z@Z1>m3E2nbGo3yYqm-N|3~P?l%FeX0YXm$kY0fdbp??fiKO3&OpR|-*dMbrh9X+}^ zT#=w>;D)3;1yG;AS}^3-{<pb&kb^O_IIc;V*z} zxlc+;0wCj%(dU!_5p!%06?2+;s1J{h_~MTw1vpCbb74J67*9n43(`Ajv1LzK_mw~p z6*L8Vo?gL*>hhAte2j0p$%)@ggt%%?{^`>S3F`EJkFMzjXg4mpTtFs)73sq*EL4t< zcVi_PlB4tFkaQVG5J(}VWz#{NrsX_Itp6A3ShgS$45+cbXu!T+bI9gV3<&Zab`q)# z+&z$Yg3~hGS_592H!=yZ1pv2zS{~=nBv=mawJ@HBV=?5GngXi|bapDUlsW;5?d0 zE09=9N7g)?f*e)B>G$Sue|+=`7y(V%c}WFguOVuUS7=Fk|1p8Ank2#=TD!Xj0QZRz z%#O|g&V9Fqk>@!oQ4`Std9tvWnOdty2kGM%Qb-s$w;S(ATUP4j7A+Wm}ksk zzG*y|uRaJrDlIN>Vl;ChVECey5LA)){8RV}u~V`P#0=EL$RC$iAfl1x)UdLHD2W(n zbJL#0o*!r7Y8E`uFBV1NZl9efpuwOg!0>UD0OWy6PqWS8|1@1g1u&lzvRbvnb(bsG@+}uThHZ~BEo*F5E3MbmMkYZX@J9>Gk4?q1 zdwQpdMvOS2+02>ya{N26jFKCI@?gJ0?nngfs63Zxt09Tx)LTkhTo<}_kFI4RPj@67 z=r}+g_~D@nK+QkicRO3@a0v>emGwYcSpfrH$DK!JUK%Y-LAQ38Txr_&;&`LifUO1u zaqf9fZ`vht$G$XDlZD^_*zi8E%0}?!bORNn#wEEhIUFxwKZ#ve6? zYBo$t>1faSh!M%@zIe-J!OU3)FlM&gE}p%kpPw}i zI(X6_skXpc?O#W)(iYDXS9p-Al}SOUmF3xQhXZ$EgA&^u5@w`xkXPxhtx&qW<~n`4Uv71&yB|UTiQvMHR?P=cp)`^DOGC$clE+|F3S%`q zUAUt~l6F;Iij_E*V>XO@v2b;wF+){bY0i>vjP&bP8K<5s%WHf>ueIEeOFhsc0Jw4F z-un{P7Nxb?;dJ=6@WZ3!<3|Y_iML zlKL;1T1%D`reH7tn=+c;_M@grMsImB(tu3Xq4Q((SvXNg?)~{W@d`h|Ri%nMOr#kFxGb_sSF+EwyPTNfbZLK^NJi zI2h#2nosj?XiN!IurE4iTaG%#Jqt6cD(X-5hi1^nms-lOB&&g-;g*t?w^+1Euwk=Y znN;uqYFAqj04wFV6vk*2xUZtMM-aKgWYj+k(zgIW#5@Q5rO?=PNyk51psaMA6qwep z&dJXzZM7Yk>VDli+v7ZjvNp4REa*Fe2Pd!{modHO>Jiuh9_IrNrebV<_R|{!o**o_ zfIfw_me&Zsl^!^TdSYWyYV+oPIr}1R={4|ZiDxEVt z$oW_RzAue|&Vdr=KX^Ee5f%od+#E403%@lqB~BjRUg!@t!V86=DG^Kb?bW8Ti%}dH z*C<+g1({p8kC!D`3c(dES|Fs`?%5pidu6y*HtUY0ftxhT;*(D0U24>6){5$go5o3f z*yD6SP7%0mV4IBHXOGRmkW8VdI&PrgCX*#ZEd@fofG&5Qz>K)|FzJl}t7}-~pIJoDSjV_veS_z7q;0IQsgbX8u z3uDIxm7#$wnbs&G3^Z^lAnqFZKck5!j|Ii*1iAe%{^zEoz(luT!3u%tGe~v~Z~&Mx z8sT$Jvg=8z=Gh2`O?&S!89U_B|0%KCw1ZEkYn@cX9)i-2N=OJJ z{W{^j`8Cbe0a0~JAfv7LM@jJg9|747md9bK{TUeYEf?$Ec-|RU7q?gOLn*R1wJWiO zckkP3C$0sU*EyF#a5><3Ogun_?481{qa3$B4Ba@I4WbOzZ|$%fa>%kENa-EGAznL4 z%r>F@FKpfeEhiZgTrYIip^#a}Q3ii;2+sV8h_PS&u*aAsKwJ#Y@VnSn`{|8Dl0$Cgkt2%#NWm3dcA@D{0g*uk+Lh=q z6a|<=TWz7x^E{L;whfk)Nb$lpo@}nCR34fkP7eYTmPKp?9;Y88%HmNfiJ8h0X5knn zuBX*1Q!!V0D`vh-9+= zQ!fX7Fp9p%&|=Vp8X)>SV;tY6q&ou^YqQ%(vpm9Py}=9pB!|@sK^eV)w}Wn(5-HZl zvi;iM*}>oVHr(pHfz+9UBzfM80m`FdEIWZ<#gJe&25AR-YlIyhQ#1C#r%)%pD;^J`L2R3^o zRWUnwrkR(clzweMDDKq!e2$CTVZgXd)t-agi9FzLCFjt>{fK|jVEy*wX&B* zGF75u-%KXHd{m*Ws;lk?PEX?uy%Q6!alwR28gNHpq-PJg1SgoTKCV!Ify2RLgroYmZHNiX#z1hJAn#8lp9{pkhdDw~SnRbiDZc zrQ1_b^(Eb&N?3U=b*?nsp@7%P)83i!1vwVyg@1k$0ao76Ax*t2vQJk zFF1E}B%Ea-M23N(T;Z7Hzo`W`6E8|^AWko8t;(u)YyEQS|0;U?T`41Sm#9~o0#Ml4 z6Z~F-15IBr0QQ8l!+NdGi(PF+uhcvn*(tC5b$Gl?pP+Q2qQJIsr57o~tVd#8?e6K4 zbbb5Flh0oHVS4|BBe>&S z3lGwciQMQ2bpsVV7iNmC+$ityb+N^>IW4{F392brF-~C`wY-Cd9@|Z-w5VV|}<-!Bhiyz`z@nxCp=$Y?LLnTP8;lBSAWVNy5Bq<0C|M zJ|lF+z)aI87l%2dW?&`IJBH4uu3+$bT^nId4w}-$WX}A^>tMLw^=E497QsJ?f__eW zl;A5sMS_8sF|jw0A%TjA5qOmcC6po9lRB_HnA;aI#}7TWYkPqn6%RM;!{jJ+y$1~j zzim{Dyf~D{RA?Do{|y+8d;A-2>-Ii%X8BYTReE8+oA1JKAHkPd9$M)S-M`^yYSobs zU95W;yp&|CR7tz>xX)uZev}{u9zvqFpL#KM=gwDP3ONDtnUJ>BrpP~jXRlE$P!hSZ5xI1!?HB4n-h;VI!89KmY(3 z((aG_dTf9}PMcd`3wT&1luK~C2Xg`DAa4C7m^%T;cV{)2&`cRGIRhkD+4&FW(ek7J zmbj-pM>}L%pzpzq#(CWuj~yJx9}%6ovCX7EN=A!?9Qg&yk!?b6GU~C1X)75seBhJV zPAa|~@^k!+QU3}uT{b|_{bEePyx($N>TfLH`@j)5`h3B?|3W z!f@eAP_1FOOL%ew(F;t-nK?X!_4O;W$!YN+C>!R)SS67=?uew4woiUl3J~&Y$_Vh7Y)NHF^U!Mhg)DlP-dL!m`fW58QZ?Vg+!#Ak;f` z_bL0|d@q%*`CSeY=8yT725ylk2z*ZHvv<6z5TsND>KB0fX1?rB`M zypj)<)+5)?g`qREUb1>IW)f>yOzQgd5Ajj5WTS8g4wXQy!zEJz?E;>kGcQtD@Y`J9 zLXtm*5Hby%5%d!5`@t&tIHgbvz<_^yBcA#~fI8e?ffU9`b3X_8;uZ6oh#I@}K%~jt zY9x{X=#xb)NyrSDo%ex)B!;By%YR198L$69sEu9)boqx~43IxrdJs0kyai{%h9e_t z%1RQd3f@hT0?6YxL8eWwpQsW!PvsPgDuKs~9(jowLUVpix2V+40}LB*3_JymCtx|s z6^~o&;R9c0ufhsx1I~87lPQB$*_S*wAl+Fdt@*KGiO_WamZMIlnya-R$OC zr0&7J*JpTBxB%h3D*d%%U|v){aKL0>qsE)Dd$6R$O2I0ubD9|)!ImoZ0%((`GYevj?GS;nMb8P3mimK zQmZLEQScxuP_K=2{N%cx#(}h+RGG43(_M1cyE|-a1oH9 zhz`FA-8y&MXO4+7TQEMzD17AW^=@LN>^BI zEr3A+VcC?GtxL{4hjcBwNth$XjKm6tv4A7x<96&%)k3yQI`%{+f3qQ{XCp6h$nJ%% z58s6YPf;Srkh0X5H&I&p@heX6I<#O+UTf!6OyI7yq&4PO+cP)3Yi0#>;ft&2II&i+ zRQ>6LbsILPo=P!_Jf+8tcb``xkNiOAq4*@s|KJ$1`(9&-@)zcSGMBrMY~lrbCeVGf zAnj(FnnRvfOOnoQ-0D-gMd9Aq$HP#e@`ur+nnoZu%NP(P|+3{e*@Sp zID!PAdwcx~MRSQ|ABf<%UDU13UC-$#`!I8#JRf5mguzt?2gKluiGC2I{Kr}#eQ2E3 z$#Tu{L)zq$HU{VJlTj8>4u-ImQKUy-362T|;ApP9-8^e72c=G%%&TSIy)B?sEp;A(u-koZ*;0A_YPhd>$a&}jRZACHTMJD3fTChvSQ(zwf zH+JCwJU&VW<&)(j(Uho4FFo1YfgPIg_~w89<|vUzND_FhIv;|a<&Rz~QgVfJvfNcd z>_o%Nqa*OoKViFZ`QSEre$cytyfENS3=`C*nnQfh%9EkPFXWSgy4&mvn7YmAWcF1lu+d*Cew`PeXOTw$C$eh&Kq@~GLJ zciH^GX+Gbqn$isrdLsw+$dzZk44KEY0u1S(Fx~-iH#z^$xEr}s9fVPvus+@AQw7B6 z_RlSm_Hv0T&k5}j98f=yiD9M`yO?_JdrhG2o!LIGWyvy4iBkYWm-Oh|>b%U(&Pdr9 zoE5O1y#Hxbm8e1pdg+~XlX#az>;PZZN_S;jjBYTt!b*0T#vXcGVsk)f*cKXl6*iF3 zr@S`EytMX@WmP(*1W8IroBudDoGK_*LRYV88#lN8q;t<;eKxgFO5!jz?WNtL+`-j0 z%LITMNEkBH-33xd_5^Uldm}#zwr+f_Qd)B_+ZWM(I4ydTGRU*M|7OWKBFadiKkHU9 z&vfaVDvt3Au=3UTvRvQg?eYvL=5u$ri_2|=R3C#UyX^J0?~BTKixW9$DwU^yeFolk z-}=KTqS>I!*6g{bBHJky8*9Dn!K!FP#%N`@VU>r%HtGCr+DSpo*b0En&e_|XS=*t} z9)qzBzQBQwRM+$i5r!Q&RB27OY_i`K^xdJ-5pz(a9~E~I?fmIW1Zg+xfE55`kITq# zKeqd*@j1$)hY0v$mv89nFXFm1C+_OlkwbQv0~TaTZ1_f#t!zm1c+F0DKn}YPU{%P^ z%Ik@DERsHfQao}7lya8_xL53t&-lsT@e?N;Z9jEW1c$cW1!x&}O%t9ZX{7}ITBAg9 zl%v$OgGk-_t7<2h#;`&pgkc-X%i`U^X6TPMeNo!lV>OFiRO|KmB*43@BBO_}gMmOo zK9B?m7^&=7E%Gh_2C_dZ2IoNH&Y;i>MdMi>K<)f$!|wqyhMz8L;%P(zv#0$oj#o%A z+5dkUETsnktQG=POh$%a4Iw0fvL&FD?Ij2iroR(B+sog6T>bYam+wJZz`5Rph`iem zfY5b3k5@yI9a6?)U20x;VY3J}RldFwE61cmt5K~r-|vzh=>c;0v<(_BY{nK87ah_~ zIPD5Tc|c9{x2NW{KiqHH{@9XZ+K({f4Hr9!>I5T9Aa!NSz7gBkiBwlmS zRG^y*`szn>D1bs+A=7Mrvh*uT3TJ&LhsaHD{Kk*Ww>h7;OVvQ~2WX6Bub}Q0(ix8a zWJade246<`$l?)Ep9P@oNKoH6ke~h%=6C;Jvz0j89`@3rSldFgvItvsAY_}YfIyVO zSDv+lavh{avPP9a4TMY2LB~G5`^hysWA>IWcO@uZt_Oc087`DPj)59z0{^<^P`T>N zZYwzeCg`X#uV00xg82;AXp-Bf&i|a%3Bn(?`J>4UdF*Qf-iDHA3F~d&mAbvYS0R7M zk>sJNqL&x^0T2QlDf3eut}d(xK-`VlWQ91QkagzpnP%pCw~pdEb5P=PaYyDn^VLfA z0fZk)dR7;WzyGmYhCCTZ`{8Xwq4>a0sz?|~Y~OQmL6%H60v*j48?j(NUntX`-@Mp( z+Z$@R`OoEku9Lm*i(Rdzi>LUh_fGWYECQ;UZr{ys3VI57<4pMR@cEdP=VSFU7(S(l z$FFRzgI4v5D=*V=r!n%;E?v8y2Tqw^A`VVxrrM6(#6UE_kYJiK0{Dg`Zzp38zQdAj z6CaD|0q;DaJ&g=ZAx{TB_#~)y_VAy|2uJhrS-!X9u0lLukv;`4w*j5>(fER{3p=^L z0coR;!*?{>E|?D^lJC&$r4wYqHv5WKky$@Pmh!{#;O`ytia1Vj@E@8X?!if9ry!#l z7sqTvG9{5L2_z5DD{};+$h@EyCAyu?O&(`Jrp>f@8g!!g-wkv~7oKZbBDN38G+3Ian;Q zh1DPL129^_x47%^`JEU8&6i+@Xb+ z`#GDJDn%C$Wh&Ki7f<#!yx~M_KuE+rg}x<`JDBDi%y@ z2sgDaZ+F$qCVd+yzuHuWY@qws;>U5syrvFrCO=_S0&YE4_S*l==>#_F5&TKxffQ60 z_z~KW?;nc21-RQ8S|Cm6ib6@x09`K$Ng$EOZe*C6eMt<=+`8U%JPYwwh(O$YN}kv( z{k<#u;_++mVOr4R{Si!XMY!iF$lqpzxc7MKivo5J{wR-FW~d&Y8WX3gB+Pquqgj#< zmB7;7oI({(p`p{^uBH2P4^Z>%p#E0;gh&_z*W(&QetyeUR&6`sblHnU6>uAeoads) ziIdQsG|Jqv&>}&+q7GRvOu1pf-ic9fhITP*JOVgu>U*Vl_kuh=G_QKq57;x%*{w&A zo(~gt@KYg|@SGU9bpxQPwqIP@bGjC5Wum;e&L?+asc7wdYFw^?KAF(fkvFJR=+`-{ zs%UOMA!81^+$hII3;~Pab#ow}!O-EK6p#i-=FP1JCRa~CMb;Rd0PY|1f4mbxQE+q# z>zdebf!IBl00O&DUjx+dXT20efbe{)PIWrGO769gMz}X2d<{x2w2JD6fMUJV7_*NO zfF{<_pjwn%R2mOWp6(_bK9OY7(J%oHM9aMw46ywjik0a=(x|oiD>tgT^Z8<+5|in$z^P@(T({VJNBdJ_g*Yq z_ahCI3oJAEly!KyFF#C71_d46`@ESx&3pBvl^R1p3^P@T+A;spxSbU1#}fb+PK6zbFxbINos^&zU4KDh8_h-gT1yfsCQNRBCx-}%rr(J{6XGvpYozY zEkIXkuFK}eY%950@pl)3YOsuJ?T^J=iwu0Z$?iDl#@cf*d#+)mA{Nmb)5!d zJ#0V3M9_Fazq#>%PaA10k~jMSWoO8c%#fHSoN!~NVR5}0D-6~vP-VQ5pWCUlpyq96 zU8eu$!L|9j<m3I-D|RYeV4!%@txgluB0Wci#AQXPrrka*1?KBc#5KIYJS@SZKs$S?_fG^L;;eo(s|^9c~z zN3ab<&Uj`JaUA@;_!X(OJo{PJNV-O6Y>e%{fY1s2S|b-_hZRrDAqJ;=*z}$3m_i0| z86UrnfPPYgzM$CDr=6iTv2m64UY4t)99X1JDPdOT-7G;D7>$yTeM{(XA(Yca@O8 z>J(s1je}I<6)I;ohh-YDv&_hIbWgEe@blY11=_rD2XI~8>ILH34qyH?2@g(jm^RQ+ zHUWJ3phLy74%7N))A_|Qc(6TX;(l&V1h6$HB!y4u<|eA2cp0tNH1@xnzx^+Va{vE-=*jalnnhG33$;8SZ@Z$fbVF%9p;V_; z;$%ny_+m~~yJ}&cczU=2BSqt%6@P{0<85_-PSzHae6(6$}FVvHs$SLgK7~33knMm7LQ*{dVc)ce~^(g_^ zi36L!3Qo)d?nQgW)My}@_Gbl^peR}bR&LsMfV%zsOCy%*_eA>eGS}tnWT^+nR^=#$ z#TD}uYA{snV~X-lOCUyXnmx{+b8bEm(_iMJrtXmVr~!O4Re%9GhEQKgh4GG^tAF?; z!8fI~VouJ;>q@y{`9dHd{$;28$PnWZjok}@E{ZX>6ou1ovd{Bef<0Q4mh!LiRp`_W zR@+mSlkahJ5X*YN!(4Iq$=t0=7~TDU9Tn*ubS)BleKIf}Ooq1J4~e@H3G)+Oi&1OO zRfD(kkD+E;T8Y`2)4eR1GsKZ2dlV@v;Cm-_@if+H?~W4RP>kS^YP!EeGa_jx{!(o) zaLxSMq!r@={ChSfp&L@(v52np;$e76@aC`3MyNT1bcX1{IOTY_D;1t?R^$CPZCCq7 zjR?YDpg$$0e!F)t6a#qc3LM5!Mg{*kvrPStZfD`sEaVNJ6ufvK-xg%O)v_Q-v;XPV zkoj29jiEk$8MATBLfVG#Xds2EVs`sNTB%>klC9omW|Zw$HPN<;Xbk^++P<*7Zs7jO zgoN+d9pKM0PL++qV3iO5ZrpypP5bM@K11;Gc7d||r^Cqy@}5bUS&;`N$(@lS|9(o` zz!Rs-UX}8r%<2V{l8(@E90rQF2%Q+0=JeP8m8B9{c)df?AaV)7!SW(`N^KH}%(gc# z*&lHHRIRHUaYpsm#@Pyo;03y|yVZr!$sNUJZDr7G3(*(f_`S_Sg(5X@s=NUdHb4Atvtc#Q0 z_Ksc0QGM>rFJG<=%0EWz8|{fVE1AdE7>pyIp|)CyG9fs%X2Bs-s=>|Ym*Fh6-1Y;M zm|g+XhYB}_OqCW0P2VUnv)9zCFt=_ut2vu7;*-C_04{LlH@1yS2kVFg&-t2`T458b-?t3+#@HG$G_Kb%59^^0D*t|nXU_Lb4zr%be zYXm+#03ToH@w|demS2hWZug|=-fs0O>gbKfws^0e^ov|m;_z>$+ihldRc#)3B3hLH zW@{5{9dtFs`1Gs{!~+GiE&RQ!9*B_-chBhk1;(cE%eADtK>2(-eyb?`ld7go#+t|w z2YTD=g=@g#G4(-(KUcD2B1eoz>1O2T#qaifJJ+&17A7VD`%y`(nGhdr**IACtJ%J6;$(^*2h?CXI+!Vk$X)i&f&g9vpgfzSmvw!a891c{nb1b-*+b$_4b+m zBw_2L0=cx_GU8)hLkYe=1a_%3w|?v=+bh8HSN;yTh;Aai?RH#7#_`fFQGq2Kc56y{7_fSI zTxJ|!_44_f|HXDj9^M&c#`^_WHb~XpCW!V}eaTig{n~ilo^|fplB(wVCu^T|0q5+V zbV-KehVFm#tkOY4dchII_5z{m#!q>34f5kE`JPfe*pL2uUzDuS&*b$B>9gEj)tqi- z*(*7-6MRsp9a8viy712WZ0&1b9gksMwiAj-CilkCV&o_bNlfjyLn;6Jqmww)>Veaf zi1ju>>ZNS{j^F-&ezA8s2@bv%7EAtw5u>A2CRw8lr_#A2( zWTD#cF=c_g6(tD>@t=*P_-t@-g|EHwO7UG3x-5>lnBc#{-D?QUc$7Rr7*rbwgM#4Y z$C$7*+1xe3h#g@Q<3OctuGngx`d1!}5+q|(g5kOtDnUyOJuxxJYVN~*b440PiyiiZ z1iDAeq1LT#qL{?~6_ul^|GQbHNJ`3BpW6(>pCc54$T9C_#~1q= zjGcFOd%6!)6&2QC5d7in+ZFrtsB~-A%>{og zj|2vSHpIU5e(Y04?rRu{-tTSlQ>OL4AUWp8J~W%AXHc|(Jv6wblx=mTXp3hq&f~iv z(~`UY^c9re-5+N_gw*}rbxWpP)jKx)XbeS@vaBE#6GJrYw6D=Dl1BG!DMkiw0Si2$ z^EPo$eTITg9L=caVf5Zyuur}(7xydwkHIM-&}-`B*u#xD<;LBKjtXF3_%N}v zTs!SHG&`bC-_^R{S>PVI@oCW+H1E{JF#j3#G*(SddW|uy_tu##1E!cU$7|J&H_TQF zdo~*Ks3!M7(0hU}eg{O13O^``-a8Qr-!9S5IKj5V~JVv+SZY{Mo?=Mo6G9%V#=W}&vHQQKC;oB|d z4Nr1V)TX3Z$c)7=AuY@Cq9pmO2G4U#OPcb88)<^~w*o^LaU$eqiu!9?15ir22fDy> zrfomwn#rMzALi$;Q}?P=2l8|XcGKfDXYa9MV$(x|jRJoMxjutA4qw&7;YQ?%H5c9~HkvkFG<5&sYrpdA!ua^h zCq)>R?DoU3#jW=3x|+MCHa_#-5swCQUZwb2J(WSzwZ)OVot2V%n4^ST0~L0zOn$Bk z5U0OhlMFt}^(3sbaO`SEA;^wudMs73x_vL5Cw{Igyr?R-rKKwg3>ix?FJeiG)$GVBYezUW%RQ)OH z)c$gjn`qO-KNRLVkR2-v;Tuwd>XSSq7F7KugWh)*KA}lo=_c(o1h1bw5`oCu3|YR*(von6j7@nJdHWE_r#zrj;+`I zy?=zl>=jw6ieDLHzP1aQGpB1o~ti`}%l{Twd z1Erc%R(ejJ$8vOzUmJA!2k5lsZTbnsi4VwpOG&)XYtTN*g_>TBT>&Z9yatjySqYya zSE5I-et}s>#^M&A5ovRH;MEW^k=6V-xK%;CEMwfO61e*LDQB7M7eC-2zRX$w81urF z9sTyR%D?&*Z(5eW(QLz3KH_xV40}W=HECz{O6Olq?g^j zOKSE07dJe0@&bX>hI#fyOX|q@3Sd_=sjVTk&y}clqCVcW9qt z{$4}B}~ z=(%Wf49UdTFC#LELp*r$`$g=%n6_$@7W%TeKH!*)@9=D3yz6WjGWhVIfMb$_57Qzc6Kov>awcZtNeUf8NHgu|c zthh77{l5{FooH;bMb$}le9n;6{2l-O!hQ|kwgE2`rZ?A`>9W56`=K6LC3psv!4EG1 zekO!^o4oz`8s<1k=+Fm6=$5@y?zUZz+4Q^(pxmv~SpBD=sREA%$W4Kxo2{*KC}i95 z_ts17XgS9wJP4RD0jR>03|066s3OA{%!+e>`x(9U?Fl+~yA~5}Z`pe-OOH%zptguGSTj!!ZMSU_}uCQatbR&H~v; zuHWj5AzswG>#qsh0PI$8TDvhcoK_>UX`R8a#Rjpi3{QCVOm;s+h0i?I#|hM0C{y0;I0^Ses)s-|Xb2b>>j^(!o+7 zN5V2@=L;chj$~GWY`A>s^;3xoQ1l1sW`<#{Y{;T0Ki!wx;Wq58$3p@wj5r__21xXU zdtLzvLU{xuFi@UTp?LGT2+dUyIO`fkSotfE%rZ)C{f?neZNk}|irA{M>iTo>xBnvp z?!B9R>SH_eE4^QA5V@!#09{f3lUEYIsCGVERqToYL)gT>a{LeeMN8I@JK=4;`|4qw zya&Fl1Rsur*4TGJ80vFLZyaDd;Z~}O5hzLr`Cj_zF*$ZZ$>4<-~xcdh%guz zfreB|2~okAxccs$6rOzjJVXGK$Wirg6ZZ-_0+1PiP9W)_UVGvv5__YdRa^ury>Dr< z*DJ;c&dG#&Ww7ksmGZE$Qolb9Bcn5?Gi{8)gwV%0otqF-j9o0IJ~FFeVUjwD=G zuk9*J@EEztwIchO2CX+C%bHTh8BXK=$9Y7{#wNGE0v#O~6PNL1an4y)l38`*-H{If zz%uXf=8nzHfmo(AK#B=Fmntvi0;5F!C-Z!Z9fovChsgjBq{#+55$CA-jz+e@=Gk@pv>=~lK|2TRrp;^m!-O&e$=AK_N zml#^#sGl0L*`G(gbRD|O?aC?h%D;2?EYShro>W*lF!T~#UN}_1i%;_IOw~)M5|+g> zA{hi+nSi%yk*QUsl4!FK&x&hPoBOOk;|3kL?FvUCW$&{U-vO_$Bk+x^K3W}Xa*rVv zpVDv4tQ#)5%K?qi6y1=87*JgSL_uOO({#rdkfS~yUa{dCm9gGeJXKT;!YZv}oGvKH za1dif$5|nNDFLQ%>Ihp)2Z~8uftFbn4bxI(Rnl!}VK&nJYK_7~A@<4JoCP8wo^A)rPDxvKh zARGb-)eDUV9o)c7NcCZE~xp#YMeksQ38nSzi;jaJ0QifVd1? z14hpi+g6DlCqS^>Wd8HKTG-;F5m6YE?43I?fged!%P#@rm&cjNj+F(PuGqQh{w|aUK=~jZE8^ZWU``KWe0?pcph;k-7Hx>%u4kJIiP{GCE5Ld2t?xyf zsHfRIl#F{prz!=q(JQ$5K+CcgiBGqf3lcFfRI>H_buxaGwb!@^AQ5i|tZQ6)CHd1v3xudeS4Vz@BR$*^vI{;O5fjZ?#T; zIK=F2KBK(~(!K4Hx1B->B_$RJh48@Wp86X`KvS_;02N?&-1o#@uzdyVQzy7!%X zJ5tlajVJ)UNy+9EqK6bu@en1`Uy_{p^k1K?p|>LelVltIL=wf?3SW$SW@=iPUBrE+I_na;FHSbmN!u;H# z5C#hmT#W-vZ!bBdJU>cEkaEg%ff~(n>ItxXWaNVnKJUeyh##n|+~|J~btdqPtnimy zoRnVv0q^mODNP zWm;64V%*NjCCvc;6-%*Lo-X?u>_7*z&sC;9;>1NpHt%eA^&iLoak*0k#n9K}WvmZ7 zT>_ln)xNQn{l9?gJJ`1~e>7HAh*HXeOnqtMjPgAc+O(ESehFB>VMqjH=%7pO07!2$Z?v z6AU(N`Uja{viP>-m#8uY;8U#hTQ*B&tMUV0Vy7G<#9Q(8bDZJMf2>*t3r$zRHfy)m z4H96}BY>=42Oen%>8f$!%$nB)cN+?Qd+b&yQu{_|F2~VE0KjQ}9d3nnhC-VrJg2{+`&nrZu1T zZ_zrI^J`C_FIjn?_O?gGmA zQ|_W|#TD!MekX9az5HBL;rqa+lH+0)I*NYE>0y9FW;=475o9j3Z6Xe(311ztF6dnCS3wd>hAvN9<8&HNQI zPxT&>dGr2+M0~F+u-Mf=sGS6C2gC0cgE#Zujnx0x&;35C;hGByb?>K=8{`I?&mfMO z(eE{M1x9;QoS zgu;LF{ng;Y8)&LJemO+_PnqC2e z7P+PS42t?Zd#|Ix_5%J#prH>@X-ki(9M@u10=?eI!RaB49NCB`y*d3SNOaDC8c+=c zN0DAhk`E%k&I6HUNP3mZ5fDL;s}H(%U%Ue+`X}&O26B5qEdsS$I%hO#1mMZXCgRNt ze}ym=MT?7A-)lC!z%NQ5w;G7!lSU>k;4VcuQ{k@R|60Ww+LL*0f_xUsN1oHy4cNhz zV6xSTfCXH&Ib)&mcg*%###}*MU{L8?Ja+ge*T-=0d1RPz9DILYh{v{E>G06#Rvgv< z&~AYc-a(3f!*tQ9a_Smw5@W5`@>~W#hkwS9y}|NDh=a--*V#*zj8_ zWz^j1!55(?8mR_?K}j;2MK6J#XG^6jdxK9x0EzH}PchpmY?5(p9NAH%MzRlzXGVLIJ3V=^i5}ImzA7@;Rb>c+3_a^MVkDBA{ja6H7 z*Hv&~eI1Kcv1|(e8WnLBoF_lk#40M^hY=n~@(q8PgG1IVf&2iL5d(Y#@&vp z*OAdBvY7+DwRXVdCC41Q|7uE=Z*Wn1yMF2(Hcd;=xKk;hUdUoTaq!H2VIl0e#9mq@611B_y0+_4VlkE z3Gp-fRH^@*kM~(|tijzZq}@aSUKnUn9){x4itW_tH%przA`xW&S4$4~rJ!mqlz4?Gw%_V@uKcET75Fj9XgX9A zdp~?x?68LFcTIaA>h#GMn1$a918ol2lmPLPU>OVCAxYFIYT%n`8CtaE8pw>wKJ_Oa zm4Qp>*Xz`H?k!NmkB3bF%h^*rEv&kCmk@#0$K>rJlZ249f2KqXXB;ZcpqXiRxS#(WMMYB4L9LeSTfY| zA#r@5KDYU7&NqZIt&4*FVt}Y<H)W8!-y`Amkma{;$+q>~>MLZ$ z({)I(+LbMJ{?^DC#(z!wdU!PQk> z6X~Z6E|-f7-35Sgw5JATdgVbt);>@TTx z#Nd*RkB$NwrBr^-omfKIU#{+y*?qX+&2Y(s`@JH>eL{S$8afw^*a?x>W{C9Wm!lSbrgbySf->RPA$~)Ah zm{8SEp9OT<)<4Gq;@N7Z2J+I;i&iHT30(I2%9jur6FHM6t&$b#O#pq2USZcps3aJO zezU7&_~dHY095ACZ_aXriAC_+!v0Ihab^iO&fZzUayru8V`7g*(N@M$t~qY%Ztb*u zE%j7V1?^tfx~IN5$+m?G3iz(=`koOvGA5$SBHpQnO@cGxz0T2Bh10xnB!+%v4!nY(=|4ZN(#{+eugwU0Z}Q<^ zWRv@sGugEju}a=804A;%G{k^i0pg_K2d9!d!$RE!$?b!b1U=>d;u$7t2E|m_!ETFO zJJ7PLdPa^fx7yV;8TZ(*DrWaSwBLLr`m3r7OCQ`dmQ%#6FzXGSf!TL`B}|5- zdj6@8nGry~7xtpO%%flY(1v^SOvQWr1Vx2@?JTaH0HjGu%L(cs_=HQW?VZ?Ju?V`f z*xPYk! zudR%6hJ}W!LCfp(9y8U?0@(R~B9)FWp~H(i#>qM={8+1(c`-kFbmPtk9-S%|bRatX zJ!^_!W^%b_E)E}Z16W^yWsQn76Gl&}&P7Z$!f+Xd?Pg${QsTaK*DHhwzzv)o;D5wCwHH zH?$lO%HhexD|NS`7rG5JXD+y3yj4?R8X&BNFnE`WF1jf`)yIIEE2YJ5kyFOs}7)U?h#UZ0Pq{B zv$$l6a{u>SlH?DHOD~G#9A}D;k&ybptto+mK}O5Ck3-HDPf%jByRi3p^3xC!Jq`m# zyUUf=%!K3MCJZsS4uzHYz!@!{{*EBOXApFhEJ+4YmSQiE>lkr<<*kIAwZzo5Yg%U)IEDpTSXr7Qd~&w5W5~_OQUN_PZSFU7v4jMahhJwt@M-j-X=4Rp{l%evR+z^L0mU$; zJ;z8=wSj7BN;b>ik5&(JC!!{rDDYXS;ekU4BcgZei>`6QFPr-~J+YHyo=BWe>!agr zX|OqQGEruMx4{0K2U`?1py6Lf6?@*-Ev&Vp@}c|T#V$R{BQ3PdZLcPrf;_S~xH2uu zY^HwnkxOrDS?nWh>*dN>JO0F@ijP!i$DucufQKJ5#2pBm{u_F;%tO=jIQ#tY!(1g!+_4_yEKEd(8Rqm71*8+aOjWJuBWT?if4*qbF(ZNhyg>Cx6g39A9iE zf+K8Uoonj{>rvm0N9Gp*)z}?z!ek1x*7D++evEp% zsFK3@u7CUXAZxW!1iA)Vv*jGMDCC(B?uaHm6Ch~9G7c&N7q*fq$avD0qgw7x-?KBn z-u@@?(uUt->C+T7s;G}LYpHPz!4@NUZ#acpZXrGbm00laoN&~qmx4Xg`B;r^@V4H* zt?#O25>CwsR=obs#kkuVE8qW_iL#zyZhMdfV%lamqN#JQV4qn&YG#6riSP}wT?1O@ zrildP%efxFkf(wQ)|rRR*#SN@LPCE}G5B1n7*pnnUd8S^cuh&eO3cotow6(b08mVq6HUT?-ff|f!Mz9kf#6n?V z??Y{g)A?QIDXDo4CqIS9u63BUr1s${zJ=1QchC5{!{G3;7pbAh@6u0r6K|BFIv<=+ z>!=v(9sUSVsMxw}R>Brl88~E(_6}XXo!fX~E6Jo`CzOk_8|ArL2q}km+zpDZx)%3!FA0gy(z2_^NN+3r>(a7ix$-pZy_WX5F8tlRQ zjuzxMIVx0Fz6mEZ)1388UN_accz=poZggR8V?&M0K%fv_hHEdd!^h4RbYOUA3&--~ z74+5r)FsH+40j+a#7WYDFE@G_*dytq+2KzV+!&xUz+eP*cf$wke{^S_YqVBvmBnJR|GdVedOhFaQJC92WJ%70&#w@<9`4ASlT{2@C4<^a1mcV=GPY;> z!s}2Q{z_zD21#LqddVVilnr#@Hbev5oT2;tI%Ek>%@ey6&#_$Mk|T6(#nGNWefJJ}!hZO^ ztAI8`|J0H9-GDdKGVI=mjYyddQGiYbD8BfdGIYPqLqI8Xf2mC0PPEbkO&h9T=crVv z_bo$9@LACBn8;^41KqMmW^jj)5f(M;$NgGcEg9ks(%LdlWL2`mi#O0WEVSP(mEu{K zqrAs06?5N8tn2ieJDAf}gx|Csy;HjKy_t4J?}jbf#3aFg#ggm(J6wPBmzfWPkG2N8 z{f;-y8!NFJzPEb*NK)VkwLy@3 z=HF%-En zKM5dI#$X3L;?d$lP7Oa)k2qwd-o9J6B?|#Vm&fDxpHjAhz z%!<)PtgI-hHV6EB8f#_GPxwGVX!f&jG3T^<8%qj3-IMRkPT>$9$<2fa#+@qH&8u7T zut6>0lkmtyE%ysp?cTRu2}q_#^24t5JvlR+4r8L*jPUA|eD6lAr>ACzf-xT$A@!!Q zo>V%yJ0<;>%VEePl|0p`MfxLwcM>I78xTFY-*te(iZaHr%p&<@n=?i z6-n{so>cwz90(h{*`B{Ev<&)Jl=jiwEz=k*XZu-R*tJ0;=CPY_3I?5fUJk#HYpR-W zN&cML{PVG|0aMVW-s)j@JKf`H(hqNN4Nge{W&qgcmshettvt?RNY9MkLZ2vf=6F1+ zev8jX6=5u5la@^)_Hrq8zLu#y;(3DkNfV{Ti{6M#n92nfGhp7Uw_k;@jE|M=sRr4ONAIH~Dokv4!JS+=rA z!76C!?&iBQ?e{$APqg6&?_N-wxa&xKOhi6O`n(eNN$$bEzR3~xHuE52@it`es;Y#M zQ}OQ_5g(ql*EVM?Wpx}a8?+3hp9N}FVwU_Y{VY&ZT73H7J>5(r=-)3FSRaZ_cf6O* z%^Z$}%kwmFH*A(F!A$MJWvTE%%7;HE%m-xej@#1!DXpuD()FIDzGOI)EZH$Ia;m`(MraqIjJ{uWHtfQR!9Cf)o6o z9l7dwVUSob9k9>p?GGn3)$tDMyS0G*Wn^xbb7z_^0v z(?oR6O}-m|8P(od`(*Ql=6!-%j*i}ZogIQ1cq@OFGg)r@=qFU=;&$LUOy0OuJwIah z3_xJczr!1i<4?yHXy(C=f$(64i+sGL)}9AoQhR<)wU;j1a~OB-t}vW?@G#>CkR@x! zDQrqfq+9REQL#HP8IRg~?nb}XG4vIASCef9t))>>53v{rE)egyqg05X9=7X*f-=j=dk~g?-|)SO=C^4h93MQXrGFR zAqqwpF3Hpds{Kpm7e02CTwZ8Qw%!bTd^LavY7a!Qx^{{yHFz)xOqx>(%5g`$M(36p z=PH5)urs{)VOy*efD~ev_JZvBySqb+m%aL`JFcV;jM9S*64yxFaws(GbDzi}hzwXROENKcK>QfS{u(SV$aKg_337aZa+LqpN z_3e!~_|tcJ*)<`Yy=m6%XILefIiAU{+-7=vhnZ;m_i;<-;B@(y{%>23m99hoM_<<- z&-D7o>r`?{Y$J?ZW~Q4<_C@5hVrj1Bq?2+j(a=$Z$SqoHi(w?Sb2x2A`ISqN+cAqy zOfI<{O5~PHBq205`#sz5oWFjr(_XLrvF-cX>-&73@ALk=Kkw)Bd_G`b3(+vRaNuw} zH1pEM>*{j5KIe9_=GqmbnJ`3)LLoADP{Uk)Gz1v1OEF|D_ns|SSim;_`UZ<`MFCIZ zzf$_D0(RDfbG~O%(l98QR($T1!WXZJUP72lp-=pia|SDNS@cO^0L912a}##xg>EAG zQ}pM?sDRT7^y*(M2Zr+iGIzYJ#4XL@hVoV;>W(>p4jnUY`fqCdOS8b7sjJWaf-_Qv z6*nz*Xtsk|Bq)3Lgr&R_T@D<`++2Okqq}AI5e9jspCr^d%8|yVK`LX0b}||&%u|yo zA5~R;6Doghto@N5IIdkkvwKBKyVDoy(c@t`#wmRwy@nHpz(bmh3(v(O$3-lr>W-E_^EAGcLu+ewGZQ+R;z^zeufS6i7;?4Ck(V!>K z7vaMRuIo!drc&#lg5?LoO7E?J)eAQmaX;mC63U4C+8Q6r)J2`7Rn7{y2cJ0`t9zIz zO*kN_QYkOjE{Na@Fq*xe@kO=$ir|nxJo~-W^x3)ay+%bp8|~Zru10pW^i!CsO>L~` zN25$zmX={%4P>_7_S&0qx4~9VRgdM?*2Ip2H>ehF9-UY#64B=3>nZ`VBPj%t*50Ck zk0LERlG;|ab!K)TYqQgS_4f)zrM2!#3mLRxW;Re*_3Y2)cp4ghbJzg21p1$9C7^rj zJorTPt~iyIisKW*-wfMc#$0%C@s*ykbHhF-G3*+j=VKnh{Sq;&8@yTBTZ7c+Fh*qGmbwTaL(ZGhrBHkZ0SkLu8u=uvwr|7eYvArj z#`dNp7s_rp(9}wj5w#m8+kivt(^i%9AvjB;$YBD!bmY)uZXg&C*-h(1+*k#O`Md9L z>?xG;ygtWh7`^!8bY8Q<5A}3NMx=0Kn^1s@@$hGr+K-B!ch=Z|n2`|;`RB8K zPis(?zoRZLS@#3$5V^e!4{cDSuO33Q@|easmC1PamCJXJ|Hpjm8t&)MsS!D#VpQgq z;}=1R{kbzezN%UWvZP9jr!D8AA$ApI^+l*`ABgW2X#{+&Q3VJ_JpbtMHuNB^B|zMb z!Xy09$y5+v@Ps3K0C*hp6ouHJSsz;IOwffpP00YDrgLohowA1GZ_jt9}j z7#*2rIytwhfKn#&hn5Ojr*oook#b3UKK7Jmg{VMvKKrXp&O+4hU6AXdQREL^>3m&~ zg))5vS?HCdpC-C_Yy!lV6mgVBrR@18)%X`L-e++lBog)X!*icnq3_&}`dgnP7!EKW z#jcU$p^y$o*PSwSxJv(yxa)7t5in2%8#FV80OzyQrQ5nn5`=BA;$SDxOcC}8?YAeV zEDTVzDAOeIQb!|k%Hsuh&qj{iRVt$rtVX)K88S#;b$m0orgi^_~BJiLEqSE@hj*NXu&oP7FZ z&KjjeHVCy#Es2mOtfH*5_`?$A$9+SRb^|~NVPPGPcs#O@U2v;6gV=inz+u<1H!_tBbpxVok}%<$rpIOdslQq zp)4b|0rk|DA+GljsNFzY0K$}IU@K$v&a8=|ovdU7yjojF6}FSVM^2dAj7LY6FIIW+ zITPCH?`}W{pfD3WpZc4lXnCOVIzc-Cm2N!3Q)b@w2J-~!$eo=1Na?><-Iv-ub&WTh zmodue_Cuu$T>M#vPRHW)aU;JX+7@&PNBVDcKM1-da-UC1^?V(GnF`y9D&v)WynE9y z+JN{lFmn56EU+^ObX_DN7d)ggcyp*?!k7s-cCJO|7zEeVd>HD^Nf0~;&zT%^|6(<6 zG|)I22`Xs-h180zMg=V~@o)xpN>566o!+BzpZ87(dPCLNnOpZmDD7@#!77f5a0VH^ z%VUz$*2kx20q{6^02$b3rAEJf{tnqCA%@dyj?u7Xv!PDK-4onW4dAOr7S1T?#&}~9 zK)RY$tB5K9_5n5I{5K_6G?BAae|Hcw53u74mgQg;Ap8)*uju8s`A5YiYh42SduT2tq+`D=oOGm?tVv(H?5WpD~UYWXxC*KlQZX@(Y7>yC?L zo_wD(<2HDDZ%71t#uN*)m@F%IQ0Xp~uCbgqbd#+>#Z3=_Gq$+Z}KQ5zGpJ zPc=$pEp4;x(??82kz{w#Z&49@KfS~=r+os!STr#JRq;kwgS?HLp_gg8-%axT%n zyxX}FY7X6=oFCb$sAUH95TQRS9);asf7`XqdEh=wRkQBr5SWdvOh<5i{uzz4y0V?(-(|Tav5l zqEcf-)Kj%;cu=K0t4{xM6)4UEl7*z3o5AMuJFO8*P1N#rz!cw%UcN{5m~a4q=8sDM z63Gsspilg1N%HU4+4G<)&)CCxRl4CcYVb<7)*XGPgWxjYb@DcCfzG}9;VzM~RMq^q zvMb#Tr~?)J2hmo$XmfQB2q-Dj*Z+JLJh>7V+KcPBn6_7RkP8M$Xh!)8xa(;6JTw0E zg@U_TApB*R`oR0r*4tDA%Dkh>B01@)M(@)1&|UYpY>ZL+<6Kw|8hWIna!=`d$Dhz6R{9$~P;M2W?*&wy}XUkEiVfed(3I=8Eg1Ezr3cizmGznGjEXMr& z4(Xu$oex80Z{b!d#gX)u!?D~FdgF4mx4yM5EJQ-XNMs$`a=2|#AYV_668SnPd7JbS zegLME_lQc7@Cqsz5XCt0CW&T+DiZJk?$RD&SU5Qd5iT+qh<19vZ#`K@VhGA(i%b1o zAP+`aNn#t|VP2g|A{c;Sv^y%Dl%t;&GdoNt@I3%lAP)(l1+BpB{$YE1P&bhXxN+v? zm^JPl8?0Ca0fk5g)S0#3*Ci4S5E&`Z)~W-&_wPx}bQBn^6Z){?0e*&q{IjX$3)7j1 zzr@qRy8-f(IvtgI#2+Z&IxuMFnH^KBH#W86k-)uKW9c7;4ygt}62y`JdoCsJ@}FD$ zzn?w`oKQ~q^hB@ox%UX6NYc+DInWTKose5w ze>&Ey|7mWUt3`TEFpyX!&lEn6E7!YL^-3-}23*xGrXqa*dtD4>d@$nKWe)?Sk;OXjvODaIFS7PY{4e$-dHnzY literal 68793 zcma%icRZW%+x3mA)l$?dwMT8DwMT0!l~P4*tvze+(4wlSy-8Y>s-pH5t=gNanyEd4 zl!%Z>Jo&xv`~3Sn?>||efxfmW0MIazUdvNo zB|X-4V~^T$}!Z? zgq=#~!>%CkhucYwuC>o1PDcy!?*+K1Es|d^H!k*=EvK;r{{E_b(ykCoPVTkk>E#1W zE4q#I9_Dl`3Geni_l>yZVxKK#lsKgplI+sNo>Su0TabKp#_sFcBjkW{tX`1sctKFo zAvz!c(Twb7U3G6b5Ce}*t;@%kU+LIW#|CO46!$QUJa@qs_6F;#G`j}Yjb;`TQ?dB{ zVHha7h6RA!3ari`&h@9>j8b~0mxY&QG%*L>b~zMhte6MhZ|nX!&jI{1H;FH)Z7==q z(pJ>V6ol~n&^+m)E~y#29*FsMFKc0xjl)<48h8{1#57pjn;jy{tbq?--UO>f;7Z#k z)F5j#%iHtfsErM$Tr~!Ida=ags7C+#POG!CE6CxN7G%q!HpXx?Kl(f@<;6gK_hc8x zM$=La&V7HWRPc?i{byehmX4roBQv`nx_Hrpt!=e(B1@b3RP=uK3_rgS+}><%;gHQr z5g)&Yo%!8PvwL16<2!r1eN(9u4UXzKP zI{t00MiO{gR!I%~`!|~3zIj>Z{LTkAORNZ*fenvP07eYA*6po;zuN159fyWjRFsM= zG`!ilnniCan%7bS1^q)xtBXq8nLE z*Hhf4KJ_#T+?S#hyqw$WT1{-H?ni3V0iDMw#CG@bBBkKjiMkg9UbM>>vD<+om~l8n z={@dJB4_jx>eEK=M2OG~Uy|?ip^SO8fA9_}=ZuQ(AUD48>hRU+d;mDp7FT047_>_1 z-jH>{(0x%$lQW_feX+aSEFOK9EDLEasVE<8hD-W=ZW3>5ZINi1H!vM=GZY;0`H*c}u~Lpm%Z1dA@njR+6- zqV4PNw<2@E6|oB;a(VV9N^>tD=^zAzU>${5Mno=Pi`LjGS?YlMdOGUTTxu*~dME(s z$)J0ZZA2A3lghKl-T*i3;NF{-1S8&11ugak&B(PMTWPnZJZnL!!`tUhl_6V}(N-2< z=)c^Q8@n7%xzH~)y32)Vwf@^7ff(nYs)OQpvUvXB-Jv(_zDz2fvthfUBg>V7Qbz5o zohMGLpNR=`zuuy!XTrW%8C?7KR!LfIYWvTlgCaZ z-(cnrvO_(!dqM;J3z2EmpaUAOI2K&IH5BfCW002}79YhEDtDZqMzCYtqPIw=9W!QZfLA*Rx<{Q_xPapeI#N=!yrvJI^ISbF|6~HK;i5^fy`+OY> zhlU@}&;g2J=+4(KZV`4qmOdDbeuK;;&h?Uxk2XA|0EFj<)7oDR%9w{h&*}a|AWQ|i^jk7n zrZ9VSkX6GM4BQXP4xgT!i52PVXb19(sQqnGiRSyc|U!iyJsW0!^g_J!O`j)m!8KD=VgOHY&o06HHA zN+9x#7a=aHIOzgOysbC%F927MCj*{zN0I?AO%_Z$jy?U3^*I4vms?=29M~uT7!@Kt zEr>btQ0i;8#wz(L(yYM0`GyHH;3CTQV0vcK2!Hug`o00YJsWe2>u*J2?cEmko;w2R zIfoXepkp_`MMj20LH@NZB{R-H1nb+Q79&uwAOksK)WXzd8 zZx=q?X-2=QPUeE`|K(T-O4w9e_3idhjs2(lQIP%5|f_vRMD9-lsei06DptOXog;0sus$F=6+7 zSIB_Yy;Ch9hT?Vy093Lmiu;FAlHMxRxWu6kU^di1Uj9a?oj+6kvS3a0ztmw2)x^cE zojsJvz`wzCdfS5Kz({V%N5}886k6!EBuI(y{+(PA~9fv6b#NilfJtYBD0NvwF?dQi0?0%<% znHrRU>iM8O88C#76%ovZ^)auYoF=<{>^e=C7^ZjXz~eh@OuC!DN?ybej#uTp5F3+x zPor-ioK_AsQu%J*THc0d)>&s^H8q=o#cxv)}GupjqpFOMhcg>QA!?0qbju>Xu>i_ksUSxoXm{nD!;2jWK20MN;b zm(w{MuZIJ`o{q*4E9 z8x^}_*GFDcH`&rZZMf}f-#G08X~|$74vNg%o6Dt+HZD^z zpu^lb+xB2{a-dwtG7Ilo?V62rd;o;6gMXbnu8$OHaNYGm2`1eV54ZpXuGU)mzw!wa zQrGCwFPt}=_8P`)9}#@8pI|uMMJJ%=T|;E;i9w`&ZvI}xQ|?s)kFqQQ^PtLK^5di2 zIg^0d@MLwJOF|;28&7ICSY_eH*BUy7dy|La<$JY-1;~7E9&db?p_pYV86R0YmOx=n z0UUNkG-VK{s}{47IW8Ehq&+KK?9|bTA!~JqQCsxOkz63=9TV;zqvIF&XB}{Z0>HcK zk27$uYVDp6Mfj2dhh(?q(S}~qTeywW3MeJed8sboCL}ktcLmSyDDLlt649>sx!4&U z$slmh8#RB}ZTBP#?_JC_;j!Sx(2zUPTv@xN$N_rZt3=dJm>zF-_2<3@EB*rWGiqyv zF2i+-L!>ORY$o&seHBUCVI?RWE3tfHT>(_gr>?4-Q3n>LPak>(8I}7&$9$sMv(!wy{EDriWai3&yHL%JZFVeX7J~{ z(@)xnE_5i3CykWAzrWWG#lPCJ)rebQ$OS9~P;jku!>=2WM`*k|JR0%}?c(@Lu;Y;P zWBKdgBePriZ&Ab(ZlLF@GY&7X{_&Hgb2}P5X)ogG7r1Bu^wdV91ArbLp34RjJVTpZ z3jCu{H6%!&o13a#>WU|B)Mt;38y@y>*I+vdyFAx0mBFZ;hY^QvAK~Ae+S=`Yt^Ip& z7!eu~5E;aRw`_7gnc0#os4DbbjoO3U-%5Jotv+BEc7PwkDo#c*0}khRe~-KtoVCZh zsNlyWef>Hk@#gQVJT0V^rIixLjJXCRj^wfeJ!v=;<`@=Si0OBXDwaCW_tc525{Fp9 znr~f@T4u<}#W|V`SY7qdcmxJh0gX+57uQ)J4Xir&vu>IiE`}eGzk)w|yQ;8Y{UY=0 z%%X|zh!H#;+c(uAr1aCnZC@fSkQVk9(lr4Jx=43h($rXMdR7Gf@!~GtU~|7EWXr#s z+NuI>Z)!f~FEYBSEOGQa$WC-=I9yb{Kghx>uA2~K{*9-zE194a+{BFWwcr@=ogaaq zSgKJWP7p0&>;S0sGJ5``iVU!ao@uA!m!A{6zrFM>se!(TIFEQ_Lw%s;_{JllPp7eW zI{bZAKu#qbtKZ1|mx%8R$Rq>g)~T}aVM0r=#qca=3n1Bg|*%c(zw`>UqCda)>uqy zgljtY%e2FqbrIa3R(3Y`2=CN3<+vMA&F~i}LKR!d7*lW8Ws%BryF2`iQyQmAOWhgz= z1nECAn`mi*aWvV$)iJyr?uDKtsz-rwQjBz#Cj2dtNise(F=KNg2kat?4h~rckM^27 z&L|V!mc`4XLuS8lQbHZ~a&;bRYuLe$je(wqOCqUm4sHe6<%C0s6pNb#H2iD(MB@Is zA~!q@Vp@Ghc=25`=r%8UWSf0AbF&+}AVLO6N1ae(lKga6<}@RscdrF?E?bm=UJAVl zP?x^BZW;NGhzhTVNa?Sl=I{Y#SJ$uS{)^%XeNQZJhBSq{gaxbw(wNUh5Uv-c2B;`b zcp!D?&Y>ESebxri1SowWs4>5DNu`un+_~L@U{$OxU+JU63T^o7Au1F^?1sAcn?5TuMP$H>< z=*1`vcA3!G@lz6=A^73^3Qs3%YeQ4kCmwI-1>vL3z^*;f6aedGJp764ei;w**{W81 zcym|0+kQiy)qegkNDjzl=o&XaBm2;hA|lZh8Rl;{ zA}GkWDd-{gMH0Bdt@g(6CoS-)2`6&ky)iQ@kpGs+<)7elOt*OlRC+|5BjMJ=U%rZ0 z2O6NsD~5Xp|5gn;4hrzws&nN&s3d*HxLwvd^fecq6PUj}_9)g9;F;bTM zrVhTxi4HhZgqg&R1UFi~sx#8=hKQjbSc`+x9=7=g%hV5Od?#HJsH1=gYc+5qB&n6y z6|QMho_o~8t-QD_3H;rB!A|Bzshj_nmZ8cYW4p`>P#>Mh4A<^Vm3;n^Mc_5nIDW1g zB|0awR(0`A_hqx$sTI(pG5kp3iJ>)&g?&U@&~KAMbyqS!amnVk1n_s?iT$H9WlZst z9M236$NAZ@jE<>SgNl`)QLUz*$=n$PI2e@Ae2z+_e_9D#p85yq_ zgbeu56i@K~P->ALa_WNDR~m|AhTV`J*4k=AR{XnyWahWmdX!2DyzbRAHnt|~xu=~h zy*9JPvU!gcc>8`eR0_Gv7VQ-0V`5%o3Pt*Mas&S^YB}m8k$sC62iqC1c6#WWCo+ql}$77Wu^FBTM|-k00=_*?^d4=f2s;#Ub?u z4~GOPV{;PqHOt}oL;B;bJCFD1%RRnldql$vi zwKqmJL~v%8kID^o`8Y8Wj+B7j_njElu}-<)++KU4Gg+>xYEMMu`1$ce;A&v~37`~=!y4U&o%OAp-YP>aXx{K+ALsP; zSs*UcH}kf@!dVOfX63P9ou95fX77;{2Wy3s>ers_20G#|&*GKEWk?tI`EJR%=6g(o z#B@5u1)<+%N#?M^g^M~yZ5Hkh5IpvrlAuLSf*#dnh+Q@vjXT?eqT;|t%=%)+g2X3P zs&=6UK%lsnzY;NL-`m>oB6r%j?uWEt@;XAxH;Qi)09I*cp1qgB4Jh$n9wc#0o#tcCEL$6Z&zZw8HQTrHhH&et0!FP63sV1R%hG(fc!z=B)CMl zqhR4ea*Syb(`|=G1%|5!2JV;Ww7+7jKPRw z1e%@04LAoXRqsu5sx8N}0_K8>-ujtPQZc_s z3!qS;EWkfRwAAB6!#5>s(u4auJ1eea0F`T$u-&#<_qHd}eS7yj`HtsJtYLV4n{oaZ zUlfay5dY7t2{qf==H9Fu&EP)RGj7B;;CF-coX!B2Yg<{TS37XFiSDKv3=*h+u`NX+ zQa{#zD5=ZOiXB8PK2091^)%yn;)E-NK|Ym5B*+E+8Jhs_OpsPV?eBnPyI><{smxul zFHtw^#jOKHZRbDYcX;Z_d-_(zD6+M`X*KFXk)sZmqFyZv#{VfEw=I^}WUI7W5xZm{ z&AyJhZo@0F=`UmmV-3Yb(z;+yXU#N!sj3BmF%-oxZIMTy$ri})C{w}fl-W5@@x>>98@*#=z6&R<% zn~jHuM;!QN?pIa-PrjycK7amDJzr`wGO`s?#fnd3EFcUkwbVfhznHna?$LiQpaNS} zd~9y&LKgEU^w9dYdZ>2gTzu7Z*0#rtT*w!rvGf`Kc*3{kT1z1g&p!;{!w;}uMH9ic zp$Ji(Lv(Rgl3h?gIl!VKqD8TcnaC-g9}dz{n-iJh6JR{tx8St&wJ7t4yJ-z`3n9w6 z%I$BDYFg87xfq>uJH$4pS%zGjEYLLk2vJ=7>X2E*-#0K$heS;8nS(3g@W?X#~i*?ZnDo=X@B$mzEKWAh;T z+j;iYgDA?egGM;O6NSeo7M=;+XZpz@k&3fcg0`RS)*_&nD%;B`Y&oI|g~3(Hq9SyA zl7Nh)`zYJhufQZf|E4v)i#tmEvy}TE8Jq4ZSZkT zKa+*sIkH%O^ibB~3`}Lc3(uzM=SS!h?f$N6)I(ax@Bh(xeSYLllwEM00kP@yPtp@& zBUzM&R0XGGay|mUq}dF~+wOUZ(^z@cSepv{Ga9s>vIL$1eK#|I8L8T7B2%7-iO_pd z+gkpLYgrfmY(!sxZ$@a{NShyPc+oqK!rnNDEbZ&=ocZc|JvJ@Q2qD5A|6EJNFM2_* zIQJ9u?^{7zHBgkj-K%u&PZ#mgY@;u4y%EfZo(TkPnplPC9$7o7(FfNp7Y_d-9x^?Q z2skd|5#e~{^()u3dy9b2E?l2&NavR9pF!KsPb6DakxrLCBa}$62*O+qddc%)YOy4O zXRS++Io{%tEb+?gu$f&gM ze!`jBc!X2rw|RA@j5eyr*r6sIdDP6!sElWy%X08-3)qED8dzUAugeS!z!Qbko44q`%-Q z9dIQ+)iI-myeE@kPcHiRy-9{FBLm${S}yt*5z7%~WuNgr0=v>vwJ503Wtc;KJG^!o zJM+U0;d{I@vAjU`lQtPd?JnDwk35*6cyZcCEDaZAo(c{BZPR?U=MHoFK(&pYLH~z; zo@V7?VYU=QcgjHe2ErxnlqUfx)X6CrFA4_`Q~v*A@%}#>m|Qto`?RDxhf(+`OY#R= zT8E!D=8h@;-8 zItwPEdV6>%P%`;MUw?~lNZToHVb5x_mes(pcJdL5(}m!AaA9hY8uYN?ymN4VbWWID zY#9GbKQZSy^n*s;7g0VoAaL$T(B7qAuYH06 zTv%;`-KaWPnVLA>I2`$Q&i&-|J%ky725w-BJ%&{SkLQLn^D8*Lq6?q!tGhvc!olKT zZtgKeZG?t5BL`EXkv5YaeO0<}SCnd7tLuQVkeV~mMjU9BbX78E`OK*5`|e~#ErCRj zGzJHUizM#xO9=B1lLM&P-s_VcO32ule*<)udJHjxB(Gsvim8BD+Qdts9&9$FFdeYF%eP&sgeZ7Jt3Xsq8qzG zGiELl`E~-`k2Ged64$|!2lIMbmgyIVwE$pWo4BpWU$C3ujSE(ptk$JA%aN&9oP?#b zszqT6xKue7f0gK3<=)J_a}K@p7yV=1b@14lB&v!T4-RX7%~;ezCw<&KsDPq7CB(s( zO^A-Lqj>2BBfO$)bdJCM?~#wOUK2`a>6ZUkImWtGDu-qQ;-!5Cd&j)*FX2Qb0W+;$ zj%j;~(i~r6!6E>-Hdh^RKsW^~g|w!e_*$^Nt^m;FoE%fQUk$CqoVuPbTKkhO+=^^j z8AS)n`6)f7u!iJk|BbMy{}@|xg0Irnx}9%wYcJGvY3x~qKg`YBqvai39y5gR>-(an z9hc6b1!8ocn(v3C7Y3MNyBlD*F`Eg+d;TA)%u>9>s~rTNA3EOim-G?Mj~X|ZeU33p z4fnSO-F)WlHh3sS z%}ol$;C52BAUd#pefA|3@&b0N5@M2dYs$`kh?thGL;Ibw>adZ#r`MI8k@m;}#B4CC z)OT7SPy>5i%L2Ti5^T6NFjjIh2Iz8xZ!`t+4U~^ypA)WdUNO}dF6mX72d6C5p>E=} zaOQgqbozDVJpy3jP2k&+ul>%J=hup;S^4dqmAU4sW;@Tj$(jq{++h1w_}-<*!7#NW zS!Fw;rrpQnp2N>o^_8yQzo?LUsr!k!9I`czg36~qM*sl+Q(Il{N(|4!dE#l**B&?g zZ?3WrPJ+q_bwgq+6XeO&sCmYs+}d_aZLircjN2At&v6yj3|3?xDr#oPfq^OxQ4NKc zSJ5h83GmadY5oI|?g?MV#d>*e&2g zI?pm3SQQ2GFh9)!MtAaX{O$e5 z;zjmXw|A;>Pcjlef5=D=PoGibv1`wW79yDekCYbCgN#9THmnA48Oc1p$1Gy$bm5Xl zhz_uGqY?F*A|p~{Sf_;c?j_&taQ5`7PsP|~e=enr+SAL3-zz0HhQcK`e04W|hrF~~ zz8Ir=w^XDQ!2W>sQAg`V0SgfGLvt3MvuiKoz%Inn2>TAHVbBiYa^za*G;Cs!bSa%U?DMxz)#Lfr{EL&YqpC zMrTIZ4@y3!q&J$@9F$tLfgdk^MY@qnb2`I(`DD&sW1X#E+}k z#-D5m%9$km1E0E1qZk5R1&^;y!Cq{;4e-?Y%u9?scvB!SVD={U9|zlB*A_LiNw3Vn zE|yzZZUYM|;hCKL;U{mJ2_`LGKU9Mge_FDR(Ce4(`d`;8lv6p6yqPN&2Ol>?NfRwfOPVI{Xhll$g zO52qZg2M>+tlmqr&}ULquaVTS`q^2?Frms76g}GKvC-nhJ#Cjdc<_Os)R^ix{#fSV zu#nW}vX7c8xAAWJ6JlU40CAPx4z0&pR{K}Sx8&ul43eb2>2wOIz`7eeQdufyUv<}H z(bDrgnwy2Oj_4n8I5t+aCCvu?O1^EQ!8+^DzvI0@?4JUSE66>Wdq(zm4!+twGi|nb zZJ*9{rUvon;vTlb1H*R5`P?fvt52*!%lPVm0phW}P*+D1vbWmW5`1`glKN1+6t_Yj zM40>JXzc6pp(`i*rR_d)#Lsd>+w5tT^M#k$1}LQ7?u+p>gL)PpLG!&phTmuPe1e

#$2Wr2aq zC&~P5tK|!}Ht*Ustjwzp=@hbF+9?MnBeD5%ZK?bm361(-u*Km74D2%TRbmU})zYOQ z$?^6_=?;ThNb*60<^B#!?7GeijuCfBq0NmSl#%26DvEZE2NwD0FG+nUdQB6HP*r_HQ21DM5asIA!UA0V(k8W2%<>@m#rV^Q>LdtY zym4ECXj*f|&f(M%F_gRox;sP*NEO(-alNlXep#L03vXzMy|!HZyr{OoO1HygmKQ6T z%_s6$uIO%?f7guJP|&Lv_ePl6N)A!YZh65Q;RZy>YLRtEPXVOJbN_4>Kng0p{UXTr zt{n70W!>~JH|mUkvzdFS0yb~vN){t_frYqe!dz6p%a7s z-iUWKH6F1sdupt*@5N;A@;1f%M3HI+x^_jt$z2GhA)U6qN9y2tVS{TzMm)vH03y8~ ziBNT>U)#>ise9G=vpcAd`+b9ydd=&^w}dZcR?a;qAs?a-b|<#a^VoK6Uw2uu_)~EH&)A05Jj71Iycp?eKw)R6HQ6T+p zayF+Hzn{w?EfWt3I+e(vnG}+Q^XS8=jK0Vr8J{;#h!GdJg&tj~n$GnE?Or`X_m|h+ zZiO!lAi8Xso~bphja+kF3t<@Y65O77Ec;$R>X@x&Red}+fo9f`jK)|n{qGr|Owt6nBL0mRuf~WZWJc_>)u3g%^UR z>JF^l-j-jTuK~p^+)Ym)ggL~mK6J0me9j%Yk?@7*(=sYEc_S$v{(Hd?{+EZxYbwfW zZJ$#Dczk392T3WN`9*uRW@Aogg-eeiE#X@TBEl&U_m59!Lev-Z%J|^(%q;WW7x9m} zF7x`MU>(N(YWy7W32=;M+T!Z(0&=8StYlo?7gQ zWfZ2g6TWKqdFp5pVN9lk9t4tu+p%TtwNW zw=zvB_W1bT1#3I$+gB5U(3j40Z03Mvakvoh!QG)eL&-c+>sY!&odP)P$b41$Nl#7o z+&jJTgtp4AeEImq?rw1Pm%y+0xeU@PB803kB77c`SRaBw>f{bSO1EB z*?)5jR1)y}t92mCkhK4c*6M`b0@n-M4`hZVtT-rD(GKyh|JA;lzxw?_;e-+uE0A}* zNk>BZf5wbt;d}!8kam143qZ;Mij8U?JwOK{m0WHKtclZAWh0L>In2|+VKotrB*(BO z@;;&eE2C!aO!wYtqzh$CqmCiRYVb=Kf3Ccqb{dP()FVVG6HCg2Hg<;RKhGvDtvw{X zs7TuP)C$DR@c_g~xLay!aEYbdqp=GC>)yl!%Dxu7o0rZLbX_9k>2>g#p-V}uMppqN zA6wNmGOFnCdqB@U5(IXY+YF)PY@PqO&wtN6lB)4(-+j<T}vM_)^!L=su$X038ZGc#No)BVp*KM!Dbgv<=$OKQeAKpxJEV{#`g!=i`f_AO;vG<2x&|CmK{h`BMOUy(u2A;+K)lV< zsLZDu+Y$7|WHQ6|%i@i4JE>nA_jYV`0y7GqD_4+TbuBCx) z$@_6e-G_yvdRAVNPCtJchCD{R@)pZXaJtfth2hd|m@;0uJ*XbGw6q*XQZjyj#|7%w zzDr6|rd(T?e}g0?CH8Vx${rHXe$+}pOl=h%hb12OF(HXfZn~0J#8x57v!BtM6}WGs zDsbuab1F2=pJOxmrd8eZ6iVQoza^Yx%xHpc7?>4vnQf?BB--eHlgLQV5g#Ac575Qw z8RESh!*OK}RcR#2xFUA1zW!@=@H*3v$SV4$UnZXYq{h{+i)oF9=C$iT?xE2w3ICpV zHmra{3MJ-UX^OUuCSZnx?ChZY7NFl;B$F`ri3ep&er2*?GS<&L?%@??13UQvSJxxS zGqN#-P39*Sq+H|XJ&U~@1?7AQx+b-4+`!1zoh;^uS9bp3+gF1-kh+8WAnnZnwc~DH zMI+Bu+=FrXCyP~q{weXjtPdWABL$aFW&)DCt-x2P0(jQ{j<2_4tvx+%wiU<|7++qR z;E>MGp=sB&nKC}!k+*^QnJ1-cloB+`90fCWb*W)~eA~|7RRc#-a(9MFr2JAc3-aSM zr9;`Y4f?AJPP}f_7Ka?WNuc(l8PYCu7M|7|(JqV6sdIzrV34)&E!optN;yZmW60`9 z)vCdY5u-Al{^0Lv4y)lE+E<~p!X;@kx=wR*(E3WfANRt}&os9`pknrRh!;eeW&FsN zOno#;mO&i2;Lk_*q0hxAUjN*iEvn^ao!Khdp#y*cF?O=sYqGhh*=h|~{FQojyYQgL z3SFO@osGE3=zxnOKahiK%?o(is1{THfD-uu>uB|qTq|7G;UnkligEdM5fPjMsfUsH z$0^*j$rB6h+!NmVZxi19G*2~LWv)N=U3Gq6f7$tmyW zqmg_uwb-%{xx_Ba?~VI6(~Lat&`rs+A0C;P5;y<)c>17krSC+<=j(Q8lgU?#nkpxa zYVQ^`nB}G(YX4;_e&G1S(Iw}{d|e77!#cTG0cV#l>JjkA@ift zNBFQ=hG_fw9BOB=VdUm}#7s2d4)9?mhU0`=o~&6%{3Sk~@#!U& z4rVVIU-s@v<>r5h&X9@4zmcSB2%Kp`ib@Ki)8d?XGw$FXf{;~^QpOGC(K}s6hAbX2 zW%1Hv04)gBL|$s74T@6Lzsiq7_^-Z11>&q3YJa&}Hj>4!mMgqHMY(*m4VBtPka834 zc(RQ2tp&XyYSU-m2?gduS2{0(fu6tHwIqPnZ1dTxT|X1$NN>D$&r1JI0qvh=aREW% z+fniO=$5fbiPc+Sj973@JIOX|NN25rZ4hh=2a8Pby94Iw_P;YJ0cgsa^5LstU$30f zFgTHo|ATu)O^&>PQjxfVT}PM{FS;V^urEgh&oP_xO<)}2y@fl2z-jq)XaWBQ zwrqcB9%D#lP2`ipC52U00S-T782?PZ;6C-t1(Xl1q&yf!O_Z{+G7xV2rjH~0B;uA} zwN*?7EhQ?=R9FK&j>mZzJ_6ddaJRPBrZ&rP+@>(ZFM4uhIhFX3A>T`gIoWA&3Pf%2 zrlfhrciYvb{{4a9oq$j-gXedWAk~>?tZ$u0)6*~)OSx|dW^6fZIF_y$B5L|_j_*Jl z#54p~K(zPsCL9pTAdVB>1TI9B?H?5KjUq$e_fr&QMxFliR}NOUoPY5PGS9iPJ*ESIiLIA8Qv>I<`W91*EHA6n1o_e zjV63O>c#7E$A)42hyNI}(?zs*#H9-U&}cq;kIOiu*^CXXrA)*jgmZTjXsdz{h9gFe zYK4qhQY#+Xe@?wXjBP4aM%ud944EKnoGZ4=&EOS}^hgFUeGLyyo`c{J`XZ2r-**dx z6TgG~L$NpXAVO9n!}a%qmG{UPX>x)Ec)t9b99Z+2(iXgc?mBlNEaN*VWn6?G77b*k z3D`emy(H0)f>K<15vf)`ihi#FViK5slcdd+Bgy{dX7of`)=goPTlk^Kgli%X+^^-g zZQTOhioDpL3C=c5YD2Tn`)$0;KO|(G2UG)pn{9N9Kp76(H@$x%jEltQIuaQ7MA006 zbBljGGHHG;=8Du5Mx5k}3l?Xldr^bC0`+y=OIpm=nc(q^XXkq<{XOs znHzrKW2ZJWo5oe(uKAa1PP(JoB+pcJN!}@82h?2_#5-kM$*VKM|DghdGx+pq9@>8 zpYe7Xe)`YHMG1p-jBS3n{ATFf1x^Hr@s5t<03OdgFI+u}rX?|+P+<b&v`Jg0xVQtVSQ)q7ot6Cs&2 zAG=f15C21J$_}HgUz46GpDXzdv;n9*vy`LOQ}0D zT5XOjA+?gRJR-I)Kx{lBl9V}8^K7#NJr{mxWYlPwpM}REYqL*6h<$@Ih0#5OGq9x| z3_g|HoKOqbXiDCFola7hLl;(863?X^pu=Sai`pcs3Zczp>AVXB+kKxB^F2F`IROSu@- zYzLPXXAudB9~}S43oM>L$J%iysg_09gXj(1NCB(ycE2Lh$xW|eDE8SjY<>{aGPT4c z1V}u|y-d;}T2$3(@x};ADO!UVmoK;kI-=1r>T(8A2cjLPmj(1j$@AL$XH+4gbN0&* zqjA$Mc4pJ5D3km*LKzu8B=a3x{8TvcU{T3e7rYwT?It!*`eHIQ&NxXZwwBjMOIKZ> z4IX{2^KL1^KCRwh`1-YH)%+Uy4Si=(tIF9QJ-1F7vXDj^rxBtSfu^wY`}`uY$jBk1 zUvrPjZwzVQjiR3mz+gJLxwkI3+1Z~{#*B0i_?0Z{nXZ08Do&Wa7oXEzx(b{fBMK=? z>pL8b%he^BO^ySv>s0IKj%sIqJWVA`Y*gV*80u{!BWH;c`EO4(Js2TGI9Mq$juc0?-Oo z=I*ZW}XjGf>(|n_*K>n6Q;+qgLe%&^G>a2HC1ePYC$iC0!1w%N1MCTZq`Mo zJx8ej$TGkslf7cAFYd1~T^=X{Vm|2wGSo?ACTlSf?QrL1Htt=Qiyp28+StEei$2!ujUq@3G@M3;BTq*pygv{A%UN%&6)12zVCJM z8;I+Ia$`!5`-hI#aYlPqZuxOm=r#l=Z{Cl_QIdt3VBn^imo1YN{;w`$#iB_ohpy+& z`ePrzR~cabzpv@M)b&7e24w_Nq_rFCDs8sW|KeqVs%yKCl7G?=*E=m7{)$y7E+8`9 zNPFQV_+kQ=pOLR$(pElqe_CF-@Xy4>Yo*I(c`lRbgLtR*^G#>3id=@tR2tgV&LzuQ z82CAs`>-NT*_aZr32hqo>cBG-|BB|@=t5OSqu#KstmC{)zS#Ks*`y__DA4F~3_Wg? zF_9rpl-ABFGUG7(&v?;E)HlzD!2!I`SY!=+`!2D2Ne6BVVoaeLdi=}WqcGjgL=3Ka zgXaU0o9QM$L3`3jq4n>}yb2>+d6$bvNh z(X~z7EQ*Aj-s5KKeR_2~1Yw%*D@c)=g*@C=b@5dL-^~AE*LY2PcXyZ6wn}PDzOOrY z@R;B`WOR3d{>?X_=RdRut?T~D%0B+yUT(7La_hg{y;*4lH9C!KgOHNd?=qxqEv-XZOTECh*I`1Rub5f7#_FYya;vN&koQoE@?! zz9uLC3fx$&fDUF|yKkl6wr371)Gz0zNgYzHBdx8iF`)omcS^8VQ1f*$|5ME^JmLqb zHv+_D^Lc2Wurl6Qlyl%=o@$Aq1di=jhaPai*6WOPAIfI%Ub5)E9mIckR8{)(xC+W8 zf#SRo9d=vE8g3g&(C+rjOT6)EB2+d*-G}$fJLmwfQtJXoM*fEQ3WB?rl6ABf03dCV>V;`HQ5=eW_A`E@Kig^TCPj6suw@+)S1 zkfubwTXO!}eoEwJdS7znpB`&1Ap&$4Li%~31g+uy9Z%ID_^$nsPR=tUt^SnB~A z841Z7?hM=je}(^3;OJeu*%!?7OGZRVNr{w@A$5skNo}xwp6KswyN@I(&H2D;vAFeO z(kPRd9$f4C^<8XX|1{Gk?uiJr72!9pX0)?EM;aNuGdQso6|p()C9*ypUPcDg-@9Us zM5t5`aySlQe`-X}*!1!en4?H!iVNA=B)=%}c;xJ&?e)UJZ=|_+_zLc22R|EnQ}{qUJ$>R+ zYO;SfE0#3!*q(ar zo#J#(((I1^A8TC)OGzynNZ0u8#%*)=0>LKXXfl5tIM5Tjf zx_@c1Ic`*Y3YC~P&ocR_1v|2F{@QPc{LvKzu^{o>71mkGLnAr^zV`OUl)syZuE-0IItiNkaSNn1Uef{D4yPoP&Ni+e@n0oh(s@gukq|hhs=dWyYpcR`c4FFcwUUF0VZMl#r z_|pxN&-6;7riwJO%Pp{SYvhVnF)eBT4trPnLt79He&0m~{5zpYE>g8KbXgk4J}sXf zu@ijZ9Iigc#xlPcG=fLZ*wjW{TOfG*c^J(VesX1L%T2Mf;RO|;L-bYiIlC7$6J+l} z_7s(#N?5Bdy5K^SwI8W*4NxpM)%lB&oZPHAexb+C{kTo^#O`oc*OBLPU}EQl`TKu2mOdA4;6cqPvdQ@WVj} zYKlK&!JC&gGUDm$=01FchS@3(vP+L~U7bUbBMs91wmA+F2jW6US&+h4w{*_~2v%kz z;h|B?1Mw3?Sv{L4KDv2u{))aI^IumRd=uY39RvA8q_9ZgscBO0S%RVe%Cl!=n!!JH#GpT-C|~FAND?sE zO%2CO@#Q5EqItcltdX=&;M0w?s)?nWqU>)4(UVm1xb@JoH-t+y}O$b z_frEBggok)=gvsq>EC_rxUHREQ^W{SAN5WDwbIY?6A_Y}VYrej|b}|#|VojQR7dWs#3}A6u89|iZ z#W&8A=5UtCU$6-C5B<5#euEMq^~Y;C?KB(;^E>bN4)XHlM?_u`Nd4L5n|ZW`s(RX= z$iu)wLGpR547a$o{a4%_RBq4fb?kVU3OB$pbq$CCyDd`!yL&^b$hM|UG-hChM_x}B!=hw^} z$NsagS=Wklo$Fj6p><0!?kJ%{8AkY+J~rwR`r^AMI59HQpt7hLw_(`)`SjuwH4gXN zvRzlZU1qHSERW4MOqNyq0)Bl<^+$X$b=oHKwXt$E#4bkLf|wIn}w|MR5eIw7dO( zUzWf$?UzISFrKltoi$A^PwC+w6<~d*iCYO;HU?fvw;oh-q~U9pOV{d#s(W6EIu)

_%ElOJ-X7(v~ibpxLH5vVu_S(P1FPT$xL$fhvt`~ zwQpbpuI-#Nz4_fBP4Bgapb|tNp@QMdXDi2=p*()D90lbxp66)0U(GAbC0(0zC7E~Y zSO#@=ohl^EN0No9TpW^5J>5!(*mMgXP}UjiyMs9Y;jJp|%N`yc7Qf9D@mD)F-155q zL-OHo6EB4Wd9)K0oePVg;CQlpu1Sf!mN!tjvZj5hHT zHl!^{s8frZ4e{@uVqV&Kw$`n8#ZO&MR~N^VfuP{#+6Al7TB^^VdOwq5+gH#l!+r4W zMtUu;UU)U_)~SG9|JBRfIXypCnY8$zX!nWfKb^ymR!~peb>=zXLVCzoV&5pUX)f4vE$8ltCm0@0TJ|TogZ4 zZMZI7d?8VV`|8SP+85>=B2K{peWsPO*$E+wuUAtd;x|K={a=k*K#F_f-Y0y1?;v2# z&k+Cc-aVkgdvN(KFz>MO`>#ix0kUoXXZCb!Pk5WyvbLp%T}IhvJc)!z)n!18CBl|G zN?JRsU&rO+i|E%3)lBSMqO5$|9B)P)KN7nUqptd^IF`%|_rQt{3pV+2l!f*`)>o! zr>s{s)S@D1k@_bWkj~$AXNVI=!KQcs35hi^LZ*mTB?@Y+yH!6 z)kiL$AYTxeH2c+EpBnN?|`J{*CK=3(E|s5B8&{L%k3;0HxUY$Ifr4>4B@? z*UgV~tX_!e(SsTP%RzOWs~$DgHt-J-Dh{K*aD7h@13oaAPOluSmI zG0a(M!|bhp^#(fA0e>rFmHVl(axWujI{A`Z;NI6PEj~9Er7Hj@1%}=W`llb|H))d9 z@mHL<-!DAL6ulnuQ`tH@HxYcD!;@>UXr-~RV?ZJ|+Xwp4DY(5a<1e~2zQBX5O@S|# zoLo{#Hn)P%)!tDa#w{Qy84Kl}Mqe4WC#%!b&rhCZaSFv#+-)DRaf{oOIeZHI*avW5 zW(TQ~PjH$=f#oPQMyVe6&b-oJ^wp61C^_9FcXbsOvNNb^=mzR0+h{$_cDp>nx0t$F z^!dE?&gF%IUwicf-6wMK>ig*D3&o&EQL2X9-U1v0->?mv?&RNL@=e6G7QKy*!j!(BW0aiXy&P**H+M z&FAsX=cI=LbHB~V&o9;HG(YL3I$So7mRHALNP5*=n%w_VvzaW}f3?e^^6&fiGA;$=w`GANC{AE6Lqee( z9X_bNwO@741m>~9TcSx(g3mx?@hf(VXc6BDcFXRGEJ|wcjJG*K(@wz-{I%Y0cn)Y( z+10=F2woh0V-O(2_$h>zs4!=PZAQsUNz$|j%fCSKYH2$5_bUpnM00JCX>EURducJI=SlimqH`~|ZJYhe`;bKSp-+Nn`RgF`wK0?}KiV>(hOUm; z6248r@*>V>P`dBO{PN4t)PBNM&p7Kz=#d&NoQQ_I-wWTaTWZR`sLcMO5jts;Nl%ub zwFwKgWZf=jt&5B#oaQ^i6=H50IdwGpXzZ1LV$p}sxjlm~S_iNxviG;Hm->1>Yv;z= zR;~EalJ6B6X;LHMYV22{_`{Mt9D;p`#p+pYG$OW%?~t(x|MzA`NMI6r0l@7Z3B;-M z;k{Hh-op+)UJ4}GDt7j3EruPqulTg>$s8&G0y)aJQx8)ucY4O?jqoYLp5XCnZ42K6 z7>C}Sr6A3QYD%l~BCt=YVt%DL2FtD&Q=T)!&Ya96B3*>~ay$32E=H*RWI6pzQ$|!T zdQkdfjtLuk?%@Hf_k(FIsIw6!D31L8PGbmxY?NB2Daa}+F6Q1EyIx;j%$d2C))1s< z!?s^ylPo_Zh=n=Z%5Kzq!ZjmlxTih@hBbV1^R_1lIyte&v-zy9+JGa(RRNZS2dyU) zJU>ji=)Wqae!U5i)7rdw*0cNdf6aj+R{tz^IKk1bzrSrRS&QuX%8`DF?e)6{5~gu- zQYzwNeTnW}a#Eic#(UvQOH$10MplvUv~hJBH;xeU2f)9B?*`EUDs`D^dzXJBMxhsyd%IPq@^o9 zxUt%Cg$sz%5nG(A=(8If_YFllXAGTIluD{elkh7B7W)M8b!NFtN?Wi#DXoqiVsYSI zwJiOqd8dd(luVHw6?F%Vw$om3Kvqk3BxVfPM18n_V0JSVem*~jNNivFa%lN8 zZ6Ez(RA^-Qbko)n=lNBL@=skTM~$>X$T!1B=tUKNt@|G3K4nl;{KvNHAnvKB{PXvj_A8;e`m^xttUZG>2f+Mj0iAq;p3Sw|$B3$;n-; z2i2*}OfO1|nEgHnosyQu_rb|5n`5lcpVyD{5dJys8cUv-yw*sLG+xGeJ)|7rCC*sz zUcaLg*OL;1}TM%MDni_1cz)A#%5ZRX;##st*kZdamcXSHB1#F{B z;SCX(xe3MQ7pA{Fe~{rXZ~rt74)#uf=e`WE(397=Unf2P5KJOWJ}1?EqdGpS)_hM5 z{HTcy^*c>sc#6Tij42*8CnW&5G>^LLtBW5L`|Fwd4$uMsuSuV?vz>KNUNJ0qe`Ryn zhn{-vof8QL<9=|FSnR^=>Q*3q|Gqo7kHNQo^;PB$7lsYAQ;lnD^>EH-l7PL51&@TIlb1+|-U^&fU+O>Wv$yn>R~R9+f?|#= zeUW#~@phF30cTY*3dlV!1Q|E07tDq%I+%gw#}7o+73f3WE)xFD|@2@ zrY(=vZpKtXN?hi?N9kH>NL>?jWRkba|5H&8 zVNW)poL*pUfGnlHhQ8w~^Cgj5n}}@LcKlZ!7g!yFE=7~WIJx>N_G{gfyma-jmm)D#L!x#k%eemhtS3VxZ?eb1c`ot#@t80_G3LS{i1sUur8`tfAStcv zyj_U(>Gbp7sBaN={SE=;p|x4O z8Y69M+tk(3aaoG^R^!r`}szjbP6p_etg@O;u^&4{dE@~A^y4?gS%TQ(rnWvd#ly##slu9 z8&CToga$jph4AI~2+HV-K zN-wwW5a!+jBz$`=O?E8miJ_vLsi$M(f38SH#;to5xyt{q$ zWhH-Um|^ubVjp^!ZPIUA!o+=RrEjz}^1o8Bfdn+dq+4jHiR^)HOL2-2p4yr(|>K z6KAemFhQM+v^Wws;|_ zl*GyO!%`ibA#&<}p0_W5p&9bzY*V`0aHXv*l4f35%3Dv_5I0nZWh9YTVr2}})0uAp zV!nBAMz#GDu<9?r#KUwe)E2tiYcd|}KkRNdkQeS<-2Mip+EHxBqW2G_8JXVxxoN9A zh8Q3!-Dgx}1qa@VVPw=Ee2v~4NOI%0lQU@}+i9(U3By^{HvL5+0^nGh*0~kh>91Yw zRbxUK@FkINnVUU2{%Aufmh+c{nT{dJ;-ypy8lLkZeL^qBc zcPieVnAYkqI}ditB$TkT9E$RO#Tce{UGfY*p=w=kGf9;XTub^8TiS6MrJ?<0hPn8m zINpl3wR+(!ec-d%8zC(6M~+@j)6Z)r{B7M_G zQ(7uJvAhwP(1WD zI~;BJ*tTPmiagcjb5}VATkZ*lb{&(TBFMXUXWMi!XN8w)a%qLz- z{bE}Qp7c3%$XZxq>c$4tYOpv8(;Z4M$j!$1daSjoOdaAR%Q1HvmPYhGwpS&>F+mNyn8Mqaw_Iv6*ZK@|UBom6CIIWWP`UAdi{$lPJd|DY{bY zx;*REnpLWiGWDgd18B=J2w0iOqf2tTyFfAMU| zsxkW=RcwJ*C~Do%_PB`GK{%qD9p$)<%ZG4Z{(vt4hJ$#=(omOQr@T zJ)h&3QR}1jpLBEPioV)p7!c}x^3Fu_^xNLXo&msKJHDTta<y;uTTH~U+!hU z-nXQp)Ou;wUTS6(>jf}G^fe_85ChT{Tm56N^QBDknuB>>@2)Sqhf7MqLY8N}bc$HK(l3mE zLABM2TWiON>p3VQw(l2k^6@R9>XhY4flbj?205GO(7W(M~-H$ZA>&ZM_xh83b zjczkiEB5w{paR%26P^hBSp-uQ+v?C+S(XB;3-IFOcBKZeN#jHTJlcBc^Wzj&QcUZJ z=ld9T6bU(Eyx}QPT(qQ0R@(-OQYuJ#s!?+QC-9h?@joRL99~P-TZEB%JlGNOR=fb; zXSxD>=xthS75vsyWZdxuLW`3%-iF%PMkBd2Ybd_!)xN6}_276-@CjpV)L)H-g{}-p zcIw9sjuz2fQpP;wKq-AuKRTP2nVDJ9cW=F_&?dgRx|#}DO;q~mfn)Zg1e`YW!6sIW&M2Ws zt7MK+!0EdPP0fs=cP>B<-U;KE@1{Aa?d%T

r5WH`JrQMKW#Q3{o=nWd!1yU!5s8 zxzI@8`mX-ZAMHyuAFHp4Ogf)CW)KWv*3YGQ#?q@Nk)zuq_g(l*h?5#F+e4}@~8k_=Ha!vB^0jRUQk-)`My=Nq;m+; z*N<;$+4q=i@<1=~ zhBqsOwcPLK$p%LE+0v=ut{8KMFh~sOA~FT_>x=?ufFJxR**!L2RPLZ<*qMQ!c10Kd z-`xWI?VkgGJBwKWz_REtYegYri-KY{1y??KOi8J=^C2sh6dtPv63QTg_(#~?{*T(9aIM*OZ^ zel#h!A7w4_FcvSk(DZxxS2iht(l!5gN5GgkGOaEI34OvoWforC1O3wBFRw?{~Ki{s@XTk2UQDJfsNB(%1!v~uV6&r&u+s7719m`*fC zW&#H}*A=LSSI<&%rrpL?8)h3-xx;!28Br5CuS4!AtVVAkmYcm>1KA<096+ld;ox+g z>1cj=Aej$i_JDwF8E?I#i_%>@GQ^J6 zpNzSxWo=Ud{QU77`(JWf924W>rglG}*b0qxk2t^2$B#Z%lmuS5uq?qVpM3lD>n(>` z_@AhzC4MqH(JFFDp6fsMrgptu8R1RDPye~v+OFWJ9c+SF-9s`*dg*NrE5IAO-F3<% zq(@WGqkZru+Z;*l4vn!E2Mcb#R=$oWi%51rNv1Tq8NH(V2uXM1pUwf*sEGyp({g;=U% z+-sR;aFjWNf4Rk%A7FsN{miE)oD19hXMW$^RujY!l$7zD+!V-2_YFAgbf(>&$> zyw*LmT2`0e80t9J>#S-~r(u%p)*|AX>5TG0AbnXTr&VfOjspBW(vkhjV78D)saI{j zO8vPa=1|5j6!*2-ATWBXC*WGy5c_@(>KSP%F}O69W2#J2U0$fq@%rJKWcsX3L(uN3 z^P~n-HOg;QuVL?y7s9&cjxqdwcu|8EBQ4)At!^y1U5lrKX~s6fc&nyw)@D&q#+T@O z=ZSLVUFCMZ1cEBEz7|b$Smx?$GCJJ|(sVkX4LkhT1#9pEgPlPlFqarE)q-A25-Plu zT2f}cySJ2qIXO}jfmJViWtdX;gCu>H(U|?&o@?PIUvLOv0e%EdlL8{7ECNm;);Z;U zou5B{;;{QT!-x0zL?=BdI&=%@c8_qo@%tyWSz%r4nVO~aLe3y+`N?lNEHx#?vjMHe zY-3Ok{JFI)kr0UAM%{`2iQ$bK*UCW#`U@E{zM9S9p(ijbQ!wNi^=g zmH%_WP;_qmsFuOiQ#J8xL+2ihfmgGEl3*3c{xwM-^jIlu=6^f6=YgI!xUwZX4vceB zU@TkseMCi1PWB^O9=HYxXWHui^1m+A)ET`NW$Jcx<>{_x1GwW{50Cq+7j z>x*&8k_`Te0GrX>;s@-4=}?TP02bZd!N@Y`D#YdK$pHMdth$D07ihQJ=YH2{yqm3i zJ}J4ackQ!y4URtSu1KnnU*r#HR&b!-8b^zF=uPMixZ8j?n+jO+-uejqjzZBAd|;zw zsucV2^&uFx=6PE)jt9bKsxKULa1q<>`I8UHPNxU(ipgA1iO0ox)*PtM0gTYFkb}$9 zDhqtpiAe9-im9{ADO&dvi(ur5i`Z_fz}yw<>-c?h1FXV!pH|G7>ycsCtNF>%;40@E zzZ>X|!7?;zBqmJhNr~q5Qe3;*syOieID0=z#U-nL-x7GCavx>5^znrsZA4$a35oi; zkCtVt6w&F!(Z&){t!L|AeO+=GXejpCmfJou;4JA9zHB4!0<$9ms!et@2Tt`VGiKrC zqIZd%i<@2q3dO`nSw!JC-4JXtX;@+4hvPRH(q-SEvyHuZF%zGY4MV)?aUykZ0IyW$ znGjDj=CQ;8k+on#I4RwR-BvUstvLg{APR@-Y`APvSUro1_Pp^sXz7z}`@*mbzVo;u z))axGdGRop^Qp}5?aP^c&Mz>~C|`zRWa6C{`JRfuEjJaF<{uHx{?PF$rkY*7>9tyM zLA{Zh&D29rm^x~d11j)}gJ)Mazmy8NKD~?e)t^o}|5<`s40T@ah>-JZczvb)G3Sqw zzrV=la}B5b##+DUMA;rd5Yl<7Ybe-v7ICIBx$502FtCByg|D)K8y2k734cb&|4+5k z|5sn#h>!>7l;wjjGxlfZ>i8Cg7fOy)_a4QPphyo3Zu%=_tEz8%hn^Cg56QPXFCI=jLx=n^m3GlVwfI_LsUH5uG9ol z#a9r)bB#Bl)YSTyF9pvdlr&y!8I`j-FVuxe#lnxAn3l3U<^zq^bq<*Tr*-8t+txe5 zy=uml7n17HlrFDO@Av-FP>yD}qCiRdCd)6@XZXrK$le_~RxR#`zQ&%3Jv{Y7Y-s88g|L@;@%p?wOwRUN)=#a4PEi=Q!~pTEJ@XM)2Z*>%hMM_-03=7n!um zx;JyRXk%=1&>5fIXXfkv9F;q1&s~$OiH@!FCxcaG_+VORKQGNzrgv8}EAO?Kt_a_w zyAiKt(HhpT`v)yEL;%c2Lx%1|lx&D$Bl|w97+eipVTwEyY2MZZAW5}RYC?=qUJRU^ zcFf~9YGDX_&`(Zj`lHr;^Pk6Aubbbao9V6Q+0{PH4(uy!-@*(wh=4fquIm@d{7kbn z_3_^UfQ@5$?PgH1MxFl_%P_XF{7o$Usu>2#5i@JVhT}~{mP=P9f%oXLSP^W6j}K+0 zOhS` zO^TAd>qTYg39ohBsS3E4!uFOlC2UkkRz^X*NB$*sQf<4BueSu~J|i_&DTyOWoVcZ@ zk30;g9JRq8Y{Y4Os^z}?EMaB($ZESM6wV8^V;!i)@~|ULK3h=}H{kbb^202^sn`2N zd5hi^X01ajm$!)G-l~}qiCZ7c4~?>mJ{$|rIXBT(ot)uEg3p%JLerS(WJi^tX}(esf52%t_RM%^lX^8@ZtyKCGI!6y zs5a^AExD!JWw>pcB@E`@Q$7shf+7Rljo7Gm^#>zHe;nc}SH;0)K?;y&hsr$MXF|r_ zwyUGTqWF;4Cp&e>me#5Qc|`G7b>a7MGNegPHG};kIZ8bK*@WrwIX|!Nc`HK-SZjn- zmE}9)A@+(SIopEEH1jILl|0Z*ox?5XVyQ9N8)BwtfjGj>&xHDW1B3c|SKK<11>e;^ zYEZ`klx%B5tVF<&No&ShUf68=a$*^h&N_H^Yo`bDF2sGeVmqxJ;Z%}}5zKoy{nn*+ z7{z36^W-r(vA42J5AjZf|*gN(a9aqS6^uEIsJE7J zn)dC7oOd35_DZ#cz=A(tuYO7eo0<8f>E2|F=5-Jf4y*M&;mPV|Pe8|AJ?v5dNs3+z zLc$vN_5(VUcl&SUtblgo3^++LAT@O;`=f)m3~70MMD1 zC60LTp0fadV;WVSKS%g{m8Yi6qq<>XVbOrBuNPh`&EjeYMJev;JAOOzPSXbEb+_Zm z%Vg+F`D3TqLRj+^Z$^9E_+1ijq)YF2=6|KrYxi6kTI5^rIIFt49sXl9(`LeX5ifvI z{9Ir+tsryU4E%-@?$s~c@>Q=kg?Q*!w+&%O_iqz{q?V=in?ZEXofqmJq2s)7 zsG6T$c@L^cooufFz&^qR!oqn}MQ&979KHK9B+^ASG7D6wPuc{6n6t!~(pbI2sdcc z%JPNuJVhRkirX0JJW&;rfWS4pfHc&q`PyYoaoFLnjZyWX_FrUZptsmtzwazvZpXig zAm|VSk~P%gkk0~-Nu?wTy#{^Uzs{X!i}9fp zErgD=p_NI?X${Fb-it2CE&^!27RTC3lOt|mz`ci-(Gh9>OMYvjx5eRYvh8eaX8+6 z*_T>1icp1%Lh~{!hUXlgro6LcjgJd4@&9uC@Tupl;fc@Nu}?Cjbz{S#2Y8Lg6#edh zy0_K@D#FzKOO$2K8YlvUcb_ddfX=~i@9@RE2wfOK$o((@#el`f-rxIKRau{H2WX!f(V$mVG`QKBU6S$^4i#&Vgx4njH3+w`+@KZm`$AFS5NfyXHt?s2VpcksXVqnoLvq$lEHo^&fn~~ zQc3tInq+6uS;an#P?fFP5(zonN95XIij&p*#6y`?h83!$nM33u3}bnX=v!S|@hzA4 zT*v?CpVl@)UFg%LAG_iY2DAE% zDYa$;P7`HWRT<1RswgG7-F45j6~EfSuT1=pU2JV8s;QQ4jwt$U+lhgxA|$gBuunXO#k z_Q2~|l3h<15-Lhq^w%dYEDaYkRV?02j#YVfn{V4NH(+Au0FbWRYvg-f*xj9==US-o ze&(l|=N4F7d^UI0g`L01`aR?L{soc8MNu!<@|IGg-r5QlDQ;N9r}lZAx5{U^Sv`47 z8m%&lqIgKwB)UgqoKXgClzPj|QL=2y3^9s{WHYlh?%*>YSkBm@XPHXQj-neHvs>*) zWb)}USzR3Otgiq;+Qs7djN?Hmz}_-RRVh)D9a);TD@?YF>%AYK~p=_b8 z^11`?FTNMG8SpJSlzcPLN3fSJLGZUQt;XOlXk)IkPdD!~=YUfHx{@c}%~~`M1BLo$ z2!Q?eSCoI68mdrF(H^(bLid+7Z+?mm(<3X>7IQSM`GWhibofPhwU}emb}=c34B*6N zQ`MCmj=>;XMNZe}vuZ72_$*{R`Rjn7 zTImdExVf7d#8laCF8VWkdi7XwL3ww1ux9;{)=h!=TH9xe*l+T>i9smA#Ip<7F2V3TbLYEptKTi3EHAX?jn0ZVP&W1xeG1I->n>YvSx4ET@ z_>|MVzn!{cF9dyE#ystM!5ATtKpq~I&Tn=j=((WQt7yBU)1$XL)q8F8Qmy%LCZ7{C z8H10r4m(&4j%^G)6e7J+`e}AMoh0GdSO#ourh5TF`;TNaA5-oV=!c4CBHaZaQ#HU4q?YQvoGPCGD5as8TM*cJFGcQys?}ny zFLC72A)FKOjCNvV25-A)74OI&U4^_BzN*tC0OsjV1YRk{4En#A6rAp*OQnin$7QU= zX7MFF(xG|&3eNlZ-dq2rl?DQM`4#9`DZci)T$}1!%E-{c^i9(eW1`k`^-a@b_oF;) zA}p`Y#CX*L!qF)Rr5VSRR^0r*C-3Cb&Aadq6cw;Pt!h~RMCpX&dqOQR%ww=dLcqhy zy~(8fsT9{ssAKrm-j6jc%G#0o6cqp&fE3Y!wLRMmcV?dNkiaI0#tzVaV$Zlcr?`Zvr3S~UH` zYK){}!uNu+4P6NVO=Y8Zcl-Z|wXvt6=qTgj!NaLgRzz`?yOk-$=`a?{$Tc3`zkTm7 zbNr@}`|9f~u&tY;>TcU85RB_-3j9#`NRUr8`W(>w4Elfv12yB+phCk`Ze76qdREb-iz8&flS8dLKC%3nd2hgpcoo zPq0Qnh0Q7kkHbUMA=}}v-Ly&2Yi%5SBb}xZ`UHU9>z$VDyZZ8d@*CTYV(YxmJdj=6 ze{&n6rgf2Uuzlz8PE|*8gKf>&mpKJ>eErYBONP3j&M&%kRrUCoQ+9N!P|YY?Nm*~E@x0vaaGR^CD;Re{?F#`>qq>gJd%~*mKB{Rj;WtH{#X}gpX-SEL20D0S+M-2!ni?S(n7e z-5ANz=(+3sJ>uh8bSqQ{ZY^nO?Cy}=xMs~jA^)$NB_Cm^ny0MADxLbx#T{u2#RJ2< z++z!Mc%7P~_u&?Sp7ZY7^=qzh{oHx|5Rpyc9iM?mGkh}|MQ#+aS09E~u zrWf2uffd3Aw{J@z@8Gc1tL&f-fzmk?i8brj9ZQ)$?tPY}{A9(p?fGwVq|S=Kj;g^A+47yBG| z0Jz$vnuF$cYA5)VKlqNTBLx0E%k3QvdHGCNXzx+PCnX;lgiJOi6&mc8MO>2n2s`W` z$zE3GOmM2HONa}tP&7p8E%MVq@f*}|`42@wzE>~+Y zYdtMjtR{;l;>?g_cXV^*WPy)Q%#xwq+qcN@g7UuV_m!K2Yl>%#u)`GJYHP0Fv>Ln2P`Ae_o6aU`i+ zzcS-?xV$BZz9kp1Ov-%Ka~t-DP+)dOhY5hNd$Au54OQgfOOEN+-)DEKLyYPJO6^#~ zKVYz1t;qk!1-OmKC;c@1`mt^^O*PvFuWt6xH~ICoPtL%LIyoEZA#W7-`1vizz&u>L z4<&kr=MjVotMe#TL(Ncqm zq)$nS@t`@|2Cn&?Uk02!rIFRDWeD4_j62xLCs!Sgu0ksXi4ZInUY?PPb4Zpu|E??D z(fxJxf^1>6G1RWtBEdUHDVnK2X!qZ4D(vHj5$TaEj^T*g+I#FiVD~Q@^1YDwYe^zRCKS%-{cS2?(?&7r8Q-hRdr2pI{C$rNcxdxq13l&t=2q zQ%>IrlcM;dqBXI1eI9I0yNTW}X$+p+$dnB)!6mld`>OP={do+C(0$Hod^KrT|de?`2YRRCbbRp3exvNtA zI5Y59f;-8fCZF3YqqL*#NnkEq{*T)!v)e1K+636yWXVqyb#uUN6^Rv;7uZtW@zScE zrh6D;s4}4WLA}86^xb9KhE1UYkl*)kV}LoTW_$&G;rea?am4wD*n;mpilN_-*z)P6EFH{#jB*CSs`+I;#ona zkU@)V3`JfJxu0U;L3`V={r4@rz`F!LMqG~M)UL>{>h_qQ7jNm$YTMv$52m*Q7halI zb-^NS+oR+&N0BA&t6xDtZ|Ba1bzHm@q&x4q%jmmZFHMn=Ci72@P5DWBRZ2{pTmnz_ z^i=vJWsPdbSdw#uG-$&_Y%i}IR&TbM3NSa0rS~v;E@G*t$DNaxs@O5sP{>9t8?ly3 zHjF%cszTbFzE>SIt<#>3_H%vF&psxWb49iB>9>@!eK zwfZsG@7q!RbJrOLsG~QXhhDM@!dfy}Et6yKJ2!rAkugDNr;GJ65 zf52B2~pwN|97}LG!ZX^(io`!EP2XU!@Vc6W6`pJp1Z2L1wkgO z@7)oPtA4d85XDkldvtsuD0Nqb%yyvoPN@skAb%Abl#r&x(H=A`IH%@ZSG4u@_5kpqrph$t-eyC5LlqP!_l^}99@fWQ`*6hG0HVd0vy09fcRLj1 zW%n9TBMP)}u=w(^mGRIADtR-n%Ln?*Uj7D|1bYRAF*0D}-0%FRF_KKC(P0!F-thU6 z{I}J{%FgDDq4^&8{li^5<_q(QH({{kGA;(PhF)!5xr@@)nx^;UO`#&&SI)I!>fN{$ z*mvMgA^^whe|Et3K%_yJpkH(8AGk&Xh@vF6>e&&=Z`lWkijHWJgHPhgmy4=cMZ_vW8pE;CrkkIy-I*&ESHudg*E%%`xM z{KlL0&D`H5k!bVPfr34SMAFR(ffn@=pGylvTvGmo*HwZXD2dF535ZjKh3iIJd)`w> z-aRsAbIJA`T^T(!CIJ@8e6~Nj9Q0cL2)x|BJ%G;$0}t|sX?0BT0HBt;9#qiPw&{%# zWy#T)S`jyw&e4n^*n+B}1K5|zy1W#^eV#ta5&d2j{s+yAk{Z%c8Epxx((kBy)L&U@ zQ54J04AC!=0F%1h4clq2Aq|uvqXUR1sa!8~xeZDk%1R-wEaFEgOvNFp2tPe)gj!;F zlzf8yi()Fx0Q;kH+(rUxvrGH*n1<;$7T}+sE-x>zVz}pLou-YhkUx6dKn3)|VPW)u zUZg#IuftkW9OP34%VtObC8Nee&(qq7^Z4;Uc|x`3pS!E97pwlXkd2+XTJBsv48eSX z3P*_&KVj0F6-#y-uAlhY_A!6WXCK#6H=1dV4JsV5g{6FL0!2Jd164Ap@SOaK;l9jo zBbD0+6beQ|?(==|_`I?FgFq4SIDD!eMw5$~rNb+(`r_dCLgD*ezt|IaZ$Xf23nDT? zg13)pJK~lRB*RR7l%G!=)e|}&YLEAdqE_U}d^P9ySvQ(}N@M?5qi*RWqxhJqqCe%* zE&`rIA9^Qn*s@B3HdJIG{j!15!g z0iDW74xY6BwF`urM{b%Xu;Q6$&mfiP*hSz;#61AGoYNeQLLfY{4zniK&I=4a_f)}4 zW?w5(iD`#C=?KOlr~E}<2g=TO5l|se!eTC|eN$o}T&4Q(&5J-J?n@!>&db(6idi9) zH(s8;<24cK7HpD34NOEyJuF8Z;w5+mC|iSYwghY3cF2G2ubP?<2)&;;(DlP~xy9|e zPEWja8&LR!AT|)22t3>M(L*Z5;7D$*SBdHj+Tu4x%mdV1*pn{Xagm{uv+uHNON=2| zTTi_*WNFpf>*}9gcPw@27PxgR&$av;W$b!)wrWP8B}330?dC;M>?|1DtNq})PK|GC zrodu0CGp#!TNC=~*wc=dQf3fowQk!3WxDPm1 zvMx&dNuXZUFYSDi@9MfwI5T_ed9OL};osdFMWZ>{Xm{Y}9x6$OL|HqT!EgN-3cp}` z3{gohbmobYK=`nL>~)DbQT`5?dm1kIN9=4${?UM}8SlEkaz*wJ5W`4Y6TM94N2kMK$GxilFCq@0m&_h!^aW+4V5%19nhkHzW z{~1$=_fP%m1L4jzzb%X0VAb(>$EzJSIh!`R(NVp)QLI(1vq=y7cXZ^t+*5F5#zk}G zzaGLD2Ei1F#x4!8u4=Z*JT~loXyhcjc5*2S()_UnPcrO}RI>DfXzX%zKsz4ACb}gsTn)9a}>eho|E}v2n~IH`I&FjpmHCp}QwpKCoU+DhNYw=2m|p#^MY%#Jt2w~r%z+?uE4z)@r# zlm2-dH)V7}RG-9+<3)wUBS9&JM4#8KH-fVL3R$rr{Y-9;gS_WF@~qx*fKX9xKbSl4 z(Xh)JC>x(7Z?nz{iShTlIAv=zkZax0%E)nkp(~D+xV~69Pi{zzITKQDl9F@mM`T?3 zXh6q%&Q)lfcxVP!eW44*G|c^%a`5)gEI_&2;2mDTGd!y$))f-x8BzJama3^Vy&Lw& zhd-r^?Bo)h$jA$RZ0GARh6&`HOEt2ZUKh_um){AJhzn8!j|Z%)`P^Q1leBKVnnIP& zF37A9GiFxk2OV-fV}DK@y?5S2G7gDagg(|@>T8YI4YF0vf9;rq&YKk9HNtFf`i$S; zhkmZ~60Bh@JMXsAqb8}rD2<@da***eznhr_dEX{|3PuQ2?dgn1Z&2GSA`O~-W$cTg z3!7-yp9;{kW8~a}6s30*z{}}p0X@ziZZXO+o|3Wx<&JCjK*W>nF%&s;arShp4-I;1 zKwgtYW{w1qlZx+s;CWy|3J7Holb+mXew2=+*Kru_=u(PflX@0t6fl?(>sA4&W}(Jl zKiR;tSR99S%%1GM8KnA7`Z8Q#0ZFyGVXhjdy!f#@`S-WoDJf9p$<~@AS`%nD9$ z2R>a!%B&uOC~5RJ*u%q?a5-ZMrBz}yyMzxVW7C1l`Ut#xV6G~YBV%=UrIP2X>w*g> zomWnJz*F8r1Y*oJn>o!~;Vme2pzVg8m$7eDj87dm^iN`d4<8W@^;3o~wxwE>CjBcj zQi?%fJ0yaxDS4J1EI8R^d(Ek{hfbtr7F`NsI`_xu4^Gn7`30|W+Xn8t`(AQ$TlzDH zWq<;OVb5yqVyS%Nlz8iJQI+!2vYu#%2Qof~@^RiLc+S1)u`F(xP4OR2u+6M`q1Ni*EM*|xA|M&)}TugGT z%lv(Bebj{5ac9q)f_|!tq6s}fI*A+kHQDJ2uJw`@&^PZr*<{s3KW9-You(|!%%A?- zdf+Q|(y*At+?b)xro=qzh+$M0r%kXpjQ)>Ys`NZ^6;wwwhmY3p}h z=b?eMjqV_7@BdWbWoHHijWHK#AQ|ut8=zU9`j#_GNR_w|R^QKm4~z&JrkBnqV5S zG!s$PE9gDwOcG%ec0(5UUjJ;D7Sz`{Z`i#r8;jDZ&lz*g=}*wd6A>GJ@E+838F}h@ z58<9J-XS+fbXw7rF6Z_ejjd5wYJ7zmhM#L>(Pd(`cmm~>!azqlalVne^O<2IUroWK zYzWd`{jiqq75EzCR;TrVdSa!sE+*PAC{xtXk4jg|4fp`%MI@&l1o&V1P>W3}cTFb8 zMHyCn*&d9)y58sa@2*^4o#5bh0=~eR1k|2bO^KNM6(dd|jOd>LUKq}VcpAqbv{iMsw4~OQOYII8c zsX56J_a~J3(I^cHOIE$QIG}+k4U}dxPO*9;EW+Xlx*R$U&^793Rfcn1YqX74l4AVYg~1s=-w?1ox0)= z3eAp_J(8}jr)WZ$rJv1I;dIRYfy}V-noX$)4qfHpvA*{9RLulP4VA3_Ypk( z@*5u2*3#~IyQ2;1aE!dgYoVp7#>IL2+@Sw>K{uh|u?mN5{GrkqW(T%r>A|k0HgZ*K z4YqqRP>oT!FQA2$mvSGyo1}U*#q)?Riu#Gd%Rn|6s$l2kj|TkQ^V~F{;M*Z>STi6v z&3-d=Jva44p4iYcILU-<#wQ*&1umKqBG<#tmFn+5m7lp(;RWRJ!aa+GdxVccmv>jm zT9WYNZmK3$liRo4i;k&)7=wkt)enLznPVW)Q2mA-M`S?Q%T*n;$>Q|d882QcqN<;v z$xa&Io~TToN25?Edf-WfZ5xsxsu&!sV^Y3g*>`%lD_h&4b+ukEE@&9!qWx={Eh)1e@->MIt;+fE!>CC52hRq?+0%!8A$83KzA z+8U`}ua<_Y)#S1a&neko0seOTvrR^cp84ht9CL9}_Bq(tWF2ml<|*~gHusiW)GH;g z9@Bl!Fqqw3pH}1wS&5lP#T@S~HJ!-Y2O(PiXCYfZyjj$YNTvp)O-l2}c%MNvG}Zj= zT0BIR{Bz@^&++gDRD+)^|9$yi%G%(;Sk+%kg`sWN;QamYRrs8*Ceb`$r2_GHP3Ze-++WVGR+wl588_rM~Gw+J-pTz_RrIJpnW>X%(0eG?gc zy-G>D*X}ZTuWCVwGQ`36j>%<^T6K03zIx%#hlIyvWs*w69|exY&ohlT)Ur#iL!_zM zdtfyl6%87SFPbXs&L6`LNjD4XyI%}>44vZr1cJ7|#DoY`?t^1P+*-hfZwzT40>6;oT{F;B)1k{!Z36B@G?1!XT+!O)rsK7txU}j1$R_Qh=x(oBbulP z2q-e1VEnH&(Q{8lu4vqux*uGwm>SJCtErMD@`_U=x=FC-8)||`l(S9@Zz26*WK^j1 z{p_p)^a=7!ni{;j3)S>3Hfe>on6$Yx{d>;~K$LPW*!5Sw8^sOYP27^9^HA#wlfMnK z%^mRk2JOE@u|NY(B__?E>Z4 z9pAi|^*dk)_ z(z5Rep*4)=cq8pO`)u1+1Hv&vZ_V7haVtU4j=R`PQ&3CZRxxt_V6AbyFx~;=!V72i zT3@!+xlyJTKY2#`0%2u2FN<=&qI~u|f)~Q21#L087GQ`Fxct+*yZ`$k@F=$Tf8p}} z4=o>sGK<$w+A(W#%|A5NlDsGG+#rT|W`?L5iwrOBHLm2HH(HY3LL7LH{rh=A zQFdluY`&3hk|+O>y|Mj=tAYE9>)5FfBugYfb1D?Nq<8s|BlP9SQ}XJNna6h(kXZB6 z$P1CDWTK``^vVx$sbj~FWiUA>BqlwR&B_LZ9lUzCc5p6FH}UyWd=uP2kW0m?d9zi7n@vs zk@h4?H42(KPCXbLvZOTChGs^X_H%nLQi_z!>gEhz|S?8#ie|if7ui7F9)E`ORE|iA8-Fv zN5}lV34?8WZt_UWe`8Y#u4?G|Qx(tED>)(}>&pcSGHy2rUheciAOA2z+#<{ZfJ9qf zzTtO-&wqgFSpJ}b_LsXan#0(xd!*SH{9~W*hk81|z9o&vbJ(b}In_9iYjIByV$J04 zlqh~twtL~#;?7iT9Kw2B>>a`;qa;je0Ou?zO)V>f9teD7aN&Ej1zjHk)= zch#zQh-h#~)(p{<5lxGC2-@aYhaOwk&OTA}U`5!48yL(N;$YltN;k^uBOr zh~01Q?av zs44Wx{118oZ+M-`bj77|#wH)M=rI4|>Y@Gv+?Wn_Pch@oh?WkU6~*P5#3bgL!8FP0 z$eIRqHa@uAQu`oRV-%Zag3gAwfO>^LokUCbO?B{`iBI(fevaccm8V=d=(MDfOFa%{ zYoP0h?rNGR^nGk|8vH}qPG$n3O7DvE+fiQq=P?I~ZOAfI{#8I9DG;p! zq09CACr>hTN6|$i*p7)5@O>{b(*JyT*f9>~{ViTP&)T!t9`WwQ$CK{8qL@&%#U!^@ zTFk)Se_r7oHu0eIiz@WK<@UX@7VGe%{KuZJ8R%lCm}-24LkkKqS_w>I_Mj!N(b%0=dg z@hN`D%}G0G^_#@b#F#D(^p$kxh4*-*o9cJEVUlqNduLNYcLsN|)n!AKLCpl2U$5_6 zn2Fts*P^hJnz!Sp=lu`DzUwa`dr*mM!p9A^-1MLZ_vh+)&0-%(v&%H^@5u+1Z1)Q> zPd_l1-B`yMMbq!l`i_lxRrdY-xR&EWCaNWc!cw(9W9J=A-Dd+{o`eMhfRt4)I5!BA zHE~ax`kSYsmKuK1oC5G&t|+d?7=cc%vmR*|-wokf-Y5GpEWsUw#)Zqe8_~QEe2&Zn zQD%R}#!#&r*Jf_2F=QuVi$AK}u1G!i3s+K5Z`njU_Fy_R?fv(6Ehc5k5Z2rELE)D6 z6*5|W=WK^Av(FmX>RuxkqWvkBJpN7DYW=$oj0?2u>4rwt!}e;g2+vK<#DfFLjuyN8 zp19t{Rt&iFzIif6w-IY;t}gC`R-=>ZAMk9CiIq-xC^m9XPc9C&(Tzp$oBX|eWQ^^@ zBSp{N&G}ozdR)Eg6}__t`+CaP9&6#E(TL3i4bbduN0gw)aO%s<-fu#ilQ(`Xp9GNg zOI!5W<=vIecg?;f5ih9ZgDb@(G4~)GFL$RI9tp8Zl6~#TYxnC`eO8UigCHj1NeYZ z)T{>Ro&bLKH9GME@bvz`|B=!uZ?Q$i!%4|fL$?3)gi*lJ3--JKg$iAdU!g)eFzj%% zFN<-p-CbVbsVLgqtQd^<*fCR~d$(y9XQCG@L-PG-jKv`_Z`aL_y;B5NlkBH-G7lEh z&(n}OUWDGLUKjHuZp|h+pojAhZy6gE@NZ{p_1cG=opkKs#=xP@nj{w)<7&bkIT8-} z9$&|s|4$3RH$nm^$TCQiyxbH!Y`YqFZ-RIG)T$kiz*F@!+0?;%6v3M$zpph1zis=2 z{i_E&aM~O1R_!oMLx{xBN+x?K{JfgE<{c@!cNWAxiz@&1meDT3yF-Z(h%ZJ|T7+3n zysuTFZNY$rBvySi5;1ojv|HYIt??Ny9`>Y)6Pp+Izi0;`V8Um8M%B? zAq(xde&Ulr9qxH>$<3n_e{%F$t_ZdP?lu3g^;TergKc0sM=T4tl@KGYWkp4?f5crr zE(#~koomcd{uL5`fjm)ty^R&YT#~Hzyok)*nKtdC^`-}Yrux;GFBv&8clg;Xzp6!d zNfo%4#~js|7Z5MyXgT4}HKI;XIyZ&;vd8Nm$3`*tPd!U~Sm(I+?OVe_+gth`jcn4` z9LTlIALOaOdks#cJ1xmb?2Ea${Fsy2m;EIW441ZYYZz7`;!6ZATgkLBSnZG-_raW% zYdK?zgJ!Kylsd51EyI$rd}S)Vy0Ab{AESN0G6Y+O)bTaO<4a8agNXYhE-~_DQJy(w z-Hbw_Dm!n;m88xW&JLRNTl(xu{f;lJ=eZ5u&1W5ztK6ju=O z`D(8X1?q65w-T}OzAxwtkS?XfW{r?lzfBY!Co2ic5xb!&M^$A(iDP;Tvj|an!ZgV# zr#&ga8e7JWB`k1)bHlrF(*{0k)sNJ_ndtfhB!;f1Z^C0Z6oE|VnUgj zJs(DcMJqV4huD|Vh)U7YKj-QL6?)6$rXZo*ebR7@l z>!;3Sos0Ys?l=NAZ5_S;_mc(4HLLOlg0^Z5`TCw0IR(-*O#h(=hk_wo{u2nN!N1C_ z{1^FiMcE>3hbdOvVsYAEnU=Y;^e?dZgH6s;tgP&zd6mnK(w~Q8MoUjD&!rVU?o+$= ztbmz6X9A0T8JkUkqdtm0|54jN4Gc?zqu7dLLpJfp7H9OH?$JT_`qWf4qF0+}!wDH* zr`ue4w*l2a9v1AnG~YE^PTCq4mp_4Z&*=wW!##1!o?WfQyoU~so zl^N5&f1zMpj!2XxZE9uf3nmAF6`Lnt@LLCg0g-6l_Z$j{+Z?3yW14?8cYYs=H5s^2 z|L`>6-N~{1bh~cLd>=IbBK4NLaunzM&VQYd$s_K@0;hEihvh+ytuwdiguBzx8Ix{g z2Wm5whDQ{#UNi7u*RiO!Vi$4%@Ci^ue;+AaCTSjd>7XZGB>I|odwIACJ@Wi~DOocq zM0dxT8C|fP2$S&2%*x>k9(uNCo=kLq%;L_^IoBC9*3n`bYb8GB8_0Q;Y2u0NtFxte;?UNc zaIF&)@5GsYMAHRaPbe2VZ|V&q%XGTX%1Vkj$I;qy1t=^@E%LDU>zu?p-uQc6P}*zFveZJSPTFT6+6EW`n108 zR%^bUU@R{t(%mC^&-{tiEx_c>O~jcVUD!!US#>`(5czavw3IcpSH+eTuUL8NdJ>-tNDPWM|v4|u0RDX&YcvvBxz;(?~LLU0}Y>14OTMY^bkk1d5P$jK%> zM1gS?iH7d%8*X0p+HGa2Y%G(fvKwUcE5izzT^@%o^PERtB)=S@2MoUIfg&8#0L%qfR&$MSiP zgTWW9Itw>|^vgR66Zeb|rJxV~k4lEj-BlcT5KFDAKux1MPOMTh$`s!uvvdUNZn2@7 zOt|Som#=zV(Qo^>hDmwU1jlf~j9k!}`A4oEpE3+An_R724^jd<0?h{9Cq+A`+7K=r(SZ zqwZ(=L$4%|lf*1-z?wh9{3qW@ml{{W7sO8OLrgR-Bjn^`7iE`qvEAxtJ$6>g^p~7}08(wb*J=O;>+D#8Qr7^XWvu zxR=i8n|6V9x$!Cb^NE;7661A(?Il}Mc9`c?<}nVC<#ThKzwhB+;s5@RhR7H_!yT}0 z`1B~(Er)^{_IuXYPS>U9pbc^%7Sx&h@cc(~udghnccn)oXEJAf)cC^KrU>anyQM)- zS492`3FG4STOX|R6pxJwi=Z1F7IvW=X?JP+unn&A_o#N<&?Bmtggi7yrVo|o&X1p9 zXK}$kg*6?P>sv#ixB-AAg1_ByEI0Yjr@NnS2LjH9e<+{C>V zclO)P^&tVs0<^T>c&^Vw%enC5ljY}*;=aFcg%(sNY@?Es8AA(%;YbDs3P$(n7;wjh z#QmEQm|-7Mxb{8r4D-(xahqk}@M(zZgFRU?we~KmhBf^BMctUH--_RX*u{ZWK&$(t z23*lxDptOHN%yEXf|61;RH5F-J|hhkMy{c1x~dyegbaU&~XA z2DJRnZVFWT=758^qe$}_yjZg~q++JZ!O5Rvt|e1%Bd!2HtTWFHhm_nVQJ|MVz_80wv)YuRLOTWD?&?9 zx?yTB5{fqqPZBWup)G6prG!F@Nx_0;4_1b}x+9RhBOOdOH=79f{*9W-Q$ch~la^j) z;hmD8cQpJJgzAfzWHhh0Ozzqdh;gcL(7nF!)MUl(M!dye#ts=8ff|=lk~Kg zQ>^QPPRl^;%t?>s-)kR0_Bj8Jh+WpA0OuIRIcexlF+2R4@;$9?OMZPOy?YCMoI%V# z)1@Cd2%WlJ)|0aUViFfz+p;_t#uCzsqE?lf&Z3*-7V+Oo#@~c+-S1;Je+QE7&1u#k z!}G&hkrd=;e!S;xTdkiO@cLe&T$Ow_K)9LexcfLyLZ*`-dsrbbR3*zrADWQ}+Booi z8KSK>zMlug?f)$ebRp7S8OcvpaDrL1qf=kJXjz}zn(#mey72YMQEz*`dzTr;+hd*xjBSDr#GlBUx*7V0smA1#trTu20XyUEOdz!4_zZZ}vYYrRR z&+%G#0#&H7hl({Xy|`{M1)d$WltVg^gVw}CPm3N2?VD;Uvim-ky8130#9ln@Xnc&j zHbqcIT+P}ghAB}t0W*q9R!{i~ruTd+NB!tkqA$C3Zb>w4OW&&ugCG@4%@6n|aRNs; zoR~vs&Wfl6n9sFI-%J%B2^PbpwYG}F(H@4vFW{5K6j*HXJ(sx zey~zj$brfMKmTjFiD~6$gN~!8XvWF)?ImkucEItCBTzH3yNx|i>SdRyTa7d_rHv|C znKwl(MyF~%8}62rD7 z=!x{H%D;n_`q1_{YG2+<;IjKzLwNaK87}8!Yq{efO0sT8$P@U0sfHz=yjg%+yDVVy z;+uCP2YE`Cn9rajm10}{m zMfCZ{OvArV$GBtAE&rrZrwjjONfs8?$pRcW<3`8Z7Mjstq#rt?`kt?UOl`5LyJH=q zLhw3JJ5=b#6+B-Bv+-)LU6(*bK0Z4jU-o)5UIY8I-;h7%@jzOh4J23no}C~5QRHbJ zP^OEI%H5qDT^UuKd)Zb=G2v3mUyn=cf~ z#>SL-A2wIPlKpKBi?Iy2H=I6JC*G@iy*4g8`cX1k(9rexgEP6Dh1D4uFk&@QU8CA_ zGiv{6&sNAMGd99!S$bfPAG!c0{lG7%po$1=p@f<2ghPtnU;Z5mVVTY!r6VoJXY??M z`As-%-}7ksT;ScC@lhGG&VBR5!P7a(MC8X-4}&_Zs7ZK-lU$fd@pF{31+T>?QW;=)Iw47Ln%B=j`SZmN`_eE+5AGb`SQB@ z92q-kk7+8^D{5sf6BUa<%QbC=yg6%0tG}*LLOP(MB|QN3lN=a}>4yW#uSq(dYvAX9 z`b*Wp0BPX+_YXk{DOU0>uUYXE5((S8d-hf?`chU7(QF3=0z%_`0=#DRSLJ?&v!zUg zi7_${;nx2|ZWtGwzCdKnoBshfHN5?f7+Z2Z0}%6EHTvRPb_AFlM>O>hk@L!rvQbQS zA)6d6EPj2Sh^;&Y5Y(Fkteff@xN3}|mk@Mt(92BLkd(MT_19|74SsePhv*=f9p?dbr1ZsQqAcNk3f|^h8&*+;Xhn79Uq)(K2Ur)66Amz5^Ga-$Byl~D} zB!V-H!^pJ5`%hUFbKAq(du`xH;%N(d4mU5SCaxeLE&=u1y+@W?~Y5nCMugmqRg7czy6(XV2~_Kn@eprIN?oRR0rF1K;k0g|)M z|CEz_`dt5Dx(^hCILLwY+0H<&L+vOJnY2@yD<}9KxQNZEF#2@>^|vPjF!a^8qF%x_ zt;<6fzH#@!_w~n)wmi1-4GGJ3&k3TnD}`^GXDztmGf_dtp-GrqI&k8F0uRGmlp@KN z=$yRchc$swTDH#J!o5}epGIaLHq!;9Rr(PRgKKNz-NC>|55iC~gc8vQS!`>eumawl z7i?LpP60I7=Zc9GyOzKHJ&xBBFOW}nx@)xt{bv$)|In@?U?>E0_FgIt=`^aEIY|h;Ns?r1S^OYxNo@rvd~tb@u`7 zZ>TfTNmW~}aPu}X4h@sIpR|4UB5GzRzTc5H@viLL6+qpxgqQQ(0hWIuTkCfnH;YMG zINFDQiRW=amiBL{AoT!Krc+gfTQbap8|%TkZL_f1cYH7Hg$}3I9hDUeav;JL3m5zG zWeHk0d@1<}6!A7FCM~41-)c9EqV5U)m_Jo^9Q{fOll&7V+t5X!5=z^`WspGDgoRvc?j$G9wv?hC(JUZ$5WHL7CA zlf7)1@T#~tmaV+Jd61B#v9%k`wkmyh6B=hyk;15Uy~^^$*A@9<@weYI%jZqYY_z>_ zk;tiiB zUy4Q98c1#>Q-r8Nq7z*&m>Igj(Z6ei*4Ebk{AlW)%W|=yXl0RhU=z3q3@cbA(v!v0(MWUB!`W_O-J~ z+NEPxuK5+3#UvEnG7)+I(T3Hq>u_Q2S#GC?CI_?44Kam=8Ww9OSyLARxGqi&U(LnbR4qjpgO_>1M|^@*4m`inCE>LN{>Qt(Iz9iL0!Ww525pyePD8LSoli) z3ga*Ij7=lyo2Q7}uA(0tJ$Rv3C{e7oIEJHQh^hUkxXh+CLq-)rpC9uOcA)=_4*I#g zen_qhc30x-d9%aa0q2)DPc!Gl!;euL1HwM~%Q6J=Q`|4Nx4Sh=Z>`&E-7^>rf4kWo z-^~*}ygi^m>eP_WZYOJV{jt1A6v1S7hw(RzW~Ilypv22)S*vuZ`F%QRn^YYV51TYG z%aX#12Yg(BTTOg7gRu|TD{=Ly5e9|W*{N++s_NwC?{zjm{+fKtI}}_0TdgqtFOFruvRZD0p5Ljsz%yRU|8~pk;zGdEBM$ z7C-D|$l_ErAy}`8PeR!Bc6j0nXG`0D*869CN6vaNLOAIt!q6)*+&QtTgw%4H#hNA9 zwb|{i4gw2B8Y~kVf=*+MlWB=@(jgadLm9LvIPz|PAaT=G@v=cJlD9B)RT3S13Qo;# zIwHIM?uSDgYQ1k?+v(Xr@zd(ypZAlJn@mW|KGs zwIX^l2qo04Hf$LBK5tr@pND3aKXx2;gl*32pB~_LY!()|*3JiQ6fsNcM;oyv)~8|P z0ln>>YZ~LOYtY9EWB0Z(T#6ZAqtj>@bzStoZG{Lt@hgRw;-YK9 z`KKebSvwDY(WSDz0@*-@@PLgF{Xfqe0^@=zU=_O}*x)731LJ3AcChih zqLz82bwI6+J1{zo(nhA|MkU+r;7Vk}Noc^286zGf-Q#jH_D9dOO3I{gUhfpfR(TJt zodp_@&hL!y`5ckk?MflL&*QscwBk`YpZ4hm3V*7P4;;e00;ldDPFQA7iwL!DQPzga4`V5aed94i0zOhx9b2^IbhM(SbIzpAs`a zc?R5{IPMl=vi7=(bN-O5?Z_;aLX1PyQausSU3^E2`il1XA#vYUr)H83oX!|^JUdQ` z(|q*D68`Cz-Y#>uEnVo-RPopS3H;CV{{P=x=M5PMwY@=c4Y0W90?%KBE=!0i8Ov@! zgPeiCoO;7Zm*u{Gdnx3x)BD>fL-~yf0ZmC5U2H^tZ5(g&oQkh|Nl_Fpe%Xczky-vy zgl{EOQHv{XFX&5Q=@&zY$49i{k^}_SGs7(Es{xrWP@m!rit0a7*|Qvzo10d`Q?m?ZTY@5 z5g{mVSFeQAnLO7{-htEKP;D))Pl>RHo(sN!GR1h)3O;Bx4MJ;5zRNGf)%}}nIG+)q zkqp}4o9Utd2%|G_ARFLuS*>FR&Un%wY3Hf?;?8-O6}Xh4HfmzVtK+BtI;9>d_hI*p z=WhY)G&zB+l zrUKL6_-4t!4kLGv1!&7jER_upvU3Bnxi#Ocx3|KxQ@urV=M5{RK&oI{p4uMbe#oBX zgG&*xDI=YIo#Sh@)Z4UL_psnvOp-S8VKV9`A0@EE=+l<`sK5t$$0dUlm}*|z)s|;S zEgaUm`e9hp4EbV>fe-cg*IRZ&)_{FuvR#N?iEPu&%9#s>{`?mXq_}vb8U$0w_sY)? zMk=sqZTjmVA-Uq>q0~K;r;mrn81QoHH-CReo=u_}WEG2c)WKy8gw|?cLEGnxLB4c*jDEg?`vn zxSHJ{7kGPQ^nRvqtf+A6qnRDr(pqAp!A<*ghf90gV-FvmGknr@!EIsY;gP8_oeyskChiD7X@@QKwM>1&XzxoPt$Lr&G#4fC4aa zOqSCyA(geTooNcPqmPOguT*ky*OK9o2 zyL-O7r}r-&dM*WU22iG~rUFX2Xr4FuRf!U4 zy{C0Wn|RNEVmNlQjT4{R%57Z$E-$p-14UWtSLc+Wn_H|bt6#RTmC;ohI4w1CWCd-B z5=nb|L+gwIeDt|Fi7+GFOgeBAyu_x}+1C)ci!y0`riIS@GI$v$ei>`^LasgN z1;@;^Yba0xu1%i^HRa{XmsZR`1XC~7a;Xz^=( z9lA8|8!!)+V&PY9N>6DNA)%Vx^o*$QB+7Qzg!@{)sE;^Gd0D~!31LU-M3?F>qubto zya^4@xs|0Aca7JT$VASfPo8c8^i*LB3?-fCqG6aXl0FLqq%;fh6pk0(!J$ z=rQfkL}qsfxXY}ddG!O2R1Al&SSV(*z^x8dqCD)+q@?Eb~4H)FygMHW+<<4;_Bg2c?mu6>|__{IU_Z2g4^BB@kd+p(Wm#Sn!_oUc|g<7 z9|*kf_Uj4{GA9z8%5bVzDR1phWMx{o0_gIM102dU!Q|Kb*3SI?#Q*9rQT*b!HFE8_tB)QhNGs@Fv)L)Vr_JHe z;@YHI`4yP^PG-P*;DzwXYk36!>KRtl`sRKNs!<8HID<~OboPW~ktw>(9pUYi2)piq zyO5*IJAjE>P|j{w{GB&|7&>_M_%Z32+^?R+E5K|8>eTtu?;710k{*ppYpUf#g+PTN zqF;iE5?G!0Te=s(;2NjP`(Qk~=An7vBL31~`SO>syR|2dT8XJ!V%MqF7^mf?`XS}W zA>r1;XZ*McNuA@%RkRZypLI|hb+6voI}KT}?2I&= zRsW+ERo0bXe=!yxVkbWs`I?Ju$6;PE;e5*2p>dW6`2Lo0))+Ig<5b*<|H>gGpD?t` z^eBB>QT0qzOD(#tDqv_N7W_pA8&l*YIo-&&I>HLm;{zs<8T@<9IjGgtmN)3Q#>7Re z&&1+|g;3w6lYA~-VfHthQ*n&wcNRXo6b$E|9G{G~yc5B^IaTM`@ADP-2{VfQ6}XgC z$G$R#z;m0{`>aZ^{r4)wr;f}Ak^rCC0&fDYAPIiiP!mOX3XLmtWW>dOwo%&m`82iF z?x!Z(KebvK_q` zBwi+pE@pMs9Ss_O-K)3gIFQ zOGTa|G}7D}FkBPtOwkb9jJ|U1zc&C1)^0-7f9I^!2SK=^REq`MLFP7X>GF;Zj#;gYRMBY9a zXdoyjEEj?$n+(x6^@SO*ko}6gPhF={y&VpS2$d6*f+XFND(D!h!zIXB9RCZy@VkmdMD9)?`=eM(MFJhLDcBI zlc*78qIVN@h%)+M%*F{s7jkOytvAgBHPqRAx-!iNA$b^No_ZBoBkrnm#My~2>@ZfLkKbBGs zad!GEVUgT_VxpfL$o}T_u^c5}9>S}2zSNZKDfytfdI2;&izOb1OemQI$730-j+Nsv(m9Jrqzt1D_&@@h;t^X-!xZrTGkytGvd+W)C zp0<06zWd+Ft4-BvRB`CC+OH&t{I9T>$LZBJFP%F!U$lN)=-*N15@l8CjzX^C7KhJG z*WT{+v(NON%I+KObxy%@D>@-R@B2?B0AVewrc7$Y=1Q;7N4uVc4#OwSMzMB>x^Vn- z<=?aaeH%9EwIlpCM+(}TS|CG^sx`FG`6h)?hSaEszH|LegsWOt9utyo!jsz%ZrvTh zCST<`mwc4MCzQl{&|?sxYDef$3!#sSOY$)wAcq{PSH=xV+dmQNY^|`U?_`Kam$Yu# zQlW1e7zR(-XQh@gyS;R)lnKmWwUQZHPFt~iU--tz>Al+}@I95oox!4U6MKhhM*^oJ zmhj{}`xil)#Q&Hfn-zA^CzHM%_p}0iV~Z?YF5jz`rn0c~rnht_V5)U2 zUBF?LDh)Vcf3mEZaufc@)~EGcyvjG0AK z`}rlUofO@Z#k<11fmbxU`brtQ9$CHMC#u7fjt!DOSH$i!0@wGOXaSlF++6^OEX~-5 z$$v}{5X>u>is3=+6Oj%cvkSlJrW1tgnp86zuFFxsQ~h30sC8~}q5iCj@l>_1D9M1< z>y|Z17)+*7mo!XJQ8#??B>bhfGWU_-YI6Y)mi+5A1@MungwI>{+`pC_KwbVyt+vyF zzKTWkr2f9vFiz~Fga}_HJ2wP!YP8$C=LSEgdp0fxq^^X%A<8>p-e$NyR~)4B=J-hb zUEwY&%X9B{cQ+~>8>(laND;YaosK!@GR~PK7W{U+bB_X`uV=MuAIUAq%vPPqR7}mu zW6XB;Yxr|mr??8#cSQ1aQD1gp+NGmb*Jnl@rBilKN~IEO)3{6{zB%4r9R2fR(9xr- zqfm{b=LKu$kRts#cW z_IXB6&XxMs%~j-=VD!ved^S>SyXxULr{g+$Tn|#XP~K68Fnv5He`XiyU=%i zUz&XeD+&D2NCr#E$kt;!jcs3#rK$UeC+|Kt;F-ZXRb1pvyJ2n0iM4l=CFp*VkIy5sm2~gR-(n?z8kFypt013SOT|8tXro zhzanV@uvh_J!}aKkscwQLYhO}l{PS1^Oy0nJqmEPjxBfEql*JZ;Fpk|FoN6GL#kr< zKKDVcVHRrU-bhgA+wOpMM&mcaH<7J5s$*kgABiW{c^^O0E5fEAH*! zR~Zhj4fi9Sl&1Pu^^hScTq!xwAAYVZu6*nD3a;YQ(H%E=E>EA6wP(#5Jk;uu)b6dE ze(fs}JWDO@edh*Q{f9|k=f$l))L}UXR06qDyc-P?CWoT&clF@2i^#!?P0}Fm??WAd zwi>OcV_aT!GYx-IWAa7s&c8{jnJU@k-;27_yO=xL(0kHKUE68o5w@MFA;`RkqsBb( zZYNrkPt58z?BypG8F0r5q+X zl!&&=ZHHJd31TuNFXp}-xHXx+r{{9C4g2gXYW@lDoHU>U40Q3 zX;^(B_2h{HX;=XUPY1lFkvkl1z)prVHdA|DwqhA+4G>^99VH+o)g}!5nJpQa&Ld|* z$9p56`AqFMe~jnrZ|~*s$UYd_)#OKVT*MviGf-E_9COj~!>@Aj8{BqVThC;gD0>_A zah;5U$I&|bC#1@qc(y1u74Eqxc$xtiUw8U^fmh3FE#*{gELk_v8M;{JkRK%E z&pF4_G9vr z0Dmupq29B&1zb;zz30Irq8V$qL1Fgu$hnGWt4KaO^Jy>?G`phE$ zb)HRi1K$^GqO_|;zZ|)|Rl`m*q|X@vPKer062o_#73J5bj&hnusUSbY@-#(h{qL$1 zN!ZcJcb=d{wNpNu^D>MLX~X^H!NXaOmR(!IbMl9#2AU^Tz>mz3&n$p5VkE$1$jeg( ziEPWDk~<>>dIBE7YFH*OC2Qjt_ua0mAW|sFvmYl% zNwW69Uk1K;Qf#-%CDXRoA>D$({Q)!~td?RvNTqddDdaubPjedWBz!`TE40o5zoqDe zu_~^huTVb>pE&;tf$-c?uVP+$Y@0|9s*lgxRywv$K$norTP4-0jPxJuP+F~NkB0ur z2UalIy{CJm(WZ{9dzOOY(W|CI>)(U^+^--V#Cn;1#+IlBkE?H3h#Jb!F(&9{tLG&j zH_od`4RFZZ0PaX7E(^CdaXdA-g>KH1=~+IyFr66_1l^2rmFicS=L$H zgwdn>bw287a69SCs~{c}dfzeamX3KBDvgWO$|Z{Wx&RGIWN9_9LuEm(l0r>Ii=ne} zuwDb2Ap?t=Zws0Dr?P%l>`&PZTb&vqX3SlEx-iQ9tgEB>2;8#jDfe9n@V7p^sTM67;+&_Kak z4s*Ou3n^D^zz_q?vywHK#5d{r9!o3tmND(Qp6+)4^2en@%1}?Twi}bg53tK6cP(CD zhSdLk!L#(?o6(o+$bj6mGakwNobPepM#ViBgD)sny{`E5Px^SYGr$5BMwj37t@ZR= z`J}}4e`5mv4_lDSlwzMlp()kTxHz+RGAfz68@KL%y-AkhGLVBh7NZhz}b6I`}^ zJs{`2i3DL8_IpA!K1y8BXK|ExX5gW~yL6J0fqz-CkpVAJO|PvKBE2&R4|KuiDQ$5H zWAtd_NKtAwt1<2xh1K3#>_p@uz$F9Qa9hkp4 z-EzQ{`uurXJ<_lPgM*Q!F)OKD_NVVuHu^uj9?+5%3L!l$wnttNq?zr{oM|l}0h_1y z!5JUyS)IphW>E*$h50NkM8POVFauALMW)ffDk?SRWS2ZUIKw(mn9qRaqVkt@VEC#E zSYZsczR1jkyyZTP0w>z9mBs5`Zu7*-Ja#p9K3jMkj_=LJ*po1@NR9nLZ5G*+m^97p zdvL(us%y)(!Io0uM^%Rbx$rHvFPt~j+qh>YHR?Y#$Uhka{+3KAQRs2?D^fL`*?-piDfFnAYm%iv%=EZ)66|04P=NHT^ zNb+KZim~-E_M8+!jXyP*qC0w?zE%I;mdt2WW4_=kDcmrX1#ytq467+DmXsO@Ikvcj zVaA7$Dh+D!i2}VG-it46C^gfsosW+d!r*2%xNvSN`(n0l0CNNN|h!vJpsV)4e-!JC;-DV+AtZG!!%}2Z;Z4XoNh1rk^ zgr_U_sEBXgQ7UEraF35V9S=712fQMl@$8`DG zb8F{A2voy0XFX2{%^w~!ak1tK8n1Y*DBMd1uZ>+Tv3`aw(X=aJJW?-0=67DXz=`&L za^{JBF(10(e+Ye>awt`pz2{X~pxnbQh~W{#NYb8+`N1lis1eOHK-G7ICp=Kpn)ZfR zxSaQq%MKIYOH14{--ul&qw`1I`?0y*(9_RKgZufGBjV$1cSbb4AkZF5DU0etxb|v5 z4upR8Ub$c3m!vd9fDN!AchHYbFi;vVW&|_$^g(o zaHIormN9j2MyT4q9yGaWU$Tve?`cx6)piWA4Uzk-e6IZH9ekV=+>0>(JW%JKsLA>7 zFylQG^Z~!x)xS(&{bn2ra(%Zrm^23m^SxN93vbeDsg*vfETcuzU7J-QsH<{nt<+aO zz0)$STl!QMjV#?R&g&@w9pl#vxm66$)S+04G}OaWCIUxUOO88-^K$T6?zx{4@OLd+ zmlEh3`RgC-nRFm!P+7|iG5B!j(G^fMtd8MFRyKPSt{}g>@H(H@V83GM#`AfzA;=}w zp2VX(1mu|j7LSB`C`0P9sIH)>k<+9A7`}6G7`T{oZA=* z%(jAAd=hq4 zVZUzgoC6cDb7?eABVRG^yIFkbFl^x~pSygtvue#J#A59%&%an8OPVrsdcn;CM6}+i ze6Kb)Ntl~m;ky2%FTE8bGkkt#r7o$Np3fBoRmy^v`MrvL#+A-_I}3%+GCNRR`Lp7n z6KZxpk>befb$NY81kg ziI2pIeGXTmuY_KSK+wK|$5{JQynriVmor#^Hvb=|7n^kM2;u8H_5xaV<3zV)GC;p^ zXAIyZX^8d1Luq5E3jcJ;DqQ;^^@$7bAnR>Lr<{N(#`TdBXdo%OQ zg7(9k$ozl2Lary)Tw4zYl%}583e79N0}k7c+8qNrJyc4-hZGKK8e6BlEUdsWjAa^w zFYwt)VbreZ3w7GK{CwOQPo^veHr~W>^Mm$4?7@{Bqe7Ec);nwQtpT+}2bYI?Fe+B7 z9}aYuw-(F6EEVCMuZ+@G;}#q@z(*N!L|OI(#!%lD8f^d^>{ z+fD1TIrBC4(OiEC9uB$9_6(n}vWG5%)0tqmHwON#y3%U7MBC3?xk|s%eLkgV=WuTB zQLgso=Bds+$VjJ6Kjv5~do+qzHE@2`ANg_km0Hs%=~gItrX6?q^*DK?fb^!6h)h&Fbf;9PaZYgd4dfYGNVmZFWb?$3%;w-AFj zn`G&Bx&rUe$r|3^8+e*HX&N2$u`2l4V$%c1?{@fonq?lS?HeIkL9%;#v@VI4J^qWq zk{pf?#>`UQDrX1>$D){qLmm#q;>xY>@o#nVyR~Y-7T4J26>4}tTLf+msHTi4%yWhs#04)M?@x@UtD~ zg}Tc7R{-e<$XfD;2@3*Va}q%`X#rI%PgDFb!2%p!7M7!F4N$oo1kcbO4>kCEhzH-; zq*3q~>Z#y(3ANuYh_J@7-|s5L_s=^)oo^njV&c~8`yx!BtYhl5QQrljx1>|l!ZEo| z8fpO!czp08&w<7w671+=YtL}=qgkfN3RFMp{WX=VhQMEE5A3rAt}(@$jjIGIi+t{F zQY1;Hqfg%2{&j8P044KhHn0+Ao)AP2)}CK59K*kh2|ms z5XrxAPPAyUq|0>_5cs>fxLgt2?wD85Dw7qcaT`*u7@p5V%ouAW+LJ*_L^zCKxTffB zq>r~c&uxu3@ngs$2jhGjMpMGsE6elska!_gLl*ValVi14?jz0{{*u!2S^KKAqxI8X zFy7VsgQdMUt50CY!_^|7N017qo8R9+bUpmz!$ATB@3C7Bw(3zb;V<5S>^ha(zF%M1 zwsR64Z_2O#yKLltibZLqypV!_1En#x*=0hf?vH|9HJqM~Dfld?&ihS6VS#DsM?-;z z*ELlc>-QmZ|2SMsT)`Dv3F2~w9q{zesW0{+h2Svl@MINEl-s$Qyy%U;X0;5Hix?;W z@RK49$BS--iB!*$0iP(oou{m;v44%8T<rGY2*D+9b@mB-Sth?LLuQ2Zrf!ccG1-1@=XsA3cfP)z z3!!z9{LHto8?U0t!XkYUlAkX})X~ z%IP)2^%XG?E!ZG&I|U-MOUCoM@yKItsoZCmP~$%<9Cb5hQ>qj@rG(I=l}g#+EK!5Y zdJPW|;a$bD+7iXC@Y9Cp4lA|^FRd%nS*KGG7xL;iY(n}jvreTn&0$R`yFK%%Y@My0 zAz(V7D^i!xxor~g**#4I7I?x%M*?)^=??xHQ)mzYxgL?C`*2Gc)JsdH9KrrUfwv^* z=gf(XZw=s2B0mbNo&6-8VRxldx>X`Frl%g)8eN*cSxONv2He>hZuLiQpjiql{Xcq< z{eM~j*~8bcvDDc7vXq$PIq&z0A5U@1zdMJw1L}gu14~tggn|8oWR;zN{j%(b*8xs@ z-6z7eI+7Kt3S+fqLP)I?*2<)9IoeJs&6T-wI){?|6Ux$CH=tw;tkHSz^>iGip{f_P zyhVQg2G6|@3{R#F7=f7(djvUvmA;HPtkO_XyMMcf-OkTA-Mg-sQ72Gz46YB?Sqs{| z`$Yf1&KX7C^rDn;C}n;Y<1&3aCMwV~coX>w2@|_PfA1)ZauKIvPcLkCs00=sg}vTj zhwnWdh^sYNkNn`vWtS# zKAq&RO>0#|=1Jf1+d|5zUGOFz>s;IeD+}X?AGgaA>?S;8G(T06{Ah=2}g6$^3EP#J20O`8)BlvR#D+jm0D6+&t6?IJe6#? zYrxd-wZYeFuqV%QN?iJ#YKvlW{Qh?Dz2Or+C~sFVEe3MU(&Ywf8rht%9YR z7Gqx6l$N<|i zb_H-+8LS*2j5 zB4e5h&g#}2nLdD!9z6H-ZE!pniB-n7jRc&Cqnz)Ncy-lZ89nyvKFg@o!JT-Fb`Iy2 z5ylO4qi0v0FQ)0D)`-J3UGAdA&Hl=~`pKM#di0*x7-=Nvb4PK}?2yiXV~Q?bWx6W|UVkqZ$A5wd8PO?|qo_qxmI;XfS===R zTHD|`d-=JQ{)>g>t-PMpvES$J@BBqRXO~}@G0kBR+=}()YUcYfpc9KO)wGxZ{-P@< z{991!8M33xt3m(`{X^9Qzm_bQ_o5DIgny02(gHZ)C{NOHrt-C4mhm4GoYF6N)|AI_or)O%!1|GLz>r zzD#*0VsRjsyMi>=`0_hoh5Yu*4mWw;Z3i7`ENr{81f9V{v%)gW6^iOAt|EqX_!zi2;!-^NIV1ZI#?|WyUByk z3fN`X=>KIR1SF>fye0)KT$8?up(NTq9vd`jull2h)8Qp$)Xj@cJE4ck z*>YF2WSs3eQKI#PK>N(k z$>Y5_g5MoHSH62un;~SKaMfDFKpMvt#(tP`$q}BPGyVIyzmC$x3FPt#Q#G+t=JyB6 z=40&?s*!ETLBDYeD8cH;fXG6%lRgevv>y}lzjQatIE~mP%QQ(A1!xOvBDv7U1yU3SXcq3-p(1qVO6ka~* zANFXWET*%Z=c|;Xo&L~2eb%qLa#D>^y`Ci+UYrh2c5e&$?822I#;}2JaKG4xJ41M& zO2$DPSBl60(ZK*x6@^%q&|TZm2MfQmYd3G4__hBF9ElHE#0vvep&ZkT>Q|Yeh{Qc2 z*{{psjKciw=~PG|kEx7K#A_t!aeg%3^PH^@!V@(4WLx7ak_V~^4=cMJ8n|HO1}cC` zzV30CND3oxD)EISxL;1x`+o4-q?;JH()@M+RIX-2hHFlSHYxihNcI}Q>3Iq&lcIeN zutg2rrWuCZ^s}Xy)098-%s)dNHpyO~*#?5I59#6tEN8^2cAfrW2;=R$IDCa{0$oq; z`=q7PCKQap?Uw4ZX}%aUctl<}hwtg?xFN}M--!loTn;z==l?ZG`Saf+7bsWD>&R!N z%Mg-ZUpfh{WeMKsf%{M@xMRi2jpi?btEnD=H7UoH8B1pHnB!%%CMc&9#`)JgxTjlR zESs6`wy9b9+AsU#qQ9}Jwmlgu{oS8*HIlw8WzKEU=d}UlA&lFnYVbG+N*NyW3bVRi zthm5C!=R~GF!`K;At6&!T^tITyXeXHGKG_qQD9fuJqAJjiT*F^*9LtRjI|1le_O2uv2Ec$GX6h8Pgrm z4(HM+-xjqo`}4naj>}p7i%}Dw&8N5=0ezvv#=JcCqkHvXHZz)59;}o_SkVo62MnVo?_N%y7=4(%eLLU(hzWyhVBC}|B2dm_IyH9fD5GO-z(U+$67D)b z_hkKX$mk*f45S2LlfD=D!mfqZs@qowKGidpGT)C41?`4|Lo|$z4Ve3lg`^f1tS}F3 z)q={0Z@sTv3)P-_V$l+#3qw>(Ki@GTK)lDgs#x;a?>`W6z{ux^p^Sh23borzMkqhD zr^XCc!y-gd4I>;#y^3G66)FuWN;Xh3t}pg+VDbatjyfSoF`9+cHotd zY&F1-TwWDQfGW#z5_oe`0w?@yr6n|Q*Zl|Y+U1M^*)z;ONrOwdtoQdZkSj)?_<^A;iiJ>NM%?5G~TbTKqD_~!AL|xyF z>+}AGGLa0pp2VP(>fPbjVCaXqH0QBOyz_kU3gFgxL^1&K&G}L=92*==K?)ZJUYn1w zMb@Q;2vytXb}pOo$b!hQVsgwvFm%ST{BdaKVo7F3YZ8wZWG7MfK2lvLl>s*OL?R`< zN9U-iLL&DH-9xcalLI>q9-b3$;_*u>&mxdsIBvo5(z0d~(JFC4)}Pc~42+hWST`+P zX(_7Ug!T)D;Xprx$n^)PyG21mJFS$9tI@pnK-CH|^G)Yv?_d<+GF*bH!$+L2FW#bE zk8atBT28y?3szMMx4Jz{UVYqiG+Jxgyl`m`CkH4Kvz#$mbwgS8msY@!W`m5`4|bOb za6H$JsREbv?zt!ha7JHEJa^`vMu6k;H^8K(KR-Wvm)?N#CHsz2!U z-Cjc}$E4en@flwq_Ym>Cs_?Bc% z#>wR&*+P+|&wkyZq^-bo8vLrRscG4V_ck_}D*i#Wh?@zq6R@O}2LsYYI;xw=kP=ja zHSQzp?tt^v601gGo5X+!CZI&(v$jtbt+_PTq6@G%`85M`Dj$16zcfH^AdJtX`Glr$-1`8AvPzxs$$(aHA&Tne$a5%v zxQ$1CqA+RPVt6JuRN zH{fW%yg48F>=M-ZA0F~h{*6??C+o^ouY?=4R(#`J7PM{UB@PuAODcP5+vgPAk`sFF zum|_!a8&^aIH!)kLc_Ng-`<4e^NnxnW%XTbZu0)}DsOP>*%x5Qwnn!kNBrK`9`MIKbFv;wTrO{r6>FfE(;1yJv4>K z9}`*@$RssrVqGPF2DSw(O@cu@6@GT{@sHPplrMr%KA(oYiA5*<(&2dY%=Nw2dV2A@ zGL4`zs;%)|PgVi`^25;*`5x(2oTxN|j{x-1(c+Cv*iF$Cl*Z*^?=B$doy&Q;36;7y zb{^!F4^Vo7tCT3lO)9%wh6t30;XgMD-sq=v(TAZPLau;aC;;za`yl~JdLrDZ_+t%D{Xh`LS>>xYA{|83_9$cY@un5tzDWl<8lveTGV3|U7WN2$}3?8ay9q2PIv(s+#?i?^4l1DI zK+dJD{*0=i!Id4;d#;z)*M>^P@H+|sk z*jI&Pq7FOvv+pEO?UMlXy3>NlT|E~DVb#kki?0DhWHe?4En~T zx|G-`mAt&Ei}BWASYr}@3tgCV2=1>iAF#oPR<_qbMXL;m{IQz_MFCw8rQ-N*sh=KR z<*BGg!q=VYG;OI)y$u#h1rqQ^EX0AO&<*t9+ioFD1BkT=SKsj!G^y|oH` zE}%&m@4DO&4-oYpek`?|?R#Vm{J^+9YPiI_f;~Xah3qM-f5b)Lu4x`t7@}89`^J9- zI^uY3|3()mMV&=P83TWJB$wVwlaJ$W34y(?-qmF$M{q$|t0j`{ z^RvV&mY8QDV>$K6#mbMIG(NagPw%IvBF8zUyJ-B@JMJ-sXY+BbUpUC~3QTprkpnV> zcfY$gc(a}BZJGJ>jNYE~G_(_hfc>$Iy3D2!0XCj@s+DKaMv2_lyg}I8yW>le7t=vR z6@-?@jyaVh9|X{xQw2Q<-OnTMJ~u?QWd`&g{?lty51cCq9wo(5UjbON{PS8%$Da=T z+duRJ0QE$a?dB3k%6*7hd)s99d%kS&3L+q$6u~btn(*R-ZHH!X#LIf|Ze5BKX4qW* zS*-z+8W;Ron};Sb+Zm_R_dK5Nd3s{h(*mnxeD68cM*RDu$i)IeXLe#-a{0&rHcqi?PQwzlY_#yyHIcg%jkkU(m=hLw|K4#xS zehCR{U*iQ~$I8BwI_vvY3b)`_v-?gOglP&o?GMcDzMPqZ&I(W;re3)oymnL>*_%nV z@S1llXuTZrYIpSZ*L(uO&e$?qIe9|Mc%dIY#dQf{Lv_H9@03nrVASvz<=@?UckKrX z_+*X7Ydi~y1IbX|l)z(n#62kMh26aY(rzS0yhU_q|7{8&7%z=BYkZLTUFsHfydD8L z@-{GwRZ_;!mpKV3x^z17s@Icfs@!~U^o8TDemaVQyN`db)4EnVxB-@=I_=!;u9f?5 z@n~_2v8VB#*6pahQ^!kf_>KBf=q9+lz27t9&G7pW(1nN9%3B{GBdL$ znVMR1At@yJVMRTncUiflK3MCw1PNL>u(J*+?8PK~ZK}B2>Rv*&d5;cS^Cza-x`*r~ ztIa3>yAUqm$2;!KDvht+rDK?nY%?w0ecRSwu@Ozk))Vlx#~*+~qoD!XMzxyv%9iIPc4= z0AwWV+nM@YAHIRKUv(<`c}RL6hOZgD95ji~#>%eCB#B|KUDw?Um61u=W(40{N;!D9 zLQmGLmaD+S;xF6PcsIEB9>Z^sj_R_>hrt?TH(tV3z16t}mlMSeWqCE$FL%z+eby@c zA}O6*|*%bNk2Ub`wRO9HoVyaP5KGDd0bn zZ@SPr@EBYQB6gK#__Gj62&TWuKV@j5f>t-G&K))-fco<)p%o(!$W4asMdycB!lfXw zzh*5KiPM8FWyP3ly79i!vG-k<0O>4!RVQQ9k?(q3uo3 zL%%iRL-G^KN`w#%M{rg8KuN6Mpl_DgF`9f8CC=`Kes;#jlK!i~dr=pKHg3|294L=r^a`I@2D;qa@r?AY4cn$X9w8KX$bF0p;}V%(4)- z!>^{(@H>rJYhrn(HUjd!?&6BF%iRIgg-*Ek&^ioBu9@5m`ckX+dR+JD{2^Pw+hCu=WoD zWprymb+8liZZnPPK{eyZ!)&u{0chBl72z?`?&F>)&(I0TuNfPLOb|wqfc=KWBS;DR zg|x3))Is6L)C086hiOGHxAFJ|ZOm~Tedk@4qfbPytwAGr%JJ6d|L84bAF8oM`(c(` z&O*l8qpwe@Fdj%ldW&LD;(mo)g;h}a?rOorQz2YVCk+magIg#Vr~Gdy+Ev5o^8zs` z-k?A7P@NP2#@iGABg;>2RwgG@8L|~?8%rWGTJuq{A<8fj+HyyhT_=%1g^Nhq$k2-v zl;90$jQG-YJuj4Mtdu~Z@7@2}?-Xg%fV4O+I)ZWir1~cLK)y`zC0EM-)j^xv0m7T`(#Va(xL zko`d!ADwi26mOo^`*42+LMBx%#2eLUAwZO^+hLgOp44QC+UDUwIEf_NgIZPN9L*-{ z76sn1K^AZ^O&1k;Ahr4)%g6=HG(|I7Q<>LE$e@aiH&wHSkz~NFeQJYWO4_d;IHR(5 zoh{DAc%rsuJVlZFAq|=Ikn8f0Irz`ieVLW3!6CAKl0@=@y)nAy{svwVmAOS@rrF0Y zpUYD?iTfGX)c@OqSJGqdLJo`SUWaJ%*<}as?${e#Zcl0}s#pAZV@@#F_b?^}KyP}l z*~PdzJl`^p50pR=mLGm){LeWlbGhMT0_|hz4wbz3N{mdETzKti<+sSDP}X&5BHq3d<~C*{8U9G z22Gh&ko>TF1FOB98i?Zqp-MY8H+;f@Q%-?dxuXL;{ZR1ebkc_HX=?N59Y0f3X=shT zlW4F=iL~3Fyb(d~n5z7t^gUJ%M4iUV(as`>HS|QK2mVhezZbbmp(>+(0nI#4%u#-| za)q|I0B9m1b3p5yZqIue5!JM3%-f|L-p$QS_*buLS&Mug zkOOxp3ver|E8rujDrTaXzcE^76PUSZ6v`$%tR{7V9aD$LIQNhOcO+ALK$e?+?!3hD zo$<%MeQw#yXm=ymGjnaYlCELJ$mTjx>za<2mm8bDYDzl#7sUmG;rg|6^|lLhA4 z)JcG9QfSri!0sMwcBz!*32^=RTd$2#eKnbxJi|24NO;-QsG@!?AZHJBi?m^lrndS2 zN$^6I-dl1-uID|9{kHM4FgM7Ebl#-6F-ZgT@cf63kpi*?zSg1gxp75vY8%}v21bdG z-d1NuV`;9>5T(9Y8%T-Es>Kh=kFsVU8H!hNBRtr72IL421mUmJ4;rU(IW=R^AQT4v zQkr539YlFg>!C=iLag1f4Xj=;do&{@Q;JI_e0y#P49%$K?w?^m&ZIc^ckjvuH2?s` zIaEnrS0(u>7}ikH9u=KEso0^0H8>&?9ujYI{LaZNf>v~tPHQ&3x#?J?e5$!eBL0F zyLo1sWdfzzV%-@Q2*c`8&_b&Kemzb3R+~Ey))9nSd|@4FG!ARciL9^t z>uP-b!6hkN2?EXx9iwqiVDPgVK##a)qRW2euOF>I<9EIgK}q^(9Cs$V_bkc?$hnZh z=3Zg_5G$xXiH832y*gcF_IkSL|8r=VlK^*4RD80HJd;m|?{Q3|K)BV6tif6d{%D9v z^$qCG0M)S70+QdvqF1{>Z-&Uh@&Xzu830!V>N-aU@$I7syg(MGca1cYN( z&dkk=6ET!un?!hnT%6W&qckANl4tHHY;Xv+qmv9+@ICVTJSD$?))>h+$?gi(q`Z1Cob$a%sz-u)ht^B#kWVAGJKy)jqU8UNIin{_JmQ;OI5_)5 zBFR zqXZZ$HMQ8;+aEE?QKuAF4f|(L#k+T(rs$WF$ccf)4n8H~_`p!Tk&-s$Z42bHs=&qz z!D+f#9X#)j0w?j^kM1a> zu8@0L)I6JRT6k}^LT{-lUZQf1J`Iv*PIz)V`=sxoZ_fDplY)xy)hGzlEU3_&8tKr4 z8jQ)*ql!!aN_6@@#mwx-Tfq#!_7eUWOV^!-;8V)r{{+r(hp+Zvx7Zkq{GX-%bcg!v z+>vITB|h;h*IX_4iAeBd0xs>v_pX!Dy#Ula#Ziky}U;^Iz@^ea;7t{t=|NXknKcr9PLCw9x;LR_wr$2(y#=pYgpa-%&qORzIFOt4fxb zyMN#_$?B3WkDNAHDPCW{+jaQeO428Nra?EJ`fG6nmZHEW4#H@Y&MtPH>}6BWC#8Z6 zl33NzPte#yO&&J$dqPEhp6TNy+;~%M;U_<27yc}UDdqo?E>2Re`GQGwzUHnEH4u&@ zK5qO(e$~4(dN*_^gYkGc{MTzU7o7C_vb7{J+7t-Y*7)+8QvArsh<&9u6FO%cyvpZe@|*ua`NeqG_hLCiPWDF~K4ze|gf;7|-7JeO zYIizJwFeX5zVMJO5WFMGl8`&I#o}dr!+ngj7l&JVnzvTBZ1@YLs5R~k)9nq^#nk9m zKB!}FQAv0`_IS6giEd$9V**ys&hGw(@T@siX>zuUiU9lGPU!qTP>T`wmTg;ICGKJx zjSygLOvnW!rLfZnXnly~S3Muc*nTCZH~UolNR^U>$A6@ApS@?Ez*j zSWC&_lVb59^t6s{{I~)6her^WV-?Pu)L+YueWTn7pZGS;c?zEA%Wm~PlpeFNPvXfK z4&2=8I;bwmTJu4HvMYo~UVad~VS+!fq9_Kokh4X+ys(9_Fze_4pY>Q={M zb*20#w#s6#ZhmF*L2qSc&#Ue;vkp(&KKJS<2o!`Y<;#>`x$mK$mD8 z?ZowiXU>`3KmA^hwO{jT{^28D?CE+v0dgMgAvkWjs5_Nk7cx~|GL|pSEk#8DVIv3 zJDL-chX@Ml#KyjRCyy_<2E5j@aV{yHj_5T2ImNZH0U!J4&~N?vm(B+M;OEDx+D~He z`H9}v9=p7JvkRINbIx>YLAPTk{7ofAYFU$4@qwKdvvW{;_%e8U_hjE58-edVBro_UppfIx{JH2;~leMd8z=x(M zqG3d@y`cp!WTZtk;vksDhX?xgftI!7vFkAyvkQ+1fA;zR*=y&@nuYUJUS=$lzP5I9 zeUVhBgSgcHKTp2=3h}(uo#irV%bt&BKYv%f4}ACIVdboS>7F)!`OWlq+P!jF6s4@F z6$`xP40uTJ{>Qb6=Jmqnx|}bsZ(o1%3;){L$)^y5QDYd&frsKYo6z{b4mZ{7vQ8^Uaq_Ggn*nRz0+s@ABmM z`MdAh98%