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:
@@ -1694,14 +1694,6 @@ namespace Game.Entities
|
|||||||
if (!_IsTargetAcceptable(who))
|
if (!_IsTargetAcceptable(who))
|
||||||
return false;
|
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)))
|
if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2232,16 +2224,10 @@ namespace Game.Entities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit targetVictim = target.GetAttackerForHelper();
|
|
||||||
|
|
||||||
// if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
|
// if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
|
||||||
if (IsEngagedBy(target) || IsHostileTo(target))
|
if (IsEngagedBy(target) || IsHostileTo(target))
|
||||||
return true;
|
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
|
// if the target's victim is not friendly, or the target is friendly, the target is not acceptable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user