[
  {
    "type": "effect_on_condition",
    "id": "EOC_RandEnc_Roadstop_Jotunn",
    "recurrence": 3000,
    "global": true,
    "condition": {
      "and": [
        { "u_near_om_location": "s_gas_rural", "range": 30 },
        "is_day",
        { "one_in_chance": 10 },
        { "days_since_cataclysm": 7 },
        {
          "not": { "u_compare_time_since_var": "RandEnc", "type": "timer", "context": "jotunn", "op": "<", "time": "1 d" }
        },
        { "not": { "u_near_om_location": "s_gas_rural", "range": 2 } },
        { "not": { "is_season": "winter" } }
      ]
    },
    "effect": [
      { "mapgen_update": "nest_RandEnc_ruralgas_jotunn", "om_terrain": "s_gas_rural" },
      { "u_add_var": "RandEnc", "type": "timer", "context": "jotunn", "time": true },
      {
        "u_location_variable": { "global_val": "randenc_jotunn_loc" },
        "target_params": { "om_terrain": "roadstop_a" }
      },
      { "arithmetic": [ { "global_val": "var", "var_name": "RandEnc_Jotunn" }, "=", { "const": 1 } ] }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_RandEnc_Jotunn_remove",
    "recurrence": 200,
    "global": true,
    "condition": {
      "and": [
        { "u_compare_time_since_var": "RandEnc", "type": "timer", "context": "jotunn", "op": ">", "time": "3 h" },
        { "not": { "u_near_om_location": "roadstop_a", "range": 2 } },
        { "compare_int": [ { "global_val": "var", "var_name": "RandEnc_Jotunn" }, "==", { "const": 1 } ] }
      ]
    },
    "effect": [
      {
        "mapgen_update": "nest_RandEnc_jotunn_remove",
        "om_terrain": "roadstop_a",
        "target_var": { "global_val": "randenc_jotunn_loc" }
      },
      { "arithmetic": [ { "global_val": "var", "var_name": "RandEnc_Jotunn" }, "=", { "const": 0 } ] }
    ]
  },
  {
    "type": "mapgen",
    "method": "json",
    "update_mapgen_id": "nest_RandEnc_ruralgas_jotunn",
    "//": "Adds a random encounter at this rural gas station",
    "object": {
      "place_monsters": [ { "monster": "GROUP_Exodii_Jotunn", "x": [ 3, 17 ], "y": [ 13, 15 ] } ],
      "place_vehicles": [ { "vehicle": "bearcub", "chance": 30, "status": -3, "x": [ 11 ], "y": [ 12 ] } ],
      "place_corpses": [ { "group": "GROUP_FERAL_AGENTS", "x": [ 7, 14 ], "y": [ 6, 18 ] } ]
    }
  },
  {
    "type": "mapgen",
    "method": "json",
    "update_mapgen_id": "nest_RandEnc_ruralgas_jotunn_remove",
    "//": "removes a random encounter at this roadstop",
    "object": { "set": [ { "square": "creature_remove", "x": 0, "y": 0, "x2": 23, "y2": 23 } ] }
  }
]
