From 74645553be9213e366a62c6967db1d9933f3d7a7 Mon Sep 17 00:00:00 2001 From: Meji Date: Sun, 8 Aug 2021 13:22:04 +0200 Subject: Core/Objects: Units possessing another ones must use the detection of the latter (#26702) * Core/Objects: Units with invisibility auras can see units that cannot detect them * Core/Objects: A unit that possess another one, uses the detection of the latter * GCC: Avoid ambiguous 'else' Closes #23528 (cherry picked from commit ad4bc7cc1f3d3f541219e9077238743c73130108) --- src/server/game/Entities/Object/Object.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/server') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 191b88464d8..d9993e84a94 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1548,10 +1548,18 @@ bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth, bool che { WorldObject const* 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 if (Unit const* thisUnit = ToUnit()) - if (Unit* controller = thisUnit->GetCharmerOrOwner()) + { + if (thisUnit->isPossessing()) + { + if (Unit* charmed = thisUnit->GetCharmed()) + seer = charmed; + } + else if (Unit* controller = thisUnit->GetCharmerOrOwner()) seer = controller; + } if (obj->IsAlwaysDetectableFor(seer)) return true; -- cgit v1.2.3