diff options
author | ccrs <ccrs@users.noreply.github.com> | 2019-07-19 16:07:00 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-16 22:10:54 +0100 |
commit | e94dca132b4a505f3cc4583bd63879148ad51ca3 (patch) | |
tree | 567ce9260d862cdbeb31f3d728807d37c4623baa /src | |
parent | f1ef2f73a4da4cf466728903207e9d623800d70e (diff) |
Core/SmartAI: add missing movement generator type check on SmartAI::SetCombatMove
ref #21562
(cherry picked from commit 0e3e4353a1824dd6e40ca10a01c4465aa1b1fbad)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 2 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index dcc6bf9d9c7..3702ede1428 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -797,7 +797,7 @@ void SmartAI::SetCombatMove(bool on) { if (!me->HasReactState(REACT_PASSIVE) && me->GetVictim() && !me->GetMotionMaster()->HasMovementGenerator([](MovementGenerator const* movement) -> bool { - return movement->Mode == MOTION_MODE_DEFAULT && movement->Priority == MOTION_PRIORITY_NORMAL; + return movement->GetMovementGeneratorType() == CHASE_MOTION_TYPE && movement->Mode == MOTION_MODE_DEFAULT && movement->Priority == MOTION_PRIORITY_NORMAL; })) { SetRun(_run); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 39319151a6f..12c7aab0d98 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -563,9 +563,7 @@ 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 cast flag SMARTCAST_COMBAT_MOVE is set combat movement will not be allowed unless target is outside spell range, out of mana, or LOS. bool allowMove = false; SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(e.action.cast.spell, me->GetMap()->GetDifficultyID()); std::vector<SpellPowerCost> costs = spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()); @@ -588,11 +586,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; } } - } - if (me->GetDistance(target) > spellInfo->GetMaxRange(true) || - me->GetDistance(target) < spellInfo->GetMinRange(true) || + if (me->GetDistance(target) > spellInfo->GetMaxRange(true) || me->GetDistance(target) < spellInfo->GetMinRange(true) || !me->IsWithinLOSInMap(target) || !hasPower || me->HasUnitFlag(UNIT_FLAG_SILENCED)) |