From d0c767cfdfab9a8900e2169bb56ac04f969060e7 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 29 May 2022 16:22:01 -0400 Subject: [PATCH] Core/Objects: Units possessing another ones must use the detection of the latter Port From (https://github.com/TrinityCore/TrinityCore/commit/74645553be9213e366a62c6967db1d9933f3d7a7) --- Source/Game/Entities/Object/WorldObject.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index d962b7ff1..1714fb1ad 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -1243,13 +1243,23 @@ namespace Game.Entities { WorldObject seer = this; + // If a unit is possessing another one, it uses the detection of the latter // Pets don't have detection, they use the detection of their masters Unit thisUnit = ToUnit(); if (thisUnit != null) { - Unit controller = thisUnit.GetCharmerOrOwner(); - if (controller != null) - seer = controller; + if (thisUnit.IsPossessing()) + { + Unit charmed = thisUnit.GetCharmed(); + if (charmed != null) + seer = charmed; + } + else + { + Unit controller = thisUnit.GetCharmerOrOwner(); + if (controller != null) + seer = controller; + } } if (obj.IsAlwaysDetectableFor(seer))