Skip to content

Commit

Permalink
Jsonify Limb Scores & Character Modifiers (#53069)
Browse files Browse the repository at this point in the history
* Use generic text function for displaying limb encumbrance effects

* Partial jsonification of limb scores

* astyle and json style corrections

* Generate modifier descriptions + Scroll info box

* Partial jsonification of character modifiers

* Style corrections + Add character_mod to translation

* Remove unnecessary static string_id's (clang-tidy)

* Documentation - limb scores and character modifiers

* Switch over to new string extraction system

* Add unit tests for limb scores and character modifiers

* Clang-tidy: use proper string_id name

* Post-merge fix: L comes before Q

* Post-rebase cleanup: new fields / new scores / changed modifiers

- New fields for `character_mod`: "override_encumb" & "override_wounds"
- Migrated new "footing" limb score
- Modified "melee_stamina_cost_mod" to force lift score to be affected by encumbrance
- Updated documentation

* Unhardcode body parts whose encumbrance affects dodge

* Fix reference to non-reference
  • Loading branch information
dseguin authored Dec 4, 2021
1 parent deb47f9 commit 427c1c6
Show file tree
Hide file tree
Showing 32 changed files with 1,147 additions and 573 deletions.
62 changes: 16 additions & 46 deletions data/json/body_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
"connected_to": "head",
"opposite_part": "torso",
"limb_type": "torso",
"limb_scores": [ [ "balance", 0.7 ] ],
"encumbrance_threshold": 6,
"balance_score": 0.7,
"encumb_impacts_dodge": true,
"is_vital": true,
"hit_size": 45,
"hit_size_relative": [ 20, 33.33, 36.57 ],
Expand Down Expand Up @@ -45,7 +46,7 @@
"connected_to": "head",
"opposite_part": "head",
"limb_type": "head",
"reaction_score": 0.3,
"limb_scores": [ [ "reaction", 0.3 ] ],
"is_vital": true,
"hit_size": 6,
"hit_size_relative": [ 0, 2.33, 5.71 ],
Expand Down Expand Up @@ -78,9 +79,7 @@
"hit_size_relative": [ 0, 0.33, 0.57 ],
"hit_difficulty": 1.15,
"limb_type": "sensor",
"vision_score": 1.0,
"nightvision_score": 1.0,
"reaction_score": 0.7,
"limb_scores": [ [ "vision", 1.0 ], [ "night_vis", 1.0 ], [ "reaction", 0.7 ] ],
"side": "both",
"legacy_id": "EYES",
"stylish_bonus": 2,
Expand All @@ -106,9 +105,7 @@
"hit_size_relative": [ 0, 0, 0 ],
"hit_difficulty": 1.15,
"limb_type": "mouth",
"breathing_score": 1.0,
"manipulator_score": 0.05,
"manipulator_max": 0.2,
"limb_scores": [ [ "breathing", 1.0 ], [ "manip", 0.05, 0.2 ] ],
"side": "both",
"legacy_id": "MOUTH",
"stylish_bonus": 2,
Expand Down Expand Up @@ -141,12 +138,7 @@
"hit_size_relative": [ 15, 20, 22.86 ],
"hit_difficulty": 0.95,
"limb_type": "arm",
"balance_score": 0.15,
"manipulator_score": 0.1,
"manipulator_max": 0.2,
"lifting_score": 0.5,
"blocking_score": 1,
"swim_score": 0.1,
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "lift", 0.5 ], [ "balance", 0.15 ], [ "block", 1.0 ], [ "swim", 0.1 ] ],
"side": "left",
"legacy_id": "ARM_L",
"hot_morale_mod": 0.5,
Expand Down Expand Up @@ -179,12 +171,7 @@
"hit_size_relative": [ 15, 20, 22.86 ],
"hit_difficulty": 0.95,
"limb_type": "arm",
"balance_score": 0.15,
"manipulator_score": 0.1,
"manipulator_max": 0.2,
"lifting_score": 0.5,
"blocking_score": 1,
"swim_score": 0.1,
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "lift", 0.5 ], [ "balance", 0.15 ], [ "block", 1.0 ], [ "swim", 0.1 ] ],
"side": "right",
"legacy_id": "ARM_R",
"hot_morale_mod": 0.5,
Expand Down Expand Up @@ -214,9 +201,7 @@
"hit_size_relative": [ 0, 0, 0 ],
"hit_difficulty": 1.1,
"limb_type": "hand",
"manipulator_score": 0.5,
"manipulator_max": 1,
"swim_score": 0.15,
"limb_scores": [ [ "manip", 0.5, 1.0 ], [ "swim", 0.15 ] ],
"side": "left",
"legacy_id": "HAND_L",
"stylish_bonus": 0.5,
Expand Down Expand Up @@ -245,9 +230,7 @@
"hit_size_relative": [ 0, 0, 0 ],
"hit_difficulty": 1.1,
"limb_type": "hand",
"manipulator_score": 0.5,
"manipulator_max": 1,
"swim_score": 0.15,
"limb_scores": [ [ "manip", 0.5, 1.0 ], [ "swim", 0.15 ] ],
"side": "right",
"legacy_id": "HAND_R",
"stylish_bonus": 0.5,
Expand Down Expand Up @@ -279,10 +262,8 @@
"hit_size_relative": [ 25, 12, 5.71 ],
"hit_difficulty": 0.975,
"limb_type": "leg",
"manipulator_score": 0.1,
"manipulator_max": 0.2,
"movement_speed_score": 0.5,
"swim_score": 0.15,
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "move_speed", 0.5 ], [ "swim", 0.15 ] ],
"encumb_impacts_dodge": true,
"side": "left",
"legacy_id": "LEG_L",
"stylish_bonus": 1,
Expand Down Expand Up @@ -316,10 +297,8 @@
"hit_size_relative": [ 25, 12, 5.71 ],
"hit_difficulty": 0.975,
"limb_type": "leg",
"manipulator_score": 0.1,
"manipulator_max": 0.2,
"movement_speed_score": 0.5,
"swim_score": 0.15,
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "move_speed", 0.5 ], [ "swim", 0.15 ] ],
"encumb_impacts_dodge": true,
"side": "right",
"legacy_id": "LEG_R",
"stylish_bonus": 1,
Expand Down Expand Up @@ -351,10 +330,7 @@
"hit_size_relative": [ 0, 0, 0 ],
"hit_difficulty": 0.8,
"limb_type": "foot",
"manipulator_score": 0.1,
"manipulator_max": 0.2,
"footing_score": 0.5,
"swim_score": 0.1,
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "footing", 0.5 ], [ "swim", 0.1 ] ],
"side": "left",
"legacy_id": "FOOT_L",
"stylish_bonus": 0.5,
Expand Down Expand Up @@ -384,10 +360,7 @@
"hit_size_relative": [ 0, 0, 0 ],
"hit_difficulty": 0.8,
"limb_type": "foot",
"manipulator_score": 0.1,
"manipulator_max": 0.2,
"footing_score": 0.5,
"swim_score": 0.1,
"limb_scores": [ [ "manip", 0.1, 0.2 ], [ "footing", 0.5 ], [ "swim", 0.1 ] ],
"side": "right",
"legacy_id": "FOOT_R",
"stylish_bonus": 0.5,
Expand All @@ -414,10 +387,7 @@
"main_part": "debug_tail",
"hit_difficulty": 0.8,
"limb_type": "tail",
"manipulator_score": 0.5,
"manipulator_max": 1,
"balance_score": 1,
"swim_score": 0.15,
"limb_scores": [ [ "manip", 0.5, 1.0 ], [ "balance", 1.0 ], [ "swim", 0.15 ] ],
"opposite_part": "debug_tail",
"side": "both",
"connected_to": "torso",
Expand Down
121 changes: 121 additions & 0 deletions data/json/character_modifiers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
[
{
"type": "character_mod",
"id": "aim_speed_skill_mod",
"description": "Aim speed skill modifier",
"mod_type": "+",
"value": { "builtin": "aim_speed_skill_modifier" }
},
{
"type": "character_mod",
"id": "aim_speed_dex_mod",
"description": "Aim speed dexterity modifier",
"mod_type": "+",
"value": { "builtin": "aim_speed_dex_modifier" }
},
{
"type": "character_mod",
"id": "aim_speed_mod",
"description": "Gun aim speed modifier",
"mod_type": "x",
"value": { "limb_score": "manip" }
},
{
"type": "character_mod",
"id": "melee_thrown_move_manip_mod",
"description": "Melee and thrown attack movement point modifier",
"mod_type": "x",
"value": { "limb_score": "manip", "max": "max_move_cost", "nominator": 1.0 }
},
{
"type": "character_mod",
"id": "melee_thrown_move_balance_mod",
"description": "Melee and thrown attack movement point modifier",
"mod_type": "x",
"value": { "limb_score": "balance", "max": "max_move_cost", "nominator": 1.0 }
},
{
"type": "character_mod",
"id": "melee_stamina_cost_mod",
"description": "Melee stamina cost",
"mod_type": "x",
"value": { "limb_score": "lift", "limb_type": "arm", "override_encumb": true, "max": "max_move_cost", "nominator": 1.0 }
},
{
"type": "character_mod",
"id": "reloading_move_mod",
"description": "Reloading movement point cost",
"mod_type": "x",
"value": { "limb_score": "manip", "max": "max_move_cost", "nominator": 1.0 }
},
{
"type": "character_mod",
"id": "thrown_dex_mod",
"description": "Dexterity when throwing items",
"mod_type": "x",
"value": { "limb_score": "manip" }
},
{
"type": "character_mod",
"id": "ranged_dispersion_manip_mod",
"description": "Hand dispersion when using ranged attacks",
"mod_type": "+",
"value": { "limb_score": "manip", "max": 1000.0, "nominator": 22.8, "subtract": 22.8 }
},
{
"type": "character_mod",
"id": "ranged_dispersion_vision_mod",
"description": "Sight dispersion when using ranged attacks",
"mod_type": "+",
"value": { "limb_score": "vision", "max": 10000.0, "nominator": 30.0, "subtract": 30.0 }
},
{
"type": "character_mod",
"id": "stamina_move_cost_mod",
"description": "Stamina move cost modifier",
"mod_type": "x",
"value": { "builtin": "stamina_move_cost_modifier" }
},
{
"type": "character_mod",
"id": "stamina_recovery_breathing_mod",
"description": "Stamina Regeneration",
"mod_type": "x",
"value": { "limb_score": "breathing" }
},
{
"type": "character_mod",
"id": "limb_speed_movecost_mod",
"description": "Limb speed movecost modifier",
"mod_type": "x",
"value": { "limb_score": "move_speed", "max": "max_move_cost", "nominator": 1.0 }
},
{
"type": "character_mod",
"id": "limb_footing_movecost_mod",
"description": "Footing movecost modifier",
"mod_type": "x",
"value": { "limb_score": "footing", "max": "max_move_cost", "nominator": 1.0 }
},
{
"type": "character_mod",
"id": "limb_run_cost_mod",
"description": "Limb run cost modifier",
"mod_type": "x",
"value": { "builtin": "limb_run_cost_modifier" }
},
{
"type": "character_mod",
"id": "swim_mod",
"description": "Swimming movement point cost",
"mod_type": "x",
"value": { "limb_score": "swim", "max": "max_move_cost", "nominator": 1.0 }
},
{
"type": "character_mod",
"id": "melee_attack_roll_mod",
"description": "Melee attack rolls",
"mod_type": "x",
"value": { "limb_score": "balance", "min": 0.2 }
}
]
79 changes: 79 additions & 0 deletions data/json/limb_scores.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[
{
"type": "limb_score",
"id": "manip",
"name": "Manipulation",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "lift",
"name": "Lifting",
"affected_by_wounds": true,
"affected_by_encumb": false
},
{
"type": "limb_score",
"id": "block",
"name": "Blocking",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "breathing",
"name": "Breathing",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "vision",
"name": "Vision",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "night_vis",
"name": "Night vision",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "reaction",
"name": "Reaction",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "move_speed",
"name": "Movement speed",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "balance",
"name": "Balance",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "footing",
"name": "Footing",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"type": "limb_score",
"id": "swim",
"name": "Swimming",
"affected_by_wounds": true,
"affected_by_encumb": true
}
]
37 changes: 37 additions & 0 deletions data/mods/TEST_DATA/body_parts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"type": "limb_score",
"id": "test",
"name": "Testing",
"affected_by_wounds": true,
"affected_by_encumb": true
},
{
"id": "test_tail",
"type": "body_part",
"name": "test tail",
"name_multiple": "test tails",
"heading": "TST Tail",
"heading_multiple": "Tails",
"encumbrance_text": "Your testing tail feels heavy",
"hit_size": 1,
"hit_size_relative": [ 0, 0, 0 ],
"drench_capacity": 4,
"main_part": "test_tail",
"hit_difficulty": 0.8,
"limb_type": "tail",
"opposite_part": "test_tail",
"connected_to": "torso",
"side": "both",
"accusative": { "ctxt": "bodypart_accusative", "str": "test tail" },
"hp_bar_ui_text": "TST TAIL",
"base_hp": 20,
"limb_scores": [ [ "test", 0.8 ] ]
},
{
"type": "enchantment",
"id": "ENCH_TEST_TAIL",
"condition": "ALWAYS",
"modified_bodyparts": [ { "gain": "test_tail" } ]
}
]
Loading

0 comments on commit 427c1c6

Please sign in to comment.