diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-04-09 12:23:07 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-05-28 16:37:56 +0200 |
commit | d34946dc3a6a74a0e75a8726eaed4281ef9a1d1d (patch) | |
tree | 82e74bd372f0071b9d683facf1f22c78bee56b2b /src | |
parent | 2b4a2e82f7e5749ad8074b342c34ef8591ea884a (diff) |
Core/Auras: Fixed SPELL_ATTR10_ROLLING_PERIODIC for auras that have 0 base amount and only scale from spell/attack power
(cherry picked from commit 3545285ad7f95cb96500760b084fe40c36a26e04)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index e77ca02b0db..a31c8c28b15 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -787,12 +787,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<int32>(aurEff->GetRemainingTicks()) / static_cast<int32>(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<float>(aurEff->GetRemainingTicks()) / static_cast<float>(totalTicks); + return val; + }); + } } GetBase()->CallScriptEffectCalcAmountHandlers(this, amount, m_canBeRecalculated); |