From 01c8344cc8df536255e2d501acb59ca6437f35e4 Mon Sep 17 00:00:00 2001 From: Carriola-wotlk <148633595+Carriola-wotlk@users.noreply.github.com> Date: Mon, 19 Aug 2024 02:06:45 +0200 Subject: [PATCH] fix(Scripts/BlackTemple): Gathios the Shatterer shouldnt use Hammer of Justice on random players (#19653) * fix: SelectTargetMethod Random replaced with MaxThreat * restore like origin * fix: cast Hammer Of Justice on current target instead random target * refactor: case EVENT_SPELL_HAMMER_OF_JUSTICE statement refactored * refactor: if statement splitted * refactor: last space removed * Update src/server/scripts/Outland/BlackTemple/illidari_council.cpp Co-authored-by: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> * fix redundant check and new line --------- Co-authored-by: MattiaBallarini Co-authored-by: Andrew <47818697+Nyeriah@users.noreply.github.com> Co-authored-by: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> --- .../Outland/BlackTemple/illidari_council.cpp | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index eeff38ecc..f77b4d639 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -103,20 +103,6 @@ enum Misc EVENT_KILL_TALK = 100 }; -struct HammerOfJusticeSelector -{ -public: - HammerOfJusticeSelector(Unit* me) : _me(me) { } - - bool operator()(Unit const* target) const - { - return target && target->GetTypeId() == TYPEID_PLAYER && _me->IsInRange(target, 10.0f, 40.0f, true); - } - -private: - Unit const* _me; -}; - class VerasEnvenom : public BasicEvent { public: @@ -337,12 +323,13 @@ public: events.ScheduleEvent(EVENT_SPELL_AURA, 30000); break; case EVENT_SPELL_HAMMER_OF_JUSTICE: - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, HammerOfJusticeSelector(me))) - { - me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE, false); - events.ScheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, 20000); - break; - } + if (Unit* target = me->GetVictim()) + if (target->IsPlayer() && me->IsInRange(target, 10.0f, 40.0f, true)) + { + me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE); + events.ScheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, 20s); + break; + } events.ScheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, 0); break; case EVENT_SPELL_SEAL: @@ -711,4 +698,3 @@ void AddSC_boss_illidari_council() RegisterSpellScript(spell_illidari_council_judgement); RegisterSpellScript(spell_illidari_council_deadly_strike_aura); } -