1 - Rev+ Skeletron adjustments.

2 - Master Mode Rev+ Skeletron.
3 - Master Mode Wall of Flesh and contact damage fairness.
4 - Rev+ Wall of Flesh now only uses distance to dictate enrage, rather than both distance and line of sight.
This commit is contained in:
mountaindrew10 committed 2024-02-19 17:32:01 -06:00
1 parent 1d9975458c
commit 8713eff4bd
4 files changed
+683 -41

No files matched your search

+2 -2
View File
@@ -3086,12 +3086,12 @@ namespace CalamityMod.NPCs
case NPCID.SkeletronHead:
return SkeletronAI.VanillaSkeletronAI(npc, Mod);
/*case NPCID.WallofFlesh:
case NPCID.WallofFlesh:
return WallOfFleshAI.VanillaWallofFleshAI(npc, Mod);
case NPCID.WallofFleshEye:
return WallOfFleshAI.VanillaWallofFleshEyeAI(npc, Mod);
case NPCID.QueenSlimeBoss:
/*case NPCID.QueenSlimeBoss:
return QueenSlimeAI.VanillaQueenSlimeAI(npc, Mod);
case NPCID.TheDestroyer:
+48 -14
View File
@@ -22,6 +22,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
bool bossRush = BossRushEvent.BossRushActive;
bool masterMode = Main.masterMode || bossRush;
bool death = CalamityWorld.death || bossRush;
// Percent life remaining
@@ -189,10 +190,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
// Reduce the amount of skulls per spread in later phases due to near-constant teleporting
if (phase4)
numProj--;
if (phase5)
numProj--;
if (!masterMode)
{
if (phase4)
numProj--;
if (phase5)
numProj--;
}
if (death)
headSpinVelocityMult *= 1.2f;
@@ -360,7 +364,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
// Skull shooting
if (handsDead && npc.ai[1] == 0f && !phase4)
if ((handsDead || masterMode) && npc.ai[1] == 0f && !phase4)
{
float skullProjFrequency = bossRush ? 10f : phase2 ? (48f - (death ? 17.5f * (1f - lifeRatio) : 0f)) : 60f;
if (Main.getGoodWorld)
@@ -401,8 +405,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
calamityGlobalNPC.newAI[1] += 1f;
float chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 9f) : phase4 ? (death ? 4f : 1f) : ((1f - lifeRatio) / (1f - phase4LifeRatio));
npc.ai[2] += 1f + chargePhaseChangeRateBoost;
npc.localAI[1] += 1f + chargePhaseChangeRateBoost;
float chargePhaseChangeRate = chargePhaseChangeRateBoost + 1f;
npc.ai[2] += chargePhaseChangeRate;
npc.localAI[1] += chargePhaseChangeRate;
float chargePhaseGateValue = ChargeGateValue;
if (npc.localAI[1] > chargePhaseGateValue)
npc.localAI[1] = chargePhaseGateValue;
@@ -412,7 +417,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
bool hasMovedForcedDistance = npc.localAI[2] >= forcedMoveAwayTime;
bool canCharge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= canChargeDistance;
bool charge = npc.ai[2] >= chargePhaseGateValue && canCharge;
if (charge)
bool forceCharge = npc.ai[2] > chargePhaseGateValue + 180f * chargePhaseChangeRate;
if (charge || forceCharge)
{
npc.localAI[2] += 1f;
if (hasMovedForcedDistance || !phase3)
@@ -434,6 +440,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
float headYTopSpeed = 3.5f - (death ? 1.75f - lifeRatio : 0f);
float headXAcceleration = 0.08f + (death ? 0.08f * (1f - lifeRatio) : 0f);
float headXTopSpeed = 8.5f - (death ? 4.25f * (1f - lifeRatio) : 0f);
if (masterMode)
{
headYAcceleration += 0.02f;
headYTopSpeed -= 0.5f;
headXAcceleration += 0.08f;
headXTopSpeed -= 1f;
}
if (Main.getGoodWorld)
{
headYAcceleration += 0.01f;
@@ -441,6 +456,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
headXAcceleration += 0.05f;
headXTopSpeed -= 2f;
}
if (bossRush)
{
headYAcceleration *= 1.25f;
@@ -449,15 +465,30 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
headXTopSpeed *= 0.75f;
}
float moveAwayGateValue = chargePhaseGateValue - (5f + chargePhaseChangeRateBoost);
float headTopSpeedCap = 0.5f;
if (headYTopSpeed < headTopSpeedCap)
headYTopSpeed = headTopSpeedCap;
if (headXTopSpeed < headTopSpeedCap)
headXTopSpeed = headTopSpeedCap;
float moveAwayGateValue = chargePhaseGateValue - (5f + chargePhaseChangeRate);
bool moveAwayBeforeCharge = npc.ai[2] >= moveAwayGateValue;
if (moveAwayBeforeCharge)
{
if (!canCharge || !hasMovedForcedDistance)
{
float maxAcceleration = headXAcceleration + headYAcceleration + (npc.ai[2] - moveAwayGateValue) * (phase5 ? 0.002f : 0.001f);
float maxAcceleration = headXAcceleration + headYAcceleration + (npc.ai[2] - moveAwayGateValue) * (phase5 ? 0.006f : 0.004f);
float maxAccelerationCap = (headXAcceleration + headYAcceleration) * 5f;
if (maxAcceleration > maxAccelerationCap)
maxAcceleration = maxAccelerationCap;
npc.velocity += Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * -maxAcceleration;
float maxVelocity = (headXTopSpeed + headYTopSpeed + (npc.ai[2] - moveAwayGateValue) * 0.01f) / 2f;
float maxVelocity = headSpinVelocityMult + (npc.ai[2] - moveAwayGateValue) * (phase5 ? 0.12f : 0.08f);
float maxVelocityCap = headSpinVelocityMult * 2.5f;
if (maxVelocity > maxVelocityCap)
maxVelocity = maxVelocityCap;
if (npc.velocity.Length() > maxVelocity)
{
npc.velocity.Normalize();
@@ -594,7 +625,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
// Shoot shadowflames (giant cursed skull projectiles) while charging in phase 4
if (phase4 && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
float shadowFlameGateValue = death ? 20f : 30f;
float shadowFlameGateValue = death ? 16f : 24f;
int shadowFlameLimit = death ? 3 : 2;
if (calamityGlobalNPC.newAI[1] % shadowFlameGateValue == 0f && calamityGlobalNPC.newAI[1] < shadowFlameGateValue * shadowFlameLimit)
{
@@ -604,6 +635,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f)
{
float shadowFlameProjectileSpeed = death ? 5f : 4f;
if (masterMode)
shadowFlameProjectileSpeed *= 1.25f;
Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * shadowFlameProjectileSpeed;
int type = ProjectileID.Shadowflames;
int damage = npc.GetProjectileDamage(type);
@@ -706,12 +740,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
headSpinVelocityMult += velocityBoost;
}
float altDashStopDistance = death ? 240f : 400f;
float altDashStopDistance = death ? (masterMode ? 210f : 240f) : (masterMode ? 320f : 400f);
float headSpeedIncreaseDist = phase3 ? altDashStopDistance : 160f;
if (headSpinTargetDist > headSpeedIncreaseDist)
{
float velocityMult = phase3 ? 0.00075f : 0.0015f;
float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headSpinTargetDist - headSpeedIncreaseDist) * 0.0015f, 0.05f, 1.5f);
float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headSpinTargetDist - headSpeedIncreaseDist) * 0.0015f, 0.05f, masterMode ? 2f : 1.5f);
headSpinVelocityMult *= baseDistanceVelocityMult;
}
+622 -21
View File
@@ -16,6 +16,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
bool bossRush = BossRushEvent.BossRushActive;
bool masterMode = Main.masterMode || bossRush;
bool death = CalamityWorld.death || bossRush;
// Despawn
@@ -76,6 +77,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
npc.ai[1] += 1f;
if (npc.ai[2] == 0f)
{
if (masterMode)
npc.ai[1] += 2f;
if (phase2)
npc.ai[1] += 1f;
if (phase3)
@@ -102,9 +106,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int leechSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + (npc.height / 2) + 20f), NPCID.LeechHead, 1);
Main.npc[leechSpawn].velocity.X = npc.direction * 9;
int leechVelocity = masterMode ? 14 : 9;
Main.npc[leechSpawn].velocity.X = npc.direction * leechVelocity;
if (phase2)
if (phase2 || masterMode)
{
// Get target vector
Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * npc.velocity.Length();
@@ -123,7 +128,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.localAI[3] >= (600 + Main.rand.Next(1000)))
{
npc.localAI[3] = -Main.rand.Next(200);
SoundEngine.PlaySound(SoundID.NPCDeath10, npc.position);
SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center);
}
// Set whoAmI variable
@@ -207,7 +212,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
float targetPosition = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2);
float npcPosition = npc.position.X + (npc.width / 2);
// Speed up if target is too far or if they're hiding behind tiles, slow down if too close
// Speed up if target is too far, slow down if too close
float distanceFromTarget;
if (npc.velocity.X < 0f)
distanceFromTarget = npcPosition - targetPosition;
@@ -216,7 +221,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
float halfAverageScreenWidth = 960f;
float distanceBeforeSlowingDown = 400f;
float timeBeforeEnrage = 600f - (death ? 390f * (1f - lifeRatio) : 0f);
float timeBeforeEnrage = (masterMode ? 450f : 600f) - (death ? 390f * (1f - lifeRatio) : 0f);
float speedMult = 1f;
if (bossRush)
@@ -224,8 +229,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (calamityGlobalNPC.newAI[0] < timeBeforeEnrage)
{
if (distanceFromTarget > halfAverageScreenWidth ||
!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
if (distanceFromTarget > halfAverageScreenWidth)
{
speedMult += (distanceFromTarget - halfAverageScreenWidth) * 0.001f;
calamityGlobalNPC.newAI[0] += 1f;
@@ -240,14 +244,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
// Play roar sound on players nearby
if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f)
SoundEngine.PlaySound(SoundID.NPCDeath10 with { Pitch = SoundID.NPCDeath10.Pitch - 0.25f}, Main.player[Main.myPlayer].position);
SoundEngine.PlaySound(SoundID.NPCDeath10 with { Pitch = SoundID.NPCDeath10.Pitch - 0.25f}, Main.player[Main.myPlayer].Center);
}
}
else if (distanceFromTarget < distanceBeforeSlowingDown)
speedMult += (distanceFromTarget - distanceBeforeSlowingDown) * 0.002f;
if (distanceFromTarget < halfAverageScreenWidth &&
Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
if (distanceFromTarget < halfAverageScreenWidth)
{
if (calamityGlobalNPC.newAI[0] > 0f)
calamityGlobalNPC.newAI[0] -= 1f;
@@ -281,10 +284,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + velocityBoost;
velocityX *= speedMult;
if (masterMode)
velocityX *= 1.2f;
if (Main.getGoodWorld)
{
velocityX *= 1.1f;
velocityX += 0.2f;
velocityX += 0.1f;
}
// NOTE: Values below are based on Rev Mode only!
@@ -339,7 +345,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
npc.localAI[1] += 0.0055555557f;
if (npc.localAI[1] >= 1f)
{
SoundEngine.PlaySound(SoundID.NPCDeath10, npc.position);
SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center);
npc.life = 0;
npc.active = false;
if (Main.netMode != NetmodeID.MultiplayerClient)
@@ -349,9 +355,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
}
else
{
npc.localAI[1] = MathHelper.Clamp(npc.localAI[1] - 1f / 30f, 0f, 1f);
}
// Direction
npc.spriteDirection = npc.direction;
@@ -397,6 +401,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (bossRush)
chance /= 4;
else if (masterMode)
chance /= 2;
if (chance < 2)
chance = 2;
if (Main.rand.NextBool(chance))
{
@@ -412,6 +421,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
int maxValue = 1 + hungryAmt * 2;
if (masterMode)
maxValue /= 2;
if (maxValue < 2)
maxValue = 2;
if (hungryAmt < 10 && Main.rand.Next(maxValue) <= 1)
{
int spawnHungryControl = -1;
@@ -450,23 +465,22 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2;
mouthYPosition = (mouthYPosition + Main.wofDrawAreaTop) / 2f;
int eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255);
int eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI);
Main.npc[eyeSpawn].ai[0] = 1f;
mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2;
mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f;
eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255);
eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI);
Main.npc[eyeSpawn].ai[0] = -1f;
mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2;
mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f;
int hungryIncrement;
for (int j = 0; j < 11; j = hungryIncrement + 1)
int maxHungries = masterMode ? 15 : 11;
for (int j = 0; j < maxHungries; j++)
{
int hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255);
int hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI);
Main.npc[hungrySpawn].ai[0] = j * 0.1f - 0.05f;
hungryIncrement = j;
}
}
@@ -478,6 +492,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
bool bossRush = BossRushEvent.BossRushActive;
bool masterMode = Main.masterMode || bossRush;
bool death = CalamityWorld.death || bossRush;
// Avoid cheap bullshit
@@ -610,7 +625,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (shouldFireLasers)
{
bool phase2 = lifeRatio < 0.5 || bossRush;
bool phase2 = lifeRatio < 0.5 || masterMode;
float velocity = (fireEnragedLasers ? 3f : 4f) + shootBoost;
int projectileType = phase2 ? ProjectileID.DeathLaser : ProjectileID.EyeLaser;
@@ -632,5 +647,591 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
return false;
}
public static bool VanillaWallofFleshAI(NPC npc, Mod mod)
{
if (npc.position.X < 160f || npc.position.X > (float)((Main.maxTilesX - 10) * 16))
npc.active = false;
if (npc.localAI[0] == 0f)
{
npc.localAI[0] = 1f;
Main.wofDrawAreaBottom = -1;
Main.wofDrawAreaTop = -1;
}
if (Main.getGoodWorld && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(180) && NPC.CountNPCS(NPCID.FireImp) < 4)
{
int num349 = 1;
for (int num350 = 0; num350 < num349; num350++)
{
int num351 = 1000;
for (int num352 = 0; num352 < num351; num352++)
{
int num353 = (int)(npc.Center.X / 16f);
int num354 = (int)(npc.Center.Y / 16f);
if (npc.target >= 0)
{
num353 = (int)(Main.player[npc.target].Center.X / 16f);
num354 = (int)(Main.player[npc.target].Center.Y / 16f);
}
num353 += Main.rand.Next(-50, 51);
for (num354 += Main.rand.Next(-50, 51); num354 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num353, num354); num354++)
{
}
num354--;
if (!WorldGen.SolidTile(num353, num354))
{
int num355 = NPC.NewNPC(npc.GetSource_FromAI(), num353 * 16 + 8, num354 * 16, 24);
if (Main.netMode == NetmodeID.Server && num355 < Main.maxNPCs)
NetMessage.SendData(23, -1, -1, null, num355);
break;
}
}
}
}
npc.ai[1] += 1f;
if (npc.ai[2] == 0f)
{
if (Main.masterMode)
npc.ai[1] += 2f;
if ((double)npc.life < (double)npc.lifeMax * 0.5)
npc.ai[1] += 1f;
if ((double)npc.life < (double)npc.lifeMax * 0.2)
npc.ai[1] += 1f;
if (npc.ai[1] > 2700f)
npc.ai[2] = 1f;
}
int num356 = Main.masterMode ? 30 : 60;
if (npc.ai[2] > 0f && npc.ai[1] > (float)num356)
{
int num357 = 3;
if ((double)npc.life < (double)npc.lifeMax * 0.3)
num357++;
npc.ai[2] += 1f;
npc.ai[1] = 0f;
if (npc.ai[2] > (float)num357)
npc.ai[2] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.LeechHead) < 10)
{
int num358 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)(npc.height / 2) + 20f), NPCID.LeechHead, 1);
int leechVelocity = Main.masterMode ? 12 : 8;
Main.npc[num358].velocity.X = npc.direction * leechVelocity;
}
}
npc.localAI[3] += 1f;
if (npc.localAI[3] >= (float)(600 + Main.rand.Next(1000)))
{
npc.localAI[3] = -Main.rand.Next(200);
SoundEngine.PlaySound(SoundID.NPCDeath10, npc.position);
}
int num359 = Main.UnderworldLayer + 10;
int num360 = num359 + 70;
Main.wofNPCIndex = npc.whoAmI;
int num361 = (int)(npc.position.X / 16f);
int num362 = (int)((npc.position.X + (float)npc.width) / 16f);
int num363 = (int)((npc.position.Y + (float)(npc.height / 2)) / 16f);
int num364 = 0;
int num365 = num363 + 7;
while (num364 < 15 && num365 > Main.UnderworldLayer)
{
num365++;
if (num365 > Main.maxTilesY - 10)
{
num365 = Main.maxTilesY - 10;
break;
}
if (num365 < num359)
continue;
for (int num366 = num361; num366 <= num362; num366++)
{
try
{
if (WorldGen.InWorld(num366, num365, 2) && (WorldGen.SolidTile(num366, num365) || Main.tile[num366, num365].LiquidAmount > 0))
num364++;
}
catch
{
num364 += 15;
}
}
}
num365 += 4;
if (Main.wofDrawAreaBottom == -1)
{
Main.wofDrawAreaBottom = num365 * 16;
}
else if (Main.wofDrawAreaBottom > num365 * 16)
{
Main.wofDrawAreaBottom--;
if (Main.wofDrawAreaBottom < num365 * 16)
Main.wofDrawAreaBottom = num365 * 16;
}
else if (Main.wofDrawAreaBottom < num365 * 16)
{
Main.wofDrawAreaBottom++;
if (Main.wofDrawAreaBottom > num365 * 16)
Main.wofDrawAreaBottom = num365 * 16;
}
num364 = 0;
num365 = num363 - 7;
while (num364 < 15 && num365 < Main.maxTilesY - 10)
{
num365--;
if (num365 <= 10)
{
num365 = 10;
break;
}
if (num365 > num360)
continue;
if (num365 < num359)
{
num365 = num359;
break;
}
for (int num367 = num361; num367 <= num362; num367++)
{
try
{
if (WorldGen.InWorld(num367, num365, 2) && (WorldGen.SolidTile(num367, num365) || Main.tile[num367, num365].LiquidAmount > 0))
num364++;
}
catch
{
num364 += 15;
}
}
}
num365 -= 4;
if (Main.wofDrawAreaTop == -1)
{
Main.wofDrawAreaTop = num365 * 16;
}
else if (Main.wofDrawAreaTop > num365 * 16)
{
Main.wofDrawAreaTop--;
if (Main.wofDrawAreaTop < num365 * 16)
Main.wofDrawAreaTop = num365 * 16;
}
else if (Main.wofDrawAreaTop < num365 * 16)
{
Main.wofDrawAreaTop++;
if (Main.wofDrawAreaTop > num365 * 16)
Main.wofDrawAreaTop = num365 * 16;
}
Main.wofDrawAreaTop = (int)MathHelper.Clamp(Main.wofDrawAreaTop, (float)num359 * 16f, (float)num360 * 16f);
Main.wofDrawAreaBottom = (int)MathHelper.Clamp(Main.wofDrawAreaBottom, (float)num359 * 16f, (float)num360 * 16f);
if (Main.wofDrawAreaTop > Main.wofDrawAreaBottom - 160)
Main.wofDrawAreaTop = Main.wofDrawAreaBottom - 160;
else if (Main.wofDrawAreaBottom < Main.wofDrawAreaTop + 160)
Main.wofDrawAreaBottom = Main.wofDrawAreaTop + 160;
float num368 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - npc.height / 2;
if (npc.position.Y > num368 + 1f)
npc.velocity.Y = -1f;
else if (npc.position.Y < num368 - 1f)
npc.velocity.Y = 1f;
npc.velocity.Y = 0f;
npc.position.Y = num368;
float masterModeVelocityBoost = 0f;
if (Main.masterMode)
{
float velocityBoostStartDistance = 480f;
float velocityBoostMaxDistance = velocityBoostStartDistance * 2f;
float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X);
float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f);
masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount);
}
float num369 = 1.5f + masterModeVelocityBoost;
if ((double)npc.life < (double)npc.lifeMax * 0.75)
num369 += 0.25f;
if ((double)npc.life < (double)npc.lifeMax * 0.5)
num369 += 0.4f;
if ((double)npc.life < (double)npc.lifeMax * 0.25)
num369 += 0.5f;
if ((double)npc.life < (double)npc.lifeMax * 0.1)
num369 += 0.6f;
if ((double)npc.life < (double)npc.lifeMax * 0.66 && Main.expertMode)
num369 += 0.3f;
if ((double)npc.life < (double)npc.lifeMax * 0.33 && Main.expertMode)
num369 += 0.3f;
if ((double)npc.life < (double)npc.lifeMax * 0.05 && Main.expertMode)
num369 += 0.6f;
if ((double)npc.life < (double)npc.lifeMax * 0.035 && Main.expertMode)
num369 += 0.6f;
if ((double)npc.life < (double)npc.lifeMax * 0.025 && Main.expertMode)
num369 += 0.6f;
if (Main.expertMode)
{
num369 *= 1.35f;
num369 += 0.35f;
}
if (Main.getGoodWorld)
{
num369 *= 1.1f;
num369 += 0.2f;
}
if (npc.velocity.X == 0f)
{
npc.TargetClosest();
if (Main.player[npc.target].dead)
{
float num370 = float.PositiveInfinity;
int num371 = 0;
for (int num372 = 0; num372 < Main.maxPlayers; num372++)
{
Player player = Main.player[npc.target];
if (player.active)
{
float num373 = npc.Distance(player.Center);
if (num370 > num373)
{
num370 = num373;
num371 = ((npc.Center.X < player.Center.X) ? 1 : (-1));
}
}
}
npc.direction = num371;
}
npc.velocity.X = npc.direction;
}
if (npc.velocity.X < 0f)
{
npc.velocity.X = 0f - num369;
npc.direction = -1;
}
else
{
npc.velocity.X = num369;
npc.direction = 1;
}
if (Main.player[npc.target].dead || !Main.player[npc.target].gross)
npc.TargetClosest_WOF();
if (Main.player[npc.target].dead)
{
npc.localAI[1] += 1f / 180f;
if (npc.localAI[1] >= 1f)
{
SoundEngine.PlaySound(SoundID.NPCDeath10, npc.position);
npc.life = 0;
npc.active = false;
if (Main.netMode != NetmodeID.MultiplayerClient)
NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f);
return false;
}
}
else
npc.localAI[1] = MathHelper.Clamp(npc.localAI[1] - 1f / 30f, 0f, 1f);
npc.spriteDirection = npc.direction;
Vector2 vector38 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num374 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector38.X;
float num375 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector38.Y;
float num376 = (float)Math.Sqrt(num374 * num374 + num375 * num375);
float num377 = num376;
num374 *= num376;
num375 *= num376;
if (npc.direction > 0)
{
if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) > npc.position.X + (float)(npc.width / 2))
npc.rotation = (float)Math.Atan2(0f - num375, 0f - num374) + MathHelper.Pi;
else
npc.rotation = 0f;
}
else if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) < npc.position.X + (float)(npc.width / 2))
npc.rotation = (float)Math.Atan2(num375, num374) + MathHelper.Pi;
else
npc.rotation = 0f;
if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient)
{
int num378 = (int)(1f + (float)npc.life / (float)npc.lifeMax * 10f);
num378 *= num378;
if (num378 < 400)
num378 = (num378 * 19 + 400) / 20;
if (num378 < 60)
num378 = (num378 * 3 + 60) / 4;
if (num378 < 20)
num378 = (num378 + 20) / 2;
num378 = (int)((double)num378 * (Main.masterMode ? 0.5 : 0.7));
if (num378 < 2)
num378 = 2;
if (Main.rand.NextBool(num378))
{
int num379 = 0;
float[] array = new float[10];
for (int num380 = 0; num380 < Main.maxNPCs; num380++)
{
if (num379 < 10 && Main.npc[num380].active && Main.npc[num380].type == NPCID.TheHungry)
{
array[num379] = Main.npc[num380].ai[0];
num379++;
}
}
int maxValue = 1 + num379 * 2;
if (Main.masterMode)
maxValue /= 2;
if (maxValue < 2)
maxValue = 2;
if (num379 < 10 && Main.rand.Next(maxValue) <= 1)
{
int num381 = -1;
for (int num382 = 0; num382 < 1000; num382++)
{
int num383 = Main.rand.Next(10);
float num384 = (float)num383 * 0.1f - 0.05f;
bool flag26 = true;
for (int num385 = 0; num385 < num379; num385++)
{
if (num384 == array[num385])
{
flag26 = false;
break;
}
}
if (flag26)
{
num381 = num383;
break;
}
}
if (num381 >= 0)
NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num368, NPCID.TheHungry, npc.whoAmI, (float)num381 * 0.1f - 0.05f);
}
}
}
if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f)
{
npc.localAI[0] = 2f;
float num386 = (npc.Center.Y + (float)Main.wofDrawAreaTop) / 2f;
int num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num386, NPCID.WallofFleshEye, npc.whoAmI, 1f);
float num388 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f;
num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num388, NPCID.WallofFleshEye, npc.whoAmI, -1f);
float num389 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f;
int maxHungries = Main.masterMode ? 17 : 11;
for (int num390 = 0; num390 < maxHungries; num390++)
num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num389, NPCID.TheHungry, npc.whoAmI, (float)num390 * 0.1f - 0.05f);
}
return false;
}
public static bool VanillaWallofFleshEyeAI(NPC npc, Mod mod)
{
if (Main.wofNPCIndex < 0)
{
npc.active = false;
return false;
}
npc.realLife = Main.wofNPCIndex;
if (Main.npc[Main.wofNPCIndex].life > 0)
npc.life = Main.npc[Main.wofNPCIndex].life;
// Avoid cheap bullshit
npc.damage = 0;
npc.TargetClosest();
npc.position.X = Main.npc[Main.wofNPCIndex].position.X;
npc.direction = Main.npc[Main.wofNPCIndex].direction;
npc.spriteDirection = npc.direction;
float num391 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2;
num391 = ((!(npc.ai[0] > 0f)) ? ((num391 + (float)Main.wofDrawAreaBottom) / 2f) : ((num391 + (float)Main.wofDrawAreaTop) / 2f));
num391 -= (float)(npc.height / 2);
if (npc.position.Y > num391 + 1f)
{
npc.velocity.Y = -1f;
}
else if (npc.position.Y < num391 - 1f)
{
npc.velocity.Y = 1f;
}
else
{
npc.velocity.Y = 0f;
npc.position.Y = num391;
}
if (npc.velocity.Y > 5f)
npc.velocity.Y = 5f;
if (npc.velocity.Y < -5f)
npc.velocity.Y = -5f;
Vector2 vector39 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num392 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector39.X;
float num393 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector39.Y;
float num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393);
float num395 = num394;
num392 *= num394;
num393 *= num394;
bool flag27 = true;
if (npc.direction > 0)
{
if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) > npc.position.X + (float)(npc.width / 2))
{
npc.rotation = (float)Math.Atan2(0f - num393, 0f - num392) + MathHelper.Pi;
}
else
{
npc.rotation = 0f;
flag27 = false;
}
}
else if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) < npc.position.X + (float)(npc.width / 2))
{
npc.rotation = (float)Math.Atan2(num393, num392) + MathHelper.Pi;
}
else
{
npc.rotation = 0f;
flag27 = false;
}
if (Main.netMode == NetmodeID.MultiplayerClient)
return false;
int num396 = 4;
npc.localAI[1] += 1f;
if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.75)
{
npc.localAI[1] += 1f;
num396++;
}
if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5)
{
npc.localAI[1] += 1f;
num396++;
}
if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25)
{
npc.localAI[1] += 1f;
num396 += 2;
}
if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1)
{
npc.localAI[1] += 2f;
num396 += 3;
}
if (Main.expertMode)
{
npc.localAI[1] += 0.5f;
num396++;
if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1)
{
npc.localAI[1] += 2f;
num396 += 3;
}
}
if (npc.localAI[2] == 0f)
{
if (npc.localAI[1] > 600f)
{
npc.localAI[2] = 1f;
npc.localAI[1] = 0f;
}
}
else
{
if (!(npc.localAI[1] > 45f) || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
return false;
npc.localAI[1] = 0f;
npc.localAI[2] += 1f;
if (npc.localAI[2] >= (float)num396)
npc.localAI[2] = 0f;
if (flag27)
{
float num397 = 9f;
int num398 = Main.masterMode ? 13 : 11;
int num399 = ProjectileID.EyeLaser;
if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5)
{
num398++;
num397 += 1f;
}
if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25)
{
num398++;
num397 += 1f;
}
if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1)
{
num398 += 2;
num397 += 2f;
}
vector39 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
num392 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector39.X;
num393 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector39.Y;
num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393);
num394 = num397 / num394;
num392 *= num394;
num393 *= num394;
vector39.X += num392;
vector39.Y += num393;
Projectile.NewProjectile(npc.GetSource_FromAI(), vector39.X, vector39.Y, num392, num393, num399, num398, 0f, Main.myPlayer);
}
}
return false;
}
}
}
+11 -4
View File
@@ -311,10 +311,11 @@ namespace CalamityMod.Projectiles
// Accelerate if fired in a spread from Skeletron in Rev+
if (revSkeletronAcceleratingSkull)
{
float maxVelocity = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 18f : 15f;
float maxVelocity = (Main.masterMode || BossRushEvent.BossRushActive) ? 20f : CalamityWorld.death ? 18f : 15f;
if (projectile.velocity.Length() < maxVelocity)
{
projectile.velocity *= 1.015f;
float acceleration = (Main.masterMode || BossRushEvent.BossRushActive) ? 1.02f : 1.015f;
projectile.velocity *= acceleration;
if (projectile.velocity.Length() > maxVelocity)
{
projectile.velocity.Normalize();
@@ -352,7 +353,12 @@ namespace CalamityMod.Projectiles
num133 = Player.FindClosest(projectile.Center, 1, 1);
projectile.ai[1] += 1f;
float homingStartTime = 30f;
float homingEndTime = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 90f : 75f;
float homingEndTime = (Main.masterMode || BossRushEvent.BossRushActive) ? 115f : CalamityWorld.death ? 90f : 75f;
// Stop homing when within a certain distance of the target
if (Vector2.Distance(projectile.Center, Main.player[num133].Center) < 80f && projectile.ai[1] < homingEndTime)
projectile.ai[1] = homingEndTime;
if (projectile.ai[1] < homingEndTime && projectile.ai[1] > homingStartTime)
{
float num134 = projectile.velocity.Length();
@@ -366,8 +372,9 @@ namespace CalamityMod.Projectiles
}
float maxVelocity = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 18f : 15f;
float acceleration = (Main.masterMode || BossRushEvent.BossRushActive) ? 1.02f : 1.015f;
if (projectile.velocity.Length() < maxVelocity)
projectile.velocity *= 1.015f;
projectile.velocity *= acceleration;
if (projectile.localAI[0] == 0f)
{