[Bug Fix] ModernAAScalingEnabled() Calculation Error #4469
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an issue where the AA experience scaling only considered unspent AAs, leading to incorrect scaling. The old implementation based the scaling on unspent AAs, meaning if a player had 2000 spent AAs and 1 unspent AA, the scaling would incorrectly be based only on the 1 unspent AA instead of the total of 2001 AAs.
Here’s a log output of the issue before the fix, from the custom code inside the ModernAAScalingEnabled function:
The custom logic looks like this:
After the fix, the experience calculation properly considers the total number of AAs (spent + unspent). The updated log is as follows:
This log reflects the intended behavior, where AA scaling is based on the total number of AAs.
Motivation
The bugfix ensures the correct scaling of AA experience by taking into account both spent and unspent AAs. Without this change, the AA experience calculation would disproportionately favor players with very few unspent AAs.
Type of change
Bug fix (non-breaking change that resolves an incorrect behavior)
Related Issues
Fixes # (issue link, if available)
Testing
Please include any test information and evidence, including logs or screenshots that validate the correct behavior after this fix.
Clients tested:
Describe client environments or versions tested.
Logs:
Please attach or describe any relevant logs that verify the correct functionality of the fix.
Checklist
I have tested my changes.
I have performed a self-review of my code, ensuring variable and function names are clear and comments are used appropriately.
I have updated relevant documentation (if applicable).
I accept full responsibility for the impact of my changes.
If applicable, I have tested the database changes locally and updated version.h to reflect the new CURRENT_BINARY_DATABASE_VERSION.