Fixed Mirror Image

close #730
This commit is contained in:
talamortis
2017-12-13 19:14:38 +00:00
parent 6d5f59d83a
commit a0d17509a2

View File

@@ -52,6 +52,7 @@ class npc_pet_mage_mirror_image : public CreatureScript
uint32 selectionTimer; uint32 selectionTimer;
uint64 _ebonGargoyleGUID; uint64 _ebonGargoyleGUID;
uint32 checktarget;
void InitializeAI() void InitializeAI()
{ {
@@ -135,7 +136,7 @@ class npc_pet_mage_mirror_image : public CreatureScript
} }
} }
bool MySelectNextTarget() void MySelectNextTarget()
{ {
if (_ebonGargoyleGUID) if (_ebonGargoyleGUID)
{ {
@@ -153,21 +154,27 @@ class npc_pet_mage_mirror_image : public CreatureScript
// target has cc, search target without cc! // target has cc, search target without cc!
if (selection->HasBreakableByDamageCrowdControlAura() || !me->IsValidAttackTarget(selection)) if (selection->HasBreakableByDamageCrowdControlAura() || !me->IsValidAttackTarget(selection))
{ {
return false; EnterEvadeMode();
return;
} }
me->getThreatManager().resetAllAggro(); me->getThreatManager().resetAllAggro();
me->AddThreat(selection, 1000000.0f); 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() void Reset()
{ {
selectionTimer = 0; selectionTimer = 0;
checktarget = 0;
} }
void UpdateAI(uint32 diff) void UpdateAI(uint32 diff)
@@ -182,12 +189,15 @@ class npc_pet_mage_mirror_image : public CreatureScript
return; return;
} }
if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive()) checktarget += diff;
if (checktarget >= 1000)
{ {
me->InterruptNonMeleeSpells(false); if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive())
if (!MySelectNextTarget()) {
EnterEvadeMode(); MySelectNextTarget();
return; me->InterruptNonMeleeSpells(true); // Stop casting if target is C or not Alive.
return;
}
} }
selectionTimer += diff; selectionTimer += diff;