From 447e92bd43e81e0cebefb2e6469d173a9bc573c7 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Wed, 15 Jun 2022 20:23:38 -0500 Subject: [PATCH] 1 - Ravager, Aureus and Rev+ Golem edits. --- NPCs/CalamityAI.cs | 32 ++++++++++++++++------ NPCs/Ravager/RavagerBody.cs | 6 ++-- NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs | 21 +++++++------- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 79163573ca..f918d54644 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -2333,8 +2333,8 @@ namespace CalamityMod.NPCs bool postMoonLordBuff = NPC.downedMoonlord && !BossRushEvent.BossRushActive; npc.damage = postMoonLordBuff ? npc.defDamage * 2 : npc.defDamage; - // Don't fire projectiles and don't increment phase timers for 6 seconds after the teleport phase to avoid cheap bullshit - float noProjectileOrPhaseIncrementTime = 360f; + // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit + float noProjectileOrPhaseIncrementTime = 240f; // Don't deal contact damage for 2 seconds after the teleport phase to avoid cheap bullshit float noContactDamageTime = 120f; @@ -2571,19 +2571,20 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 1f) { // Slow down - npc.velocity.X *= 0.9f; + npc.velocity.X *= 0.8f; // Stay vulnerable for a maximum of 2 seconds npc.ai[1] += 1f; if (npc.ai[1] >= (phase2 ? 30f : 120f) || malice) { - // Stop colliding with tiles - npc.noTileCollide = true; - // Set AI to next phase (Walk) and reset other AI npc.TargetClosest(); npc.ai[0] = Main.rand.NextBool() ? 3f : 2f; npc.ai[1] = 0f; + + // Stop colliding with tiles if entering walking phase + npc.noTileCollide = npc.ai[0] == 2f; + npc.netUpdate = true; } else @@ -2596,7 +2597,7 @@ namespace CalamityMod.NPCs // Set walking direction if (Math.Abs(npc.Center.X - player.Center.X) < 200f) { - npc.velocity.X *= 0.9f; + npc.velocity.X *= 0.8f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; } @@ -2770,13 +2771,16 @@ namespace CalamityMod.NPCs npc.ai[0] = phase2 ? (Main.rand.NextBool() ? (phase3 ? 2f : 1f) : 5f) : (Main.rand.NextBool() ? 2f : 1f); npc.ai[2] = 0f; npc.ai[3] = 0f; + + // Stop colliding with tiles if entering walking phase + npc.noTileCollide = npc.ai[0] == 2f; + npc.netUpdate = true; } else { float playerLocation = npc.Center.X - player.Center.X; npc.direction = playerLocation < 0 ? 1 : -1; - npc.ai[0] = 3f; npc.ai[3] = 0f; npc.netUpdate = true; @@ -2931,7 +2935,7 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 5f) { // Slow down - npc.velocity.X *= 0.9f; + npc.velocity.X *= 0.8f; // Spawn slimes and start teleport if (Main.netMode != NetmodeID.MultiplayerClient) @@ -3000,6 +3004,8 @@ namespace CalamityMod.NPCs ; } } + + CustomGravity(); } // Mid-teleport @@ -3046,6 +3052,8 @@ namespace CalamityMod.NPCs Main.dust[num244].noGravity = true; Main.dust[num244].velocity *= 0.5f; } + + CustomGravity(); } // End of teleport @@ -3083,6 +3091,10 @@ namespace CalamityMod.NPCs npc.ai[0] = phase3 ? (Main.rand.NextBool() ? 3f : 2f) : (Main.rand.NextBool() ? 1f : 2f); npc.ai[2] = 0f; npc.localAI[3] = noProjectileOrPhaseIncrementTime; + + // Stop colliding with tiles if entering walking phase + npc.noTileCollide = npc.ai[0] == 2f; + npc.netUpdate = true; } @@ -3100,6 +3112,8 @@ namespace CalamityMod.NPCs Main.dust[num244].noGravity = true; Main.dust[num244].velocity *= 0.5f; } + + CustomGravity(); } void CustomGravity() diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 43c34cc677..c335cdcd7f 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -432,7 +432,9 @@ namespace CalamityMod.NPCs.Ravager } } - CustomGravity(); + // Don't run custom gravity when starting a jump + if (NPC.ai[0] != 1f) + CustomGravity(); } else if (NPC.ai[0] >= 1f) { @@ -534,7 +536,7 @@ namespace CalamityMod.NPCs.Ravager float offset = phase2 ? maxOffset * calamityGlobalNPC.newAI[2] : 0f; int quarterWidth = (int)(NPC.width * 0.25f); - if ((NPC.position.X + quarterWidth < targetVector.X + offset && NPC.position.X + NPC.width - quarterWidth > targetVector.X + player.width + offset && (inRange || NPC.ai[0] != 2f)) || NPC.ai[1] > 0f || calamityGlobalNPC.newAI[3] >= 180f) + if ((NPC.position.X + quarterWidth < targetVector.X + offset && NPC.position.X + NPC.width - quarterWidth > targetVector.X + player.width + offset && (inRange || NPC.ai[0] != 2f)) || NPC.ai[1] > 0f || calamityGlobalNPC.newAI[3] >= 120f) { NPC.damage = NPC.defDamage; diff --git a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs index 9c69df5176..47651a1093 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs @@ -241,11 +241,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); float speedMult = 1f; - float multiplier = turboEnrage ? 0.003f : enrage ? 0.002f : 0.0015f; + float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; if (distanceBelowTarget > 0f && ((!flag41 && !flag42) || turboEnrage)) speedMult += distanceBelowTarget * multiplier; - float speedMultLimit = turboEnrage ? 4f : enrage ? 3f : 2.5f; + float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; if (speedMult > speedMultLimit) speedMult = speedMultLimit; @@ -262,7 +262,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - CustomGravity(); + // Don't run custom gravity when starting a jump + if (npc.ai[0] != 1f) + CustomGravity(); } // Fall down @@ -400,7 +402,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses void CustomGravity() { - float gravity = turboEnrage ? (Main.getGoodWorld ? 0.12f : 0.9f) : enrage ? 0.6f : (!flag41 && !flag42) ? 0.45f : 0.3f; + float gravity = turboEnrage ? (Main.getGoodWorld ? 1.2f : 0.9f) : enrage ? 0.6f : (!flag41 && !flag42) ? 0.45f : 0.3f; float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (Main.getGoodWorld ? 40f : 30f) : enrage ? 20f : (!flag41 && !flag42) ? 15f : 10f; npc.velocity.Y += gravity; @@ -915,6 +917,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Die if body is gone if (NPC.golemBoss < 0) { + calamityGlobalNPC.DR = 0.25f; + calamityGlobalNPC.unbreakableDR = false; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = false; npc.StrikeNPCNoInteraction(9999, 0f, 0); return false; } @@ -950,18 +955,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (malice || Main.getGoodWorld) enrage = true; - if (turboEnrage && NPC.golemBoss >= 0) + if (turboEnrage) { calamityGlobalNPC.DR = 0.9999f; calamityGlobalNPC.unbreakableDR = true; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; } - else - { - calamityGlobalNPC.DR = 0.25f; - calamityGlobalNPC.unbreakableDR = false; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = false; - } // Float through tiles or not bool flag44 = false;