Skip to content

Commit

Permalink
Merge pull request #77925 from AlexMooney/safecracking_combination_gu…
Browse files Browse the repository at this point in the history
…essing

Allow safecracking prof to identify safe mechanisms
  • Loading branch information
Night-Pryanik authored Nov 17, 2024
2 parents 4a03734 + b42412f commit e5cdaca
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ static const npc_class_id NC_ROBOFAC_INTERCOM( "NC_ROBOFAC_INTERCOM" );

static const proficiency_id proficiency_prof_disarming( "prof_disarming" );
static const proficiency_id proficiency_prof_parkour( "prof_parkour" );
static const proficiency_id proficiency_prof_safecracking( "prof_safecracking" );
static const proficiency_id proficiency_prof_traps( "prof_traps" );
static const proficiency_id proficiency_prof_trapsetting( "prof_trapsetting" );

Expand Down Expand Up @@ -1805,15 +1806,28 @@ void iexamine::safe( Character &you, const tripoint_bub_ms &examp )
// The dialing procedures for safes vary, I'm estimating 5 procedures.
// See https://hoogerhydesafe.com/resources/combination-lock-dialing-procedures/
// At the end of the day, that means a 1 / 80,000 chance per attempt.
// If someone is interested, they can feel free to add a proficiency for
// "safe recognition" to mitigate or eliminate this 2x and 5x factor.
if( one_in( 80000 ) ) {
you.add_msg_if_player( m_good, _( "You mess with the dial for a little bit… and it opens!" ) );
get_map().furn_set( examp, furn_f_safe_o );
return;
// If the player has the safecracking proficiency, they know the procedure.

// With the proficiency, there's a 50% chance to open after 15.4 hours of attempts.
// Without the proficiency, there's a 50% chance to open after 154 hours of attempts.
if( you.has_proficiency( proficiency_prof_safecracking ) ) {
if( one_in( 8000 ) ) {
you.add_msg_if_player( m_good, _( "You carefully dial a combination… and it opens!" ) );
get_map().furn_set( examp, furn_f_safe_o );
return;
} else {
you.add_msg_if_player( m_info, _( "You carefully dial a combination." ) );
return;
}
} else {
you.add_msg_if_player( m_info, _( "You mess with the dial for a little bit." ) );
return;
if( one_in( 80000 ) ) {
you.add_msg_if_player( m_good, _( "You mess with the dial for a little bit… and it opens!" ) );
get_map().furn_set( examp, furn_f_safe_o );
return;
} else {
you.add_msg_if_player( m_info, _( "You mess with the dial for a little bit." ) );
return;
}
}
}

Expand Down

0 comments on commit e5cdaca

Please sign in to comment.