From 277d51549d3711faee4931e8b0b1f4601980190d Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Thu, 9 Feb 2023 04:57:07 -0600 Subject: [PATCH] 1 - Healer heals the other guardians more. 2 - Commander and Defender both go low and shift from one side to the other from time to time in phase 1. 3 - Trees drop a bit less fruit. --- .../ProfanedGuardianCommander.cs | 42 ++++++++++++++++++- .../ProfanedGuardianDefender.cs | 2 +- Tiles/CalamityGlobalTile.cs | 2 +- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index fea0cebcd3..773db47e9b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -97,6 +97,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -108,6 +109,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) @@ -122,6 +124,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians { CalamityGlobalNPC.doughnutBoss = NPC.whoAmI; + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.1f, 0.9f, 0f); // Projectile and dust spawn location variables @@ -229,7 +233,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians healTimer = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - int healAmt = NPC.lifeMax / 20; + int healAmt = NPC.lifeMax / 10; if (healAmt > NPC.lifeMax - NPC.life) healAmt = NPC.lifeMax - NPC.life; @@ -332,6 +336,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians } // Charge variables + float moveToOtherSideInPhase1GateValue = 900f; + float timeBeforeMoveToOtherSideInPhase1Reset = moveToOtherSideInPhase1GateValue * 2f; + float totalGoLowDuration = 240f; + float goLowDuration = totalGoLowDuration * 0.5f; + float goLowDistance = 480f; float chargeVelocityMult = 0.25f; float maxChargeVelocity = (bossRush || biomeEnraged) ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; if (Main.getGoodWorld) @@ -351,6 +360,27 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[0] == 0f) { + // Dictates when the commander and defender will swap to the other side in phase 1 + if (healerAlive) + NPC.localAI[3] += 1f; + else + NPC.localAI[3] = 0f; + + // Go low just before moving to the other side to avoid bullshit hits + bool goLow = (NPC.localAI[3] > moveToOtherSideInPhase1GateValue - goLowDuration && NPC.localAI[3] <= moveToOtherSideInPhase1GateValue + goLowDuration) || + NPC.localAI[3] > timeBeforeMoveToOtherSideInPhase1Reset - goLowDuration || NPC.localAI[3] < 0f; + + // Swap from side to side over time + if (NPC.localAI[3] > moveToOtherSideInPhase1GateValue) + { + if (NPC.localAI[3] > timeBeforeMoveToOtherSideInPhase1Reset) + NPC.localAI[3] = -goLowDuration; + + calamityGlobalNPC.newAI[0] = -1f; + } + else + calamityGlobalNPC.newAI[0] = 1f; + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -371,8 +401,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians inertia *= 0.5f; velocity *= 1.5f; } + if (goLow) + { + inertia *= 0.75f; + velocity *= 1.25f; + } + + Vector2 destination = player.Center + Vector2.UnitX * distanceToStayAwayFromTarget * -NPC.direction * calamityGlobalNPC.newAI[0]; + if (goLow) + destination.Y += goLowDistance; - Vector2 destination = player.Center + Vector2.UnitX * distanceToStayAwayFromTarget * -NPC.direction; Vector2 targetVector = destination - NPC.Center; Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; float phaseGateValue = (bossRush || biomeEnraged) ? 50f : death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 065b97fbf9..922e39f580 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -194,7 +194,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians healTimer = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - int healAmt = NPC.lifeMax / 20; + int healAmt = NPC.lifeMax / 10; if (healAmt > NPC.lifeMax - NPC.life) healAmt = NPC.lifeMax - NPC.life; diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index aa6904d286..c9deb8c69f 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -158,7 +158,7 @@ namespace CalamityMod.Tiles if (WorldGen.IsTileALeafyTreeTop(treeX, treeY) && !Collision.SolidTiles(treeX - 2, treeX + 2, treeY - 2, treeY + 2)) { - int randomAmt = WorldGen.genRand.Next(2, 4); + int randomAmt = WorldGen.genRand.Next(1, 3); for (int z = 0; z < randomAmt; z++) { int treeDropItemType = 0;