Core/Gameobjects: Improve stealth detection

This commit is contained in:
Gildor authored and Ovahlord committed 2022-09-12 09:15:27 +02:00
1 parent eeef100e08
commit eab8e4aefb
4 files changed
+20 -13

No files matched your search

+3 -1
View File
@@ -5727,7 +5727,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());