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

View File

@@ -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