CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.66k stars 4.18k forks source link

Transformed mutations should block gaining the transform target mutation during mutation gain process #71918

Open Maleclypse opened 9 months ago

Maleclypse commented 9 months ago

Describe the bug

If I have a mutation "Body Armor" that all it does it give an activation button that allows me to transform the mutation into an active mutation "Body Armor (Active)" then proceed to down mutagen while I have the active version turned on I can then mutate into "Body Armor", so now I have both traits. This shouldn't be possible. It's currently worked around in any mutations that give enchantment driven effects via conditionals but that's not an ideal solution until all effects are enchantment driven which is a gigantic project that has already claimed multiple attempts.

Attach save file

N/A

Steps to reproduce

Find a mutation that transforms, transform, prepare to mutate, rng into the inactive version, weep.

Expected behavior

I expect that mutate into would check for and account for active versions being the passive version.

Screenshots

No response

Versions and configuration

N/A

Additional context

No response

Standing-Storm commented 9 months ago

An example of the problem occurring in the base game, with the Feline mutation line:

image

Extending claws turns the ID from CLAWS_RETRACT to CLAWS_RETRACT_active. CLAWS_RETRACT_active is not technically part of the Long Fingernails -> Claws -> Retractable Claws chain since it has "valid": false so the system sees that I don't have any of the chain active and gives me Long Fingernails. Long Fingernails is a "types": [ "CLAWS" ] mutation, and you can only have one mutation of each type, so by extending my claws while still mutating I lost them completely and they turned back into fingernails.

worm-girl commented 9 months ago

The most obvious method to me is to give the character a base mutation that stays on always, and then there's a pair of secondary mutations which rely on the active state of the base.

So you'd have CLAWS_RETRACT, which would be a mutation that would come with another mutation called CLAWS_RETRACT_inactive. Activating CLAWS_RETRACT would get rid of CLAWS_RETRACT_inactive and give you CLAWS_RETRACT_active. Activating it again would go the other way.

CLAWS_RETRACT would hold all the prereqs, the mutation type, the conflicts, etc. Since you never lose it unless you purify it off or mutate out of it (in which case, you lose the others), you're not going to get into a situation where your active/inactive state creates any gaps in the system. CLAWS_RETRACTED and CLAWS_EXTENDED don't have any of that data.

It could also be done with just two. CLAWS_RETRACT is on always, _active comes and goes when the former is activated.

edit: I have this working for retractable claws, extending it to the others will take me just a minute