From e942d80fa591f5306404a36ee05645fbb776b396 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 22 Aug 2020 14:39:39 -0400 Subject: [PATCH] Fix an oversight causing the main tank flag in SelectTarget to be inverted. Port From (https://github.com/TrinityCore/TrinityCore/commit/1e6480ee358977cdb6596a0dba8b2a1c4ef04a0b) --- Source/Game/AI/CoreAI/UnitAI.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Game/AI/CoreAI/UnitAI.cs b/Source/Game/AI/CoreAI/UnitAI.cs index 014b43fe6..10f636181 100644 --- a/Source/Game/AI/CoreAI/UnitAI.cs +++ b/Source/Game/AI/CoreAI/UnitAI.cs @@ -609,14 +609,14 @@ namespace Game.AI /// the reference unit /// if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit /// self explaining - /// allow current tank to be selected + /// allow current tank to be selected /// if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura - public DefaultTargetSelector(Unit unit, float dist, bool playerOnly, bool withMainTank, int aura) + public DefaultTargetSelector(Unit unit, float dist, bool playerOnly, bool withTank, int aura) { me = unit; m_dist = dist; m_playerOnly = playerOnly; - except = withMainTank ? me.GetThreatManager().GetCurrentVictim() : null; + except = !withTank ? me.GetThreatManager().GetCurrentVictim() : null; m_aura = aura; } @@ -628,7 +628,7 @@ namespace Game.AI if (target == null) return false; - if (target == except) + if (except != null && target == except) return false; if (m_playerOnly && !target.IsTypeId(TypeId.Player))