From cb52217cad155ce36f5d368d3227a9411c947089 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Fri, 11 Mar 2022 09:29:22 -0500 Subject: [PATCH] Core/SAI: Remove completed timed action lists even while evading Port From (https://github.com/TrinityCore/TrinityCore/commit/1f2c48f8bb2396995c1e37e914ef2f3fa6bca490) --- Source/Game/AI/SmartScripts/SmartScript.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 1ef1da5e4..7aec7d159 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -3906,7 +3906,24 @@ namespace Game.AI return; if (_me != null && _me.IsInEvadeMode()) + { + // Check if the timed action list finished and clear it if so. + // This is required by SMART_ACTION_CALL_TIMED_ACTIONLIST failing if mTimedActionList is not empty. + if (!_timedActionList.Empty()) + { + bool needCleanup1 = true; + foreach (SmartScriptHolder scriptholder in _timedActionList) + { + if (scriptholder.EnableTimed) + needCleanup1 = false; + } + + if (needCleanup1) + _timedActionList.Clear(); + } + return; + } InstallEvents();//before UpdateTimers