[
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_CONTROL",
    "recurrence": [ "12 hours", "1 day" ],
    "global": true,
    "effect": [
      { "u_teleport": { "global_val": "your_spawnpoint" } },
      { "math": [ "wave_number", "++" ] },
      { "u_message": "Welcome to wave <global_val:wave_number>!", "type": "bad", "popup": false },
      { "run_eocs": "DEFENSE_MODE_WAVE_SPECIAL_DECIDER" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPECIAL_DECIDER",
    "global": true,
    "//": "This is used to decide for special waves, like shadow spawns and ultimate victory.",
    "condition": {
      "and": [
        { "math": [ "special_waves_allowed", "==", "0" ] },
        {
          "or": [
            { "math": [ "wave_number", "==", "5" ] },
            { "math": [ "wave_number", "==", "15" ] },
            { "math": [ "wave_number", "==", "30" ] },
            { "math": [ "wave_number", "==", "50" ] }
          ]
        }
      ]
    },
    "effect": [
      {
        "run_eocs": [
          "DEFENSE_MODE_WAVE_SPECIAL_FERALS",
          "DEFENSE_MODE_WAVE_SPECIAL_RATKIN",
          "DEFENSE_MODE_WAVE_SPECIAL_MILITARY",
          "DEFENSE_MODE_WAVE_SPECIAL_SHADOW"
        ]
      }
    ],
    "false_effect": [ { "run_eocs": "DEFENSE_MODE_WAVE_SPAWN_FALLBACK" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPAWN_FALLBACK",
    "//": "Fallback case which runs until something spawns.",
    "effect": [
      {
        "weighted_list_eocs": [
          [ "DEFENSE_MODE_WAVE_SPAWN_ZOMBIES", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_SPECIAL_ZOMBIES", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_SPIDERS", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_ROBOTS", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_TRIFFIDS", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_SUBSPACE", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_DINOS", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_LIZARDFOLK", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_GOLEMS", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_GOBLINS", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_ORCS", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_MEGAFAUNA", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_PSYCHICS", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_CANDY", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_MYTHOS", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_EXODII", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_XEDRA", 1 ],
          [ "DEFENSE_MODE_WAVE_SPAWN_AFTERSHOCK", 1 ]
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPAWN_ZOMBIES",
    "condition": { "math": [ "regular_zombies_allowed", "==", "1" ] },
    "effect": [
      {
        "u_spawn_monster": "GROUP_VANILLA_ONLY_HUMANS",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_VANILLA_ONLY_HUMANS",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_VANILLA_ONLY_HUMANS",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      }
    ],
    "false_effect": { "run_eocs": "DEFENSE_MODE_WAVE_SPAWN_FALLBACK" }
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPAWN_SPECIAL_ZOMBIES",
    "condition": { "math": [ "special_zombies_allowed", "==", "1" ] },
    "effect": [
      {
        "u_spawn_monster": "GROUP_ZOMBIE",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_ZOMBIE",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_ZOMBIE",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      }
    ],
    "false_effect": { "run_eocs": "DEFENSE_MODE_WAVE_SPAWN_FALLBACK" }
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPAWN_SPIDERS",
    "condition": { "math": [ "spiders_allowed", "==", "1" ] },
    "effect": [
      {
        "u_spawn_monster": "GROUP_SPIDER_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_SPIDER_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_SPIDER_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      }
    ],
    "false_effect": { "run_eocs": "DEFENSE_MODE_WAVE_SPAWN_FALLBACK" }
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPAWN_ROBOTS",
    "condition": { "math": [ "robots_allowed", "==", "1" ] },
    "effect": [
      {
        "u_spawn_monster": "GROUP_ROBOT_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_ROBOT_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_ROBOT_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      }
    ],
    "false_effect": { "run_eocs": "DEFENSE_MODE_WAVE_SPAWN_FALLBACK" }
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPAWN_TRIFFIDS",
    "condition": { "math": [ "triffids_allowed", "==", "1" ] },
    "effect": [
      {
        "u_spawn_monster": "GROUP_TRIFFID_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_TRIFFID_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_TRIFFID_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      }
    ],
    "false_effect": { "run_eocs": "DEFENSE_MODE_WAVE_SPAWN_FALLBACK" }
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPAWN_SUBSPACE",
    "condition": { "math": [ "subspace_allowed", "==", "1" ] },
    "effect": [
      {
        "u_spawn_monster": "GROUP_NETHER_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_NETHER_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_NETHER_DM",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      }
    ],
    "false_effect": { "run_eocs": "DEFENSE_MODE_WAVE_SPAWN_FALLBACK" }
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPECIAL_FERALS",
    "condition": { "math": [ "wave_number", "==", "5" ] },
    "effect": [
      {
        "u_spawn_monster": "GROUP_FERAL",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_FERAL",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_FERAL",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_message": "You hear the wild howls of crazed individuals and unintelligible, carnal gibberish and slavering cries.  Something is coming, and it doesn't have your best interest in mind.",
        "type": "bad",
        "popup": true
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPECIAL_RATKIN",
    "condition": { "math": [ "wave_number", "==", "15" ] },
    "effect": [
      {
        "u_spawn_monster": "GROUP_RATKIN_EVOLVED",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_RATKIN_EVOLVED",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_RATKIN_EVOLVED",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_message": "Squeaking and chittering can be heard nearby, with the pattering of many feet, like a swarm of rats travelling quickly.  However, this sounds more, organized?  Almost like they're all walking in formation.",
        "type": "bad",
        "popup": true
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPECIAL_MILITARY",
    "condition": { "math": [ "wave_number", "==", "30" ] },
    "effect": [
      {
        "u_spawn_monster": "GROUP_MIL_HELIPAD",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_MIL_HELIPAD",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_spawn_monster": "GROUP_MIL_HELIPAD",
        "real_count": { "math": [ "wave_spawn_number()" ], "default": 1 },
        "outdoor_only": true,
        "group": true,
        "min_radius": 20,
        "max_radius": 40
      },
      {
        "u_message": "You hear crazed, half-pronounced orders screamed from afar.  The tamping of boots and off-beat shouts of two-three-four sound like the signs of an approaching army, but all the footfall is out of tune.",
        "type": "bad",
        "popup": true
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "DEFENSE_MODE_WAVE_SPECIAL_SHADOW",
    "condition": { "math": [ "wave_number", "==", "50" ] },
    "effect": [
      { "u_spawn_monster": "mon_boss_shadow", "real_count": 1, "outdoor_only": true, "min_radius": 20, "max_radius": 40 },
      {
        "u_message": "Your vision flickers with black, blob-like creatures for a moment.  An intense feeling of paranoia washes over you, as if the world itself is now out to kill you, the night itself reaching for your mind to rip it apart.  Somethings wicked comes this way, and it wants you dead.",
        "type": "bad",
        "popup": true
      }
    ]
  }
]
