diff --git a/src/scripts/Pet/pet_mage.cpp b/src/scripts/Pet/pet_mage.cpp index a8089857b..4642e9a13 100644 --- a/src/scripts/Pet/pet_mage.cpp +++ b/src/scripts/Pet/pet_mage.cpp @@ -52,6 +52,7 @@ class npc_pet_mage_mirror_image : public CreatureScript uint32 selectionTimer; uint64 _ebonGargoyleGUID; + uint32 checktarget; void InitializeAI() { @@ -135,7 +136,7 @@ class npc_pet_mage_mirror_image : public CreatureScript } } - bool MySelectNextTarget() + void MySelectNextTarget() { if (_ebonGargoyleGUID) { @@ -153,21 +154,27 @@ class npc_pet_mage_mirror_image : public CreatureScript // target has cc, search target without cc! if (selection->HasBreakableByDamageCrowdControlAura() || !me->IsValidAttackTarget(selection)) { - return false; + EnterEvadeMode(); + return; } me->getThreatManager().resetAllAggro(); me->AddThreat(selection, 1000000.0f); - AttackStart(selection); - return true; + + if (owner->IsInCombat()) + AttackStart(selection); + } } - return false; + + if (!me->GetVictim() || !me->GetVictim()->IsAlive()) + return; } void Reset() { selectionTimer = 0; + checktarget = 0; } void UpdateAI(uint32 diff) @@ -182,12 +189,15 @@ class npc_pet_mage_mirror_image : public CreatureScript return; } - if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive()) + checktarget += diff; + if (checktarget >= 1000) { - me->InterruptNonMeleeSpells(false); - if (!MySelectNextTarget()) - EnterEvadeMode(); - return; + if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive()) + { + MySelectNextTarget(); + me->InterruptNonMeleeSpells(true); // Stop casting if target is C or not Alive. + return; + } } selectionTimer += diff;