Core/Spells: Fix periodic rolling adding bonuses twice

Port From (https://github.com/TrinityCore/TrinityCore/commit/9fa95b4b57c1d843392d0c321cdabbc3a21e1d69)
This commit is contained in:
hondacrx
2021-09-08 22:52:23 -04:00
parent d3530ddf1c
commit f9779537a8
9 changed files with 16 additions and 34 deletions
+12
View File
@@ -58,6 +58,7 @@ namespace Game.Spells
targetList.Add(app.GetTarget());
}
}
void GetApplicationList(out List<AuraApplication> applicationList)
{
applicationList = new List<AuraApplication>();
@@ -120,6 +121,17 @@ namespace Game.Spells
break;
}
if (GetSpellInfo().HasAttribute(SpellAttr10.RollingPeriodic))
{
var periodicAuras = GetBase().GetUnitOwner().GetAuraEffectsByType(GetAuraType());
amount = periodicAuras.Aggregate(0, (val, aurEff) =>
{
if (aurEff.GetCasterGUID() == GetCasterGUID() && aurEff.GetId() == GetId() && aurEff.GetEffIndex() == GetEffIndex() && aurEff.GetTotalTicks() > 0)
val += aurEff.GetAmount() * (int)aurEff.GetRemainingTicks() / (int)aurEff.GetTotalTicks();
return val;
});
}
GetBase().CallScriptEffectCalcAmountHandlers(this, ref amount, ref m_canBeRecalculated);
if (!GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.NoScaleWithStack))
amount *= GetBase().GetStackAmount();