From 9279b1248f167648adbe457f1d4d043d2c806c22 Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Sat, 7 Jun 2025 15:43:53 -0300 Subject: [PATCH] =?UTF-8?q?fix(Core/SAI):=20Don't=20try=20to=20reposition?= =?UTF-8?q?=20SMC=20creatures=20while=20moving=20(fi=E2=80=A6=20(#22280)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/game/AI/SmartScripts/SmartScript.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 2ba8132c4..4b54ff788 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -742,13 +742,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.cast.castFlags & SMARTCAST_COMBAT_MOVE) { - // If cast flag SMARTCAST_COMBAT_MOVE is set combat movement will not be allowed unless target is outside spell range, out of mana, or LOS. - if (result == SPELL_FAILED_OUT_OF_RANGE) - // if we are just out of range, we only chase until we are back in spell range. - CAST_AI(SmartAI, me->AI())->SetCombatMove(true, std::max(spellMaxRange - NOMINAL_MELEE_RANGE, 0.0f)); - else - // if spell fail for any other reason, we chase to melee range, or stay where we are if spellcast was successful. - CAST_AI(SmartAI, me->AI())->SetCombatMove(spellCastFailed); + if (!me->isMoving()) // Don't try to reposition while we are moving + { + // If cast flag SMARTCAST_COMBAT_MOVE is set combat movement will not be allowed unless target is outside spell range, out of mana, or LOS. + if (result == SPELL_FAILED_OUT_OF_RANGE) + // if we are just out of range, we only chase until we are back in spell range. + CAST_AI(SmartAI, me->AI())->SetCombatMove(true, std::max(spellMaxRange - NOMINAL_MELEE_RANGE, 0.0f)); + else + // if spell fail for any other reason, we chase to melee range, or stay where we are if spellcast was successful. + CAST_AI(SmartAI, me->AI())->SetCombatMove(spellCastFailed); + } } if (spellCastFailed)