From c13d83796f7b2111c5dcf8546bdd84eccd232ae3 Mon Sep 17 00:00:00 2001 From: Treeston Date: Sun, 21 Jul 2019 01:49:58 +0200 Subject: Core/AI: Finally move the "is creature engaged" flag to be a property of the creature AI, where it honestly always belonged. Fixes #17981 and #23602 for real this time. (cherry picked from commit 0e7c66cb4c7ff7d44e232d0b50703a48605ffd24) --- .../BlackrockDepths/instance_blackrock_depths.cpp | 11 ++--------- src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp | 2 -- .../scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp | 11 ++++++----- 3 files changed, 8 insertions(+), 16 deletions(-) (limited to 'src/server/scripts/EasternKingdoms') diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index a326d9c2323..2057c55a29b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -372,16 +372,9 @@ public: if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) { if (!boss->IsAlive()) - {//do not call EnterEvadeMode(), it will create infinit loops boss->Respawn(); - boss->RemoveAllAuras(); - boss->CombatStop(true); - boss->GetThreatManager().NotifyDisengaged(); - boss->LoadCreaturesAddon(); - boss->GetMotionMaster()->MoveTargetedHome(); - boss->SetLootRecipient(nullptr); - } - boss->SetFaction(FACTION_FRIENDLY); + else + boss->SetFaction(FACTION_FRIENDLY); } } GhostKillCount = 0; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 68400643091..7c6fb0e4689 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -1257,7 +1257,6 @@ public: Julianne->GetMotionMaster()->Clear(); Julianne->setDeathState(JUST_DIED); Julianne->CombatStop(true); - Julianne->GetThreatManager().NotifyDisengaged(); Julianne->SetDynamicFlags(UNIT_DYNFLAG_LOOTABLE); } return; @@ -1527,7 +1526,6 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama Romulo->GetMotionMaster()->Clear(); Romulo->setDeathState(JUST_DIED); Romulo->CombatStop(true); - Romulo->GetThreatManager().NotifyDisengaged(); Romulo->SetDynamicFlags(UNIT_DYNFLAG_LOOTABLE); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 64c8497712c..f62c84c7dc0 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -1388,9 +1388,10 @@ public: me->RemoveAurasDueToSpell(SPELL_THE_MIGHT_OF_MOGRAINE); me->RemoveAllAuras(); me->CombatStop(true); - me->GetThreatManager().NotifyDisengaged(); me->InterruptNonMeleeSpells(false); me->SetWalk(false); + + EngagementOver(); for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) DespawnNPC(uiDefenderGUID[i]); @@ -1407,9 +1408,9 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) { + temp->AI()->EnterEvadeMode(); temp->RemoveAllAuras(); temp->CombatStop(true); - temp->GetThreatManager().NotifyDisengaged(); temp->AttackStop(); temp->SetFaction(me->GetFaction()); temp->SetWalk(false); @@ -1428,9 +1429,9 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) { + temp->AI()->EnterEvadeMode(); temp->RemoveAllAuras(); temp->CombatStop(true); - temp->GetThreatManager().NotifyDisengaged(); temp->AttackStop(); temp->SetFaction(me->GetFaction()); temp->SetWalk(false); @@ -1440,9 +1441,9 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) { + temp->AI()->EnterEvadeMode(); temp->RemoveAllAuras(); temp->CombatStop(true); - temp->GetThreatManager().NotifyDisengaged(); temp->AttackStop(); temp->SetFaction(me->GetFaction()); temp->SetWalk(false); @@ -1455,9 +1456,9 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) { + temp->AI()->EnterEvadeMode(); temp->RemoveAllAuras(); temp->CombatStop(true); - temp->GetThreatManager().NotifyDisengaged(); temp->AttackStop(); temp->SetFaction(me->GetFaction()); temp->SetWalk(false); -- cgit v1.2.3