From dfcfb349a82ac3b7ebf77583314655ffcb0eeada Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Thu, 17 Mar 2022 13:49:13 -0500 Subject: [PATCH] 1 - Astrum Aureus can be hit during teleportation now, increased HP by ~10%. 2 - Cal Clone becomes invisible, except for her glowmasks, while her brothers are alive. She now becomes invincible while her brothers are alive. 3 - Hive Mind no longer gaines increased DR from Dank Creepers, increased HP by ~10%. 4 - Perf Hive is no longer invincible while the large worm is alive, increased HP by ~10%. The worms also spawn at different health intervals: 75%, 50% and 25%. 5 - Destroyer Probes are no longer invincible for 2 seconds after spawning. 6 - Rev+ Duke Fishron is no longer invincible while transitioning phases, increased HP by ~20%. 7 - Plantera always photosynthesizes on the surface now with slower regen during nighttime, instead of gaining huge DR during nighttime. 8 - Skeletron always has max DR if a hand is alive. 9 - Skeletron Prime no longer gains increased defense from the amount of arms alive. He also transitions phases later so that the arm phase lasts a bit longer and the head phases don't drag on for so long. --- NPCs/AstrumAureus/AstrumAureus.cs | 6 +- NPCs/Calamitas/CalamitasRun3.cs | 2 - NPCs/CalamityAI.cs | 52 +++++---------- NPCs/CalamityGlobalNPC.cs | 2 +- NPCs/HiveMind/HiveMind.cs | 18 +---- NPCs/Perforator/PerforatorHive.cs | 37 ++++++++--- .../VanillaNPCOverrides/Bosses/DestroyerAI.cs | 16 +---- .../Bosses/DukeFishronAI.cs | 13 ---- NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs | 65 ++++++++----------- .../VanillaNPCOverrides/Bosses/SkeletronAI.cs | 4 +- .../Bosses/SkeletronPrimeAI.cs | 7 +- 11 files changed, 79 insertions(+), 143 deletions(-) diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 055a1e1332..7e243e5fcf 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.height = 374; npc.defense = 40; npc.DR_NERD(0.5f); - npc.LifeMaxNERB(NPC.downedMoonlord ? 243750 : 89200, NPC.downedMoonlord ? 292500 : 107000, 740000); // 30 seconds in boss rush + npc.LifeMaxNERB(NPC.downedMoonlord ? 196000 : 98000, NPC.downedMoonlord ? 235200 : 117600, 740000); // 30 seconds in boss rush npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -70,8 +70,6 @@ namespace CalamityMod.NPCs.AstrumAureus public override void SendExtraAI(BinaryWriter writer) { writer.Write(stomping); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); writer.Write(npc.alpha); writer.Write(npc.localAI[2]); for (int i = 0; i < 4; i++) @@ -81,8 +79,6 @@ namespace CalamityMod.NPCs.AstrumAureus public override void ReceiveExtraAI(BinaryReader reader) { stomping = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); npc.alpha = reader.ReadInt32(); npc.localAI[2] = reader.ReadSingle(); for (int i = 0; i < 4; i++) diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index 2cf870fb9f..9de3e661da 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -74,7 +74,6 @@ namespace CalamityMod.NPCs.Calamitas public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); @@ -86,7 +85,6 @@ namespace CalamityMod.NPCs.Calamitas public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); npc.localAI[1] = reader.ReadSingle(); diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 8b8ea2bdc6..1d6dc5bb55 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1293,7 +1293,6 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.Item109, npc.Center); calamityGlobalNPC.newAI[2] = 2f; SpawnDust(); - npc.alpha = 255; } else if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.4) { @@ -1303,45 +1302,33 @@ namespace CalamityMod.NPCs string key = "Mods.CalamityMod.CalamitasBossText2"; Color messageColor = Color.Orange; CalamityUtils.DisplayLocalizedText(key, messageColor); + + SpawnDust(); } else { Main.PlaySound(SoundID.Item109, npc.Center); calamityGlobalNPC.newAI[2] = 1f; SpawnDust(); - npc.alpha = 255; } } } } - // Huge DR boost if brothers are alive - if (expertMode) + // Immunity if brothers are alive + if (CalamityGlobalNPC.cataclysm != -1) { - if (CalamityGlobalNPC.cataclysm != -1) - { - if (Main.npc[CalamityGlobalNPC.cataclysm].active) - brotherAlive = true; - } - if (CalamityGlobalNPC.catastrophe != -1) - { - if (Main.npc[CalamityGlobalNPC.catastrophe].active) - brotherAlive = true; - } - if (brotherAlive) - { - calamityGlobalNPC.DR = 0.9999f; - calamityGlobalNPC.unbreakableDR = true; - } - else - { - calamityGlobalNPC.DR = death ? 0.075f : 0.15f; - calamityGlobalNPC.unbreakableDR = false; - } + if (Main.npc[CalamityGlobalNPC.cataclysm].active) + brotherAlive = true; + } + if (CalamityGlobalNPC.catastrophe != -1) + { + if (Main.npc[CalamityGlobalNPC.catastrophe].active) + brotherAlive = true; } - // Disable homing if brothers are alive - npc.chaseable = !brotherAlive; + if (brotherAlive) + npc.dontTakeDamage = true; void SpawnDust() { @@ -1565,8 +1552,8 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[3] += 1f; npc.damage = 0; - npc.chaseable = false; npc.dontTakeDamage = true; + npc.alpha = 255; float rotX = player.Center.X - npc.Center.X; float rotY = player.Center.Y - npc.Center.Y; @@ -1636,7 +1623,6 @@ namespace CalamityMod.NPCs npc.localAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - npc.alpha = 0; // Prevent bullshit charge hits when second bullet hell ends. if (phase5) @@ -1703,6 +1689,8 @@ namespace CalamityMod.NPCs return; } + npc.alpha = npc.dontTakeDamage ? 255 : 0; + // Float above target and fire lasers or fireballs if (npc.ai[1] == 0f) { @@ -3033,10 +3021,6 @@ namespace CalamityMod.NPCs // Mid-teleport else if (npc.ai[0] == 6f) { - // Become immune - npc.chaseable = false; - npc.dontTakeDamage = true; - if (death) npc.localAI[2] += 1f + 0.33f * (1f - lifeRatio); @@ -3105,10 +3089,6 @@ namespace CalamityMod.NPCs } } - // Become vulnerable - npc.chaseable = true; - npc.dontTakeDamage = false; - // Reset alpha and set AI to next phase (Idle) npc.alpha = 0; npc.ai[0] = 1f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 714289c965..c629787d58 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1123,7 +1123,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.DukeFishron) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)(npc.lifeMax * 1.4); npc.npcSlots = 20f; } else if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 16ee319a67..dc9b357ef5 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -95,7 +95,7 @@ namespace CalamityMod.NPCs.HiveMind npc.width = 178; npc.height = 122; npc.defense = 8; - npc.LifeMaxNERB(7800, 9360, 350000); + npc.LifeMaxNERB(8500, 10200, 350000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -405,8 +405,6 @@ namespace CalamityMod.NPCs.HiveMind npc.frame.Y = 0; npc.noGravity = true; npc.noTileCollide = true; - npc.Calamity().DR = 0f; - npc.Calamity().unbreakableDR = false; npc.scale = 1f; npc.alpha = 0; npc.dontTakeDamage = false; @@ -468,20 +466,6 @@ namespace CalamityMod.NPCs.HiveMind } } - if (expertMode) - { - if (NPC.AnyNPCs(ModContent.NPCType())) - { - npc.Calamity().DR = 0.9999f; - npc.Calamity().unbreakableDR = true; - } - else - { - npc.Calamity().DR = 0f; - npc.Calamity().unbreakableDR = false; - } - } - if (npc.ai[3] == 0f && npc.life > 0) npc.ai[3] = npc.lifeMax; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 71ca8e8142..569603dcc2 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 110; npc.height = 100; npc.defense = 4; - npc.LifeMaxNERB(4500, 5400, 270000); + npc.LifeMaxNERB(5000, 6000, 270000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -170,27 +170,22 @@ namespace CalamityMod.NPCs.Perforator npc.timeLeft = 1800; int wormsAlive = 0; - bool largeWormAlive = false; if (NPC.AnyNPCs(ModContent.NPCType())) - { wormsAlive++; - largeWormAlive = true; - } if (NPC.AnyNPCs(ModContent.NPCType())) wormsAlive++; if (NPC.AnyNPCs(ModContent.NPCType())) wormsAlive++; - npc.dontTakeDamage = largeWormAlive && expertMode; - if (npc.ai[3] == 0f && npc.life > 0) npc.ai[3] = npc.lifeMax; - if (npc.life > 0) + bool canSpawnWorms = !small || !medium || !large; + if (npc.life > 0 && canSpawnWorms) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)(npc.lifeMax * 0.3); + int num660 = (int)(npc.lifeMax * 0.25); if ((npc.life + num660) < npc.ai[3]) { npc.ai[3] = npc.life; @@ -209,8 +204,30 @@ namespace CalamityMod.NPCs.Perforator large = true; wormType = ModContent.NPCType(); } - NPC.NewNPC((int)npc.Center.X, (int)(npc.Center.Y + 800f), wormType, 1); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, wormType, 1); npc.TargetClosest(); + + Main.PlaySound(SoundID.NPCDeath23, npc.position); + + for (int num621 = 0; num621 < 16; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 170, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.25f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + for (int num623 = 0; num623 < 32; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 3f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } } } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs index 742aede064..97c4c59b7d 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs @@ -605,18 +605,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - // 2 seconds of immunity to prevent spawn killing - if (npc.Calamity().newAI[1] < 120f) - { - npc.Calamity().newAI[1] += 1f; - if (npc.Calamity().newAI[1] % 15f == 0f) - npc.SyncExtraAI(); - - npc.dontTakeDamage = true; - } - else - npc.dontTakeDamage = false; - // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -705,9 +693,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.velocity.Y > num5) npc.velocity.Y -= acceleration; - if (npc.Calamity().newAI[1] >= 120f) - npc.localAI[0] += 1f; - + npc.localAI[0] += 1f; if (npc.justHit) npc.localAI[0] = 0f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs index f94643714c..5ccfb282c2 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs @@ -143,10 +143,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && enrage; - // If the player isn't in the ocean biome or Fishron is transitioning between phases, become immune - if (!phase3AI) - npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; - // Enrage if (enrage || malice) { @@ -807,9 +803,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phase 3 else if (npc.ai[0] == 10f && !player.dead) { - npc.dontTakeDamage = false; - npc.chaseable = false; - // Alpha if (npc.alpha < 255) { @@ -929,9 +922,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charge else if (npc.ai[0] == 11f) { - npc.dontTakeDamage = false; - npc.chaseable = true; - // Accelerate npc.velocity *= 1.01f; @@ -971,9 +961,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Pause before teleport else if (npc.ai[0] == 12f) { - npc.dontTakeDamage = true; - npc.chaseable = false; - // Alpha if (npc.alpha < 255) { diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index ad7f737569..fa305112fb 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -365,7 +365,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.unbreakableDR = false; npc.defense = 10; npc.damage = (int)(npc.defDamage * 1.4f); - npc.chaseable = true; // Spawn tentacles if (Main.netMode != NetmodeID.MultiplayerClient) @@ -559,51 +558,43 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - // Heal if on surface and it's daytime, else, gain defense + // Heal if on surface if (surface) { - if (Main.dayTime) + if (Main.rand.NextBool(Main.dayTime ? 3 : 6)) { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, 55, 0f, 0f, 200, default, 0.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.75f; - Main.dust[dust].fadeIn = 1.3f; - Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= Main.rand.Next(50, 100) * 0.04f; - Main.dust[dust].velocity = vector; - vector.Normalize(); - vector *= 86f; - Main.dust[dust].position = npc.Center - vector; - } + int dust = Dust.NewDust(npc.position, npc.width, npc.height, 55, 0f, 0f, 200, default, 0.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + Main.dust[dust].fadeIn = 1.3f; + Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= Main.rand.Next(50, 100) * 0.04f; + Main.dust[dust].velocity = vector; + vector.Normalize(); + vector *= 86f; + Main.dust[dust].position = npc.Center - vector; + } - // Heal, 25 seconds to reach full HP from 0 - calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] >= 15f) + // Heal, 100 (50 during daytime) seconds to reach full HP from 0 + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] >= (Main.dayTime ? 30f : 60f)) + { + calamityGlobalNPC.newAI[1] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) { - calamityGlobalNPC.newAI[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) + int healAmt = npc.lifeMax / 100; + if (healAmt > npc.lifeMax - npc.life) + healAmt = npc.lifeMax - npc.life; + + if (healAmt > 0) { - int healAmt = npc.lifeMax / 100; - if (healAmt > npc.lifeMax - npc.life) - healAmt = npc.lifeMax - npc.life; - - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; } } } - else - { - calamityGlobalNPC.DR = 0.9999f; - calamityGlobalNPC.unbreakableDR = true; - } } if (npc.ai[0] == 0f && npc.life > 0) diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index 5808fb1849..68975358c8 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -126,9 +126,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } bool handsDead = num156 == 0; npc.chaseable = handsDead; - calamityGlobalNPC.DR = (malice ? 0.45f : 0.05f) + num156 * 0.45f; - if (calamityGlobalNPC.DR > 0.95f) - calamityGlobalNPC.DR = 0.95f; + calamityGlobalNPC.DR = num156 > 0 ? 0.9999f : 0.05f; // Teleport if (handsDead || phase2) diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index f6ff4a02fe..c771a76d03 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -108,12 +108,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (allArmsDead) npc.damage = npc.defDamage; - int defenseBoost = malice ? 100 : 20; - npc.defense = npc.defDefense + (cannonAlive ? defenseBoost : 0) + (laserAlive ? defenseBoost : 0) + (viceAlive ? defenseBoost : 0) + (sawAlive ? defenseBoost : 0); + npc.defense = npc.defDefense; // Phases - bool phase2 = lifeRatio < 0.66f; - bool phase3 = lifeRatio < 0.33f; + bool phase2 = lifeRatio < 0.5f; + bool phase3 = lifeRatio < 0.25f; // Kill all arms if Prime Head enters phase 2 if (phase2 && !allArmsDead)