From 3545285ad7f95cb96500760b084fe40c36a26e04 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 9 Apr 2024 12:23:07 +0200 Subject: Core/Auras: Fixed SPELL_ATTR10_ROLLING_PERIODIC for auras that have 0 base amount and only scale from spell/attack power --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 9dc69616fe6..8b729b29e8a 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -707,12 +707,15 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetSpellInfo()->HasAttribute(SPELL_ATTR10_ROLLING_PERIODIC)) { Unit::AuraEffectList const& periodicAuras = GetBase()->GetUnitOwner()->GetAuraEffectsByType(GetAuraType()); - amount = std::accumulate(std::begin(periodicAuras), std::end(periodicAuras), amount, [this](int32 val, AuraEffect const* aurEff) + if (uint32 totalTicks = GetTotalTicks()) { - if (aurEff->GetCasterGUID() == GetCasterGUID() && aurEff->GetId() == GetId() && aurEff->GetEffIndex() == GetEffIndex() && aurEff->GetTotalTicks() > 0) - val += aurEff->GetAmount() * static_cast(aurEff->GetRemainingTicks()) / static_cast(aurEff->GetTotalTicks()); - return val; - }); + amount = std::reduce(std::begin(periodicAuras), std::end(periodicAuras), amount, [&](int32 val, AuraEffect const* aurEff) + { + if (aurEff->GetCasterGUID() == GetCasterGUID() && aurEff->GetId() == GetId() && aurEff->GetEffIndex() == GetEffIndex()) + val += aurEff->GetEstimatedAmount().value_or(aurEff->GetAmount()) * static_cast(aurEff->GetRemainingTicks()) / static_cast(totalTicks); + return val; + }); + } } GetBase()->CallScriptEffectCalcAmountHandlers(this, amount, m_canBeRecalculated); -- cgit v1.2.3