Skip to content

Commit

Permalink
Jsonized skill rust multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg committed Jul 12, 2019
1 parent b3ef2a4 commit f176c89
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 2 additions & 0 deletions data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"points": 3,
"description": "You have an exceptional memory, and find it easy to remember things. Your skills will erode slightly slower than usual, and you can remember more terrain.",
"map_memory_capacity_multiplier": 2,
"skill_rust_multiplier": 0.66,
"starting_trait": true,
"valid": false,
"cancels": [ "FORGETFUL" ]
Expand Down Expand Up @@ -1020,6 +1021,7 @@
"description": "You have a hard time remembering things. Your skills will erode slightly faster than usual, and you can remember less terrain.",
"social_modifiers": { "lie": -5 },
"map_memory_capacity_multiplier": 0.5,
"skill_rust_multiplier": 1.33,
"starting_trait": true,
"category": [ "BEAST", "MEDICAL", "CHIMERA", "MOUSE", "INSECT" ],
"cancels": [ "GOODMEMORY" ]
Expand Down
1 change: 1 addition & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3138,6 +3138,7 @@ mutation_value_map = {
{ "overmap_sight", calc_mutation_value_multiplicative<&mutation_branch::overmap_sight> },
{ "overmap_multiplier", calc_mutation_value_multiplicative<&mutation_branch::overmap_multiplier> },
{ "map_memory_capacity_multiplier", calc_mutation_value_multiplicative<&mutation_branch::map_memory_capacity_multiplier> },
{ "skill_rust_multiplier", calc_mutation_value_multiplicative<&mutation_branch::skill_rust_multiplier> }
};

float Character::mutation_value( const std::string &val ) const
Expand Down
3 changes: 3 additions & 0 deletions src/mutation.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ struct mutation_branch {
// Multiplier for map memory capacity, defaulting to 1.
float map_memory_capacity_multiplier = 1.0f;

// Multiplier for skill rust, defaulting to 1.
float skill_rust_multiplier = 1.0f;

// Bonus or penalty to social checks (additive). 50 adds 50% to success, -25 subtracts 25%
social_modifiers social_mods;

Expand Down
1 change: 1 addition & 0 deletions src/mutation_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ void mutation_branch::load( JsonObject &jo, const std::string & )
optional( jo, was_loaded, "overmap_sight", overmap_sight, 0.0f );
optional( jo, was_loaded, "overmap_multiplier", overmap_multiplier, 1.0f );
optional( jo, was_loaded, "map_memory_capacity_multiplier", map_memory_capacity_multiplier, 1.0f );
optional( jo, was_loaded, "skill_rust_multiplier", skill_rust_multiplier, 1.0f );

optional( jo, was_loaded, "mana_modifier", mana_modifier, 0 );
optional( jo, was_loaded, "mana_multiplier", mana_multiplier, 1.0f );
Expand Down
10 changes: 1 addition & 9 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,10 @@ static const trait_id trait_FASTREADER( "FASTREADER" );
static const trait_id trait_FAT( "FAT" );
static const trait_id trait_FELINE_FUR( "FELINE_FUR" );
static const trait_id trait_FLOWERS( "FLOWERS" );
static const trait_id trait_FORGETFUL( "FORGETFUL" );
static const trait_id trait_FRESHWATEROSMOSIS( "FRESHWATEROSMOSIS" );
static const trait_id trait_FUR( "FUR" );
static const trait_id trait_GILLS( "GILLS" );
static const trait_id trait_GILLS_CEPH( "GILLS_CEPH" );
static const trait_id trait_GOODMEMORY( "GOODMEMORY" );
static const trait_id trait_HATES_BOOKS( "HATES_BOOKS" );
static const trait_id trait_HEAVYSLEEPER( "HEAVYSLEEPER" );
static const trait_id trait_HEAVYSLEEPER2( "HEAVYSLEEPER2" );
Expand Down Expand Up @@ -2726,13 +2724,7 @@ int player::rust_rate( bool return_stat_effect ) const
int ret = ( ( get_option<std::string>( "SKILL_RUST" ) == "vanilla" ||
get_option<std::string>( "SKILL_RUST" ) == "capped" ) ? 500 : 500 - 35 * ( intel - 8 ) );

if( has_trait( trait_FORGETFUL ) ) {
ret *= 1.33;
}

if( has_trait( trait_GOODMEMORY ) ) {
ret *= .66;
}
ret *= mutation_value( "skill_rust_multiplier" );

if( ret < 0 ) {
ret = 0;
Expand Down

0 comments on commit f176c89

Please sign in to comment.