diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index d4a629728ac..0fd480c0bba 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -5966,7 +5966,7 @@ SpellCastResult Spell::CheckCast(bool strict) { if (!pet->IsAlive()) return SPELL_FAILED_TARGETS_DEAD; - if (!IsIgnoreLosSpellEffect(m_spellInfo, SpellEffectIndex(i)) && !m_caster->IsWithinLOSInMap(pet, true)) + if (!IsIgnoreLosSpellEffect(m_spellInfo, SpellEffectIndex(i), false) && !m_caster->IsWithinLOSInMap(pet, true)) return SPELL_FAILED_LINE_OF_SIGHT; } break; @@ -8365,10 +8365,7 @@ bool Spell::CheckTarget(Unit* target, SpellEffectIndex eff, bool targetB, CheckE // all ok by some way or another, skip normal check break; default: // normal case - bool forceLos = false; - if (target != m_trueCaster && target != m_targets.getUnitTarget()) - forceLos = m_spellInfo->HasAttribute(SPELL_ATTR_EX5_ALWAYS_AOE_LINE_OF_SIGHT); - if (exception != EXCEPTION_MAGNET && (forceLos || !IsIgnoreLosSpellEffect(m_spellInfo, eff))) + if (exception != EXCEPTION_MAGNET && !IsIgnoreLosSpellEffect(m_spellInfo, eff, targetB)) { float x, y, z; switch (info.los) diff --git a/src/game/Spells/SpellMgr.h b/src/game/Spells/SpellMgr.h index f6a40c33158..593766f7cfe 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -1833,7 +1833,12 @@ inline bool IsIgnoreLosSpell(SpellEntry const* spellInfo) return spellInfo->HasAttribute(SPELL_ATTR_EX2_IGNORE_LINE_OF_SIGHT); } -inline bool IsIgnoreLosSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex effIdx) +inline bool IsIgnoreLosSpellCast(SpellEntry const* spellInfo) +{ + return spellInfo->rangeIndex == 13 || IsIgnoreLosSpell(spellInfo); +} + +inline bool IsIgnoreLosSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex effIdx, bool targetB) { if (spellInfo->HasAttribute(SPELL_ATTR_EX5_ALWAYS_LINE_OF_SIGHT)) return false; @@ -1845,17 +1850,15 @@ inline bool IsIgnoreLosSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex case TARGET_UNIT_FRIEND_AND_PARTY: case TARGET_UNIT_RAID_AND_CLASS: case TARGET_ENUM_UNITS_PARTY_WITHIN_CASTER_RANGE: return true; - default: break; + default: + if (IsCheckCastTarget(targetB ? spellInfo->EffectImplicitTargetB[effIdx] : spellInfo->EffectImplicitTargetA[effIdx])) + return IsIgnoreLosSpellCast(spellInfo); + break; } return spellInfo->EffectRadiusIndex[effIdx] == 28 || IsIgnoreLosSpell(spellInfo); } -inline bool IsIgnoreLosSpellCast(SpellEntry const* spellInfo) -{ - return spellInfo->rangeIndex == 13 || IsIgnoreLosSpell(spellInfo); -} - // applied when item is received/looted/equipped inline bool IsItemAura(SpellEntry const* spellInfo) {