[
  {
    "type": "effect_on_condition",
    "id": "EOC_SLEEP",
    "effect": [ { "u_message": "You feel very sleepy…" }, { "math": [ "u_val('sleepiness')", "+=", "40" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MINOR_SLEEP",
    "effect": [ { "u_message": "You feel sleepy…" }, { "math": [ "u_val('sleepiness')", "+=", "20" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "ambient_subway",
    "recurrence": [ "1 hours", "2 hours" ],
    "global": true,
    "condition": { "u_at_om_location": "subway" },
    "effect": [ { "u_message": "<AMBIENT_SUBWAY>", "snippet": true, "sound": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "ambient_lab_subway",
    "recurrence": [ "1 hours", "2 hours" ],
    "global": true,
    "condition": { "u_at_om_location": "lab_subway" },
    "effect": [ { "u_message": "<AMBIENT_LAB_SUBWAY>", "snippet": true, "sound": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "ambient_sewer",
    "recurrence": [ "1 hours", "2 hours" ],
    "global": true,
    "condition": { "u_at_om_location": "sewer" },
    "effect": [ { "u_message": "<AMBIENT_SEWER>", "snippet": true, "sound": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "robofac_surveillance",
    "recurrence": [ "1 days", "7 days" ],
    "global": true,
    "condition": { "or": [ { "u_has_trait": "PROF_HUB01_ANCILLIARY" }, { "u_has_effect": "robofac_surveillance" } ] },
    "effect": [
      { "u_spawn_monster": "mon_robofac_camspy", "real_count": 1, "min_radius": 15, "max_radius": 40, "outdoor_only": true }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_mininuke_record",
    "eoc_type": "EVENT",
    "required_event": "activates_mininuke",
    "effect": [ { "math": [ "u_mininuke_activated++" ] } ]
  },
  {
    "id": "EOC_DEATH_SWITCH",
    "type": "effect_on_condition",
    "eoc_type": "AVATAR_DEATH",
    "condition": {
      "and": [ { "npc_allies_global": 1 }, { "u_query": "You have died.  Continue as one of your followers?", "default": false } ]
    },
    "effect": [ "take_control_menu" ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_last_amigara_death",
    "condition": { "math": [ "n_monsters_nearby('mon_amigara_horror') < 1" ] },
    "effect": [
      { "npc_location_variable": { "context_val": "loc" }, "max_radius": 2, "passable_only": true },
      { "map_spawn_item": "amigara_drops", "use_item_group": true, "loc": { "context_val": "loc" } },
      { "run_eocs": [ "EOC_remove_amigara_effect" ] },
      {
        "if": "has_alpha",
        "then": [
          { "u_lose_effect": "effect_amigara" },
          { "u_add_var": "general_talk_clearead_amigara_mine", "value": "yes" },
          {
            "u_message": "As the last of the horrors fell dead, you notice a strange thing popped up from nowhere and dropped on the ground.",
            "type": "info"
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_remove_amigara_effect",
    "global": true,
    "effect": [ { "u_lose_effect": "effect_amigara" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PLAY_PIANO",
    "effect": [
      { "u_add_morale": "morale_music", "bonus": 5, "max_bonus": 10 },
      { "u_make_sound": "music", "type": "music", "volume": 10 },
      { "u_message": "play_piano", "snippet": true }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_RANDOM_HALLUCINATIONS",
    "recurrence": [ "1 hours", "3 hours" ],
    "condition": { "and": [ { "u_has_effect": "hallucination_attacks" }, { "x_in_y_chance": { "x": 1, "y": 6 } } ] },
    "effect": [
      {
        "if": { "math": [ "u_monsters_nearby() > 1" ] },
        "then": {
          "u_spawn_monster": "GROUP_YOUR_FEARS",
          "group": true,
          "real_count": 0,
          "hallucination_count": { "math": [ "rand(2) + 1" ] },
          "outdoor_only": false,
          "min_radius": 10,
          "max_radius": 40,
          "lifespan": [ "1 hours", "4 hours" ]
        }
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_discover_zomborg",
    "condition": { "math": [ "u_monsters_nearby('mon_zomborg') >= 1" ] },
    "effect": [ { "u_add_var": "dialogue_exodii_seen_zomborg", "value": "yes" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "yrax_trifacet_activation",
    "effect": [
      { "u_spawn_monster": "mon_yrax_trifacet", "real_count": 1, "min_radius": 1, "max_radius": 2 },
      { "u_message": "The hostile trifacet violently unfolds just clear of your hand!", "type": "bad" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "yrax_triakis_activation",
    "effect": [
      { "u_spawn_monster": "mon_yrax_triakis", "real_count": 1, "min_radius": 1, "max_radius": 2 },
      { "u_message": "The hostile triakis violently unfolds just clear of your hand!", "type": "bad" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "yrax_golden_monolith_activation",
    "effect": [
      { "u_spawn_monster": "mon_golden_monolith", "real_count": 1, "min_radius": 1, "max_radius": 2 },
      {
        "u_message": "You notice a brief lull in the ambient noise around you, but its otherwise impossible to know if you allowed something to happen.",
        "type": "bad"
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "yrax_delta_activation",
    "effect": [
      { "u_spawn_monster": "mon_yrax_delta", "real_count": 1, "min_radius": 1, "max_radius": 2 },
      { "u_message": "The hostile delta starts flying just as you release it!", "type": "bad" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "add_effect",
    "effect": { "u_add_effect": { "context_val": "effect" }, "duration": { "context_val": "duration" } }
  },
  {
    "type": "effect_on_condition",
    "id": "sewer_morale_debuff",
    "global": false,
    "recurrence": [ "20 minutes", "1 hour" ],
    "condition": {
      "or": [
        { "u_at_om_location": "sewer" },
        { "u_at_om_location": "pump_station_3" },
        { "u_at_om_location": "pump_station_4" },
        { "u_at_om_location": "pump_station_5" }
      ]
    },
    "effect": [
      { "u_message": "<SEWER_MORALE_DEBUFF>", "snippet": true },
      {
        "if": { "u_has_trait": "SQUEAMISH" },
        "then": [
          { "u_add_morale": "morale_hates_sewer", "bonus": -20, "max_bonus": -40, "duration": "1 hour", "decay_start": "1 hour" }
        ],
        "else": [
          {
            "u_add_morale": "morale_dislikes_sewer",
            "bonus": -10,
            "max_bonus": -20,
            "duration": "1 hour",
            "decay_start": "1 hour"
          }
        ]
      }
    ]
  },
  {
    "id": "morale_hates_sewer",
    "type": "morale_type",
    "text": "Hates being in sewer"
  },
  {
    "id": "morale_dislikes_sewer",
    "type": "morale_type",
    "text": "Dislikes being in sewer"
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_TOOK_OVER_CAMP_NOTICE",
    "eoc_type": "EVENT",
    "required_event": "camp_taken_over",
    "condition": { "expects_vars": [ "old_owner", "new_owner", "camp_name", "was_violent" ] },
    "effect": [
      {
        "if": { "compare_string": [ "your_followers", { "context_val": "new_owner" } ] },
        "then": {
          "run_eocs": {
            "id": "EOC_camp_rumor_spread",
            "effect": { "u_message": "Rumors of your takeover of <context_val:camp_name> have begun to spread…", "type": "mixed" }
          },
          "time_in_future": [ "7 days", "14 days" ]
        },
        "else": [
          {
            "//": "Don't bother player unless they even have a camp.",
            "if": "u_has_camp",
            "then": {
              "u_message": "While you've been out of contact with the powers of <context_val:camp_name> it's been taken over by its enemies.",
              "popup": true,
              "type": "bad"
            }
          }
        ]
      }
    ]
  },
  {
    "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_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": [
      {
        "if": { "u_has_effect": "conjunctivitis", "bodypart": "eyes" },
        "then": { "u_lose_effect": "conjunctivitis", "target_part": "eyes" }
      },
      {
        "u_add_effect": "conjunctivitis",
        "duration": { "math": [ "( 1 - u_coverage('eyes') / 100 ) * rand(345600) + 86400" ] },
        "target_part": "eyes"
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_boomer_bile_affliction",
    "eoc_type": "EVENT",
    "required_event": "character_gains_effect",
    "condition": { "and": [ { "compare_string": [ "boomered", { "context_val": "effect" } ] } ] },
    "effect": [
      {
        "math": [ "BILE_STINK_DURATION = u_effect_duration('bile_stink') > 0 ? u_effect_duration('bile_stink') + 300 : 600" ]
      },
      { "math": [ "MORALE_MULTIPLIER = u_has_trait('SQUEAMISH') ? -2 : -1" ] },
      { "u_add_effect": "bile_stink", "duration": { "global_val": "BILE_STINK_DURATION" } },
      {
        "if": { "not": { "or": [ { "u_has_flag": "IRRITANT_IMMUNE" }, { "u_has_worn_with_flag": "IRRITANT_IMMUNE" } ] } },
        "then": [
          {
            "math": [
              "BILE_IRRITANT_DURATION",
              "=",
              "u_effect_duration('bile_irritant') > 0 ? u_effect_duration('bile_irritant') + 120 + rand(90) : 240 + rand(180)"
            ]
          },
          { "math": [ "MORALE_MULTIPLIER", "*=", "u_has_trait('SQUEAMISH') ? 4 : 2" ] },
          { "u_add_effect": "bile_irritant", "duration": { "global_val": "BILE_IRRITANT_DURATION" } }
        ]
      },
      {
        "if": { "not": { "u_has_any_trait": [ "SAPROVORE", "EATDEAD", "THRESH_SLIME" ] } },
        "then": [
          {
            "u_add_morale": "morale_bile",
            "bonus": { "math": [ "MORALE_MULTIPLIER * 3" ] },
            "max_bonus": { "math": [ "MORALE_MULTIPLIER * 6" ] },
            "duration": { "global_val": "BILE_STINK_DURATION" },
            "decay_start": { "math": [ "BILE_STINK_DURATION / 2" ] }
          }
        ],
        "else": [
          {
            "u_add_morale": "morale_bile",
            "bonus": { "math": [ "MORALE_MULTIPLIER" ] },
            "max_bonus": { "math": [ "MORALE_MULTIPLIER * 2" ] },
            "duration": { "math": [ "BILE_STINK_DURATION / 2" ] },
            "decay_start": { "math": [ "BILE_STINK_DURATION / 4" ] }
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "sunrise_morale_buff",
    "recurrence": { "math": [ "time_until('sunrise')" ] },
    "global": true,
    "run_for_npcs": true,
    "condition": { "and": [ "u_is_outside", "u_can_see", { "test_eoc": "EOC_CONDITION_XE_SUNRISE_MORALE_OVERRIDES" } ] },
    "effect": [
      {
        "if": { "or": [ { "is_weather": "sunny" }, { "is_weather": "clear" } ] },
        "then": [
          {
            "if": { "and": [ { "u_has_trait": "SPIRITUAL" }, { "x_in_y_chance": { "x": 1, "y": 2 } } ] },
            "then": [
              { "u_message": "As you gaze upon the sunrise, you feel enraptured by its ethereal beauty.", "type": "good" },
              {
                "u_add_morale": "morale_sunrise",
                "bonus": 15,
                "max_bonus": 15,
                "duration": "120 minutes",
                "decay_start": "60 minutes"
              }
            ],
            "else": [
              {
                "if": { "x_in_y_chance": { "x": 1, "y": 5 } },
                "then": [
                  { "u_message": "The sunrise is especially beautiful today.", "type": "good" },
                  {
                    "u_add_morale": "morale_sunrise",
                    "bonus": 15,
                    "max_bonus": 15,
                    "duration": "120 minutes",
                    "decay_start": "60 minutes"
                  }
                ],
                "else": [
                  { "u_message": "The sunrise always makes you a feel a little bit better.", "type": "good" },
                  {
                    "u_add_morale": "morale_sunrise",
                    "bonus": 10,
                    "max_bonus": 10,
                    "duration": "120 minutes",
                    "decay_start": "60 minutes"
                  }
                ]
              }
            ]
          }
        ],
        "else": [
          { "u_message": "The sunrise is hidden behind clouds, but it is still a bright, new day.", "type": "good" },
          {
            "u_add_morale": "morale_sunrise",
            "bonus": 5,
            "max_bonus": 5,
            "duration": "60 minutes",
            "decay_start": "30 minutes"
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_CONDITION_XE_SUNRISE_MORALE_OVERRIDES",
    "condition": { "math": [ "0 == 0" ] },
    "effect": [  ]
  },
  {
    "type": "effect_on_condition",
    "id": "sunset_morale_buff",
    "recurrence": { "math": [ "time_until('sunset')" ] },
    "global": true,
    "run_for_npcs": true,
    "condition": { "and": [ "u_is_outside", "u_can_see", { "test_eoc": "EOC_CONDITION_XE_SUNSET_MORALE_OVERRIDES" } ] },
    "effect": [
      {
        "if": { "or": [ { "is_weather": "sunny" }, { "is_weather": "clear" } ] },
        "then": [
          {
            "if": { "and": [ { "u_has_trait": "SPIRITUAL" }, { "x_in_y_chance": { "x": 1, "y": 2 } } ] },
            "then": [
              { "u_message": "As you gaze upon the sunset, you feel enraptured by its ethereal beauty.", "type": "good" },
              {
                "u_add_morale": "morale_sunset",
                "bonus": 15,
                "max_bonus": 15,
                "duration": "120 minutes",
                "decay_start": "60 minutes"
              }
            ],
            "else": [
              {
                "if": { "x_in_y_chance": { "x": 1, "y": 5 } },
                "then": [
                  { "u_message": "The sunset is especially beautiful today.", "type": "good" },
                  {
                    "u_add_morale": "morale_sunset",
                    "bonus": 15,
                    "max_bonus": 15,
                    "duration": "120 minutes",
                    "decay_start": "60 minutes"
                  }
                ],
                "else": [
                  { "u_message": "The sunset always makes you a feel a little bit better.", "type": "good" },
                  {
                    "u_add_morale": "morale_sunset",
                    "bonus": 10,
                    "max_bonus": 10,
                    "duration": "120 minutes",
                    "decay_start": "60 minutes"
                  }
                ]
              }
            ]
          }
        ],
        "else": [
          { "u_message": "The sunset is hidden behind clouds, but you can still see the pretty amber hue.", "type": "good" },
          {
            "u_add_morale": "morale_sunset",
            "bonus": 5,
            "max_bonus": 5,
            "duration": "60 minutes",
            "decay_start": "30 minutes"
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_CONDITION_XE_SUNSET_MORALE_OVERRIDES",
    "condition": { "math": [ "0 == 0" ] },
    "effect": [  ]
  }
]
