Core/Creature: Get rid of a few Creature::getAttackerForHelper misuses. That's not what the function does, folks.

Port From (https://github.com/TrinityCore/TrinityCore/commit/26ca7b0fc2907f861d2cdbf1e8699b364518501b)
This commit is contained in:
hondacrx
2021-11-03 11:49:08 -04:00
parent 3a49852fa7
commit f4c1e8cbbe
-14
View File
@@ -1694,14 +1694,6 @@ namespace Game.Entities
if (!_IsTargetAcceptable(who))
return false;
if (who.IsEngaged() && IsWithinDist(who, SharedConst.AttackDistance))
{
Unit victim = who.GetAttackerForHelper();
if (victim != null)
if (IsWithinDistInMap(victim, WorldConfig.GetFloatValue(WorldCfg.CreatureFamilyAssistanceRadius)))
force = true;
}
if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
return false;
}
@@ -2232,16 +2224,10 @@ namespace Game.Entities
return false;
}
Unit 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 != null && IsFriendlyTo(targetVictim))
return true;
// if the target's victim is not friendly, or the target is friendly, the target is not acceptable
return false;
}