diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-04-09 12:23:07 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2024-04-09 12:23:07 +0200 |
commit | 3545285ad7f95cb96500760b084fe40c36a26e04 (patch) | |
tree | 1319a6aa049b0e480f8bb4cc1e05f3690b9bef11 | |
parent | 9089dd5c1a937f0ffa4f8ad4bfcaee254e3f4d57 (diff) |
Core/Auras: Fixed SPELL_ATTR10_ROLLING_PERIODIC for auras that have 0 base amount and only scale from spell/attack power
-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 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<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); |