mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
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:
@@ -124,9 +124,9 @@ bool TaskScheduler::IsGroupScheduled(group_t const group)
|
|||||||
return _task_holder.IsGroupQueued(group);
|
return _task_holder.IsGroupQueued(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
Milliseconds TaskScheduler::GetNextGroupOcurrence(group_t const group) const
|
Milliseconds TaskScheduler::GetNextGroupOccurrence(group_t const group) const
|
||||||
{
|
{
|
||||||
return std::chrono::duration_cast<std::chrono::milliseconds>(_task_holder.GetNextGroupOcurrence(group) - clock_t::now());
|
return std::chrono::duration_cast<std::chrono::milliseconds>(_task_holder.GetNextGroupOccurrence(group) - clock_t::now());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskScheduler::TaskQueue::Push(TaskContainer&& task)
|
void TaskScheduler::TaskQueue::Push(TaskContainer&& task)
|
||||||
@@ -194,15 +194,12 @@ bool TaskScheduler::TaskQueue::IsGroupQueued(group_t const group)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskScheduler::timepoint_t TaskScheduler::TaskQueue::GetNextGroupOcurrence(group_t const group) const
|
TaskScheduler::timepoint_t TaskScheduler::TaskQueue::GetNextGroupOccurrence(group_t const group) const
|
||||||
{
|
{
|
||||||
TaskScheduler::timepoint_t next = TaskScheduler::timepoint_t::max();
|
TaskScheduler::timepoint_t next = TaskScheduler::timepoint_t::max();
|
||||||
for (auto const& task : container)
|
for (auto const& task : container)
|
||||||
{
|
|
||||||
if (task->IsInGroup(group) && task->_end < next)
|
if (task->IsInGroup(group) && task->_end < next)
|
||||||
next = task->_end;
|
next = task->_end;
|
||||||
}
|
|
||||||
|
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +245,7 @@ TaskScheduler::repeated_t TaskContext::GetRepeatCounter() const
|
|||||||
return _task->_repeated;
|
return _task->_repeated;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskScheduler::timepoint_t TaskContext::GetNextOcurrence() const
|
TaskScheduler::timepoint_t TaskContext::GetNextOccurrence() const
|
||||||
{
|
{
|
||||||
return _task->_end;
|
return _task->_end;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class TaskScheduler
|
|||||||
bool IsGroupQueued(group_t const group);
|
bool IsGroupQueued(group_t const group);
|
||||||
|
|
||||||
// Returns the next group occurrence.
|
// Returns the next group occurrence.
|
||||||
TaskScheduler::timepoint_t GetNextGroupOcurrence(group_t const group) const;
|
TaskScheduler::timepoint_t GetNextGroupOccurrence(group_t const group) const;
|
||||||
|
|
||||||
bool IsEmpty() const;
|
bool IsEmpty() const;
|
||||||
};
|
};
|
||||||
@@ -377,7 +377,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the next group occurrence.
|
// Returns the next group occurrence.
|
||||||
Milliseconds GetNextGroupOcurrence(group_t const group) const;
|
Milliseconds GetNextGroupOccurrence(group_t const group) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Insert a new task to the enqueued tasks.
|
/// Insert a new task to the enqueued tasks.
|
||||||
@@ -483,7 +483,7 @@ public:
|
|||||||
/// Returns the repeat counter which increases every time the task is repeated.
|
/// Returns the repeat counter which increases every time the task is repeated.
|
||||||
TaskScheduler::repeated_t GetRepeatCounter() const;
|
TaskScheduler::repeated_t GetRepeatCounter() const;
|
||||||
|
|
||||||
TaskScheduler::timepoint_t GetNextOcurrence() const;
|
TaskScheduler::timepoint_t GetNextOccurrence() const;
|
||||||
|
|
||||||
/// Repeats the event and sets a new duration.
|
/// Repeats the event and sets a new duration.
|
||||||
/// std::chrono::seconds(5) for example.
|
/// std::chrono::seconds(5) for example.
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ struct boss_akilzon : public BossAI
|
|||||||
});
|
});
|
||||||
|
|
||||||
ScheduleTimedEvent(20s, 30s, [&] {
|
ScheduleTimedEvent(20s, 30s, [&] {
|
||||||
if (scheduler.GetNextGroupOcurrence(GROUP_ELECTRICAL_STORM) > 5s)
|
if (scheduler.GetNextGroupOccurrence(GROUP_ELECTRICAL_STORM) > 5s)
|
||||||
DoCastRandomTarget(SPELL_GUST_OF_WIND, 1);
|
DoCastRandomTarget(SPELL_GUST_OF_WIND, 1);
|
||||||
}, 20s, 30s);
|
}, 20s, 30s);
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,8 @@ enum Misc
|
|||||||
MAX_ADD_COUNT = 4,
|
MAX_ADD_COUNT = 4,
|
||||||
ADDITIONAL_CLASS_SPRIEST = 11,
|
ADDITIONAL_CLASS_SPRIEST = 11,
|
||||||
AURA_SHADOW_FORM = 15473,
|
AURA_SHADOW_FORM = 15473,
|
||||||
GROUP_CLASS_ABILITY = 1
|
GROUP_CLASS_ABILITY = 1,
|
||||||
|
GROUP_DRAIN_POWER = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AbilityTarget
|
enum AbilityTarget
|
||||||
@@ -242,12 +243,15 @@ struct boss_hexlord_malacrass : public BossAI
|
|||||||
BossAI::Reset();
|
BossAI::Reset();
|
||||||
_currentClass = CLASS_NONE;
|
_currentClass = CLASS_NONE;
|
||||||
_classAbilityTimer = 10000ms;
|
_classAbilityTimer = 10000ms;
|
||||||
|
_timeUntilNextDrainPower = 0ms;
|
||||||
SpawnAdds();
|
SpawnAdds();
|
||||||
ScheduleHealthCheckEvent(80, [&] {
|
ScheduleHealthCheckEvent(80, [&] {
|
||||||
ScheduleTimedEvent(1s, [&] {
|
scheduler.Schedule(1s, GROUP_DRAIN_POWER, [this](TaskContext context)
|
||||||
|
{
|
||||||
DoCastSelf(SPELL_DRAIN_POWER, true);
|
DoCastSelf(SPELL_DRAIN_POWER, true);
|
||||||
Talk(SAY_DRAIN_POWER);
|
Talk(SAY_DRAIN_POWER);
|
||||||
}, 30s);
|
context.Repeat(30s);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,6 +286,14 @@ struct boss_hexlord_malacrass : public BossAI
|
|||||||
ScheduleTimedEvent(30s, [&]{
|
ScheduleTimedEvent(30s, [&]{
|
||||||
scheduler.CancelGroup(GROUP_CLASS_ABILITY);
|
scheduler.CancelGroup(GROUP_CLASS_ABILITY);
|
||||||
DoCastSelf(SPELL_SPIRIT_BOLTS);
|
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)
|
scheduler.Schedule(10s, [this](TaskContext)
|
||||||
{
|
{
|
||||||
if (Creature* siphonTrigger = me->SummonCreature(NPC_TEMP_TRIGGER, me->GetPosition(), TEMPSUMMON_TIMED_DESPAWN, 30000))
|
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:
|
private:
|
||||||
uint8 _currentClass;
|
uint8 _currentClass;
|
||||||
std::chrono::milliseconds _classAbilityTimer;
|
std::chrono::milliseconds _classAbilityTimer;
|
||||||
|
std::chrono::milliseconds _timeUntilNextDrainPower;
|
||||||
std::vector<uint8> _creatureIndex;
|
std::vector<uint8> _creatureIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user