From 38889324b2bd4a77b47bf4774753198e280723ec Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Thu, 23 Jun 2022 09:49:08 -0300 Subject: [PATCH] fix(Scripts/BlackwingLair): Nefarian class calls should not repeat (#12148) --- .../BlackwingLair/boss_nefarian.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index cfb502d59..ec924ec79 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -548,6 +548,8 @@ struct boss_nefarian : public BossAI } me->DespawnOrUnsummon(); } + + classesPresent.clear(); } void EnterCombat(Unit* /*who*/) override {} @@ -675,16 +677,21 @@ struct boss_nefarian : public BossAI events.ScheduleEvent(EVENT_TAILLASH, 10000); break; case EVENT_CLASSCALL: - std::set classesPresent; - for (auto& ref : me->GetThreatMgr().getThreatList()) + if (classesPresent.empty()) { - if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER) + for (auto& ref : me->GetThreatMgr().getThreatList()) { - classesPresent.insert(ref->getTarget()->getClass()); + if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER) + { + classesPresent.insert(ref->getTarget()->getClass()); + } } } + uint8 targetClass = Acore::Containers::SelectRandomContainerElement(classesPresent); + classesPresent.erase(targetClass); + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, ClassCallSelector(me, targetClass))) { switch (target->getClass()) @@ -755,6 +762,7 @@ struct boss_nefarian : public BossAI private: bool Phase3; bool _introDone; + std::set classesPresent; }; enum TotemSpells