Core/SmartAI: add missing movement generator type check on SmartAI::SetCombatMove
Port From (https://github.com/TrinityCore/TrinityCore/commit/e94dca132b4a505f3cc4583bd63879148ad51ca3)
This commit is contained in:
@@ -849,7 +849,10 @@ namespace Game.AI
|
|||||||
{
|
{
|
||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
if (!me.HasReactState(ReactStates.Passive) && me.GetVictim() && !me.GetMotionMaster().HasMovementGenerator(movement => movement.Mode == MovementGeneratorMode.Default && movement.Priority == MovementGeneratorPriority.Normal))
|
if (!me.HasReactState(ReactStates.Passive) && me.GetVictim() && !me.GetMotionMaster().HasMovementGenerator(movement =>
|
||||||
|
{
|
||||||
|
return movement.GetMovementGeneratorType() == MovementGeneratorType.Chase && movement.Mode == MovementGeneratorMode.Default && movement.Priority == MovementGeneratorPriority.Normal;
|
||||||
|
}))
|
||||||
{
|
{
|
||||||
SetRun(_run);
|
SetRun(_run);
|
||||||
me.GetMotionMaster().MoveChase(me.GetVictim());
|
me.GetMotionMaster().MoveChase(me.GetVictim());
|
||||||
|
|||||||
@@ -452,9 +452,7 @@ namespace Game.AI
|
|||||||
|
|
||||||
if (e.Action.cast.castFlags.HasAnyFlag((uint)SmartCastFlags.CombatMove))
|
if (e.Action.cast.castFlags.HasAnyFlag((uint)SmartCastFlags.CombatMove))
|
||||||
{
|
{
|
||||||
// If cast flag SMARTCAST_COMBAT_MOVE is set combat movement will not be allowed
|
// 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.
|
||||||
// unless target is outside spell range, out of mana, or LOS.
|
|
||||||
|
|
||||||
bool allowMove = false;
|
bool allowMove = false;
|
||||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Action.cast.spell, _me.GetMap().GetDifficultyID());
|
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Action.cast.spell, _me.GetMap().GetDifficultyID());
|
||||||
var costs = spellInfo.CalcPowerCost(_me, spellInfo.GetSchoolMask());
|
var costs = spellInfo.CalcPowerCost(_me, spellInfo.GetSchoolMask());
|
||||||
@@ -479,8 +477,7 @@ namespace Game.AI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_me.GetDistance(target) > spellInfo.GetMaxRange(true) ||
|
if (_me.GetDistance(target) > spellInfo.GetMaxRange(true) || _me.GetDistance(target) < spellInfo.GetMinRange(true) ||
|
||||||
_me.GetDistance(target) < spellInfo.GetMinRange(true) ||
|
|
||||||
!_me.IsWithinLOSInMap(target) || !hasPower || _me.HasUnitFlag(UnitFlags.Silenced))
|
!_me.IsWithinLOSInMap(target) || !hasPower || _me.HasUnitFlag(UnitFlags.Silenced))
|
||||||
allowMove = true;
|
allowMove = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user