1 - Hopefully fixed the berserk phase issues that happen when all 3 mechs are out.

This commit is contained in:
Andrew Marheine committed 2022-01-04 07:00:57 -06:00
1 parent c007a4f0de
commit e17c855dac
3 files changed
+126 -114

No files matched your search

+67 -63
View File
@@ -800,7 +800,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
}
// If Artemis and Apollo are the first mechs to go berserk
if (berserk)
else if (berserk)
{
// Set Artemis variables
if (exoMechTwinRedAlive)
@@ -852,76 +852,80 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
// Do nothing while immune
AIState = (float)Phase.Normal;
// Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk
if ((exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk)
// Only run this if no other mechs are in berserk phase
if (!otherMechIsBerserk)
{
// Set Artemis variables
if (exoMechTwinRedAlive)
// Enter the fight again if any of the other exo mechs is below 70%
if (exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f)
{
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] =
totalOtherExoMechLifeRatio > 5f ? (float)Artemis.Artemis.SecondaryPhase.Nothing : (float)Artemis.Artemis.SecondaryPhase.Passive;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[1] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[0] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[1] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[3] = 0f;
}
// Tells Artemis and Apollo to return to the battle in passive state and reset everything
// Return to normal phases if one or more mechs have been downed
SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive;
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
npc.localAI[2] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
for (int i = 0; i < maxCharges; i++)
chargeLocations[i] = default;
npc.TargetClosest();
// Phase 3, when all 3 mechs attack at the same time
if (exoWormAlive && exoPrimeAlive)
{
if (draedonAlive)
// Set Artemis variables
if (exoMechTwinRedAlive)
{
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] =
totalOtherExoMechLifeRatio > 5f ? (float)Artemis.Artemis.SecondaryPhase.Nothing : (float)Artemis.Artemis.SecondaryPhase.Passive;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[1] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[0] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[1] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[3] = 0f;
}
// Tells Artemis and Apollo to return to the battle in passive state and reset everything
// Return to normal phases if one or more mechs have been downed
SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive;
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
npc.localAI[2] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
for (int i = 0; i < maxCharges; i++)
chargeLocations[i] = default;
npc.TargetClosest();
// Phase 3, when all 3 mechs attack at the same time
if (exoWormAlive && exoPrimeAlive)
{
if (draedonAlive)
{
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
}
}
}
}
if (berserk)
{
// Set Artemis variables
if (exoMechTwinRedAlive)
if (berserk)
{
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] = (float)Artemis.Artemis.SecondaryPhase.Nothing;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[1] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[0] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[1] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[3] = 0f;
// Set Artemis variables
if (exoMechTwinRedAlive)
{
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] = (float)Artemis.Artemis.SecondaryPhase.Nothing;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[1] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[0] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[1] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].localAI[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[2] = 0f;
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[3] = 0f;
}
// Reset everything
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
npc.localAI[2] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
for (int i = 0; i < maxCharges; i++)
chargeLocations[i] = default;
npc.TargetClosest();
// Never be passive if berserk
SecondaryAIState = (float)SecondaryPhase.Nothing;
}
// Reset everything
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
npc.localAI[2] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
for (int i = 0; i < maxCharges; i++)
chargeLocations[i] = default;
npc.TargetClosest();
// Never be passive if berserk
SecondaryAIState = (float)SecondaryPhase.Nothing;
}
break;
+24 -20
View File
@@ -552,7 +552,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
}
// If Ares is the first mech to go berserk
if (berserk)
else if (berserk)
{
// Reset everything
npc.TargetClosest();
@@ -576,32 +576,36 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Fly above target and become immune
case (int)SecondaryPhase.PassiveAndImmune:
// Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk
if ((exoWormLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk)
// Only run this if no other mechs are in berserk phase
if (!otherMechIsBerserk)
{
// Tells Ares to return to the battle in passive state and reset everything
// Return to normal phases if one or more mechs have been downed
SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive;
npc.TargetClosest();
// Phase 3, when all 3 mechs attack at the same time
if (exoWormAlive && exoTwinsAlive)
// Enter the fight again if any of the other exo mechs is below 70%
if (exoWormLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f)
{
if (draedonAlive)
// Tells Ares to return to the battle in passive state and reset everything
// Return to normal phases if one or more mechs have been downed
SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive;
npc.TargetClosest();
// Phase 3, when all 3 mechs attack at the same time
if (exoWormAlive && exoTwinsAlive)
{
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
if (draedonAlive)
{
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
}
}
}
}
if (berserk)
{
// Reset everything
npc.TargetClosest();
if (berserk)
{
// Reset everything
npc.TargetClosest();
// Never be passive if berserk
SecondaryAIState = (float)SecondaryPhase.Nothing;
// Never be passive if berserk
SecondaryAIState = (float)SecondaryPhase.Nothing;
}
}
break;
+35 -31
View File
@@ -580,7 +580,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
}
// If Thanatos is the first mech to go berserk
if (berserk)
else if (berserk)
{
// Reset everything
AIState = (float)Phase.Charge;
@@ -613,43 +613,47 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Do nothing while immune
AIState = (float)Phase.UndergroundLaserBarrage;
// Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk
if ((exoPrimeLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk)
// Only run this if no other mechs are in berserk phase
if (!otherMechIsBerserk)
{
// Tells Thanatos to return to the battle in passive state and reset everything
// Return to normal phases if one or more mechs have been downed
SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive;
npc.localAI[0] = 0f;
npc.localAI[2] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
chargeVelocityScalar = 0f;
npc.TargetClosest();
// Phase 3, when all 3 mechs attack at the same time
if (exoPrimeAlive && exoTwinsAlive)
// Enter the fight again if any of the other exo mechs is below 70%
if (exoPrimeLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f)
{
if (draedonAlive)
// Tells Thanatos to return to the battle in passive state and reset everything
// Return to normal phases if one or more mechs have been downed
SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive;
npc.localAI[0] = 0f;
npc.localAI[2] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
chargeVelocityScalar = 0f;
npc.TargetClosest();
// Phase 3, when all 3 mechs attack at the same time
if (exoPrimeAlive && exoTwinsAlive)
{
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
if (draedonAlive)
{
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
}
}
}
}
if (berserk)
{
// Reset everything
AIState = (float)Phase.Charge;
npc.localAI[0] = 0f;
npc.localAI[2] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
chargeVelocityScalar = 0f;
npc.TargetClosest();
if (berserk)
{
// Reset everything
AIState = (float)Phase.Charge;
npc.localAI[0] = 0f;
npc.localAI[2] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
chargeVelocityScalar = 0f;
npc.TargetClosest();
// Never be passive if berserk
SecondaryAIState = (float)SecondaryPhase.Nothing;
// Never be passive if berserk
SecondaryAIState = (float)SecondaryPhase.Nothing;
}
}
break;