diff options
| author | Gildor <gildor55@gmail.com> | 2020-04-12 15:28:01 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-01-01 15:05:01 +0100 |
| commit | 60e66621dae44cb832ebb0bdb5e168f9ab114ecb (patch) | |
| tree | cb6b64c580921ffca2af15e24e949415854542eb /src/server/game/Spells/Spell.cpp | |
| parent | 2aa5f4e1b2f1bc0cd956127fc53cac680c9aaf67 (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>
(cherry picked from commit 862097a63351e957fd4aa6cb82fe7d9edf4d3926)
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 eec48f5e6df..b79dd8a49a8 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5402,7 +5402,9 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32 { // 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()); |
