diff --git a/data/json/bionics.json b/data/json/bionics.json index 405ff9a667ebb..d5de08d3e99ee 100644 --- a/data/json/bionics.json +++ b/data/json/bionics.json @@ -862,6 +862,17 @@ "occupied_bodyparts": [ [ "TORSO", 1 ], [ "ARM_L", 2 ], [ "ARM_R", 2 ], [ "LEG_L", 3 ], [ "LEG_R", 3 ] ], "flags": [ "BIONIC_FAULTY" ] }, + { + "id": "bio_synaptic_regen", + "type": "bionic", + "name": "Synaptic Regeneration System", + "description": "An electromagnetic stimulator has been surgically implanted on the back of your head and along your spine, continually draining power. As long as it's active, you won't become sleep deprived; and if you're sleep deprived already, it will boost the rate of recovery while you sleep.", + "flags": [ "BIONIC_TOGGLED" ], + "occupied_bodyparts": [ [ "HEAD", 1 ], [ "TORSO", 1 ] ], + "act_cost": 0, + "react_cost": "1 kJ", + "time": 100 + }, { "id": "bio_shock", "type": "bionic", diff --git a/data/json/effects.json b/data/json/effects.json index f2bd4fc08b407..cc3042f2e3e3f 100644 --- a/data/json/effects.json +++ b/data/json/effects.json @@ -520,6 +520,26 @@ "max_duration": "15 m", "base_mods": { "vomit_chance": [ 60 ] } }, + { + "type": "effect_type", + "id": "sleep_deprived", + "name": [ "Sleep Deprived" ], + "desc": [ "Your sleep debt has been steadily increasing for a while. You should get some rest." ], + "rating": "bad", + "max_intensity": 20160, + "int_dur_factor": 240, + "base_mods": { "speed_mod": [ -5 ] }, + "scaling_mods": { "speed_mod": [ -1 ], "int_mod": [ -0.33 ], "per_mod": [ -0.33 ], "str_mod": [ -0.17 ], "dex_mod": [ -0.17 ] }, + "apply_message": "You feel weary, your body tired from lack of quality sleep.", + "remove_message": "You have finally caught up with your lost sleep, and you feel refreshed and awake for a change." + }, + { + "type": "effect_type", + "id": "melatonin", + "name": [ "Melatonin Supplements" ], + "desc": [ "You took some melatonin supplements. These will help with sleep deprivation." ], + "rating": "good" + }, { "type": "effect_type", "id": "beartrap", diff --git a/data/json/game_balance.json b/data/json/game_balance.json index df8a8a0226738..7628961159695 100644 --- a/data/json/game_balance.json +++ b/data/json/game_balance.json @@ -130,7 +130,7 @@ "name": "SLEEP_DEPRIVATION", "info": "Enables sleep deprivation mechanics. If true, stimulants will only help you so far, and you might have to enforce proper sleep hygiene for a while.", "stype": "bool", - "value": false + "value": true }, { "type": "EXTERNAL_OPTION", diff --git a/data/json/item_actions.json b/data/json/item_actions.json index ede621ccbe690..d18b67bae7e7a 100644 --- a/data/json/item_actions.json +++ b/data/json/item_actions.json @@ -54,6 +54,11 @@ "id": "PICKAXE", "name": "Dig through rock" }, + { + "type": "item_action", + "id": "MELATONIN_TABLET", + "name": "Take a melatonin tablet" + }, { "type": "item_action", "id": "PACK_CBM", diff --git a/data/json/itemgroups/bionics.json b/data/json/itemgroups/bionics.json index 4e065cccad334..5c1620b230f50 100644 --- a/data/json/itemgroups/bionics.json +++ b/data/json/itemgroups/bionics.json @@ -149,6 +149,7 @@ [ "bio_face_mask", 10 ], [ "bio_scent_mask", 10 ], [ "bio_cloak", 10 ], + [ "bio_synaptic_regen", 12 ], [ "bio_fingerhack", 10 ], [ "bio_lockpick", 10 ], [ "bio_night", 10 ], diff --git a/data/json/itemgroups/locations.json b/data/json/itemgroups/locations.json index f687265f18b55..c8d016b5861ba 100644 --- a/data/json/itemgroups/locations.json +++ b/data/json/itemgroups/locations.json @@ -2114,6 +2114,7 @@ [ "con_milk", 20 ], [ "milk_evap", 15 ], [ "milk_UHT", 10 ], + { "item": "melatonin_tablet", "count": 20, "prob": 20 }, [ "can_spam", 30 ], [ "can_tuna", 35 ], [ "can_salmon", 25 ], diff --git a/data/json/items/bionics.json b/data/json/items/bionics.json index 2b1f1378796be..af5d7ae1ab186 100644 --- a/data/json/items/bionics.json +++ b/data/json/items/bionics.json @@ -1158,6 +1158,15 @@ "weight": "100 g", "difficulty": 11 }, + { + "id": "bio_synaptic_regen", + "copy-from": "bionic_general", + "type": "BIONIC_ITEM", + "name": "Synaptic Regeneration System CBM", + "description": "An electromagnetic stimulator has been surgically implanted on the back of your head and along your spine, continually draining power. As long as it's active, you won't become sleep deprived; and if you're sleep deprived already, it will boost the rate of recovery.", + "price": 10000, + "difficulty": 8 + }, { "id": "bio_spasm", "copy-from": "bionic_general_faulty", diff --git a/data/json/items/comestibles/med.json b/data/json/items/comestibles/med.json index f8d3249b2ff1c..51b60dba8fa6f 100644 --- a/data/json/items/comestibles/med.json +++ b/data/json/items/comestibles/med.json @@ -14,6 +14,21 @@ "use_action": "DISASSEMBLE", "flags": [ "NO_REPAIR" ] }, + { + "id": "melatonin_tablet", + "type": "COMESTIBLE", + "comestible_type": "MED", + "name": "melatonin tablet", + "description": "Over-the-counter melatonin supplements, commonly prescribed to treat sleep deprivation and to mitigate its effects. One tablet a day combined with a good night's sleep will help you recover faster.", + "weight": "1 g", + "volume": "250 ml", + "price": 400, + "price_postapoc": 4000, + "stack_size": 30, + "symbol": "!", + "color": "yellow", + "use_action": "MELATONIN_TABLET" + }, { "id": "adderall", "type": "COMESTIBLE", diff --git a/data/json/items/migration.json b/data/json/items/migration.json index a2a2ad1e26540..96e0319ecd9a4 100644 --- a/data/json/items/migration.json +++ b/data/json/items/migration.json @@ -944,6 +944,11 @@ "type": "MIGRATION", "replace": "40x53mm_m1001" }, + { + "id": "magnesium_tablet", + "type": "MIGRATION", + "replace": "melatonin_tablet" + }, { "id": "40mm_frag", "type": "MIGRATION", diff --git a/data/json/items/obsolete.json b/data/json/items/obsolete.json index 87509f10aad8b..a1240bb03daae 100644 --- a/data/json/items/obsolete.json +++ b/data/json/items/obsolete.json @@ -350,6 +350,13 @@ "valid_mod_locations": [ [ "sling", 1 ], [ "stock", 1 ], [ "rail mount", 1 ] ], "relative": { "reload": 4 } }, + { + "type": "effect_type", + "id": "magnesium", + "name": [ "Magnesium Supplements" ], + "desc": [ "You took some magnesium supplements. These will help with sleep deprivation." ], + "rating": "good" + }, { "id": "bio_furnace", "copy-from": "bionic_general", diff --git a/data/json/monsterdrops/zombie_lab.json b/data/json/monsterdrops/zombie_lab.json index 46e5ab4e4542d..c970a6c719651 100644 --- a/data/json/monsterdrops/zombie_lab.json +++ b/data/json/monsterdrops/zombie_lab.json @@ -53,6 +53,7 @@ [ "bio_night_vision", 1 ], [ "bio_infrared", 2 ], [ "bio_scent_vision", 5 ], + [ "bio_synaptic_regen", 12 ], [ "bio_gills", 5 ], [ "bio_climate", 2 ], [ "bio_heatsink", 2 ], diff --git a/data/json/obsolete.json b/data/json/obsolete.json index 2594ed0db7bad..22ee9fd522658 100644 --- a/data/json/obsolete.json +++ b/data/json/obsolete.json @@ -53,6 +53,13 @@ "occupied_bodyparts": [ [ "TORSO", 32 ] ], "flags": [ "BIONIC_NPC_USABLE", "BIONIC_SHOCKPROOF" ] }, + { + "type": "effect_type", + "id": "magnesium", + "name": [ "Magnesium Supplements" ], + "desc": [ "You took some magnesium supplements. These will help with sleep deprivation." ], + "rating": "good" + }, { "type": "recipe", "result": "reloaded_270", diff --git a/data/mods/Sleep_Deprivation/bionics.json b/data/mods/Sleep_Deprivation/bionics.json deleted file mode 100644 index 5cea5a3c4c517..0000000000000 --- a/data/mods/Sleep_Deprivation/bionics.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "id": "bio_synaptic_regen", - "type": "bionic", - "name": "Synaptic Regeneration System", - "description": "An electromagnetic stimulator has been surgically implanted on the back of your head and along your spine, continually draining power. As long as it's active, you won't become sleep deprived; and if you're sleep deprived already, it will boost the rate of recovery while you sleep.", - "flags": [ "BIONIC_TOGGLED" ], - "occupied_bodyparts": [ [ "HEAD", 1 ], [ "TORSO", 1 ] ], - "act_cost": 0, - "react_cost": 1, - "time": 100 - } -] diff --git a/data/mods/Sleep_Deprivation/effects.json b/data/mods/Sleep_Deprivation/effects.json deleted file mode 100644 index 727018df54fd9..0000000000000 --- a/data/mods/Sleep_Deprivation/effects.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "type": "effect_type", - "id": "sleep_deprived", - "name": [ "Sleep Deprived" ], - "desc": [ "Your sleep debt has been steadily increasing for a while. You should get some rest." ], - "rating": "bad", - "max_intensity": 20160, - "int_dur_factor": 1440, - "base_mods": { "speed_mod": [ -5 ] }, - "scaling_mods": { "speed_mod": [ -1 ], "int_mod": [ -0.33 ], "per_mod": [ -0.33 ], "str_mod": [ -0.17 ], "dex_mod": [ -0.17 ] }, - "apply_message": "You feel weary, your body tired from lack of quality sleep.", - "remove_message": "You have finally caught up with your lost sleep, and you feel refreshed and awake for a change." - }, - { - "type": "effect_type", - "id": "magnesium", - "name": [ "Magnesium Supplements" ], - "desc": [ "You took some magnesium supplements. These will help with sleep deprivation." ], - "rating": "good" - } -] diff --git a/data/mods/Sleep_Deprivation/game_balance.json b/data/mods/Sleep_Deprivation/game_balance.json deleted file mode 100644 index 594bb55a809b3..0000000000000 --- a/data/mods/Sleep_Deprivation/game_balance.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "type": "EXTERNAL_OPTION", - "name": "SLEEP_DEPRIVATION", - "stype": "bool", - "value": true - } -] diff --git a/data/mods/Sleep_Deprivation/item_actions.json b/data/mods/Sleep_Deprivation/item_actions.json deleted file mode 100644 index 34981463ca9cc..0000000000000 --- a/data/mods/Sleep_Deprivation/item_actions.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "type": "item_action", - "id": "MAGNESIUM_TABLET", - "name": "Take a magnesium tablet" - } -] diff --git a/data/mods/Sleep_Deprivation/item_groups.json b/data/mods/Sleep_Deprivation/item_groups.json deleted file mode 100644 index e1b7bba825253..0000000000000 --- a/data/mods/Sleep_Deprivation/item_groups.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "type": "item_group", - "id": "bionics", - "items": [ [ "bio_synaptic_regen", 10 ] ] - }, - { - "type": "item_group", - "id": "bionics_sci", - "items": [ [ "bio_synaptic_regen", 8 ] ] - }, - { - "type": "item_group", - "id": "bionics_mil", - "items": [ [ "bio_synaptic_regen", 12 ] ] - }, - { - "type": "item_group", - "id": "softdrugs", - "items": [ [ "magnesium_tablet", 75 ] ] - }, - { - "type": "item_group", - "id": "shelter", - "items": [ [ "magnesium_tablet", 75 ] ] - } -] diff --git a/data/mods/Sleep_Deprivation/itemgroups/drugs.json b/data/mods/Sleep_Deprivation/itemgroups/drugs.json deleted file mode 100644 index 14a5db899f6a2..0000000000000 --- a/data/mods/Sleep_Deprivation/itemgroups/drugs.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "id": "drugs_rare", - "type": "item_group", - "//": "Rare and/or valuable drugs excluding painkillers", - "items": [ [ "magnesium_tablet", 100 ] ] - } -] diff --git a/data/mods/Sleep_Deprivation/items/bionics.json b/data/mods/Sleep_Deprivation/items/bionics.json deleted file mode 100644 index f1e44329e3ae3..0000000000000 --- a/data/mods/Sleep_Deprivation/items/bionics.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "id": "bio_synaptic_regen", - "copy-from": "bionic_general", - "type": "BIONIC_ITEM", - "name": "Synaptic Regeneration System CBM", - "description": "An electromagnetic stimulator has been surgically implanted on the back of your head and along your spine, continually draining power. As long as it's active, you won't become sleep deprived; and if you're sleep deprived already, it will boost the rate of recovery.", - "price": 10000, - "difficulty": 8 - } -] diff --git a/data/mods/Sleep_Deprivation/items/comestibles/med.json b/data/mods/Sleep_Deprivation/items/comestibles/med.json deleted file mode 100644 index b46ca75e7ea59..0000000000000 --- a/data/mods/Sleep_Deprivation/items/comestibles/med.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "id": "magnesium_tablet", - "type": "COMESTIBLE", - "comestible_type": "MED", - "name": "magnesium tablet", - "description": "Over-the-counter magnesium supplements, commonly prescribed to treat sleep deprivation and to mitigate its effects. One tablet a day combined with a good night's sleep will help you recover faster.", - "weight": "1 g", - "volume": "250 ml", - "price": 400, - "price_postapoc": 4000, - "charges": 1, - "stack_size": 30, - "symbol": "!", - "color": "yellow", - "use_action": "MAGNESIUM_TABLET" - } -] diff --git a/data/mods/Sleep_Deprivation/modinfo.json b/data/mods/Sleep_Deprivation/modinfo.json index e484c731eec3d..8b93a9054215c 100644 --- a/data/mods/Sleep_Deprivation/modinfo.json +++ b/data/mods/Sleep_Deprivation/modinfo.json @@ -7,6 +7,7 @@ "maintainers": [ "Kevin Giovinazzo" ], "description": "Enables sleep deprivation mechanics independently of a player's fatigue.", "category": "rebalance", + "obsolete": true, "dependencies": [ "dda" ] } ] diff --git a/src/cata_string_consts.h b/src/cata_string_consts.h index d1e0cf2e94fb0..d44d8b00512fa 100644 --- a/src/cata_string_consts.h +++ b/src/cata_string_consts.h @@ -229,7 +229,7 @@ static const efftype_id effect_jetinjector( "jetinjector" ); static const efftype_id effect_lack_sleep( "lack_sleep" ); static const efftype_id effect_lightsnare( "lightsnare" ); static const efftype_id effect_lying_down( "lying_down" ); -static const efftype_id effect_magnesium_supplements( "magnesium" ); +static const efftype_id effect_melatonin_supplements( "melatonin" ); static const efftype_id effect_masked_scent( "masked_scent" ); static const efftype_id effect_mending( "mending" ); static const efftype_id effect_meth( "meth" ); diff --git a/src/character.cpp b/src/character.cpp index 483e2bc178cd8..0d3a360342c25 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -3951,8 +3951,8 @@ void Character::update_needs( int rate_multiplier ) // Sleeping on a bed, bionic = 6x rest_modifier // Sleeping on a comfy bed, bionic = 9x rest_modifier float rest_modifier = ( has_active_bionic( bio_synaptic_regen ) ? 3 : 1 ); - // Magnesium supplements also add a flat bonus to recovery speed - if( has_effect( effect_magnesium_supplements ) ) { + // Melatonin supplements also add a flat bonus to recovery speed + if( has_effect( effect_melatonin_supplements ) ) { rest_modifier += 1; } diff --git a/src/item_factory.cpp b/src/item_factory.cpp index 4bae7acfcfd00..e68b9eb9176be 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -803,7 +803,7 @@ void Item_factory::init() add_iuse( "WEED_CAKE", &iuse::weed_cake ); add_iuse( "XANAX", &iuse::xanax ); add_iuse( "BREAK_STICK", &iuse::break_stick ); - add_iuse( "MAGNESIUM_TABLET", &iuse::magnesium_tablet ); + add_iuse( "MELATONIN_TABLET", &iuse::melatonin_tablet ); add_actor( std::make_unique() ); add_actor( std::make_unique() ); diff --git a/src/iuse.cpp b/src/iuse.cpp index 77da2f158136a..1bbec0c360196 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -217,7 +217,7 @@ static const efftype_id effect_weak_antibiotic( "weak_antibiotic" ); static const efftype_id effect_weak_antibiotic_visible( "weak_antibiotic_visible" ); static const efftype_id effect_webbed( "webbed" ); static const efftype_id effect_weed_high( "weed_high" ); -static const efftype_id effect_magnesium_supplements( "magnesium" ); +static const efftype_id effect_melatonin_supplements( "melatonin" ); static const trait_id trait_ACIDBLOOD( "ACIDBLOOD" ); static const trait_id trait_ACIDPROOF( "ACIDPROOF" ); @@ -9693,14 +9693,14 @@ int iuse::gobag_personal( player *p, item *it, bool, const tripoint & ) return gobag( p, it, true ); } -int iuse::magnesium_tablet( player *p, item *it, bool, const tripoint & ) +int iuse::melatonin_tablet( player *p, item *it, bool, const tripoint & ) { p->add_msg_if_player( _( "You pop a %s." ), it->tname() ); - if( p->has_effect( effect_magnesium_supplements ) ) { + if( p->has_effect( effect_melatonin_supplements ) ) { p->add_msg_if_player( m_warning, - _( "Simply taking more magnesium won't help. You have to go to sleep for it to work." ) ); + _( "Simply taking more melatonin won't help. You have to go to sleep for it to work." ) ); } - p->add_effect( effect_magnesium_supplements, 16_hours ); + p->add_effect( effect_melatonin_supplements, 16_hours ); return it->type->charges_to_use(); } diff --git a/src/iuse.h b/src/iuse.h index de59b434bfd41..8758cdfe881c6 100644 --- a/src/iuse.h +++ b/src/iuse.h @@ -203,7 +203,7 @@ class iuse int weak_antibiotic( player *, item *, bool, const tripoint & ); int strong_antibiotic( player *, item *, bool, const tripoint & ); int panacea( player *, item *, bool, const tripoint & ); - int magnesium_tablet( player *, item *, bool, const tripoint & ); + int melatonin_tablet( player *, item *, bool, const tripoint & ); int coin_flip( player *, item *, bool, const tripoint & ); int play_game( player *, item *, bool, const tripoint & ); int magic_8_ball( player *, item *, bool, const tripoint & ); diff --git a/tests/stomach_contents_test.cpp b/tests/stomach_contents_test.cpp index 4c84da558ad02..ee5a439a92519 100644 --- a/tests/stomach_contents_test.cpp +++ b/tests/stomach_contents_test.cpp @@ -215,6 +215,7 @@ TEST_CASE( "hunger" ) reset_time(); clear_stomach( dummy ); dummy.initialize_stomach_contents(); + dummy.clear_effects(); if( print_tests ) { printf( "\n\n" );