Add ability to count character flags, move all trait flag checks over to character flag #55061
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
Features "Enhance character flag functionality"
Purpose of change
Character flags are a wonderful thing, unifying checks for effect, limb, trait, and bionic flags. However, they are pretty binary - either you have the flag or you don't. With #54749 at least bodyparts can lose their flags on sufficient damage/encumbrance, but that means you could fly down ledges with a single
WINGS_2
wing or climb up a wall with 7/8 brokenWALL_CLING
arachnid legs.Describe the solution
Character::has_flag
to return the number of the flags the character hashas_effect_flag
intact since it has the scary kind of brackets)has_trait_flag
withhas_flag
, meaning now anything utilizing character flag can use those functions - supersoldier serums giving your temporaryPRED4
combat skill learning rate, anyone?has_trait_flag
tohas_flag
, checking all character flags and moved existing usages overDescribe alternatives you've considered
Add a way for dialog conditions to count the flags returned, but I'm happy if I managed not to break anything in the first place.
Include a demonstration use case but arms aren't ready enough for that yet.
Testing
Added
CANNIBAL
to Debug Tail, mutated the PSYCHOPATH trait and triggered the Refugee Center merchant's relevant dialog lines.Changed the wing check to need 2 instances of ´WINGS_2´ and added a single instance to the Debug Tail BP (each wing has it as a conditional flag as well), mutated Debug tail and fell off a roof. Mutated bird wings, fluttered gracefully down, even after breaking a single wing.
Additional context
A lot of stuff is still partly hardcoded (looking at you CANNIBAL/SPIRITUAL/SAPIOVORE), in that some checks check the character flag while the rest checks an explicit trait ID. I might circle back to them sometime, but I have Limb Stuff to hack my way through for now.