Core/SAI: Fix creatures casting spells while moving with flag SMARTCAST_COMBAT_MOVE
Port From (https://github.com/TrinityCore/TrinityCore/commit/b3545479bfbd2b743288bd32094ce8c4856a1e3d)
This commit is contained in:
@@ -843,7 +843,7 @@ namespace Game.AI
|
||||
GetScript().ProcessEventsFor(SmartEvents.RewardQuest, player, quest.Id, opt);
|
||||
}
|
||||
|
||||
public void SetCombatMove(bool on)
|
||||
public void SetCombatMove(bool on, bool stopMoving = false)
|
||||
{
|
||||
if (_canCombatMove == on)
|
||||
return;
|
||||
@@ -870,7 +870,11 @@ namespace Game.AI
|
||||
{
|
||||
var movement = me.GetMotionMaster().GetMovementGenerator(a => a.GetMovementGeneratorType() == MovementGeneratorType.Chase && a.Mode == MovementGeneratorMode.Default && a.Priority == MovementGeneratorPriority.Normal);
|
||||
if (movement != null)
|
||||
{
|
||||
me.GetMotionMaster().Remove(movement);
|
||||
if (stopMoving)
|
||||
me.StopMoving();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ namespace Game.AI
|
||||
!_me.IsWithinLOSInMap(target) || !hasPower || _me.HasUnitFlag(UnitFlags.Silenced))
|
||||
allowMove = true;
|
||||
|
||||
((SmartAI)_me.GetAI()).SetCombatMove(allowMove);
|
||||
((SmartAI)_me.GetAI()).SetCombatMove(allowMove, true);
|
||||
}
|
||||
|
||||
_me.CastSpell(target.ToUnit(), e.Action.cast.spell, new CastSpellExtraArgs(triggerFlag));
|
||||
|
||||
Reference in New Issue
Block a user