Core/Gameobjects: Improve stealth detection

Port From (https://github.com/TrinityCore/TrinityCore/commit/60e66621dae44cb832ebb0bdb5e168f9ab114ecb)
This commit is contained in:
hondacrx
2022-02-18 12:51:16 -05:00
parent 743d0158d6
commit a604bbd7f9
4 changed files with 22 additions and 15 deletions
+3 -1
View File
@@ -4639,7 +4639,9 @@ namespace Game.Spells
{
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
WorldObject caster = m_caster;
if (m_originalCaster != null)
// 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 != null && !caster.IsGameObject())
caster = m_originalCaster;
castResult = m_spellInfo.CheckExplicitTarget(caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget());