mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-07 21:01:37 +00:00
fix(Core/SAI): Don't try to reposition SMC creatures while moving (fi… (#22280)
This commit is contained in:
@@ -742,13 +742,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||||||
|
|
||||||
if (e.action.cast.castFlags & SMARTCAST_COMBAT_MOVE)
|
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 (!me->isMoving()) // Don't try to reposition while we are moving
|
||||||
if (result == SPELL_FAILED_OUT_OF_RANGE)
|
{
|
||||||
// if we are just out of range, we only chase until we are back in spell range.
|
// 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.
|
||||||
CAST_AI(SmartAI, me->AI())->SetCombatMove(true, std::max(spellMaxRange - NOMINAL_MELEE_RANGE, 0.0f));
|
if (result == SPELL_FAILED_OUT_OF_RANGE)
|
||||||
else
|
// if we are just out of range, we only chase until we are back in spell range.
|
||||||
// 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(true, std::max(spellMaxRange - NOMINAL_MELEE_RANGE, 0.0f));
|
||||||
CAST_AI(SmartAI, me->AI())->SetCombatMove(spellCastFailed);
|
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)
|
if (spellCastFailed)
|
||||||
|
|||||||
Reference in New Issue
Block a user