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
|
// list sorted and and we check current target, then this is best case
|
||||||
if (currentVictim == currentRef || currentRef->getThreat() <= 1.1f * currentVictim->getThreat())
|
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;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12958,7 +12958,7 @@ Unit* Creature::SelectVictim()
|
|||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (target && _IsTargetAcceptable(target))
|
if (target && _IsTargetAcceptable(target) && canCreatureAttack(target))
|
||||||
{
|
{
|
||||||
SetInFront(target);
|
SetInFront(target);
|
||||||
return target;
|
return target;
|
||||||
@@ -12984,7 +12984,7 @@ Unit* Creature::SelectVictim()
|
|||||||
{
|
{
|
||||||
target = SelectNearestTargetInAttackDistance(m_CombatDistance ? m_CombatDistance : ATTACK_DISTANCE);
|
target = SelectNearestTargetInAttackDistance(m_CombatDistance ? m_CombatDistance : ATTACK_DISTANCE);
|
||||||
|
|
||||||
if (target && _IsTargetAcceptable(target))
|
if (target && _IsTargetAcceptable(target) && canCreatureAttack(target))
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user