Core/Auras: Fixed accessing invalid iterators in Unit::CalcHealAbsorb
Port From (https://github.com/TrinityCore/TrinityCore/commit/63b2188e75704ef4220d1e169d07179d07e898c7)
This commit is contained in:
@@ -3738,11 +3738,7 @@ namespace Game.Entities
|
|||||||
if (healInfo.GetHeal() == 0)
|
if (healInfo.GetHeal() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Need remove expired auras after
|
var vHealAbsorb = new List<AuraEffect>(healInfo.GetTarget().GetAuraEffectsByType(AuraType.SchoolHealAbsorb));
|
||||||
bool existExpired = false;
|
|
||||||
|
|
||||||
// absorb without mana cost
|
|
||||||
var vHealAbsorb = healInfo.GetTarget().GetAuraEffectsByType(AuraType.SchoolHealAbsorb);
|
|
||||||
for (var i = 0; i < vHealAbsorb.Count && healInfo.GetHeal() > 0; ++i)
|
for (var i = 0; i < vHealAbsorb.Count && healInfo.GetHeal() > 0; ++i)
|
||||||
{
|
{
|
||||||
AuraEffect absorbAurEff = vHealAbsorb[i];
|
AuraEffect absorbAurEff = vHealAbsorb[i];
|
||||||
@@ -3784,7 +3780,7 @@ namespace Game.Entities
|
|||||||
absorbAurEff.ChangeAmount(absorbAurEff.GetAmount() - currentAbsorb);
|
absorbAurEff.ChangeAmount(absorbAurEff.GetAmount() - currentAbsorb);
|
||||||
// Aura cannot absorb anything more - remove it
|
// Aura cannot absorb anything more - remove it
|
||||||
if (absorbAurEff.GetAmount() <= 0)
|
if (absorbAurEff.GetAmount() <= 0)
|
||||||
existExpired = true;
|
absorbAurEff.GetBase().Remove(AuraRemoveMode.EnemySpell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3801,23 +3797,6 @@ namespace Game.Entities
|
|||||||
healInfo.GetTarget().SendMessageToSet(absorbLog, true);
|
healInfo.GetTarget().SendMessageToSet(absorbLog, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all expired absorb auras
|
|
||||||
if (existExpired)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < vHealAbsorb.Count;)
|
|
||||||
{
|
|
||||||
AuraEffect auraEff = vHealAbsorb[i];
|
|
||||||
++i;
|
|
||||||
if (auraEff.GetAmount() <= 0)
|
|
||||||
{
|
|
||||||
uint removedAuras = healInfo.GetTarget().m_removedAurasCount;
|
|
||||||
auraEff.GetBase().Remove(AuraRemoveMode.EnemySpell);
|
|
||||||
if (removedAuras + 1 < healInfo.GetTarget().m_removedAurasCount)
|
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static uint CalcArmorReducedDamage(Unit attacker, Unit victim, uint damage, SpellInfo spellInfo, WeaponAttackType attackType = WeaponAttackType.Max, uint attackerLevel = 0)
|
public static uint CalcArmorReducedDamage(Unit attacker, Unit victim, uint damage, SpellInfo spellInfo, WeaponAttackType attackType = WeaponAttackType.Max, uint attackerLevel = 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user