fix(Scripts/TempleOfAhnQiraj): Ouro Sand Blast should hit top threat … (#13578)

* 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
This commit is contained in:
Skjalf
2022-10-28 22:01:47 -03:00
committed by GitHub
parent f2669971ed
commit 0b745022a4
@@ -112,6 +112,11 @@ struct boss_ouro : public BossAI
_scheduler.SetValidator([this] { return !me->HasUnitState(UNIT_STATE_CASTING); }); _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 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType, SpellSchoolMask) override
{ {
if (me->HealthBelowPctDamaged(20, damage) && !_enraged) if (me->HealthBelowPctDamaged(20, damage) && !_enraged)
@@ -204,7 +209,21 @@ struct boss_ouro : public BossAI
_scheduler _scheduler
.Schedule(20s, GROUP_EMERGED, [this](TaskContext context) .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(); context.Repeat();
}) })
.Schedule(22s, GROUP_EMERGED, [this](TaskContext context) .Schedule(22s, GROUP_EMERGED, [this](TaskContext context)
@@ -253,6 +272,8 @@ struct boss_ouro : public BossAI
} }
void EnterEvadeMode(EvadeReason /*why*/) override void EnterEvadeMode(EvadeReason /*why*/) override
{
if (me->GetThreatMgr().GetThreatList().empty())
{ {
DoCastSelf(SPELL_OURO_SUBMERGE_VISUAL); DoCastSelf(SPELL_OURO_SUBMERGE_VISUAL);
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1000);
@@ -260,6 +281,7 @@ struct boss_ouro : public BossAI
if (GameObject* base = me->FindNearestGameObject(GO_SANDWORM_BASE, 200.f)) if (GameObject* base = me->FindNearestGameObject(GO_SANDWORM_BASE, 200.f))
base->DespawnOrUnsummon(); base->DespawnOrUnsummon();
} }
}
void EnterCombat(Unit* who) override void EnterCombat(Unit* who) override
{ {