mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
Core/Creature: Get rid of a few Creature::getAttackerForHelper misuses. That's not what the function does, folks.
(cherry picked from commit 71c5569d18)
This commit is contained in:
@@ -1978,11 +1978,6 @@ bool Creature::CanStartAttack(Unit const* who, bool force) const
|
||||
if (!_IsTargetAcceptable(who))
|
||||
return false;
|
||||
|
||||
if (who->IsEngaged() && IsWithinDist(who, ATTACK_DISTANCE))
|
||||
if (Unit* victim = who->getAttackerForHelper())
|
||||
if (IsWithinDistInMap(victim, sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)))
|
||||
force = true;
|
||||
|
||||
if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
|
||||
return false;
|
||||
}
|
||||
@@ -2535,16 +2530,10 @@ bool Creature::_IsTargetAcceptable(Unit const* target) const
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit const* targetVictim = target->getAttackerForHelper();
|
||||
|
||||
// if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
|
||||
if (IsEngagedBy(target) || IsHostileTo(target))
|
||||
return true;
|
||||
|
||||
// if the target's victim is friendly, and the target is neutral, the target is acceptable
|
||||
if (targetVictim && IsFriendlyTo(targetVictim))
|
||||
return true;
|
||||
|
||||
// if the target's victim is not friendly, or the target is friendly, the target is not acceptable
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user