Merge pull request #6820 from Elron103/pull-requests
Core/Combat: Fix CanAIAttack implementation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user