Skip to content

feat: add MUTATE_THRESH spell flag for mutation spells#8554

Merged
chaosvolt merged 8 commits intocataclysmbn:mainfrom
chaosvolt:He-From-Beyond-The-Veil-says-mutagen-is-cringe
Apr 18, 2026
Merged

feat: add MUTATE_THRESH spell flag for mutation spells#8554
chaosvolt merged 8 commits intocataclysmbn:mainfrom
chaosvolt:He-From-Beyond-The-Veil-says-mutagen-is-cringe

Conversation

@chaosvolt
Copy link
Copy Markdown
Member

@chaosvolt chaosvolt commented Apr 17, 2026

Purpose of change (The Why)

A sort of side project to #8510 so that mods will have a way to mutate without worrying about point balance if they need it.

Describe the solution (The How)

C++ changes:

  1. In magic.cpp and magic.h, added definition for MUTATE_THRESH spell flag.
  2. In magic_spell_effect.cpp, set spell_effect::mutate so that, if it's mutating you in a specific category (i.e. effect is specified and MUTATE_TRAIT is absent), it will test for crossing that category's threshold after it mutates you. This allows for mutation-granting spells to replicate the effects of serums as well regular mutagen. In addition per feedback, it pings threshold tier based on spell accuracy, defaulting to tier-1 since most thresholds have only 1 tier.

Documentation changes:

  1. Documented new spell flag in magic.md

Describe alternatives you've considered

Hacking in support for currently-unimplemented threshold tiers? For now it uses the default tier, dunno how we'd handle that at present. Presumably something like how damage is used for chance of mutation, glom onto some existing spell property when the spell effect is mutation?

Testing

  1. Compiled and load-tested.
  2. Started a world with Arcana using the changes in my draft PR implementing them.
  3. Spammed restored ritual blade, I can cross the threshold.
  4. Restarted and chugged a fuckton of blood effigy, no threshold as expected.
  5. Gave myself a sacramental heart after maxing out pre-thresh Dragonblood mutations, aside from a bug we discovered that triggers when savescumming it works fine to grant the thresh.

Additional context

image

Checklist

Mandatory

@github-actions github-actions Bot added docs PRs releated to docs page src changes related to source code. labels Apr 17, 2026
@autofix-ci
Copy link
Copy Markdown
Contributor

autofix-ci Bot commented Apr 17, 2026

Autofix has formatted code style violation in this PR.

I edit commits locally (e.g: git, github desktop) and want to keep autofix
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

@AzmodiusX
Copy link
Copy Markdown
Collaborator

Remember that we'll also need a field / flag / bool / ;_; that lets a mutation be ignored by the point system entirely. Otherwise, your special mutations will just get removed when a Shaggoth dunks you in nuclear waste off the top rope.

@AzmodiusX
Copy link
Copy Markdown
Collaborator

That's gonna require work on my PR, though (I assume)

@chaosvolt
Copy link
Copy Markdown
Member Author

Ah, fair. For a starting point on that, does it properly ignore profession mutations? If so then there should be points in the functions that check whether a trait is a profession trait both when trying to figure out your total point value and when deciding whether it wants to modify a mutation at all. Those would be the points where you're want to inject a specific trait flag.

@chaosvolt
Copy link
Copy Markdown
Member Author

chaosvolt commented Apr 17, 2026

To help with this I also aim to make spell-granting traits in Arcana zero points (though I've yet to decide how I'll handle magic signs since those can be bought in chargen) so they should be entirely unaffected by this, I assume it never touches zero-point mutations, right?

@AzmodiusX
Copy link
Copy Markdown
Collaborator

0 point mutations can be added or removed, it would be a problem if they weren't, no?
I don't think that will solve the issue. Also another way we'd be sidestepping the issue with somewhat undefined features.
We should make this explicit.

@chaosvolt
Copy link
Copy Markdown
Member Author

Ah, damn. That axes one potential workaround, yeah. I guess we'll need a specific mutation flag for it then. Like I said, start with checking how it treats profession mutations, those already need to be excluded from this system entirely (chugging mutagen should not remove your MD trait, even if mutagenic experiments would probably get your medical license revoked XP) so if you make sure those are made untouchable those create natural points where we can inject flag checks too.

@AzmodiusX
Copy link
Copy Markdown
Collaborator

Oh, profession mutations have a field? Yeah, I should make sure that's accounted for too.
I should do a pass over every possible field.

@chaosvolt
Copy link
Copy Markdown
Member Author

Oh, profession mutations have a field? Yeah, I should make sure that's accounted for too. I should do a pass over every possible field.

Yeah, profession mutations have "profession": true to mark them as not being a standard mutation but something specific to that character's background.

chaosvolt and others added 2 commits April 17, 2026 22:41
Co-Authored-By: RobbieNeko <30732426+RobbieNeko@users.noreply.github.com>
@chaosvolt chaosvolt marked this pull request as ready for review April 18, 2026 04:57
Copy link
Copy Markdown
Collaborator

@RobbieNeko RobbieNeko left a comment

Choose a reason for hiding this comment

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

Looks good to me, I personally would have chosen pierce over accuracy for the tier deciding but that's minor.

@chaosvolt chaosvolt merged commit 83ce6cb into cataclysmbn:main Apr 18, 2026
17 of 18 checks passed
@chaosvolt chaosvolt deleted the He-From-Beyond-The-Veil-says-mutagen-is-cringe branch April 18, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs PRs releated to docs page src changes related to source code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants