fix(Scripts/ZulAman): make sure Malacrass timer is delayed only when it should be triggered during channel of Spirit Bolts (#21089)

This commit is contained in:
Dan
2025-01-06 18:44:44 +01:00
committed by GitHub
parent 131671d793
commit 72ae994a65
4 changed files with 24 additions and 14 deletions

View File

@@ -98,7 +98,7 @@ struct boss_akilzon : public BossAI
});
ScheduleTimedEvent(20s, 30s, [&] {
if (scheduler.GetNextGroupOcurrence(GROUP_ELECTRICAL_STORM) > 5s)
if (scheduler.GetNextGroupOccurrence(GROUP_ELECTRICAL_STORM) > 5s)
DoCastRandomTarget(SPELL_GUST_OF_WIND, 1);
}, 20s, 30s);

View File

@@ -135,7 +135,8 @@ enum Misc
MAX_ADD_COUNT = 4,
ADDITIONAL_CLASS_SPRIEST = 11,
AURA_SHADOW_FORM = 15473,
GROUP_CLASS_ABILITY = 1
GROUP_CLASS_ABILITY = 1,
GROUP_DRAIN_POWER = 2
};
enum AbilityTarget
@@ -242,12 +243,15 @@ struct boss_hexlord_malacrass : public BossAI
BossAI::Reset();
_currentClass = CLASS_NONE;
_classAbilityTimer = 10000ms;
_timeUntilNextDrainPower = 0ms;
SpawnAdds();
ScheduleHealthCheckEvent(80, [&] {
ScheduleTimedEvent(1s, [&] {
scheduler.Schedule(1s, GROUP_DRAIN_POWER, [this](TaskContext context)
{
DoCastSelf(SPELL_DRAIN_POWER, true);
Talk(SAY_DRAIN_POWER);
}, 30s);
context.Repeat(30s);
});
});
}
@@ -282,6 +286,14 @@ struct boss_hexlord_malacrass : public BossAI
ScheduleTimedEvent(30s, [&]{
scheduler.CancelGroup(GROUP_CLASS_ABILITY);
DoCastSelf(SPELL_SPIRIT_BOLTS);
// Delay Drain Power if it's currently within 10s of being cast
// TODO: see what is wrong with GetNextGroupOccurrence as the timers don't seem correct on resets
_timeUntilNextDrainPower = scheduler.GetNextGroupOccurrence(GROUP_DRAIN_POWER);
if (_timeUntilNextDrainPower > 0s && _timeUntilNextDrainPower < 10s)
{
std::chrono::milliseconds delayTime = 10s - _timeUntilNextDrainPower + 1s;
scheduler.DelayGroup(GROUP_DRAIN_POWER, delayTime);
}
scheduler.Schedule(10s, [this](TaskContext)
{
if (Creature* siphonTrigger = me->SummonCreature(NPC_TEMP_TRIGGER, me->GetPosition(), TEMPSUMMON_TIMED_DESPAWN, 30000))
@@ -354,6 +366,7 @@ struct boss_hexlord_malacrass : public BossAI
private:
uint8 _currentClass;
std::chrono::milliseconds _classAbilityTimer;
std::chrono::milliseconds _timeUntilNextDrainPower;
std::vector<uint8> _creatureIndex;
};