diff options
author | Meji <alvaromegias_46@hotmail.com> | 2021-08-08 13:22:04 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-03-12 01:17:00 +0100 |
commit | 74645553be9213e366a62c6967db1d9933f3d7a7 (patch) | |
tree | 2fbbffcd79e1dae6a48530f5b7476505a0dad7ba /src | |
parent | b6615a45eb00a3127a11bf97a1fef1a7d81f39c7 (diff) |
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)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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; |