From 913c5da70fa5a62a2d4cba1faf3472b4dfa5dacb Mon Sep 17 00:00:00 2001 From: carolus21rex <85852042+carolus21rex@users.noreply.github.com> Date: Wed, 11 Sep 2024 17:06:48 -0400 Subject: [PATCH] [Bug Fix] ModernAAScalingEnabled() Calculation Error (#4469) Current version only looks at your unspent AAs, meaning if you have 2000 spent AAs and 1 unspent AA, your scaling will be based on the 1 unspent AA instead of the 2001 total AA. Here's the original log which is custom code found in the ModernAAScalingEnabled function: [Wed Sep 11 14:10:19 2024] [AA] [ScaleAAXPBasedOnCurrentAATotal] AA Experience Calculation: add_aaxp = 660796, Base Bonus = 256.000000, Half-Life = 64.000000, Minimum Bonus = 1.000000, Earned AA = 1, Calculated Bonus = 253.242371 Custom code looks like this: uint64 totalWithExpMod = add_aaxp; if (RuleB(AA, EnableLogrithmicClasslessAABonus)) { float base_bonus = RuleR(AA, InitialLogrithmicClasslessAABonus); float half_life = RuleR(AA, HalfLifeLogrithmicClasslessAABonus); float min_bon = RuleR(AA, MinimumLogrithmicClasslessAABonus); float bonus_expon = earnedAA / half_life; float bonus = base_bonus * std::pow(0.5, bonus_expon); Log(Logs::General, Logs::AA, "AA Experience Calculation: add_aaxp = %d, Base Bonus = %f, Half-Life = %f, Minimum Bonus = %f, Earned AA = %d, Calculated Bonus = %f", add_aaxp, base_bonus, half_life, min_bon, earnedAA, bonus); if (bonus < min_bon) bonus = min_bon; totalWithExpMod = (uint64)(totalWithExpMod * bonus); } After the fix, the log becomes: [Wed Sep 11 14:10:19 2024] [AA] [ScaleAAXPBasedOnCurrentAATotal] AA Experience Calculation: add_aaxp = 660796, Base Bonus = 256.000000, Half-Life = 64.000000, Minimum Bonus = 1.000000, Earned AA = 1, Calculated Bonus = 253.242371 Which is much closer to the expected behavior --- zone/exp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/exp.cpp b/zone/exp.cpp index c40baca14..be6b8af2b 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -527,7 +527,7 @@ void Client::AddEXP(ExpSource exp_source, uint64 in_add_exp, uint8 conlevel, boo // Are we also doing linear AA acceleration? if (RuleB(AA, ModernAAScalingEnabled) && aaexp > 0) { - aaexp = ScaleAAXPBasedOnCurrentAATotal(GetAAPoints(), aaexp); + aaexp = ScaleAAXPBasedOnCurrentAATotal(GetSpentAA() + GetAAPoints(), aaexp); } // Check for AA XP Cap