Core/Creature: redo some logical checks in _IsTargetAcceptable

Port From (https://github.com/TrinityCore/TrinityCore/commit/3d52ba93fc59070ef0a8c3411440ad979399c954)
This commit is contained in:
hondacrx
2019-09-01 10:52:52 -04:00
parent 17107956c3
commit 4f66987965
+6 -1
View File
@@ -2035,9 +2035,14 @@ namespace Game.Entities
Unit targetVictim = target.getAttackerForHelper();
// if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
if (myVictim == target || targetVictim == this || IsHostileTo(target))
if (GetVictim() == target || IsHostileTo(target))
return true;
// a player is targeting me, but I'm not hostile towards it, and not currently attacking it, the target is not acceptable
// (players may set their victim from a distance, and doesn't mean we should attack)
if (target.GetTypeId() == TypeId.Player && targetVictim == this)
return false;
// if the target's victim is friendly, and the target is neutral, the target is acceptable
if (targetVictim != null && IsFriendlyTo(targetVictim))
return true;