mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-14 22:19:25 +01:00
Core/Entities: Replace Unit::canAttack usage with more accurate Unit::IsValidAttackTarget
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user