Skip to content

Commit

Permalink
Add crawling score, applied to prone movement cost
Browse files Browse the repository at this point in the history
  • Loading branch information
dseguin committed Jan 9, 2022
1 parent fe5028e commit 0fc50c5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
8 changes: 4 additions & 4 deletions data/json/body_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"hit_size": 13,
"hit_difficulty": 0.95,
"limb_type": "arm",
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "lift", 0.5 ], [ "balance", 0.15 ], [ "block", 1.0 ], [ "swim", 0.1 ] ],
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "lift", 0.5 ], [ "balance", 0.15 ], [ "block", 1.0 ], [ "swim", 0.1 ], [ "crawl", 0.3 ] ],
"side": "left",
"legacy_id": "ARM_L",
"hot_morale_mod": 0.5,
Expand Down Expand Up @@ -167,7 +167,7 @@
"hit_size": 13,
"hit_difficulty": 0.95,
"limb_type": "arm",
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "lift", 0.5 ], [ "balance", 0.15 ], [ "block", 1.0 ], [ "swim", 0.1 ] ],
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "lift", 0.5 ], [ "balance", 0.15 ], [ "block", 1.0 ], [ "swim", 0.1 ], [ "crawl", 0.3 ] ],
"side": "right",
"legacy_id": "ARM_R",
"hot_morale_mod": 0.5,
Expand Down Expand Up @@ -255,7 +255,7 @@
"hit_size": 13,
"hit_difficulty": 0.9,
"limb_type": "leg",
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "move_speed", 0.5 ], [ "swim", 0.15 ], [ "block", 1 ] ],
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "move_speed", 0.5 ], [ "swim", 0.15 ], [ "block", 1 ], [ "crawl", 0.2 ] ],
"encumb_impacts_dodge": true,
"side": "left",
"legacy_id": "LEG_L",
Expand Down Expand Up @@ -290,7 +290,7 @@
"hit_size": 13,
"hit_difficulty": 0.9,
"limb_type": "leg",
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "move_speed", 0.5 ], [ "swim", 0.15 ], [ "block", 1 ] ],
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "move_speed", 0.5 ], [ "swim", 0.15 ], [ "block", 1 ], [ "crawl", 0.2 ] ],
"encumb_impacts_dodge": true,
"side": "right",
"legacy_id": "LEG_R",
Expand Down
7 changes: 7 additions & 0 deletions data/json/character_modifiers.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
"mod_type": "x",
"value": { "limb_score": "breathing" }
},
{
"type": "character_mod",
"id": "crawl_speed_movecost_mod",
"description": "Crawl speed movecost modifier",
"mod_type": "x",
"value": { "limb_score": "crawl", "nominator": 1.2 }
},
{
"type": "character_mod",
"id": "limb_speed_movecost_mod",
Expand Down
7 changes: 7 additions & 0 deletions data/json/limb_scores.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,12 @@
"name": "Swimming",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "crawl",
"name": "Crawling",
"affected_by_wounds": true,
"affected_by_encumb": true
}
]
7 changes: 5 additions & 2 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ static const bionic_id bio_voice( "bio_voice" );
static const character_modifier_id character_modifier_aim_speed_dex_mod( "aim_speed_dex_mod" );
static const character_modifier_id character_modifier_aim_speed_mod( "aim_speed_mod" );
static const character_modifier_id character_modifier_aim_speed_skill_mod( "aim_speed_skill_mod" );
static const character_modifier_id
character_modifier_crawl_speed_movecost_mod( "crawl_speed_movecost_mod" );
static const character_modifier_id character_modifier_limb_run_cost_mod( "limb_run_cost_mod" );
static const character_modifier_id
character_modifier_limb_speed_movecost_mod( "limb_speed_movecost_mod" );
Expand Down Expand Up @@ -8907,7 +8909,8 @@ int Character::run_cost( int base_cost, bool diag ) const
}
}

movecost *= get_modifier( character_modifier_limb_run_cost_mod );
movecost *= get_modifier( is_prone() ? character_modifier_crawl_speed_movecost_mod :
character_modifier_limb_run_cost_mod );

movecost *= mutation_value( "movecost_modifier" );
if( flatground ) {
Expand Down Expand Up @@ -8969,7 +8972,7 @@ int Character::run_cost( int base_cost, bool diag ) const
movecost /= get_modifier( character_modifier_stamina_move_cost_mod );

if( !is_mounted() && !is_prone() && has_effect( effect_downed ) ) {
movecost *= 3;
movecost *= get_modifier( character_modifier_crawl_speed_movecost_mod ) * 2;
}
}

Expand Down

0 comments on commit 0fc50c5

Please sign in to comment.