1 - Removed Death Mode natural boss spawns.

2 - DoG phase 1 has more aggressive movement.
This commit is contained in:
mountaindrew10 committed 2022-03-30 19:05:12 -05:00
1 parent d8fa336ed9
commit b62185c24d
5 files changed
+190 -614

No files matched your search

-21
View File
@@ -214,14 +214,6 @@ namespace CalamityMod
case CalamityModMessageType.BossRushEndTimer:
BossRushEvent.EndTimer = reader.ReadInt32();
break;
case CalamityModMessageType.BossSpawnCountdownSync:
int countdown2 = reader.ReadInt32();
CalamityWorld.bossSpawnCountdown = countdown2;
break;
case CalamityModMessageType.BossTypeSync:
int type = reader.ReadInt32();
CalamityWorld.bossType = type;
break;
case CalamityModMessageType.EndBossRush:
BossRushEvent.EndEffects();
break;
@@ -260,14 +252,6 @@ namespace CalamityMod
CalamityWorld.DraedonMechToSummon = (ExoMech)reader.ReadInt32();
break;
//
// Death Mode boss spawn countdown sync
//
case CalamityModMessageType.DeathBossSpawnCountdownSync:
int countdown4 = reader.ReadInt32();
CalamityWorld.deathBossSpawnCooldown = countdown4;
break;
//
// Reforge syncs
//
@@ -395,8 +379,6 @@ namespace CalamityMod
BossRushStage,
BossRushStartTimer,
BossRushEndTimer,
BossSpawnCountdownSync,
BossTypeSync,
EndBossRush,
BRHostileProjKillSync, // TODO -- Simplify this. Only one packet needs be sent: "kill all hostile projectiles for N frames".
TeleportPlayer, // also used by Astral Arcanum.
@@ -406,9 +388,6 @@ namespace CalamityMod
AcidRainOldDukeSummonSync,
EncounteredOldDukeSync,
// Death Mode environmental syncs
DeathBossSpawnCountdownSync, // TODO -- This currently syncs every frame and shouldn't. It only needs to sync once, when the countdown starts.
// Reforge syncs
ItemTypeLastReforgedSync, // TODO -- there has to be a better way to do this, but I don't know what it is
ReforgeTierSafetySync,
-2
View File
@@ -177,8 +177,6 @@ namespace CalamityMod.Localization
new [] { "BossRushTierFourEndText2", "Go forth and conquer 'til the ritual's end!" },
new [] { "BossRushTierFiveEndText", "Hmm? You expected a reward beyond this mere pebble? Patience, the true reward will become apparent in time..." },
new [] { "BossSpawnText", "Something is approaching..." },
new [] { "MeleeLevelUp", "Melee weapon proficiency level up!" },
new [] { "MeleeLevelUpFinal", "Melee weapon proficiency maxed out!" },
new [] { "RangedLevelUp", "Ranged weapon proficiency level up!" },
+190 -217
View File
@@ -51,6 +51,9 @@ namespace CalamityMod.NPCs.DevourerofGods
phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath);
}
// Laser velocity
private const float laserVelocity = 10f;
// Phase 1 variables
// Enums
@@ -279,8 +282,18 @@ namespace CalamityMod.NPCs.DevourerofGods
// Stop rain
CalamityMod.StopRain();
// Variables
Vector2 vector = npc.Center;
// Get a target
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
npc.TargetClosest();
// Despawn safety, make sure to target another player if the current player target is too far away
if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles)
npc.TargetClosest();
Player player = Main.player[npc.target];
// Variables
Vector2 vector = npc.Center;
bool flies = npc.ai[3] == 0f;
bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive;
bool expertMode = Main.expertMode || BossRushEvent.BossRushActive;
@@ -302,6 +315,40 @@ namespace CalamityMod.NPCs.DevourerofGods
bool phase6 = lifeRatio < 0.18f;
bool phase7 = lifeRatio < 0.09f;
// Velocity variables
float fallSpeed = malice ? 19f : death ? 17.5f : 16f;
if (expertMode)
fallSpeed += 4f * (1f - lifeRatio);
float speed = malice ? 18f : death ? 16.5f : 15f;
float turnSpeed = malice ? 0.36f : death ? 0.33f : 0.3f;
float homingSpeed = malice ? 36f : death ? 30f : 24f;
float homingTurnSpeed = malice ? 0.48f : death ? 0.405f : 0.33f;
if (expertMode)
{
speed += 3f * (1f - lifeRatio);
turnSpeed += 0.06f * (1f - lifeRatio);
homingSpeed += 12f * (1f - lifeRatio);
homingTurnSpeed += 0.15f * (1f - lifeRatio);
}
float groundPhaseTurnSpeed = malice ? 0.3f : death ? 0.24f : 0.18f;
if (expertMode)
groundPhaseTurnSpeed += 0.1f * (1f - lifeRatio);
groundPhaseTurnSpeed += Vector2.Distance(player.Center, npc.Center) * 0.0002f;
// How long it takes before swapping phases
int phaseLimit = death ? 600 : 900;
if (expertMode && npc.ai[3] == 0f)
{
phaseLimit /= 1 + (int)((death ? 4f : 5f) * (1f - lifeRatio));
if (phaseLimit < 180)
phaseLimit = 180;
}
// Continuously reset certain things.
AttemptingToEnterPortal = false;
@@ -312,16 +359,6 @@ namespace CalamityMod.NPCs.DevourerofGods
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
// Get a target
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
npc.TargetClosest();
// Despawn safety, make sure to target another player if the current player target is too far away
if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles)
npc.TargetClosest();
Player player = Main.player[npc.target];
// Despawn
if (player.dead)
{
@@ -648,7 +685,6 @@ namespace CalamityMod.NPCs.DevourerofGods
// Laser walls
if (!phase6 && laserWallPhase == (int)LaserWallPhase.FireLaserWalls)
{
float speed = 10f;
float spawnOffset = 1500f;
float divisor = malice ? 100f : 120f;
@@ -671,15 +707,15 @@ namespace CalamityMod.NPCs.DevourerofGods
for (int x = 0; x < totalShots_Phase2; x++)
{
Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0], -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0], speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0], -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0], laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
shotSpacing_Phase2[0] -= spacingVar_Phase2;
}
if (expertMode)
{
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
}
break;
@@ -689,15 +725,15 @@ namespace CalamityMod.NPCs.DevourerofGods
targetPosY += 50f;
for (int x = 0; x < totalShots_Phase2; x++)
{
Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0], -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0], speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0], -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0], laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
shotSpacing_Phase2[0] -= spacingVar_Phase2;
}
if (expertMode)
{
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
}
break;
@@ -708,18 +744,18 @@ namespace CalamityMod.NPCs.DevourerofGods
{
start = new Vector2(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0]);
aim.Y += laserWallSpacingOffset * (x - halfTotalDiagonalShots);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
start = new Vector2(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0]);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
shotSpacing_Phase2[0] -= diagonalSpacingVar;
}
Projectile.NewProjectile(player.Center.X, targetPosY + spawnOffset, 0f, -speed, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.Center.X, targetPosY - spawnOffset, 0f, speed, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.Center.X, targetPosY + spawnOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.Center.X, targetPosY - spawnOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer);
break;
@@ -727,21 +763,21 @@ namespace CalamityMod.NPCs.DevourerofGods
for (int x = 0; x < totalShots_Phase2; x++)
{
Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0], -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0], speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0], -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0], laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
shotSpacing_Phase2[0] -= spacingVar_Phase2;
}
int totalBonusLasers = totalShots_Phase2 / 2;
for (int x = 0; x < totalBonusLasers; x++)
{
Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[3], -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[3], speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[3], -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[3], laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
shotSpacing_Phase2[3] -= Main.rand.NextBool(2) ? 180 : 200;
}
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
break;
@@ -751,18 +787,18 @@ namespace CalamityMod.NPCs.DevourerofGods
{
start = new Vector2(player.position.X + shotSpacing_Phase2[0], targetPosY + spawnOffset);
aim.X += laserWallSpacingOffset * (x - halfTotalDiagonalShots);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
start = new Vector2(player.position.X + shotSpacing_Phase2[0], targetPosY - spawnOffset);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
shotSpacing_Phase2[0] -= diagonalSpacingVar;
}
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
break;
}
@@ -782,14 +818,14 @@ namespace CalamityMod.NPCs.DevourerofGods
// Lower wall
for (int x = 0; x < totalShots_Phase2; x++)
{
Projectile.NewProjectile(player.position.X + shotSpacing_Phase2[1], player.position.Y + spawnOffset, 0f, -speed, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + shotSpacing_Phase2[1], player.position.Y + spawnOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer);
shotSpacing_Phase2[1] -= spacingVar_Phase2;
}
// Upper wall
for (int x = 0; x < totalShots_Phase2; x++)
{
Projectile.NewProjectile(player.position.X + shotSpacing_Phase2[2], player.position.Y - spawnOffset, 0f, speed, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + shotSpacing_Phase2[2], player.position.Y - spawnOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer);
shotSpacing_Phase2[2] -= spacingVar_Phase2;
}
@@ -814,11 +850,6 @@ namespace CalamityMod.NPCs.DevourerofGods
}
}
float fallSpeed = malice ? 19.5f : death ? 17.75f : 16f;
if (expertMode)
fallSpeed += 3.5f * (1f - lifeRatio);
// Movement
int num180 = (int)(npc.position.X / 16f) - 1;
int num181 = (int)((npc.position.X + npc.width) / 16f) + 2;
@@ -839,8 +870,6 @@ namespace CalamityMod.NPCs.DevourerofGods
else if (npc.velocity.X > 0f)
npc.spriteDirection = 1;
int phaseLimit = death ? 600 : 900;
// Flight
if (npc.ai[3] == 0f)
{
@@ -861,24 +890,6 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.localAI[1] = 0f;
float speed = malice ? 18f : death ? 16.5f : 15f;
float turnSpeed = malice ? 0.36f : death ? 0.33f : 0.3f;
float homingSpeed = malice ? 36f : death ? 30f : 24f;
float homingTurnSpeed = malice ? 0.48f : death ? 0.405f : 0.33f;
if (expertMode)
{
phaseLimit /= 1 + (int)(5f * (1f - lifeRatio));
if (phaseLimit < 180)
phaseLimit = 180;
speed += 3f * (1f - lifeRatio);
turnSpeed += 0.06f * (1f - lifeRatio);
homingSpeed += 12f * (1f - lifeRatio);
homingTurnSpeed += 0.15f * (1f - lifeRatio);
}
// Go to ground phase sooner
if (increaseSpeedMore)
{
@@ -1071,13 +1082,6 @@ namespace CalamityMod.NPCs.DevourerofGods
calamityGlobalNPC.newAI[2] += 1f;
float turnSpeed = malice ? 0.3f : death ? 0.24f : 0.18f;
if (expertMode)
turnSpeed += 0.1f * (1f - lifeRatio);
turnSpeed += Vector2.Distance(player.Center, npc.Center) * 0.0002f;
// Enrage
if (increaseSpeedMore)
{
@@ -1086,10 +1090,10 @@ namespace CalamityMod.NPCs.DevourerofGods
SpawnTeleportLocation(player);
}
else
turnSpeed *= 4f;
groundPhaseTurnSpeed *= 4f;
}
else if (increaseSpeed)
turnSpeed *= 2f;
groundPhaseTurnSpeed *= 2f;
if (!flies)
{
@@ -1119,8 +1123,6 @@ namespace CalamityMod.NPCs.DevourerofGods
Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height);
int num954 = death ? 1125 : 1200;
if (lifeRatio < 0.8f && lifeRatio > 0.2f && !death)
num954 = 1400;
if (expertMode)
num954 -= (int)(150f * (1f - lifeRatio));
@@ -1150,7 +1152,7 @@ namespace CalamityMod.NPCs.DevourerofGods
else
npc.localAI[1] = 0f;
float num189 = turnSpeed;
float num189 = groundPhaseTurnSpeed;
Vector2 vector18 = npc.Center;
float num191 = player.Center.X;
float num192 = player.Center.Y;
@@ -1163,7 +1165,7 @@ namespace CalamityMod.NPCs.DevourerofGods
if (!flies)
{
npc.velocity.Y += turnSpeed;
npc.velocity.Y += groundPhaseTurnSpeed;
if (npc.velocity.Y > fallSpeed)
npc.velocity.Y = fallSpeed;
@@ -1210,72 +1212,72 @@ namespace CalamityMod.NPCs.DevourerofGods
if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)))
{
if (npc.velocity.X < num191)
npc.velocity.X += turnSpeed * 1.5f;
npc.velocity.X += groundPhaseTurnSpeed * 1.5f;
else if (npc.velocity.X > num191)
npc.velocity.X -= turnSpeed * 1.5f;
npc.velocity.X -= groundPhaseTurnSpeed * 1.5f;
if (npc.velocity.Y < num192)
npc.velocity.Y += turnSpeed * 1.5f;
npc.velocity.Y += groundPhaseTurnSpeed * 1.5f;
else if (npc.velocity.Y > num192)
npc.velocity.Y -= turnSpeed * 1.5f;
npc.velocity.Y -= groundPhaseTurnSpeed * 1.5f;
}
if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))
{
if (npc.velocity.X < num191)
npc.velocity.X += turnSpeed;
npc.velocity.X += groundPhaseTurnSpeed;
else if (npc.velocity.X > num191)
npc.velocity.X -= turnSpeed;
npc.velocity.X -= groundPhaseTurnSpeed;
if (npc.velocity.Y < num192)
npc.velocity.Y += turnSpeed;
npc.velocity.Y += groundPhaseTurnSpeed;
else if (npc.velocity.Y > num192)
npc.velocity.Y -= turnSpeed;
npc.velocity.Y -= groundPhaseTurnSpeed;
if (Math.Abs(num192) < fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f)))
{
if (npc.velocity.Y > 0f)
npc.velocity.Y += turnSpeed * 2f;
npc.velocity.Y += groundPhaseTurnSpeed * 2f;
else
npc.velocity.Y -= turnSpeed * 2f;
npc.velocity.Y -= groundPhaseTurnSpeed * 2f;
}
if (Math.Abs(num191) < fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f)))
{
if (npc.velocity.X > 0f)
npc.velocity.X += turnSpeed * 2f;
npc.velocity.X += groundPhaseTurnSpeed * 2f;
else
npc.velocity.X -= turnSpeed * 2f;
npc.velocity.X -= groundPhaseTurnSpeed * 2f;
}
}
else if (num25 > num26)
{
if (npc.velocity.X < num191)
npc.velocity.X += turnSpeed * 1.1f;
npc.velocity.X += groundPhaseTurnSpeed * 1.1f;
else if (npc.velocity.X > num191)
npc.velocity.X -= turnSpeed * 1.1f;
npc.velocity.X -= groundPhaseTurnSpeed * 1.1f;
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y += turnSpeed;
npc.velocity.Y += groundPhaseTurnSpeed;
else
npc.velocity.Y -= turnSpeed;
npc.velocity.Y -= groundPhaseTurnSpeed;
}
}
else
{
if (npc.velocity.Y < num192)
npc.velocity.Y += turnSpeed * 1.1f;
npc.velocity.Y += groundPhaseTurnSpeed * 1.1f;
else if (npc.velocity.Y > num192)
npc.velocity.Y -= turnSpeed * 1.1f;
npc.velocity.Y -= groundPhaseTurnSpeed * 1.1f;
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2)
{
if (npc.velocity.X > 0f)
npc.velocity.X += turnSpeed;
npc.velocity.X += groundPhaseTurnSpeed;
else
npc.velocity.X -= turnSpeed;
npc.velocity.X -= groundPhaseTurnSpeed;
}
}
}
@@ -1396,7 +1398,6 @@ namespace CalamityMod.NPCs.DevourerofGods
if (phase2)
{
float speed = 10f;
float spawnOffset = 1500f;
float divisor = malice ? 240f : death ? 360f : 480f;
@@ -1420,14 +1421,14 @@ namespace CalamityMod.NPCs.DevourerofGods
{
start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing);
aim.Y += laserWallSpacingOffset * (x - 3);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
shotSpacing -= spacingVar;
}
if (expertMode)
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
break;
@@ -1437,14 +1438,14 @@ namespace CalamityMod.NPCs.DevourerofGods
{
start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing);
aim.Y += laserWallSpacingOffset * (x - 3);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
shotSpacing -= spacingVar;
}
if (expertMode)
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
break;
@@ -1454,11 +1455,11 @@ namespace CalamityMod.NPCs.DevourerofGods
{
start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing);
aim.Y += laserWallSpacingOffset * (x - 3);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
shotSpacing -= spacingVar;
@@ -1466,8 +1467,8 @@ namespace CalamityMod.NPCs.DevourerofGods
if (expertMode)
{
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
}
break;
@@ -1481,20 +1482,20 @@ namespace CalamityMod.NPCs.DevourerofGods
{
start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing);
aim.Y += laserWallSpacingOffset * (x - 3);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing);
velocity = Vector2.Normalize(aim - start) * speed;
velocity = Vector2.Normalize(aim - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
start = new Vector2(player.position.X + shotSpacing, player.position.Y + spawnOffset);
aimClone.X += laserWallSpacingOffset * (x - 3);
velocity = Vector2.Normalize(aimClone - start) * speed;
velocity = Vector2.Normalize(aimClone - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
start = new Vector2(player.position.X + shotSpacing, player.position.Y - spawnOffset);
velocity = Vector2.Normalize(aimClone - start) * speed;
velocity = Vector2.Normalize(aimClone - start) * laserVelocity;
Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer);
}
@@ -1503,8 +1504,8 @@ namespace CalamityMod.NPCs.DevourerofGods
if (expertMode)
{
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
}
break;
@@ -1563,21 +1564,7 @@ namespace CalamityMod.NPCs.DevourerofGods
// Flying movement
npc.localAI[1] = 0f;
float phaseChangeRate = 1f + (expertMode ? 9f * (1f - lifeRatio) : 0f);
calamityGlobalNPC.newAI[2] += phaseChangeRate;
float speed = malice ? 18f : death ? 16.5f : 15f;
float turnSpeed = malice ? 0.36f : death ? 0.33f : 0.3f;
float homingSpeed = malice ? 27f : death ? 22.5f : 18f;
float homingTurnSpeed = malice ? 0.48f : death ? 0.405f : 0.33f;
if (expertMode)
{
speed += 3f * (1f - lifeRatio);
turnSpeed += 0.06f * (1f - lifeRatio);
homingSpeed += 9f * (1f - lifeRatio);
homingTurnSpeed += 0.15f * (1f - lifeRatio);
}
calamityGlobalNPC.newAI[2] += 1f;
// Go to ground phase sooner
if (increaseSpeedMore)
@@ -1736,7 +1723,7 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2;
if (calamityGlobalNPC.newAI[2] > 900f)
if (calamityGlobalNPC.newAI[2] > phaseLimit)
{
npc.ai[3] = 1f;
calamityGlobalNPC.newAI[2] = 0f;
@@ -1756,30 +1743,11 @@ namespace CalamityMod.NPCs.DevourerofGods
calamityGlobalNPC.newAI[2] += 1f;
float fallSpeed = malice ? 19.5f : death ? 17.75f : 16f;
float speed = malice ? 0.26f : death ? 0.22f : 0.18f;
float turnSpeed = malice ? 0.24f : death ? 0.18f : 0.12f;
if (expertMode)
{
fallSpeed += 3.5f * (1f - lifeRatio);
speed += 0.08f * (1f - lifeRatio);
turnSpeed += 0.12f * (1f - lifeRatio);
speed += distanceFromTarget * 0.00005f * (1f - lifeRatio);
turnSpeed += distanceFromTarget * 0.00005f * (1f - lifeRatio);
}
// Enrage
if (increaseSpeedMore)
{
speed *= 4f;
turnSpeed *= 4f;
}
groundPhaseTurnSpeed *= 4f;
else if (increaseSpeed)
{
speed *= 2f;
turnSpeed *= 2f;
}
groundPhaseTurnSpeed *= 2f;
if (!flies)
{
@@ -1805,13 +1773,16 @@ namespace CalamityMod.NPCs.DevourerofGods
if (!flies)
{
npc.localAI[1] = 1f;
Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height);
int num954 = death ? 1100 : 1175;
int num954 = death ? 1125 : 1200;
if (expertMode)
num954 -= (int)(150f * (1f - lifeRatio));
if (num954 < 1025)
num954 = 1025;
if (num954 < 1050)
num954 = 1050;
bool flag95 = true;
if (npc.position.Y > player.position.Y)
@@ -1835,130 +1806,132 @@ namespace CalamityMod.NPCs.DevourerofGods
else
npc.localAI[1] = 0f;
Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num20 = player.position.X + (player.width / 2);
float num21 = player.position.Y + (player.height / 2);
num20 = (int)(num20 / 16f) * 16;
num21 = (int)(num21 / 16f) * 16;
vector3.X = (int)(vector3.X / 16f) * 16;
vector3.Y = (int)(vector3.Y / 16f) * 16;
num20 -= vector3.X;
num21 -= vector3.Y;
float num189 = groundPhaseTurnSpeed;
Vector2 vector18 = npc.Center;
float num191 = player.Center.X;
float num192 = player.Center.Y;
num191 = (int)(num191 / 16f) * 16;
num192 = (int)(num192 / 16f) * 16;
vector18.X = (int)(vector18.X / 16f) * 16;
vector18.Y = (int)(vector18.Y / 16f) * 16;
num191 -= vector18.X;
num192 -= vector18.Y;
if (!flies)
{
npc.velocity.Y += turnSpeed;
npc.velocity.Y += groundPhaseTurnSpeed;
if (npc.velocity.Y > fallSpeed)
npc.velocity.Y = fallSpeed;
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 1.8)
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 2.2)
{
if (npc.velocity.X < 0f)
npc.velocity.X -= speed * 1.1f;
npc.velocity.X -= num189 * 1.1f;
else
npc.velocity.X += speed * 1.1f;
npc.velocity.X += num189 * 1.1f;
}
else if (npc.velocity.Y == fallSpeed)
{
if (npc.velocity.X < num20)
npc.velocity.X += speed;
else if (npc.velocity.X > num20)
npc.velocity.X -= speed;
if (npc.velocity.X < num191)
npc.velocity.X += num189;
else if (npc.velocity.X > num191)
npc.velocity.X -= num189;
}
else if (npc.velocity.Y > 4f)
{
if (npc.velocity.X < 0f)
npc.velocity.X += speed * 0.9f;
npc.velocity.X += num189 * 0.9f;
else
npc.velocity.X -= speed * 0.9f;
npc.velocity.X -= num189 * 0.9f;
}
}
else
{
double maximumSpeed1 = malice ? 0.48 : death ? 0.44 : 0.4;
double maximumSpeed2 = malice ? 1.16 : death ? 1.08 : 1D;
double maximumSpeed1 = malice ? 0.52 : death ? 0.46 : 0.4;
double maximumSpeed2 = malice ? 1.25 : death ? 1.125 : 1D;
if (expertMode)
{
maximumSpeed1 += 0.08f * (1f - lifeRatio);
maximumSpeed2 += 0.16f * (1f - lifeRatio);
maximumSpeed1 += 0.1f * (1f - lifeRatio);
maximumSpeed2 += 0.2f * (1f - lifeRatio);
}
float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21);
float num25 = Math.Abs(num20);
float num26 = Math.Abs(num21);
float num27 = fallSpeed / num22;
num20 *= num27;
num21 *= num27;
float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192);
float num25 = Math.Abs(num191);
float num26 = Math.Abs(num192);
float num27 = fallSpeed / num193;
num191 *= num27;
num192 *= num27;
if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)))
if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)))
{
if (npc.velocity.X < num20)
npc.velocity.X += turnSpeed * 1.3f;
else if (npc.velocity.X > num20)
npc.velocity.X -= turnSpeed * 1.3f;
if (npc.velocity.X < num191)
npc.velocity.X += groundPhaseTurnSpeed * 1.5f;
else if (npc.velocity.X > num191)
npc.velocity.X -= groundPhaseTurnSpeed * 1.5f;
if (npc.velocity.Y < num21)
npc.velocity.Y += turnSpeed * 1.3f;
else if (npc.velocity.Y > num21)
npc.velocity.Y -= turnSpeed * 1.3f;
if (npc.velocity.Y < num192)
npc.velocity.Y += groundPhaseTurnSpeed * 1.5f;
else if (npc.velocity.Y > num192)
npc.velocity.Y -= groundPhaseTurnSpeed * 1.5f;
}
if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))
if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))
{
if (npc.velocity.X < num20)
npc.velocity.X += speed;
else if (npc.velocity.X > num20)
npc.velocity.X -= speed;
if (npc.velocity.Y < num21)
npc.velocity.Y += speed;
else if (npc.velocity.Y > num21)
npc.velocity.Y -= speed;
if (npc.velocity.X < num191)
npc.velocity.X += groundPhaseTurnSpeed;
else if (npc.velocity.X > num191)
npc.velocity.X -= groundPhaseTurnSpeed;
if (Math.Abs(num21) < fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f)))
if (npc.velocity.Y < num192)
npc.velocity.Y += groundPhaseTurnSpeed;
else if (npc.velocity.Y > num192)
npc.velocity.Y -= groundPhaseTurnSpeed;
if (Math.Abs(num192) < fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f)))
{
if (npc.velocity.Y > 0f)
npc.velocity.Y += speed * 2f;
npc.velocity.Y += groundPhaseTurnSpeed * 2f;
else
npc.velocity.Y -= speed * 2f;
npc.velocity.Y -= groundPhaseTurnSpeed * 2f;
}
if (Math.Abs(num20) < fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f)))
if (Math.Abs(num191) < fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f)))
{
if (npc.velocity.X > 0f)
npc.velocity.X += speed * 2f;
npc.velocity.X += groundPhaseTurnSpeed * 2f;
else
npc.velocity.X -= speed * 2f;
npc.velocity.X -= groundPhaseTurnSpeed * 2f;
}
}
else if (num25 > num26)
{
if (npc.velocity.X < num20)
npc.velocity.X += speed * 1.1f;
else if (npc.velocity.X > num20)
npc.velocity.X -= speed * 1.1f;
if (npc.velocity.X < num191)
npc.velocity.X += groundPhaseTurnSpeed * 1.1f;
else if (npc.velocity.X > num191)
npc.velocity.X -= groundPhaseTurnSpeed * 1.1f;
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y += speed;
npc.velocity.Y += groundPhaseTurnSpeed;
else
npc.velocity.Y -= speed;
npc.velocity.Y -= groundPhaseTurnSpeed;
}
}
else
{
if (npc.velocity.Y < num21)
npc.velocity.Y += speed * 1.1f;
else if (npc.velocity.Y > num21)
npc.velocity.Y -= speed * 1.1f;
if (npc.velocity.Y < num192)
npc.velocity.Y += groundPhaseTurnSpeed * 1.1f;
else if (npc.velocity.Y > num192)
npc.velocity.Y -= groundPhaseTurnSpeed * 1.1f;
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2)
{
if (npc.velocity.X > 0f)
npc.velocity.X += speed;
npc.velocity.X += groundPhaseTurnSpeed;
else
npc.velocity.X -= speed;
npc.velocity.X -= groundPhaseTurnSpeed;
}
}
}
@@ -1983,7 +1956,7 @@ namespace CalamityMod.NPCs.DevourerofGods
if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit)
npc.netUpdate = true;
if (calamityGlobalNPC.newAI[2] > 900f)
if (calamityGlobalNPC.newAI[2] > phaseLimit)
{
npc.ai[3] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
-8
View File
@@ -41,11 +41,6 @@ namespace CalamityMod.World
// Boss Rush
public static int bossRushHostileProjKillCounter = 0;
// Death Mode natural boss spawns
public static int bossSpawnCountdown = 0; // Death Mode natural boss spawn countdown
public static int bossType = 0; // Death Mode natural boss spawn type
public static int deathBossSpawnCooldown = 0; // Cooldown between Death Mode natural boss spawns
// Modes
public static bool onionMode = false; // Extra accessory from Moon Lord
public static bool revenge = false; // Revengeance Mode
@@ -255,10 +250,7 @@ namespace CalamityMod.World
ArmoredDiggerSpawnCooldown = 0;
BossRushEvent.BossRushActive = false;
BossRushEvent.BossRushSpawnCountdown = 180;
bossSpawnCountdown = 0;
bossRushHostileProjKillCounter = 0;
deathBossSpawnCooldown = 0;
bossType = 0;
newAltarX = 0;
newAltarY = 0;
abyssChasmBottom = 0;
-366
View File
@@ -91,7 +91,6 @@ namespace CalamityMod.World
TrySpawnArmoredDigger(player, modPlayer);
TrySpawnDungeonGuardian(player);
TrySpawnAEoW(player, modPlayer);
TrySpawnRandomDeathmodeBosses(player, modPlayer);
// Very, very, very rarely display a Lorde joke text if the system clock is set to April Fools Day.
if (Main.rand.NextBool(100000000) && DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
@@ -461,370 +460,5 @@ namespace CalamityMod.World
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<EidolonWyrmHeadHuge>());
}
#endregion
#region Handle Deathmode Random Boss Spawns
public static void TrySpawnRandomDeathmodeBosses(Player player, CalamityPlayer modPlayer)
{
void BossText()
{
string key = "Mods.CalamityMod.BossSpawnText";
Color messageColor = Color.Crimson;
CalamityUtils.DisplayLocalizedText(key, messageColor);
}
//does not occur while a boss is alive or during certain events)
if (!death || CalamityPlayer.areThereAnyDamnBosses || Main.snowMoon || Main.pumpkinMoon || DD2Event.Ongoing || player.statLifeMax2 < 300 || WorldGen.spawnEye || WorldGen.spawnHardBoss > 0)
return;
if (bossSpawnCountdown <= 0 && deathBossSpawnCooldown <= 0) // Check for countdown and cooldown being 0
{
if (Main.rand.NextBool(50000))
{
// Only set countdown and boss type if conditions are met
// Night time bosses set message only before 11pm. Day time bosses only before 2pm.
if (!NPC.downedBoss1 && bossType == 0)
if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600)
{
BossText();
bossType = NPCID.EyeofCthulhu;
bossSpawnCountdown = 3600; // 1 minute
}
if (!NPC.downedBoss2 && bossType == 0)
if (player.ZoneCorrupt)
{
BossText();
bossType = NPCID.EaterofWorldsHead;
bossSpawnCountdown = 3600;
}
if (!NPC.downedBoss2 && bossType == 0)
if (player.ZoneCrimson)
{
BossText();
bossType = NPCID.BrainofCthulhu;
bossSpawnCountdown = 3600;
}
/*if (!NPC.downedQueenBee && bossType == 0)
if (player.ZoneJungle && !player.ZoneOverworldHeight && !player.ZoneSkyHeight)
{
BossText();
bossType = NPCID.QueenBee;
bossSpawnCountdown = 3600;
}*/
if (!downedDesertScourge && bossType == 0)
if (player.ZoneDesert)
{
BossText();
bossType = ModContent.NPCType<DesertScourgeHead>();
bossSpawnCountdown = 3600;
}
if (!downedPerforator && bossType == 0)
if (player.ZoneCrimson)
{
BossText();
bossType = ModContent.NPCType<PerforatorHive>();
bossSpawnCountdown = 3600;
}
if (!downedHiveMind && bossType == 0)
if (player.ZoneCorrupt)
{
BossText();
bossType = ModContent.NPCType<HiveMind>();
bossSpawnCountdown = 3600;
}
if (!downedCrabulon && bossType == 0)
if (player.ZoneGlowshroom)
{
BossText();
bossType = ModContent.NPCType<CrabulonIdle>();
bossSpawnCountdown = 3600;
}
if (Main.hardMode)
{
if (!NPC.downedMechBoss1 && bossType == 0)
if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600)
{
BossText();
bossType = NPCID.TheDestroyer;
bossSpawnCountdown = 3600;
}
if (!NPC.downedMechBoss2 && bossType == 0)
if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600)
{
BossText();
bossType = NPCID.Spazmatism;
bossSpawnCountdown = 3600;
}
if (!NPC.downedMechBoss3 && bossType == 0)
if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600)
{
BossText();
bossType = NPCID.SkeletronPrime;
bossSpawnCountdown = 3600;
}
if (!NPC.downedPlantBoss && bossType == 0)
if (player.ZoneJungle && !player.ZoneOverworldHeight && !player.ZoneSkyHeight)
{
BossText();
bossType = NPCID.Plantera;
bossSpawnCountdown = 3600;
}
if (!NPC.downedFishron && bossType == 0)
if (player.ZoneBeach && !modPlayer.ZoneSulphur)
{
BossText();
bossType = NPCID.DukeFishron;
bossSpawnCountdown = 3600;
}
if (!downedCryogen && bossType == 0)
if (player.ZoneSnow && player.ZoneOverworldHeight)
{
BossText();
bossType = ModContent.NPCType<Cryogen>();
bossSpawnCountdown = 3600;
}
if (!downedCalamitas && bossType == 0)
if (!Main.dayTime && player.ZoneOverworldHeight && Main.time < 12600)
{
BossText();
bossType = ModContent.NPCType<CalamitasRun3>();
bossSpawnCountdown = 3600;
}
if (!downedAstrageldon && bossType == 0)
if (modPlayer.ZoneAstral &&
!Main.dayTime && player.ZoneOverworldHeight)
{
BossText();
bossType = ModContent.NPCType<AstrumAureus>();
bossSpawnCountdown = 3600;
}
/*if (!downedPlaguebringer && bossType == 0)
if (player.ZoneJungle && NPC.downedGolemBoss && !player.ZoneOverworldHeight && !player.ZoneSkyHeight)
{
BossText();
bossType = ModContent.NPCType<PlaguebringerGoliath>();
bossSpawnCountdown = 3600;
}*/
if (NPC.downedMoonlord)
{
if (!downedGuardians && bossType == 0)
if (Main.dayTime && (player.ZoneUnderworldHeight ||
(player.ZoneHoly && player.ZoneOverworldHeight)) && Main.time < 34200) //only before 2pm
{
BossText();
bossType = ModContent.NPCType<ProfanedGuardianBoss>();
bossSpawnCountdown = 3600;
}
if (!downedBumble && bossType == 0)
if (player.ZoneJungle && player.ZoneOverworldHeight)
{
BossText();
bossType = ModContent.NPCType<Bumblefuck>();
bossSpawnCountdown = 3600;
}
}
}
if (Main.netMode == NetmodeID.Server)
{
var netMessage = CalamityMod.Instance.GetPacket();
netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync);
netMessage.Write(bossSpawnCountdown);
netMessage.Send();
var netMessage2 = CalamityMod.Instance.GetPacket();
netMessage2.Write((byte)CalamityModMessageType.BossTypeSync);
netMessage2.Write(bossType);
netMessage2.Send();
}
}
}
else
{
if (bossSpawnCountdown > 0)
{
bossSpawnCountdown--;
if (Main.netMode == NetmodeID.Server)
{
var netMessage = CalamityMod.Instance.GetPacket();
netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync);
netMessage.Write(bossSpawnCountdown);
netMessage.Send();
}
}
if (bossSpawnCountdown <= 0 && deathBossSpawnCooldown <= 0) // Check both cooldowns again here to avoid infinite message possibilities
{
bool canSpawn = true;
switch (bossType)
{
case NPCID.EyeofCthulhu:
if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200)
canSpawn = false;
break;
case NPCID.EaterofWorldsHead:
if (!player.ZoneCorrupt)
canSpawn = false;
break;
case NPCID.BrainofCthulhu:
if (!player.ZoneCrimson)
canSpawn = false;
break;
/*case NPCID.QueenBee:
if (!player.ZoneJungle || player.ZoneOverworldHeight || player.ZoneSkyHeight)
canSpawn = false;
break;*/
case NPCID.TheDestroyer:
if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200)
canSpawn = false;
break;
case NPCID.Spazmatism:
if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200)
canSpawn = false;
break;
case NPCID.SkeletronPrime:
if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200)
canSpawn = false;
break;
case NPCID.Plantera:
if (!player.ZoneJungle || player.ZoneOverworldHeight || player.ZoneSkyHeight)
canSpawn = false;
break;
case NPCID.DukeFishron:
if (!player.ZoneBeach)
canSpawn = false;
break;
}
if (bossType == ModContent.NPCType<DesertScourgeHead>())
{
if (!player.ZoneDesert)
canSpawn = false;
}
else if (bossType == ModContent.NPCType<PerforatorHive>())
{
if (!player.ZoneCrimson)
canSpawn = false;
}
else if (bossType == ModContent.NPCType<HiveMind>())
{
if (!player.ZoneCorrupt)
canSpawn = false;
}
else if (bossType == ModContent.NPCType<CrabulonIdle>())
{
if (!player.ZoneGlowshroom)
canSpawn = false;
}
else if (bossType == ModContent.NPCType<Cryogen>())
{
if (!player.ZoneSnow || !player.ZoneOverworldHeight)
canSpawn = false;
}
else if (bossType == ModContent.NPCType<CalamitasRun3>())
{
if (Main.dayTime || !player.ZoneOverworldHeight || Main.time > 16200)
canSpawn = false;
}
else if (bossType == ModContent.NPCType<AstrumAureus>())
{
if (!modPlayer.ZoneAstral ||
Main.dayTime || !player.ZoneOverworldHeight)
canSpawn = false;
}
/*else if (bossType == ModContent.NPCType<PlaguebringerGoliath>())
{
if (!player.ZoneJungle || player.ZoneOverworldHeight || player.ZoneSkyHeight)
canSpawn = false;
}*/
else if (bossType == ModContent.NPCType<ProfanedGuardianBoss>())
{
if (!Main.dayTime || (!player.ZoneUnderworldHeight &&
(!player.ZoneHoly || !player.ZoneOverworldHeight)) || Main.time > 37800)
canSpawn = false;
}
else if (bossType == ModContent.NPCType<Bumblefuck>())
{
if (!player.ZoneJungle || !player.ZoneOverworldHeight)
canSpawn = false;
}
if (canSpawn)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (bossType == NPCID.Spazmatism)
NPC.SpawnOnPlayer(player.whoAmI, NPCID.Retinazer);
else if (bossType == ModContent.NPCType<ProfanedGuardianBoss>())
{
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<ProfanedGuardianBoss2>());
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<ProfanedGuardianBoss3>());
}
else if (bossType == ModContent.NPCType<DesertScourgeHead>())
{
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<DesertNuisanceHead>());
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<DesertNuisanceHead>());
}
if (bossType == NPCID.DukeFishron)
{
NPC.NewNPC((int)player.Center.X - 300, (int)player.Center.Y - 300, bossType);
}
else
{
NPC.SpawnOnPlayer(player.whoAmI, bossType);
}
}
deathBossSpawnCooldown = 86400; // 24 minutes (1 full Terraria day)
if (Main.netMode == NetmodeID.Server)
{
var netMessage = CalamityMod.Instance.GetPacket();
netMessage.Write((byte)CalamityModMessageType.DeathBossSpawnCountdownSync);
netMessage.Write(deathBossSpawnCooldown);
netMessage.Send();
}
}
bossType = 0;
if (Main.netMode == NetmodeID.Server)
{
var netMessage = CalamityMod.Instance.GetPacket();
netMessage.Write((byte)CalamityModMessageType.BossTypeSync);
netMessage.Write(bossType);
netMessage.Send();
}
}
// IMPORTANT! Decrement this cooldown AFTER everything else to avoid infinite possibilities
if (deathBossSpawnCooldown > 0)
{
deathBossSpawnCooldown--;
if (Main.netMode == NetmodeID.Server)
{
var netMessage = CalamityMod.Instance.GetPacket();
netMessage.Write((byte)CalamityModMessageType.DeathBossSpawnCountdownSync);
netMessage.Write(deathBossSpawnCooldown);
netMessage.Send();
}
}
}
}
#endregion
}
}