From 0b745022a49749711a49ab2a823d2abfcb4c0d60 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Fri, 28 Oct 2022 22:01:47 -0300 Subject: [PATCH] =?UTF-8?q?fix(Scripts/TempleOfAhnQiraj):=20Ouro=20Sand=20?= =?UTF-8?q?Blast=20should=20hit=20top=20threat=20=E2=80=A6=20(#13578)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(Scripts/TempleOfAhnQiraj): Ouro Sand Blast should hit top threat target * ouro should only target players in melee range * fix ouro resetting * Update boss_ouro.cpp --- .../Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp index f2aa35452..6b8d086ac 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp @@ -112,6 +112,11 @@ struct boss_ouro : public BossAI _scheduler.SetValidator([this] { return !me->HasUnitState(UNIT_STATE_CASTING); }); } + bool CanAIAttack(Unit const* victim) const override + { + return me->IsWithinMeleeRange(victim); + } + void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType, SpellSchoolMask) override { if (me->HealthBelowPctDamaged(20, damage) && !_enraged) @@ -204,7 +209,21 @@ struct boss_ouro : public BossAI _scheduler .Schedule(20s, GROUP_EMERGED, [this](TaskContext context) { - DoCastVictim(SPELL_SAND_BLAST); + if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 0.0f, true)) + { + me->SetTarget(target->GetGUID()); + } + + DoCastAOE(SPELL_SAND_BLAST); + + me->m_Events.AddEventAtOffset([this]() + { + if (Unit* victim = me->GetVictim()) + { + me->SetTarget(victim->GetGUID()); + } + }, 3s); + context.Repeat(); }) .Schedule(22s, GROUP_EMERGED, [this](TaskContext context) @@ -254,11 +273,14 @@ struct boss_ouro : public BossAI void EnterEvadeMode(EvadeReason /*why*/) override { - DoCastSelf(SPELL_OURO_SUBMERGE_VISUAL); - me->DespawnOrUnsummon(1000); - instance->SetBossState(DATA_OURO, FAIL); - if (GameObject* base = me->FindNearestGameObject(GO_SANDWORM_BASE, 200.f)) - base->DespawnOrUnsummon(); + if (me->GetThreatMgr().GetThreatList().empty()) + { + DoCastSelf(SPELL_OURO_SUBMERGE_VISUAL); + me->DespawnOrUnsummon(1000); + instance->SetBossState(DATA_OURO, FAIL); + if (GameObject* base = me->FindNearestGameObject(GO_SANDWORM_BASE, 200.f)) + base->DespawnOrUnsummon(); + } } void EnterCombat(Unit* who) override