aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2019-07-19 16:07:00 +0200
committerccrs <ccrs@users.noreply.github.com>2019-07-19 16:07:00 +0200
commit0e3e4353a1824dd6e40ca10a01c4465aa1b1fbad (patch)
tree1fd215227f63ff1deb1aee60228097708c703763 /src
parentc8cb866db088837cd7c771059e66d98a46de4fdd (diff)
Core/SmartAI: add missing movement generator type check on SmartAI::SetCombatMove
ref #21562
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp9
2 files changed, 4 insertions, 7 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 521ebdd8f62..04507e95467 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -795,7 +795,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 34daeb240f1..60d5e673992 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -557,17 +557,14 @@ 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);
int32 mana = me->GetPower(POWER_MANA);
- 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) ||
- mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask())||
+ mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()) ||
me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
allowMove = true;