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

Lock picking overhaul #39409

Merged
merged 22 commits into from
Apr 18, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3a0c357
Added lock picking skill
Night-Pryanik Apr 9, 2020
885f7a0
Use lock picking skill in calculation of success when picking the loc…
Night-Pryanik Apr 9, 2020
c20d09b
Fixed item damage effect on calculation
Night-Pryanik Apr 9, 2020
52f4e34
Gave several professions lockpicking as a starting skill
Night-Pryanik Apr 9, 2020
5e9f61b
Added a booklet about lockpicking
Night-Pryanik Apr 9, 2020
9b0abf1
Added lockpicking booklet to several books item groups
Night-Pryanik Apr 9, 2020
cbdd1a5
Fix json errors
Night-Pryanik Apr 9, 2020
dbbc047
Correct name
Night-Pryanik Apr 10, 2020
68b6e5e
Added doxygen documentation for the new skill
Night-Pryanik Apr 10, 2020
128110b
Added lockpicking quality to several items
Night-Pryanik Apr 10, 2020
d7a098b
Updated hardcoded lockpicking qualities for gun safe lockpicking
Night-Pryanik Apr 10, 2020
db77f22
Made lockpicking long activity
Night-Pryanik Apr 10, 2020
28df0fb
Returned comments
Night-Pryanik Apr 10, 2020
19f745b
Fixed error in coordinates
Night-Pryanik Apr 10, 2020
51dde9c
Updated lockpicking duration formula
Night-Pryanik Apr 10, 2020
868d69c
Reduced minimal difficulty of locks from 4 to 1
Night-Pryanik Apr 10, 2020
52f4a7b
Added gun safe to the list of furniture in mapdata
Night-Pryanik Apr 12, 2020
2c19f7e
Made lockpicking activity recognize furniture (gun safe in particular)
Night-Pryanik Apr 12, 2020
8f56472
Changed `examine_action` for gun safe from `gunsafe_ml` to generic `l…
Night-Pryanik Apr 12, 2020
76ad06d
Removed mentions of now-unused `gunsafe_ml` examine function
Night-Pryanik Apr 12, 2020
5dc95a6
Small fixes
Night-Pryanik Apr 13, 2020
11e42e5
static_cast to void for `ter_set` function
Night-Pryanik Apr 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions data/json/items/book/lockpick.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"id": "book_lockpick",
"type": "BOOK",
"name": { "str": "MIT Guide to Lockpicking", "str_pl": "copies of MIT Guide to Lockpicking" },
Night-Pryanik marked this conversation as resolved.
Show resolved Hide resolved
"description": "A home-made booklet with large black-and-white pictures of several types of modern locks and general information on how to crack them open.",
"weight": "400 g",
"volume": "500 ml",
"price": 100,
"price_postapoc": 5000,
"material": [ "paper" ],
"symbol": "?",
"color": "green",
"skill": "lockpick",
"max_level": 2,
"intelligence": 8,
"time": "20 m"
}
]
22 changes: 16 additions & 6 deletions data/json/professions.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@
{ "level": 2, "name": "gun" },
{ "level": 2, "name": "rifle" },
{ "level": 2, "name": "melee" },
{ "level": 2, "name": "lockpick" },
{ "level": 2, "name": "cutting" },
{ "level": 1, "name": "bashing" }
],
Expand Down Expand Up @@ -607,7 +608,8 @@
{ "level": 1, "name": "stabbing" },
{ "level": 1, "name": "unarmed" },
{ "level": 1, "name": "dodge" },
{ "level": 1, "name": "barter" }
{ "level": 1, "name": "barter" },
{ "level": 1, "name": "lockpick" }
],
"items": {
"both": {
Expand Down Expand Up @@ -783,6 +785,7 @@
{ "level": 2, "name": "cutting" },
{ "level": 2, "name": "melee" },
{ "level": 2, "name": "dodge" },
{ "level": 2, "name": "lockpick" },
{ "level": 1, "name": "firstaid" },
{ "level": 1, "name": "swimming" },
{ "level": 1, "name": "survival" }
Expand Down Expand Up @@ -1005,7 +1008,8 @@
{ "level": 2, "name": "fabrication" },
{ "level": 2, "name": "cooking" },
{ "level": 2, "name": "firstaid" },
{ "level": 2, "name": "swimming" }
{ "level": 2, "name": "swimming" },
{ "level": 1, "name": "lockpick" }
],
"items": {
"both": {
Expand Down Expand Up @@ -1483,7 +1487,7 @@
"name": { "male": "Handy Man", "female": "Handy Woman" },
"description": "You used to work at a local hardware store, and you did a lot of home renovations yourself. Now you look out at the horizon of a ruined world, and wonder - are your meager skills, and the few supplies you grabbed on the way out, sufficient to help it rebuild?",
"points": 1,
"skills": [ { "level": 2, "name": "fabrication" } ],
"skills": [ { "level": 2, "name": "fabrication" }, { "level": 1, "name": "lockpick" } ],
"items": {
"both": {
"items": [ "tank_top", "socks", "boots_steel", "pants", "multitool", "wristwatch" ],
Expand Down Expand Up @@ -1661,7 +1665,7 @@
"description": "You have done many high profile heists, but your gains mean nothing in this world. All you have left are the tools of your trade and your impeccable style.",
"points": 4,
"CBMs": [ "bio_batteries", "bio_lockpick", "bio_fingerhack", "bio_power_storage_mkII" ],
"skills": [ { "level": 1, "name": "gun" }, { "level": 1, "name": "smg" } ],
"skills": [ { "level": 1, "name": "gun" }, { "level": 1, "name": "smg" }, { "level": 3, "name": "lockpick" } ],
"items": {
"both": {
"items": [ "waistcoat", "pants", "dress_shirt", "socks", "dress_shoes", "knit_scarf", "gold_watch", "smart_phone" ],
Expand Down Expand Up @@ -2417,7 +2421,7 @@
"name": "Convict",
"description": "The Cataclysm gave you a chance to escape, but freedom comes with a steep price.",
"points": 0,
"skills": [ { "level": 1, "name": "melee" } ],
"skills": [ { "level": 1, "name": "melee" }, { "level": 1, "name": "lockpick" } ],
"items": {
"both": [ "striped_shirt", "striped_pants", "sneakers", "socks", "glass_shiv" ],
"male": [ "briefs" ],
Expand Down Expand Up @@ -2508,6 +2512,7 @@
"name": "Burglar",
"description": "You thought this would be your lucky break. Does it count as breaking and entering if everyone in town is undead?",
"points": 3,
"skills": [ { "level": 4, "name": "lockpick" } ],
"//": "A ski mask would fit the stereotype better, but wool allergy breaks this.",
"items": {
"both": [
Expand Down Expand Up @@ -3390,7 +3395,12 @@
"name": "Survivalist Jr.",
"description": "Your parents were crazy preppers who thought some \"Cataclysm\" was coming, and insisted on preparing you for it. Turns out they were right. You didn't get a chance to thank them. The only thing you can do for them now is what they always hoped you would do in the dark days ahead: survive.",
"points": 3,
"skills": [ { "level": 1, "name": "survival" }, { "level": 1, "name": "fabrication" }, { "level": 1, "name": "firstaid" } ],
"skills": [
{ "level": 1, "name": "survival" },
{ "level": 1, "name": "fabrication" },
{ "level": 1, "name": "firstaid" },
{ "level": 1, "name": "lockpick" }
],
"items": {
"both": {
"items": [
Expand Down
8 changes: 8 additions & 0 deletions data/json/skills.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@
"display_category": "display_melee",
"companion_skill_practice": [ { "skill": "hunting", "weight": 10 }, { "skill": "combat", "weight": 10 } ]
},
{
"type": "skill",
"ident": "lockpick",
"name": { "str": "lock picking" },
"description": "Your skill in picking all sorts of locks which require physical keys - from simple pin tumbler locks to intricate disc tumbler locks. Skill increases chance and decreases time required to successfully pick the lock.",
"companion_survival_rank_factor": 1,
"display_category": "display_interaction"
},
{
"type": "skill",
"ident": "weapon",
Expand Down
12 changes: 7 additions & 5 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ static const skill_id skill_cooking( "cooking" );
static const skill_id skill_electronics( "electronics" );
static const skill_id skill_fabrication( "fabrication" );
static const skill_id skill_firstaid( "firstaid" );
static const skill_id skill_lockpick( "lockpick" );
static const skill_id skill_mechanics( "mechanics" );
static const skill_id skill_survival( "survival" );

Expand Down Expand Up @@ -1310,20 +1311,21 @@ void iexamine::gunsafe_ml( player &p, const tripoint &examp )
return;
}

p.practice( skill_mechanics, 1 );
p.practice( skill_lockpick, 1 );

///\EFFECT_DEX speeds up lock picking gun safe
///\EFFECT_MECHANICS speeds up lock picking gun safe
p.moves -= std::max( 0, to_turns<int>( 10_minutes - time_duration::from_minutes( pick_quality ) )
- ( p.dex_cur + p.get_skill_level( skill_mechanics ) ) * 5 );
- ( p.dex_cur + p.get_skill_level( skill_lockpick ) ) * 5 );

///\EFFECT_DEX increases chance of lock picking gun safe
///\EFFECT_MECHANICS increases chance of lock picking gun safe
int pick_roll = ( dice( 2, p.get_skill_level( skill_mechanics ) ) + dice( 2,
p.dex_cur ) ) * pick_quality;
int pick_roll = std::pow( 1.5, p.get_skill_level( skill_lockpick ) ) *
( std::pow( 1.3, p.get_skill_level( skill_mechanics ) ) + pick_quality ) +
p.dex_cur / 4;
int door_roll = dice( 4, 30 );
if( pick_roll >= door_roll ) {
p.practice( skill_mechanics, 1 );
p.practice( skill_lockpick, 1 );
add_msg( _( "You successfully unlock the gun safe." ) );
g->m.furn_set( examp, furn_str_id( "f_safe_o" ) );
} else if( door_roll > ( 3 * pick_roll ) ) {
Expand Down
13 changes: 8 additions & 5 deletions src/iuse_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ static const bionic_id bio_syringe( "bio_syringe" );

static const skill_id skill_fabrication( "fabrication" );
static const skill_id skill_firstaid( "firstaid" );
static const skill_id skill_lockpick( "lockpick" );
static const skill_id skill_mechanics( "mechanics" );
static const skill_id skill_survival( "survival" );

Expand Down Expand Up @@ -1105,22 +1106,24 @@ int pick_lock_actor::use( player &p, item &it, bool, const tripoint & ) const
} else {
return 0;
}
p.practice( skill_mechanics, 1 );
p.practice( skill_lockpick, 1 );

/** @EFFECT_DEX speeds up door lock picking */
/** @EFFECT_MECHANICS speeds up door lock picking */
p.moves -= std::max( 0, to_turns<int>( 10_minutes - time_duration::from_minutes( pick_quality ) )
- ( p.dex_cur + p.get_skill_level( skill_mechanics ) ) * 5 );
- ( p.dex_cur + p.get_skill_level( skill_lockpick ) ) * 5 );

bool destroy = false;

/** @EFFECT_DEX improves chances of successfully picking door lock, reduces chances of bad outcomes */
/** @EFFECT_MECHANICS improves chances of successfully picking door lock, reduces chances of bad outcomes */
int pick_roll = ( dice( 2, p.get_skill_level( skill_mechanics ) ) + dice( 2,
p.dex_cur ) - it.damage_level( 4 ) / 2 ) * pick_quality;
int pick_roll = std::pow( 1.5, p.get_skill_level( skill_lockpick ) ) *
( std::pow( 1.3, p.get_skill_level( skill_mechanics ) ) +
pick_quality - it.damage() / 2000 ) +
p.dex_cur / 4;
int door_roll = dice( 4, 30 );
if( pick_roll >= door_roll ) {
p.practice( skill_mechanics, 1 );
p.practice( skill_lockpick, 1 );
p.add_msg_if_player( m_good, open_message );
g->m.ter_set( pnt, new_type );
} else if( door_roll > ( 1.5 * pick_roll ) ) {
Expand Down