diff --git a/data/json/flags.json b/data/json/flags.json index d0931c7edf97..b70dc3ecef0f 100644 --- a/data/json/flags.json +++ b/data/json/flags.json @@ -1826,6 +1826,11 @@ "type": "json_flag", "context": [ ] }, + { + "id": "SHOCKING", + "type": "json_flag", + "context": [ ] + }, { "id": "SLEEP_IGNORE", "type": "json_flag", diff --git a/data/json/item_actions.json b/data/json/item_actions.json index fbf9c55e9716..ff9c4f1bb802 100644 --- a/data/json/item_actions.json +++ b/data/json/item_actions.json @@ -849,16 +849,6 @@ "id": "SHAVEKIT", "name": { "str": "Shave" } }, - { - "type": "item_action", - "id": "SHOCKTONFA_OFF", - "name": { "str": "Turn on" } - }, - { - "type": "item_action", - "id": "SHOCKTONFA_ON", - "name": { "str": "Turn off" } - }, { "type": "item_action", "id": "SIPHON", diff --git a/data/json/items/melee/bludgeons.json b/data/json/items/melee/bludgeons.json index 2bbd6ca912e5..f7e3c2ed1fd0 100644 --- a/data/json/items/melee/bludgeons.json +++ b/data/json/items/melee/bludgeons.json @@ -744,16 +744,22 @@ "id": "shock_staff", "type": "TOOL", "copy-from": "i_staff", - "name": { "str": "powered quarterstaff", "str_pl": "powered quarterstaves" }, - "description": "This is an ironshod quarterstaff that has a high-voltage stun gun built into the handle. The stun gun is wired to the metal caps at either end of the staff, allowing you to zap a dangerous opponent should beating them senseless with it prove too hazardous.", + "name": { "str": "powered quarterstaff (off)", "str_pl": "powered quarterstaves (off)" }, + "description": "This is an ironshod quarterstaff that has a high-voltage stun gun built into the handle. The stun gun is wired to the metal caps at either end of the staff, allowing you to zap a dangerous opponent with each strike. It is currently off.", "weight": "2650 g", "volume": "3250 ml", "price": "80 USD", "price_postapoc": "45 USD", "bashing": 29, "ammo": "battery", - "charges_per_use": 100, - "use_action": "TAZER", + "use_action": { + "type": "transform", + "msg": "You press a button and the staff crackles with electricity.", + "active": true, + "need_charges": 1, + "need_charges_msg": "The %s's batteries are dead.", + "target": "shock_staff_on" + }, "magazines": [ [ "battery", @@ -762,6 +768,19 @@ ], "magazine_well": "500 ml" }, + { + "id": "shock_staff_on", + "copy-from": "shock_staff", + "type": "TOOL", + "name": { "str": "powered quarterstaff (on)", "str_pl": "powered quarterstaves (on)" }, + "description": "This is an ironshod quarterstaff that has a high-voltage stun gun built into the handle. The stun gun is wired to the metal caps at either end of the staff, allowing you to zap a dangerous opponent with each strike. It is currently on.", + "revert_to": "shock_staff", + "revert_msg": "The %s's batteries run dry.", + "use_action": { "type": "transform", "msg": "You press a button and the staff turns off.", "target": "shock_staff" }, + "extend": { "flags": [ "TRADER_AVOID", "SHOCKING" ] }, + "power_draw": 5000000, + "magazine_well": "500 ml" + }, { "id": "rock_sock", "type": "GENERIC", @@ -859,15 +878,21 @@ "type": "TOOL", "copy-from": "tonfa", "name": { "str": "tactical tonfa (off)", "str_pl": "tactical tonfas (off)" }, - "description": "This is a reinforced plastic tonfa; the core is hollowed out and is filled with capacitors and a high-yield rechargeable storage battery. When a switch on the handle is pressed, a high-voltage current is transmitted to the two electrodes mounted in the end of the tonfa, and by extension to anyone unfortunate enough to be in contact with them. It also has a nifty flashlight, which is off at the moment.", + "description": "This is a reinforced plastic tonfa; the core is hollowed out and is filled with capacitors and a battery compartment. When a switch on the handle is pressed, a high-voltage current is transmitted to the two electrodes mounted in the end of the tonfa, and by extension to anyone unfortunate enough to be in contact with them. It's currently turned off.", "weight": "726 g", "volume": "2250 ml", "price": "170 USD", "price_postapoc": "25 USD", "material": [ "plastic", "steel" ], "ammo": "battery", - "charges_per_use": 1, - "use_action": "SHOCKTONFA_OFF", + "use_action": { + "type": "transform", + "msg": "You press a button and the tonfa crackles with electricity.", + "need_charges": 1, + "active": true, + "need_charges_msg": "The %s's batteries are dead.", + "target": "shocktonfa_on" + }, "flags": [ "DURABLE_MELEE", "NONCONDUCTIVE", "BELT_CLIP" ], "magazines": [ [ @@ -882,10 +907,12 @@ "copy-from": "shocktonfa_off", "type": "TOOL", "name": { "str": "tactical tonfa (on)", "str_pl": "tactical tonfas (on)" }, - "description": "This is a reinforced plastic tonfa; the core is hollowed out and is filled with capacitors and a high-yield rechargeable storage battery. When a switch on the handle is pressed, a high-voltage current is transmitted to the two electrodes mounted in the end of the tonfa, and by extension to anyone unfortunate enough to be in contact with them. It also has a nifty flashlight, which is currently active.", + "description": "This is a reinforced plastic tonfa; the core is hollowed out and is filled with capacitors and a battery compartment. When a switch on the handle is pressed, a high-voltage current is transmitted to the two electrodes mounted in the end of the tonfa, and by extension to anyone unfortunate enough to be in contact with them. It's currently turned on.", "revert_to": "shocktonfa_off", - "use_action": "SHOCKTONFA_ON", - "extend": { "flags": [ "LIGHT_20", "TRADER_AVOID" ] }, + "revert_msg": "The %s's batteries run dry.", + "use_action": { "type": "transform", "msg": "You press a button and the tonfa turns off.", "target": "shocktonfa_off" }, + "extend": { "flags": [ "TRADER_AVOID", "SHOCKING" ] }, + "power_draw": 5000000, "magazine_well": "500 ml" }, { diff --git a/data/json/items/melee/swords_and_blades.json b/data/json/items/melee/swords_and_blades.json index 533e2df29e8f..962d25f2b122 100644 --- a/data/json/items/melee/swords_and_blades.json +++ b/data/json/items/melee/swords_and_blades.json @@ -1107,12 +1107,18 @@ "id": "shock_foil", "type": "TOOL", "copy-from": "fencing_foil_sharpened", - "name": { "str": "electrified foil" }, - "description": "The modifications made to this fencing foil may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired through the electronic scoring circuit to the tip. Thrusting the sharpened tip into a foe and activating the momentary switch will deliver a painful electric shock.", + "name": { "str": "electrified foil (off)" }, + "description": "The modifications made to this fencing foil may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired through the electronic scoring circuit to the tip. Activate the switch to elecrocute your foes!", "ammo": "battery", - "charges_per_use": 100, "price_postapoc": "1250 cent", - "use_action": "TAZER", + "use_action": { + "type": "transform", + "msg": "You press a button and the foil crackles with electricity.", + "active": true, + "need_charges": 1, + "need_charges_msg": "The %s's batteries are dead.", + "target": "shock_foil_on" + }, "extend": { "flags": [ "NONCONDUCTIVE" ] }, "relative": { "volume": "250 ml", "weight": "151 g" }, "magazines": [ @@ -1123,6 +1129,19 @@ ], "magazine_well": "500 ml" }, + { + "id": "shock_foil_on", + "copy-from": "shock_foil", + "type": "TOOL", + "name": { "str": "electrified foil (on)", "str_pl": "electrified foils (on)" }, + "description": "The modifications made to this fencing foil may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired through the electronic scoring circuit to the tip. It is currently turned on.", + "revert_to": "shock_foil", + "revert_msg": "The %s's batteries run dry.", + "use_action": { "type": "transform", "msg": "You press a button and the foil turns off.", "target": "shock_foil" }, + "extend": { "flags": [ "TRADER_AVOID", "SHOCKING" ] }, + "power_draw": 5000000, + "magazine_well": "500 ml" + }, { "id": "fencing_epee", "type": "GENERIC", @@ -1148,11 +1167,17 @@ "copy-from": "fencing_epee_sharpened", "looks_like": "fencing_epee", "name": { "str": "electrified épée" }, - "description": "The modifications made to this fencing épée may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired through the electronic scoring circuit to the tip. Thrusting the sharpened tip into a foe and activating the momentary switch will deliver a painful electric shock.", + "description": "The modifications made to this fencing épée may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired through the electronic scoring circuit to the tip. Activate the switch to electrocute your foes!", "ammo": "battery", "price_postapoc": "1250 cent", - "charges_per_use": 100, - "use_action": "TAZER", + "use_action": { + "type": "transform", + "msg": "You press a button and the epee crackles with electricity.", + "active": true, + "need_charges": 1, + "need_charges_msg": "The %s's batteries are dead.", + "target": "shock_epee_on" + }, "extend": { "flags": [ "NONCONDUCTIVE" ] }, "relative": { "volume": "250 ml", "weight": "151 g" }, "magazines": [ @@ -1163,6 +1188,19 @@ ], "magazine_well": "500 ml" }, + { + "id": "shock_epee_on", + "copy-from": "shock_epee", + "type": "TOOL", + "name": { "str": "electrified epee (on)", "str_pl": "electrified epees (on)" }, + "description": "The modifications made to this fencing épée may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired through the electronic scoring circuit to the tip. It is currently turned on.", + "revert_to": "shock_epee", + "revert_msg": "The %s's batteries run dry.", + "use_action": { "type": "transform", "msg": "You press a button and the epee turns off.", "target": "shock_epee" }, + "extend": { "flags": [ "TRADER_AVOID", "SHOCKING" ] }, + "power_draw": 5000000, + "magazine_well": "500 ml" + }, { "id": "fencing_sabre", "type": "GENERIC", @@ -1186,12 +1224,18 @@ "type": "TOOL", "copy-from": "fencing_sabre_sharpened", "looks_like": "fencing_sabre", - "name": { "str": "electrified saber" }, - "description": "The modifications made to this fencing saber may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired to the tip along the saber's groove. Thrusting the sharpened tip into a foe and activating the momentary switch will deliver a painful electric shock.", + "name": { "str": "electrified saber (off)", "str_pl": "electrified sabers (off)" }, + "description": "The modifications made to this fencing saber may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired to the tip along the saber's groove. Activate the switch to electrocute your foes!", "ammo": "battery", "price_postapoc": "1250 cent", - "charges_per_use": 100, - "use_action": "TAZER", + "use_action": { + "type": "transform", + "msg": "You press a button and the sabre crackles with electricity.", + "active": true, + "need_charges": 1, + "need_charges_msg": "The %s's batteries are dead.", + "target": "shock_sabre_on" + }, "extend": { "flags": [ "NONCONDUCTIVE" ] }, "relative": { "volume": "250 ml", "weight": "151 g" }, "magazines": [ @@ -1202,6 +1246,19 @@ ], "magazine_well": "500 ml" }, + { + "id": "shock_sabre_on", + "copy-from": "shock_sabre", + "type": "TOOL", + "name": { "str": "electrified saber (on)", "str_pl": "electrified sabers (on)" }, + "description": "The modifications made to this fencing saber may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired through the electronic scoring circuit to the tip. It is currently turned on.", + "revert_to": "shock_sabre", + "revert_msg": "The %s's batteries run dry.", + "use_action": { "type": "transform", "msg": "You press a button and the foil crackles with electricity.", "target": "shock_sabre" }, + "extend": { "flags": [ "TRADER_AVOID", "SHOCKING" ] }, + "power_draw": 5000000, + "magazine_well": "500 ml" + }, { "id": "sword_cane", "type": "GENERIC", @@ -1291,6 +1348,45 @@ "qualities": [ [ "CUT", 1 ], [ "BUTCHER", 9 ] ], "flags": [ "STAB", "DURABLE_MELEE", "SHEATH_SWORD", "NONCONDUCTIVE" ] }, + { + "id": "shock_rapier_off", + "type": "TOOL", + "copy-from": "rapier", + "name": { "str": "electrified rapier (off)", "str_pl": "electrified rapiers (off)" }, + "description": "The modifications made to this rapier may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired to the tip along the saber's groove. Activate the switch to electrocute your foes!", + "ammo": "battery", + "price_postapoc": "1250 cent", + "use_action": { + "type": "transform", + "msg": "You press a button and the rapier crackles with electricity.", + "active": true, + "need_charges": 1, + "need_charges_msg": "The %s's batteries are dead.", + "target": "shock_rapier_on" + }, + "extend": { "flags": [ "NONCONDUCTIVE" ] }, + "relative": { "volume": "250 ml", "weight": "151 g" }, + "magazines": [ + [ + "battery", + [ "medium_battery_cell", "medium_plus_battery_cell", "medium_atomic_battery_cell", "medium_disposable_cell" ] + ] + ], + "magazine_well": "500 ml" + }, + { + "id": "shock_rapier_on", + "copy-from": "shock_rapier_off", + "type": "TOOL", + "name": { "str": "electrified rapier (on)", "str_pl": "electrified rapiers (on)" }, + "description": "The modifications made to this rapier may not be sporting, but they might give you an edge in this final competition. Extra effort has been made to insulate the grip and a high voltage stun gun has been attached to the guard, wired through the electronic scoring circuit to the tip. It is currently turned on.", + "revert_to": "shock_rapier_off", + "revert_msg": "The %s's batteries run dry.", + "use_action": { "type": "transform", "msg": "You press a button and the rapier turns off.", "target": "shock_rapier_off" }, + "extend": { "flags": [ "TRADER_AVOID", "SHOCKING" ] }, + "power_draw": 5000000, + "magazine_well": "500 ml" + }, { "id": "rapier_fake", "type": "GENERIC", diff --git a/data/json/recipes/weapon/bashing.json b/data/json/recipes/weapon/bashing.json index cea1eb912714..2b174f1cccba 100644 --- a/data/json/recipes/weapon/bashing.json +++ b/data/json/recipes/weapon/bashing.json @@ -207,7 +207,8 @@ "subcategory": "CSC_WEAPON_BASHING", "skill_used": "fabrication", "skills_required": [ "melee", 1 ], - "difficulty": 6, + "difficulty": 5, + "autolearn": true, "time": "30 m", "book_learn": [ [ "recipe_melee", 4 ] ], "tools": [ [ [ "mold_plastic", -1 ] ], [ [ "surface_heat", 10, "LIST" ] ] ], @@ -219,9 +220,10 @@ "category": "CC_WEAPON", "subcategory": "CSC_WEAPON_BASHING", "skill_used": "fabrication", - "skills_required": [ "bashing", 3 ], + "skills_required": [ "melee", 1 ], "difficulty": 4, "time": "30 m", + "autolearn": true, "book_learn": [ [ "recipe_melee", 3 ] ], "qualities": [ { "id": "CUT", "level": 1 } ], "components": [ [ [ "2x4", 1 ], [ "stick", 2 ] ] ] @@ -235,12 +237,13 @@ "skills_required": [ "electronics", 3 ], "difficulty": 6, "time": "45 m", + "autolearn": true, "book_learn": [ [ "recipe_melee", 5 ] ], "using": [ [ "soldering_standard", 10 ], [ "surface_heat", 10 ] ], "qualities": [ { "id": "SCREW", "level": 1 } ], "tools": [ [ [ "mold_plastic", -1 ] ] ], "components": [ - [ [ "plastic_chunk", 10 ] ], + [ [ "plastic_chunk", 10 ], [ "tonfa", 1 ] ], [ [ "amplifier", 2 ] ], [ [ "power_supply", 1 ] ], [ [ "scrap", 2 ] ], diff --git a/data/json/recipes/weapon/piercing.json b/data/json/recipes/weapon/piercing.json index 7b426622ede6..3dc2b2e7d063 100644 --- a/data/json/recipes/weapon/piercing.json +++ b/data/json/recipes/weapon/piercing.json @@ -525,6 +525,27 @@ [ [ "cable", 10 ] ] ] }, + { + "type": "recipe", + "result": "shock_rapier_off", + "category": "CC_WEAPON", + "subcategory": "CSC_WEAPON_PIERCING", + "skill_used": "fabrication", + "skills_required": [ "electronics", 3 ], + "difficulty": 3, + "time": "15 m", + "reversible": true, + "book_learn": [ [ "textbook_electronics", 3 ], [ "advanced_electronics", 3 ], [ "recipe_melee", 4 ] ], + "using": [ [ "soldering_standard", 10 ] ], + "qualities": [ { "id": "SCREW", "level": 1 } ], + "components": [ + [ [ "rapier", 1 ] ], + [ [ "fabric_hides_any", 1, "LIST" ] ], + [ [ "duct_tape", 100 ], [ "superglue", 1 ] ], + [ [ "tazer", 1 ] ], + [ [ "cable", 10 ] ] + ] + }, { "type": "recipe", "result": "estoc", diff --git a/src/flag.cpp b/src/flag.cpp index 20e60383d232..7eb799380bd9 100644 --- a/src/flag.cpp +++ b/src/flag.cpp @@ -279,6 +279,7 @@ const flag_id flag_ROLLER_ONE( "ROLLER_ONE" ); const flag_id flag_ROLLER_QUAD( "ROLLER_QUAD" ); const flag_id flag_SAFECRACK( "SAFECRACK" ); const flag_id flag_SEMITANGIBLE( "SEMITANGIBLE" ); +const flag_id flag_SHOCKING( "SHOCKING" ); const flag_id flag_SILENT( "SILENT" ); const flag_id flag_SKINNED( "SKINNED" ); const flag_id flag_SKINTIGHT( "SKINTIGHT" ); diff --git a/src/flag.h b/src/flag.h index c8e439e65cbc..dd93b851065d 100644 --- a/src/flag.h +++ b/src/flag.h @@ -283,6 +283,7 @@ extern const flag_id flag_ROLLER_ONE; extern const flag_id flag_ROLLER_QUAD; extern const flag_id flag_SAFECRACK; extern const flag_id flag_SEMITANGIBLE; +extern const flag_id flag_SHOCKING; extern const flag_id flag_SILENT; extern const flag_id flag_SKINNED; extern const flag_id flag_SKINTIGHT; diff --git a/src/item_factory.cpp b/src/item_factory.cpp index baae3fb8d581..563db32ffa03 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -1045,8 +1045,6 @@ void Item_factory::init() add_iuse( "SEED", &iuse::seed ); add_iuse( "SEWAGE", &iuse::sewage ); add_iuse( "SHAVEKIT", &iuse::shavekit ); - add_iuse( "SHOCKTONFA_OFF", &iuse::shocktonfa_off ); - add_iuse( "SHOCKTONFA_ON", &iuse::shocktonfa_on ); add_iuse( "SIPHON", &iuse::siphon ); add_iuse( "SLEEP", &iuse::sleep ); add_iuse( "SMOKING", &iuse::smoking ); diff --git a/src/iuse.cpp b/src/iuse.cpp index a7b6f006bc56..8b5c91843d57 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -270,8 +270,6 @@ static const itype_id itype_radio_on( "radio_on" ); static const itype_id itype_rebreather_on( "rebreather_on" ); static const itype_id itype_rebreather_xl_on( "rebreather_xl_on" ); static const itype_id itype_rmi2_corpse( "rmi2_corpse" ); -static const itype_id itype_shocktonfa_off( "shocktonfa_off" ); -static const itype_id itype_shocktonfa_on( "shocktonfa_on" ); static const itype_id itype_smart_phone( "smart_phone" ); static const itype_id itype_smartphone_music( "smartphone_music" ); static const itype_id itype_soap( "soap" ); @@ -4060,60 +4058,6 @@ int iuse::tazer2( player *p, item *it, bool b, const tripoint &pos ) return 0; } -int iuse::shocktonfa_off( player *p, item *it, bool t, const tripoint &pos ) -{ - int choice = uilist( _( "tactical tonfa" ), { - _( "Zap something" ), _( "Turn on light" ) - } ); - - switch( choice ) { - case 0: { - return iuse::tazer2( p, it, t, pos ); - } - case 1: { - if( !it->units_sufficient( *p ) ) { - p->add_msg_if_player( m_info, _( "The batteries are dead." ) ); - return 0; - } else { - p->add_msg_if_player( _( "You turn the light on." ) ); - it->convert( itype_shocktonfa_on ); - it->active = true; - return it->type->charges_to_use(); - } - } - } - return 0; -} - -int iuse::shocktonfa_on( player *p, item *it, bool t, const tripoint &pos ) -{ - if( t ) { // Effects while simply on - - } else { - if( !it->units_sufficient( *p ) ) { - p->add_msg_if_player( m_info, _( "Your tactical tonfa is out of power." ) ); - it->convert( itype_shocktonfa_off ); - it->active = false; - } else { - int choice = uilist( _( "tactical tonfa" ), { - _( "Zap something" ), _( "Turn off light" ) - } ); - - switch( choice ) { - case 0: { - return iuse::tazer2( p, it, t, pos ); - } - case 1: { - p->add_msg_if_player( _( "You turn off the light." ) ); - it->convert( itype_shocktonfa_off ); - it->active = false; - } - } - } - } - return 0; -} - int iuse::mp3( player *p, item *it, bool, const tripoint & ) { // TODO: avoid item id hardcoding to make this function usable for pure json-defined devices. diff --git a/src/iuse.h b/src/iuse.h index 961054be7e1b..ec4efbad7829 100644 --- a/src/iuse.h +++ b/src/iuse.h @@ -128,8 +128,6 @@ int pick_lock( player *, item *, bool, const tripoint & ); int portal( player *, item *, bool, const tripoint & ); int tazer( player *, item *, bool, const tripoint & ); int tazer2( player *, item *, bool, const tripoint & ); -int shocktonfa_off( player *, item *, bool, const tripoint & ); -int shocktonfa_on( player *, item *, bool, const tripoint & ); int mp3( player *, item *, bool, const tripoint & ); int mp3_on( player *, item *, bool, const tripoint & ); int rpgdie( player *, item *, bool, const tripoint & ); diff --git a/src/melee.cpp b/src/melee.cpp index c1ed41add914..73c8cffa087f 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -1904,6 +1904,16 @@ std::string Character::melee_special_effects( Creature &t, damage_instance &d, i } } + if( primary_weapon().has_flag( flag_SHOCKING ) ) { + d.add_damage( DT_ELECTRIC, rng( 1, 8 ) ); + + if( is_player() ) { + dump += string_format( _( "You shock %s." ), target ) + "\n"; + } else { + add_msg_player_or_npc( _( " shocks %s." ), target ); + } + } + //Hurting the wielder from poorly-chosen weapons if( weap.has_flag( flag_HURT_WHEN_WIELDED ) && x_in_y( 2, 3 ) ) { add_msg_if_player( m_bad, _( "The %s cuts your hand!" ), weap.tname() );