aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMeji <alvaromegias_46@hotmail.com>2021-08-08 13:22:04 +0200
committerGitHub <noreply@github.com>2021-08-08 13:22:04 +0200
commitad4bc7cc1f3d3f541219e9077238743c73130108 (patch)
treea7a157c7fd166c607c7b898ebc5a0dd35887285b /src
parentccf1932bc527a4c87028be181396e39fc81088df (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
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Object/Object.cpp10
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 5baee7886d8..616dc8c032e 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1645,10 +1645,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;