Fix independent gain, add current cost #4
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: profectus/Profectus#4
Loading…
Reference in a new issue
No description provided.
Delete branch "main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Independent conversions were subtracting the current resource amount from the expected gain, while the
nextAt
andconvert
functions were designed with a staticcurrentGain
in mind. This discrepancy was causing the displayedcurrentGain
andnextAt
value to "jump" immediately after a reset, and to produce erroneous values (e.g. after resetting for 5 points, attaining the original resource amount would allow you to reset for 4, then after resetting for those 4, which would drop you from 5 points to 4, you could once again reset for 5).Moving the subtraction to a display-only
actualGain
function allows thecurrentGain
function to work as intended, without interfering with the surrounding conversion functionality.Additionally, a
currentAt
function has been added, to allow for displaying current costs or for use in customconvert
functions, if the developer wishes to do so.Oh boy, there do seem to be a myriad of issues with the independent conversions code. It makes it a bit tricky to separate the existing issues from the ones this is fixing. Rather than fixing the others and making you update your code, I'm going to merge this in because it does appear to be working, and go and fix the other issues with independent conversions. If there are any issues with this implementation, I'll fix them myself during that process.
Thanks for the contribution!