Fix fleeing speed to 66% run speed
Port From (https://github.com/TrinityCore/TrinityCore/commit/d095d4afe95125bba64312025528a2c4aab157e0)
This commit is contained in:
@@ -36,6 +36,8 @@ namespace Game.AI
|
||||
RemoveFlag(MovementGeneratorFlags.InitializationPending | MovementGeneratorFlags.Deactivated);
|
||||
AddFlag(MovementGeneratorFlags.Initialized);
|
||||
|
||||
owner.SetNoSearchAssistance(false);
|
||||
|
||||
SetTargetLocation(owner);
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Game.Movement
|
||||
|
||||
public class AssistanceMovementGenerator : PointMovementGenerator<Creature>
|
||||
{
|
||||
public AssistanceMovementGenerator(uint id, float x, float y, float z, float speed = 0.0f) : base(id, x, y, z, true, speed) { }
|
||||
public AssistanceMovementGenerator(uint id, float x, float y, float z) : base(id, x, y, z, true) { }
|
||||
|
||||
public override void Finalize(Unit owner, bool active, bool movementInform)
|
||||
{
|
||||
|
||||
@@ -914,12 +914,15 @@ namespace Game.Movement
|
||||
|
||||
public void MoveSeekAssistance(float x, float y, float z)
|
||||
{
|
||||
if (_owner.IsCreature())
|
||||
Creature creature = _owner.ToCreature();
|
||||
if (creature != null)
|
||||
{
|
||||
_owner.AttackStop();
|
||||
_owner.CastStop();
|
||||
_owner.ToCreature().SetReactState(ReactStates.Passive);
|
||||
Add(new AssistanceMovementGenerator(EventId.AssistMove, x, y, z, _owner.GetSpeed(UnitMoveType.Run) * 0.66f));
|
||||
Log.outDebug(LogFilter.Movement, $"MotionMaster::MoveSeekAssistance: '{creature.GetGUID()}', seeks assistance (X: {x}, Y: {y}, Z: {z})");
|
||||
creature.AttackStop();
|
||||
creature.CastStop();
|
||||
creature.DoNotReacquireSpellFocusTarget();
|
||||
creature.SetReactState(ReactStates.Passive);
|
||||
Add(new AssistanceMovementGenerator(EventId.AssistMove, x, y, z));
|
||||
}
|
||||
else
|
||||
Log.outError(LogFilter.Server, $"MotionMaster::MoveSeekAssistance: {_owner.GetGUID()}, attempted to seek assistance");
|
||||
|
||||
@@ -122,6 +122,10 @@ namespace Game.Movement
|
||||
moveFlagsForSpeed &= ~MovementFlag.Walking;
|
||||
|
||||
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlagsForSpeed));
|
||||
Creature creature = unit.ToCreature();
|
||||
if (creature != null)
|
||||
if (creature.HasSearchedAssistance())
|
||||
args.velocity *= 0.66f;
|
||||
}
|
||||
|
||||
// limit the speed in the same way the client does
|
||||
|
||||
Reference in New Issue
Block a user