From 8310a03e7c16257dd4866da4f2da77cd86959249 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 17 Sep 2021 13:46:15 -0500 Subject: [PATCH] 1 - Fixed exo mech name drawing issue. 2 - Fixed exo mechs spawning each other immediately. 3 - Ares tesla orbs no longer arc during deathray spin phase. --- CalPlayer/CalamityPlayerMiscEffects.cs | 51 -------------------- NPCs/ExoMechs/Apollo/Apollo.cs | 5 +- NPCs/ExoMechs/Ares/AresBody.cs | 5 +- NPCs/ExoMechs/Ares/AresGaussNuke.cs | 2 + NPCs/ExoMechs/Ares/AresLaserCannon.cs | 2 + NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs | 2 + NPCs/ExoMechs/Ares/AresTeslaCannon.cs | 4 +- NPCs/ExoMechs/Artemis/Artemis.cs | 5 +- NPCs/ExoMechs/Thanatos/ThanatosHead.cs | 3 +- Projectiles/Boss/AresTeslaOrb.cs | 7 ++- Projectiles/Boss/DarkEnergyBall.cs | 7 +++ Projectiles/Boss/DarkEnergyBall2.cs | 7 +++ Projectiles/Boss/DoGBeamPortal.cs | 7 +++ 13 files changed, 50 insertions(+), 57 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 7817f364c5..066b57bb34 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -161,57 +161,6 @@ namespace CalamityMod.CalPlayer { if (CalamityWorld.revenge || CalamityWorld.malice) { - // This effect is way too annoying during the fight so I disabled it - Fab - // Signus headcrab effect - /*if (CalamityGlobalNPC.signus != -1) - { - if (Main.npc[CalamityGlobalNPC.signus].active) - { - if (Vector2.Distance(player.Center, Main.npc[CalamityGlobalNPC.signus].Center) <= 5200f) - { - float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax); - - // Reduce the power of Signus darkness based on your light level. - float multiplier = 1f; - switch (modPlayer.GetTotalLightStrength()) - { - case 0: - break; - case 1: - case 2: - multiplier = 0.75f; - break; - case 3: - case 4: - multiplier = 0.5f; - break; - case 5: - case 6: - multiplier = 0.25f; - break; - default: - multiplier = 0f; - break; - } - - // Increased darkness in Death Mode - if (CalamityWorld.death) - multiplier += (1f - multiplier) * 0.1f; - - // Total darkness - float signusDarkness = signusLifeRatio * multiplier; - - // Headcrab effect - if (!modPlayer.ZoneAbyss && !player.headcovered) - { - float screenObstructionAmt = MathHelper.Clamp(signusDarkness, 0f, 0.63f); - float targetValue = MathHelper.Clamp(screenObstructionAmt * 0.33f, 0.1f, 0.2f); - ScreenObstruction.screenObstruction = MathHelper.Lerp(ScreenObstruction.screenObstruction, screenObstructionAmt, targetValue); - } - } - } - }*/ - // Adjusts the life steal cap in rev/death float lifeStealCap = CalamityWorld.malice ? 30f : CalamityWorld.death ? 50f : 60f; /*if (Main.masterMode) diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 64db2186fa..dfee0098da 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -182,6 +182,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo CalamityGlobalNPC.draedonExoMechTwinGreen = npc.whoAmI; + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; @@ -265,6 +267,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Phases bool phase2 = lifeRatio < 0.6f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -474,7 +477,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Spawn the other mechs if Artemis and Apollo are first if (otherExoMechsAlive == 0) { - if (npc.ai[3] == 0f) + if (spawnOtherExoMechs) { // Reset everything npc.ai[3] = 1f; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index e464187143..546832aabd 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -139,6 +139,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares CalamityGlobalNPC.draedonExoMechPrime = npc.whoAmI; + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; @@ -248,6 +250,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.ai[3] = 1f; // Phases + bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -379,7 +382,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Spawn the other mechs if Ares is first if (otherExoMechsAlive == 0) { - if (npc.ai[3] == 0f) + if (spawnOtherExoMechs) { // Reset everything npc.ai[3] = 1f; diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 47315a41d7..676ca04b77 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -103,6 +103,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { npc.life = 0; diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index b1282330a8..c2c1942a35 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -101,6 +101,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { npc.life = 0; diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index d4be78fa6a..b2501f1689 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -101,6 +101,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { npc.life = 0; diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 623442070a..bda09634a1 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -101,6 +101,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { npc.life = 0; @@ -470,7 +472,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares return false; } - + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index e25a1d1faa..1601f01f8d 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -190,6 +190,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis CalamityGlobalNPC.draedonExoMechTwinRed = npc.whoAmI; + npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; @@ -276,6 +278,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Phases bool phase2 = lifeRatio < 0.6f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -492,7 +495,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Note: Only Apollo spawns the mechs because the twins HP values are linked if (otherExoMechsAlive == 0) { - if (npc.ai[3] == 0f) + if (spawnOtherExoMechs) { // Reset everything npc.ai[3] = 1f; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index cb47c82bf8..52d489cd99 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -250,6 +250,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.ai[3] = 1f; // Phases + bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -451,7 +452,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Spawn the other mechs if Thanatos is first if (otherExoMechsAlive == 0) { - if (npc.ai[3] == 0f) + if (spawnOtherExoMechs) { // Reset everything npc.ai[3] = 1f; diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index 0278354c98..e989a46b0e 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -1,3 +1,5 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.ExoMechs.Ares; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -140,9 +142,12 @@ namespace CalamityMod.Projectiles.Boss public Projectile GetOrbToAttachTo() { + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + return null; + for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].type != projectile.type || Main.projectile[i].ai[0] != Identity + 1f || !Main.projectile[i].active) + if (Main.projectile[i].type != projectile.type || Main.projectile[i].ai[0] != Identity + 1f || !Main.projectile[i].active || Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[0] == (float)AresBody.Phase.Deathrays) continue; return Main.projectile[i]; diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 7b03090f98..a270cbb957 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -33,6 +33,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + if (Vector2.Distance(projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) projectile.Kill(); diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 506d0c91af..5ff7987d43 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -35,6 +35,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + if (Vector2.Distance(projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) projectile.Kill(); diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index b77e467f51..58a5eeed39 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -45,6 +45,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + Player player = Main.player[projectile.owner]; if (start)