diff --git a/src/game/AI/BaseAI/CreatureAI.cpp b/src/game/AI/BaseAI/CreatureAI.cpp index 1597053703..df34aa6061 100644 --- a/src/game/AI/BaseAI/CreatureAI.cpp +++ b/src/game/AI/BaseAI/CreatureAI.cpp @@ -44,7 +44,7 @@ CreatureAI::CreatureAI(Creature* creature, uint32 combatActions) : void CreatureAI::Reset() { - ResetAllTimers(); + ResetTimersOnEvade(); m_currentRangedMode = m_rangedMode; m_attackDistance = m_chaseDistance; } diff --git a/src/game/AI/ScriptDevAI/base/TimerAI.cpp b/src/game/AI/ScriptDevAI/base/TimerAI.cpp index 706f48eb6d..0be9048b97 100644 --- a/src/game/AI/ScriptDevAI/base/TimerAI.cpp +++ b/src/game/AI/ScriptDevAI/base/TimerAI.cpp @@ -149,6 +149,13 @@ void TimerManager::ResetAllTimers() data.second.ResetTimer(); } +void TimerManager::ResetTimersOnEvade() +{ + for (auto& data : m_timers) + if (data.second.combatSetting != TIMER_ALWAYS) + data.second.ResetTimer(); +} + void TimerManager::GetAIInformation(ChatHandler& reader) { reader.PSendSysMessage("TimerAI: Timers:"); @@ -187,6 +194,21 @@ void CombatActions::ResetAllTimers() TimerManager::ResetAllTimers(); } +void CombatActions::ResetTimersOnEvade() +{ + for (uint32 i = 0; i < m_actionReadyStatus.size(); ++i) + { + auto itr = m_timerlessActionSettings.find(i); + if (itr == m_timerlessActionSettings.end()) + m_actionReadyStatus[i] = false; + else + m_actionReadyStatus[i] = (*itr).second; + } + for (auto& data : m_combatActions) + data.second.ResetTimer(); + TimerManager::ResetTimersOnEvade(); +} + void CombatActions::AddCombatAction(uint32 id, bool disabled) { m_combatActions.emplace(id, Timer(id, [&, id] { m_actionReadyStatus[id] = true; }, 0, 0, TIMER_COMBAT_COMBAT, disabled)); diff --git a/src/game/AI/ScriptDevAI/base/TimerAI.h b/src/game/AI/ScriptDevAI/base/TimerAI.h index d75f6ff674..08f08b4655 100644 --- a/src/game/AI/ScriptDevAI/base/TimerAI.h +++ b/src/game/AI/ScriptDevAI/base/TimerAI.h @@ -31,9 +31,9 @@ class ChatHandler; enum TimerCombat { - TIMER_COMBAT_OOC = 0, - TIMER_COMBAT_COMBAT = 1, - TIMER_ALWAYS = 2 + TIMER_COMBAT_OOC = 0, // reset on evade + TIMER_COMBAT_COMBAT = 1, // reset on evade + TIMER_ALWAYS = 2, // reset on spawn }; /* @@ -104,6 +104,7 @@ class TimerManager virtual void UpdateTimers(const uint32 diff); virtual void UpdateTimers(const uint32 diff, bool combat); virtual void ResetAllTimers(); + virtual void ResetTimersOnEvade(); virtual void GetAIInformation(ChatHandler& reader); @@ -191,6 +192,7 @@ class CombatActions : public TimerManager virtual void UpdateTimers(const uint32 diff, bool combat) override; virtual void ExecuteActions() = 0; virtual void ResetAllTimers() override; + virtual void ResetTimersOnEvade() override; virtual void GetAIInformation(ChatHandler& reader) override; diff --git a/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_morogrim_tidewalker.cpp b/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_morogrim_tidewalker.cpp index 828eaf6db9..999c055793 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_morogrim_tidewalker.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_morogrim_tidewalker.cpp @@ -248,11 +248,6 @@ struct mob_water_globuleAI : public ScriptedAI bool m_initialAggro; - void Reset() override - { - ResetAllTimers(); - } - void JustRespawned() override { ScriptedAI::JustRespawned();