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

Add ability to count character flags, move all trait flag checks over to character flag #55061

Merged
merged 3 commits into from
Feb 4, 2022

Conversation

Venera3
Copy link
Member

@Venera3 Venera3 commented Feb 3, 2022

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 broken WALL_CLING arachnid legs.

Describe the solution

  • Changed Character::has_flag to return the number of the flags the character has
  • Changed trait/bionic/limb flag checks to return the count of flags their respective struct contributes (left has_effect_flag intact since it has the scary kind of brackets)
  • Replaced almost all instances of has_trait_flag with has_flag, meaning now anything utilizing character flag can use those functions - supersoldier serums giving your temporary PRED4 combat skill learning rate, anyone?
  • Changed the dialog condition has_trait_flag to has_flag, checking all character flags and moved existing usages over
  • TODO: document all the hardcoded trait flags that are now checked as character flags

Describe 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.

@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Feb 3, 2022
What insect arms?
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Feb 3, 2022
@Ramza13
Copy link
Contributor

Ramza13 commented Feb 3, 2022

So this looks nice. If you want to allow dialog conditions/effects to use the count you can look into adding them into the arithmatic/compare_int code, if not I may get around to doing it myself after this merges.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 3, 2022
@Maleclypse Maleclypse added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON [Markdown] Markdown issues and PRs labels Feb 3, 2022
@kevingranade kevingranade merged commit 2c41bdf into CleverRaven:master Feb 4, 2022
Brambor added a commit to Brambor/Cataclysm-DDA that referenced this pull request Apr 5, 2023
- introduced in
commit: 2c41bdf
PR: Add ability to count character flags, move all trait flag checks over to character flag (CleverRaven#55061)
dseguin pushed a commit that referenced this pull request Apr 5, 2023
- introduced in
commit: 2c41bdf
PR: Add ability to count character flags, move all trait flag checks over to character flag (#55061)
Maleclypse pushed a commit to Maleclypse/Cataclysm-DDA that referenced this pull request Apr 6, 2023
- introduced in
commit: 2c41bdf
PR: Add ability to count character flags, move all trait flag checks over to character flag (CleverRaven#55061)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants