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
+6 -1
View File
@@ -16,6 +16,7 @@
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.AI;
using Game.DataStorage;
using Game.Entities;
@@ -23,7 +24,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Framework.Dynamic;
namespace Game.Movement
{
@@ -1113,7 +1113,10 @@ namespace Game.Movement
{
case MovementSlot.Default:
if (_defaultGenerator != null)
{
_defaultGenerator.Finalize(_owner, _generators.Empty(), false);
_defaultGenerator.NotifyAIOnFinalize(_owner);
}
_defaultGenerator = movement;
if (IsStatic(movement))
@@ -1151,12 +1154,14 @@ namespace Game.Movement
void Delete(MovementGenerator movement, bool active, bool movementInform)
{
movement.Finalize(_owner, active, movementInform);
movement.NotifyAIOnFinalize(_owner);
ClearBaseUnitState(movement);
}
void DeleteDefault(bool active, bool movementInform)
{
_defaultGenerator.Finalize(_owner, active, movementInform);
_defaultGenerator.NotifyAIOnFinalize(_owner);
_defaultGenerator = GetIdleMovementGenerator();
AddFlag(MotionMasterFlags.StaticInitializationPending);
}