Core/Entities: Replace Unit::canAttack usage with more accurate Unit::IsValidAttackTarget

This commit is contained in:
QAston
2011-09-16 23:49:31 +02:00
parent 3a3f2d927f
commit c0b1823524
15 changed files with 23 additions and 19 deletions

View File

@@ -226,7 +226,7 @@ public:
Unit* eventStarter = Unit::GetUnit(*me, uiEventStarterGUID);
if (eventStarter && me->canAttack(eventStarter))
if (eventStarter && me->IsValidAttackTarget(eventStarter))
AttackStart(eventStarter);
else if (!UpdateVictim())
{
@@ -250,7 +250,7 @@ public:
// switch to "who" if nearer than current target.
void SelectNearestTarget(Unit* who)
{
if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who))
if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->IsValidAttackTarget(who))
{
me->getThreatManager().modifyThreatPercent(me->getVictim(), -100);
me->AddThreat(who, 1000000.0f);

View File

@@ -862,7 +862,7 @@ public:
void EnterCombat(Unit* who)
{
if (me->canAttack(who))
if (me->IsValidAttackTarget(who))
AttackStart(who);
}
@@ -1618,7 +1618,7 @@ public:
void EnterCombat(Unit* who)
{
if (me->canAttack(who))
if (me->IsValidAttackTarget(who))
AttackStart(who);
}