From 7185ae680c74a08b82ad52fae8070472718fe74b Mon Sep 17 00:00:00 2001 From: Snapper Date: Sat, 4 Jun 2016 21:17:15 +0200 Subject: [PATCH] Core/SmartAI: delay SMART_ACTION_FLEE_FOR_ASSIST if creature is rooted/stunned. Prevents creatures from teleporting around when fleeing while stunned/rooted. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 6dc7dae0a5..d484a85888 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -3373,6 +3373,16 @@ void SmartScript::UpdateTimer(SmartScriptHolder& e, uint32 const diff) } } + // Delay flee for assist event if stunned or rooted + if (e.GetActionType() == SMART_ACTION_FLEE_FOR_ASSIST) + { + if (me && me->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) + { + e.timer = 1; + return; + } + } + e.active = true;//activate events with cooldown switch (e.GetEventType())//process ONLY timed events {