Skip to content

Commit

Permalink
add butchering profs
Browse files Browse the repository at this point in the history
  • Loading branch information
GuardianDll committed Sep 2, 2024
1 parent 9c0bc47 commit 2dda6c5
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 6 deletions.
9 changes: 8 additions & 1 deletion data/json/hobbies.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 20 additions & 3 deletions data/json/professions.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": [
Expand Down Expand Up @@ -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": {
Expand Down
47 changes: 47 additions & 0 deletions data/json/proficiencies/butchering.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
6 changes: 6 additions & 0 deletions data/json/proficiencies/proficiency_categories.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
70 changes: 68 additions & 2 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -950,7 +974,7 @@ static std::vector<item> 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 );
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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<int>( moves_total ) );
} else {
you.practice_proficiency( proficiency_prof_butchering_basic,
time_duration::from_moves<int>( moves_total ) );
}
}

if( mt.harvest->has_entry_type( harvest_drop_offal ) ) {
you.practice_proficiency( proficiency_prof_butchery_offal,
time_duration::from_moves<int>( 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<int>( moves_total ) );
} else {
you.practice_proficiency( proficiency_prof_skinning_basic,
time_duration::from_moves<int>( 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.
Expand Down Expand Up @@ -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() );
Expand Down

0 comments on commit 2dda6c5

Please sign in to comment.