From 537d7280736dd19c586327d4aed202da90581b6a Mon Sep 17 00:00:00 2001 From: killerwife Date: Mon, 20 May 2024 21:11:40 +0200 Subject: [PATCH] AI: Resolve errors with combat timers Refactored existing use of enterevademode Split reset of timer between just respawned - all timers evade - ooc/combat timers Closes https://github.com/cmangos/mangos-tbc/pull/676 --- src/game/AI/BaseAI/CreatureAI.cpp | 2 +- src/game/AI/ScriptDevAI/base/follower_ai.cpp | 1 + src/game/AI/ScriptDevAI/include/sc_creature.cpp | 2 ++ .../magisters_terrace/boss_felblood_kaelthas.cpp | 2 +- .../eastern_kingdoms/naxxramas/boss_gothik.cpp | 12 +----------- .../eastern_kingdoms/naxxramas/boss_heigan.cpp | 10 +++++----- .../eastern_kingdoms/naxxramas/boss_kelthuzad.cpp | 2 +- .../eastern_kingdoms/naxxramas/boss_noth.cpp | 4 ++-- .../eastern_kingdoms/naxxramas/boss_sapphiron.cpp | 6 +++--- .../boss_mograine_and_whitemane.cpp | 2 +- .../sunwell_plateau/boss_eredar_twins.cpp | 4 ++-- .../eastern_kingdoms/sunwell_plateau/boss_muru.cpp | 4 ++-- .../eastern_kingdoms/zulaman/boss_zuljin.cpp | 6 ++---- .../kalimdor/caverns_of_time/hyjal/hyjalAI.cpp | 1 + .../scripts/kalimdor/onyxias_lair/boss_onyxia.cpp | 4 ++-- .../kalimdor/ruins_of_ahnqiraj/boss_buru.cpp | 2 +- .../kalimdor/temple_of_ahnqiraj/boss_cthun.cpp | 4 ++-- .../kalimdor/temple_of_ahnqiraj/boss_skeram.cpp | 2 +- .../temple_of_ahnqiraj/boss_twinemperors.cpp | 2 +- .../kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp | 4 ++-- .../auchindoun/shadow_labyrinth/boss_murmur.cpp | 4 ++-- .../scripts/outland/black_temple/boss_illidan.cpp | 1 + .../outland/black_temple/boss_teron_gorefiend.cpp | 2 +- .../AI/ScriptDevAI/scripts/outland/boss_terokk.cpp | 2 +- .../serpent_shrine/boss_lady_vashj.cpp | 12 ++++++------ .../coilfang_reservoir/slave_pens/boss_ahune.cpp | 2 +- .../hellfire_ramparts/boss_omor_the_unscarred.cpp | 2 +- .../shattered_halls/boss_nethekurse.cpp | 6 +++--- .../scripts/outland/shartuul_transporter.cpp | 5 ----- .../outland/tempest_keep/arcatraz/boss_dalliah.cpp | 14 +++----------- .../tempest_keep/arcatraz/boss_soccothrates.cpp | 14 +++----------- .../tempest_keep/botanica/boss_warp_splinter.cpp | 2 +- .../outland/tempest_keep/the_eye/boss_alar.cpp | 2 +- 33 files changed, 58 insertions(+), 86 deletions(-) diff --git a/src/game/AI/BaseAI/CreatureAI.cpp b/src/game/AI/BaseAI/CreatureAI.cpp index c74f40a13ca..7e358c413bf 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() { - ResetTimersOnEvade(); + m_currentRangedMode = m_rangedMode; m_attackDistance = m_chaseDistance; } diff --git a/src/game/AI/ScriptDevAI/base/follower_ai.cpp b/src/game/AI/ScriptDevAI/base/follower_ai.cpp index 4f80ce00ede..e5d35b15b5d 100644 --- a/src/game/AI/ScriptDevAI/base/follower_ai.cpp +++ b/src/game/AI/ScriptDevAI/base/follower_ai.cpp @@ -104,6 +104,7 @@ void FollowerAI::CorpseRemoved(uint32& /*respawnDelay*/) void FollowerAI::EnterEvadeMode() { + ResetTimersOnEvade(); m_creature->RemoveAllAurasOnEvade(); m_creature->CombatStopWithPets(true); diff --git a/src/game/AI/ScriptDevAI/include/sc_creature.cpp b/src/game/AI/ScriptDevAI/include/sc_creature.cpp index b2ad63dd0a7..526166ee344 100644 --- a/src/game/AI/ScriptDevAI/include/sc_creature.cpp +++ b/src/game/AI/ScriptDevAI/include/sc_creature.cpp @@ -54,12 +54,14 @@ void ScriptedAI::EnterEvadeMode() { UnitAI::EnterEvadeMode(); + ResetTimersOnEvade(); Reset(); } /// This function calls Reset() to reset variables as expected void ScriptedAI::JustRespawned() { + ResetAllTimers(); Reset(); } diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp index dcd11451374..b46b0bcc130 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp @@ -134,7 +134,7 @@ struct boss_felblood_kaelthasAI : public CombatAI AddCustomAction(KAEL_GRAVITY_LAPSE_SCRIPT, true, [&]() { HandleGravityLapse(); - }); + }, TIMER_COMBAT_COMBAT); AddCustomAction(KAEL_OUTRO, true, [&]() { HandleOutro(); diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_gothik.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_gothik.cpp index e2287c4cd00..142a0c261d0 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_gothik.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_gothik.cpp @@ -164,18 +164,8 @@ struct boss_gothikAI : public ScriptedAI if (m_instance) m_instance->SetData(TYPE_GOTHIK, FAIL); + m_creature->SetRespawnDelay(30, true); m_creature->ForcedDespawn(); - m_creature->Respawn(); - - ScriptedAI::EnterEvadeMode(); - } - - void JustReachedHome() override - { - if (m_instance) - m_instance->SetData(TYPE_GOTHIK, FAIL); - - SetCombatMovement(false); } void UpdateAI(const uint32 diff) override diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_heigan.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_heigan.cpp index 571b43baa24..d0e3bc7b50a 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_heigan.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_heigan.cpp @@ -90,10 +90,10 @@ struct boss_heiganAI : public CombatAI AddCombatAction(HEIGAN_TELEPORT_PLAYERS, 35u * IN_MILLISECONDS, 45u * IN_MILLISECONDS); AddCombatAction(HEIGAN_TAUNT, 25u * IN_MILLISECONDS, 90u * IN_MILLISECONDS); AddCustomAction(HEIGAN_ERUPTION, true, [&]() { StartEruptions(m_phase == PHASE_GROUND ? SPELL_PLAGUE_WAVE_SLOW : SPELL_PLAGUE_WAVE_FAST); }); - AddCustomAction(HEIGAN_GROUND_PHASE, true, [&]() { HandleGroundPhase(); }); - AddCustomAction(HEIGAN_PLATFORM_PHASE, true, [&]() { HandlePlatformPhase(); }); + AddCustomAction(HEIGAN_GROUND_PHASE, true, [&]() { HandleGroundPhase(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(HEIGAN_PLATFORM_PHASE, true, [&]() { HandlePlatformPhase(); }, TIMER_COMBAT_COMBAT); AddCustomAction(HEIGAN_DOOR, true, [&]() { CloseEntrance(); }); - AddCustomAction(HEIGAN_CHANNELING, true, [&]() { HandleChanneling(); }); + AddCustomAction(HEIGAN_CHANNELING, true, [&]() { HandleChanneling(); }, TIMER_COMBAT_COMBAT); } ScriptedInstance* m_instance; @@ -159,12 +159,12 @@ struct boss_heiganAI : public CombatAI void EnterEvadeMode() override { + ScriptedAI::EnterEvadeMode(); + if (m_instance) m_instance->SetData(TYPE_HEIGAN, FAIL); StopEruptions(); - - ScriptedAI::EnterEvadeMode(); } void HandleGroundPhase() diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_kelthuzad.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_kelthuzad.cpp index 1863f6fd885..2b726111da3 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_kelthuzad.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_kelthuzad.cpp @@ -574,7 +574,7 @@ struct npc_icecrown_guardianAI : public ScriptedAI void EnterEvadeMode() override { - m_creature->RemoveAurasDueToSpell(SPELL_BLOOD_TAP); + m_creature->RemoveAurasDueToSpell(SPELL_BLOOD_TAP); ScriptedAI::EnterEvadeMode(); } diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_noth.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_noth.cpp index eab491aea86..5faa3d01aac 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_noth.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_noth.cpp @@ -121,8 +121,8 @@ struct boss_nothAI : public CombatAI AddCombatAction(NOTH_BLINK, 25u * IN_MILLISECONDS); AddCombatAction(NOTH_CURSE, 4u * IN_MILLISECONDS); AddCombatAction(NOTH_SUMMON, 12u * IN_MILLISECONDS); - AddCustomAction(NOTH_BALCONY_PHASE, true, [&]() { HandleBalconyPhase(); }); - AddCustomAction(NOTH_GROUND_PHASE, true, [&]() { HandleGroundPhase(); }); + AddCustomAction(NOTH_BALCONY_PHASE, true, [&]() { HandleBalconyPhase(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(NOTH_GROUND_PHASE, true, [&]() { HandleGroundPhase(); }, TIMER_COMBAT_COMBAT); AddOnKillText(SAY_SLAY1, SAY_SLAY1); } diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_sapphiron.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_sapphiron.cpp index cd57fd4c5ec..d159e93d8e1 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_sapphiron.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_sapphiron.cpp @@ -94,9 +94,9 @@ struct boss_sapphironAI : public CombatAI AddCombatAction(SAPPHIRON_FROST_BREATH, true); AddCombatAction(SAPPHIRON_ICEBOLT, true); AddCombatAction(SAPPHIRON_BERSERK, 15u * MINUTE * IN_MILLISECONDS); - AddCustomAction(SAPPHIRON_AIR_PHASE, true, [&]() { HandleAirPhase(); }); - AddCustomAction(SAPPHIRON_LANDING_PHASE, true, [&]() { HandleLandingPhase(); }); - AddCustomAction(SAPPHIRON_GROUND_PHASE, true, [&]() { HandleGroundPhase(); }); + AddCustomAction(SAPPHIRON_AIR_PHASE, true, [&]() { HandleAirPhase(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(SAPPHIRON_LANDING_PHASE, true, [&]() { HandleLandingPhase(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(SAPPHIRON_GROUND_PHASE, true, [&]() { HandleGroundPhase(); }, TIMER_COMBAT_COMBAT); } ScriptedInstance* m_instance; diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp index 2bcb8d6ec08..e3278b4470b 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp @@ -87,7 +87,7 @@ struct boss_scarlet_commander_mograineAI : public CombatAI AddCustomAction(MOGRAINE_ACTION_LAY_ON_HANDS, false, [&]() { HandleLayOnHandsTimer(); - }); + }, TIMER_COMBAT_COMBAT); AddCustomAction(MOGRAINE_ACTION_REVIVED, true, [&]() { HandleRevivedTimer(); diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp index ab519fe2a92..274b2af9397 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp @@ -125,7 +125,7 @@ struct boss_alythessAI : public CombatAI AddCombatAction(ALYTHESS_CONFLAGRATION, 15000u); AddCombatAction(ALYTHESS_BLAZE, 1000u); AddCombatAction(ALYTHESS_FLAME_SEAR, 10000u); - AddCustomAction(ALYTHESS_DELAY, true, [&]() { HandleEmpowerDelay(); }); + AddCustomAction(ALYTHESS_DELAY, true, [&]() { HandleEmpowerDelay(); }, TIMER_COMBAT_COMBAT); AddOnKillText(SAY_ALYTHESS_KILL_1, SAY_ALYTHESS_KILL_2); } @@ -311,7 +311,7 @@ struct boss_sacrolashAI : public CombatAI AddCombatAction(SACROLASH_CONFOUNDING_BLOW, 25000, 27000); AddCombatAction(SACROLASH_SHADOW_BLADES, 10000, 11000); AddCombatAction(SACROLASH_SUMMON_SHADOW_IMAGE, 10000u); - AddCustomAction(ALYTHESS_DELAY, true, [&]() { HandleEmpowerDelay(); }); + AddCustomAction(ALYTHESS_DELAY, true, [&]() { HandleEmpowerDelay(); }, TIMER_COMBAT_COMBAT); AddOnKillText(SAY_SACROLASH_KILL_1, SAY_SACROLASH_KILL_2); m_creature->GetCombatManager().SetLeashingCheck([](Unit*, float x, float y, float) -> bool { diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp index 0d3e6b6b421..2f21fce4b69 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/sunwell_plateau/boss_muru.cpp @@ -116,8 +116,8 @@ struct boss_muruAI : public CombatAI AddTimerlessCombatAction(MURU_TRANSITION, false); AddCombatAction(MURU_DARK_FIENDS, true); AddCombatAction(MURU_HUMANOIDS, 15000u); - AddCustomAction(MURU_SPAWN_ENTROPIUS, true, [&]() { HandleSpawnEntropius(); }); - AddCustomAction(MURU_ATTACK_SPAWNS, true, [&]() { HandleSpawnAttack(); }); + AddCustomAction(MURU_SPAWN_ENTROPIUS, true, [&]() { HandleSpawnEntropius(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(MURU_ATTACK_SPAWNS, true, [&]() { HandleSpawnAttack(); }, TIMER_COMBAT_COMBAT); SetDeathPrevention(true); } diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/zulaman/boss_zuljin.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/zulaman/boss_zuljin.cpp index 9c1655e1224..b13eee8f268 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/zulaman/boss_zuljin.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/zulaman/boss_zuljin.cpp @@ -158,12 +158,12 @@ struct boss_zuljinAI : public CombatAI AddCustomAction(ZULJIN_SPIRIT_ACQUIRED, true, [&]() { SpiritAcquired(); - }); + }, TIMER_COMBAT_COMBAT); AddCustomAction(ZULJIN_FIRE_WALL_DELAY, true, [&]() { if (m_creature->IsInCombat() && !m_creature->GetCombatManager().IsEvadingHome()) m_instance->DoUseDoorOrButton(GO_FIRE_DOOR); - }); + }, TIMER_COMBAT_COMBAT); m_creature->SetWalk(true); m_creature->GetCombatManager().SetLeashingCheck([&](Unit*, float /*x*/, float y, float /*z*/) { @@ -221,8 +221,6 @@ struct boss_zuljinAI : public CombatAI if (Creature* spirit = m_instance->GetSingleCreatureFromStorage(aZuljinPhase.spiritId)) spirit->RemoveAurasDueToSpell(SPELL_SPIRIT_DRAINED); - m_creature->SetHealthPercent(100.f); // TODO: Remove this hack once evade issues are resolved - CombatAI::EnterEvadeMode(); } diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp index 9e8cd66ef91..adfe29cd605 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp @@ -82,6 +82,7 @@ void hyjalAI::Reset() void hyjalAI::EnterEvadeMode() { + ResetTimersOnEvade(); m_creature->RemoveAllAurasOnEvade(); m_creature->CombatStop(true); diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/onyxias_lair/boss_onyxia.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/onyxias_lair/boss_onyxia.cpp index a5d862dc64e..a882cd61705 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/onyxias_lair/boss_onyxia.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/onyxias_lair/boss_onyxia.cpp @@ -158,8 +158,8 @@ struct boss_onyxiaAI : public CombatAI AddCombatAction(ONYXIA_KNOCK_AWAY, 20000, 30000); AddCombatAction(ONYXIA_FIREBALL, true); AddCombatAction(ONYXIA_MOVEMENT, true); - AddCustomAction(ONYXIA_SUMMON_WHELPS, true, [&]() { SummonWhelps(); }); - AddCustomAction(ONYXIA_PHASE_TRANSITIONS, true, [&]() { PhaseTransition(); }); + AddCustomAction(ONYXIA_SUMMON_WHELPS, true, [&]() { SummonWhelps(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(ONYXIA_PHASE_TRANSITIONS, true, [&]() { PhaseTransition(); }, TIMER_COMBAT_COMBAT); m_creature->SetWalk(false); // onyxia should run when flying AddOnKillText(SAY_KILL); } diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/ruins_of_ahnqiraj/boss_buru.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/ruins_of_ahnqiraj/boss_buru.cpp index 45c0ef3faa1..950aee0b009 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/ruins_of_ahnqiraj/boss_buru.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/ruins_of_ahnqiraj/boss_buru.cpp @@ -78,7 +78,7 @@ struct boss_buruAI : public CombatAI AddCombatAction(BURU_CREEPING_PLAGUE, true); AddCombatAction(BURU_GATHERING_SPEED, 9000u); AddCombatAction(BURU_FULL_SPEED, 60000u); - AddCustomAction(BURU_PHASE_2_TRANSITION_STEP, true, [&]() { HandlePhaseTwo(); }); + AddCustomAction(BURU_PHASE_2_TRANSITION_STEP, true, [&]() { HandlePhaseTwo(); }, TIMER_COMBAT_COMBAT); } uint8 m_uiPhase; diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp index 2da47a9d5c5..44d12107fa0 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp @@ -260,8 +260,8 @@ struct boss_cthunAI : public CombatAI // There are 30 seconds offset between Giant Eye and Giant Claw Tentacles which are both on a 60 seconds period handled by periodic spells AddCombatAction(CTHUN_CLAWTENTACLEDELAY, 10000u); AddCombatAction(CTHUN_EYETENTACLEDELAY, 40000u); - AddCustomAction(CTHUN_EMERGE, true, [&]() { HandleEmerge(); }); - AddCustomAction(CTHUN_WEAKENED_END, true, [&]() { HandleEndWeaken(); }); + AddCustomAction(CTHUN_EMERGE, true, [&]() { HandleEmerge(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(CTHUN_WEAKENED_END, true, [&]() { HandleEndWeaken(); }, TIMER_COMBAT_COMBAT); // Set active in order to be used during the instance progress m_creature->SetActiveObjectState(true); } diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_skeram.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_skeram.cpp index d2c55e302b1..86ff45d80d3 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_skeram.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_skeram.cpp @@ -71,7 +71,7 @@ struct boss_skeramAI : public CombatAI AddCombatAction(SKERAM_ARCANE_EXPLOSION, 6000, 12000); AddCombatAction(SKERAM_TRUE_FULFILMENT, uint32(15) * IN_MILLISECONDS); AddCombatAction(SKERAM_EARTH_SHOCK, 1200u); - AddCustomAction(SKERAM_BLINK_DELAY, true, [&]() { HandleBlinkDelay(); }); + AddCustomAction(SKERAM_BLINK_DELAY, true, [&]() { HandleBlinkDelay(); }, TIMER_COMBAT_COMBAT); AddOnKillText(SAY_SLAY); } diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp index e194c033eb1..06642e9e7cd 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp @@ -85,7 +85,7 @@ struct boss_twin_emperorsAI : public CombatAI { AddCombatAction(EMPEROR_BERSERK, 15u * MINUTE * IN_MILLISECONDS); AddCombatAction(EMPEROR_BUG_ABILITY, urand(7000, 14000)); - AddCustomAction(EMPEROR_TELEPORT_DELAY, true, [&]() { HandleDelayedAttack(); }); + AddCustomAction(EMPEROR_TELEPORT_DELAY, true, [&]() { HandleDelayedAttack(); }, TIMER_COMBAT_COMBAT); } instance_temple_of_ahnqiraj* m_instance; diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp index 47ded14f496..5cc254567fd 100755 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_viscidus.cpp @@ -125,8 +125,8 @@ struct boss_viscidusAI : public CombatAI AddCombatAction(VISCIDUS_TOXIN, 30000u); AddCombatAction(VISCIDUS_POISON_SHOCK, 7000, 12000); AddCombatAction(VISCIDUS_POISON_BOLT_VOLLEY, 10000, 15000); - AddCustomAction(VISCIDUS_EXPLODE, true, [&]() { HandleExplode(); }); - AddCustomAction(VISCIDUS_REJOIN, true, [&]() { HandleRejoin(); }); + AddCustomAction(VISCIDUS_EXPLODE, true, [&]() { HandleExplode(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(VISCIDUS_REJOIN, true, [&]() { HandleRejoin(); }, TIMER_COMBAT_COMBAT); m_creature->GetCombatManager().SetLeashingCheck([&](Unit* /*unit*/, float /*x*/, float /*y*/, float /*z*/) -> bool { return m_creature->GetDistance(resetPoint.m_fX, resetPoint.m_fY, resetPoint.m_fZ, DIST_CALC_COMBAT_REACH) < 10.0f; diff --git a/src/game/AI/ScriptDevAI/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp b/src/game/AI/ScriptDevAI/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp index c059c19b2c3..e97523a8fdc 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp @@ -57,8 +57,8 @@ struct boss_murmurAI : public CombatAI boss_murmurAI(Creature* creature) : CombatAI(creature, MURMUR_ACTION_MAX), m_instance(static_cast(creature->GetInstanceData())), m_bIsRegularMode(creature->GetMap()->IsRegularDifficulty()) { - AddCustomAction(MURMUR_OOC_RP_ATTACK, true, [&]() { HandleOocAttack(); }); - AddCustomAction(MURMUR_OOC_CASTER_ATTACK, true, [&]() { HandleOocCasterAttack(); }); + AddCustomAction(MURMUR_OOC_RP_ATTACK, true, [&]() { HandleOocAttack(); }, TIMER_COMBAT_OOC); + AddCustomAction(MURMUR_OOC_CASTER_ATTACK, true, [&]() { HandleOocCasterAttack(); }, TIMER_COMBAT_OOC); } ScriptedInstance* m_instance; diff --git a/src/game/AI/ScriptDevAI/scripts/outland/black_temple/boss_illidan.cpp b/src/game/AI/ScriptDevAI/scripts/outland/black_temple/boss_illidan.cpp index 520df2791f6..24f20c9c4cf 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/black_temple/boss_illidan.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/black_temple/boss_illidan.cpp @@ -1850,6 +1850,7 @@ struct boss_maievAI : public CombatAI, private DialogueHelper // Custom evade - don't allow her to return to home position void EnterEvadeMode() override { + ResetTimersOnEvade(); m_creature->RemoveAllAurasOnEvade(); m_creature->CombatStop(true); m_creature->LoadCreatureAddon(true); diff --git a/src/game/AI/ScriptDevAI/scripts/outland/black_temple/boss_teron_gorefiend.cpp b/src/game/AI/ScriptDevAI/scripts/outland/black_temple/boss_teron_gorefiend.cpp index f70ebfcec7e..44ad48110b7 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/black_temple/boss_teron_gorefiend.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/black_temple/boss_teron_gorefiend.cpp @@ -146,7 +146,7 @@ struct boss_teron_gorefiendAI : public CombatAI m_instance->SetData(TYPE_GOREFIEND, FAIL); DespawnSummons(); DoCastSpellIfCan(nullptr, SPELL_DESTROY_ALL_SPIRITS); - ScriptedAI::EnterEvadeMode(); + CombatAI::EnterEvadeMode(); } void Aggro(Unit* /*pWho*/) override diff --git a/src/game/AI/ScriptDevAI/scripts/outland/boss_terokk.cpp b/src/game/AI/ScriptDevAI/scripts/outland/boss_terokk.cpp index 0cbca90d774..3134e92d139 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/boss_terokk.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/boss_terokk.cpp @@ -107,7 +107,7 @@ struct boss_terokkAI : public CombatAI Creature* target = GetClosestCreatureWithEntry(m_creature, NPC_SKYGUARD_TARGET, 70.f); if (Creature* ace = m_creature->GetMap()->GetCreature(m_aces[1])) ace->AI()->DoCastSpellIfCan(target, SPELL_ANCIENT_FLAMES); - }); + }, TIMER_COMBAT_COMBAT); AddTimerlessCombatAction(TEROKK_COMBAT_ACTION_SPAWN_ACE, true); AddTimerlessCombatAction(TEROKK_COMBAT_ACTION_PHASE_2, true); AddCombatAction(TEROKK_COMBAT_ACTION_DIVINE_SHIELD, GetInitialActionTimer(TEROKK_COMBAT_ACTION_DIVINE_SHIELD)); diff --git a/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_lady_vashj.cpp b/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_lady_vashj.cpp index b6a698433c7..1478efc5d16 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_lady_vashj.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_lady_vashj.cpp @@ -157,12 +157,12 @@ struct boss_lady_vashjAI : public CombatAI AddCombatAction(VASHJ_ACTION_SHOOT, 2000u); AddCombatAction(VASHJ_ACTION_FORKED_LIGHTNING, true); AddTimerlessCombatAction(VASHJ_ACTION_MELEE_MODE, true); - AddCustomAction(VASHJ_INTRO, true, [&]() { HandleIntroText(); }); - AddCustomAction(VASHJ_COILFANG_ELITE, true, [&]() { HandleCoilfangElite(); }); - AddCustomAction(VASHJ_COILFANG_STRIDER, true, [&]() { HandleCoilfangStrider(); }); - AddCustomAction(VASHJ_SPOREBAT, true, [&]() { HandleSporebat(); }); - AddCustomAction(VASHJ_ENCHANTED_ELEMENTAL, true, [&]() { HandleEnchantedElemental(); }); - AddCustomAction(VASHJ_TAINTED_ELEMENTAL, true, [&]() { HandleTaintedElemental(); }); + AddCustomAction(VASHJ_INTRO, true, [&]() { HandleIntroText(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(VASHJ_COILFANG_ELITE, true, [&]() { HandleCoilfangElite(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(VASHJ_COILFANG_STRIDER, true, [&]() { HandleCoilfangStrider(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(VASHJ_SPOREBAT, true, [&]() { HandleSporebat(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(VASHJ_ENCHANTED_ELEMENTAL, true, [&]() { HandleEnchantedElemental(); }, TIMER_COMBAT_COMBAT); + AddCustomAction(VASHJ_TAINTED_ELEMENTAL, true, [&]() { HandleTaintedElemental(); }, TIMER_COMBAT_COMBAT); SetRangedMode(true, 40.f, TYPE_PROXIMITY); AddMainSpell(SPELL_SHOOT); AddDistanceSpell(SPELL_ENTANGLE); diff --git a/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/slave_pens/boss_ahune.cpp b/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/slave_pens/boss_ahune.cpp index 3e0cfbd6407..ce6e30e670c 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/slave_pens/boss_ahune.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/slave_pens/boss_ahune.cpp @@ -100,7 +100,7 @@ struct boss_ahuneAI : public CombatAI boss_ahuneAI(Creature* creature) : CombatAI(creature, AHUNE_ACTION_MAX) { AddCustomAction(AHUNE_ATTACK, 3000u, [&]() { HandleAttackDelay(); }); - AddCustomAction(AHUNE_EMERGE, true, [&]() { HandleEmerge(); }); + AddCustomAction(AHUNE_EMERGE, true, [&]() { HandleEmerge(); }, TIMER_COMBAT_COMBAT); AddCombatAction(AHUNE_SUBMERGE, 90000u); AddCombatAction(AHUNE_COLD_SLAP, 2000u); AddCombatAction(AHUNE_HAILSTONE, 1000u); diff --git a/src/game/AI/ScriptDevAI/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp b/src/game/AI/ScriptDevAI/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp index 50b1215e9af..c23f9b3c3f6 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp @@ -68,7 +68,7 @@ struct boss_omor_the_unscarredAI : public CombatAI AddCombatAction(OMOR_TREACHERY, 12300, 23300); AddCombatAction(OMOR_ORBITAL_STRIKE, 25000u); AddCombatAction(OMOR_SHADOW_BOLT, 0u); - AddCustomAction(OMOR_PULL_BACK, true, [&]() {HandlePullBack(); }); + AddCustomAction(OMOR_PULL_BACK, true, [&]() { HandlePullBack(); }, TIMER_COMBAT_COMBAT); SetCombatMovement(false); SetRangedMode(true, 100.f, TYPE_PROXIMITY); AddOnKillText(SAY_KILL_1, SAY_KILL_2); diff --git a/src/game/AI/ScriptDevAI/scripts/outland/hellfire_citadel/shattered_halls/boss_nethekurse.cpp b/src/game/AI/ScriptDevAI/scripts/outland/hellfire_citadel/shattered_halls/boss_nethekurse.cpp index d3b0b5c28e2..b3ee6a6f8cb 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/hellfire_citadel/shattered_halls/boss_nethekurse.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/hellfire_citadel/shattered_halls/boss_nethekurse.cpp @@ -85,9 +85,9 @@ struct boss_grand_warlock_nethekurseAI : public CombatAI m_instance(static_cast(creature->GetInstanceData())), m_isRegularMode(creature->GetMap()->IsRegularDifficulty()), m_introOnce(false), m_peonRPCD(false) { - AddCustomAction(NETHEKURSE_TAUNT_PEONS, true, [&]() { DoTauntPeons(); }); - AddCustomAction(NETHEKURSE_START_FIGHT, true, [&]() { DoStartFight(); }); - AddCustomAction(NETHEKURSE_PEON_RP_CD, true, [&]() { DoPeonCD(); }); + AddCustomAction(NETHEKURSE_TAUNT_PEONS, true, [&]() { DoTauntPeons(); }, TIMER_COMBAT_OOC); + AddCustomAction(NETHEKURSE_START_FIGHT, true, [&]() { DoStartFight(); }, TIMER_COMBAT_OOC); + AddCustomAction(NETHEKURSE_PEON_RP_CD, true, [&]() { DoPeonCD(); }, TIMER_COMBAT_OOC); AddOnKillText(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3, SAY_SLAY_4); SetReactState(REACT_DEFENSIVE); } diff --git a/src/game/AI/ScriptDevAI/scripts/outland/shartuul_transporter.cpp b/src/game/AI/ScriptDevAI/scripts/outland/shartuul_transporter.cpp index 4cc6d0c636d..4d062197ef8 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/shartuul_transporter.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/shartuul_transporter.cpp @@ -162,11 +162,6 @@ struct npc_shivan_assassinAI : public CombatAI m_instance->SetData(TYPE_SHARTUUL, EVENT_FAIL); } - void EnterEvadeMode() override - { - CombatAI::EnterEvadeMode(); - } - void JustReachedHome() override { if (m_instance) diff --git a/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/arcatraz/boss_dalliah.cpp b/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/arcatraz/boss_dalliah.cpp index ed59d13f88e..daff3112a04 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/arcatraz/boss_dalliah.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/arcatraz/boss_dalliah.cpp @@ -79,6 +79,8 @@ struct boss_dalliahAI : public CombatAI if (m_instance) m_instance->SetData(TYPE_DALLIAH, IN_PROGRESS); + + m_creature->SetCombatStartPosition(Position(aDalliahStartPos[0], aDalliahStartPos[1], aDalliahStartPos[2])); } void JustDied(Unit* /*who*/) override @@ -91,20 +93,10 @@ struct boss_dalliahAI : public CombatAI void EnterEvadeMode() override { - m_creature->RemoveAllAurasOnEvade(); - m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(true); - - // should evade to the attack position - if (m_creature->IsAlive()) - m_creature->GetMotionMaster()->MovePoint(1, aDalliahStartPos[0], aDalliahStartPos[1], aDalliahStartPos[2]); + CombatAI::EnterEvadeMode(); if (m_instance) m_instance->SetData(TYPE_DALLIAH, FAIL); - - m_creature->SetLootRecipient(nullptr); - - Reset(); } void MovementInform(uint32 moveType, uint32 pointId) override diff --git a/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/arcatraz/boss_soccothrates.cpp b/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/arcatraz/boss_soccothrates.cpp index 21c8f3a2560..9bd5cf1c3e6 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/arcatraz/boss_soccothrates.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/arcatraz/boss_soccothrates.cpp @@ -119,6 +119,8 @@ struct boss_soccothratesAI : public CombatAI, private DialogueHelper if (m_instance) m_instance->SetData(TYPE_SOCCOTHRATES, IN_PROGRESS); + + m_creature->SetCombatStartPosition(Position(aSoccotharesStartPos[0], aSoccotharesStartPos[1], aSoccotharesStartPos[2])); } void MoveInLineOfSight(Unit* who) override @@ -142,20 +144,10 @@ struct boss_soccothratesAI : public CombatAI, private DialogueHelper void EnterEvadeMode() override { - m_creature->RemoveAllAurasOnEvade(); - m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(true); - - // should evade to the attack position - if (m_creature->IsAlive()) - m_creature->GetMotionMaster()->MovePoint(1, aSoccotharesStartPos[0], aSoccotharesStartPos[1], aSoccotharesStartPos[2]); + CombatAI::EnterEvadeMode(); if (m_instance) m_instance->SetData(TYPE_SOCCOTHRATES, FAIL); - - m_creature->SetLootRecipient(nullptr); - - Reset(); } void MovementInform(uint32 moveType, uint32 pointId) override diff --git a/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/botanica/boss_warp_splinter.cpp b/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/botanica/boss_warp_splinter.cpp index 8d6b55a4b64..b79ae4e9f93 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/botanica/boss_warp_splinter.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/botanica/boss_warp_splinter.cpp @@ -99,7 +99,7 @@ struct boss_warp_splinterAI : public CombatAI void EnterEvadeMode() override { - ScriptedAI::EnterEvadeMode(); + CombatAI::EnterEvadeMode(); DespawnGuids(m_saplings); } diff --git a/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/the_eye/boss_alar.cpp b/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/the_eye/boss_alar.cpp index 6ac5ad80d3b..a08b47b16f2 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/the_eye/boss_alar.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/the_eye/boss_alar.cpp @@ -235,7 +235,7 @@ struct boss_alarAI : public CombatAI if (m_creature->HasAura(SPELL_EMBER_BLAST)) return; - ScriptedAI::EnterEvadeMode(); + CombatAI::EnterEvadeMode(); } void ReceiveAIEvent(AIEventType eventType, Unit* /*sender*/, Unit* invoker, uint32 /*miscValue*/) override