diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 663fb07464..d2bd69839e 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -5194,7 +5194,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; @@ -7342,10 +7342,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 61939e214d..ac9665a801 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -1760,7 +1760,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; @@ -1772,17 +1777,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) {