Core/AI: Make critters flee as soon as engaged in combat and make them evade after they stop running in fear
Port From (https://github.com/TrinityCore/TrinityCore/commit/934c320d4b0da40691be7449f860447fe79b4083)
This commit is contained in:
@@ -119,12 +119,18 @@ namespace Game.AI
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit done_by, ref uint damage)
|
||||
public override void JustEngagedWith(Unit who)
|
||||
{
|
||||
if (!me.HasUnitState(UnitState.Fleeing))
|
||||
me.SetControlled(true, UnitState.Fleeing);
|
||||
}
|
||||
|
||||
public override void OnMovementGeneratorFinalized(MovementGeneratorType type)
|
||||
{
|
||||
if (type == MovementGeneratorType.TimedFleeing)
|
||||
EnterEvadeMode(EvadeReason.Other);
|
||||
}
|
||||
|
||||
public override void EnterEvadeMode(EvadeReason why)
|
||||
{
|
||||
if (me.HasUnitState(UnitState.Fleeing))
|
||||
|
||||
@@ -502,6 +502,8 @@ namespace Game.AI
|
||||
/// </summary>
|
||||
public virtual void OnGameEvent(bool start, ushort eventId) { }
|
||||
|
||||
public virtual void OnMovementGeneratorFinalized(MovementGeneratorType type) { }
|
||||
|
||||
public virtual string GetDebugInfo()
|
||||
{
|
||||
return $"Me: {(me != null ? me.GetDebugInfo() : "NULL")}";
|
||||
|
||||
Reference in New Issue
Block a user