Prevent magic add during spellcast from consuming all magic#2589
Open
djevangelia wants to merge 2 commits into
Open
Prevent magic add during spellcast from consuming all magic#2589djevangelia wants to merge 2 commits into
djevangelia wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When adding magic, check current magic state and adjust both magic and magicTarget if needed. Fixes #2106.
See issue for further information. This checks for current magic state (or previous, if current is fill) and if applicable state - just instantly add the requested add amount to both magic and magicTarget, adjusting if necessary if result > capacity.
When consuming, it will also check if current magic - 2 = target, which is only possible if current magic was equal to target when starting the consume. Then, it will re-add those two points. This is a bit ugly and I can't remember if there was a specific reason why I checked this after the consume.
Testing
Tested in Ares recent nightly build. Tested together with previous fix for magic getting locked if frozen during spellcast.
Looks like this: https://www.youtube.com/watch?v=HbBx_z9MJ_I
Testing using button binds because I couldn't recreate the original bug report (magic jar picked up during cast). Also tested drinking potion and Great Fairy refill.