From d689d924517fa25ac6b1de2452712e42b21eb3cd Mon Sep 17 00:00:00 2001 From: Chaosvolt Date: Tue, 21 Nov 2023 11:28:40 -0600 Subject: [PATCH 1/5] fix(balance): repair chance rebalancing --- data/json/items/tool/tailoring.json | 10 +++++----- src/iuse_actor.cpp | 10 ++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/data/json/items/tool/tailoring.json b/data/json/items/tool/tailoring.json index 69b7179c5f81..a522bf5793c0 100644 --- a/data/json/items/tool/tailoring.json +++ b/data/json/items/tool/tailoring.json @@ -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 }, @@ -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 }, @@ -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 }, @@ -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 }, @@ -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 }, diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 65f7e0f6dd05..361946f15407 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -3295,8 +3295,8 @@ std::pair 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; break; case RT_PRACTICE: // Skill gain scales with recipe difficulty, so practice difficulty should too @@ -3315,9 +3315,11 @@ std::pair 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 ) ); From 59b415baa6bd7d797c5dc3ae3a7f77ad162b0880 Mon Sep 17 00:00:00 2001 From: Chaosvolt Date: Tue, 21 Nov 2023 20:22:02 -0600 Subject: [PATCH 2/5] Update json_info.md --- .../docs/en/mod/json/reference/json_info.md | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/src/content/docs/en/mod/json/reference/json_info.md b/doc/src/content/docs/en/mod/json/reference/json_info.md index 4dcc40f60594..19e7c372b246 100644 --- a/doc/src/content/docs/en/mod/json/reference/json_info.md +++ b/doc/src/content/docs/en/mod/json/reference/json_info.md @@ -2414,7 +2414,29 @@ more structured function. "done_message": "Place the beartrap on the %s.", // The message that appears after the trap has been placed. %s is replaced with the terrain name of the place where the trap has been put. "practice": 4, // How much practice to the "traps" skill placing the trap gives. "moves": 10 // (optional, default is 100): the move points that are used by placing the trap. -} +}, +"use_action": { + { + "type": "repair_item", // Repair items. Skill, tool quality, and minor impact from dexterit + "item_action_type": "repair_fabric", // Points to an item_action JSON entry that determines the action's name in the use menu. Vanilla examples include repair_fabric and repair_metal. + "materials": [ // What materials can be repaired by this item. Materials.json defines what item is consumed when repairing items of that material. + "cotton", + "leather", + "nylon", + "wool", + "fur", + "faux_fur", + "nomex", + "kevlar", + "neoprene", + "gutskin" + ], + "skill": "tailor", // What skill determines chance of success vs. risk of damaging the item further. + "tool_quality": 3, // Bonus from tool, 1. times multiplier on skill. With 8 Dex, 10 skill plus 2 or more tool_quality allows any item in the game to be fully reinforced. + "cost_scaling": 0.1, // Reduces or increases how much raw material is needed per successful repair action, also affected by the item's volume. + "move_cost": 800 // How long between each roll for success or failure, 100 moves is 1 turn. + } +}, "use_action": { "type": "sew_advanced", // Modify clothing "materials": [ // materials to deal with. From 7fa9d4d5134bf1abd084cc07e07988ee7c852a12 Mon Sep 17 00:00:00 2001 From: Chaosvolt Date: Tue, 21 Nov 2023 20:24:57 -0600 Subject: [PATCH 3/5] Woops --- doc/src/content/docs/en/mod/json/reference/json_info.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/content/docs/en/mod/json/reference/json_info.md b/doc/src/content/docs/en/mod/json/reference/json_info.md index 19e7c372b246..2f362e5fcbac 100644 --- a/doc/src/content/docs/en/mod/json/reference/json_info.md +++ b/doc/src/content/docs/en/mod/json/reference/json_info.md @@ -2417,7 +2417,7 @@ more structured function. }, "use_action": { { - "type": "repair_item", // Repair items. Skill, tool quality, and minor impact from dexterit + "type": "repair_item", // Repair items. Skill, tool quality, and dexterity is checked against how hard that item is to craft/dissemble (which may be modified with repairs_like). "item_action_type": "repair_fabric", // Points to an item_action JSON entry that determines the action's name in the use menu. Vanilla examples include repair_fabric and repair_metal. "materials": [ // What materials can be repaired by this item. Materials.json defines what item is consumed when repairing items of that material. "cotton", From 76e8ef438ba8dd02bac5756e0196325feb3593cb Mon Sep 17 00:00:00 2001 From: Chaosvolt Date: Wed, 22 Nov 2023 19:02:22 -0600 Subject: [PATCH 4/5] Yeet dat table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (╯°□°)╯︵ ┻━┻ --- src/iuse_actor.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 361946f15407..0421a3dbc246 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -3306,15 +3306,6 @@ std::pair repair_item_actor::repair_chance( } const int difficulty = recipe_difficulty + action_difficulty; - // Sample numbers: - // Item | Damage | Skill | Dex | Success | Failure - // Hoodie | 2 | 3 | 10 | 6% | 0% - // Hazmat | 1 | 10 | 10 | 8% | 0% - // Hazmat | 1 | 5 | 20 | 0% | 2% - // t-shirt| 4 | 1 | 5 | 2% | 3% - // 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 * ( 1 + tool_quality / 10.0f ) ) - 2 * difficulty ) / 100.0f; /** @EFFECT_DEX reduces the chances of damaging an item when repairing */ From 9c7e0de3cd03754d4e91345d9162406a1add5512 Mon Sep 17 00:00:00 2001 From: Chaosvolt Date: Thu, 23 Nov 2023 10:38:51 -0600 Subject: [PATCH 5/5] Update iuse_actor.cpp --- src/iuse_actor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 0421a3dbc246..019c8a81906d 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -3296,7 +3296,7 @@ std::pair repair_item_actor::repair_chance( break; case RT_REINFORCE: // Reinforcing is 50% harder than refitting - action_difficulty = fix.max_damage() / itype::damage_scale * 1.5; + action_difficulty = ( fix.max_damage() / itype::damage_scale ) + 2; break; case RT_PRACTICE: // Skill gain scales with recipe difficulty, so practice difficulty should too