Skip to content
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

fix: ensure that we never have negative values for soul fragment counts #1034

Merged
merged 2 commits into from
Sep 29, 2021

Conversation

johnnylam88
Copy link
Contributor

No description provided.

Use `math.max` and `math.min` to express limits instead of inlining
computations and add a check to enforce that `pending` can never be
negative.

Refactor the code slightly to extract a function to update
`this.current.count` to be called whenever `count` or `pending` has
changed, instead of duplicating the same code three times, and
enforce limits appropriately in the new function.
Spend Soul Fragments first and then gain Soul Fragments afterwards
in case we have a spell that spends the fragments but refunds some
portion of them once they are spent.
@Sidoine Sidoine merged commit 3afeb18 into Sidoine:master Sep 29, 2021
@johnnylam88 johnnylam88 deleted the fix/soul-fragments branch September 29, 2021 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants