Required weapon categories for buffs & techniques #52788
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
None
Purpose of change
Fixes #52783. Very simple addition.
For martial arts, add the ability to specify one or more weapon categories required to perform a technique or benefit from a buff.
Describe the solution
Weapon category requirements can be defined using
"weapon_categories_allowed"
. This field can accept a single string or an array of strings:Example of defining weapon category requirements for a buff:
As displayed on the info screen:
![buff_cat](https://user-images.githubusercontent.com/12537966/141603776-763d7b62-ae74-4c2a-b54b-7198882d8b1f.png)
In this case, the player would only benefit from the buff when wielding either a polearm or baton. (This is not accurate to this specific martial art, it's just used as an example)
Describe alternatives you've considered
I think originally this was meant to address unarmed type weapons being uncategorized. For this, we would probably need to treat weapons with "UNARMED_WEAPON" as a special case.
Testing
Load game with defined weapon category restrictions for techniques and buffs.
Also added a unit test to check that
ma_technique::is_valid_character()
andma_buff::is_valid_character()
properly evaluate the weapon categories.Additional context
Updated to use the new translated weapon category ids from #52639.