feat(Core/Scripts): Allow scheduling multiple hp checks at once for i… (#15897)
feat(Core/Scripts): Allow scheduling multiple hp checks at once for identical phases
This commit is contained in:
@@ -691,6 +691,14 @@ void BossAI::ScheduleHealthCheckEvent(uint32 healthPct, std::function<void()> ex
|
|||||||
_healthCheckEvents.push_back(HealthCheckEventData(healthPct, exec));
|
_healthCheckEvents.push_back(HealthCheckEventData(healthPct, exec));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void BossAI::ScheduleHealthCheckEvent(std::initializer_list<uint8> healthPct, std::function<void()> exec)
|
||||||
|
{
|
||||||
|
for (auto const& checks : healthPct)
|
||||||
|
{
|
||||||
|
_healthCheckEvents.push_back(HealthCheckEventData(checks, exec));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool BossAI::_ProccessHealthCheckEvent(uint8 healthPct, uint32 damage, std::function<void()> exec) const
|
bool BossAI::_ProccessHealthCheckEvent(uint8 healthPct, uint32 damage, std::function<void()> exec) const
|
||||||
{
|
{
|
||||||
if (me->HealthBelowPctDamaged(healthPct, damage))
|
if (me->HealthBelowPctDamaged(healthPct, damage))
|
||||||
|
|||||||
@@ -470,6 +470,7 @@ public:
|
|||||||
void UpdateAI(uint32 diff) override;
|
void UpdateAI(uint32 diff) override;
|
||||||
|
|
||||||
void ScheduleHealthCheckEvent(uint32 healthPct, std::function<void()> exec);
|
void ScheduleHealthCheckEvent(uint32 healthPct, std::function<void()> exec);
|
||||||
|
void ScheduleHealthCheckEvent(std::initializer_list<uint8> healthPct, std::function<void()> exec);
|
||||||
|
|
||||||
// Hook used to execute events scheduled into EventMap without the need
|
// Hook used to execute events scheduled into EventMap without the need
|
||||||
// to override UpdateAI
|
// to override UpdateAI
|
||||||
|
|||||||
@@ -56,31 +56,7 @@ struct boss_talon_king_ikiss : public BossAI
|
|||||||
_Reset();
|
_Reset();
|
||||||
_spoken = false;
|
_spoken = false;
|
||||||
|
|
||||||
ScheduleHealthCheckEvent(80, [&] {
|
ScheduleHealthCheckEvent({ 80, 50, 25 }, [&] {
|
||||||
TeleportAndCastExplosion();
|
|
||||||
});
|
|
||||||
|
|
||||||
ScheduleHealthCheckEvent(50, [&] {
|
|
||||||
TeleportAndCastExplosion();
|
|
||||||
});
|
|
||||||
|
|
||||||
ScheduleHealthCheckEvent(25, [&] {
|
|
||||||
TeleportAndCastExplosion();
|
|
||||||
});
|
|
||||||
|
|
||||||
ScheduleHealthCheckEvent(20, [&] {
|
|
||||||
DoCast(me, SPELL_MANA_SHIELD);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @todo: remove this once pets stop going through doors.
|
|
||||||
bool CanAIAttack(Unit const* /*victim*/) const override
|
|
||||||
{
|
|
||||||
return _spoken;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TeleportAndCastExplosion()
|
|
||||||
{
|
|
||||||
me->InterruptNonMeleeSpells(false);
|
me->InterruptNonMeleeSpells(false);
|
||||||
DoCastAOE(SPELL_BLINK);
|
DoCastAOE(SPELL_BLINK);
|
||||||
DoCastSelf(SPELL_ARCANE_BUBBLE, true);
|
DoCastSelf(SPELL_ARCANE_BUBBLE, true);
|
||||||
@@ -93,6 +69,17 @@ struct boss_talon_king_ikiss : public BossAI
|
|||||||
{
|
{
|
||||||
me->GetThreatMgr().ResetAllThreat();
|
me->GetThreatMgr().ResetAllThreat();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
ScheduleHealthCheckEvent(20, [&] {
|
||||||
|
DoCast(me, SPELL_MANA_SHIELD);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @todo: remove this once pets stop going through doors.
|
||||||
|
bool CanAIAttack(Unit const* /*victim*/) const override
|
||||||
|
{
|
||||||
|
return _spoken;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveInLineOfSight(Unit* who) override
|
void MoveInLineOfSight(Unit* who) override
|
||||||
|
|||||||
Reference in New Issue
Block a user