diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8771dc196..939269574 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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 // 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) { // 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()) 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(); // 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()) 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(); - if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect() && !splitSpellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT)) - if (!caster->IsWithinLOSInMap(victim) || !caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster))) + if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect()) + if (!caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster))) continue; uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount());