mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-07 15:28:02 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user