Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix - dissection drop rate #62433

Merged
merged 13 commits into from
Dec 6, 2022
20 changes: 16 additions & 4 deletions data/json/harvest_dissect.json
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,19 @@
"drop": "bio_power_storage",
"type": "bionic",
"flags": [ "FILTHY", "NO_STERILE", "NO_PACKED" ],
"faults": [ "fault_bionic_salvaged" ]
"faults": [ "fault_bionic_salvaged" ],
"base_num": [ 0, 2 ],
"scale_num": [ 0.1, 0.6 ],
"max": 5
},
{
"drop": "cyborg_harvest",
"type": "bionic_group",
"flags": [ "FILTHY", "NO_STERILE", "NO_PACKED" ],
"faults": [ "fault_bionic_salvaged" ]
"faults": [ "fault_bionic_salvaged" ],
"base_num": [ 0, 2 ],
"scale_num": [ 0.1, 0.6 ],
"max": 5
}
]
},
Expand All @@ -684,13 +690,19 @@
"drop": "Zomborg_CBM_harvest",
"type": "bionic_group",
"flags": [ "NO_STERILE", "NO_PACKED", "FILTHY" ],
"faults": [ "fault_bionic_salvaged" ]
"faults": [ "fault_bionic_salvaged" ],
"base_num": [ 0, 2 ],
"scale_num": [ 0.1, 0.6 ],
"max": 5
},
{
"drop": "Zomborg_CBM_harvest_power",
"type": "bionic_group",
"flags": [ "NO_STERILE", "NO_PACKED", "FILTHY" ],
"faults": [ "fault_bionic_salvaged" ]
"faults": [ "fault_bionic_salvaged" ],
"base_num": [ 0, 2 ],
"scale_num": [ 0.1, 0.6 ],
"max": 5
}
]
}
Expand Down
6 changes: 4 additions & 2 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static bool check_butcher_dissect( const int roll )
// Roll is reduced by corpse damage level, but to no less then 0
add_msg_debug( debugmode::DF_ACT_BUTCHER, "Roll = %i", roll );
add_msg_debug( debugmode::DF_ACT_BUTCHER, "Failure chance = %f%%",
( 19.0f / ( 10.0f + roll * 5.0f ) ) * 100.0f );
( 10.0f / ( 10.0f + roll * 5.0f ) ) * 100.0f );
const bool failed = x_in_y( 10, ( 10 + roll * 5 ) );
return !failed;
}
Expand Down Expand Up @@ -816,17 +816,19 @@ static bool butchery_drops_harvest( item *corpse_item, const mtype &mt, Characte
practice += ( 4 + butchery ) / entry_count;
const float min_num = entry.base_num.first + butchery * entry.scale_num.first;
const float max_num = entry.base_num.second + butchery * entry.scale_num.second;

int roll = 0;
// mass_ratio will override the use of base_num, scale_num, and max
if( entry.mass_ratio != 0.00f ) {
roll = static_cast<int>( std::round( entry.mass_ratio * monster_weight ) );
roll = corpse_damage_effect( roll, entry.type, corpse_item->damage_level() );
} else if( action != butcher_type::DISSECT ) {
} else {
roll = std::min<int>( entry.max, std::round( rng_float( min_num, max_num ) ) );
// will not give less than min_num defined in the JSON
roll = std::max<int>( corpse_damage_effect( roll, entry.type, corpse_item->damage_level() ),
entry.base_num.first );
}

itype_id drop_id = itype_id::NULL_ID();
const itype *drop = nullptr;
if( entry.type->is_itype() ) {
Expand Down