Fix fleeing speed to 66% run speed
Port From (https://github.com/TrinityCore/TrinityCore/commit/d095d4afe95125bba64312025528a2c4aab157e0)
This commit is contained in:
@@ -713,7 +713,6 @@ namespace Game.Entities
|
|||||||
var creature = searcher.GetTarget();
|
var creature = searcher.GetTarget();
|
||||||
|
|
||||||
SetNoSearchAssistance(true);
|
SetNoSearchAssistance(true);
|
||||||
UpdateSpeed(UnitMoveType.Run);
|
|
||||||
|
|
||||||
if (!creature)
|
if (!creature)
|
||||||
SetControlled(true, UnitState.Fleeing);
|
SetControlled(true, UnitState.Fleeing);
|
||||||
@@ -1810,13 +1809,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
SetMountDisplayId(0); // if creature is mounted on a virtual mount, remove it at death
|
SetMountDisplayId(0); // if creature is mounted on a virtual mount, remove it at death
|
||||||
|
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
|
SetNoSearchAssistance(false);
|
||||||
if (HasSearchedAssistance())
|
|
||||||
{
|
|
||||||
SetNoSearchAssistance(false);
|
|
||||||
UpdateSpeed(UnitMoveType.Run);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Dismiss group if is leader
|
//Dismiss group if is leader
|
||||||
if (m_formation != null && m_formation.GetLeader() == this)
|
if (m_formation != null && m_formation.GetLeader() == this)
|
||||||
|
|||||||
@@ -400,16 +400,8 @@ namespace Game.Entities
|
|||||||
// reset only at real combat stop
|
// reset only at real combat stop
|
||||||
Creature creature = ToCreature();
|
Creature creature = ToCreature();
|
||||||
if (creature != null)
|
if (creature != null)
|
||||||
{
|
|
||||||
creature.SetNoCallAssistance(false);
|
creature.SetNoCallAssistance(false);
|
||||||
|
|
||||||
if (creature.HasSearchedAssistance())
|
|
||||||
{
|
|
||||||
creature.SetNoSearchAssistance(false);
|
|
||||||
UpdateSpeed(UnitMoveType.Run);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SendMeleeAttackStop(victim);
|
SendMeleeAttackStop(victim);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -543,10 +543,6 @@ namespace Game.Entities
|
|||||||
Creature creature = ToCreature();
|
Creature creature = ToCreature();
|
||||||
if (creature != null)
|
if (creature != null)
|
||||||
{
|
{
|
||||||
// for creature case, we check explicit if mob searched for assistance
|
|
||||||
if (ToCreature().HasSearchedAssistance())
|
|
||||||
speed *= 0.66f; // best guessed value, so this will be 33% reduction. Based off initial speed, mob can then "run", "walk fast" or "walk".
|
|
||||||
|
|
||||||
if (creature.HasUnitTypeMask(UnitTypeMask.Minion) && !creature.IsInCombat())
|
if (creature.HasUnitTypeMask(UnitTypeMask.Minion) && !creature.IsInCombat())
|
||||||
{
|
{
|
||||||
if (GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Follow)
|
if (GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Follow)
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ namespace Game.AI
|
|||||||
RemoveFlag(MovementGeneratorFlags.InitializationPending | MovementGeneratorFlags.Deactivated);
|
RemoveFlag(MovementGeneratorFlags.InitializationPending | MovementGeneratorFlags.Deactivated);
|
||||||
AddFlag(MovementGeneratorFlags.Initialized);
|
AddFlag(MovementGeneratorFlags.Initialized);
|
||||||
|
|
||||||
|
owner.SetNoSearchAssistance(false);
|
||||||
|
|
||||||
SetTargetLocation(owner);
|
SetTargetLocation(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ namespace Game.Movement
|
|||||||
|
|
||||||
public class AssistanceMovementGenerator : PointMovementGenerator<Creature>
|
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)
|
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)
|
public void MoveSeekAssistance(float x, float y, float z)
|
||||||
{
|
{
|
||||||
if (_owner.IsCreature())
|
Creature creature = _owner.ToCreature();
|
||||||
|
if (creature != null)
|
||||||
{
|
{
|
||||||
_owner.AttackStop();
|
Log.outDebug(LogFilter.Movement, $"MotionMaster::MoveSeekAssistance: '{creature.GetGUID()}', seeks assistance (X: {x}, Y: {y}, Z: {z})");
|
||||||
_owner.CastStop();
|
creature.AttackStop();
|
||||||
_owner.ToCreature().SetReactState(ReactStates.Passive);
|
creature.CastStop();
|
||||||
Add(new AssistanceMovementGenerator(EventId.AssistMove, x, y, z, _owner.GetSpeed(UnitMoveType.Run) * 0.66f));
|
creature.DoNotReacquireSpellFocusTarget();
|
||||||
|
creature.SetReactState(ReactStates.Passive);
|
||||||
|
Add(new AssistanceMovementGenerator(EventId.AssistMove, x, y, z));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Log.outError(LogFilter.Server, $"MotionMaster::MoveSeekAssistance: {_owner.GetGUID()}, attempted to seek assistance");
|
Log.outError(LogFilter.Server, $"MotionMaster::MoveSeekAssistance: {_owner.GetGUID()}, attempted to seek assistance");
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ namespace Game.Movement
|
|||||||
moveFlagsForSpeed &= ~MovementFlag.Walking;
|
moveFlagsForSpeed &= ~MovementFlag.Walking;
|
||||||
|
|
||||||
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlagsForSpeed));
|
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
|
// limit the speed in the same way the client does
|
||||||
|
|||||||
Reference in New Issue
Block a user