From 08ced5b5e9ac324ac7495a8b58eba6163fb0c962 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Thu, 14 May 2020 19:51:07 -0500 Subject: [PATCH] Boss projectile spreads are now 100% correct. New Providence cocoon flame pattern. Perf Hive projectiles are much easier to see. Ceaseless Void orb spiral rotates slower. Description file updated with hyphens. Various refactors. --- NPCs/CalamityAI.cs | 55 +-- NPCs/CalamityGlobalAI.cs | 91 ++--- NPCs/Cryogen/Cryogen.cs | 263 +++++------- NPCs/Cryogen/CryogenIce.cs | 40 +- NPCs/OldDuke/OldDukeSharkron.cs | 50 +-- NPCs/OldDuke/OldDukeToothBall.cs | 68 ++-- NPCs/Perforator/PerforatorHive.cs | 3 - .../ProfanedGuardians/ProfanedGuardianBoss.cs | 79 ++-- .../ProfanedGuardianBoss2.cs | 50 +-- .../ProfanedGuardianBoss3.cs | 51 +-- NPCs/Providence/Providence.cs | 81 ++-- NPCs/Ravager/RavagerBody.cs | 81 ++-- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 372 +++++++++-------- NPCs/Yharon/Yharon.cs | 385 +++++++++--------- Projectiles/Boss/BloodGeyser.cs | 9 +- Projectiles/Boss/DarkEnergyBall2.cs | 2 +- Projectiles/Boss/DarkOrb.cs | 29 +- Projectiles/Boss/IceBlast.cs | 5 +- Projectiles/Boss/IchorShot.cs | 7 +- description.txt | 16 +- 20 files changed, 803 insertions(+), 934 deletions(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index fb95ce1654..3128569bd6 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -183,12 +183,6 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 valueBoom = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; int damageBoom = Main.expertMode ? 23 : 28; float velocity = revenge ? 7.5f : 6.5f; if (death) @@ -196,16 +190,16 @@ namespace CalamityMod.NPCs if (CalamityWorld.bossRushActive) velocity = 11f; - for (iBoom = 0; iBoom < 15; iBoom++) + int totalProjectiles = 30; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) { int projectileType = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); if (projectileType == ModContent.ProjectileType()) - { damageBoom = Main.expertMode ? 25 : 30; - } - offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocity), (float)(Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocity), (float)(-Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); + Projectile.NewProjectile(npc.Center, vector255, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); } damageBoom = Main.expertMode ? 28 : 33; @@ -959,7 +953,6 @@ namespace CalamityMod.NPCs int totalProjectiles = 6; float offsetAngle = (float)Math.PI * radialOffset; - for (int j = 0; j < totalProjectiles; j++) { float radians = j - (totalProjectiles - 1f) / 2f; @@ -969,19 +962,12 @@ namespace CalamityMod.NPCs Main.projectile[proj].tileCollide = false; } - vectorCenter = npc.Center; totalProjectiles = 12; - float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle2; - - int i; - for (i = 0; i < 6; i++) + float radians2 = MathHelper.TwoPi / totalProjectiles; + for (int k = 0; k < totalProjectiles; k++) { - offsetAngle2 = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; // Used to be 32 - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(Math.Sin(offsetAngle2) * projectileSpeed), (float)(Math.Cos(offsetAngle2) * projectileSpeed), ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(-Math.Sin(offsetAngle2) * projectileSpeed), (float)(-Math.Cos(offsetAngle2) * projectileSpeed), ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Vector2 vector255 = new Vector2(0f, -projectileSpeed).RotatedBy(radians2 * k); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); } } } @@ -2330,21 +2316,14 @@ namespace CalamityMod.NPCs // Fire astral flames while teleporting if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) { - Vector2 shootFromVector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; float velocity = CalamityWorld.bossRushActive ? 10f : 7f; - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), - (float)(Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), laserDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), - (float)(-Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), laserDamage, 0f, Main.myPlayer, 0f, 0f); - } + int totalProjectiles = 8; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), laserDamage, 0f, Main.myPlayer, 0f, 0f); + } } // Fire astral lasers while falling or walking diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 6a3f5f39e2..bf889056d5 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -10,14 +10,11 @@ using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using Terraria; -using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Events; using Terraria.Localization; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs { @@ -6456,25 +6453,17 @@ namespace CalamityMod.NPCs if (npc.localAI[1] >= 480f) { npc.localAI[1] = 0f; - Vector2 shootFromVector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - int totalProjectiles = 12; - float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle; - float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; - int damage = 31; - if (death) - damage += 3; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; // Used to be 32 - int proj = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - int proj2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj2].timeLeft = 300; - } + + int totalProjectiles = 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = death ? 34 : 31; + float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.Center, vector255, ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = 300; + } } } @@ -6589,25 +6578,17 @@ namespace CalamityMod.NPCs if (npc.localAI[1] >= 45f) { npc.localAI[1] = 0f; - Vector2 shootFromVector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - int totalProjectiles = 12; - float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle; - float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; - int damage = 31; - if (death) - damage += 3; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; // Used to be 32 - int proj = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - int proj2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj2].timeLeft = 300; - } + + int totalProjectiles = 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = death ? 34 : 31; + float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.Center, vector255, ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = 300; + } } } @@ -7126,23 +7107,17 @@ namespace CalamityMod.NPCs if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - Vector2 shootFromVector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - int totalProjectiles = 12; - float spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle; - float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; - int damage = 31; - if (death) - damage += 3; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; // Used to be 32 - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - } + + int totalProjectiles = 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = death ? 34 : 31; + float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.Center, vector255, ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = 300; + } } } } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 830a1f5fed..20046193a3 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1,5 +1,4 @@ -using CalamityMod; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -23,7 +22,6 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.Config; namespace CalamityMod.NPCs.Cryogen { [AutoloadBossHead] @@ -114,7 +112,7 @@ namespace CalamityMod.NPCs.Cryogen public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 1f, 1f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 1f, 1f); // Get a target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -130,16 +128,16 @@ namespace CalamityMod.NPCs.Cryogen if ((int)npc.ai[0] + 1 > currentPhase && currentPhase < 6) { - handlePhaseTransition((int)npc.ai[0] + 1); + HandlePhaseTransition((int)npc.ai[0] + 1); } if (npc.ai[2] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (npc.ai[0] < 4f || CalamityWorld.bossRushActive)) //spawn shield for phase 0 1 2 3, not 4 5 6 { int num6 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - npc.ai[2] = (float)(num6 + 1); + npc.ai[2] = num6 + 1; npc.localAI[1] = -1f; npc.netUpdate = true; - Main.npc[num6].ai[0] = (float)npc.whoAmI; + Main.npc[num6].ai[0] = npc.whoAmI; Main.npc[num6].netUpdate = true; } @@ -197,27 +195,21 @@ namespace CalamityMod.NPCs.Cryogen else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (npc.ai[0] < 5f || !revenge || (double)npc.life >= (double)npc.lifeMax * 0.15)) + if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (npc.ai[0] < 5f || !revenge || npc.life >= npc.lifeMax * 0.15)) { time++; if (time >= 600) { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); int totalProjectiles = 4; - float spread = MathHelper.ToRadians(90); - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / (float)totalProjectiles; - double offsetAngle; - int i; - int num184 = 25; - float velocity = CalamityWorld.bossRushActive ? 12f : 4f; - - for (i = 0; i < 2; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - } + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = 25; + float velocity = CalamityWorld.bossRushActive ? 12f : 4f; + Vector2 spinningPoint = Main.rand.NextBool(2) ? new Vector2(0f, -velocity) : Vector2.Normalize(new Vector2(-velocity, -velocity)) * velocity; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } time = 0; } } @@ -233,20 +225,15 @@ namespace CalamityMod.NPCs.Cryogen npc.netUpdate = true; if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - float velocity = CalamityWorld.bossRushActive ? 12f : 8f; - int i; - for (i = 0; i < 8; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - } + int totalProjectiles = 16; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = Main.expertMode ? 20 : 23; + float velocity = CalamityWorld.bossRushActive ? 12f : 8f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } } } } @@ -254,7 +241,7 @@ namespace CalamityMod.NPCs.Cryogen 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((double)(num1243 * num1243 + num1244 * num1244)); + float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); float num1246 = isChill ? 4f : 8f; if (death) { @@ -271,7 +258,7 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; double HPMult = death ? 0.95 : 0.83 + multAdd; - if ((double)npc.life < (double)npc.lifeMax * HPMult) + if (npc.life < npc.lifeMax * HPMult) { npc.TargetClosest(true); npc.ai[0] = 1f; @@ -289,22 +276,15 @@ namespace CalamityMod.NPCs.Cryogen npc.localAI[0] = 0f; if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - float projVelocity = CalamityWorld.bossRushActive ? 12f : 8f; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * projVelocity), (float)(Math.Cos(offsetAngle) * projVelocity), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * projVelocity), (float)(-Math.Cos(offsetAngle) * projVelocity), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } + int totalProjectiles = 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = Main.expertMode ? 20 : 23; + float velocity2 = CalamityWorld.bossRushActive ? 12f : 8f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = new Vector2(0f, -velocity2).RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } } } } @@ -340,7 +320,7 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.Y = -velocity; } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 300f) + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 300f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; @@ -350,7 +330,7 @@ namespace CalamityMod.NPCs.Cryogen if (npc.velocity.X > velocity) npc.velocity.X = velocity; } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 300f) + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 300f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; @@ -362,7 +342,7 @@ namespace CalamityMod.NPCs.Cryogen } double HPMult = death ? 0.8 : 0.66 + multAdd; - if ((double)npc.life < (double)npc.lifeMax * HPMult) + if (npc.life < npc.lifeMax * HPMult) { npc.TargetClosest(true); npc.ai[0] = 2f; @@ -384,22 +364,15 @@ namespace CalamityMod.NPCs.Cryogen { if (Main.rand.NextBool(2)) { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - float velocity = CalamityWorld.bossRushActive ? 14f : 9f; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } + int totalProjectiles = 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = Main.expertMode ? 20 : 23; + float velocity = CalamityWorld.bossRushActive ? 14f : 9f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } } else { @@ -407,11 +380,11 @@ namespace CalamityMod.NPCs.Cryogen if (CalamityWorld.bossRushActive) num179 = 14f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; num180 *= num183; num182 *= num183; @@ -421,12 +394,12 @@ namespace CalamityMod.NPCs.Cryogen value9.Y += num182; for (int num186 = 0; num186 < 15; num186++) { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; - num180 += (float)Main.rand.Next(-180, 181); - num182 += (float)Main.rand.Next(-180, 181); + num180 += Main.rand.Next(-180, 181); + num182 += Main.rand.Next(-180, 181); num180 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, -8f, num185, num184, 0f, Main.myPlayer, 0f, 0f); } @@ -438,7 +411,7 @@ namespace CalamityMod.NPCs.Cryogen 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((double)(num1243 * num1243 + num1244 * num1244)); + float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); float num1246 = isChill ? 6f : 12f; if (death) { @@ -455,7 +428,7 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; double HPMult = death ? 0.7 : 0.49 + multAdd; - if ((double)npc.life < (double)npc.lifeMax * HPMult) + if (npc.life < npc.lifeMax * HPMult) { npc.TargetClosest(true); npc.ai[0] = 3f; @@ -477,11 +450,11 @@ namespace CalamityMod.NPCs.Cryogen if (CalamityWorld.bossRushActive) num179 = 14f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); npc.netUpdate = true; num183 = num179 / num183; num180 *= num183; @@ -492,12 +465,12 @@ namespace CalamityMod.NPCs.Cryogen value9.Y += num182; for (int num186 = 0; num186 < 15; num186++) { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; - num180 += (float)Main.rand.Next(-360, 361); - num182 += (float)Main.rand.Next(-360, 361); + num180 += Main.rand.Next(-360, 361); + num182 += Main.rand.Next(-360, 361); num180 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, -2.5f, num185, num184, 0f, Main.myPlayer, 1f, 0f); } @@ -536,7 +509,7 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.Y = -velocity; } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 300f) + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 300f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; @@ -546,7 +519,7 @@ namespace CalamityMod.NPCs.Cryogen if (npc.velocity.X > velocity) npc.velocity.X = velocity; } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 300f) + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 300f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; @@ -558,7 +531,7 @@ namespace CalamityMod.NPCs.Cryogen } double HPMult = death ? 0.55 : 0.32 + multAdd; - if ((double)npc.life < (double)npc.lifeMax * HPMult) + if (npc.life < npc.lifeMax * HPMult) { npc.TargetClosest(true); npc.ai[0] = 4f; @@ -577,21 +550,15 @@ namespace CalamityMod.NPCs.Cryogen npc.localAI[0] = 0f; if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } + int totalProjectiles = 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = Main.expertMode ? 20 : 23; + float velocity = CalamityWorld.bossRushActive ? 14f : 9f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } } } } @@ -599,7 +566,7 @@ namespace CalamityMod.NPCs.Cryogen 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((double)(num1243 * num1243 + num1244 * num1244)); + float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); float speed = revenge ? 5.5f : 5f; if (CalamityWorld.bossRushActive) { @@ -642,7 +609,7 @@ namespace CalamityMod.NPCs.Cryogen else num1251 -= Main.rand.Next(min, max); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height)) + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2(num1250 * 16, num1251 * 16), 1, 1, player.position, player.width, player.height)) break; if (num1249 > 100) @@ -659,7 +626,7 @@ namespace CalamityMod.NPCs.Cryogen } else if (npc.ai[1] == 1f) { - Vector2 position = new Vector2((float)teleportLocationX * 16f - (float)(npc.width / 2), (float)iceShard * 16f - (float)(npc.height / 2)); + Vector2 position = new Vector2(teleportLocationX * 16f - (npc.width / 2), iceShard * 16f - (npc.height / 2)); for (int m = 0; m < 5; m++) { int dust = Dust.NewDust(position, npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); @@ -695,7 +662,7 @@ namespace CalamityMod.NPCs.Cryogen } double HPMult = death ? 0.4 : 0.15 + multAdd; - if ((double)npc.life < (double)npc.lifeMax * HPMult) + if (npc.life < npc.lifeMax * HPMult) { for (int num621 = 0; num621 < 40; num621++) { @@ -704,7 +671,7 @@ namespace CalamityMod.NPCs.Cryogen if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) @@ -716,7 +683,7 @@ namespace CalamityMod.NPCs.Cryogen Main.dust[num624].velocity *= 2f; } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + float randomSpread = Main.rand.Next(-200, 200) / 100; Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore1"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore2"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore3"), 1f); @@ -752,10 +719,10 @@ namespace CalamityMod.NPCs.Cryogen } else if (npc.ai[0] == 5f) { - npc.damage = (int)((float)npc.defDamage * 1.5f); + npc.damage = (int)(npc.defDamage * 1.5f); double HPMult = death ? 0.25 : 0.15; - if (revenge && (double)npc.life < (double)npc.lifeMax * HPMult) + if (revenge && npc.life < npc.lifeMax * HPMult) { if (npc.ai[1] == 60f) npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (CalamityWorld.bossRushActive ? 30f : (isChill ? 18f : 24f)); @@ -785,7 +752,7 @@ namespace CalamityMod.NPCs.Cryogen npc.rotation = npc.velocity.X * 0.15f; } else - npc.rotation += (float)npc.direction * 0.5f; + npc.rotation += npc.direction * 0.5f; return; } @@ -795,16 +762,16 @@ namespace CalamityMod.NPCs.Cryogen { num1372 = 32f; } - 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; + 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((double)(num1373 * num1373 + num1374 * num1374)); + float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; iceShard--; - if ((double)npc.life < (double)npc.lifeMax * (0.1 + multAdd) || death) + if (npc.life < npc.lifeMax * (0.1 + multAdd) || death) { if (num1375 < 170f || iceShard > 0) { @@ -812,11 +779,11 @@ namespace CalamityMod.NPCs.Cryogen { iceShard = 17; } - npc.rotation += (float)npc.direction * 0.5f; + npc.rotation += npc.direction * 0.5f; return; } } - else if ((double)npc.life < (double)npc.lifeMax * (0.125 + multAdd)) + else if (npc.life < npc.lifeMax * (0.125 + multAdd)) { if (num1375 < 190f || iceShard > 0) { @@ -824,7 +791,7 @@ namespace CalamityMod.NPCs.Cryogen { iceShard = 19; } - npc.rotation += (float)npc.direction * 0.35f; + npc.rotation += npc.direction * 0.35f; return; } } @@ -836,7 +803,7 @@ namespace CalamityMod.NPCs.Cryogen { iceShard = 20; } - npc.rotation += (float)npc.direction * 0.3f; + npc.rotation += npc.direction * 0.3f; return; } } @@ -860,19 +827,15 @@ namespace CalamityMod.NPCs.Cryogen time++; if (time >= 75) { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 4f; - double offsetAngle; - int i; - int num184 = 25; + int totalProjectiles = 4; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = 25; float velocity2 = CalamityWorld.bossRushActive ? 16f : 6f; - for (i = 0; i < 2; i++) + Vector2 spinningPoint = Main.rand.NextBool(2) ? new Vector2(0f, -velocity2) : Vector2.Normalize(new Vector2(-velocity2, -velocity2)) * velocity2; + for (int k = 0; k < totalProjectiles; k++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * velocity2), (float)(Math.Cos(offsetAngle) * velocity2), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * velocity2), (float)(-Math.Cos(offsetAngle) * velocity2), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } time = 0; } @@ -919,7 +882,7 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.Y = -velocity; } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 350f) + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 350f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; @@ -929,7 +892,7 @@ namespace CalamityMod.NPCs.Cryogen if (npc.velocity.X > velocity) npc.velocity.X = velocity; } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 350f) + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 350f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; @@ -941,24 +904,24 @@ namespace CalamityMod.NPCs.Cryogen } } - if (!revenge || (double)npc.life >= (double)npc.lifeMax * (death ? 0.25 : 0.15)) + if (!revenge || npc.life >= npc.lifeMax * (death ? 0.25 : 0.15)) { if (npc.ai[3] == 0f && npc.life > 0) { - npc.ai[3] = (float)npc.lifeMax; + npc.ai[3] = npc.lifeMax; } if (npc.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.075); - if ((float)(npc.life + num660) < npc.ai[3]) + int num660 = (int)(npc.lifeMax * 0.075); + if ((npc.life + num660) < npc.ai[3]) { - npc.ai[3] = (float)npc.life; + npc.ai[3] = npc.life; for (int num662 = 0; num662 < 2; num662++) { - 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 x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); int random = 1; switch ((int)npc.ai[0]) { @@ -1001,7 +964,7 @@ namespace CalamityMod.NPCs.Cryogen } } - private void handlePhaseTransition (int newPhase) + private void HandlePhaseTransition(int newPhase) { int chipGoreAmount = newPhase >= 5 ? 3 : newPhase >= 3 ? 2 : 1; for (int i = 1; i < chipGoreAmount; i++) diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index 95e383fc06..fe68a082c0 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -50,8 +50,8 @@ namespace CalamityMod.NPCs.Cryogen { npc.velocity = Vector2.Zero; npc.position = Main.npc[num989].Center; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); npc.gfxOffY = Main.npc[num989].gfxOffY + 14; return; } @@ -92,9 +92,10 @@ namespace CalamityMod.NPCs.Cryogen if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + for (int num623 = 0; num623 < 50; num623++) { int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); @@ -103,25 +104,26 @@ namespace CalamityMod.NPCs.Cryogen num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 4f; - double offsetAngle; - int num184 = Main.expertMode ? 20 : 23; - int i; - for (i = 0; i < 2; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = 4; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage2 = Main.expertMode ? 20 : 23; + float velocity = CalamityWorld.bossRushActive ? 12f : 8f; + Vector2 spinningPoint = Main.rand.NextBool(2) ? new Vector2(0f, -velocity) : Vector2.Normalize(new Vector2(-velocity, -velocity)) * velocity; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage2, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = 300; + } + } + float randomSpread; for (int spike = 0; spike < 4; spike++) { - randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + randomSpread = Main.rand.Next(-200, 200) / 100; for (int x = 0; x < 4; x++) { Gore.NewGore(npc.Center, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoShieldGore" + x), 1f); diff --git a/NPCs/OldDuke/OldDukeSharkron.cs b/NPCs/OldDuke/OldDukeSharkron.cs index d2b68d4a4d..029140b609 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -1,7 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using System; -using System.Collections.Generic; using System.IO; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,7 +8,6 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; -using CalamityMod; namespace CalamityMod.NPCs.OldDuke { @@ -67,12 +64,12 @@ namespace CalamityMod.NPCs.OldDuke if (npc.velocity.X < 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)-(double)npc.velocity.Y, (double)-(double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); } else { npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); } npc.alpha -= 6; @@ -139,9 +136,9 @@ namespace CalamityMod.NPCs.OldDuke Main.PlaySound(npc.DeathSound, npc.position); } - CheckDead(); npc.life = 0; npc.HitEffect(0, 10.0); + npc.checkDead(); npc.active = false; return; } @@ -161,7 +158,7 @@ namespace CalamityMod.NPCs.OldDuke spriteEffects = SpriteEffects.None; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); Color color36 = Color.Lime; float amount9 = 0.5f; int num153 = 10; @@ -173,16 +170,16 @@ namespace CalamityMod.NPCs.OldDuke Color color38 = lightColor; 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 - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -207,11 +204,11 @@ namespace CalamityMod.NPCs.OldDuke { Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 12); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = (npc.height = 96); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); + npc.width = npc.height = 96; + 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++) { @@ -221,7 +218,7 @@ namespace CalamityMod.NPCs.OldDuke if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } @@ -234,11 +231,14 @@ namespace CalamityMod.NPCs.OldDuke Main.dust[num624].velocity.X *= 2f; } - int spawnX = (int)(npc.width / 2); - int damage = Main.expertMode ? 55 : 70; - for (int i = 0; i < 2; i++) - Projectile.NewProjectile(npc.Center.X + (float)Main.rand.Next(-spawnX, spawnX), npc.Center.Y, - (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spawnX = npc.width / 2; + int damage = Main.expertMode ? 55 : 70; + for (int i = 0; i < 2; i++) + Projectile.NewProjectile(npc.Center.X + Main.rand.Next(-spawnX, spawnX), npc.Center.Y, + Main.rand.Next(-3, 4), Main.rand.Next(-12, -6), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } return true; } @@ -247,13 +247,13 @@ namespace CalamityMod.NPCs.OldDuke { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index fec8315cfb..ef7bca6f13 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -1,17 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Boss; using System; -using System.Collections.Generic; using System.IO; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; -using CalamityMod.Projectiles; -using CalamityMod; namespace CalamityMod.NPCs.OldDuke { @@ -84,9 +79,11 @@ namespace CalamityMod.NPCs.OldDuke if (vector.Length() < 40f || npc.ai[3] >= 900f) { npc.dontTakeDamage = false; - CheckDead(); npc.life = 0; - return; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + return; } npc.ai[3] += 1f; npc.dontTakeDamage = (npc.ai[3] >= 600f ? false : true); @@ -97,14 +94,14 @@ namespace CalamityMod.NPCs.OldDuke return; } float num1372 = 12f; - 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; + 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((double)(num1373 * num1373 + num1374 * num1374)); + float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; - npc.ai[0] -= (float)Main.rand.Next(6); + npc.ai[0] -= Main.rand.Next(6); if (num1375 < 300f || npc.ai[0] > 0f) { if (num1375 < 300f) @@ -176,56 +173,49 @@ namespace CalamityMod.NPCs.OldDuke { Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 12); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = (npc.height = 96); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(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 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 2f); + 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; if (Main.rand.Next(2) == 0) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } Main.dust[num622].noGravity = true; } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default(Color), 3f); + 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(Color), 2f); + 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; } - if (Main.netMode != 1) + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 valueBoom = npc.Center; int totalProjectiles = 4; - float spreadBoom = MathHelper.ToRadians(90); - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / (float)totalProjectiles; - double offsetAngleBoom; - int iBoom; - int damageBoom = Main.expertMode ? 55 : 70; - int projectileType = ModContent.ProjectileType(); - Projectile.NewProjectile(valueBoom.X, valueBoom.Y, 0f, 0f, ModContent.ProjectileType(), damageBoom, 0f, Main.myPlayer, 0f, 0f); - for (iBoom = 0; iBoom < 2; iBoom++) - { - float velocity = (float)Main.rand.Next(7, 11); - offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; - int proj = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocity), (float)(Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = Main.expertMode ? 55 : 70; + for (int k = 0; k < totalProjectiles; k++) + { + float velocity = Main.rand.Next(7, 11); + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = 360; - int proj2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocity), (float)(-Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj2].timeLeft = 360; } + Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } + return true; } @@ -233,13 +223,13 @@ namespace CalamityMod.NPCs.OldDuke { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index be4eff4ffa..fbec41d482 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -17,13 +17,10 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index 2653f14e77..1ae31e8fd7 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -14,8 +14,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; using CalamityMod.Items.Placeables.Furniture.Trophies; namespace CalamityMod.NPCs.ProfanedGuardians @@ -108,7 +106,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians CalamityGlobalNPC.doughnutBoss = npc.whoAmI; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; Vector2 vectorCenter = npc.Center; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] == 0f) @@ -200,7 +198,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { if (Main.rand.Next(3) < num1009) { - int num1012 = Dust.NewDust(vectorCenter - new Vector2((float)num1010), num1010 * 2, num1010 * 2, (int)CalamityDusts.ProfanedFire, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + int num1012 = Dust.NewDust(vectorCenter - new Vector2(num1010), num1010 * 2, num1010 * 2, (int)CalamityDusts.ProfanedFire, 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; @@ -216,58 +214,35 @@ namespace CalamityMod.NPCs.ProfanedGuardians Main.PlaySound(SoundID.Item20, npc.position); - Vector2 center = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - int totalProjectiles = 18; - float spread = MathHelper.ToRadians(20); - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 - float velocity = 5f; - int damage = expertMode ? 50 : 60; - int projectileType = ModContent.ProjectileType(); + int totalProjectiles = 10; + float velocity = 5f; + int damage = expertMode ? 50 : 60; + int projectileType = ModContent.ProjectileType(); - double offsetAngle; - int i; switch (spearType) { case 0: - for (i = 0; i < 9; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; // Used to be 32 - Projectile.NewProjectile(center.X, center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(center.X, center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - } - break; + break; case 1: totalProjectiles = 12; - spread = MathHelper.ToRadians(30); // 30 degrees in radians = 0.523599 - startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 velocity = 5.5f; - for (i = 0; i < 6; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; // Used to be 32 - Projectile.NewProjectile(center.X, center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(center.X, center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - } break; case 2: totalProjectiles = 8; - spread = MathHelper.ToRadians(45); // 30 degrees in radians = 0.523599 - startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this - deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 velocity = 6f; - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; // Used to be 32 - Projectile.NewProjectile(center.X, center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(center.X, center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - } break; default: break; } - spearType++; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); + Projectile.NewProjectile(npc.Center, vector255, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + } + + spearType++; if (spearType > 2) spearType = 0; } @@ -287,7 +262,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians flag64 = true; } float num1014 = 8f; - flag64 = flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014; + flag64 = flag64 && vector126.ToRotation() > MathHelper.Pi / num1014 && vector126.ToRotation() < MathHelper.Pi - MathHelper.Pi / num1014; if (num1013 > 1200f || !flag64) { npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / num1000; @@ -337,8 +312,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians { Main.PlaySound(SoundID.Item20, npc.position); int damage = expertMode ? 55 : 70; - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); //changed + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; + int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, npc.direction * 2, 4f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[projectile].timeLeft = 120; Main.projectile[projectile].velocity.X = 0f; Main.projectile[projectile].velocity.Y = 0f; @@ -363,7 +338,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians vec2.Normalize(); if (vec2.HasNaNs()) { - vec2 = new Vector2((float)npc.direction, 0f); + vec2 = new Vector2(npc.direction, 0f); } npc.velocity = (npc.velocity * (num1000 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1000; } @@ -388,7 +363,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -402,16 +377,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians Color color38 = lightColor; 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 - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -425,9 +400,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians 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 - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index c2c4f1e7c5..26ae268aad 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -11,8 +11,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.ProfanedGuardians { [AutoloadBossHead] @@ -136,7 +134,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { dustType = 160; } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + int num1012 = Dust.NewDust(npc.Center - new Vector2(num1010), num1010 * 2, num1010 * 2, dustType, 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; @@ -153,7 +151,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + float num786 = (float)Math.Sqrt(num784 * num784 + num785 * num785); if (num786 > 90f) { num786 = 21f / num786; //8f @@ -173,7 +171,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians vector96 = new Vector2(npc.Center.X, npc.Center.Y); num784 = player.Center.X - vector96.X; num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = (float)Math.Sqrt(num784 * num784 + num785 * num785); num786 = 21f / num786; //8f npc.velocity.X = num784 * num786; npc.velocity.Y = num785 * num786; @@ -190,7 +188,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + float num789 = (float)Math.Sqrt(num787 * num787 + num788 * num788); if (num789 > 700f) { npc.ai[0] = 0f; @@ -206,20 +204,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = expertMode ? 50 : 60; - int projectileShot = ModContent.ProjectileType(); - int i; - for (i = 0; i < 3; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } + + float velocity = 5f; + int totalProjectiles = 6; + float radians = MathHelper.TwoPi / totalProjectiles; + int damage = expertMode ? 50 : 60; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } } } } @@ -232,7 +226,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -244,16 +238,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians Color color38 = lightColor; 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 - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -267,9 +261,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians 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 - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index 7dab0178ef..8fe6427d42 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -11,8 +11,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.ProfanedGuardians { [AutoloadBossHead] @@ -136,7 +134,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { dustType = 107; } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + int num1012 = Dust.NewDust(npc.Center - new Vector2(num1010), num1010 * 2, num1010 * 2, dustType, 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; @@ -153,7 +151,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + float num786 = (float)Math.Sqrt(num784 * num784 + num785 * num785); if (num786 > 90f) { num786 = 21f / num786; //8f @@ -173,7 +171,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians vector96 = new Vector2(npc.Center.X, npc.Center.Y); num784 = player.Center.X - vector96.X; num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = (float)Math.Sqrt(num784 * num784 + num785 * num785); num786 = 21f / num786; //8f npc.velocity.X = num784 * num786; npc.velocity.Y = num785 * num786; @@ -190,7 +188,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + float num789 = (float)Math.Sqrt(num787 * num787 + num788 * num788); if (num789 > 700f) { npc.ai[0] = 0f; @@ -206,20 +204,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = 0; - int projectileShot = ModContent.ProjectileType(); - int i; - for (i = 0; i < 3; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } + + float velocity = 5f; + int totalProjectiles = 6; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + } } } } @@ -233,7 +226,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Texture2D texture2D15 = Main.npcTexture[npc.type]; Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss3Glow2"); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -245,16 +238,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians Color color38 = lightColor; 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 - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -269,16 +262,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians 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 - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); color43 = npc.GetAlpha(color43); - color43 *= (float)(num153 - num163) / 15f; + color43 *= (num153 - num163) / 15f; spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 8e609a7ef9..60e3ddb756 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -470,7 +470,7 @@ namespace CalamityMod.NPCs.Providence phase = 3; break; // 1575 or 1500 case 1: - phase = 5; + phase = 2; break; // 1875 or 1800 case 2: phase = 0; @@ -763,7 +763,7 @@ namespace CalamityMod.NPCs.Providence num867 *= -1f; } - /*if (npc.velocity.Length() <= 2f) + if (npc.velocity.Length() <= 2f) npc.velocity = Vector2.Zero; if (npc.velocity.Length() > 2f) return; @@ -774,54 +774,55 @@ namespace CalamityMod.NPCs.Providence float interval = totalProjectiles / chains * divisor; double patternInterval = Math.Floor(npc.ai[3] / interval); float velocity = 3f; + Vector2 fireFrom = new Vector2(vector.X, vector.Y + 20f); - if (patternInterval % 2 == 0) + if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[3] % divisor == 0f) + if (patternInterval % 2 == 0) { - double radians = (patternInterval % 4 == 0 ? MathHelper.TwoPi + MathHelper.Pi / 3 : MathHelper.TwoPi) / chains; - float radialOffset = MathHelper.ToRadians(npc.ai[2]); - Vector2 fireFrom = new Vector2(vector.X, vector.Y + 20f); - - for (int i = 0; i < chains; i++) + if (npc.ai[3] % divisor == 0f) { - Vector2 vector2 = new Vector2(0f, -velocity).RotatedBy(radians * i + radialOffset); + Vector2 spinningPoint = calamityGlobalNPC.newAI[1] % 2f == 0f ? new Vector2(0f, -velocity) : Vector2.Normalize(new Vector2(-velocity, -velocity)) * velocity; + double radians = MathHelper.TwoPi / chains; + for (int i = 0; i < chains; i++) + { + Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(npc.ai[2])); - int projectileType = ModContent.ProjectileType(); - if (Main.rand.NextBool(4) && !death) - projectileType = ModContent.ProjectileType(); + int projectileType = ModContent.ProjectileType(); + if (Main.rand.NextBool(4) && !death) + projectileType = ModContent.ProjectileType(); - Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); + } + + // Radial offset + npc.ai[2] += 10f; } + } + else + { + npc.ai[2] = 0f; - // Radial offset - npc.ai[2] += 10f; + totalProjectiles = 16; + if (npc.ai[3] % (divisor * totalProjectiles) == 0f) + { + calamityGlobalNPC.newAI[1] += 1f; + double radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector2 = new Vector2(0f, -velocity).RotatedBy(radians * i); + + int projectileType = ModContent.ProjectileType(); + if (Main.rand.NextBool(4) && !death) + projectileType = ModContent.ProjectileType(); + + Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); + } + } } } - else - { - npc.ai[2] = 0f; - totalProjectiles = 16; - if (npc.ai[3] % (divisor * totalProjectiles) == 0f) - { - double radians = MathHelper.TwoPi / totalProjectiles; - Vector2 fireFrom = new Vector2(vector.X, vector.Y + 20f); - - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector2 = new Vector2(0f, -velocity).RotatedBy(radians * i); - - int projectileType = ModContent.ProjectileType(); - if (Main.rand.NextBool(4) && !death) - projectileType = ModContent.ProjectileType(); - - Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); - } - } - }*/ - - int shootBoost = (int)(4f * (1f - lifeRatio)); + /*int shootBoost = (int)(4f * (1f - lifeRatio)); int num870 = (expertMode ? 3 : 4) - shootBoost; @@ -839,7 +840,7 @@ namespace CalamityMod.NPCs.Providence else Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); } - } + }*/ if (npc.ai[3] == 0f) { diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 7b742de0ef..3e66a8f693 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -19,8 +19,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Ravager { @@ -116,7 +114,7 @@ namespace CalamityMod.NPCs.Ravager bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Large fire light Lighting.AddLight((int)(npc.Center.X - 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); @@ -177,7 +175,7 @@ namespace CalamityMod.NPCs.Ravager } bool enrage = false; - if (player.position.Y + (float)(player.height / 2) > npc.position.Y + (float)(npc.height / 2) + 10f) + if (player.position.Y + (player.height / 2) > npc.position.Y + (npc.height / 2) + 10f) enrage = true; if (headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive) @@ -199,8 +197,8 @@ namespace CalamityMod.NPCs.Ravager Main.dust[rightDust].velocity *= 0.2f; Dust rightDustExpr = Main.dust[rightDust]; - rightDustExpr.velocity.Y -= 3f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + rightDustExpr.velocity.Y -= 3f + Main.rand.Next(10) * 0.1f; + Main.dust[rightDust].fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) { @@ -208,7 +206,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[rightDust].scale *= 1f + Main.rand.Next(10) * 0.1f; Dust rightDustExpr2 = Main.dust[rightDust]; rightDustExpr2.velocity.Y -= 4f; } @@ -223,20 +221,15 @@ namespace CalamityMod.NPCs.Ravager npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int laserDamage = 45; - float velocity = CalamityWorld.bossRushActive ? 10f : 7f; - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } + float velocity = CalamityWorld.bossRushActive ? 10f : 7f; + int totalProjectiles = 8; + float radians = MathHelper.TwoPi / totalProjectiles; + int laserDamage = 45; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); + Projectile.NewProjectile(npc.Center, vector255, ProjectileID.EyeBeam, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } } } } @@ -249,8 +242,8 @@ namespace CalamityMod.NPCs.Ravager Main.dust[rightDust].velocity *= 0.2f; Dust rightDustExpr = Main.dust[rightDust]; - rightDustExpr.velocity.X += 3f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + rightDustExpr.velocity.X += 3f + Main.rand.Next(10) * 0.1f; + Main.dust[rightDust].fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) { @@ -258,7 +251,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[rightDust].scale *= 1f + Main.rand.Next(10) * 0.1f; Dust rightDustExpr2 = Main.dust[rightDust]; rightDustExpr2.velocity.X += 4f; } @@ -286,8 +279,8 @@ namespace CalamityMod.NPCs.Ravager Main.dust[leftDust].velocity *= 0.2f; Dust leftDustExpr = Main.dust[leftDust]; - leftDustExpr.velocity.X -= 3f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[leftDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + leftDustExpr.velocity.X -= 3f + Main.rand.Next(10) * 0.1f; + Main.dust[leftDust].fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) { @@ -295,7 +288,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.Next(20) != 0) { Main.dust[leftDust].noGravity = true; - Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[leftDust].scale *= 1f + Main.rand.Next(10) * 0.1f; Dust leftDustExpr2 = Main.dust[leftDust]; leftDustExpr2.velocity.X -= 4f; } @@ -323,8 +316,8 @@ namespace CalamityMod.NPCs.Ravager Main.dust[rightDust].velocity *= 0.2f; Dust rightDustExpr = Main.dust[rightDust]; - rightDustExpr.velocity.Y += 0.5f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + rightDustExpr.velocity.Y += 0.5f + Main.rand.Next(10) * 0.1f; + Main.dust[rightDust].fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) { @@ -332,7 +325,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[rightDust].scale *= 1f + Main.rand.Next(10) * 0.1f; Dust rightDustExpr2 = Main.dust[rightDust]; rightDustExpr2.velocity.Y += 1f; } @@ -359,8 +352,8 @@ namespace CalamityMod.NPCs.Ravager Main.dust[leftDust].velocity *= 0.2f; Dust leftDustExpr = Main.dust[leftDust]; - leftDustExpr.velocity.Y += 0.5f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[leftDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + leftDustExpr.velocity.Y += 0.5f + Main.rand.Next(10) * 0.1f; + Main.dust[leftDust].fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) { @@ -368,7 +361,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.Next(20) != 0) { Main.dust[leftDust].noGravity = true; - Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[leftDust].scale *= 1f + Main.rand.Next(10) * 0.1f; Dust leftDustExpr2 = Main.dust[leftDust]; leftDustExpr2.velocity.Y += 1f; } @@ -421,7 +414,7 @@ namespace CalamityMod.NPCs.Ravager { npc.TargetClosest(true); - bool shouldFall = (player.position.Y >= npc.position.Y + (float)npc.height); + bool shouldFall = player.position.Y >= npc.position.Y + npc.height; float velocityXBoost = death ? 4f : 4f * (1f - lifeRatio); float velocityX = ((enrage || npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 8f : 4f) + velocityXBoost; float velocityY = -16f; @@ -446,7 +439,7 @@ namespace CalamityMod.NPCs.Ravager } } - npc.velocity.X = velocityX * (float)npc.direction; + npc.velocity.X = velocityX * npc.direction; npc.velocity.Y = velocityY; npc.ai[0] = 1f; @@ -484,11 +477,11 @@ namespace CalamityMod.NPCs.Ravager { for (int stompDustAmount = 0; stompDustAmount < 6; stompDustAmount++) { - int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + (float)npc.height), npc.width + 30, 4, 31, 0f, 0f, 100, default, 1.5f); + int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + npc.height), npc.width + 30, 4, 31, 0f, 0f, 100, default, 1.5f); Main.dust[stompDust].velocity *= 0.2f; } - int stompGore = Gore.NewGore(new Vector2((float)(stompDustArea - 30), npc.position.Y + (float)npc.height - 12f), default, Main.rand.Next(61, 64), 1f); + int stompGore = Gore.NewGore(new Vector2(stompDustArea - 30, npc.position.Y + npc.height - 12f), default, Main.rand.Next(61, 64), 1f); Main.gore[stompGore].velocity *= 0.4f; } } @@ -498,16 +491,16 @@ namespace CalamityMod.NPCs.Ravager // Fall through if (npc.target >= 0 && revenge && - ((player.position.Y > npc.position.Y + (float)npc.height && npc.velocity.Y > 0f) || (player.position.Y < npc.position.Y + (float)npc.height && npc.velocity.Y < 0f))) + ((player.position.Y > npc.position.Y + npc.height && npc.velocity.Y > 0f) || (player.position.Y < npc.position.Y + npc.height && npc.velocity.Y < 0f))) npc.noTileCollide = true; else if (!player.dead) npc.noTileCollide = false; - if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) + if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width) { npc.velocity.X *= 0.9f; - if (player.position.Y > npc.position.Y + (float)npc.height) + if (player.position.Y > npc.position.Y + npc.height) { float fallSpeedBoost = death ? 0.6f : 0.6f * (1f - lifeRatio); float fallSpeed = 0.6f + fallSpeedBoost; @@ -552,11 +545,11 @@ namespace CalamityMod.NPCs.Ravager } int distanceFromTarget = 3000; - if (Math.Abs(npc.Center.X - player.Center.X) + Math.Abs(npc.Center.Y - player.Center.Y) > (float)distanceFromTarget) + if (Math.Abs(npc.Center.X - player.Center.X) + Math.Abs(npc.Center.Y - player.Center.Y) > distanceFromTarget) { npc.TargetClosest(true); player = Main.player[npc.target]; - if (Math.Abs(npc.Center.X - player.Center.X) + Math.Abs(npc.Center.Y - player.Center.Y) > (float)distanceFromTarget) + if (Math.Abs(npc.Center.X - player.Center.X) + Math.Abs(npc.Center.Y - player.Center.Y) > distanceFromTarget) { npc.active = false; npc.netUpdate = true; @@ -572,9 +565,9 @@ namespace CalamityMod.NPCs.Ravager spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Width, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Height / Main.npcFrameCount[npc.type]) * 1f / 2f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Color.Blue); spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerBodyGlow"), vector, diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 13b1eed45c..048e16585b 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -23,8 +23,6 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; using CalamityMod.Items.Placeables.Furniture.Trophies; namespace CalamityMod.NPCs.SupremeCalamitas @@ -416,7 +414,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num740 = player.Center.X - vectorCenter.X; float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -445,7 +443,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num740 = player.Center.X - vectorCenter.X; float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -456,18 +454,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas int damage = expertMode ? 200 : 250; //800 500 if (bulletHellCounter2 < 300) //blasts from above { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 600) //blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from above, left, and right { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -522,7 +520,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num740 = player.Center.X - vectorCenter.X; float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -531,21 +529,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (bulletHellCounter2 % 180 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) { if (bulletHellCounter2 % 180 == 0) //blasts from right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } else if (bulletHellCounter2 > 1500) { if (bulletHellCounter2 % 180 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } bulletHellCounter += 1; @@ -554,22 +552,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas bulletHellCounter = 0; if (bulletHellCounter2 < 1200) //blasts from below { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 1500) //blasts from left { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from left and right { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } return; } - if (!startSecondAttack && ((double)npc.life <= (double)npc.lifeMax * 0.75)) + if (!startSecondAttack && (npc.life <= npc.lifeMax * 0.75)) { string key = "Mods.CalamityMod.SupremeBossText4"; Color messageColor = Color.Orange; @@ -599,18 +597,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num740 = player.Center.X - vectorCenter.X; float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { int damage = expertMode ? 150 : 200; if (bulletHellCounter2 % 180 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 240 == 0) //fireblasts from above { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } bulletHellCounter += 1; if (bulletHellCounter > (enraged ? 9 : 11)) @@ -618,22 +616,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas bulletHellCounter = 0; if (bulletHellCounter2 < 2100) //blasts from above { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 2400) //blasts from right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } return; } - if (!startThirdAttack && ((double)npc.life <= (double)npc.lifeMax * 0.5)) + if (!startThirdAttack && (npc.life <= npc.lifeMax * 0.5)) { Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -668,22 +666,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num740 = player.Center.X - vectorCenter.X; float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) //more clustered attack { int damage = expertMode ? 150 : 200; if (bulletHellCounter2 % 180 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 240 == 0) //fireblasts from above { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 225 == 0) //giant homing fireballs { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, passedVar); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, passedVar); passedVar += 1f; } bulletHellCounter += 1; @@ -692,22 +690,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas bulletHellCounter = 0; if (bulletHellCounter2 < 3000) //blasts from below { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 3300) //blasts from left { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } return; } - if (!startFourthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.3)) + if (!startFourthAttack && (npc.life <= npc.lifeMax * 0.3)) { Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -742,22 +740,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num740 = player.Center.X - vectorCenter.X; float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { int damage = expertMode ? 150 : 200; if (bulletHellCounter2 % 240 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 360 == 0) //fireblasts from above { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 30 == 0) //projectiles that move in wave pattern { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-500, 500), -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-500, 500), -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } bulletHellCounter += 1; if (bulletHellCounter > (enraged ? 12 : 14)) @@ -765,24 +763,24 @@ namespace CalamityMod.NPCs.SupremeCalamitas bulletHellCounter = 0; if (bulletHellCounter2 < 3900) //blasts from above { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 4200) //blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from above, left, and right { Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } return; } - if (!startFifthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.1)) + if (!startFifthAttack && (npc.life <= npc.lifeMax * 0.1)) { string key = "Mods.CalamityMod.SupremeBossText9"; Color messageColor = Color.Orange; @@ -817,7 +815,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num = player.Center.X - vectorCenter.X; float num1 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2((double)num1, (double)num) - 1.57f; + npc.rotation = (float)Math.Atan2(num1, num) - MathHelper.PiOver2; if (CalamityWorld.downedSCal) //after first time you kill her { @@ -877,7 +875,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.dontTakeDamage = true; return; } - if (!gettingTired5 && ((double)npc.life <= (double)npc.lifeMax * 0.01)) + if (!gettingTired5 && (npc.life <= npc.lifeMax * 0.01)) { for (int x = 0; x < Main.maxProjectiles; x++) { @@ -901,7 +899,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired5 = true; return; } - else if (!gettingTired4 && ((double)npc.life <= (double)npc.lifeMax * 0.02)) + else if (!gettingTired4 && (npc.life <= npc.lifeMax * 0.02)) { string key = "Mods.CalamityMod.SupremeBossText23"; Color messageColor = Color.Orange; @@ -916,7 +914,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired4 = true; return; } - else if (!gettingTired3 && ((double)npc.life <= (double)npc.lifeMax * 0.04)) + else if (!gettingTired3 && (npc.life <= npc.lifeMax * 0.04)) { string key = "Mods.CalamityMod.SupremeBossText22"; Color messageColor = Color.Orange; @@ -931,7 +929,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired3 = true; return; } - else if (!gettingTired2 && ((double)npc.life <= (double)npc.lifeMax * 0.06)) + else if (!gettingTired2 && (npc.life <= npc.lifeMax * 0.06)) { string key = "Mods.CalamityMod.SupremeBossText21"; Color messageColor = Color.Orange; @@ -946,7 +944,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired2 = true; return; } - else if (!gettingTired && ((double)npc.life <= (double)npc.lifeMax * 0.08)) + else if (!gettingTired && (npc.life <= npc.lifeMax * 0.08)) { string key = "Mods.CalamityMod.SupremeBossText20"; Color messageColor = Color.Orange; @@ -1008,7 +1006,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region TransformSeekerandBrotherTriggers - if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.4)) + if (!halfLife && (npc.life <= npc.lifeMax * 0.4)) { string key = "Mods.CalamityMod.SupremeBossText"; Color messageColor = Color.Orange; @@ -1023,7 +1021,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas halfLife = true; } - if ((double)npc.life <= (double)npc.lifeMax * 0.2) + if (npc.life <= npc.lifeMax * 0.2) { if (secondStage == false) { @@ -1054,16 +1052,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (bossLife == 0f && npc.life > 0) { - bossLife = (float)npc.lifeMax; + bossLife = npc.lifeMax; } if (npc.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.55); - if ((float)(npc.life + num660) < bossLife) + int num660 = (int)(npc.lifeMax * 0.55); + if ((npc.life + num660) < bossLife) { - bossLife = (float)npc.life; + bossLife = npc.life; NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); string key = "Mods.CalamityMod.SupremeBossText6"; @@ -1082,26 +1080,26 @@ namespace CalamityMod.NPCs.SupremeCalamitas #endregion #region TargetandRotation - float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; + 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 += 6.283f; - else if ((double)num803 > 6.283) - num803 -= 6.283f; + num803 += MathHelper.TwoPi; + else if (num803 > MathHelper.TwoPi) + num803 -= MathHelper.TwoPi; float num804 = 0.1f; if (npc.rotation < num803) { - if ((double)(num803 - npc.rotation) > 3.1415) + if ((num803 - npc.rotation) > MathHelper.Pi) npc.rotation -= num804; else npc.rotation += num804; } else if (npc.rotation > num803) { - if ((double)(npc.rotation - num803) > 3.1415) + if ((npc.rotation - num803) > MathHelper.Pi) npc.rotation += num804; else npc.rotation -= num804; @@ -1111,9 +1109,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.rotation = num803; if (npc.rotation < 0f) - npc.rotation += 6.283f; - else if ((double)npc.rotation > 6.283) - npc.rotation -= 6.283f; + 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; @@ -1140,7 +1138,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num740 = player.Center.X - vectorCenter.X; float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; return; } else @@ -1241,7 +1239,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas break; } - npc.ai[1] = (float)phase; + npc.ai[1] = phase; npc.ai[2] = 0f; npc.ai[3] = 0f; } @@ -1252,10 +1250,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num823 = 12f; float num824 = 0.12f; - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num825 = player.position.X + (player.width / 2) - vector82.X; + float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; + float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num823 / num827; num825 *= num827; @@ -1297,10 +1295,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.netUpdate = true; } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num825 = player.position.X + (player.width / 2) - vector82.X; + num826 = player.position.Y + (player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2(num826, num825) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1311,11 +1309,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num828 = 10f * uDieLul; int num829 = expertMode ? 150 : 200; //600 400 - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num828 / num183; num180 *= num183; @@ -1328,7 +1326,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; num825 *= num827; num826 *= num827; @@ -1340,7 +1338,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; num825 *= num827; num826 *= num827; @@ -1354,10 +1352,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas randomShot = ModContent.ProjectileType(); for (int num186 = 0; num186 < 8; num186++) { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - float speedBoost = (float)(num186 > 3 ? -(num186 - 3) : num186); + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float speedBoost = num186 > 3 ? -(num186 - 3) : num186; num183 = (8f + speedBoost) / num183; num180 *= num183; num182 *= num183; @@ -1371,21 +1369,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.rotation = num803; float num383 = wormAlive ? 26f : 30f; - if ((double)npc.life < (double)npc.lifeMax * 0.95) + if (npc.life < npc.lifeMax * 0.95) num383 += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.85) + if (npc.life < npc.lifeMax * 0.85) num383 += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.7) + if (npc.life < npc.lifeMax * 0.7) num383 += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.6) + if (npc.life < npc.lifeMax * 0.6) num383 += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) + if (npc.life < npc.lifeMax * 0.5) num383 += 1f; - Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num384 = player.position.X + (float)(player.width / 2) - vector37.X; - float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; - float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); + Vector2 vector37 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num384 = player.position.X + (player.width / 2) - vector37.X; + float num385 = player.position.Y + (player.height / 2) - vector37.Y; + float num386 = (float)Math.Sqrt(num384 * num384 + num385 * num385); num386 = num383 / num386; if (!canDespawn) @@ -1405,14 +1403,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.velocity *= 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) npc.velocity.Y = 0f; } } else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; if (npc.ai[2] >= 70f) { @@ -1433,13 +1431,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num413 = 1.2f; int num414 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; - float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num415 = player.position.X + (player.width / 2) + (num414 * 600) - vector40.X; + float num416 = player.position.Y + (player.height / 2) - vector40.Y; + float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num412 / num417; num415 *= num417; @@ -1489,16 +1487,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.ai[3] >= 20f) { npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num415 = player.position.X + (float)(player.width / 2) - vector40.X; - num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num415 = player.position.X + (player.width / 2) - vector40.X; + num416 = player.position.Y + (player.height / 2) - vector40.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { float num418 = 10f * uDieLul; int num419 = expertMode ? 150 : 200; //600 500 int num420 = ModContent.ProjectileType(); - num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num418 / num417; num415 *= num417; num416 *= num417; @@ -1512,16 +1510,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas else if (npc.ai[1] == 4f) { int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num831 = -1; float num832 = 32f; float num833 = 1.2f; - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + Vector2 vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 + float num835 = player.position.Y + (player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num832 / num836; num834 *= num836; @@ -1555,10 +1553,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num834 = player.position.X + (player.width / 2) - vector83.X; + num835 = player.position.Y + (player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2(num835, num834) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1569,7 +1567,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num837 = 5f * uDieLul; int num838 = expertMode ? 150 : 200; //600 500 int num839 = ModContent.ProjectileType(); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num837 / num836; num834 *= num836; num835 *= num836; @@ -1589,7 +1587,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if ((double)npc.life < (double)npc.lifeMax * 0.4) + if (npc.life < npc.lifeMax * 0.4) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -1608,7 +1606,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.ai[0] == 1f) { npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) + if (npc.ai[2] > 0.5) npc.ai[2] = 0.5f; } else @@ -1631,21 +1629,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas else { for (int num388 = 0; num388 < 50; num388++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); } } - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); if (!canDespawn) { npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) npc.velocity.Y = 0f; } } @@ -1764,7 +1762,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas break; } - npc.ai[1] = (float)phase; + npc.ai[1] = phase; npc.ai[2] = 0f; npc.ai[3] = 0f; } @@ -1775,10 +1773,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num823 = 12f; float num824 = 0.12f; - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num825 = player.position.X + (player.width / 2) - vector82.X; + float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; + float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num823 / num827; num825 *= num827; @@ -1821,10 +1819,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.netUpdate = true; } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num825 = player.position.X + (player.width / 2) - vector82.X; + num826 = player.position.Y + (player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2(num826, num825) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1835,11 +1833,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num828 = 10f * uDieLul; int num829 = expertMode ? 150 : 200; //600 500 - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num828 / num183; num180 *= num183; @@ -1852,7 +1850,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; num825 *= num827; num826 *= num827; @@ -1864,7 +1862,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; num825 *= num827; num826 *= num827; @@ -1878,10 +1876,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas randomShot = ModContent.ProjectileType(); for (int num186 = 0; num186 < 8; num186++) { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - float speedBoost = (float)(num186 > 3 ? -(num186 - 3) : num186); + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float speedBoost = num186 > 3 ? -(num186 - 3) : num186; num183 = (8f + speedBoost) / num183; num180 *= num183; num182 *= num183; @@ -1895,17 +1893,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.rotation = num803; float num383 = wormAlive ? 31f : 35f; - if ((double)npc.life < (double)npc.lifeMax * 0.3) + if (npc.life < npc.lifeMax * 0.3) num383 += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.2) + if (npc.life < npc.lifeMax * 0.2) num383 += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.1) + if (npc.life < npc.lifeMax * 0.1) num383 += 1f; - Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num384 = player.position.X + (float)(player.width / 2) - vector37.X; - float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; - float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); + Vector2 vector37 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num384 = player.position.X + (player.width / 2) - vector37.X; + float num385 = player.position.Y + (player.height / 2) - vector37.Y; + float num386 = (float)Math.Sqrt(num384 * num384 + num385 * num385); num386 = num383 / num386; if (!canDespawn) @@ -1925,14 +1923,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.velocity *= 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) npc.velocity.Y = 0f; } } else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; if (npc.ai[2] >= 70f) { @@ -1952,13 +1950,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num412 = 32f; float num413 = 1.2f; int num414 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; - float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num415 = player.position.X + (player.width / 2) + (num414 * 600) - vector40.X; + float num416 = player.position.Y + (player.height / 2) - vector40.Y; + float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num412 / num417; num415 *= num417; @@ -2008,16 +2006,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.ai[3] >= 24f) { npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num415 = player.position.X + (float)(player.width / 2) - vector40.X; - num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num415 = player.position.X + (player.width / 2) - vector40.X; + num416 = player.position.Y + (player.height / 2) - vector40.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { float num418 = 10f * uDieLul; int num419 = expertMode ? 150 : 200; //600 500 int num420 = ModContent.ProjectileType(); - num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num418 / num417; num415 *= num417; num416 *= num417; @@ -2031,16 +2029,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas else if (npc.ai[1] == 4f) { int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num831 = -1; float num832 = 32f; float num833 = 1.2f; - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + Vector2 vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 + float num835 = player.position.Y + (player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num832 / num836; num834 *= num836; @@ -2074,10 +2072,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num834 = player.position.X + (player.width / 2) - vector83.X; + num835 = player.position.Y + (player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2(num835, num834) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -2088,7 +2086,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num837 = 5f * uDieLul; int num838 = expertMode ? 150 : 200; //600 500 int num839 = ModContent.ProjectileType(); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num837 / num836; num834 *= num836; num835 *= num836; @@ -2283,7 +2281,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = npc.ai[0] > 1f ? ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitas2") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 7; @@ -2295,16 +2293,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas Color color38 = lightColor; 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 - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -2317,9 +2315,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { 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 - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } @@ -2338,12 +2336,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 100; npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(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++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); @@ -2351,7 +2349,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 83849aeff2..8e2cd94508 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -21,13 +21,9 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Utilities; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Yharon { @@ -156,7 +152,7 @@ namespace CalamityMod.NPCs.Yharon public override void AI() { // Disable loot drop - dropLoot = (double)npc.life <= (double)npc.lifeMax * 0.1; + dropLoot = npc.life <= npc.lifeMax * 0.1; // Stop rain CalamityMod.StopRain(); @@ -235,10 +231,10 @@ namespace CalamityMod.NPCs.Yharon } // Phase bools - bool phase2Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.8 : 0.7); - bool phase3Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.5 : 0.4); - bool phase4Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.25 : 0.2); - bool phase5Check = (double)npc.life <= (double)npc.lifeMax * 0.1; + bool phase2Check = npc.life <= npc.lifeMax * (revenge ? 0.8 : 0.7); + bool phase3Check = npc.life <= npc.lifeMax * (revenge ? 0.5 : 0.4); + bool phase4Check = npc.life <= npc.lifeMax * (revenge ? 0.25 : 0.2); + bool phase5Check = npc.life <= npc.lifeMax * 0.1; bool phase2Change = npc.ai[0] > 5f; bool phase3Change = npc.ai[0] > 12f; bool phase4Change = npc.ai[0] > 20f; @@ -328,7 +324,7 @@ namespace CalamityMod.NPCs.Yharon int num1461 = 120; int num1462 = 4; float scaleFactor13 = 20f; - float num1463 = MathHelper.TwoPi / (float)(num1461 / 2); + float num1463 = MathHelper.TwoPi / (num1461 / 2); int num1464 = 75; // Center and target @@ -537,7 +533,7 @@ namespace CalamityMod.NPCs.Yharon for (int num1469 = 0; num1469 < num1468; num1469++) { 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, default) + npc.Center; + 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; @@ -564,7 +560,7 @@ namespace CalamityMod.NPCs.Yharon npc.dontTakeDamage = false; if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + npc.ai[1] = 300 * Math.Sign((vectorCenter - player.Center).X); Vector2 value17 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * scaleFactor; @@ -608,7 +604,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) + if (npc.ai[2] >= aiChangeRate) { int aiState = 0; switch ((int)npc.ai[3]) //0 2 4 6 1 3 5 7 repeat @@ -643,7 +639,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = 0f; npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1471 != 0) { @@ -680,7 +676,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = 0f; npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1471 != 0) { @@ -701,9 +697,9 @@ namespace CalamityMod.NPCs.Yharon int num1473 = 7; for (int num1474 = 0; num1474 < num1473; num1474++) { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * (double)pie / (double)(float)num1473, default) + vectorCenter; - Vector2 value18 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector171 = vector171.RotatedBy((num1474 - (num1473 / 2 - 1)) * (double)pie / (float)num1473) + vectorCenter; + 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; @@ -712,7 +708,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -724,7 +720,7 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 2f) //fireball attack { if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + npc.ai[1] = 300 * Math.Sign((vectorCenter - player.Center).X); Vector2 value19 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; Vector2 vector172 = Vector2.Normalize(value19 - npc.velocity) * scaleFactor11; @@ -756,13 +752,13 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] % (float)num1455 == 0f) //fire flare bombs from mouth + if (npc.ai[2] % num1455 == 0f) //fire flare bombs from mouth { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; if (NPC.CountNPCS(ModContent.NPCType()) < flareCount) NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); @@ -784,7 +780,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1454) + if (npc.ai[2] >= num1454) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -797,17 +793,17 @@ namespace CalamityMod.NPCs.Yharon npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) + if (npc.ai[2] == num1457 - 30) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num1457 - 30) { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(npc.direction * 2), 8f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); //changed - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(-(float)npc.direction * 2), 8f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); //changed + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, npc.direction * 2, 8f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); //changed + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, -(float)npc.direction * 2, 8f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); //changed } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) + if (npc.ai[2] >= num1457) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -822,11 +818,11 @@ namespace CalamityMod.NPCs.Yharon npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1458 - 60)) + if (npc.ai[2] == num1458 - 60) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1458) + if (npc.ai[2] >= num1458) { npc.ai[0] = 6f; npc.ai[1] = 0f; @@ -840,9 +836,9 @@ namespace CalamityMod.NPCs.Yharon int num1473 = 14; for (int num1474 = 0; num1474 < num1473; num1474++) { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * (double)pie / (double)(float)num1473, default) + vectorCenter; - Vector2 value18 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector171 = vector171.RotatedBy((num1474 - (num1473 / 2 - 1)) * pie / (double)num1473) + vectorCenter; + 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); //changed Main.dust[num1475].noGravity = true; Main.dust[num1475].noLight = true; @@ -851,7 +847,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime2) + if (npc.ai[2] >= chargeTime2) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -868,7 +864,7 @@ namespace CalamityMod.NPCs.Yharon npc.dontTakeDamage = false; if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + npc.ai[1] = 300 * Math.Sign((vectorCenter - player.Center).X); Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; @@ -912,7 +908,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) + if (npc.ai[2] >= aiChangeRate) { int aiState = 0; switch ((int)npc.ai[3]) //0 2 4 6 8 1 3 5 7 9 repeat @@ -951,7 +947,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = 0f; npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) { @@ -966,7 +962,7 @@ namespace CalamityMod.NPCs.Yharon else if (aiState == 2) { npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) { @@ -1001,7 +997,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = 0f; npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) { @@ -1016,7 +1012,7 @@ namespace CalamityMod.NPCs.Yharon else if (aiState == 6) { npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) { @@ -1041,9 +1037,9 @@ namespace CalamityMod.NPCs.Yharon int num1479 = 7; for (int num1480 = 0; num1480 < num1479; num1480++) { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * (double)pie / (double)(float)num1479, default) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector176 = vector176.RotatedBy((num1480 - (num1479 / 2 - 1)) * pie / (double)num1479) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); //changed Main.dust[num1481].noGravity = true; Main.dust[num1481].noLight = true; @@ -1052,7 +1048,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { npc.ai[0] = 6f; npc.ai[1] = 0f; @@ -1066,26 +1062,26 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] % (float)num1462 == 0f) + if (npc.ai[2] % num1462 == 0f) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; if (NPC.CountNPCS(ModContent.NPCType()) < flareCount) NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-400, 401) * 0.13f, (float)Main.rand.Next(-30, 31) * 0.13f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, Main.rand.Next(-400, 401) * 0.13f, Main.rand.Next(-30, 31) * 0.13f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); } } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); - npc.rotation -= num1463 * (float)npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)num1463 * (float)npc.direction); + npc.rotation -= num1463 * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) + if (npc.ai[2] >= num1461) { npc.ai[0] = 6f; npc.ai[1] = 0f; @@ -1098,14 +1094,14 @@ namespace CalamityMod.NPCs.Yharon npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) + if (npc.ai[2] == num1457 - 30) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num1457 - 30) + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) + if (npc.ai[2] >= num1457) { npc.ai[0] = 6f; npc.ai[1] = 0f; @@ -1120,11 +1116,11 @@ namespace CalamityMod.NPCs.Yharon npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1459 - 60)) + if (npc.ai[2] == num1459 - 60) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1459) + if (npc.ai[2] >= num1459) { npc.ai[0] = 13f; npc.ai[1] = 0f; @@ -1138,9 +1134,9 @@ namespace CalamityMod.NPCs.Yharon int num1479 = 14; for (int num1480 = 0; num1480 < num1479; num1480++) { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * (double)pie / (double)(float)num1479, default) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * pie / (float)num1479) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); //changed Main.dust[num1481].noGravity = true; Main.dust[num1481].noLight = true; @@ -1149,7 +1145,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime2) + if (npc.ai[2] >= chargeTime2) { npc.ai[0] = 6f; npc.ai[1] = 0f; @@ -1163,19 +1159,19 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] % (float)num1462 == 0f) + if (npc.ai[2] % num1462 == 0f) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { int damage = expertMode ? 75 : 90; - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float playerX = player.position.X + (float)player.width * 0.5f - vectorShoot.X; + Vector2 vectorShoot = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f + 30f); + float playerX = player.position.X + player.width * 0.5f - vectorShoot.X; float playerY = player.position.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + float playerXY = (float)Math.Sqrt(playerX * playerX + playerY * playerY); playerXY = speed / playerXY; playerX *= playerXY; playerY *= playerXY; @@ -1183,11 +1179,11 @@ namespace CalamityMod.NPCs.Yharon } } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); - npc.rotation -= num1463 * (float)npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)num1463 * (float)npc.direction); + npc.rotation -= num1463 * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) + if (npc.ai[2] >= num1461) { npc.ai[0] = 6f; npc.ai[1] = 0f; @@ -1204,7 +1200,7 @@ namespace CalamityMod.NPCs.Yharon npc.dontTakeDamage = phase5Check; if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + npc.ai[1] = 300 * Math.Sign((vectorCenter - player.Center).X); Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; @@ -1248,7 +1244,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) + if (npc.ai[2] >= aiChangeRate) { int aiState = 0; switch ((int)npc.ai[3]) //0 2 4 6 8 9 1 3 5 7 10 repeat @@ -1290,7 +1286,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = 0f; npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) { @@ -1305,7 +1301,7 @@ namespace CalamityMod.NPCs.Yharon else if (aiState == 2) { npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) { @@ -1340,7 +1336,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = 0f; npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) { @@ -1355,7 +1351,7 @@ namespace CalamityMod.NPCs.Yharon else if (aiState == 6) { npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) { @@ -1388,9 +1384,9 @@ namespace CalamityMod.NPCs.Yharon int num1479 = 7; for (int num1480 = 0; num1480 < num1479; num1480++) { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * (double)pie / (double)(float)num1479, default) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * pie / (float)num1479) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); Main.dust[num1481].noGravity = true; Main.dust[num1481].noLight = true; @@ -1399,7 +1395,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { npc.ai[0] = 13f; npc.ai[1] = 0f; @@ -1415,27 +1411,27 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] % (float)num1462 == 0f) + if (npc.ai[2] % num1462 == 0f) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; if (NPC.CountNPCS(ModContent.NPCType()) < flareCount && NPC.CountNPCS(ModContent.NPCType()) < flareCount) NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, Main.rand.NextBool(2) ? ModContent.NPCType() : ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-401, 401) * 0.13f, (float)Main.rand.Next(-31, 31) * 0.13f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); //changed - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-31, 31) * 0.13f, (float)Main.rand.Next(-151, 151) * 0.13f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); //changed + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, Main.rand.Next(-401, 401) * 0.13f, Main.rand.Next(-31, 31) * 0.13f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); //changed + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, Main.rand.Next(-31, 31) * 0.13f, Main.rand.Next(-151, 151) * 0.13f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); //changed } } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); - npc.rotation -= num1463 * (float)npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)num1463 * (float)npc.direction); + npc.rotation -= num1463 * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) + if (npc.ai[2] >= num1461) { npc.ai[0] = 13f; npc.ai[1] = 0f; @@ -1450,14 +1446,14 @@ namespace CalamityMod.NPCs.Yharon npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) + if (npc.ai[2] == num1457 - 30) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num1457 - 30) + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) + if (npc.ai[2] >= num1457) { npc.ai[0] = 13f; npc.ai[1] = 0f; @@ -1470,7 +1466,7 @@ namespace CalamityMod.NPCs.Yharon { npc.dontTakeDamage = true; - if (npc.ai[2] < (float)(num1459 - 90)) + if (npc.ai[2] < num1459 - 90) { bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); @@ -1495,11 +1491,11 @@ namespace CalamityMod.NPCs.Yharon npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1459 - 60)) + if (npc.ai[2] == num1459 - 60) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1459) + if (npc.ai[2] >= num1459) { npc.ai[0] = 21f; npc.ai[1] = 0f; @@ -1515,9 +1511,9 @@ namespace CalamityMod.NPCs.Yharon int num1479 = 14; for (int num1480 = 0; num1480 < num1479; num1480++) { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * (double)pie / (double)(float)num1479, default) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector176 = vector176.RotatedBy((num1480 - (num1479 / 2 - 1)) * (double)pie / (float)num1479) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default, 1.4f); Main.dust[num1481].noGravity = true; Main.dust[num1481].noLight = true; @@ -1526,7 +1522,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime2) + if (npc.ai[2] >= chargeTime2) { npc.ai[0] = 13f; npc.ai[1] = 0f; @@ -1542,19 +1538,19 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] % (float)num1462 == 0f) + if (npc.ai[2] % num1462 == 0f) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { int damage = expertMode ? 75 : 90; - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float playerX = player.position.X + (float)player.width * 0.5f - vectorShoot.X; + Vector2 vectorShoot = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f + 30f); + float playerX = player.position.X + player.width * 0.5f - vectorShoot.X; float playerY = player.position.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + float playerXY = (float)Math.Sqrt(playerX * playerX + playerY * playerY); playerXY = speed / playerXY; playerX *= playerXY; playerY *= playerXY; @@ -1562,11 +1558,11 @@ namespace CalamityMod.NPCs.Yharon } } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default); - npc.rotation -= num1463 * (float)npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)num1463 * (float)npc.direction); + npc.rotation -= num1463 * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) + if (npc.ai[2] >= num1461) { npc.ai[0] = 13f; npc.ai[1] = 0f; @@ -1582,22 +1578,22 @@ namespace CalamityMod.NPCs.Yharon npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) + if (npc.ai[2] == num1457 - 30) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); if (death) { - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num1457 - 30) + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); } else { - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num1457 - 30)) - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num1457 - 30) + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) + if (npc.ai[2] >= num1457) { npc.ai[0] = 13f; npc.ai[1] = 0f; @@ -1625,7 +1621,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 360 * Math.Sign((vectorCenter - player.Center).X); } - Vector2 value7 = player.Center + new Vector2(npc.ai[1], (float)teleportLocation) - vectorCenter; //teleport distance + Vector2 value7 = player.Center + new Vector2(npc.ai[1], teleportLocation) - vectorCenter; //teleport distance Vector2 desiredVelocity = Vector2.Normalize(value7 - npc.velocity) * scaleFactor; npc.SimpleFlyMovement(desiredVelocity, npcVelocity); @@ -1729,7 +1725,7 @@ namespace CalamityMod.NPCs.Yharon for (int m = 0; m < num34; m++) { Vector2 vector11 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; - vector11 = vector11.RotatedBy((m - (num34 / 2 - 1)) * pie / num34, default) + vectorCenter; + vector11 = vector11.RotatedBy((m - (num34 / 2 - 1)) * pie / num34) + vectorCenter; Vector2 value8 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num35 = Dust.NewDust(vector11 + value8, 0, 0, 244, value8.X * 2f, value8.Y * 2f, 100, default, 1.4f); Main.dust[num35].noGravity = true; @@ -1837,9 +1833,9 @@ namespace CalamityMod.NPCs.Yharon #region AI2 public void Yharon_AI2(bool expertMode, bool revenge, bool death, float pie) { - bool phase2 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.85 : 0.75); - bool phase3 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.6 : 0.5); - bool phase4 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.2 : 0.1); + bool phase2 = npc.life <= npc.lifeMax * (revenge ? 0.85 : 0.75); + bool phase3 = npc.life <= npc.lifeMax * (revenge ? 0.6 : 0.5); + bool phase4 = npc.life <= npc.lifeMax * (revenge ? 0.2 : 0.1); if (npc.ai[0] != 8f) { @@ -1939,7 +1935,7 @@ namespace CalamityMod.NPCs.Yharon npc.damage = npc.defDamage; if (phase4) - npc.damage = (int)((float)npc.defDamage * 1.1f); + npc.damage = (int)(npc.defDamage * 1.1f); } // Set DR based on protection boost (aka enrage) @@ -1949,7 +1945,7 @@ namespace CalamityMod.NPCs.Yharon float num2 = 1f; int num4 = expertMode ? 110 : 125; if (phase4) - num4 = (int)((double)num4 * 1.1); + num4 = (int)(num4 * 1.1); float num6 = 0.575f; float scaleFactor = 10f; @@ -1965,7 +1961,7 @@ namespace CalamityMod.NPCs.Yharon int num16 = 10; int num17 = 6 * num16; float num18 = 60f; - float num19 = num15 + (float)num17 + num18; + float num19 = num15 + num17 + num18; float num20 = 60f; float num22 = MathHelper.TwoPi * (1f / num20); float scaleFactor5 = 37.25f; @@ -2010,7 +2006,7 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 1f) { if (npc.ai[2] == 0f) - npc.ai[2] = (float)((npc.Center.X < targetData.Center.X) ? 1 : -1); + npc.ai[2] = (npc.Center.X < targetData.Center.X) ? 1 : -1; Vector2 destination = targetData.Center + new Vector2(-npc.ai[2] * 300f, -200f); Vector2 desiredVelocity = npc.DirectionTo(destination) * scaleFactor; @@ -2165,7 +2161,7 @@ namespace CalamityMod.NPCs.Yharon } } - npc.ai[0] = (float)num28; + npc.ai[0] = num28; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 1f; @@ -2234,7 +2230,7 @@ namespace CalamityMod.NPCs.Yharon } case 3: //fireballs { - Vector2 vector2 = new Vector2((float)((targetData.Center.X > npc.Center.X) ? 1 : -1), 0f); + Vector2 vector2 = new Vector2((targetData.Center.X > npc.Center.X) ? 1 : -1, 0f); npc.spriteDirection = (vector2.X > 0f) ? 1 : -1; npc.velocity = vector2 * -2f; @@ -2277,9 +2273,9 @@ namespace CalamityMod.NPCs.Yharon int num1473 = 7; for (int num1474 = 0; num1474 < num1473; num1474++) { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * (double)pie / (double)(float)num1473, default) + npc.Center; - Vector2 value18 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * pie / (float)num1473) + 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; @@ -2298,12 +2294,12 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 3f) //fireball spit { int num29 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.ai[2] = (float)num29; + npc.ai[2] = num29; npc.ai[1] += 1f; if (npc.ai[1] < num11) { - Vector2 vector4 = targetData.Center + new Vector2((float)num29 * -600f, -250f); + Vector2 vector4 = targetData.Center + new Vector2(num29 * -600f, -250f); Vector2 value = npc.DirectionTo(vector4) * 12f; if (npc.Distance(vector4) < 12f) @@ -2320,7 +2316,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] == num11) { int num30 = (targetData.Center.X > npc.Center.X) ? 1 : -1; - npc.velocity = new Vector2((float)num30, 0f) * 22f; //10f + npc.velocity = new Vector2(num30, 0f) * 22f; //10f npc.direction = npc.spriteDirection = num30; } @@ -2329,12 +2325,12 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] % 8 == 0 && Main.netMode != NetmodeID.MultiplayerClient) { float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, default); + Vector2 position = npc.Center + new Vector2((110f + num33) * npc.direction, -20f).RotatedBy(npc.rotation); float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + Vector2 vectorShoot = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f + 30f); float playerX = targetData.Center.X - vectorShoot.X; float playerY = targetData.Center.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + float playerXY = (float)Math.Sqrt(playerX * playerX + playerY * playerY); playerXY = speed / playerXY; playerX *= playerXY; playerY *= playerXY; @@ -2344,7 +2340,7 @@ namespace CalamityMod.NPCs.Yharon num2 = 1.5f; if (Math.Abs(targetData.Center.X - npc.Center.X) > 550f && Math.Abs(npc.velocity.X) < 20f) - npc.velocity.X += (float)Math.Sign(npc.velocity.X) * 0.5f; + npc.velocity.X += Math.Sign(npc.velocity.X) * 0.5f; } if (npc.ai[1] >= num13) @@ -2357,11 +2353,11 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 4f) //fireball spit { int num31 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.ai[2] = (float)num31; + npc.ai[2] = num31; if (npc.ai[1] < num15) { - Vector2 vector5 = targetData.Center + new Vector2((float)num31 * -1500f, -350f); + Vector2 vector5 = targetData.Center + new Vector2(num31 * -1500f, -350f); Vector2 value2 = npc.DirectionTo(vector5) * scaleFactor3; npc.velocity = Vector2.Lerp(npc.velocity, value2, 0.0333333351f); @@ -2378,7 +2374,7 @@ namespace CalamityMod.NPCs.Yharon { Vector2 vector6 = npc.DirectionTo(targetData.Center); vector6.Y *= 0.25f; - vector6 = vector6.SafeNormalize(Vector2.UnitX * (float)npc.direction); + vector6 = vector6.SafeNormalize(Vector2.UnitX * npc.direction); npc.spriteDirection = (vector6.X > 0f) ? 1 : -1; npc.rotation = vector6.ToRotation(); @@ -2397,7 +2393,7 @@ namespace CalamityMod.NPCs.Yharon num2 = 1.5f; float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, default); + Vector2 position = npc.Center + new Vector2((110f + num33) * npc.direction, -20f).RotatedBy(npc.rotation); int num34 = (int)(npc.ai[1] - num15 + 1f); if (num34 <= num17 && num34 % num16 == 0 && Main.netMode != NetmodeID.MultiplayerClient) @@ -2417,12 +2413,12 @@ namespace CalamityMod.NPCs.Yharon } else if (npc.ai[0] == 5f) //spin 2 win { - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num22 * (float)npc.direction), default); + npc.velocity = npc.velocity.RotatedBy(-(double)num22 * (float)npc.direction); npc.position.Y = npc.position.Y - 0.1f; npc.position += npc.DirectionTo(targetData.Center) * 10f; - npc.rotation -= num22 * (float)npc.direction; + npc.rotation -= num22 * npc.direction; num2 *= 0.7f; @@ -2435,16 +2431,16 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] % 12 == 0) { float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, default); + Vector2 position = npc.Center + new Vector2((110f + num33) * npc.direction, -20f).RotatedBy(npc.rotation); Projectile.NewProjectile(position, npc.velocity, ModContent.ProjectileType(), num4, 0f, Main.myPlayer, 0f, 0f); if (phase4) { float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + Vector2 vectorShoot = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f + 30f); float playerX = targetData.Center.X - vectorShoot.X; float playerY = targetData.Center.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + float playerXY = (float)Math.Sqrt(playerX * playerX + playerY * playerY); playerXY = speed / playerXY; playerX *= playerXY; playerY *= playerXY; @@ -2455,7 +2451,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] == 45f && phase4 && useTornado) { useTornado = false; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); } } @@ -2533,7 +2529,7 @@ namespace CalamityMod.NPCs.Yharon { if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); Boom(600, num4); } @@ -2550,9 +2546,9 @@ namespace CalamityMod.NPCs.Yharon int num1473 = 7; for (int num1474 = 0; num1474 < num1473; num1474++) { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * (double)pie / (double)(float)num1473, default) + npc.Center; - Vector2 value18 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * pie / (float)num1473) + 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; @@ -2588,10 +2584,10 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 15f) { if (npc.ai[1] == 0f) - npc.ai[1] = (float)(450 * Math.Sign((npcCenter - targetData.Center).X)); + npc.ai[1] = 450 * Math.Sign((npcCenter - targetData.Center).X); teleportLocation = Main.rand.NextBool(2) ? (revenge ? 500 : 600) : (revenge ? -500 : -600); - Vector2 center = targetData.Center + new Vector2(-npc.ai[1], (float)teleportLocation); //teleport distance + Vector2 center = targetData.Center + new Vector2(-npc.ai[1], teleportLocation); //teleport distance npcCenter = npc.Center = center; } @@ -2658,7 +2654,7 @@ namespace CalamityMod.NPCs.Yharon npc.localAI[0] = 0f; if (num != -1) - npc.localAI[0] = (float)(num * 4); + npc.localAI[0] = num * 4; npc.localAI[1] += 1f; if (npc.localAI[1] >= 60f) @@ -2685,7 +2681,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] >= num11) { - num42 += (float)npc.spriteDirection * pie / 12f; + num42 += npc.spriteDirection * pie / 12f; num43 = 0.05f; } @@ -2734,7 +2730,7 @@ namespace CalamityMod.NPCs.Yharon spriteEffects = ai2 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Texture2D texture = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[npc.type] / 2); Color color = lightColor; Color invincibleColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); Color color36 = Color.White; @@ -2753,10 +2749,10 @@ namespace CalamityMod.NPCs.Yharon color = CalamityGlobalNPC.buffColor(color, 0.8f, 0.7f, 0.4f, 1f); else if (flag8) color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.5f, 1f); - else if (npc.ai[0] == 4f && npc.ai[2] > (float)num150) + else if (npc.ai[0] == 4f && npc.ai[2] > num150) { - float num152 = npc.ai[2] - (float)num150; - num152 /= (float)num151; + 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); } @@ -2784,9 +2780,9 @@ namespace CalamityMod.NPCs.Yharon 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 - Main.screenPosition; - vector41 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } @@ -2803,19 +2799,19 @@ namespace CalamityMod.NPCs.Yharon { int num158 = 60; int num159 = 30; - if (npc.ai[2] > (float)num158) + if (npc.ai[2] > num158) { num156 = 6; - num157 = 1f - (float)Math.Cos((double)((npc.ai[2] - (float)num158) / (float)num159 * MathHelper.TwoPi)); + num157 = 1f - (float)Math.Cos((npc.ai[2] - num158) / num159 * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 40f; } } - if (newPhasePhase && npc.ai[2] > (float)num150) + if (newPhasePhase && npc.ai[2] > num150) { num156 = 6; - num157 = 1f - (float)Math.Cos((double)((npc.ai[2] - (float)num150) / (float)num151 * MathHelper.TwoPi)); + num157 = 1f - (float)Math.Cos((npc.ai[2] - num150) / num151 * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 60f; } @@ -2823,7 +2819,7 @@ namespace CalamityMod.NPCs.Yharon if (pauseAfterTeleportPhase) { num156 = 6; - num157 = 1f - (float)Math.Cos((double)(npc.ai[2] / 30f * MathHelper.TwoPi)); + num157 = 1f - (float)Math.Cos(npc.ai[2] / 30f * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 20f; } @@ -2836,15 +2832,15 @@ namespace CalamityMod.NPCs.Yharon 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 - Main.screenPosition; - vector42 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + Vector2 vector42 = npc.Center + (num160 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector42 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector42 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture, vector42, npc.frame, color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture, vector43, npc.frame, (invincible ? invincibleColor : npc.GetAlpha(lightColor)), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -2869,8 +2865,8 @@ namespace CalamityMod.NPCs.Yharon if (newPhasePhase) { - float num161 = npc.ai[2] - (float)num150; - num161 /= (float)num151; + float num161 = npc.ai[2] - num150; + num161 /= num151; color36 *= num161; color40 *= num161; @@ -2911,9 +2907,9 @@ namespace CalamityMod.NPCs.Yharon { 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 - Main.screenPosition; - vector44 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -2921,7 +2917,7 @@ namespace CalamityMod.NPCs.Yharon { Color color47 = color43; color47 = Color.Lerp(color47, color44, amount9); - color47 *= (float)(num153 - num163) / 15f; + color47 *= (num153 - num163) / 15f; spriteBatch.Draw(texture2, vector44, npc.frame, color47, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } @@ -2929,7 +2925,7 @@ namespace CalamityMod.NPCs.Yharon { Color color48 = color45; color48 = Color.Lerp(color48, color46, amount9); - color48 *= (float)(num153 - num163) / 15f; + color48 *= (num153 - num163) / 15f; spriteBatch.Draw(texture3, vector44, npc.frame, color48, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -2940,8 +2936,8 @@ namespace CalamityMod.NPCs.Yharon 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 - Main.screenPosition; - vector45 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + Vector2 vector45 = npc.Center + (num164 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector45 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector45 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture, vector45, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -3124,7 +3120,7 @@ namespace CalamityMod.NPCs.Yharon num84 = 4; } npc.frameCounter += 1D; - if (npc.frameCounter > (double)num84) + if (npc.frameCounter > num84) { npc.frameCounter = 0D; npc.frame.Y += frameHeight; @@ -3145,7 +3141,7 @@ namespace CalamityMod.NPCs.Yharon if (tornadoPhase) { int num85 = 90; - if (npc.ai[2] < (float)(num85 - 30) || npc.ai[2] > (float)(num85 - 10)) + if (npc.ai[2] < num85 - 30 || npc.ai[2] > num85 - 10) { npc.frameCounter += 1D; if (npc.frameCounter > 5D) @@ -3161,7 +3157,7 @@ namespace CalamityMod.NPCs.Yharon else { npc.frame.Y = frameHeight * 5; - if (npc.ai[2] > (float)(num85 - 20) && npc.ai[2] < (float)(num85 - 15)) + if (npc.ai[2] > num85 - 20 && npc.ai[2] < num85 - 15) { npc.frame.Y = frameHeight * 6; } @@ -3170,7 +3166,7 @@ namespace CalamityMod.NPCs.Yharon if (newPhasePhase) { int num86 = 180; - if (npc.ai[2] < (float)(num86 - 60) || npc.ai[2] > (float)(num86 - 20)) + if (npc.ai[2] < num86 - 60 || npc.ai[2] > num86 - 20) { npc.frameCounter += 1D; if (npc.frameCounter > 5D) @@ -3186,7 +3182,7 @@ namespace CalamityMod.NPCs.Yharon else { npc.frame.Y = frameHeight * 5; - if (npc.ai[2] > (float)(num86 - 50) && npc.ai[2] < (float)(num86 - 25)) + if (npc.ai[2] > num86 - 50 && npc.ai[2] < num86 - 25) { npc.frame.Y = frameHeight * 6; } @@ -3200,20 +3196,15 @@ namespace CalamityMod.NPCs.Yharon { if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - for (iBoom = 0; iBoom < 25; iBoom++) - { - offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 5f), (float)(Math.Cos(offsetAngleBoom) * 5f), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 5f), (float)(-Math.Cos(offsetAngleBoom) * 5f), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[boom1].timeLeft = timeLeft; - Main.projectile[boom2].timeLeft = timeLeft; - } + float velocity = 5f; + int totalProjectiles = 50; + 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.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = timeLeft; + } } } #endregion @@ -3228,12 +3219,12 @@ namespace CalamityMod.NPCs.Yharon if (npc.life <= 0) { Boom(150, 1000); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 300; npc.height = 280; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(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++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); @@ -3241,7 +3232,7 @@ namespace CalamityMod.NPCs.Yharon if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index b560a73a3a..be5a381b1f 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft < 180) projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 0.5f); Main.dust[num469].noGravity = true; @@ -40,5 +40,10 @@ namespace CalamityMod.Projectiles.Boss { target.AddBuff(ModContent.BuffType(), 120); } - } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + } } diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 894057e551..d737512fcd 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Boss distance += (projectile.ai[1] == 1f ? 2D : 1D); projectile.position.X = startingPosX - (int)(Math.Cos(rad) * distance) - projectile.width / 2; projectile.position.Y = startingPosY - (int)(Math.Sin(rad) * distance) - projectile.height / 2; - projectile.ai[0] += 1f; + projectile.ai[0] += 0.5f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs index d8d9d314dc..4dc786231b 100644 --- a/Projectiles/Boss/DarkOrb.cs +++ b/Projectiles/Boss/DarkOrb.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss bool useSin = projectile.ai[0] == 3f; - WavyMotion(0.1f, 0f, useSin); + WavyMotion(0.1f, 0f, useSin, false); break; @@ -166,9 +166,11 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < 4; i++) + int totalProjectiles = 4; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) { - Vector2 vector = new Vector2(0f, -8f).RotatedBy(MathHelper.PiOver2 * i); + Vector2 vector = new Vector2(0f, -8f).RotatedBy(radians * i); Projectile.NewProjectile(projectile.Center, vector, projectile.type, projectile.damage, 0f, Main.myPlayer, Main.rand.Next(6), 0f); } } @@ -187,9 +189,11 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < 8; i++) + int totalProjectiles = 8; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) { - Vector2 vector = new Vector2(0f, -8f).RotatedBy(MathHelper.PiOver4 * i); + Vector2 vector = new Vector2(0f, -8f).RotatedBy(radians * i); Projectile.NewProjectile(projectile.Center, vector, projectile.type, projectile.damage, 0f, Main.myPlayer, Main.rand.Next(2), 0f); } } @@ -207,7 +211,7 @@ namespace CalamityMod.Projectiles.Boss bool splitThrice = projectile.timeLeft < 450; if (splitOnce) - WavyMotion(0.05f, 2f, true); + WavyMotion(0.05f, 2f, true, true); projectile.localAI[0] += 1f; @@ -215,8 +219,8 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.owner == Main.myPlayer) { - float randomRotation = MathHelper.ToRadians(Main.rand.NextFloat() * 60f); - float radians = MathHelper.TwoPi / 3f + randomRotation; + int totalProjectiles = 3; + float radians = MathHelper.TwoPi / totalProjectiles; int spread = 8; if (splitOnce) @@ -229,7 +233,7 @@ namespace CalamityMod.Projectiles.Boss vector.Normalize(); vector *= 3f; - for (int i = 0; i < 3; i++) + for (int i = 0; i < totalProjectiles; i++) { Vector2 vector2 = splitOnce ? projectile.velocity.RotatedBy(MathHelper.ToRadians(i * spread)) : new Vector2(0f, -3f).RotatedBy(radians * i); @@ -394,7 +398,7 @@ namespace CalamityMod.Projectiles.Boss } } - private void WavyMotion(float frequency, float amplitude, bool useSin) + private void WavyMotion(float frequency, float amplitude, bool useSin, bool waveWithVelocity) { if (start) { @@ -409,7 +413,10 @@ namespace CalamityMod.Projectiles.Boss float wavyVelocity = useSin ? (float)Math.Sin(projectile.ai[1]) : (float)Math.Cos(projectile.ai[1]); - projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; + if (waveWithVelocity) + projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; + else + projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; } private void LurchForward(float frequncy, float deceleration, float acceleration) diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index f3da7280eb..361da94387 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -20,12 +20,13 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 10; projectile.penetrate = -1; projectile.hostile = true; + projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight((int)((projectile.position.X + (projectile.width / 2)) / 16f), (int)((projectile.position.Y + (projectile.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; int num3; for (int num322 = 0; num322 < 2; num322 = num3 + 1) { diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index b4824fe8b0..b0ab5ba3a8 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -54,5 +54,10 @@ namespace CalamityMod.Projectiles.Boss { target.AddBuff(BuffID.Ichor, 180); } - } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 50, projectile.alpha); + } + } } diff --git a/description.txt b/description.txt index 394ea6bdbc..19fb493fce 100644 --- a/description.txt +++ b/description.txt @@ -1,13 +1,13 @@ The Calamity Mod currently adds: -20+ new bosses -A brand new event -A lot of new enemies, ores, and items -5 new modes for extra challenge -6 new biomes and several new structures -Buffs and nerfs to certain vanilla features in order to maintain balance -Buffs and nerfs to certain vanilla items that were either too weak or too strong -Cross-content support for various other mods +- 20+ new bosses +- A brand new event +- A lot of new enemies, ores, and items +- 5 new modes for extra challenge +- 6 new biomes and several new structures +- Buffs and nerfs to certain vanilla features in order to maintain balance +- Buffs and nerfs to certain vanilla items that were either too weak or too strong +- Cross-content support for various other mods PLEASE BE ADVISED: