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

Cleanup and flesh out book morale interactions a bit #2910

Merged
merged 10 commits into from
Oct 1, 2023

Conversation

chaosvolt
Copy link
Member

@chaosvolt chaosvolt commented May 29, 2023

Summary

SUMMARY: Balance "Streamline book morale checks slightly, fix multiplier on spiritual books, add support for psychopaths liking morbid books"

Purpose of change

I'd been meaning to clean up some behavior with how Spiritual and Cannibal handle book morale for a while. Actually I wanted to just outright make it so that what traits or trait flags affected this was outright JSONized, but I was having trouble getting that to work so ech.

Now thanks to #2911 we can actually afford to make more use of has_trait_flag.

Describe the solution

C++ changes:

  1. Defined new function in character_functions.cpp, is_book_morale_boosted for the sake of unifying and streamlining the if/else logic buried in is_fun_to_read and get_book_fun_for. It takes the previous if/else stack and checks for trait and item flags for all of the relevant checks, allowing for more mod support and variety. It also makes it so the cannibal check asks for BOOK_CANNIBAL instead of exactly just To Serve Man, for support of any other books we want to have use that. Also adds a separate if statement that supports "morbid but not for cannibal reasons" books.
  2. Defined function in character_functions.h as well.
  3. Changed is_fun_to_read to check is_book_morale_boosted instead of using its own big if/else chain.
  4. Changed get_book_fun_for to call is_book_morale_boosted for determining whether to invert negative morale into positive morale, and split off the bonus morale for Spiritual into a separate check. This also turns it from a 3x multiplier to a +2 bonus. Idea here is this retains the same result of converting vanilla holy books from +1 to +3 morale, without doing wacky shit like making Oaths to The Chalice in Arcana go from -3 to +9.

JSON changes:

  1. Added the relevant item flags to flags.json.
  2. Added BOOK_CANNIBAL flag to To Serve Man.
  3. Changed priest's diary to extend the MORBID flag to it, so that psychopath characters enjoy the authors' descent into insanity while spiritual characters actually read more into it.
  4. Additionally added -1 morale and the MORBID flag to Visions in Solitude (the prisoner diary also seen in the cult quest line the priest's diary is a part of) and patient treatment records. This also fixes them both having innately positive morale due to inheriting from books that have that.
  5. Added SPIRITUAL flag to Spiritual trait.
  6. Added MORBID flag to the two mi-go books in Aftershock, and to the necromancy book in Magiclysm.

Documentation changes:

  1. Documented the new book flags.
  2. Updated the current effects of the CANNIBAL, PSYCHOPATH, and SAPIOVORE trait flags along with the SPIRITUAL trait.

Describe alternatives you've considered

  1. As mentioned, my preferred goal longer-term would be JSONizing this entirely, but this at least gets the behavior a bit less wonky and enables a few extra applications in mods.
  2. Some of the lab recipe books could be given the MORBID flag if desired since they tend to deal in hilariously-unethical !!SCIENCE!! that a psychopath character might get a kick out of, but that might be a bit potent a bonus.
  3. Making it so that Psychopath simply sets base book morale for morbid books to zero instead of inverting it.

Testing

  1. Checked affected JSON files for syntax and lint errors.
  2. Compiled and load-tested.
  3. Checked that a random holy book has +1 morale normally and +3 when you have Spiritual.
  4. Checked that the priest's diary has -1 morale now, goes up to +1 if you have Psychopath, and goes up to +3 if you add Spiritual.
  5. Checked affected C++ file for astyle.

Additional context

@github-actions github-actions bot added JSON related to game datas in JSON format. src changes related to source code. labels May 29, 2023
@github-actions github-actions bot added the mods PR changes related to mods. label May 30, 2023
@chaosvolt chaosvolt marked this pull request as draft June 18, 2023 20:17
@chaosvolt
Copy link
Member Author

Converting to draft since I'm a bit stuck on the precursor PR.

@chaosvolt
Copy link
Member Author

Good news is the precursor PR has been sorted out, but I may or may not end up having to close and remake this PR depending on how merge conflicts go once it's merged.

@chaosvolt chaosvolt marked this pull request as ready for review September 26, 2023 05:51
@chaosvolt
Copy link
Member Author

And we should now be in business.

@scarf005 scarf005 self-requested a review September 26, 2023 06:14
@scarf005 scarf005 self-assigned this Sep 26, 2023
@chaosvolt
Copy link
Member Author

  1. Compiled and load-tested.
  2. Temporarily added in the branch of Arcana from Pending BN Update: more options for affecting book morale chaosvolt/cdda-arcana-mod#346
  3. Started off as a Blood Mage, checked that book morale for Sanguine Codex showed as positive.
  4. Debugged away Sanguinist profession trait, book goes back to being unfun to read.
    image

@chaosvolt
Copy link
Member Author

Also U H
image

Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test cases

normal

normal

cannibal

cannibal

spiritual

spiritual

spiritual cannibal

spiritual-cannibal

psychopath

psycho

spiritual psychopath

spiritual-psychopath

LGTM

@chaosvolt
Copy link
Member Author

chaosvolt commented Sep 27, 2023

I see a small problem there: priest's diary isn't inverting its morale on the psychopath character, something wrong with the logic of the book having both inspiration and morbid?

EDIT: I'm not able to reproduce that so it was likely just an incorrect image from a test without Psychopath:
image

@scarf005 scarf005 added this pull request to the merge queue Oct 1, 2023
Merged via the queue into cataclysmbnteam:upload with commit c25952c Oct 1, 2023
8 of 14 checks passed
@chaosvolt chaosvolt deleted the book-morale-goes-nyoom branch October 1, 2023 01:18
olanti-p pushed a commit to olanti-p/Cataclysm-BN that referenced this pull request Oct 6, 2023
…#2910)

* Cleanup and flesh out book morale interactions a bit

* Update character_functions.h

* Also mods

* Update character_functions.cpp

* Update json_flags.md

* style(autofix.ci): automated formatting

* Update flags_mutation.json

* Update character_functions.cpp

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON related to game datas in JSON format. mods PR changes related to mods. src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants