*If our target of choice is attacking a player, only attack our target if we are friendly towards that player.

*Only regenerate quickly if polymorphed.

--HG--
branch : trunk
This commit is contained in:
maximius committed 2009-09-27 19:11:52 -07:00
1 parent 2c14426c76
commit 15dbc456bb
2 files changed
+14 -12

No files matched your search

+6 -3
View File
@@ -11344,7 +11344,7 @@ Unit* Creature::SelectVictim()
else
return NULL;
if(target)
if(target && (!target->isAttackingPlayer() || IsFriendlyTo(target->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly
{
SetInFront(target);
return target;
@@ -11356,7 +11356,9 @@ Unit* Creature::SelectVictim()
// Note: creature not have targeted movement generator but have attacker in this case
for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
{
if(canCreatureAttack(*itr) && ((*itr)->GetTypeId() != TYPEID_PLAYER && (!((Creature*)(*itr))->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))))
if(canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
&& !((Creature*)(*itr))->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)
&& (!(*itr)->isAttackingPlayer() || IsFriendlyTo(target->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly
return NULL;
}
@@ -11367,7 +11369,8 @@ Unit* Creature::SelectVictim()
// search nearby enemy before enter evade mode
if(HasReactState(REACT_AGGRESSIVE))
if(target = SelectNearestTarget())
return target;
if(!target->isAttackingPlayer() || IsFriendlyTo(target->getVictim())) // if the victim of target is a player, only defend the victim if we are friendly
return target;
if(m_invisibilityMask)
{