1 - Actually hopefully fixed the problems.

This commit is contained in:
Andrew Marheine committed 2022-01-04 09:54:13 -06:00
1 parent 4b017e304d
commit 14b9cdd2fe
11 files changed
+340 -187

No files matched your search

+74 -73
View File
@@ -326,6 +326,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
// If Artemis and Apollo don't go berserk
bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoPrimeLifeRatio < 0.4f;
// Whether Artemis and Apollo should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Spawn Artemis if it doesn't exist after the first 10 frames have passed
if (npc.ai[0] < 10f)
{
@@ -383,7 +386,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
float reducedTimeForGateValue_Berserk = reducedTimeForGateValue * 0.5f;
float normalAttackTime = 360f - reducedTimeForGateValue;
float berserkAttackTime = lastMechAlive ? 225f - reducedTimeForGateValue_Berserk : 270f - reducedTimeForGateValue_Berserk;
float attackPhaseGateValue = berserk ? berserkAttackTime : normalAttackTime;
float attackPhaseGateValue = shouldGetBuffedByBerserkPhase ? berserkAttackTime : normalAttackTime;
float timeToLineUpAttack = 30f;
float timeToLineUpCharge = malice ? 30f : death ? 40f : revenge ? 45f : expertMode ? 50f : 60f;
@@ -392,7 +395,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
float chargeLocationDistanceGateValue = 20f;
// Velocity and acceleration values
float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocity = (AIState == (int)Phase.LineUpChargeCombo ? 40f : 20f) * baseVelocityMult;
// Attack gate values
@@ -410,7 +413,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
float projectileVelocity = 12f;
if (lastMechAlive)
projectileVelocity *= 1.2f;
else if (berserk)
else if (shouldGetBuffedByBerserkPhase)
projectileVelocity *= 1.1f;
// Rocket phase variables
@@ -679,8 +682,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
}
// Go passive and immune if one of the other mechs is berserk
// This is only called if two exo mechs are alive
if (otherMechIsBerserk)
// This is only called if two exo mechs are alive in ideal scenarios
// This is not called if Artemis and Apollo and another one or two mechs are berserk
if (otherMechIsBerserk && !berserk)
{
// Despawn projectile bullshit
for (int x = 0; x < Main.maxProjectiles; x++)
@@ -739,7 +743,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
break;
// Fire projectiles less often
// Fire projectiles less often, this happens when all 3 mechs are present and attacking
case (int)SecondaryPhase.Passive:
// Artemis fires lasers while passive
@@ -800,7 +804,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
}
// If Artemis and Apollo are the first mechs to go berserk
else if (berserk)
if (berserk)
{
// Set Artemis variables
if (exoMechTwinRedAlive)
@@ -852,82 +856,79 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
// Do nothing while immune
AIState = (float)Phase.Normal;
// Only run this if no other mechs are in berserk phase
if (!otherMechIsBerserk)
// Enter the fight again if any of the other exo mechs is below 70% and other mechs aren't berserk
if ((exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk)
{
// Enter the fight again if any of the other exo mechs is below 70%
if (exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f)
// Set Artemis variables
if (exoMechTwinRedAlive)
{
// Set Artemis variables
if (exoMechTwinRedAlive)
{
Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] =
totalOtherExoMechLifeRatio > 5f ? (float)Artemis.Artemis.SecondaryPhase.Nothing : (float)Artemis.Artemis.SecondaryPhase.Passive;
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;
}
}
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;
}
if (berserk)
// 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)
{
// Set Artemis variables
if (exoMechTwinRedAlive)
if (draedonAlive)
{
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;
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
}
// 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;
}
}
// This is here just in case
if (berserk)
{
// 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;
}
break;
}
@@ -1076,7 +1077,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
{
// Go back to normal phase
AIState = (float)Phase.Normal;
npc.localAI[2] = berserk ? 1f : 0f;
npc.localAI[2] = shouldGetBuffedByBerserkPhase ? 1f : 0f;
calamityGlobalNPC.newAI[2] = 0f;
npc.TargetClosest();
}
+31 -30
View File
@@ -329,6 +329,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// If Ares doesn't go berserk
bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f;
// Whether Ares should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Get a target
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
npc.TargetClosest();
@@ -421,9 +424,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X, player.Center.Y - 800f) : AIState != (float)Phase.Deathrays ? new Vector2(player.Center.X, player.Center.Y - 425f) : player.Center;
// Velocity and acceleration values
float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocity = (EnragedState == (float)Enraged.Yes ? 28f : 20f) * baseVelocityMult;
float baseAcceleration = berserk ? 1.25f : 1f;
float baseAcceleration = shouldGetBuffedByBerserkPhase ? 1.25f : 1f;
float decelerationVelocityMult = 0.85f;
// Distance where Ares stops moving
@@ -516,8 +519,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
}
// Go passive and immune if one of the other mechs is berserk
// This is only called if two exo mechs are alive
if (otherMechIsBerserk)
// This is only called if two exo mechs are alive in ideal scenarios
// This is not called if Ares and another one or two mechs are berserk
if (otherMechIsBerserk && !berserk)
{
// Reset everything
if (npc.ai[3] < 2f)
@@ -537,7 +541,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
break;
// Fire projectiles less often
// Fire projectiles less often, this happens when all 3 mechs are present and attacking
case (int)SecondaryPhase.Passive:
// Enter passive and invincible phase if one of the other exo mechs is berserk
@@ -552,7 +556,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
}
// If Ares is the first mech to go berserk
else if (berserk)
if (berserk)
{
// Reset everything
npc.TargetClosest();
@@ -576,36 +580,33 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Fly above target and become immune
case (int)SecondaryPhase.PassiveAndImmune:
// Only run this if no other mechs are in berserk phase
if (!otherMechIsBerserk)
// Enter the fight again if any of the other exo mechs is below 70% and other mechs aren't berserk
if ((exoWormLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk)
{
// Enter the fight again if any of the other exo mechs is below 70%
if (exoWormLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f)
{
// 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();
// 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)
// Phase 3, when all 3 mechs attack at the same time
if (exoWormAlive && exoTwinsAlive)
{
if (draedonAlive)
{
if (draedonAlive)
{
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
}
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
}
}
}
if (berserk)
{
// Reset everything
npc.TargetClosest();
// This is here just in case
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;
@@ -650,7 +651,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue);
if (berserk)
if (shouldGetBuffedByBerserkPhase)
{
calamityGlobalNPC.newAI[2] += 1f;
if (calamityGlobalNPC.newAI[2] > deathrayPhaseGateValue)
+21 -3
View File
@@ -133,11 +133,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoWormAlive = false;
bool exoTwinsAlive = false;
if (CalamityGlobalNPC.draedonExoMechWorm != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active)
{
otherExoMechsAlive++;
exoWormAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
@@ -157,6 +161,20 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoWormLifeRatio = defaultLifeRatio;
float exoTwinsLifeRatio = defaultLifeRatio;
if (exoWormAlive)
exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax;
if (exoTwinsAlive)
exoTwinsLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
// If Ares doesn't go berserk
bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f;
// Whether Ares should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
@@ -203,7 +221,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
float projectileVelocity = passivePhase ? 9.6f : 12f;
if (lastMechAlive)
projectileVelocity *= 1.2f;
else if (berserk)
else if (shouldGetBuffedByBerserkPhase)
projectileVelocity *= 1.1f;
float rateOfRotation = AIState == (int)Phase.GaussNuke ? 0.08f : 0.04f;
@@ -292,7 +310,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX2, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY2) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY);
// Velocity and acceleration values
float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult;
baseVelocity *= 1f + Main.npc[(int)npc.ai[2]].localAI[2];
@@ -307,7 +325,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
gaussNukePhaseGateValue *= 0.05f;
else if (lastMechAlive)
gaussNukePhaseGateValue *= 0.1f;
else if (berserk)
else if (shouldGetBuffedByBerserkPhase)
gaussNukePhaseGateValue *= 0.15f;
// Variable to disable deathray firing
+22 -4
View File
@@ -131,11 +131,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoWormAlive = false;
bool exoTwinsAlive = false;
if (CalamityGlobalNPC.draedonExoMechWorm != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active)
{
otherExoMechsAlive++;
exoWormAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
@@ -155,6 +159,20 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoWormLifeRatio = defaultLifeRatio;
float exoTwinsLifeRatio = defaultLifeRatio;
if (exoWormAlive)
exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax;
if (exoTwinsAlive)
exoTwinsLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
// If Ares doesn't go berserk
bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f;
// Whether Ares should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
@@ -284,10 +302,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
}
// Velocity and acceleration values
float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult;
baseVelocity *= 1f + Main.npc[(int)npc.ai[2]].localAI[2];
float baseAcceleration = berserk ? 1.25f : 1f;
float baseAcceleration = shouldGetBuffedByBerserkPhase ? 1.25f : 1f;
Vector2 distanceFromDestination = destination - npc.Center;
Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity;
@@ -302,13 +320,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
deathrayPhaseGateValue *= 0.1f;
else if (lastMechAlive)
deathrayPhaseGateValue *= 0.3f;
else if (berserk)
else if (shouldGetBuffedByBerserkPhase)
deathrayPhaseGateValue *= 0.5f;
float deathrayPhaseVelocity = (nerfedAttacks ? 6f : passivePhase ? 9f : 12f) * baseVelocityMult;
if (lastMechAlive)
deathrayPhaseVelocity *= 1.2f;
else if (berserk)
else if (shouldGetBuffedByBerserkPhase)
deathrayPhaseVelocity *= 1.1f;
// If Laser Cannon can fire normal lasers, cannot fire if too close to the target and in deathray spiral phase
+21 -3
View File
@@ -133,11 +133,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoWormAlive = false;
bool exoTwinsAlive = false;
if (CalamityGlobalNPC.draedonExoMechWorm != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active)
{
otherExoMechsAlive++;
exoWormAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
@@ -157,6 +161,20 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoWormLifeRatio = defaultLifeRatio;
float exoTwinsLifeRatio = defaultLifeRatio;
if (exoWormAlive)
exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax;
if (exoTwinsAlive)
exoTwinsLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
// If Ares doesn't go berserk
bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f;
// Whether Ares should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
@@ -203,7 +221,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
float projectileVelocity = passivePhase ? 9.6f : 12f;
if (lastMechAlive)
projectileVelocity *= 1.2f;
else if (berserk)
else if (shouldGetBuffedByBerserkPhase)
projectileVelocity *= 1.1f;
float rateOfRotation = AIState == (int)Phase.PlasmaBolts ? 0.08f : 0.04f;
@@ -244,7 +262,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
plasmaBoltPhaseGateValue *= 0.1f;
else if (lastMechAlive)
plasmaBoltPhaseGateValue *= 0.4f;
else if (berserk)
else if (shouldGetBuffedByBerserkPhase)
plasmaBoltPhaseGateValue *= 0.7f;
// Set attack timer to this when despawning or when Ares is coming out of deathray phase
@@ -305,7 +323,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX2, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY2) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY);
// Velocity and acceleration values
float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult;
baseVelocity *= 1f + Main.npc[(int)npc.ai[2]].localAI[2];
+22 -4
View File
@@ -131,11 +131,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoWormAlive = false;
bool exoTwinsAlive = false;
if (CalamityGlobalNPC.draedonExoMechWorm != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active)
{
otherExoMechsAlive++;
exoWormAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
@@ -155,6 +159,20 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoWormLifeRatio = defaultLifeRatio;
float exoTwinsLifeRatio = defaultLifeRatio;
if (exoWormAlive)
exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax;
if (exoTwinsAlive)
exoTwinsLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
// If Ares doesn't go berserk
bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f;
// Whether Ares should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
@@ -204,7 +222,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
float projectileVelocity = (passivePhase || fireMoreOrbs) ? 6f : 9f;
if (lastMechAlive)
projectileVelocity *= 1.2f;
else if (berserk)
else if (shouldGetBuffedByBerserkPhase)
projectileVelocity *= 1.1f;
float rateOfRotation = AIState == (int)Phase.TeslaOrbs ? 0.08f : 0.04f;
@@ -244,7 +262,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
teslaOrbPhaseGateValue *= 0.1f;
else if (lastMechAlive)
teslaOrbPhaseGateValue *= 0.4f;
else if (berserk)
else if (shouldGetBuffedByBerserkPhase)
teslaOrbPhaseGateValue *= 0.7f;
// Set attack timer to this when despawning or when Ares is coming out of deathray phase
@@ -305,7 +323,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX2, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY2) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY);
// Velocity and acceleration values
float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult;
baseVelocity *= 1f + Main.npc[(int)npc.ai[2]].localAI[2];
@@ -386,7 +404,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
else
{
// Fire tesla orbs
int numTeslaOrbs = lastMechAlive ? 6 : berserk ? 5 : nerfedAttacks ? 3 : 4;
int numTeslaOrbs = lastMechAlive ? 6 : shouldGetBuffedByBerserkPhase ? 5 : nerfedAttacks ? 3 : 4;
float divisor = teslaOrbDuration / numTeslaOrbs;
if (calamityGlobalNPC.newAI[2] % divisor == 0f && canFire)
+6 -3
View File
@@ -345,6 +345,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
// If Artemis and Apollo don't go berserk
bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoPrimeLifeRatio < 0.4f;
// Whether Artemis and Apollo should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Spawn Apollo if it doesn't exist after the first 10 frames have passed
if (npc.ai[0] < 10f)
{
@@ -404,7 +407,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
float reducedTimeForGateValue_Berserk = reducedTimeForGateValue * 0.5f;
float normalAttackTime = 360f - reducedTimeForGateValue;
float berserkAttackTime = lastMechAlive ? 225f - reducedTimeForGateValue_Berserk : 270f - reducedTimeForGateValue_Berserk;
float attackPhaseGateValue = berserk ? berserkAttackTime : normalAttackTime;
float attackPhaseGateValue = shouldGetBuffedByBerserkPhase ? berserkAttackTime : normalAttackTime;
float timeToLineUpAttack = phase2 ? 30f : 45f;
// Spin variables
@@ -448,7 +451,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
bool doBigAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack;
// Velocity and acceleration values
float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocity = ((AIState == (int)Phase.Deathray || lineUpAttack || AIState == (int)Phase.LaserShotgun) ? 40f : 20f) * baseVelocityMult;
float decelerationVelocityMult = 0.85f;
@@ -886,7 +889,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
{
pickNewLocation = true;
AIState = (float)Phase.Normal;
npc.localAI[2] = berserk ? 1f : 0f;
npc.localAI[2] = shouldGetBuffedByBerserkPhase ? 1f : 0f;
calamityGlobalNPC.newAI[2] = 0f;
}
+32 -7
View File
@@ -35,6 +35,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f);
// Default life ratio for the other mechs
private const float defaultLifeRatio = 5f;
// Timer to prevent Thanatos from dealing contact damage for a bit
private int noContactDamageTimer = 0;
@@ -200,23 +203,45 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoPrimeAlive = false;
bool exoTwinsAlive = false;
if (CalamityGlobalNPC.draedonExoMechPrime != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active)
{
otherExoMechsAlive++;
exoPrimeAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
{
otherExoMechsAlive++;
exoTwinsAlive = true;
}
}
// Set the AI to become more aggressive if head is berserk
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoPrimeLifeRatio = defaultLifeRatio;
float exoTwinsLifeRatio = defaultLifeRatio;
if (exoPrimeAlive)
exoPrimeLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax;
if (exoTwinsAlive)
exoTwinsLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
// If Thanatos doesn't go berserk
bool otherMechIsBerserk = exoPrimeLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f;
// Whether Thanatos should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Use to close the segments quicker in later phases
float fasterSegmentClosingVar = lastMechAlive ? 0.2f : berserk ? 0.1f : 0f;
float fasterSegmentClosingVar = lastMechAlive ? 0.2f : shouldGetBuffedByBerserkPhase ? 0.1f : 0f;
bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
if (shootLasers && !invisiblePhase)
@@ -228,14 +253,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
npc.ai[3] += 1f;
double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D;
if (berserk)
if (shouldGetBuffedByBerserkPhase)
numSegmentsAbleToFire *= 1.5;
float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire);
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
{
float divisor = lastMechAlive ? 45f : berserk ? 60f : 90f;
float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 90f;
if ((npc.ai[3] % divisor == 0f && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f)
{
// Body is vulnerable while firing lasers
@@ -301,7 +326,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
}
else
{
float divisor = npc.ai[0] * (lastMechAlive ? 1f : berserk ? 2f : 3f); // Ranges from 3 to 300
float divisor = npc.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300
if ((npc.ai[3] == divisor && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f)
{
// Body is vulnerable while firing lasers
@@ -358,7 +383,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
else
{
// Normal laser
if (berserk && npc.ai[0] % 3f == 0f)
if (shouldGetBuffedByBerserkPhase && npc.ai[0] % 3f == 0f)
Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
// Predictive laser
@@ -420,7 +445,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Increase overall damage taken while vulnerable
float damageMult = malice ? 1.1f : death ? 1.2f : revenge ? 1.25f : expertMode ? 1.3f : 1.4f;
if (berserk)
if (shouldGetBuffedByBerserkPhase)
damageMult -= malice ? 0.1f : death ? 0.175f : revenge ? 0.2f : expertMode ? 0.225f : 0.3f;
npc.takenDamageMultiplier = vulnerable ? damageMult : 1f;
@@ -443,7 +468,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Steam
npc.localAI[0] += 1f;
float actualVentDuration = lastMechAlive ? 90f : berserk ? 120f : ThanatosHead.ventDuration;
float actualVentDuration = lastMechAlive ? 90f : shouldGetBuffedByBerserkPhase ? 120f : ThanatosHead.ventDuration;
if (npc.localAI[0] < actualVentDuration)
{
SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2;
+32 -7
View File
@@ -35,6 +35,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f);
// Default life ratio for the other mechs
private const float defaultLifeRatio = 5f;
// Timer to prevent Thanatos from dealing contact damage for a bit
private int noContactDamageTimer = 0;
@@ -200,23 +203,45 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoPrimeAlive = false;
bool exoTwinsAlive = false;
if (CalamityGlobalNPC.draedonExoMechPrime != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active)
{
otherExoMechsAlive++;
exoPrimeAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
{
otherExoMechsAlive++;
exoTwinsAlive = true;
}
}
// Set the AI to become more aggressive if head is berserk
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoPrimeLifeRatio = defaultLifeRatio;
float exoTwinsLifeRatio = defaultLifeRatio;
if (exoPrimeAlive)
exoPrimeLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax;
if (exoTwinsAlive)
exoTwinsLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
// If Thanatos doesn't go berserk
bool otherMechIsBerserk = exoPrimeLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f;
// Whether Thanatos should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Use to close the segments quicker in later phases
float fasterSegmentClosingVar = lastMechAlive ? 0.2f : berserk ? 0.1f : 0f;
float fasterSegmentClosingVar = lastMechAlive ? 0.2f : shouldGetBuffedByBerserkPhase ? 0.1f : 0f;
bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
if (shootLasers && !invisiblePhase)
@@ -228,14 +253,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
npc.ai[3] += 1f;
double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D;
if (berserk)
if (shouldGetBuffedByBerserkPhase)
numSegmentsAbleToFire *= 1.5;
float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire);
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
{
float divisor = lastMechAlive ? 45f : berserk ? 60f : 90f;
float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 90f;
if ((npc.ai[3] % divisor == 0f && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f)
{
// Body is vulnerable while firing lasers
@@ -301,7 +326,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
}
else
{
float divisor = npc.ai[0] * (lastMechAlive ? 1f : berserk ? 2f : 3f); // Ranges from 3 to 300
float divisor = npc.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300
if ((npc.ai[3] == divisor && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f)
{
// Body is vulnerable while firing lasers
@@ -358,7 +383,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
else
{
// Normal laser
if (berserk && npc.ai[0] % 3f == 0f)
if (shouldGetBuffedByBerserkPhase && npc.ai[0] % 3f == 0f)
Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
// Predictive laser
@@ -420,7 +445,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Increase overall damage taken while vulnerable
float damageMult = malice ? 1.1f : death ? 1.2f : revenge ? 1.25f : expertMode ? 1.3f : 1.4f;
if (berserk)
if (shouldGetBuffedByBerserkPhase)
damageMult -= malice ? 0.1f : death ? 0.175f : revenge ? 0.2f : expertMode ? 0.225f : 0.3f;
npc.takenDamageMultiplier = vulnerable ? damageMult : 1f;
@@ -443,7 +468,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Steam
npc.localAI[0] += 1f;
float actualVentDuration = lastMechAlive ? 90f : berserk ? 120f : ThanatosHead.ventDuration;
float actualVentDuration = lastMechAlive ? 90f : shouldGetBuffedByBerserkPhase ? 120f : ThanatosHead.ventDuration;
if (npc.localAI[0] < actualVentDuration)
{
SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2;
+47 -46
View File
@@ -303,6 +303,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// If Thanatos doesn't go berserk
bool otherMechIsBerserk = exoPrimeLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f;
// Whether Thanatos should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
@@ -370,10 +373,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Phase gate values
float velocityAdjustTime = 20f;
float speedUpTime = lastMechAlive ? 180f : berserk ? 240f : 360f;
float slowDownTime = lastMechAlive ? 30f : berserk ? 40f : 60f;
float speedUpTime = lastMechAlive ? 180f : shouldGetBuffedByBerserkPhase ? 240f : 360f;
float slowDownTime = lastMechAlive ? 30f : shouldGetBuffedByBerserkPhase ? 40f : 60f;
float chargePhaseGateValue = speedUpTime + slowDownTime;
float laserBarrageDuration = lastMechAlive ? 270f : berserk ? 300f : 360f;
float laserBarrageDuration = lastMechAlive ? 270f : shouldGetBuffedByBerserkPhase ? 300f : 360f;
// Despawn if target is dead
bool targetDead = false;
@@ -451,7 +454,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
float laserBarrageLocationDistance = turnDistance * 3f;
// Velocity and turn speed values
float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocity = 11.1f * baseVelocityMult;
// Increase top velocity if target is dead or if Thanatos is uncoiling
@@ -460,7 +463,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
else
baseVelocity *= increaseSpeedMult;
float turnDegrees = baseVelocity * 0.11f * (berserk ? 1.25f : 1f);
float turnDegrees = baseVelocity * 0.11f * (shouldGetBuffedByBerserkPhase ? 1.25f : 1f);
float turnSpeed = MathHelper.ToRadians(turnDegrees);
float chargeVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar);
@@ -478,7 +481,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
float deathrayVelocityScalarIncrement = 1f / deathrayDuration;
// Scalar to use during laser barrage, passive and immune phases
float laserBarrageVelocityScalarIncrement = lastMechAlive ? 0.025f : berserk ? 0.02f : 0.015f;
float laserBarrageVelocityScalarIncrement = lastMechAlive ? 0.025f : shouldGetBuffedByBerserkPhase ? 0.02f : 0.015f;
float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime;
// Passive and Immune phases
@@ -537,8 +540,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
}
// Go passive and immune if one of the other mechs is berserk
// This is only called if two exo mechs are alive
if (otherMechIsBerserk)
// This is only called if two exo mechs are alive in ideal scenarios
// This is not called if Thanatos and another one or two mechs are berserk
if (otherMechIsBerserk && !berserk)
{
// Reset everything
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
@@ -560,7 +564,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
break;
// Fly underneath target and fire lasers
// Fly underneath target and fire lasers, this happens when all 3 mechs are present and attacking
case (int)SecondaryPhase.Passive:
// Fire lasers while passive
@@ -580,7 +584,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
}
// If Thanatos is the first mech to go berserk
else if (berserk)
if (berserk)
{
// Reset everything
AIState = (float)Phase.Charge;
@@ -613,47 +617,44 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Do nothing while immune
AIState = (float)Phase.UndergroundLaserBarrage;
// Only run this if no other mechs are in berserk phase
if (!otherMechIsBerserk)
// Enter the fight again if any of the other exo mechs is below 70% and other mechs aren't berserk
if ((exoPrimeLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk)
{
// Enter the fight again if any of the other exo mechs is below 70%
if (exoPrimeLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f)
{
// 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();
// 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)
// Phase 3, when all 3 mechs attack at the same time
if (exoPrimeAlive && exoTwinsAlive)
{
if (draedonAlive)
{
if (draedonAlive)
{
Main.npc[CalamityGlobalNPC.draedon].localAI[0] = 2f;
Main.npc[CalamityGlobalNPC.draedon].ai[0] = Draedon.ExoMechPhaseDialogueTime;
}
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();
// This is here just in case
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;
@@ -759,8 +760,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
calamityGlobalNPC.newAI[3] += 1f;
if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime)
{
npc.ai[1] += (berserk && revenge) ? 1f : 0f;
npc.localAI[0] = berserk ? 1f : 0f;
npc.ai[1] += (shouldGetBuffedByBerserkPhase && revenge) ? 1f : 0f;
npc.localAI[0] = shouldGetBuffedByBerserkPhase ? 1f : 0f;
AIState = (float)Phase.Charge;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
+32 -7
View File
@@ -35,6 +35,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f);
// Default life ratio for the other mechs
private const float defaultLifeRatio = 5f;
// Timer to prevent Thanatos from dealing contact damage for a bit
private int noContactDamageTimer = 0;
@@ -200,23 +203,45 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoPrimeAlive = false;
bool exoTwinsAlive = false;
if (CalamityGlobalNPC.draedonExoMechPrime != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active)
{
otherExoMechsAlive++;
exoPrimeAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
{
otherExoMechsAlive++;
exoTwinsAlive = true;
}
}
// Set the AI to become more aggressive if head is berserk
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoPrimeLifeRatio = defaultLifeRatio;
float exoTwinsLifeRatio = defaultLifeRatio;
if (exoPrimeAlive)
exoPrimeLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax;
if (exoTwinsAlive)
exoTwinsLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
// If Thanatos doesn't go berserk
bool otherMechIsBerserk = exoPrimeLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f;
// Whether Thanatos should be buffed while in berserk phase
bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk;
// Use to close the segments quicker in later phases
float fasterSegmentClosingVar = lastMechAlive ? 0.2f : berserk ? 0.1f : 0f;
float fasterSegmentClosingVar = lastMechAlive ? 0.2f : shouldGetBuffedByBerserkPhase ? 0.1f : 0f;
bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
if (shootLasers && !invisiblePhase)
@@ -228,14 +253,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
npc.ai[3] += 1f;
double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D;
if (berserk)
if (shouldGetBuffedByBerserkPhase)
numSegmentsAbleToFire *= 1.5;
float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire);
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
{
float divisor = lastMechAlive ? 45f : berserk ? 60f : 90f;
float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 90f;
if ((npc.ai[3] % divisor == 0f && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f)
{
// Body is vulnerable while firing lasers
@@ -301,7 +326,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
}
else
{
float divisor = npc.ai[0] * (lastMechAlive ? 1f : berserk ? 2f : 3f); // Ranges from 3 to 300
float divisor = npc.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300
if ((npc.ai[3] == divisor && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f)
{
// Body is vulnerable while firing lasers
@@ -358,7 +383,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
else
{
// Normal laser
if (berserk && npc.ai[0] % 3f == 0f)
if (shouldGetBuffedByBerserkPhase && npc.ai[0] % 3f == 0f)
Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
// Predictive laser
@@ -420,7 +445,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Increase overall damage taken while vulnerable
float damageMult = malice ? 1.1f : death ? 1.2f : revenge ? 1.25f : expertMode ? 1.3f : 1.4f;
if (berserk)
if (shouldGetBuffedByBerserkPhase)
damageMult -= malice ? 0.1f : death ? 0.175f : revenge ? 0.2f : expertMode ? 0.225f : 0.3f;
npc.takenDamageMultiplier = vulnerable ? damageMult : 1f;
@@ -443,7 +468,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Steam
npc.localAI[0] += 1f;
float actualVentDuration = lastMechAlive ? 90f : berserk ? 120f : ThanatosHead.ventDuration;
float actualVentDuration = lastMechAlive ? 90f : shouldGetBuffedByBerserkPhase ? 120f : ThanatosHead.ventDuration;
if (npc.localAI[0] < actualVentDuration)
{
SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2;