diff --git a/Source/Game/AI/CoreAI/UnitAI.cs b/Source/Game/AI/CoreAI/UnitAI.cs index bab124e3d..a21cdaf05 100644 --- a/Source/Game/AI/CoreAI/UnitAI.cs +++ b/Source/Game/AI/CoreAI/UnitAI.cs @@ -334,12 +334,7 @@ namespace Game.AI if (AIInfo.cooldown.TotalMilliseconds < spellInfo.RecoveryTime) AIInfo.cooldown = TimeSpan.FromMilliseconds(spellInfo.RecoveryTime); - if (spellInfo.GetMaxRange(false) == 0) - { - if (AIInfo.target < AITarget.Self) - AIInfo.target = AITarget.Self; - } - else + if (spellInfo.GetMaxRange(false) != 0) { foreach (var spellEffectInfo in spellInfo.GetEffects()) { @@ -370,6 +365,7 @@ namespace Game.AI } } } + AIInfo.realCooldown = TimeSpan.FromMilliseconds(spellInfo.RecoveryTime + spellInfo.StartRecoveryTime); AIInfo.maxRange = spellInfo.GetMaxRange(false) * 3 / 4; diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index facdec8ff..e185e5dd7 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -114,11 +114,9 @@ namespace Game.AI if (invoker && invoker.IsPlayer()) { _escortNPCFlags = me.m_unitData.NpcFlags[0]; - me.SetNpcFlags((NPCFlags)0); + me.SetNpcFlags(0); } - GetScript().ProcessEventsFor(SmartEvents.WaypointStart, null, _currentWaypointNode, GetScript().GetPathId()); - me.GetMotionMaster().MovePath(_path, _repeatWaypointPath); } @@ -394,17 +392,12 @@ namespace Game.AI public override void WaypointPathStarted(uint pathId) { - if (!HasEscortState(SmartEscortState.Escorting)) - { - // @todo remove the constant 1 at some point, it's never anything different - GetScript().ProcessEventsFor(SmartEvents.WaypointStart, null, 1, pathId); - return; - } + // SmartAI::WaypointStarted() already handles the case of starting the 1st waypoint } public override void WaypointStarted(uint nodeId, uint pathId) { - + GetScript().ProcessEventsFor(SmartEvents.WaypointStart, null, nodeId, pathId); } public override void WaypointReached(uint nodeId, uint pathId) diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 386d8f13b..a8f46da50 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -3493,13 +3493,13 @@ namespace Game.AI break; } case SmartEvents.TransportRelocate: - case SmartEvents.WaypointStart: { - if (e.Event.waypoint.pathID != 0 && var0 != e.Event.waypoint.pathID) + if (e.Event.transportRelocate.pointID != 0 && var0 != e.Event.transportRelocate.pointID) return; ProcessAction(e, unit, var0); break; } + case SmartEvents.WaypointStart: case SmartEvents.WaypointReached: case SmartEvents.WaypointResumed: case SmartEvents.WaypointPaused: