Merge pull request #6820 from Elron103/pull-requests

Core/Combat: Fix CanAIAttack implementation
This commit is contained in:
QAston
2012-06-17 03:20:44 -07:00
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -354,7 +354,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR
// list sorted and and we check current target, then this is best case
if (currentVictim == currentRef || currentRef->getThreat() <= 1.1f * currentVictim->getThreat())
{
currentRef = currentVictim; // for second case
if (currentVictim != currentRef && attacker->canCreatureAttack(currentVictim->getTarget()))
currentRef = currentVictim; // for second case, if currentvictim is attackable
found = true;
break;
}
+2 -2
View File
@@ -12958,7 +12958,7 @@ Unit* Creature::SelectVictim()
else
return NULL;
if (target && _IsTargetAcceptable(target))
if (target && _IsTargetAcceptable(target) && canCreatureAttack(target))
{
SetInFront(target);
return target;
@@ -12984,7 +12984,7 @@ Unit* Creature::SelectVictim()
{
target = SelectNearestTargetInAttackDistance(m_CombatDistance ? m_CombatDistance : ATTACK_DISTANCE);
if (target && _IsTargetAcceptable(target))
if (target && _IsTargetAcceptable(target) && canCreatureAttack(target))
return target;
}