1 - Exo Mech adjustments.

This commit is contained in:
Andrew Marheine committed 2021-11-10 01:26:27 -06:00
1 parent d4d2cdc56c
commit 548166a310
8 files changed
+158 -22

No files matched your search

+15 -3
View File
@@ -296,7 +296,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
// Prevent mechs from being respawned
if (otherExoMechWasFirst)
npc.ai[3] = 1f;
{
if (npc.ai[3] < 1f)
npc.ai[3] = 1f;
}
// Decrement the timer used to stop Artemis from firing lasers
if (npc.ai[3] > 1f)
@@ -419,7 +422,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
float destinationX = flyRight ? 750f : -750f;
float destinationY = player.Center.Y;
float chargeComboXOffset = flyRight ? -500f : 500f;
float chargeComboYOffset = npc.ai[2] == 0f ? 400f : -400f;
float chargeComboYOffset = npc.ai[2] % 2f == 0f ? 400f : -400f;
Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + destinationX * 1.6f, destinationY) : AIState == (float)Phase.LineUpChargeCombo ? new Vector2(player.Center.X + destinationX, destinationY + chargeComboYOffset) : new Vector2(player.Center.X + destinationX, destinationY);
// If Apollo can fire projectiles, cannot fire if too close to the target
@@ -563,7 +566,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
if (npc.ai[0] < 10f)
npc.ai[0] = 10f;
npc.ai[0] += 1f;
npc.ai[3] = 1f;
if (npc.ai[3] < 1f)
npc.ai[3] = 1f;
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
@@ -618,6 +624,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
if (npc.ai[0] < 10f)
npc.ai[0] = 10f;
npc.ai[0] += 1f;
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
@@ -653,6 +660,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
if (npc.ai[0] < 10f)
npc.ai[0] = 10f;
npc.ai[0] += 1f;
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
@@ -1084,10 +1092,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
npc.ai[0] = 10f;
npc.ai[0] += 1f;
// Change Y offset for the next charge combo
npc.ai[2] = Main.rand.Next(2);
// Tell Artemis to not fire lasers for a short time while swapping positions
npc.ai[3] = 61f;
npc.TargetClosest();
npc.netUpdate = true;
}
break;
+37 -3
View File
@@ -296,7 +296,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Prevent mechs from being respawned
if (otherExoMechWasFirst)
npc.ai[3] = 1f;
{
if (npc.ai[3] < 1f)
npc.ai[3] = 1f;
}
// Phases
bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f;
@@ -462,7 +465,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (spawnOtherExoMechs)
{
// Reset everything
npc.ai[3] = 1f;
if (npc.ai[3] < 1f)
npc.ai[3] = 1f;
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
npc.TargetClosest();
@@ -499,6 +504,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (otherMechIsBerserk)
{
// Reset everything
if (npc.ai[3] < 2f)
npc.ai[3] = 2f;
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
npc.TargetClosest();
@@ -520,6 +528,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (otherMechIsBerserk)
{
// Reset everything
if (npc.ai[3] < 2f)
npc.ai[3] = 2f;
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
npc.TargetClosest();
}
@@ -707,7 +718,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 35f, npc.ai[3] % 2f == 0f ? laserVelocity : -laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
}
}
}
@@ -718,8 +729,31 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
AIState = (float)Phase.Normal;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
/* Normal positions: Laser = 0, Tesla = 1, Plasma = 2, Gauss = 3
* 0 = Laser = 0, Tesla = 1, Plasma = 2, Gauss = 3
* 1 = Laser = 3, Tesla = 1, Plasma = 2, Gauss = 0
* 2 = Laser = 3, Tesla = 2, Plasma = 1, Gauss = 0
* 3 = Laser = 0, Tesla = 2, Plasma = 1, Gauss = 3
* 4 = Laser = 0, Tesla = 1, Plasma = 2, Gauss = 3
* 5 = Laser = 3, Tesla = 1, Plasma = 2, Gauss = 0
*/
if (revenge)
{
npc.ai[3] += 1f + Main.rand.Next(2);
if (npc.ai[3] > 5f)
npc.ai[3] -= 4f;
}
else if (expertMode)
{
npc.ai[3] += Main.rand.Next(2);
if (npc.ai[3] > 3f)
npc.ai[3] -= 2f;
}
npc.localAI[0] += 1f;
npc.TargetClosest();
npc.netUpdate = true;
}
}
+21 -2
View File
@@ -268,11 +268,30 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
}
// Default vector to fly to
Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 560f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y);
float offsetX = 560f;
float offsetY = 0f;
float offsetX2 = 540f;
float offsetY2 = 540f;
switch ((int)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3])
{
case 0:
case 3:
case 4:
break;
case 1:
case 2:
case 5:
offsetX *= -1f;
offsetX2 *= -1f;
offsetY2 *= -1f;
break;
}
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 baseVelocity = (enraged ? 33f : 25f) * baseVelocityMult;
float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult;
Vector2 distanceFromDestination = destination - npc.Center;
+29 -6
View File
@@ -189,12 +189,37 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Variable to fire normal lasers
bool fireNormalLasers = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays;
// Default vector to fly to
float offsetX = -560f;
float offsetY = 0f;
float offsetX2 = -540f;
float offsetY2 = -540f;
bool flyLeft = true;
switch ((int)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3])
{
case 0:
case 3:
case 4:
break;
case 1:
case 2:
case 5:
offsetX *= -1f;
offsetX2 *= -1f;
offsetY2 *= -1f;
flyLeft = false;
break;
}
Vector2 destination = fireNormalLasers ? 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);
// Rotate the cannon to look at the target while not firing the beam
// Rotate the cannon to look in the direction it will fire only while it's charging or while it's firing
// Rotation
bool horizontalLaserSweep = calamityGlobalNPC.newAI[3] == 0f;
float rateOfRotation = AIState == (int)Phase.Deathray ? 0.08f : 0.04f;
Vector2 lookAt = AIState == (int)Phase.Deathray && !fireNormalLasers ? (horizontalLaserSweep ? new Vector2(npc.Center.X, npc.Center.Y + 1000f) : new Vector2(npc.Center.X + 1000f, npc.Center.Y)) : player.Center;
float lookAtX = flyLeft ? 1000f : -1000f;
Vector2 lookAt = AIState == (int)Phase.Deathray && !fireNormalLasers ? (horizontalLaserSweep ? new Vector2(npc.Center.X, npc.Center.Y + 1000f) : new Vector2(npc.Center.X + lookAtX, npc.Center.Y)) : player.Center;
float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X);
if (npc.spriteDirection == 1)
@@ -256,12 +281,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
}
}
// Default vector to fly to
Vector2 destination = fireNormalLasers ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 560f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y);
// Velocity and acceleration values
float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f);
float baseVelocity = (enraged ? 33f : 25f) * baseVelocityMult;
float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult;
float baseAcceleration = berserk ? 1.25f : 1f;
Vector2 distanceFromDestination = destination - npc.Center;
@@ -436,7 +458,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
desiredVelocity.Y = 0f;
npc.SimpleFlyMovement(desiredVelocity, baseAcceleration);
npc.velocity = horizontalLaserSweep ? new Vector2(deathrayPhaseVelocity, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity * 0.75f);
float velocityX = flyLeft ? deathrayPhaseVelocity : -deathrayPhaseVelocity;
npc.velocity = horizontalLaserSweep ? new Vector2(velocityX, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity * 0.75f);
// Fire deathray
if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration)
+21 -2
View File
@@ -266,11 +266,30 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
}
// Default vector to fly to
Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 375f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 160f);
float offsetX = 375f;
float offsetY = 160f;
float offsetX2 = 540f;
float offsetY2 = -540f;
switch ((int)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3])
{
case 0:
case 1:
case 4:
case 5:
break;
case 2:
case 3:
offsetX *= -1f;
offsetX2 *= -1f;
offsetY2 *= -1f;
break;
}
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 baseVelocity = (enraged ? 33f : 25f) * baseVelocityMult;
float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult;
Vector2 distanceFromDestination = destination - npc.Center;
+21 -2
View File
@@ -268,11 +268,30 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
}
// Default vector to fly to
Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 375f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 160f);
float offsetX = -375f;
float offsetY = 160f;
float offsetX2 = -540f;
float offsetY2 = 540f;
switch ((int)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3])
{
case 0:
case 1:
case 4:
case 5:
break;
case 2:
case 3:
offsetX *= -1f;
offsetX2 *= -1f;
offsetY2 *= -1f;
break;
}
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 baseVelocity = (enraged ? 33f : 25f) * baseVelocityMult;
float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult;
Vector2 distanceFromDestination = destination - npc.Center;
+7 -2
View File
@@ -322,7 +322,10 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
// Prevent mechs from being respawned
if (otherExoMechWasFirst)
npc.ai[3] = 1f;
{
if (npc.ai[3] < 1f)
npc.ai[3] = 1f;
}
// Phases
bool phase2 = lifeRatio < 0.6f;
@@ -602,7 +605,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
// Reset everything
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 1f;
if (npc.ai[3] < 1f)
npc.ai[3] = 1f;
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
npc.localAI[0] = 0f;
npc.localAI[1] = 0f;
+7 -2
View File
@@ -285,7 +285,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Prevent mechs from being respawned
if (otherExoMechWasFirst)
npc.ai[3] = 1f;
{
if (npc.ai[3] < 1f)
npc.ai[3] = 1f;
}
// Phases
bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f;
@@ -509,7 +512,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (spawnOtherExoMechs)
{
// Reset everything
npc.ai[3] = 1f;
if (npc.ai[3] < 1f)
npc.ai[3] = 1f;
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
npc.localAI[0] = 0f;
npc.localAI[2] = 0f;