Skip to content

Commit

Permalink
jsonize swim speed modifier as per walk cost mutation modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
David Brown authored and kevingranade committed Jan 4, 2020
1 parent 5a05025 commit 5575599
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
6 changes: 6 additions & 0 deletions data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,7 @@
"category": [ "CHIMERA", "RAPTOR", "LIZARD" ],
"prereqs": [ "SKIN_ROUGH" ],
"changes_to": [ "THICK_SCALES", "SLEEK_SCALES" ],
"movecost_swim_modifier": 0.9,
"wet_protection": [
{ "part": "HEAD", "ignored": 3 },
{ "part": "LEG_L", "ignored": 10 },
Expand Down Expand Up @@ -1842,6 +1843,7 @@
"types": [ "SKIN" ],
"prereqs": [ "SCALES" ],
"category": [ "FISH" ],
"movecost_swim_modifier": 0.75,
"wet_protection": [
{ "part": "HEAD", "good": 7 },
{ "part": "LEG_L", "good": 21 },
Expand Down Expand Up @@ -3134,6 +3136,7 @@
"prereqs": [ "TAIL_STUB" ],
"category": [ "FISH" ],
"wet_protection": [ { "part": "LEG_L", "good": 3 }, { "part": "LEG_R", "good": 3 } ],
"movecost_swim_modifier": 0.75,
"restricts_gear": [ "LEG_L", "LEG_R" ],
"allow_soft_gear": true
},
Expand Down Expand Up @@ -3818,6 +3821,7 @@
"prereqs": [ "STR_UP", "STR_UP_2", "STR_UP_3", "STR_UP_4" ],
"leads_to": [ "HIBERNATE" ],
"category": [ "URSINE" ],
"movecost_swim_modifier": 0.95,
"armor": [ { "parts": "ALL", "bash": 1 } ],
"movecost_modifier": 1.05
},
Expand Down Expand Up @@ -5681,6 +5685,7 @@
"description": "Your legs have transformed into six tentacles. This decreases your speed on land by 20%, makes your movement silent, increases your swimming speed, and reduces wet penalties.",
"types": [ "LEGS" ],
"leads_to": [ "LEG_TENT_BRACE" ],
"movecost_swim_modifier": 0.85,
"category": [ "CEPHALOPOD" ],
"wet_protection": [
{ "part": "LEG_L", "neutral": 21 },
Expand Down Expand Up @@ -5974,6 +5979,7 @@
"description": "You're as comfortable in water as on land, and your body has adapted around that fact. Your base swimming speed is greatly increased, and weight will hinder you much less while swimming.",
"category": [ "FISH" ],
"threshreq": [ "THRESH_FISH" ],
"movecost_swim_modifier": 0.45,
"purifiable": false
},
{
Expand Down
1 change: 1 addition & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5010,6 +5010,7 @@ mutation_value_map = {
{ "max_stamina_modifier", calc_mutation_value_multiplicative<&mutation_branch::max_stamina_modifier> },
{ "weight_capacity_modifier", calc_mutation_value_multiplicative<&mutation_branch::weight_capacity_modifier> },
{ "hearing_modifier", calc_mutation_value_multiplicative<&mutation_branch::hearing_modifier> },
{ "movecost_swim_modifier", calc_mutation_value_multiplicative<&mutation_branch::movecost_swim_modifier> },
{ "noise_modifier", calc_mutation_value_multiplicative<&mutation_branch::noise_modifier> },
{ "overmap_sight", calc_mutation_value_multiplicative<&mutation_branch::overmap_sight> },
{ "overmap_multiplier", calc_mutation_value_multiplicative<&mutation_branch::overmap_multiplier> },
Expand Down
1 change: 1 addition & 0 deletions src/mutation.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ struct mutation_branch {
float max_stamina_modifier = 1.0f;
float weight_capacity_modifier = 1.0f;
float hearing_modifier = 1.0f;
float movecost_swim_modifier = 1.0f;
float noise_modifier = 1.0f;
float scent_modifier = 1.0f;
cata::optional<int> scent_intensity;
Expand Down
1 change: 1 addition & 0 deletions src/mutation_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ void mutation_branch::load( const JsonObject &jo, const std::string & )
optional( jo, was_loaded, "movecost_modifier", movecost_modifier, 1.0f );
optional( jo, was_loaded, "movecost_flatground_modifier", movecost_flatground_modifier, 1.0f );
optional( jo, was_loaded, "movecost_obstacle_modifier", movecost_obstacle_modifier, 1.0f );
optional( jo, was_loaded, "movecost_swim_modifier", movecost_swim_modifier, 1.0f );
optional( jo, was_loaded, "attackcost_modifier", attackcost_modifier, 1.0f );
optional( jo, was_loaded, "max_stamina_modifier", max_stamina_modifier, 1.0f );
optional( jo, was_loaded, "weight_capacity_modifier", weight_capacity_modifier, 1.0f );
Expand Down
23 changes: 3 additions & 20 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ static const bionic_id bio_synaptic_regen( "bio_synaptic_regen" );
static const bionic_id afs_bio_linguistic_coprocessor( "afs_bio_linguistic_coprocessor" );

static const trait_id trait_ACIDBLOOD( "ACIDBLOOD" );
static const trait_id trait_AMPHIBIAN( "AMPHIBIAN" );
static const trait_id trait_ANTENNAE( "ANTENNAE" );
static const trait_id trait_ANTLERS( "ANTLERS" );
static const trait_id trait_CANNIBAL( "CANNIBAL" );
Expand Down Expand Up @@ -758,12 +757,9 @@ int player::swim_speed() const
float hand_bonus_mult = ( usable.test( bp_hand_l ) ? 0.5f : 0.0f ) +
( usable.test( bp_hand_r ) ? 0.5f : 0.0f );

if( !has_trait( trait_AMPHIBIAN ) ) {
ret = 440 + weight_carried() / 60_gram - 50 * get_skill_level( skill_swimming );
/** AMPHIBIAN increases base swim speed */
} else {
ret = 200 + weight_carried() / 120_gram - 50 * get_skill_level( skill_swimming );
}
// base swim speed.
ret = ( 440 * mutation_value( "movecost_swim_modifier" ) ) + weight_carried() /
( 60_gram / mutation_value( "movecost_swim_modifier" ) ) - 50 * get_skill_level( skill_swimming );
/** @EFFECT_STR increases swim speed bonus from PAWS */
if( has_trait( trait_PAWS ) ) {
ret -= hand_bonus_mult * ( 20 + str_cur * 3 );
Expand All @@ -784,19 +780,6 @@ int player::swim_speed() const
if( has_trait( trait_WEBBED ) ) {
ret -= hand_bonus_mult * ( 60 + str_cur * 5 );
}
/** @EFFECT_STR increases swim speed bonus from TAIL_FIN */
if( has_trait( trait_TAIL_FIN ) ) {
ret -= 100 + str_cur * 10;
}
if( has_trait( trait_SLEEK_SCALES ) ) {
ret -= 100;
}
if( has_trait( trait_LEG_TENTACLES ) ) {
ret -= 60;
}
if( has_trait( trait_FAT ) ) {
ret -= 30;
}
/** @EFFECT_SWIMMING increases swim speed */
ret += ( 50 - get_skill_level( skill_swimming ) * 2 ) * ( ( encumb( bp_leg_l ) + encumb(
bp_leg_r ) ) / 10 );
Expand Down

0 comments on commit 5575599

Please sign in to comment.