-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Dynamic Power and Accuracy in Move Descriptions #5327
base: upcoming
Are you sure you want to change the base?
Added Dynamic Power and Accuracy in Move Descriptions #5327
Conversation
Adds config to show the real base power and accuracy of moves after ability, stat and item modifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calcs are stored in simulatedDamage so instead of recalc'ing everything which will waste a lot of cycles you should fetch the damage from there.
Also the config should be off by default
Oh I understand. This doesn't show the actual damage. It just calcs MoveBasePower, hm.
In battle.h there is a struct called
Then in function The problem with the current implementation is that it will recalc everything each time you open the move description but we already calc it at the beginning of the turn so there is no reason to do everything again |
Should be off by default anyways I think, no official game ever gives you this info |
Yeah, that's the plan |
Refactored the calculation of move power and accuracy to improve efficiency and reduce redundant computations. In the first version, calculations were done directly within battle_controller_player.c every time the move selection menu was opened, using CalcMoveBasePowerAfterModifiers for each move. In this commit, we now calculate the power and accuracy of moves at the start of each turn and store the values in a new structure, MoveUIData. This reduces the computational load during menu interactions, as the precomputed values are retrieved directly rather than recalculated. This approach simplifies the logic and ensures that the power and accuracy values remain consistent throughout the turn. Additionally, the feature allows for flexibility, with calculations being enabled or disabled via config settings.
6148ce5
to
44c9b08
Compare
Refactored the calculation of move power and accuracy to improve efficiency and reduce redundant computations. In the first version, calculations were done directly within battle_controller_player.c every time the move selection menu was opened, using CalcMoveBasePowerAfterModifiers for each move. In this commit, we now calculate the power and accuracy of moves at the start of each turn and store the values in a new structure, MoveUIData. This reduces the computational load during menu interactions, as the precomputed values are retrieved directly rather than recalculated. This approach simplifies the logic and ensures that the power and accuracy values remain consistent throughout the turn. Additionally, the feature allows for flexibility, with calculations being enabled or disabled via config settings.
Changed the settings to off by default
5c83a68
to
35de532
Compare
Realized the for loop on the calls should be in the function and got rid of some remaining scraps of first attempt.
f14147d
to
afed8ee
Compare
Got rid of a bunch of redundant calculations. Added a flag to CalcMoveBasePowerAfterModifiers and GetTotalAccuracy to check if it's being used for UI purposes. Changed the conditions within those for any section referencing battleDef to skip it instead.
afed8ee
to
829b1f9
Compare
Undid changes to CalcMoveBasePowerAfterModifiers and GetTotalAccuracy and fixed logic inside SetMoveUIDataForTurn.
Co-authored-by: Alex <[email protected]>
Co-authored-by: Alex <[email protected]>
Small tweaks to lower line count
Adds a configuration option to display the actual base power and accuracy of moves in battle move descriptions, factoring in ability, stat, and item modifiers. Additionally, it introduces individual configuration options to control which factors (abilities, stats, items, weather, terrain, etc.) affect these values. This extends the existing Move Descriptions feature introduced in PR #4152.
Known Issues
People who collaborated with me in this PR
Code based on Move Descriptions feature from @PCG06 which was based on the implementation from Elite Redux.
Improved and reviewed by @AlexOn1ine.
Discord contact info
flash1lucky