Core/Auras: Fixed SPELL_ATTR10_ROLLING_PERIODIC for auras that have 0 base amount and only scale from spell/attack power

Port From (https://github.com/TrinityCore/TrinityCore/commit/3545285ad7f95cb96500760b084fe40c36a26e04)
This commit is contained in:
Hondacrx
2024-08-05 14:55:03 -04:00
parent a3089d7572
commit 337ba82a92
+9 -5
View File
@@ -107,12 +107,16 @@ namespace Game.Spells
if (GetSpellInfo().HasAttribute(SpellAttr10.RollingPeriodic))
{
var periodicAuras = GetBase().GetUnitOwner().GetAuraEffectsByType(GetAuraType());
amount = periodicAuras.Aggregate(0, (val, aurEff) =>
uint totalTicks = GetTotalTicks();
if (totalTicks != 0)
{
if (aurEff.GetCasterGUID() == GetCasterGUID() && aurEff.GetId() == GetId() && aurEff.GetEffIndex() == GetEffIndex() && aurEff.GetTotalTicks() > 0)
val += aurEff.GetAmount() * (int)aurEff.GetRemainingTicks() / (int)aurEff.GetTotalTicks();
return val;
});
amount = periodicAuras.Aggregate(amount, (val, aurEff) =>
{
if (aurEff.GetCasterGUID() == GetCasterGUID() && aurEff.GetId() == GetId() && aurEff.GetEffIndex() == GetEffIndex())
val += (int)(aurEff.GetEstimatedAmount().GetValueOrDefault(aurEff.GetAmount()) * (float)aurEff.GetRemainingTicks() / (float)aurEff.GetTotalTicks());
return val;
});
}
}
GetBase().CallScriptEffectCalcAmountHandlers(this, ref amount, ref m_canBeRecalculated);