fix(Core/Unit): Split Damage auras should ignore LOS (#19357)

This commit is contained in:
avarishd
2024-07-27 13:31:22 +03:00
committed by GitHub
parent 138c18dbd3
commit 3c9dc6ed78
+12 -4
View File
@@ -2343,7 +2343,7 @@ void Unit::CalcAbsorbResist(DamageInfo& dmgInfo, bool Splited)
{ {
// We're going to call functions which can modify content of the list during iteration over it's elements // We're going to call functions which can modify content of the list during iteration over it's elements
// Let's copy the list so we can prevent iterator invalidation // Let's copy the list so we can prevent iterator invalidation
AuraEffectList vSplitDamageFlatCopy(victim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_FLAT)); AuraEffectList vSplitDamageFlatCopy(victim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_FLAT)); // Not used by any spell
for (AuraEffectList::iterator itr = vSplitDamageFlatCopy.begin(); (itr != vSplitDamageFlatCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr) for (AuraEffectList::iterator itr = vSplitDamageFlatCopy.begin(); (itr != vSplitDamageFlatCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
{ {
// Check if aura was removed during iteration - we don't need to work on such auras // Check if aura was removed during iteration - we don't need to work on such auras
@@ -2358,6 +2358,13 @@ void Unit::CalcAbsorbResist(DamageInfo& dmgInfo, bool Splited)
if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive()) if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
continue; continue;
// Limit effect range to spell's cast range. (Only for single target auras, AreaAuras don't need it)
// Ignore LOS attribute is only used for the cast portion of the spell
SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect())
if (!caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
continue;
int32 splitDamage = (*itr)->GetAmount(); int32 splitDamage = (*itr)->GetAmount();
// absorb must be smaller than the damage itself // absorb must be smaller than the damage itself
@@ -2418,10 +2425,11 @@ void Unit::CalcAbsorbResist(DamageInfo& dmgInfo, bool Splited)
if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive()) if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
continue; continue;
// Xinef: Single Target splits require LoS // Limit effect range to spell's cast range. (Only for single target auras, AreaAuras don't need it)
// Ignore LOS attribute is only used for the cast portion of the spell
SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo(); SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect() && !splitSpellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT)) if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect())
if (!caster->IsWithinLOSInMap(victim) || !caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster))) if (!caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
continue; continue;
uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount()); uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount());