Touchups to spellcasting behavior and UI #2598
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.
Summary
SUMMARY: Bugfixes "Spellcasting menu cancels out early if all spells out of energy, don't show max mana unless you actually know a mana-casting spell"
Purpose of change
This fixes two bits of weirdness with spellcasting and associated UI.
Describe the solution
cast_spell
so that the "check if you're too out of energy to cast any spells" check to properly return out of the function instead of continuing, fixing the issue where it would say "you can't cast any of the spells you know" but still open to a menu of currently-uncastable spells.spell_panel
to check the player's known spells for any mana-casting spells to determine if it returns true. This fixes it so that mana and max mana only shows on your sidebar if one of your spells actually costs mana.Describe alternatives you've considered
I'm not 100% sure if vector-ifying avatar's known spells and running some
for
logic on them will have any performance impact over the previous "check a bool on the avatar that will in turn check their known spells" method.Testing
Additional context