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/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..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 @@ -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 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", + "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. diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 65f7e0f6dd05..019c8a81906d 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 ) + 2; break; case RT_PRACTICE: // Skill gain scales with recipe difficulty, so practice difficulty should too @@ -3306,18 +3306,11 @@ 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 - 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 ) );