From f898fa75cd291d7eb490e7937ee30529dede45aa Mon Sep 17 00:00:00 2001 From: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Date: Wed, 8 Nov 2023 02:44:05 -0500 Subject: [PATCH] fix(Core/Spells): Correct spell scaling formula. (#17649) * Replace old spell scaling with revised version. Co-Authored-By: balakethelock <111737968+balakethelock@users.noreply.github.com> * Remove a single-use variable. * Use funky multiply operator. More similar to original function, if a tad less readable IMO. --------- Co-authored-by: balakethelock <111737968+balakethelock@users.noreply.github.com> --- src/server/game/Spells/SpellInfo.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index baaf3f1af..c310b5e53 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -502,10 +502,13 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const if (canEffectScale) { - GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(_spellInfo->SpellLevel - 1); - GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->GetLevel() - 1); - if (spellScaler && casterScaler) - value *= casterScaler->ratio / spellScaler->ratio; + CreatureTemplate const* cInfo = caster->ToCreature()->GetCreatureTemplate(); + + CreatureBaseStats const* pCBS = sObjectMgr->GetCreatureBaseStats(caster->GetLevel(), caster->getClass()); + float CBSPowerCreature = pCBS->BaseDamage[cInfo->expansion]; + CreatureBaseStats const* spellCBS = sObjectMgr->GetCreatureBaseStats(_spellInfo->SpellLevel, caster->getClass()); + float CBSPowerSpell = spellCBS->BaseDamage[cInfo->expansion]; + value *= CBSPowerCreature / CBSPowerSpell; } } }