diff --git a/data/json/mutations/mutations.json b/data/json/mutations/mutations.json index 26c235393844e..015b4bc2b3dab 100644 --- a/data/json/mutations/mutations.json +++ b/data/json/mutations/mutations.json @@ -4853,6 +4853,7 @@ "description": "Your hands have fused into quasi-paws. Fine manipulation is a challenge: permanent hand encumbrance of 10, difficulty with delicate craftwork, and your gloves don't fit. But they handle water better.", "encumbrance_always": [ [ "HAND_L", 10 ], [ "HAND_R", 10 ] ], "restricts_gear": [ "HAND_L", "HAND_R" ], + "craft_skill_bonus": [ [ "electronics", -2 ], [ "tailor", -2 ], [ "mechanics", -2 ] ], "types": [ "HANDS" ], "prereqs": [ "CLAWS", "CLAWS_RETRACT", "CLAWS_RAT" ], "cancels": [ "TALONS" ], @@ -4868,6 +4869,17 @@ "ugliness": 3, "mixed_effect": true, "description": "Your paws are much larger now. Manual dexterity is difficult: permanent hand encumbrance of 20, serious problems crafting, and no gloves. But you can swim more effectively.", + "craft_skill_bonus": [ + [ "electronics", -4 ], + [ "tailor", -4 ], + [ "mechanics", -4 ], + [ "firstaid", -2 ], + [ "computer", -2 ], + [ "traps", -2 ], + [ "fabrication", -2 ], + [ "cooking", -2 ], + [ "survival", -2 ] + ], "encumbrance_always": [ [ "HAND_L", 20 ], [ "HAND_R", 20 ] ], "restricts_gear": [ "HAND_L", "HAND_R" ], "types": [ "HANDS" ], diff --git a/doc/JSON_INFO.md b/doc/JSON_INFO.md index 59e672ef1b7ee..2529945bfa454 100644 --- a/doc/JSON_INFO.md +++ b/doc/JSON_INFO.md @@ -1016,6 +1016,7 @@ Note that even though most statistics yield an integer, you should still use "good": 1 } ] // "neutral/good/ignored" // Good increases pos and cancels neg, neut cancels neg, ignored cancels both "vitamin_rates": [ [ "vitC", -1200 ] ], // How much extra vitamins do you consume per minute. Negative values mean production "vitamins_absorb_multi": [ [ "flesh", [ [ "vitA", 0 ], [ "vitB", 0 ], [ "vitC", 0 ], [ "calcium", 0 ], [ "iron", 0 ] ], [ "all", [ [ "vitA", 2 ], [ "vitB", 2 ], [ "vitC", 2 ], [ "calcium", 2 ], [ "iron", 2 ] ] ] ], // multiplier of vitamin absorption based on material. "all" is every material. supports multiple materials. +"craft_skill_bonus": [ [ "electronics", -2 ], [ "tailor", -2 ], [ "mechanics", -2 ] ], // Skill affected by the mutation and their bonuses. Bonuses can be negative, a bonus of 4 is worth 1 full skill level. "restricts_gear" : [ "TORSO" ], //list of bodyparts that get restricted by this mutation "allow_soft_gear" : true, //If there is a list of 'restricts_gear' this sets if the location still allows items made out of soft materials (Only one of the types need to be soft for it to be considered soft). (default: false) "destroys_gear" : true, //If true, destroys the gear in the 'restricts_gear' location when mutated into. (default: false) diff --git a/src/crafting.cpp b/src/crafting.cpp index cea5d6c85cd02..65e81f1b2aff0 100644 --- a/src/crafting.cpp +++ b/src/crafting.cpp @@ -29,6 +29,7 @@ #include "map.h" #include "map_iterator.h" #include "messages.h" +#include "mutation.h" #include "npc.h" #include "options.h" #include "output.h" @@ -73,8 +74,6 @@ static const efftype_id effect_contacts( "contacts" ); void drop_or_handle( const item &newit, player &p ); static const trait_id trait_DEBUG_HS( "DEBUG_HS" ); -static const trait_id trait_PAWS_LARGE( "PAWS_LARGE" ); -static const trait_id trait_PAWS( "PAWS" ); static const trait_id trait_BURROW( "BURROW" ); static bool crafting_allowed( const player &p, const recipe &rec ) @@ -923,17 +922,12 @@ double player::crafting_success_roll( const recipe &making ) const // It's tough to craft with paws. Fortunately it's just a matter of grip and fine-motor, // not inability to see what you're doing - if( has_trait( trait_PAWS ) || has_trait( trait_PAWS_LARGE ) ) { - int paws_rank_penalty = 0; - if( has_trait( trait_PAWS_LARGE ) ) { - paws_rank_penalty += 1; - } - if( making.skill_used == skill_id( "electronics" ) - || making.skill_used == skill_id( "tailor" ) - || making.skill_used == skill_id( "mechanics" ) ) { - paws_rank_penalty += 1; + for( const std::pair< trait_id, trait_data > &mut : my_mutations ) { + for( const std::pair &skib : mut.first->craft_skill_bonus ) { + if( making.skill_used == skib.first ) { + skill_dice += skib.second; + } } - skill_dice -= paws_rank_penalty * 4; } // Sides on dice is 16 plus your current intelligence diff --git a/src/mutation.h b/src/mutation.h index 053738d2c38cb..ee12948f04fbb 100644 --- a/src/mutation.h +++ b/src/mutation.h @@ -146,6 +146,9 @@ struct mutation_branch { cata::optional scent_mask; int bleed_resist = 0; + /**Map of crafting skills modifiers, can be negative*/ + std::map craft_skill_bonus; + /**What do you smell like*/ cata::optional scent_typeid; diff --git a/src/mutation_data.cpp b/src/mutation_data.cpp index c7bb5dbd88ab8..f3c9209783917 100644 --- a/src/mutation_data.cpp +++ b/src/mutation_data.cpp @@ -411,6 +411,15 @@ void mutation_branch::load( const JsonObject &jo, const std::string & ) spells_learned.emplace( sp, ja.next_int() ); } + for( JsonArray ja : jo.get_array( "craft_skill_bonus" ) ) { + const skill_id skid( ja.next_string() ); + if( skid.is_valid() ) { + craft_skill_bonus.emplace( skid, ja.next_int() ); + } else { + jo.throw_error( "invalid skill_id" ); + } + } + for( JsonArray ja : jo.get_array( "lumination" ) ) { const body_part bp = get_body_part_token( ja.next_string() ); lumination.emplace( bp, ja.next_float() );