From a908f986c9c306a4ea89f9a98e7ec75ed8a54dcd Mon Sep 17 00:00:00 2001 From: Zachary Johnson Date: Mon, 1 Jul 2024 00:27:17 -0400 Subject: [PATCH] Add conjunctivitis from boomer bile (#74681) * Add conjunctivitis effect * Add eoc_boomered_apply_conjunctivitis * Add eoc_conjunctivitis_itch * Add eoc_conjunctivitis_sting * Remove mentions of smoke in eye irritation messages * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Lint effects.json * Lint effects_eocs.json * Lint misc_effect_on_condition.json * Fix JSON typo * Remove resist from antihistamines Co-authored-by: Kevin Granade * Lint data/json/effects_on_condition/effects_eocs.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Prevent conjunctivis with sufficient eye coverage * Lint data/json/effects_on_condition/misc_effect_on_condition.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Modify conjunctivitis chance and duration based on eye coverage * Allow for reducing conjunctivitis duration with eye drops * Lint src/iuse.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Kevin Granade --- data/json/effects.json | 24 +++++++++++----- .../effects_on_condition/effects_eocs.json | 28 +++++++++++++++++++ .../misc_effect_on_condition.json | 25 +++++++++++++++++ src/iuse.cpp | 8 ++++++ 4 files changed, 78 insertions(+), 7 deletions(-) diff --git a/data/json/effects.json b/data/json/effects.json index 7aca1e9932648..b8e8f469268d6 100644 --- a/data/json/effects.json +++ b/data/json/effects.json @@ -1961,12 +1961,7 @@ { "type": "effect_type", "id": "smoke_eyes", - "name": [ - "Little Eye Irritation (Smoke)", - "Minor Eye Irritation (Smoke)", - "Huge Eye Irritation (Smoke)", - "Bad Eye Irritation (Smoke)" - ], + "name": [ "Little Eye Irritation", "Minor Eye Irritation", "Huge Eye Irritation", "Bad Eye Irritation" ], "desc": [ "Your eyes are mildly irritated.", "Your eyes are watering.", @@ -1982,7 +1977,7 @@ "bad" ] ], - "miss_messages": [ [ "Your eyes sting and tear from the smoke.", 1 ] ], + "miss_messages": [ [ "Your eyes sting and tear from the irritation.", 1 ] ], "max_duration": "3 m", "max_intensity": 4, "int_decay_tick": 40, @@ -2104,6 +2099,21 @@ "max_duration": "2 minutes", "removes_effects": [ "skunk_spray" ] }, + { + "type": "effect_type", + "id": "conjunctivitis", + "name": [ "Conjunctivitis" ], + "desc": [ "Your eyes are inflamed." ], + "apply_message": "The chemical irritant damaged your eyes!", + "rating": "bad", + "resist_traits": [ "POISRESIST", "PER_SLIME_OK" ], + "immune_flags": [ "POISIMMUNE", "SEESLEEP" ], + "int_dur_factor": "50 m", + "base_mods": { "per_mod": [ -1 ], "pain_min": [ 1 ], "pain_chance": [ 400, 1000 ] }, + "limb_score_mods": [ { "limb_score": "vision", "modifier": 0.85, "resist_modifier": 0.925 } ], + "miss_messages": [ [ "It feels like there's sand in your eye.", 1 ] ], + "flags": [ "EFFECT_LIMB_SCORE_MOD" ] + }, { "type": "effect_type", "id": "invisibility", diff --git a/data/json/effects_on_condition/effects_eocs.json b/data/json/effects_on_condition/effects_eocs.json index 3539252e21432..781f68d8faf6d 100644 --- a/data/json/effects_on_condition/effects_eocs.json +++ b/data/json/effects_on_condition/effects_eocs.json @@ -63,5 +63,33 @@ } ], "false_effect": [ { "u_lose_morale": "morale_asocial_dissatisfied" } ] + }, + { + "type": "effect_on_condition", + "id": "eoc_conjunctivitis_itch", + "recurrence": [ "10 minutes", "45 minutes" ], + "condition": { + "and": [ + { "u_has_effect": "conjunctivitis", "bodypart": "eyes" }, + { "not": { "u_has_effect": "formication" } }, + { "not": { "u_has_effect": "took_antihistamine" } }, + { "not": { "u_has_effect": "sleep" } } + ] + }, + "effect": [ { "u_add_effect": "formication", "duration": 300, "target_part": "head" } ] + }, + { + "type": "effect_on_condition", + "id": "eoc_conjunctivitis_sting", + "recurrence": [ "10 minutes", "45 minutes" ], + "condition": { "and": [ { "u_has_effect": "conjunctivitis", "bodypart": "eyes" }, { "not": { "u_has_effect": "sleep" } } ] }, + "effect": [ + { + "u_add_effect": "smoke_eyes", + "duration": 180, + "intensity": { "math": [ "u_effect_intensity('smoke_eyes', 'bodypart': 'eyes') + 1" ] }, + "target_part": "eyes" + } + ] } ] diff --git a/data/json/effects_on_condition/misc_effect_on_condition.json b/data/json/effects_on_condition/misc_effect_on_condition.json index a8c1e6d388734..f340c03070947 100644 --- a/data/json/effects_on_condition/misc_effect_on_condition.json +++ b/data/json/effects_on_condition/misc_effect_on_condition.json @@ -192,5 +192,30 @@ ] } ] + }, + { + "type": "effect_on_condition", + "id": "eoc_boomered_apply_conjunctivitis", + "eoc_type": "EVENT", + "required_event": "character_gains_effect", + "condition": { + "and": [ + { "compare_string": [ "boomered", { "context_val": "effect" } ] }, + { "compare_string": [ "eyes", { "context_val": "bodypart" } ] }, + { "not": { "u_has_effect": "conjunctivitis" } }, + { "not": { "u_has_trait": "COMPOUND_EYES" } }, + { "not": { "u_has_trait": "SEESLEEP" } }, + { "not": { "u_has_bionics": "armor_bio_eyes" } }, + { "math": [ "u_coverage('eyes')", "<", "rand(100)" ] }, + { "x_in_y_chance": { "x": 2, "y": 3 } } + ] + }, + "effect": [ + { + "u_add_effect": "conjunctivitis", + "duration": { "math": [ "( 1 - u_coverage('eyes') / 100 ) * rand(259200) + 172800" ] }, + "target_part": "eyes" + } + ] } ] diff --git a/src/iuse.cpp b/src/iuse.cpp index 32a72b0ada2a8..cc62c35a22e62 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -162,6 +162,7 @@ static const efftype_id effect_boomered( "boomered" ); static const efftype_id effect_bouldering( "bouldering" ); static const efftype_id effect_brainworms( "brainworms" ); static const efftype_id effect_cig( "cig" ); +static const efftype_id effect_conjunctivitis( "conjunctivitis" ); static const efftype_id effect_contacts( "contacts" ); static const efftype_id effect_corroding( "corroding" ); static const efftype_id effect_critter_well_fed( "critter_well_fed" ); @@ -675,6 +676,13 @@ std::optional iuse::eyedrops( Character *p, item *it, const tripoint & ) p->remove_effect( effect_boomered ); p->add_msg_if_player( m_good, _( "You wash the slime from your eyes." ) ); } + if( p->has_effect( effect_conjunctivitis ) ) { + effect &eff = p->get_effect( effect_conjunctivitis ); + if( eff.get_duration() > 2_days ) { + p->add_msg_if_player( m_good, _( "You wash some of the chemical irritant from your eyes." ) ); + eff.set_duration( 2_days ); + } + } return 1; }