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);
if (owner->IsInCombat())
AttackStart(selection); AttackStart(selection);
return true;
} }
} }
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,13 +189,16 @@ class npc_pet_mage_mirror_image : public CreatureScript
return; return;
} }
checktarget += diff;
if (checktarget >= 1000)
{
if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive()) if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive())
{ {
me->InterruptNonMeleeSpells(false); MySelectNextTarget();
if (!MySelectNextTarget()) me->InterruptNonMeleeSpells(true); // Stop casting if target is C or not Alive.
EnterEvadeMode();
return; return;
} }
}
selectionTimer += diff; selectionTimer += diff;
if (selectionTimer >= 1000) if (selectionTimer >= 1000)