Skip to content

Commit

Permalink
Add regen serum (#74021)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* 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 <[email protected]>
  • Loading branch information
GuardianDll and osuphobia authored May 31, 2024
1 parent 00b781c commit cef5d70
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 3 deletions.
101 changes: 101 additions & 0 deletions data/json/effects_on_condition/medicine_eocs/regen_serum_eoc.json
Original file line number Diff line number Diff line change
@@ -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 } ] } ]
}
]
26 changes: 26 additions & 0 deletions data/json/effects_on_condition/medicine_eocs/serum_eoc.json
Original file line number Diff line number Diff line change
@@ -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" } ]
}
]
26 changes: 25 additions & 1 deletion data/json/itemgroups/science_and_tech.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] },
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
27 changes: 27 additions & 0 deletions data/json/items/comestibles/serums.json
Original file line number Diff line number Diff line change
@@ -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" } }
}
]
}
]
}
]
17 changes: 17 additions & 0 deletions data/json/items/newspaper.json
Original file line number Diff line number Diff line change
Expand Up @@ -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<serum_testing_regen>",
"append": true,
"expand_snippets": true
}
],
"copy-from": "file"
},
{
"type": "GENERIC",
"id": "lab_file_sec",
Expand Down
9 changes: 9 additions & 0 deletions data/json/items/tool/science.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
},
{
Expand Down
2 changes: 1 addition & 1 deletion data/json/mapgen/lab/lab_floorplan_cross.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
10 changes: 10 additions & 0 deletions data/json/snippets/lab.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,16 @@
}
]
},
{
"type": "snippet",
"category": "<serum_testing_regen>",
"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",
Expand Down
1 change: 1 addition & 0 deletions tools/spell_checker/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3409,6 +3409,7 @@ LMES
LMG
LMGs
LMOE
Locutus
loadout
loadouts
lobotomizer
Expand Down

0 comments on commit cef5d70

Please sign in to comment.