From c5f80a04ba17c611b52ea34425826856b38a4126 Mon Sep 17 00:00:00 2001 From: WinterSolstice8 <60417494+wintersolstice8@users.noreply.github.com> Date: Thu, 27 Feb 2025 19:01:41 -0700 Subject: [PATCH] [core] Don't cancel spell during cast for being out of range --- src/map/ai/states/magic_state.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/map/ai/states/magic_state.cpp b/src/map/ai/states/magic_state.cpp index b75073de3e8..3c8164829ee 100644 --- a/src/map/ai/states/magic_state.cpp +++ b/src/map/ai/states/magic_state.cpp @@ -121,7 +121,7 @@ bool CMagicState::Update(time_point tick) auto isTargetValid = [&]() { // m_PEntity->IsValidTarget checks if the target is dead and returns nullptr if so, so we don't need to duplicate it here. - if (!PTarget || m_errorMsg || !CanCastSpell(PTarget, true) || + if (!PTarget || m_errorMsg || (HasMoved() && (m_PEntity->objtype != TYPE_PET || static_cast(m_PEntity)->getPetType() != PET_TYPE::AUTOMATON))) { return false; @@ -157,7 +157,8 @@ bool CMagicState::Update(time_point tick) if (tick > GetEntryTime() + m_castTime && !IsCompleted()) { - if (!isTargetValid()) + // CanCastSpell also does a range check which we don't want to check during midcast - mobs don't cancel spells during casting for being out of range + if (!isTargetValid() || !CanCastSpell(PTarget, true)) { m_PEntity->OnCastInterrupted(*this, action, msg, false); m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, std::make_unique(action));