diff options
| author | Gildor <gildor55@gmail.com> | 2020-04-12 15:28:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-12 15:28:01 +0200 |
| commit | 862097a63351e957fd4aa6cb82fe7d9edf4d3926 (patch) | |
| tree | c557ea317bd244ca7ff5f6d688d5a812cf122b41 /src/server/game/Spells/Spell.cpp | |
| parent | c3037c35639a547fca6be02ad1a0a2ed4c1c5fe9 (diff) | |
Core/Gameobjects: Improve stealth detection (#24417)
* Core/Gameobjects: Improve stealth detection
* fix warning: private field 'i_funit' is not used
* Code cleanup
* add comment
Co-authored-by: jackpoz <giacomopoz@gmail.com>
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3e6de8b9baf..ff52652452f 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5186,7 +5186,9 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint { // Check explicit target for m_originalCaster - todo: get rid of such workarounds WorldObject* caster = m_caster; - if (m_originalCaster) + // in case of gameobjects like traps, we need the gameobject itself to check target validity + // otherwise, if originalCaster is far away and cannot detect the target, the trap would not hit the target + if (m_originalCaster && !caster->ToGameObject()) caster = m_originalCaster; SpellCastResult castResult = m_spellInfo->CheckExplicitTarget(caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget()); |
