Skip to content

Commit

Permalink
fix(balance): repair chance rebalancing
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosvolt committed Nov 21, 2023
1 parent a77aebb commit d689d92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions data/json/items/tool/tailoring.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"item_action_type": "repair_fabric",
"materials": [ "cotton", "leather", "nylon", "wool", "fur", "faux_fur", "nomex", "kevlar", "gutskin" ],
"skill": "tailor",
"tool_quality": -1,
"tool_quality": 1,
"cost_scaling": 0.1,
"move_cost": 1300
},
Expand Down Expand Up @@ -101,7 +101,7 @@
"item_action_type": "repair_fabric",
"materials": [ "neoprene" ],
"skill": "tailor",
"tool_quality": 0,
"tool_quality": 1,
"cost_scaling": 0.1,
"move_cost": 1200
},
Expand Down Expand Up @@ -130,7 +130,7 @@
"item_action_type": "repair_fabric",
"materials": [ "cotton", "nylon", "leather", "wool", "fur", "faux_fur", "nomex", "gutskin" ],
"skill": "tailor",
"tool_quality": -1,
"tool_quality": 0,
"cost_scaling": 0.1,
"move_cost": 1500
},
Expand Down Expand Up @@ -160,7 +160,7 @@
"item_action_type": "repair_fabric",
"materials": [ "cotton", "leather", "nylon", "wool", "fur", "faux_fur", "nomex", "kevlar", "gutskin" ],
"skill": "tailor",
"tool_quality": 0,
"tool_quality": 2,
"cost_scaling": 0.1,
"move_cost": 1000
},
Expand Down Expand Up @@ -206,7 +206,7 @@
"item_action_type": "repair_fabric",
"materials": [ "cotton", "leather", "nylon", "wool", "fur", "faux_fur", "nomex", "kevlar", "neoprene", "gutskin" ],
"skill": "tailor",
"tool_quality": 1,
"tool_quality": 3,
"cost_scaling": 0.1,
"move_cost": 800
},
Expand Down
10 changes: 6 additions & 4 deletions src/iuse_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3295,8 +3295,8 @@ std::pair<float, float> repair_item_actor::repair_chance(
action_difficulty = fix.max_damage() / itype::damage_scale;
break;
case RT_REINFORCE:
// Reinforcing is at least as hard as refitting
action_difficulty = std::max( fix.max_damage() / itype::damage_scale, recipe_difficulty );
// Reinforcing is 50% harder than refitting
action_difficulty = fix.max_damage() / itype::damage_scale * 1.5;

Check failure on line 3299 in src/iuse_actor.cpp

View workflow job for this annotation

GitHub Actions / build

result of integer division used in a floating point context; possible loss of precision [bugprone-integer-division,-warnings-as-errors]
break;
case RT_PRACTICE:
// Skill gain scales with recipe difficulty, so practice difficulty should too
Expand All @@ -3315,9 +3315,11 @@ std::pair<float, float> repair_item_actor::repair_chance(
// Duster | 2 | 5 | 5 | 10% | 0%
// Duster | 2 | 2 | 10 | 4% | 1%
// Duster | Refit | 2 | 10 | 0% | N/A
float success_chance = ( 10 + 2 * skill - 2 * difficulty + tool_quality / 5.0f ) / 100.0f;
float success_chance = ( 10 + 2 * ( skill * ( 1 + tool_quality / 10.0f ) ) - 2 * difficulty ) /
100.0f;
/** @EFFECT_DEX reduces the chances of damaging an item when repairing */
float damage_chance = ( difficulty - skill - ( tool_quality + pl.dex_cur ) / 5.0f ) / 100.0f;
float damage_chance = ( difficulty - ( skill * ( 1 + tool_quality / 10.0f ) ) - pl.dex_cur /
5.0f ) / 100.0f;

damage_chance = std::max( 0.0f, std::min( 1.0f, damage_chance ) );
success_chance = std::max( 0.0f, std::min( 1.0f - damage_chance, success_chance ) );
Expand Down

0 comments on commit d689d92

Please sign in to comment.