Skip to content

Commit

Permalink
feat(balance): mutations can modify power value of mutant toxins, add…
Browse files Browse the repository at this point in the history
…ing a vanilla use for Robust Genetics (#4163)

* feat(balance): mutations can modify power value of mutant toxins, adding a vanilla use for Robust Genetics

* Update json_info.md
  • Loading branch information
chaosvolt authored Mar 2, 2024
1 parent 60385e8 commit 762448d
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 32 deletions.
81 changes: 59 additions & 22 deletions data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,17 @@
"prereqs": [ "FLIMSY2" ],
"hp_modifier": -0.75
},
{
"type": "mutation",
"id": "ROBUST",
"name": { "str": "Robust Genetics" },
"points": 3,
"description": "You have a very strong genetic base. Mutations gained from eating mutant flesh will balance out at a higher number of positive mutations.",
"starting_trait": true,
"cancels": [ "CHAOTIC_BAD" ],
"category": [ "FISH", "SLIME", "ALPHA", "MEDICAL" ],
"mutagen_target_modifier": 8
},
{
"type": "mutation",
"id": "CHAOTIC_BAD",
Expand All @@ -1236,7 +1247,8 @@
"description": "The events of the Cataclysm have damaged your DNA beyond repair. You mutate frequently, and all mutations you receive (from any source) are negative.",
"starting_trait": true,
"cancels": [ "ROBUST" ],
"valid": false
"valid": false,
"mutagen_target_modifier": -50
},
{
"type": "mutation",
Expand Down Expand Up @@ -5640,7 +5652,9 @@
"description": "You sometimes look back on your days before your tail came in. But you're better now.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"//": "Based on highest of category's iv_hunger, iv_thirst, or iv_fatigue. Most default to 10+10+5 so default value of 10",
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5650,7 +5664,8 @@
"description": "You're sure you'll fly someday. In the meantime, there are still nests to build.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5660,7 +5675,8 @@
"description": "Ninety percent of the planet, and it's yours to explore. And colonize. And enjoy. What was that about a surface?",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5670,7 +5686,8 @@
"description": "It's about time you grew out. Now that you've matured, it is time to make something of yourself.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5680,7 +5697,8 @@
"description": "Stalking prey, eating well, and lying in the sun. Mmm, all you could ever desire.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5690,7 +5708,8 @@
"description": "You're the perfect candidate to lead a pack.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5701,7 +5720,8 @@
"cancels": [ "CARNIVORE" ],
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5711,7 +5731,8 @@
"description": "Civilization collapsed? Great! You and your kin will never have to worry about a slaughterhouse again.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5721,7 +5742,8 @@
"description": "It would be good to be a Queen, having workers constantly servicing your every need… but how would you keep them in line?",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5731,7 +5753,8 @@
"description": "Well, you still have those other walking flowers-and the mushrooms too-to deal with. But you'll manage.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5741,7 +5764,8 @@
"description": "What was that old advertisement? 'Paint the planet'? That might be a good long-term goal, but for now…",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5751,7 +5775,8 @@
"description": "Not much point to rebuilding up in that horribly bright roofless wasteland. Now that you've become accustomed to your new digs, there's the beginning of a great empire right here, underground.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5761,7 +5786,8 @@
"description": "Strange aeons, true, but Death seems to be slacking, and you are doing just fine.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5771,7 +5797,8 @@
"description": "Well, maybe you'll just have to make your own worldwide web.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5781,7 +5808,8 @@
"description": "Hey. Civilization fell. You're still around. 'Rat' just isn't respectful.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5791,7 +5819,9 @@
"description": "After all those experiments, what's a few more, hmm?",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"//": "iv_fatigue of 5, other values are lower",
"mutagen_target_modifier": 5
},
{
"type": "mutation",
Expand All @@ -5801,7 +5831,9 @@
"description": "You're the perfect candidate to tidy this mess.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"//": "iv_fatigue of 5, other values are lower",
"mutagen_target_modifier": 5
},
{
"type": "mutation",
Expand All @@ -5811,7 +5843,8 @@
"description": "You are the tree under which humankind will shelter during these dark times.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5821,7 +5854,9 @@
"description": "You can't tell what you are anymore. Everything and yet nothing, like you weren't meant to exist. But you do, and you're a force, no matter what happens.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"//": "iv_hunger, iv_thirst, and iv_fatigue are all at 20",
"mutagen_target_modifier": 20
},
{
"type": "mutation",
Expand All @@ -5831,7 +5866,8 @@
"description": "The chance to undo not one but TWO extinction events. You're confident you'll do fine.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand All @@ -5841,7 +5877,8 @@
"description": "So much food, everywhere! And nobody's even guarding it anymore! These are good times.",
"valid": false,
"purifiable": false,
"threshold": true
"threshold": true,
"mutagen_target_modifier": 10
},
{
"type": "mutation",
Expand Down
9 changes: 0 additions & 9 deletions data/json/obsoletion/mutations.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
[
{
"type": "mutation",
"id": "ROBUST",
"name": { "str": "Robust Genetics" },
"points": 0,
"description": "Genetics? Doesn't excuse not eating healthy, though.",
"valid": false,
"player_display": false
},
{
"type": "mutation",
"id": "TRUTHTELLER",
Expand Down
1 change: 1 addition & 0 deletions doc/src/content/docs/en/mod/json/reference/json_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@ wake up for the first time after 24 hours into the game.
"active": false , // Will the target mutation start powered ( turn ON ).
"moves": 100 // how many moves this costs. (default: 0)
"enchantments": [ "MEP_INK_GLAND_SPRAY" ], // Applies this enchantment to the player. See magic.md and effects_json.md
"mutagen_target_modifier": 5 // Increases or decreases how mutations prefer to balance out when mutating from mutant toxins, negative values push the target value lower (default: 0)
}
```

Expand Down
1 change: 1 addition & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7125,6 +7125,7 @@ mutation_value_map = {
{ "mana_modifier", calc_mutation_value_additive<&mutation_branch::mana_modifier> },
{ "mana_multiplier", calc_mutation_value_multiplicative<&mutation_branch::mana_multiplier> },
{ "mana_regen_multiplier", calc_mutation_value_multiplicative<&mutation_branch::mana_regen_multiplier> },
{ "mutagen_target_modifier", calc_mutation_value_additive<&mutation_branch::mutagen_target_modifier> },
{ "speed_modifier", calc_mutation_value_multiplicative<&mutation_branch::speed_modifier> },
{ "movecost_modifier", calc_mutation_value_multiplicative<&mutation_branch::movecost_modifier> },
{ "movecost_flatground_modifier", calc_mutation_value_multiplicative<&mutation_branch::movecost_flatground_modifier> },
Expand Down
3 changes: 2 additions & 1 deletion src/mutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,8 @@ std::map<trait_id, float> Character::mutation_chances() const
int current_score = genetic_score( *this );
// 10/10/10/10 in stats, balanced traits, plus tip
int expected_score = 4 * 10 + 6;
int direction = expected_score - current_score;
int direction = expected_score - current_score + mutation_value( "mutagen_target_modifier" );
add_msg_if_player( m_debug, "Mutation target value: %s", direction );

// Duplicates allowed - they'll increase chances of change
std::vector<potential_mutation> potential;
Expand Down
2 changes: 2 additions & 0 deletions src/mutation.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ struct mutation_branch {
float mana_modifier = 0.0f;
float mana_multiplier = 1.0f;
float mana_regen_multiplier = 1.0f;
// Bonus or penalty when mutating from toxins, see Character::mutation_chances
float mutagen_target_modifier = 0;
// spells learned and their associated level when gaining the mutation
std::map<spell_id, int> spells_learned;
/** mutation enchantments */
Expand Down
2 changes: 2 additions & 0 deletions src/mutation_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ void mutation_branch::load( const JsonObject &jo, const std::string & )
optional( jo, was_loaded, "mana_multiplier", mana_multiplier, 1.0f );
optional( jo, was_loaded, "mana_regen_multiplier", mana_regen_multiplier, 1.0f );

optional( jo, was_loaded, "mutagen_target_modifier", mutagen_target_modifier, 0 );

if( jo.has_object( "rand_cut_bonus" ) ) {
JsonObject sm = jo.get_object( "rand_cut_bonus" );
rand_cut_bonus.first = sm.get_int( "min" );
Expand Down

0 comments on commit 762448d

Please sign in to comment.