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:
hondacrx
2022-01-07 12:44:09 -05:00
parent 0dc38f91cf
commit fcf47da853
4 changed files with 22 additions and 2 deletions
+7 -1
View File
@@ -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))
+2
View File
@@ -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")}";