From 2dda6c5d21c72bbfc9692c7828c7e9666c588d3a Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Mon, 2 Sep 2024 22:03:46 +0200 Subject: [PATCH 01/14] add butchering profs --- data/json/hobbies.json | 9 ++- data/json/professions.json | 23 +++++- data/json/proficiencies/butchering.json | 47 +++++++++++++ .../proficiencies/proficiency_categories.json | 6 ++ src/activity_handlers.cpp | 70 ++++++++++++++++++- 5 files changed, 149 insertions(+), 6 deletions(-) create mode 100644 data/json/proficiencies/butchering.json diff --git a/data/json/hobbies.json b/data/json/hobbies.json index a341cd90bb4b8..0d7a400909b57 100644 --- a/data/json/hobbies.json +++ b/data/json/hobbies.json @@ -836,7 +836,14 @@ "points": -3, "traits": [ "ANTIFRUIT", "MEATARIAN" ], "skills": [ { "level": 2, "name": "survival" }, { "level": 2, "name": "cooking" } ], - "proficiencies": [ "prof_knives_familiar", "prof_knife_skills" ] + "proficiencies": [ + "prof_knives_familiar", + "prof_knife_skills", + "prof_butchering_basic", + "prof_butchering_adv", + "prof_skinning_basic", + "prof_butchery_offal" + ] }, { "type": "profession", diff --git a/data/json/professions.json b/data/json/professions.json index 641ac245831b9..752bb3daddd5c 100644 --- a/data/json/professions.json +++ b/data/json/professions.json @@ -888,7 +888,10 @@ "prof_baking", "prof_baking_desserts_1", "prof_frying", - "prof_knives_familiar" + "prof_knives_familiar", + "prof_butchering_basic", + "prof_skinning_basic", + "prof_butchery_offal" ], "items": { "both": { @@ -914,7 +917,18 @@ "description": "You spent most of your adult life in a butcher shop. Your trusty knife has seen many different creatures and you know how to butcher them.", "points": 2, "skills": [ { "name": "cutting", "level": 2 }, { "name": "cooking", "level": 2 }, { "name": "survival", "level": 2 } ], - "proficiencies": [ "prof_food_prep", "prof_knife_skills", "prof_intro_biology", "prof_wp_basic_bird", "prof_knives_familiar" ], + "proficiencies": [ + "prof_food_prep", + "prof_knife_skills", + "prof_intro_biology", + "prof_wp_basic_bird", + "prof_knives_familiar", + "prof_butchering_basic", + "prof_butchering_adv", + "prof_skinning_basic", + "prof_skinning_adv", + "prof_butchery_offal" + ], "items": { "both": { "entries": [ @@ -5195,7 +5209,10 @@ "prof_bow_expert", "prof_fletching", "prof_carving", - "prof_knives_familiar" + "prof_knives_familiar", + "prof_butchering_basic", + "prof_skinning_basic", + "prof_butchery_offal" ], "items": { "both": { diff --git a/data/json/proficiencies/butchering.json b/data/json/proficiencies/butchering.json new file mode 100644 index 0000000000000..090cd4ba849f6 --- /dev/null +++ b/data/json/proficiencies/butchering.json @@ -0,0 +1,47 @@ +[ + { + "type": "proficiency", + "id": "prof_butchering_basic", + "category": "prof_butchering", + "name": { "str": "Principles of Butchering" }, + "description": "You know how to pick up most of the meat from the animal body.", + "can_learn": true, + "time_to_learn": "4 h" + }, + { + "type": "proficiency", + "id": "prof_butchering_adv", + "category": "prof_butchering", + "name": { "str": "Butchering Expert" }, + "description": "There is very little meat left after your skillful knife movements.", + "can_learn": true, + "time_to_learn": "40 h" + }, + { + "type": "proficiency", + "id": "prof_skinning_basic", + "category": "prof_butchering", + "name": { "str": "Principles of Skinning" }, + "description": "You stopped making holes in the skin of animals you butcher.", + "can_learn": true, + "time_to_learn": "4 h" + }, + { + "type": "proficiency", + "id": "prof_skinning_adv", + "category": "prof_butchering", + "name": { "str": "Skinning Expert" }, + "description": "You really know how to skin the animal.", + "can_learn": true, + "time_to_learn": "40 h" + }, + { + "type": "proficiency", + "id": "prof_butchery_offal", + "category": "prof_butchering", + "name": { "str": "Evisceration" }, + "description": "You know how to properly remove offals from the body.", + "can_learn": true, + "time_to_learn": "4 h" + } +] diff --git a/data/json/proficiencies/proficiency_categories.json b/data/json/proficiencies/proficiency_categories.json index 5d95e0d26a2ce..3eabe88e57fc2 100644 --- a/data/json/proficiencies/proficiency_categories.json +++ b/data/json/proficiencies/proficiency_categories.json @@ -23,6 +23,12 @@ "name": "Food Handling", "description": "Proficiencies for cooking and food preparation, as well as experience with food handling tools." }, + { + "type": "proficiency_category", + "id": "prof_butchering", + "name": "Butchering", + "description": "Proficiencies for carving and proper dressing of meat and skin of animals." + }, { "type": "proficiency_category", "id": "prof_electronic", diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 989825905925d..4a25510e6c7f1 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -231,7 +231,12 @@ static const morale_type morale_feeling_good( "morale_feeling_good" ); static const morale_type morale_game( "morale_game" ); static const morale_type morale_tree_communion( "morale_tree_communion" ); +static const proficiency_id proficiency_prof_butchering_adv( "prof_butchering_adv" ); +static const proficiency_id proficiency_prof_butchering_basic( "prof_butchering_basic" ); +static const proficiency_id proficiency_prof_butchery_offal( "prof_butchery_offal" ); static const proficiency_id proficiency_prof_dissect_humans( "prof_dissect_humans" ); +static const proficiency_id proficiency_prof_skinning_adv( "prof_skinning_adv" ); +static const proficiency_id proficiency_prof_skinning_basic( "prof_skinning_basic" ); static const quality_id qual_BUTCHER( "BUTCHER" ); static const quality_id qual_CUT_FINE( "CUT_FINE" ); @@ -811,6 +816,25 @@ int butcher_time_to_cut( Character &you, const item &corpse_item, const butcher_ if( corpse_item.has_flag( flag_QUARTERED ) ) { time_to_cut /= 4; } + + if( corpse.harvest->has_entry_type( harvest_drop_flesh ) && ( action == butcher_type::FULL || + action == butcher_type::QUICK ) ) { + time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); + time_to_cut *= 1.75 - ( 0.75 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); + + } + + if( corpse.harvest->has_entry_type( harvest_drop_offal ) && ( action == butcher_type::FULL || + action == butcher_type::QUICK || action == butcher_type::FIELD_DRESS ) ) { + time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_butchery_offal ) ); + } + + // Skinning decrease the cutting speed only a little, and decreases the output mostly + if( corpse.harvest->has_entry_type( harvest_drop_skin ) && ( action == butcher_type::FULL || + action == butcher_type::QUICK || action == butcher_type::SKIN ) ) { + time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_skinning_adv ) ); + } + time_to_cut *= ( 1.0f - ( get_player_character().get_num_crafting_helpers( 3 ) / 10.0f ) ); return time_to_cut; } @@ -950,7 +974,7 @@ static std::vector create_charge_items( const itype *drop, int count, // Returns false if the calling function should abort static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Character &you, - butcher_type action ) + butcher_type action, int moves_total ) { const int tool_quality = you.max_quality( action == butcher_type::DISSECT ? qual_CUT_FINE : qual_BUTCHER, PICKUP_RANGE ); @@ -1057,6 +1081,20 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte roll = 0; } + if( entry.type == harvest_drop_flesh ) { + roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); + roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); + } + + if( entry.type == harvest_drop_offal ) { + roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_butchery_offal ) ); + } + + if( entry.type == harvest_drop_skin ) { + roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_skinning_adv ) ); + roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_skinning_basic ) ); + } + // QUICK BUTCHERY if( action == butcher_type::QUICK ) { if( entry.type == harvest_drop_flesh ) { @@ -1267,6 +1305,34 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte 0 ) + 4 ); } + // handle our prof training + + if( mt.harvest->has_entry_type( harvest_drop_flesh ) ) { + if( you.has_proficiency( proficiency_prof_butchering_basic ) ) { + you.practice_proficiency( proficiency_prof_butchering_adv, + time_duration::from_moves( moves_total ) ); + } else { + you.practice_proficiency( proficiency_prof_butchering_basic, + time_duration::from_moves( moves_total ) ); + } + } + + if( mt.harvest->has_entry_type( harvest_drop_offal ) ) { + you.practice_proficiency( proficiency_prof_butchery_offal, + time_duration::from_moves( moves_total ) ); + } + + if( mt.harvest->has_entry_type( harvest_drop_skin ) ) { + if( you.has_proficiency( proficiency_prof_skinning_basic ) ) { + you.practice_proficiency( proficiency_prof_skinning_adv, + time_duration::from_moves( moves_total ) ); + } else { + you.practice_proficiency( proficiency_prof_skinning_basic, + time_duration::from_moves( moves_total ) ); + } + } + + // after this point, if there was a liquid handling from the harvest, // and the liquid handling was interrupted, then the activity was canceled, // therefore operations on this activity's targets and values may be invalidated. @@ -1353,7 +1419,7 @@ void activity_handlers::butcher_finish( player_activity *act, Character *you ) } // all action types - yields - if( !butchery_drops_harvest( &corpse_item, *corpse, *you, action ) ) { + if( !butchery_drops_harvest( &corpse_item, *corpse, *you, action, act->moves_total ) ) { // FATAL FAILURE add_msg( m_warning, SNIPPET.random_from_category( "harvest_drop_default_dissect_failed" ).value_or( translation() ).translated() ); From d43a7cb9cc7b375159ab18d4702bda663e5569f3 Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Tue, 3 Sep 2024 00:03:45 +0200 Subject: [PATCH 02/14] Thank you Ferret Co-authored-by: TheShadowFerret <99621099+TheShadowFerret@users.noreply.github.com> --- data/json/hobbies.json | 1 - data/json/proficiencies/butchering.json | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/data/json/hobbies.json b/data/json/hobbies.json index 0d7a400909b57..decf2444b6f95 100644 --- a/data/json/hobbies.json +++ b/data/json/hobbies.json @@ -840,7 +840,6 @@ "prof_knives_familiar", "prof_knife_skills", "prof_butchering_basic", - "prof_butchering_adv", "prof_skinning_basic", "prof_butchery_offal" ] diff --git a/data/json/proficiencies/butchering.json b/data/json/proficiencies/butchering.json index 090cd4ba849f6..63973853b9c96 100644 --- a/data/json/proficiencies/butchering.json +++ b/data/json/proficiencies/butchering.json @@ -15,7 +15,8 @@ "name": { "str": "Butchering Expert" }, "description": "There is very little meat left after your skillful knife movements.", "can_learn": true, - "time_to_learn": "40 h" + "time_to_learn": "40 h", + "required_proficiencies": [ "prof_butchering_basic" ] }, { "type": "proficiency", @@ -33,7 +34,8 @@ "name": { "str": "Skinning Expert" }, "description": "You really know how to skin the animal.", "can_learn": true, - "time_to_learn": "40 h" + "time_to_learn": "40 h", + "required_proficiencies": [ "prof_skinning_basic" ] }, { "type": "proficiency", From c31d830a80c61b9d5a4ff2678616a2262d101ee3 Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Tue, 3 Sep 2024 00:21:19 +0200 Subject: [PATCH 03/14] Update data/json/hobbies.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- data/json/hobbies.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/data/json/hobbies.json b/data/json/hobbies.json index decf2444b6f95..f0a4903f238dc 100644 --- a/data/json/hobbies.json +++ b/data/json/hobbies.json @@ -836,13 +836,7 @@ "points": -3, "traits": [ "ANTIFRUIT", "MEATARIAN" ], "skills": [ { "level": 2, "name": "survival" }, { "level": 2, "name": "cooking" } ], - "proficiencies": [ - "prof_knives_familiar", - "prof_knife_skills", - "prof_butchering_basic", - "prof_skinning_basic", - "prof_butchery_offal" - ] + "proficiencies": [ "prof_knives_familiar", "prof_knife_skills", "prof_butchering_basic", "prof_skinning_basic", "prof_butchery_offal" ] }, { "type": "profession", From 6ef9130b2b94c9e35979c69a92926d7993e9e0ce Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:22:18 +0200 Subject: [PATCH 04/14] remove prof_butchery_offal, tweak learning of the profs slightly --- data/json/hobbies.json | 2 +- data/json/professions.json | 9 +++---- data/json/proficiencies/butchering.json | 9 ------- src/activity_handlers.cpp | 34 +++++++------------------ 4 files changed, 13 insertions(+), 41 deletions(-) diff --git a/data/json/hobbies.json b/data/json/hobbies.json index f0a4903f238dc..013e2e70c8f42 100644 --- a/data/json/hobbies.json +++ b/data/json/hobbies.json @@ -836,7 +836,7 @@ "points": -3, "traits": [ "ANTIFRUIT", "MEATARIAN" ], "skills": [ { "level": 2, "name": "survival" }, { "level": 2, "name": "cooking" } ], - "proficiencies": [ "prof_knives_familiar", "prof_knife_skills", "prof_butchering_basic", "prof_skinning_basic", "prof_butchery_offal" ] + "proficiencies": [ "prof_knives_familiar", "prof_knife_skills", "prof_butchering_basic", "prof_skinning_basic" ] }, { "type": "profession", diff --git a/data/json/professions.json b/data/json/professions.json index 752bb3daddd5c..2078683f1f057 100644 --- a/data/json/professions.json +++ b/data/json/professions.json @@ -890,8 +890,7 @@ "prof_frying", "prof_knives_familiar", "prof_butchering_basic", - "prof_skinning_basic", - "prof_butchery_offal" + "prof_skinning_basic" ], "items": { "both": { @@ -926,8 +925,7 @@ "prof_butchering_basic", "prof_butchering_adv", "prof_skinning_basic", - "prof_skinning_adv", - "prof_butchery_offal" + "prof_skinning_adv" ], "items": { "both": { @@ -5211,8 +5209,7 @@ "prof_carving", "prof_knives_familiar", "prof_butchering_basic", - "prof_skinning_basic", - "prof_butchery_offal" + "prof_skinning_basic" ], "items": { "both": { diff --git a/data/json/proficiencies/butchering.json b/data/json/proficiencies/butchering.json index 63973853b9c96..d343a7d08d66d 100644 --- a/data/json/proficiencies/butchering.json +++ b/data/json/proficiencies/butchering.json @@ -36,14 +36,5 @@ "can_learn": true, "time_to_learn": "40 h", "required_proficiencies": [ "prof_skinning_basic" ] - }, - { - "type": "proficiency", - "id": "prof_butchery_offal", - "category": "prof_butchering", - "name": { "str": "Evisceration" }, - "description": "You know how to properly remove offals from the body.", - "can_learn": true, - "time_to_learn": "4 h" } ] diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 4a25510e6c7f1..123ed9dea7a6f 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -233,7 +233,6 @@ static const morale_type morale_tree_communion( "morale_tree_communion" ); static const proficiency_id proficiency_prof_butchering_adv( "prof_butchering_adv" ); static const proficiency_id proficiency_prof_butchering_basic( "prof_butchering_basic" ); -static const proficiency_id proficiency_prof_butchery_offal( "prof_butchery_offal" ); static const proficiency_id proficiency_prof_dissect_humans( "prof_dissect_humans" ); static const proficiency_id proficiency_prof_skinning_adv( "prof_skinning_adv" ); static const proficiency_id proficiency_prof_skinning_basic( "prof_skinning_basic" ); @@ -817,18 +816,11 @@ int butcher_time_to_cut( Character &you, const item &corpse_item, const butcher_ time_to_cut /= 4; } - if( corpse.harvest->has_entry_type( harvest_drop_flesh ) && ( action == butcher_type::FULL || - action == butcher_type::QUICK ) ) { + if( ( corpse.harvest->has_entry_type( harvest_drop_flesh ) || corpse.harvest->has_entry_type( harvest_drop_offal ) ) && ( action == butcher_type::FULL || + action == butcher_type::QUICK || action == butcher_type::FIELD_DRESS ) ) ) { time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); time_to_cut *= 1.75 - ( 0.75 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); - } - - if( corpse.harvest->has_entry_type( harvest_drop_offal ) && ( action == butcher_type::FULL || - action == butcher_type::QUICK || action == butcher_type::FIELD_DRESS ) ) { - time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_butchery_offal ) ); - } - // Skinning decrease the cutting speed only a little, and decreases the output mostly if( corpse.harvest->has_entry_type( harvest_drop_skin ) && ( action == butcher_type::FULL || action == butcher_type::QUICK || action == butcher_type::SKIN ) ) { @@ -1081,15 +1073,11 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte roll = 0; } - if( entry.type == harvest_drop_flesh ) { + if( entry.type == harvest_drop_flesh || entry.type == harvest_drop_offal ) { roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); } - if( entry.type == harvest_drop_offal ) { - roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_butchery_offal ) ); - } - if( entry.type == harvest_drop_skin ) { roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_skinning_adv ) ); roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_skinning_basic ) ); @@ -1306,29 +1294,25 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte } // handle our prof training + // 40% time to skin the animal, 40% to actually butcher it, 20 for mics activities - if( mt.harvest->has_entry_type( harvest_drop_flesh ) ) { + if( mt.harvest->has_entry_type( harvest_drop_flesh ) || mt.harvest->has_entry_type( harvest_drop_offal ) ) { if( you.has_proficiency( proficiency_prof_butchering_basic ) ) { you.practice_proficiency( proficiency_prof_butchering_adv, - time_duration::from_moves( moves_total ) ); + time_duration::from_moves( moves_total / 2.5 ) ); } else { you.practice_proficiency( proficiency_prof_butchering_basic, - time_duration::from_moves( moves_total ) ); + time_duration::from_moves( moves_total / 2.5 ) ); } } - if( mt.harvest->has_entry_type( harvest_drop_offal ) ) { - you.practice_proficiency( proficiency_prof_butchery_offal, - time_duration::from_moves( moves_total ) ); - } - if( mt.harvest->has_entry_type( harvest_drop_skin ) ) { if( you.has_proficiency( proficiency_prof_skinning_basic ) ) { you.practice_proficiency( proficiency_prof_skinning_adv, - time_duration::from_moves( moves_total ) ); + time_duration::from_moves( moves_total / 2.5 ) ); } else { you.practice_proficiency( proficiency_prof_skinning_basic, - time_duration::from_moves( moves_total ) ); + time_duration::from_moves( moves_total / 2.5 ) ); } } From cbdc631b3e72d0d5f4576fe76909412eab086a92 Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:25:48 +0200 Subject: [PATCH 05/14] Astyle Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/activity_handlers.cpp | 54 +++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 123ed9dea7a6f..46b4bcf95d1d1 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -816,8 +816,9 @@ int butcher_time_to_cut( Character &you, const item &corpse_item, const butcher_ time_to_cut /= 4; } - if( ( corpse.harvest->has_entry_type( harvest_drop_flesh ) || corpse.harvest->has_entry_type( harvest_drop_offal ) ) && ( action == butcher_type::FULL || - action == butcher_type::QUICK || action == butcher_type::FIELD_DRESS ) ) ) { + if( ( corpse.harvest->has_entry_type( harvest_drop_flesh ) || + corpse.harvest->has_entry_type( harvest_drop_offal ) ) && ( action == butcher_type::FULL || + action == butcher_type::QUICK || action == butcher_type::FIELD_DRESS ) ) ) { time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); time_to_cut *= 1.75 - ( 0.75 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); @@ -1072,15 +1073,17 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte if( corpse_item->has_flag( flag_SKINNED ) && entry.type == harvest_drop_skin ) { roll = 0; } - - if( entry.type == harvest_drop_flesh || entry.type == harvest_drop_offal ) { - roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); - roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); + if( corpse_item->has_flag( flag_SKINNED ) ) { + monster_weight = std::round( 0.85 * monster_weight ); } + const int entry_count = ( action == butcher_type::DISSECT && + !mt.dissect.is_empty() ) ? mt.dissect->get_all().size() : mt.harvest->get_all().size(); + int monster_weight_remaining = monster_weight; + int practice = 0; - if( entry.type == harvest_drop_skin ) { - roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_skinning_adv ) ); - roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_skinning_basic ) ); + if( mt.harvest.is_null() ) { + debugmsg( "ERROR: %s has no harvest entry.", mt.id.c_str() ); + return false; } // QUICK BUTCHERY @@ -1296,25 +1299,26 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte // handle our prof training // 40% time to skin the animal, 40% to actually butcher it, 20 for mics activities - if( mt.harvest->has_entry_type( harvest_drop_flesh ) || mt.harvest->has_entry_type( harvest_drop_offal ) ) { - if( you.has_proficiency( proficiency_prof_butchering_basic ) ) { - you.practice_proficiency( proficiency_prof_butchering_adv, - time_duration::from_moves( moves_total / 2.5 ) ); - } else { - you.practice_proficiency( proficiency_prof_butchering_basic, - time_duration::from_moves( moves_total / 2.5 ) ); + if( mt.harvest->has_entry_type( harvest_drop_flesh ) || + mt.harvest->has_entry_type( harvest_drop_offal ) ) { + if( you.has_proficiency( proficiency_prof_butchering_basic ) ) { + you.practice_proficiency( proficiency_prof_butchering_adv, + time_duration::from_moves( moves_total / 2.5 ) ); + } else { + you.practice_proficiency( proficiency_prof_butchering_basic, + time_duration::from_moves( moves_total / 2.5 ) ); + } } - } - if( mt.harvest->has_entry_type( harvest_drop_skin ) ) { - if( you.has_proficiency( proficiency_prof_skinning_basic ) ) { - you.practice_proficiency( proficiency_prof_skinning_adv, - time_duration::from_moves( moves_total / 2.5 ) ); - } else { - you.practice_proficiency( proficiency_prof_skinning_basic, - time_duration::from_moves( moves_total / 2.5 ) ); + if( mt.harvest->has_entry_type( harvest_drop_skin ) ) { + if( you.has_proficiency( proficiency_prof_skinning_basic ) ) { + you.practice_proficiency( proficiency_prof_skinning_adv, + time_duration::from_moves( moves_total / 2.5 ) ); + } else { + you.practice_proficiency( proficiency_prof_skinning_basic, + time_duration::from_moves( moves_total / 2.5 ) ); + } } - } // after this point, if there was a liquid handling from the harvest, From 86de89cd0f7adb563c4338a4a93a0c689a1861e9 Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:27:58 +0200 Subject: [PATCH 06/14] Update src/activity_handlers.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/activity_handlers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 46b4bcf95d1d1..975e425dce883 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -1296,8 +1296,8 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte 0 ) + 4 ); } - // handle our prof training - // 40% time to skin the animal, 40% to actually butcher it, 20 for mics activities + // handle our prof training + // 40% time to skin the animal, 40% to actually butcher it, 20 for mics activities if( mt.harvest->has_entry_type( harvest_drop_flesh ) || mt.harvest->has_entry_type( harvest_drop_offal ) ) { From d54768fc2c1c64a10bb55160949904ec7cd4d500 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Tue, 3 Sep 2024 17:56:07 +0200 Subject: [PATCH 07/14] fix syntax error --- src/activity_handlers.cpp | 44 ++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 975e425dce883..e9d41fd0b46f3 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -818,14 +818,16 @@ int butcher_time_to_cut( Character &you, const item &corpse_item, const butcher_ if( ( corpse.harvest->has_entry_type( harvest_drop_flesh ) || corpse.harvest->has_entry_type( harvest_drop_offal ) ) && ( action == butcher_type::FULL || - action == butcher_type::QUICK || action == butcher_type::FIELD_DRESS ) ) ) { + action == butcher_type::QUICK || action == butcher_type::FIELD_DRESS ) ) { time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); time_to_cut *= 1.75 - ( 0.75 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); + } // Skinning decrease the cutting speed only a little, and decreases the output mostly if( corpse.harvest->has_entry_type( harvest_drop_skin ) && ( action == butcher_type::FULL || action == butcher_type::QUICK || action == butcher_type::SKIN ) ) { - time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_skinning_adv ) ); + time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_skinning_basic ) ); + } time_to_cut *= ( 1.0f - ( get_player_character().get_num_crafting_helpers( 3 ) / 10.0f ) ); @@ -1296,29 +1298,29 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte 0 ) + 4 ); } - // handle our prof training - // 40% time to skin the animal, 40% to actually butcher it, 20 for mics activities + // handle our prof training + // 40% time to skin the animal, 40% to actually butcher it, 20 for mics activities - if( mt.harvest->has_entry_type( harvest_drop_flesh ) || - mt.harvest->has_entry_type( harvest_drop_offal ) ) { - if( you.has_proficiency( proficiency_prof_butchering_basic ) ) { - you.practice_proficiency( proficiency_prof_butchering_adv, - time_duration::from_moves( moves_total / 2.5 ) ); - } else { - you.practice_proficiency( proficiency_prof_butchering_basic, - time_duration::from_moves( moves_total / 2.5 ) ); - } + if( mt.harvest->has_entry_type( harvest_drop_flesh ) || + mt.harvest->has_entry_type( harvest_drop_offal ) ) { + if( you.has_proficiency( proficiency_prof_butchering_basic ) ) { + you.practice_proficiency( proficiency_prof_butchering_adv, + time_duration::from_moves( moves_total / 2.5 ) ); + } else { + you.practice_proficiency( proficiency_prof_butchering_basic, + time_duration::from_moves( moves_total / 2.5 ) ); } + } - if( mt.harvest->has_entry_type( harvest_drop_skin ) ) { - if( you.has_proficiency( proficiency_prof_skinning_basic ) ) { - you.practice_proficiency( proficiency_prof_skinning_adv, - time_duration::from_moves( moves_total / 2.5 ) ); - } else { - you.practice_proficiency( proficiency_prof_skinning_basic, - time_duration::from_moves( moves_total / 2.5 ) ); - } + if( mt.harvest->has_entry_type( harvest_drop_skin ) ) { + if( you.has_proficiency( proficiency_prof_skinning_basic ) ) { + you.practice_proficiency( proficiency_prof_skinning_adv, + time_duration::from_moves( moves_total / 2.5 ) ); + } else { + you.practice_proficiency( proficiency_prof_skinning_basic, + time_duration::from_moves( moves_total / 2.5 ) ); } + } // after this point, if there was a liquid handling from the harvest, From 36fe3685386284176d6d01b27347b86e091907fa Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Tue, 3 Sep 2024 22:51:23 +0200 Subject: [PATCH 08/14] fix whatever gods of github messed up in my PR --- src/activity_handlers.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index e9d41fd0b46f3..83ff32e53ae7a 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -1075,17 +1075,15 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte if( corpse_item->has_flag( flag_SKINNED ) && entry.type == harvest_drop_skin ) { roll = 0; } - if( corpse_item->has_flag( flag_SKINNED ) ) { - monster_weight = std::round( 0.85 * monster_weight ); + + if( entry.type == harvest_drop_flesh ) { + roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); + roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); } - const int entry_count = ( action == butcher_type::DISSECT && - !mt.dissect.is_empty() ) ? mt.dissect->get_all().size() : mt.harvest->get_all().size(); - int monster_weight_remaining = monster_weight; - int practice = 0; - if( mt.harvest.is_null() ) { - debugmsg( "ERROR: %s has no harvest entry.", mt.id.c_str() ); - return false; + if( entry.type == harvest_drop_skin ) { + roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_skinning_adv ) ); + roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_skinning_basic ) ); } // QUICK BUTCHERY @@ -1322,7 +1320,6 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte } } - // after this point, if there was a liquid handling from the harvest, // and the liquid handling was interrupted, then the activity was canceled, // therefore operations on this activity's targets and values may be invalidated. From 0aa4abd02982c295035aac98cc5e5e28c13a896f Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Tue, 3 Sep 2024 23:00:04 +0200 Subject: [PATCH 09/14] tweak learning time since now leaning is not count as all the time you spend butchering --- data/json/proficiencies/butchering.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/json/proficiencies/butchering.json b/data/json/proficiencies/butchering.json index d343a7d08d66d..57b6ff4fba2a1 100644 --- a/data/json/proficiencies/butchering.json +++ b/data/json/proficiencies/butchering.json @@ -6,7 +6,7 @@ "name": { "str": "Principles of Butchering" }, "description": "You know how to pick up most of the meat from the animal body.", "can_learn": true, - "time_to_learn": "4 h" + "time_to_learn": "2 h" }, { "type": "proficiency", @@ -15,7 +15,7 @@ "name": { "str": "Butchering Expert" }, "description": "There is very little meat left after your skillful knife movements.", "can_learn": true, - "time_to_learn": "40 h", + "time_to_learn": "25 h", "required_proficiencies": [ "prof_butchering_basic" ] }, { @@ -25,7 +25,7 @@ "name": { "str": "Principles of Skinning" }, "description": "You stopped making holes in the skin of animals you butcher.", "can_learn": true, - "time_to_learn": "4 h" + "time_to_learn": "2 h" }, { "type": "proficiency", @@ -34,7 +34,7 @@ "name": { "str": "Skinning Expert" }, "description": "You really know how to skin the animal.", "can_learn": true, - "time_to_learn": "40 h", + "time_to_learn": "25 h", "required_proficiencies": [ "prof_skinning_basic" ] } ] From a9143ea7bd829b10c240b860779960c1962f5d8d Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Wed, 4 Sep 2024 19:55:19 +0200 Subject: [PATCH 10/14] change speeds, influence and training as it was discussed --- src/activity_handlers.cpp | 111 ++++++++++++++++++++++++++++++-------- 1 file changed, 89 insertions(+), 22 deletions(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 83ff32e53ae7a..f6bd7d1b6ce78 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -816,18 +816,33 @@ int butcher_time_to_cut( Character &you, const item &corpse_item, const butcher_ time_to_cut /= 4; } - if( ( corpse.harvest->has_entry_type( harvest_drop_flesh ) || - corpse.harvest->has_entry_type( harvest_drop_offal ) ) && ( action == butcher_type::FULL || - action == butcher_type::QUICK || action == butcher_type::FIELD_DRESS ) ) { - time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); - time_to_cut *= 1.75 - ( 0.75 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); + double butch_basic = you.get_proficiency_practice( proficiency_prof_butchering_basic ); + double butch_adv = you.get_proficiency_practice( proficiency_prof_butchering_adv ); + double skin_basic = you.get_proficiency_practice( proficiency_prof_skinning_basic ); + double penalty_small = 0.25; + double penalty_big = 0.75; + + if( action == butcher_type::FULL ) { + // 40% of butchering and gutting, 40% of skinning, 20% another activities + time_to_cut *= 1 + ( penalty_small * ( 1 - butch_adv ) * 0.4 ); + time_to_cut *= 1 + ( penalty_big * ( 1 - butch_basic ) * 0.4 ); + time_to_cut *= 1 + ( penalty_small * ( 1 - skin_basic ) * 0.4 ); } - // Skinning decrease the cutting speed only a little, and decreases the output mostly - if( corpse.harvest->has_entry_type( harvest_drop_skin ) && ( action == butcher_type::FULL || - action == butcher_type::QUICK || action == butcher_type::SKIN ) ) { - time_to_cut *= 1.25 - ( 0.25 * you.get_proficiency_practice( proficiency_prof_skinning_basic ) ); + if( action == butcher_type::QUICK ) { + // 70% of butchery, 15% skinning, 15% another activities + time_to_cut *= 1 + ( penalty_small * ( 1 - butch_adv ) * 0.7 ); + time_to_cut *= 1 + ( penalty_big * ( 1 - butch_basic ) * 0.7 ); + time_to_cut *= 1 + ( penalty_small * ( 1 - skin_basic ) * 0.15 ); + } + if( action == butcher_type::FIELD_DRESS ) { + time_to_cut *= 1 + ( penalty_small * ( 1 - butch_adv ) ); + time_to_cut *= 1 + ( penalty_big * ( 1 - butch_basic ) ); + } + + if( action == butcher_type::SKIN ) { + time_to_cut *= 1 + ( penalty_small * ( 1 - skin_basic ) ); } time_to_cut *= ( 1.0f - ( get_player_character().get_num_crafting_helpers( 3 ) / 10.0f ) ); @@ -1036,6 +1051,7 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte } map &here = get_map(); + for( const harvest_entry &entry : ( action == butcher_type::DISSECT && !mt.dissect.is_empty() ) ? *mt.dissect : *mt.harvest ) { const int skill_level = butchery_dissect_skill_level( you, tool_quality, entry.type ); @@ -1076,14 +1092,20 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte roll = 0; } - if( entry.type == harvest_drop_flesh ) { - roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_butchering_adv ) ); - roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_butchering_basic ) ); + const double butch_basic = you.get_proficiency_practice( proficiency_prof_butchering_basic ); + const double butch_adv = you.get_proficiency_practice( proficiency_prof_butchering_basic ); + const double skin_basic = you.get_proficiency_practice( proficiency_prof_skinning_basic ); + const double skin_adv = you.get_proficiency_practice( proficiency_prof_skinning_adv ); + const double penalty_small = 0.15; + const double penalty_big = 2; + + if( entry.type == harvest_drop_flesh || entry.type == harvest_drop_offal ) { + roll /= 1 + ( penalty_small * ( 1 - butch_basic ) ); } if( entry.type == harvest_drop_skin ) { - roll /= 1.13 - ( 0.13 * you.get_proficiency_practice( proficiency_prof_skinning_adv ) ); - roll /= 1.6 - ( 0.6 * you.get_proficiency_practice( proficiency_prof_skinning_basic ) ); + roll /= 1 + ( penalty_big * ( 1 - skin_basic ) ); + roll /= 1 + ( penalty_small * ( 1 - skin_adv ) ); } // QUICK BUTCHERY @@ -1297,26 +1319,71 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte } // handle our prof training - // 40% time to skin the animal, 40% to actually butcher it, 20 for mics activities + if( action == butcher_type::FULL && ( mt.harvest->has_entry_type( harvest_drop_flesh ) || + mt.harvest->has_entry_type( harvest_drop_offal ) ) ) { + // 40% of butchering and gutting, 40% of skinning, 20% another activities + if( you.has_proficiency( proficiency_prof_butchering_basic ) ) { + you.practice_proficiency( proficiency_prof_butchering_adv, + time_duration::from_moves( moves_total * 0.4 ) ); + } else { + you.practice_proficiency( proficiency_prof_butchering_basic, + time_duration::from_moves( moves_total * 0.4 ) ); + } + } + + if( action == butcher_type::FULL && mt.harvest->has_entry_type( harvest_drop_skin ) ) { + // 40% of butchering and gutting, 40% of skinning, 20% another activities + if( you.has_proficiency( proficiency_prof_skinning_basic ) ) { + you.practice_proficiency( proficiency_prof_skinning_adv, + time_duration::from_moves( moves_total * 0.4 ) ); + } else { + you.practice_proficiency( proficiency_prof_skinning_basic, + time_duration::from_moves( moves_total * 0.4 ) ); + } + } + + if( action == butcher_type::QUICK && ( mt.harvest->has_entry_type( harvest_drop_flesh ) || + mt.harvest->has_entry_type( harvest_drop_offal ) ) ) { + // 70% of butchery, 15% skinning, 15% another activities + if( you.has_proficiency( proficiency_prof_butchering_basic ) ) { + you.practice_proficiency( proficiency_prof_butchering_adv, + time_duration::from_moves( moves_total * 0.7 ) ); + } else { + you.practice_proficiency( proficiency_prof_butchering_basic, + time_duration::from_moves( moves_total * 0.7 ) ); + } + } + + if( action == butcher_type::QUICK && mt.harvest->has_entry_type( harvest_drop_skin ) ) { + // 70% of butchery, 15% skinning, 15% another activities + if( you.has_proficiency( proficiency_prof_skinning_basic ) ) { + you.practice_proficiency( proficiency_prof_skinning_adv, + time_duration::from_moves( moves_total * 0.15 ) ); + } else { + you.practice_proficiency( proficiency_prof_skinning_basic, + time_duration::from_moves( moves_total * 0.15 ) ); + } + } - if( mt.harvest->has_entry_type( harvest_drop_flesh ) || - mt.harvest->has_entry_type( harvest_drop_offal ) ) { + if( action == butcher_type::FIELD_DRESS && ( mt.harvest->has_entry_type( harvest_drop_flesh ) || + mt.harvest->has_entry_type( harvest_drop_offal ) ) ) { if( you.has_proficiency( proficiency_prof_butchering_basic ) ) { you.practice_proficiency( proficiency_prof_butchering_adv, - time_duration::from_moves( moves_total / 2.5 ) ); + time_duration::from_moves( moves_total ) ); } else { you.practice_proficiency( proficiency_prof_butchering_basic, - time_duration::from_moves( moves_total / 2.5 ) ); + time_duration::from_moves( moves_total ) ); } } - if( mt.harvest->has_entry_type( harvest_drop_skin ) ) { + if( action == butcher_type::SKIN && mt.harvest->has_entry_type( harvest_drop_skin ) ) { + // 70% of butchery, 15% skinning, 15% another activities if( you.has_proficiency( proficiency_prof_skinning_basic ) ) { you.practice_proficiency( proficiency_prof_skinning_adv, - time_duration::from_moves( moves_total / 2.5 ) ); + time_duration::from_moves( moves_total ) ); } else { you.practice_proficiency( proficiency_prof_skinning_basic, - time_duration::from_moves( moves_total / 2.5 ) ); + time_duration::from_moves( moves_total ) ); } } From a3ac1836283f3d171e66fd9b5054f5881f2103f3 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Wed, 4 Sep 2024 21:25:55 +0200 Subject: [PATCH 11/14] penalize only time spend on this specific activity --- src/activity_handlers.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index f6bd7d1b6ce78..3a42c14f48e15 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -821,28 +821,37 @@ int butcher_time_to_cut( Character &you, const item &corpse_item, const butcher_ double skin_basic = you.get_proficiency_practice( proficiency_prof_skinning_basic ); double penalty_small = 0.25; double penalty_big = 0.75; + int prof_penalty = 0; if( action == butcher_type::FULL ) { // 40% of butchering and gutting, 40% of skinning, 20% another activities - time_to_cut *= 1 + ( penalty_small * ( 1 - butch_adv ) * 0.4 ); - time_to_cut *= 1 + ( penalty_big * ( 1 - butch_basic ) * 0.4 ); - time_to_cut *= 1 + ( penalty_small * ( 1 - skin_basic ) * 0.4 ); + prof_penalty += ( time_to_cut * 0.4 ) * penalty_small * ( 1 - butch_adv ); + prof_penalty += ( time_to_cut * 0.4 ) * penalty_big * ( 1 - butch_basic ); + prof_penalty += ( time_to_cut * 0.4 ) * penalty_small * ( 1 - skin_basic ); + + time_to_cut += prof_penalty; } if( action == butcher_type::QUICK ) { // 70% of butchery, 15% skinning, 15% another activities - time_to_cut *= 1 + ( penalty_small * ( 1 - butch_adv ) * 0.7 ); - time_to_cut *= 1 + ( penalty_big * ( 1 - butch_basic ) * 0.7 ); - time_to_cut *= 1 + ( penalty_small * ( 1 - skin_basic ) * 0.15 ); + prof_penalty += ( time_to_cut * 0.7 ) * penalty_small * ( 1 - butch_adv ); + prof_penalty += ( time_to_cut * 0.7 ) * penalty_big * ( 1 - butch_basic ); + prof_penalty += ( time_to_cut * 0.15 ) * penalty_small * ( 1 - skin_basic ); + + time_to_cut += prof_penalty; } if( action == butcher_type::FIELD_DRESS ) { - time_to_cut *= 1 + ( penalty_small * ( 1 - butch_adv ) ); - time_to_cut *= 1 + ( penalty_big * ( 1 - butch_basic ) ); + prof_penalty += time_to_cut * penalty_small * ( 1 - butch_adv ); + prof_penalty += time_to_cut * penalty_big * ( 1 - butch_basic ); + + time_to_cut += prof_penalty; } if( action == butcher_type::SKIN ) { - time_to_cut *= 1 + ( penalty_small * ( 1 - skin_basic ) ); + prof_penalty += time_to_cut * penalty_small * ( 1 - skin_basic ); + + time_to_cut += prof_penalty; } time_to_cut *= ( 1.0f - ( get_player_character().get_num_crafting_helpers( 3 ) / 10.0f ) ); From 5fa8c7eccde858f909cfcded3ab9c1b3cc6ddb87 Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Wed, 4 Sep 2024 21:36:46 +0200 Subject: [PATCH 12/14] Update src/activity_handlers.cpp --- src/activity_handlers.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 3a42c14f48e15..4b05e25763b98 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -1102,7 +1102,6 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte } const double butch_basic = you.get_proficiency_practice( proficiency_prof_butchering_basic ); - const double butch_adv = you.get_proficiency_practice( proficiency_prof_butchering_basic ); const double skin_basic = you.get_proficiency_practice( proficiency_prof_skinning_basic ); const double skin_adv = you.get_proficiency_practice( proficiency_prof_skinning_adv ); const double penalty_small = 0.15; From fdfc9331daec20fceda0061606c08240ff72aeac Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Wed, 4 Sep 2024 23:11:48 +0200 Subject: [PATCH 13/14] use much better code by IdleSol, apply penalties values by HadeanLake Co-authored-by: IdleSol <155764584+IdleSol@users.noreply.github.com> Co-authored-by: HadeanLake <69697985+HadeanLake@users.noreply.github.com> --- src/activity_handlers.cpp | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 4b05e25763b98..502da817ab18d 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -819,39 +819,31 @@ int butcher_time_to_cut( Character &you, const item &corpse_item, const butcher_ double butch_basic = you.get_proficiency_practice( proficiency_prof_butchering_basic ); double butch_adv = you.get_proficiency_practice( proficiency_prof_butchering_adv ); double skin_basic = you.get_proficiency_practice( proficiency_prof_skinning_basic ); - double penalty_small = 0.25; - double penalty_big = 0.75; + double penalty_small = 0.5; + double penalty_big = 1.5; int prof_penalty = 0; + int prof_butch_penalty = penalty_big * ( 1 - butch_basic ) + penalty_small * ( 1 - butch_adv ); + int prof_skin_penalty = penalty_small * ( 1 - skin_basic ); + + // there supposed to be a code for book mitigation, but we don't have any book fitting for this + if( action == butcher_type::FULL ) { // 40% of butchering and gutting, 40% of skinning, 20% another activities - prof_penalty += ( time_to_cut * 0.4 ) * penalty_small * ( 1 - butch_adv ); - prof_penalty += ( time_to_cut * 0.4 ) * penalty_big * ( 1 - butch_basic ); - prof_penalty += ( time_to_cut * 0.4 ) * penalty_small * ( 1 - skin_basic ); - - time_to_cut += prof_penalty; + time_to_cut *= 0.4 * ( 1 + prof_butch_penalty ) + 0.4 * ( 1 + prof_skin_penalty ) + 0.2; } if( action == butcher_type::QUICK ) { // 70% of butchery, 15% skinning, 15% another activities - prof_penalty += ( time_to_cut * 0.7 ) * penalty_small * ( 1 - butch_adv ); - prof_penalty += ( time_to_cut * 0.7 ) * penalty_big * ( 1 - butch_basic ); - prof_penalty += ( time_to_cut * 0.15 ) * penalty_small * ( 1 - skin_basic ); - - time_to_cut += prof_penalty; + time_to_cut *= 0.7 * ( 1 + prof_butch_penalty ) + 0.15 * ( 1 + prof_skin_penalty ) + 0.15; } if( action == butcher_type::FIELD_DRESS ) { - prof_penalty += time_to_cut * penalty_small * ( 1 - butch_adv ); - prof_penalty += time_to_cut * penalty_big * ( 1 - butch_basic ); - - time_to_cut += prof_penalty; + time_to_cut *= 1 + prof_butch_penalty; } if( action == butcher_type::SKIN ) { - prof_penalty += time_to_cut * penalty_small * ( 1 - skin_basic ); - - time_to_cut += prof_penalty; + time_to_cut *= 1 + prof_skin_penalty; } time_to_cut *= ( 1.0f - ( get_player_character().get_num_crafting_helpers( 3 ) / 10.0f ) ); From b27fb3232f35d9beb9461bec6b8f9810ad50db08 Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Wed, 4 Sep 2024 23:53:40 +0200 Subject: [PATCH 14/14] Apply suggestions from code review --- src/activity_handlers.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 502da817ab18d..6a4927b8b945d 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -821,7 +821,6 @@ int butcher_time_to_cut( Character &you, const item &corpse_item, const butcher_ double skin_basic = you.get_proficiency_practice( proficiency_prof_skinning_basic ); double penalty_small = 0.5; double penalty_big = 1.5; - int prof_penalty = 0; int prof_butch_penalty = penalty_big * ( 1 - butch_basic ) + penalty_small * ( 1 - butch_adv ); int prof_skin_penalty = penalty_small * ( 1 - skin_basic );