From c903b317c9a2b92b5b45a15a44ee6e486530ce6c Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Wed, 31 Jul 2024 11:39:37 +0200 Subject: Core/Spells: prioritize DieSides over Variance when calculation spell values --- src/server/game/Spells/SpellInfo.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/server/game/Spells/SpellInfo.cpp') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index d079113b828..4cc5daf84e9 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -504,26 +504,23 @@ int32 SpellEffectInfo::CalcValue(WorldObject const* caster /*= nullptr*/, int32 if (caster) casterUnit = caster->ToUnit(); - if (Scaling.Variance != 0.0f) + if (DieSides) + { + // roll in a range <1;EffectDieSides> as of patch 3.3.3 + if (DieSides == 1) + value += DieSides; + else + value += (DieSides >= 1) ? irand(1, DieSides) : irand(DieSides, 1); + } + else if (Scaling.Variance != 0.0f) { float delta = fabs(Scaling.Variance * 0.5f); double valueVariance = frand(-delta, delta); value += double(basePoints) * valueVariance; - + if (variance) *variance = valueVariance; } - else - { - if (DieSides) - { - // roll in a range <1;EffectDieSides> as of patch 3.3.3 - if (DieSides == 1) - value += DieSides; - else - value += (DieSides >= 1) ? irand(1, DieSides) : irand(DieSides, 1); - } - } // base amount modification based on spell lvl vs caster lvl if (Scaling.Coefficient != 0.0f) -- cgit v1.2.3