From 3dfb9685cd5b31fbf64ae873625795da7dc058d0 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sat, 24 May 2025 14:45:44 -0500 Subject: [PATCH] Ebonian Paladin flies to a hittable location if it's not at one after charging. --- NPCs/SlimeGod/EbonianPaladin.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index 53b640896e..94fbe9c8cc 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -493,6 +493,9 @@ namespace CalamityMod.NPCs.SlimeGod // Distance required to charge float minChargeSafeDistance = 650f; + // Duration for slow down after charging + float slowDownDurationAfterCharge = revenge ? 90f : 120f; + // Charge variables float chargeVelocityMult = 0.1f; float maxChargeVelocity = (bossRush || enraged) ? 12f : death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; @@ -545,7 +548,6 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[2] >= phaseGateValue) { NPC.ai[1] = 2f; - float slowDownDurationAfterCharge = revenge ? 90f : 120f; NPC.ai[2] = slowDownDurationAfterCharge; NPC.localAI[2] = 0f; NPC.velocity *= 0.5f; @@ -597,7 +599,19 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[2] -= 1f; + // Fly to a location that the player can hit + bool flyToHittableLocation = NPC.ai[2] == slowDownDurationAfterCharge && !Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1); + if (flyToHittableLocation) + { + Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)) * maxChargeVelocity; + NPC.SimpleFlyMovement(velocity, 0.25f); + } + else + { + NPC.velocity *= 0.95f; + NPC.ai[2] -= 1f; + } + if (NPC.ai[2] <= 0f) { NPC.Calamity().newAI[0] = NPC.ai[0]; @@ -609,8 +623,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.TargetClosest(); NPC.netUpdate = true; } - - NPC.velocity *= 0.95f; } }