More fixes for Mirror Image

When player loses target on the mirror image should still attack the current target
This commit is contained in:
talamortis
2018-03-29 01:01:38 +01:00
parent 91cbe9e98a
commit 4cb370e192

View File

@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
@@ -81,7 +81,7 @@ class npc_pet_mage_mirror_image : public CreatureScript
((Minion*)me)->SetFollowAngle(angle);
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
me->SetReactState(REACT_PASSIVE);
me->SetReactState(REACT_DEFENSIVE);
// Xinef: Inherit Master's Threat List (not yet implemented)
//owner->CastSpell((Unit*)NULL, SPELL_MAGE_MASTERS_THREAT_LIST, true);
@@ -149,26 +149,14 @@ class npc_pet_mage_mirror_image : public CreatureScript
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{
Unit* selection = owner->ToPlayer()->GetSelectedUnit();
if (selection && selection != me->GetVictim())
{
// target has cc, search target without cc!
if (selection->HasBreakableByDamageCrowdControlAura() || !me->IsValidAttackTarget(selection))
{
EnterEvadeMode();
return;
}
if (selection)
{
me->getThreatManager().resetAllAggro();
me->AddThreat(selection, 1000000.0f);
if (owner->IsInCombat())
AttackStart(selection);
AttackStart(selection);
}
}
if (!me->GetVictim() || !me->GetVictim()->IsAlive())
return;
}
void Reset()
@@ -183,6 +171,9 @@ class npc_pet_mage_mirror_image : public CreatureScript
if (events.GetTimer() < 1200)
return;
if (!me->GetVictim() || !me->GetVictim()->IsAlive())
EnterEvadeMode();
if (!me->IsInCombat() || !me->GetVictim())
{
MySelectNextTarget();
@@ -190,23 +181,17 @@ class npc_pet_mage_mirror_image : public CreatureScript
}
checktarget += diff;
if (checktarget >= 1000)
{
if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive())
{
MySelectNextTarget();
me->InterruptNonMeleeSpells(true); // Stop casting if target is C or not Alive.
me->InterruptNonMeleeSpells(true); // Stop casting if target is CC or not Alive.
return;
}
}
selectionTimer += diff;
if (selectionTimer >= 1000)
{
MySelectNextTarget();
selectionTimer = 0;
}
if (me->HasUnitState(UNIT_STATE_CASTING))
return;