From cef5d7032a256d9a6dc09928b39eee95e61370aa Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Fri, 31 May 2024 18:31:16 +0200 Subject: [PATCH] Add regen serum (#74021) * add regen serum * Check yesterday's calories consumption, not today's. Also check ingested calories, not eaten * fixes * more fixes * Apply suggestions from code review Co-authored-by: osuphobia <78858975+osuphobia@users.noreply.github.com> * move serum crash penalty to jmath, add flag to mend bodyparts without splint * fixes * make serum GENERIC * fixes fixes fixes * attempt to fix MEND_ALL flag (futile) * Spell check fixes * make mending actually work * too many " --------- Co-authored-by: osuphobia <78858975+osuphobia@users.noreply.github.com> --- .../medicine_eocs/regen_serum_eoc.json | 101 ++++++++++++++++++ .../medicine_eocs/serum_eoc.json | 26 +++++ data/json/itemgroups/science_and_tech.json | 26 ++++- data/json/items/comestibles/serums.json | 27 +++++ data/json/items/newspaper.json | 17 +++ data/json/items/tool/science.json | 9 ++ data/json/mapgen/lab/lab_floorplan_cross.json | 2 +- .../lab_nests_modular/lab_nested_medical.json | 2 +- data/json/snippets/lab.json | 10 ++ tools/spell_checker/dictionary.txt | 1 + 10 files changed, 218 insertions(+), 3 deletions(-) create mode 100644 data/json/effects_on_condition/medicine_eocs/regen_serum_eoc.json create mode 100644 data/json/effects_on_condition/medicine_eocs/serum_eoc.json create mode 100644 data/json/items/comestibles/serums.json diff --git a/data/json/effects_on_condition/medicine_eocs/regen_serum_eoc.json b/data/json/effects_on_condition/medicine_eocs/regen_serum_eoc.json new file mode 100644 index 0000000000000..56cbc25de56cd --- /dev/null +++ b/data/json/effects_on_condition/medicine_eocs/regen_serum_eoc.json @@ -0,0 +1,101 @@ +[ + { + "type": "jmath_function", + "id": "spent_to_ingested_ratio", + "//": "return ratio between calories you spent yesterday and calories you ingested yesterday. if bigger than 1, you consumed more calories than you ingested", + "num_args": 0, + "return": "max( get_calories_daily('type':'spent', 'day':'1'), 1 ) / max( get_calories_daily('type':'ingested', 'day':'1'), 1 )" + }, + { + "type": "effect_on_condition", + "id": "EOC_SERUM_REGEN", + "effect": [ + { "u_consume_item": { "context_val": "id" } }, + { "math": [ "_serum_duration", "=", "rng(time('1 d'), time('2 d'))" ] }, + { "u_add_effect": "regen_serum_main", "duration": { "context_val": "serum_duration" } }, + { "u_add_effect": "regen_serum_crash_cardio", "duration": { "math": [ "_serum_duration * rng(1.5, 2.5)" ] } }, + { "queue_eocs": "EOC_APPLY_REGEN_SERUM_CRASH", "time_in_future": { "context_val": "serum_duration" } }, + { "queue_eocs": "EOC_REGEN_SERUM_PAIN_SPIKE", "time_in_future": [ "1 h", "6 h" ] }, + { "queue_eocs": "EOC_REGEN_SERUM_MUT_REJECTION", "time_in_future": [ "1 h", "6 h" ] } + ] + }, + { + "type": "effect_on_condition", + "id": "EOC_APPLY_REGEN_SERUM_CRASH", + "effect": [ { "u_add_effect": "regen_serum_crash_fatigue", "duration": [ "5 d", "10 d" ] } ] + }, + { + "type": "effect_on_condition", + "id": "EOC_REGEN_SERUM_PAIN_SPIKE", + "condition": { "u_has_any_effect": [ "regen_serum_main" ] }, + "//": "todo: move message to snippet?", + "effect": [ + { "u_message": "You feel an immense pain, when something within your bloodstream moves eerily.", "type": "bad" }, + { "math": [ "u_pain()", "+=", "rng(15, 55)" ] }, + { "queue_eocs": "EOC_REGEN_SERUM_PAIN_SPIKE", "time_in_future": [ "1 h", "6 h" ] } + ] + }, + { + "type": "effect_on_condition", + "id": "EOC_REGEN_SERUM_MUT_REJECTION", + "condition": { "one_in_chance": 5 }, + "effect": [ + { + "if": { "one_in_chance": 2 }, + "then": { "u_mutate_category": "HUMAN", "use_vitamins": false }, + "else": { "u_mutate": 1, "use_vitamins": false } + } + ] + }, + { + "type": "effect_type", + "id": "regen_serum_main", + "name": [ "Injected 48x-\"Locutus\"" ], + "desc": [ + "You just take a shot of some weird stuff. You feel sleepiness, nauseous, and overall weakened, but you wounds close up at unnatural pace." + ], + "apply_message": "Without hesitation, you draw the liquid from the ampule, smack it a bit to release an air, and put right into your veins, in hope it won't kill you.", + "remove_message": "You feel your rapid regeneration turn back to normal, but some negative effects are still presented.", + "rating": "mixed", + "flags": [ "MEND_ALL" ], + "enchantments": [ + { + "values": [ + { "value": "REGEN_HP", "multiply": 50 }, + { "value": "REGEN_HP_AWAKE", "multiply": 1 }, + { "value": "MENDING_MODIFIER", "add": 50 }, + { "value": "METABOLISM", "multiply": 2 }, + { "value": "HUNGER", "multiply": 2 }, + { "value": "SLEEPINESS", "multiply": 1 }, + { "value": "STAMINA_REGEN_MOD", "multiply": -0.5 }, + { "value": "VOMIT_MUL", "multiply": 1 } + ] + } + ] + }, + { + "type": "effect_type", + "id": "regen_serum_crash_cardio", + "name": [ "" ], + "desc": [ "" ], + "apply_message": "", + "remove_message": "", + "enchantments": [ + { + "values": [ + { "value": "CARDIO_MULTIPLIER", "multiply": { "math": [ "(-1 / clamp( spent_to_ingested_ratio(), 0, 0.6 )) / 5" ] } }, + { "value": "STRENGTH", "multiply": { "math": [ "(-1 / clamp( spent_to_ingested_ratio(), 0, 0.6 )) / 5" ] } } + ] + } + ] + }, + { + "type": "effect_type", + "id": "regen_serum_crash_fatigue", + "name": [ "Injected Serum Crash" ], + "desc": [ "Your body regeneration is not as fast as before, but you still feel some weakness." ], + "apply_message": "", + "remove_message": "", + "enchantments": [ { "values": [ { "value": "STAMINA_REGEN_MOD", "multiply": -0.5 }, { "value": "SLEEPINESS", "multiply": 1 } ] } ] + } +] diff --git a/data/json/effects_on_condition/medicine_eocs/serum_eoc.json b/data/json/effects_on_condition/medicine_eocs/serum_eoc.json new file mode 100644 index 0000000000000..366ca9f6f0fc7 --- /dev/null +++ b/data/json/effects_on_condition/medicine_eocs/serum_eoc.json @@ -0,0 +1,26 @@ +[ + { + "type": "effect_on_condition", + "id": "EOC_HAS_SERUM", + "condition": { "u_has_any_effect": [ "regen_serum_main", "regen_serum_crash_cardio", "regen_serum_crash_fatigue" ] } + }, + { + "type": "effect_on_condition", + "id": "EOC_HAS_SYRINGE", + "condition": { "or": [ { "u_has_item": "syringe" }, { "u_has_bionics": "bio_syringe" } ] } + }, + { + "type": "effect_on_condition", + "id": "EOC_SERUM_GENERIFIED", + "condition": { "test_eoc": "EOC_HAS_SYRINGE" }, + "effect": [ { "run_eocs": "EOC_SERUM_GENERIFIED_2" } ], + "false_effect": [ { "u_message": "You need a syringe to inject the liquid.", "type": "bad" } ] + }, + { + "type": "effect_on_condition", + "id": "EOC_SERUM_GENERIFIED_2", + "condition": { "not": { "test_eoc": "EOC_HAS_SERUM" } }, + "effect": [ { "run_eocs": [ { "context_val": "eoc" } ] } ], + "false_effect": [ { "u_message": "You would not dare to inject two of them at once.", "type": "bad" } ] + } +] diff --git a/data/json/itemgroups/science_and_tech.json b/data/json/itemgroups/science_and_tech.json index 24f9170d97ac2..f80c8c5c0d052 100644 --- a/data/json/itemgroups/science_and_tech.json +++ b/data/json/itemgroups/science_and_tech.json @@ -265,7 +265,7 @@ [ "recipe_animal", 4 ], [ "recipe_maiar", 4 ], [ "recipe_labchem", 6 ], - { "group": "mutagen_kits", "prob": 1 }, + { "group": "mutagen_or_serum_kit", "prob": 1 }, [ "syringe", 8 ], { "item": "bleach", "prob": 20, "charges": [ 1, -1 ] }, { "item": "ammonia_liquid", "prob": 50, "charges": [ 6, -1 ] }, @@ -278,6 +278,12 @@ { "item": "chem_nitric_acid", "prob": 5, "charges": [ 1, -1 ] } ] }, + { + "type": "item_group", + "id": "mutagen_or_serum_kit", + "//": "odds of serum kit is so low for there is only one at this moment, would be very reperative. TODO increase odds to get serum once there would be more of them.", + "items": [ { "group": "mutagen_kits", "prob": 100 }, { "group": "serum_kits", "prob": 15 } ] + }, { "type": "item_group", "id": "mutagen_kits", @@ -437,6 +443,24 @@ { "item": "lab_file_mutation_testing", "prob": 100 } ] }, + { + "type": "item_group", + "id": "serum_kits", + "items": [ { "group": "regen_serum_kit", "prob": 100 } ] + }, + { + "type": "item_group", + "id": "regen_serum_kit", + "container-item": "box_small_plastic", + "subtype": "collection", + "items": [ + { "item": "syringe", "prob": 100, "count": 1 }, + { "item": "serum_regen", "prob": 100, "count": 1 }, + { "item": "bubblewrap", "prob": 100, "count": [ 2, 5 ] }, + { "item": "lab_file_mutagen_guide", "prob": 100 }, + { "item": "lab_file_mutation_testing", "prob": 100 } + ] + }, { "type": "item_group", "id": "teleport", diff --git a/data/json/items/comestibles/serums.json b/data/json/items/comestibles/serums.json new file mode 100644 index 0000000000000..37ecdd4d61a98 --- /dev/null +++ b/data/json/items/comestibles/serums.json @@ -0,0 +1,27 @@ +[ + { + "id": "serum_regen", + "type": "GENERIC", + "category": "drugs", + "name": { "str_sp": "48x-\"Locutus\"" }, + "description": "Little, sealed ampule with some white, semi-transparent liquid of unknown origin. Label on it says \"48x-\"Locutus\"\", whatever that means.", + "weight": "7 g", + "volume": "10 ml", + "material": [ "alien_liquid" ], + "symbol": "[", + "color": "white", + "use_action": [ + { + "type": "effect_on_conditions", + "menu_text": "Inject", + "description": "Inject the liquid.", + "effect_on_conditions": [ + { + "id": "EOC_RUN_SERUM_REGEN", + "effect": { "run_eoc_with": "EOC_SERUM_GENERIFIED", "variables": { "eoc": "EOC_SERUM_REGEN" } } + } + ] + } + ] + } +] diff --git a/data/json/items/newspaper.json b/data/json/items/newspaper.json index 2a92ea44b0d29..f97c3625195fe 100644 --- a/data/json/items/newspaper.json +++ b/data/json/items/newspaper.json @@ -163,6 +163,23 @@ ], "copy-from": "file" }, + { + "type": "GENERIC", + "id": "lab_file_serum_testing", + "name": { "str_sp": "production tests" }, + "description": "Accompanying document, that describes tests performed on different subjects.", + "expand_snippets": true, + "variants": [ + { + "id": "lab_file_serum_testing_regen", + "name": { "str_sp": "production tests" }, + "description": "\n\n", + "append": true, + "expand_snippets": true + } + ], + "copy-from": "file" + }, { "type": "GENERIC", "id": "lab_file_sec", diff --git a/data/json/items/tool/science.json b/data/json/items/tool/science.json index 177afdc064eae..aacb33b4af922 100644 --- a/data/json/items/tool/science.json +++ b/data/json/items/tool/science.json @@ -1028,6 +1028,15 @@ "material": [ "glass" ], "symbol": "|", "color": "white", + "pocket_data": [ + { + "pocket_type": "CONTAINER", + "rigid": true, + "max_contains_volume": "25 ml", + "max_contains_weight": "100 g", + "watertight": true + } + ], "melee_damage": { "bash": 1 } }, { diff --git a/data/json/mapgen/lab/lab_floorplan_cross.json b/data/json/mapgen/lab/lab_floorplan_cross.json index 5ac9e84ddcc3c..138aea17af3f5 100644 --- a/data/json/mapgen/lab/lab_floorplan_cross.json +++ b/data/json/mapgen/lab/lab_floorplan_cross.json @@ -616,7 +616,7 @@ { "type": "palette", "id": "lab_loot_serum_vault", - "mapping": { "r": { "items": [ { "item": "mutagen_kits", "chance": 50 } ] } }, + "mapping": { "r": { "items": [ { "item": "mutagen_or_serum_kit", "chance": 50 } ] } }, "terrain": { "r": "t_thconc_floor" }, "computers": { "6": { diff --git a/data/json/mapgen/lab/lab_modular/lab_nests_modular/lab_nested_medical.json b/data/json/mapgen/lab/lab_modular/lab_nests_modular/lab_nested_medical.json index 8657e71aa3284..f1fd8c86ddd77 100644 --- a/data/json/mapgen/lab/lab_modular/lab_nests_modular/lab_nested_medical.json +++ b/data/json/mapgen/lab/lab_modular/lab_nests_modular/lab_nested_medical.json @@ -349,7 +349,7 @@ "palettes": [ "lab_common_palette", "lab_medical_palette" ], "furniture": { "O": "f_floor_mattress" }, "place_items": [ - { "item": "mutagen_kits", "x": 5, "y": 0, "repeat": [ 3, 5 ], "chance": 100 }, + { "item": "mutagen_or_serum_kit", "x": 5, "y": 0, "repeat": [ 3, 5 ], "chance": 100 }, { "item": "lab_mutagen_ingredients", "x": 5, "y": 0, "repeat": [ 1, 8 ], "chance": 90 }, { "item": "supplies_reagents_lab", "x": 5, "y": 2, "repeat": [ 1, 4 ], "chance": 90 }, { "item": "chem_lab", "x": 5, "y": 2, "repeat": [ 3, 5 ], "chance": 80 }, diff --git a/data/json/snippets/lab.json b/data/json/snippets/lab.json index ce4a5578bb319..57146348d1bcd 100644 --- a/data/json/snippets/lab.json +++ b/data/json/snippets/lab.json @@ -356,6 +356,16 @@ } ] }, + { + "type": "snippet", + "category": "", + "text": [ + { + "id": "serum_testing_regen_1", + "text": "Inject subject with 10 ml of 48x-\"Locutus\" compound\nObserve for 6 hours\nNote: subject has left arm amputated and bald.\nResults: Subject suffered from heavy vomiting, physical weakness, sleepiness, and sudden spiked of pain. Subject arm was regenerated, with no functional loss, which was confirmed in future tests. Subject hair grow showed an exceptional rate, with approximately 1 cm in 6 hours.\nLong term results: approximately 24 hours after the injection the regeneration speed returned to normal rate. In two weeks, most of negative effects were rounded off. Full body inspection revealed mostly positive changes, healing of previously damaged internal organs, notably liver, thyroid gland and spine. Subject cataract were not cured, for some reason." + } + ] + }, { "type": "snippet", "category": "lab_notes", diff --git a/tools/spell_checker/dictionary.txt b/tools/spell_checker/dictionary.txt index 1e80ab4d4324a..91a8b80127208 100644 --- a/tools/spell_checker/dictionary.txt +++ b/tools/spell_checker/dictionary.txt @@ -3409,6 +3409,7 @@ LMES LMG LMGs LMOE +Locutus loadout loadouts lobotomizer