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 <ballarini.mattia1990@gmail.com>
Co-authored-by: Andrew <47818697+Nyeriah@users.noreply.github.com>
Co-authored-by: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com>
This commit is contained in:
Carriola-wotlk
2024-08-19 02:06:45 +02:00
committed by GitHub
parent 79a653b13e
commit 01c8344cc8

View File

@@ -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);
}