[
  {
    "id": "sunny",
    "type": "weather_type",
    "name": "Sunny",
    "color": "light_cyan",
    "map_color": "yellow_white",
    "sym": "*",
    "ranged_penalty": 0,
    "sight_penalty": 1.0,
    "light_modifier": 2,
    "sound_attn": 0,
    "dangerous": false,
    "precip": "none",
    "rains": false,
    "sound_category": "sunny",
    "priority": 10,
    "condition": { "and": [ "is_day", { "math": [ "weather('pressure') >= 1020" ] }, { "math": [ "weather('humidity') < 70" ] } ] }
  },
  {
    "id": "cloudy",
    "type": "weather_type",
    "name": "Cloudy",
    "color": "light_gray",
    "map_color": "dark_gray_white",
    "sym": "~",
    "ranged_penalty": 0,
    "sight_penalty": 1.0,
    "light_modifier": -20,
    "sun_multiplier": 0.3,
    "sound_attn": 0,
    "dangerous": false,
    "precip": "none",
    "rains": false,
    "sound_category": "cloudy",
    "priority": 20,
    "condition": { "and": [ { "math": [ "weather('humidity') >= 40" ] }, { "math": [ "weather('pressure') < 1010" ] } ] }
  },
  {
    "id": "light_drizzle",
    "type": "weather_type",
    "name": "Light Drizzle",
    "color": "light_blue",
    "map_color": "h_light_blue",
    "sym": ".",
    "ranged_penalty": 0,
    "sight_penalty": 1.01,
    "light_modifier": -10,
    "sun_multiplier": 0.2,
    "sound_attn": 0,
    "dangerous": false,
    "precip": "very_light",
    "rains": true,
    "tiles_animation": "weather_rain_drop",
    "weather_animation": { "factor": 0.01, "color": "light_blue", "sym": "," },
    "sound_category": "drizzle",
    "required_weathers": [ "cloudy" ],
    "priority": 30,
    "condition": { "or": [ { "math": [ "weather('humidity') >= 96" ] }, { "math": [ "weather('pressure') < 1003" ] } ] }
  },
  {
    "id": "drizzle",
    "type": "weather_type",
    "name": "Drizzle",
    "color": "light_blue",
    "map_color": "h_light_blue",
    "sym": ".",
    "ranged_penalty": 1,
    "sight_penalty": 1.03,
    "light_modifier": -20,
    "sun_multiplier": 0.1,
    "sound_attn": 1,
    "dangerous": false,
    "precip": "light",
    "rains": true,
    "tiles_animation": "weather_rain_drop",
    "weather_animation": { "factor": 0.01, "color": "light_blue", "sym": "." },
    "sound_category": "drizzle",
    "required_weathers": [ "light_drizzle" ],
    "priority": 40,
    "condition": { "or": [ { "math": [ "weather('humidity') >= 97" ] }, { "math": [ "weather('pressure') < 1000" ] } ] }
  },
  {
    "id": "rain",
    "type": "weather_type",
    "name": "Rain",
    "color": "blue",
    "map_color": "h_blue",
    "sym": "o",
    "ranged_penalty": 3,
    "sight_penalty": 1.1,
    "light_modifier": -30,
    "sun_multiplier": 0.03,
    "sound_attn": 4,
    "dangerous": false,
    "precip": "heavy",
    "rains": true,
    "tiles_animation": "weather_rain_drop",
    "weather_animation": { "factor": 0.02, "color": "light_blue", "sym": "," },
    "sound_category": "rainy",
    "required_weathers": [ "light_drizzle", "drizzle" ],
    "priority": 50,
    "condition": { "or": [ { "math": [ "weather('humidity') >= 98" ] }, { "math": [ "weather('pressure') < 993" ] } ] }
  },
  {
    "id": "rainstorm",
    "type": "weather_type",
    "name": "Rain Storm",
    "color": "blue",
    "map_color": "i_blue",
    "sym": "%",
    "ranged_penalty": 6,
    "sight_penalty": 1.2,
    "light_modifier": -35,
    "sun_multiplier": 0.01,
    "sound_attn": 8,
    "dangerous": false,
    "precip": "heavy",
    "rains": true,
    "tiles_animation": "weather_rain_drop",
    "weather_animation": { "factor": 0.04, "color": "blue", "sym": ";" },
    "sound_category": "rainstorm",
    "required_weathers": [ "rain" ],
    "priority": 60,
    "condition": {
      "and": [ { "math": [ "weather('temperature') >= from_fahrenheit( 33 )" ] }, { "math": [ "weather('windpower') >= 15" ] } ]
    }
  },
  {
    "id": "thunder",
    "type": "weather_type",
    "name": "Thunder Storm",
    "color": "dark_gray",
    "map_color": "i_blue",
    "sym": "%",
    "ranged_penalty": 4,
    "sight_penalty": 1.2,
    "light_modifier": -40,
    "sun_multiplier": 0.01,
    "sound_attn": 8,
    "dangerous": false,
    "precip": "heavy",
    "rains": true,
    "tiles_animation": "weather_rain_drop",
    "weather_animation": { "factor": 0.02, "color": "light_blue", "sym": "." },
    "sound_category": "thunder",
    "required_weathers": [ "rain" ],
    "priority": 70,
    "condition": { "math": [ "weather('pressure') < 996" ] }
  },
  {
    "id": "lightning",
    "type": "weather_type",
    "name": "Lightning Storm",
    "color": "yellow",
    "map_color": "h_yellow",
    "sym": "%",
    "ranged_penalty": 4,
    "sight_penalty": 1.25,
    "light_modifier": -45,
    "sun_multiplier": 0.01,
    "sound_attn": 8,
    "dangerous": false,
    "precip": "heavy",
    "rains": true,
    "tiles_animation": "weather_rain_drop",
    "weather_animation": { "factor": 0.04, "color": "light_blue", "sym": "," },
    "sound_category": "thunder",
    "required_weathers": [ "thunder" ],
    "priority": 80,
    "condition": { "math": [ "weather('pressure') < 990" ] }
  },
  {
    "id": "flurries",
    "type": "weather_type",
    "name": "Flurries",
    "color": "white",
    "map_color": "dark_gray_cyan",
    "sym": ".",
    "ranged_penalty": 2,
    "sight_penalty": 1.12,
    "light_modifier": -15,
    "sun_multiplier": 0.3,
    "sound_attn": 2,
    "dangerous": false,
    "precip": "light",
    "rains": false,
    "tiles_animation": "weather_snowflake",
    "weather_animation": { "factor": 0.01, "color": "white", "sym": "." },
    "sound_category": "flurries",
    "required_weathers": [ "drizzle" ],
    "priority": 90,
    "condition": { "math": [ "weather('temperature') < from_fahrenheit( 33 )" ] }
  },
  {
    "id": "snowing",
    "type": "weather_type",
    "name": "Snowing",
    "color": "white",
    "map_color": "dark_gray_cyan",
    "sym": "*",
    "ranged_penalty": 4,
    "sight_penalty": 1.3,
    "light_modifier": -20,
    "sun_multiplier": 0.15,
    "sound_attn": 4,
    "dangerous": false,
    "precip": "heavy",
    "rains": false,
    "tiles_animation": "weather_snowflake",
    "weather_animation": { "factor": 0.02, "color": "white", "sym": "," },
    "sound_category": "snow",
    "required_weathers": [ "rain", "thunder", "lightning" ],
    "priority": 100,
    "condition": { "math": [ "weather('temperature') < from_fahrenheit( 33 )" ] }
  },
  {
    "id": "snowstorm",
    "type": "weather_type",
    "name": "Snowstorm",
    "color": "white",
    "map_color": "white_cyan",
    "sym": "%",
    "ranged_penalty": 6,
    "sight_penalty": 1.2,
    "light_modifier": -30,
    "sun_multiplier": 0.01,
    "sound_attn": 6,
    "dangerous": false,
    "precip": "heavy",
    "rains": false,
    "tiles_animation": "weather_snowflake",
    "weather_animation": { "factor": 0.04, "color": "white", "sym": "*" },
    "sound_category": "snowstorm",
    "required_weathers": [ "thunder", "lightning" ],
    "priority": 110,
    "condition": {
      "and": [ { "math": [ "weather('temperature') < from_fahrenheit( 33 )" ] }, { "math": [ "weather('windpower') >= 15" ] } ]
    }
  },
  {
    "id": "mist",
    "type": "weather_type",
    "name": "Mist",
    "color": "light_gray",
    "map_color": "dark_gray_white",
    "sym": "~",
    "ranged_penalty": 3,
    "sight_penalty": 1.3,
    "light_modifier": -20,
    "sun_multiplier": 0.3,
    "sound_attn": 0,
    "dangerous": false,
    "precip": "none",
    "rains": false,
    "sound_category": "silent",
    "priority": 15,
    "required_weathers": [ "clear", "sunny", "fog" ],
    "condition": {
      "and": [
        { "math": [ "weather('windpower') < 12" ] },
        { "math": [ "weather('windpower') > 0" ] },
        { "math": [ "dew_point_factor(celsius(weather('temperature'))) <= 2.5" ] },
        { "math": [ "weather('humidity') < 90" ] }
      ]
    }
  },
  {
    "id": "fog",
    "type": "weather_type",
    "name": "Fog",
    "color": "light_gray",
    "map_color": "dark_gray_white",
    "sym": "~",
    "ranged_penalty": 7,
    "sight_penalty": 1.7,
    "light_modifier": -40,
    "sun_multiplier": 0.3,
    "sound_attn": 0,
    "dangerous": false,
    "precip": "none",
    "rains": false,
    "sound_category": "silent",
    "priority": 15,
    "required_weathers": [ "clear", "sunny", "mist" ],
    "condition": {
      "and": [
        { "math": [ "weather('windpower') < 12" ] },
        { "math": [ "weather('windpower') > 0" ] },
        { "math": [ "dew_point_factor(celsius(weather('temperature'))) <= 2.5" ] }
      ]
    }
  },
  {
    "type": "jmath_function",
    "id": "dprhx",
    "num_args": 1,
    "return": "log(weather('humidity') / 100) + 17.625 * _0 / (243.04 + _0)"
  },
  {
    "type": "jmath_function",
    "id": "dew_point",
    "num_args": 1,
    "//": "Eq. (8) from https://doi.org/10.1175/BAMS-86-2-225; _0 is temperature in Celsius",
    "return": "243.04 * dprhx(_0) / (17.625 - dprhx(_0))"
  },
  {
    "type": "jmath_function",
    "id": "dew_point_factor",
    "num_args": 1,
    "//": "the closer this difference gets to zero, the bigger the probability for fog to occur, starting at around 2.5 Celsius",
    "return": "abs( _0 - dew_point(_0) )"
  },
  {
    "id": "early_portal_storm",
    "type": "weather_type",
    "name": "Early Portal Storm",
    "color": "light_red",
    "map_color": "light_red",
    "sym": "o",
    "ranged_penalty": 0,
    "sight_penalty": 1.0,
    "light_modifier": -5,
    "sun_multiplier": 0.8,
    "sound_attn": 0,
    "dangerous": true,
    "precip": "none",
    "rains": false,
    "debug_cause_eoc": "EOC_CAUSE_EARLY_PORTAL_STORM",
    "debug_leave_eoc": "EOC_CANCEL_PORTAL_STORM",
    "tiles_animation": "weather_portal_storm",
    "weather_animation": { "factor": 0.01, "color": "red", "sym": "*" },
    "sound_category": "portal_storm",
    "priority": 120,
    "condition": {
      "and": [
        { "math": [ "cause_early_portal_storm == 1" ] },
        {
          "math": [ "distance(_weather_location, portal_storm_center) <= value_or(portal_storm_distant_distance, 200)" ]
        }
      ]
    }
  },
  {
    "id": "distant_portal_storm",
    "type": "weather_type",
    "name": "Distant Portal Storm",
    "color": "red",
    "map_color": "red",
    "sym": "O",
    "ranged_penalty": 0,
    "sight_penalty": 1.0,
    "light_modifier": -8,
    "sun_multiplier": 0.7,
    "sound_attn": 0,
    "dangerous": true,
    "precip": "none",
    "rains": false,
    "debug_cause_eoc": "EOC_CAUSE_PORTAL_STORM",
    "debug_leave_eoc": "EOC_CANCEL_PORTAL_STORM",
    "tiles_animation": "weather_portal_storm",
    "weather_animation": { "factor": 0.01, "color": "red", "sym": "*" },
    "sound_category": "portal_storm",
    "priority": 130,
    "condition": {
      "and": [
        { "math": [ "cause_portal_storm == 1" ] },
        {
          "math": [ "distance(_weather_location, portal_storm_center) <= value_or(portal_storm_distant_distance, 200)" ]
        }
      ]
    }
  },
  {
    "id": "close_portal_storm",
    "type": "weather_type",
    "name": "Close Portal Storm",
    "color": "red",
    "map_color": "red",
    "sym": "O",
    "ranged_penalty": 0,
    "sight_penalty": 1.0,
    "light_modifier": -10,
    "sun_multiplier": 0.6,
    "sound_attn": 0,
    "dangerous": true,
    "precip": "none",
    "rains": false,
    "debug_cause_eoc": "EOC_CAUSE_PORTAL_STORM",
    "debug_leave_eoc": "EOC_CANCEL_PORTAL_STORM",
    "tiles_animation": "weather_portal_storm",
    "weather_animation": { "factor": 0.02, "color": "red", "sym": "*" },
    "sound_category": "portal_storm",
    "priority": 131,
    "condition": {
      "and": [
        { "math": [ "cause_portal_storm == 1" ] },
        {
          "math": [ "distance(_weather_location, portal_storm_center) <= value_or(portal_storm_close_distance, 100)" ]
        }
      ]
    }
  },
  {
    "id": "portal_storm",
    "type": "weather_type",
    "name": "Portal Storm",
    "color": "red",
    "map_color": "red",
    "sym": "O",
    "ranged_penalty": 0,
    "sight_penalty": 1.0,
    "light_modifier": -14,
    "sun_multiplier": 0.5,
    "sound_attn": 0,
    "dangerous": true,
    "precip": "none",
    "rains": false,
    "debug_cause_eoc": "EOC_CAUSE_PORTAL_STORM",
    "debug_leave_eoc": "EOC_CANCEL_PORTAL_STORM",
    "tiles_animation": "weather_portal_storm",
    "weather_animation": { "factor": 0.03, "color": "red", "sym": "*" },
    "sound_category": "portal_storm",
    "priority": 132,
    "condition": {
      "and": [
        { "math": [ "cause_portal_storm == 1" ] },
        { "math": [ "distance(_weather_location, portal_storm_center) <= value_or(portal_storm_distance, 50)" ] }
      ]
    }
  }
]
