Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-07-29 15:40:17 +08:00
129 changed files with 3078 additions and 1132 deletions

View File

@@ -33,12 +33,10 @@
#include "CreatureGroups.h"
#include "DisableMgr.h"
#include "DynamicVisibility.h"
#include "Formulas.h"
#include "GameObjectAI.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "InstanceSaveMgr.h"
#include "Log.h"
#include "MapMgr.h"
#include "MoveSpline.h"
@@ -2343,7 +2341,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 +2356,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 +2423,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());