refactor(Core/EventMap): Refactor EventMap and related scripts (#23121)

Co-authored-by: Kelno <3866946+kelno@users.noreply.github.com>
Co-authored-by: Peter Keresztes Schmidt <carbenium@outlook.com>
This commit is contained in:
天鹭 2025-10-13 09:19:24 +08:00 committed by GitHub
parent 8e1426c06a
commit 9c49349e1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
168 changed files with 1468 additions and 1593 deletions

View file

@ -62,10 +62,18 @@ struct npc_pet_mage_mirror_image : CasterAI
ObjectGuid _ebonGargoyleGUID;
uint32 checktarget;
uint32 dist = urand(1, 5);
bool _delayAttack;
void InitializeAI() override
{
CasterAI::InitializeAI();
_delayAttack = true;
me->m_Events.AddEventAtOffset([this]()
{
_delayAttack = false;
}, 1200ms);
Unit* owner = me->GetOwner();
if (!owner)
return;
@ -185,10 +193,11 @@ struct npc_pet_mage_mirror_image : CasterAI
void UpdateAI(uint32 diff) override
{
events.Update(diff);
if (events.GetTimer() < 1200)
if (_delayAttack)
return;
events.Update(diff);
if (!me->IsInCombat() || !me->GetVictim())
{
MySelectNextTarget();
@ -212,7 +221,7 @@ struct npc_pet_mage_mirror_image : CasterAI
if (uint32 spellId = events.ExecuteEvent())
{
events.RescheduleEvent(spellId, spellId == 59637 ? 6500 : 2500);
events.RescheduleEvent(spellId, spellId == 59637 ? 6500ms : 2500ms);
me->CastSpell(me->GetVictim(), spellId, false);
}
}