Skip to content

Commit

Permalink
feat(balance): disassembly learning now depends on skill and Int more. (
Browse files Browse the repository at this point in the history
#5125)

* feat(balance): disassembly learning now works 100% instead of 25%

* style(autofix.ci): automated formatting

* Update crafting.cpp

* style(autofix.ci): automated formatting

* Update src/crafting.cpp

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: scarf <[email protected]>
  • Loading branch information
3 people authored Aug 2, 2024
1 parent e891894 commit 999f0ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2277,8 +2277,10 @@ void crafting::complete_disassemble( Character &who, const iuse_location &target

if( !dis.learn_by_disassembly.empty() && !who.knows_recipe( &dis ) ) {
if( who.can_learn_by_disassembly( dis ) ) {
// TODO: make this depend on intelligence
if( one_in( 4 ) ) {
const SkillLevelMap &char_skills = who.get_all_skills();
float skill_bonus = ( 1.0f + char_skills.exceeds_recipe_requirements( dis ) ) * std::max( 1.0f,
0.9f + ( who.int_cur * 0.025f ) );
if( x_in_y( skill_bonus, 4.0 ) ) {
// TODO: change to forward an id or a reference
who.learn_recipe( &dis.ident().obj() );
add_msg( m_good, _( "You learned a recipe for %s from disassembling it!" ),
Expand Down

0 comments on commit 999f0ae

Please sign in to comment.