From 999f0aeda4b06ed013ce54f59e13a0f65e8fe2f0 Mon Sep 17 00:00:00 2001 From: Viss Valdyr <33199510+Lamandus@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:46:43 +0200 Subject: [PATCH] feat(balance): disassembly learning now depends on skill and Int more. (#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 --- src/crafting.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/crafting.cpp b/src/crafting.cpp index 6930ee2c633b..fa38a6700ead 100644 --- a/src/crafting.cpp +++ b/src/crafting.cpp @@ -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!" ),