Skip to content

Commit

Permalink
Spell: Enforce los ignore due to range index 13 for single target tar…
Browse files Browse the repository at this point in the history
…geting
  • Loading branch information
killerwife committed Nov 18, 2023
1 parent ee8ca27 commit b52cba1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
7 changes: 2 additions & 5 deletions src/game/Spells/Spell.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
17 changes: 10 additions & 7 deletions src/game/Spells/SpellMgr.h
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down

0 comments on commit b52cba1

Please sign in to comment.