
Def Crops()
  { "crops" {7 7 9 9} "default"}  {2 4} 5
End

"TUTORIAL_VILLAGE"
{
  settlement = {
    type = RandomLayout { "village" { 20 15 } "village"}
    tribe = HUMAN
    inhabitants = {
      leader = {{"PESEANT_LEADER"}}
      fighters = {
        count = {2 4}
        all = {
          1 "PESEANT"
        }
      }
      civilians = {
        count = {3 7}
        all = {
          1 "CHILD"
#          1 "HORSE"  Horses are too strong for the tutorial
          1 "DONKEY_STEED"
          1 "COW"
          1 "PIG"
          1 "GOAT_STEED"
        }
      }
    }
    race = "humans"
    stockpiles = {
      { "gold" 50 "TREASURE_CHEST" }
    }
    crops = Crops()
    furniture = "roomFurniture"
    locationNameGen = TOWN
  }
  config = {
    alwaysMount = true
  }
}
"UNICORN_HERD"
{
  settlement = {
    type = Builtin FOREST "WOOD"
    inhabitants = {
      leader = {{"UNICORN_LEADER"}}
      fighters = {
        count = {5 8}
        all = {
          1 "UNICORN"
        }
      }
    }
    tribe = MONSTER
    race = "unicorns"
  }
  config = {
    immigrantInterval = 200
    maxPopulation = 9
    prisoners = true
  }
  immigrants = {
    {
      ids = {"UNICORN"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}
"KIRIN"
{
  settlement = {
    type = Builtin EMPTY "WOOD"
    inhabitants = {
      leader = {{"KIRIN"}}
    }
    tribe = MONSTER
    race = "ki-rin"
  }
  config = {
    prisoners = true
  }
}
"ANTS_CLOSED"
{
  settlement = {
    type = Builtin ANT_NEST "DUNGEON"
    inhabitants = {
      leader = { { "ANT_QUEEN" } }
      civilians = {
        count = {5 7}
        all = { 1 "ANT_WORKER" }
      }
      fighters = {
        count = {5 7}
        all = { 1 "ANT_SOLDIER" }
      }
    }
    dontConnectCave = true
    surroundWithResources = 5
    tribe = ANT
    race = "ants"
  }
  config = {
    immigrantInterval = 500
    maxPopulation = 15
  }
  behaviour = {
    minPopulation = 1
    minTeamSize = 4
    triggers = { SelfVictims }
    attackBehaviour = KillLeader
  }
  immigrants = {
    {
      ids = {"ANT_WORKER"}
      frequency = 1
    }
    {
      ids = {"ANT_SOLDIER"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}
"ANTS_CLOSED_SMALL"
{
  settlement = {
    type = Builtin SMALL_MINETOWN "DUNGEON"
    inhabitants = {
      civilians = {
        count = {2 5}
        all = { 1 "ANT_WORKER" }
      }
      fighters = {
        count = {3 5}
        all = { 1 "ANT_SOLDIER" }
      }
    }
    tribe = ANT
    race = "ants"
    dontConnectCave = true
    closeToPlayer = true
    surroundWithResources = 6
  }
}
"BLACK_RATS"
{
  settlement = {
    type = Builtin ANT_NEST "DUNGEON"
    inhabitants = {
      fighters = {
        count = {12 20}
        all = { 1 "BLACK_RAT" }
      }
    }
    tribe = ANT
    race = "black rats"
  }
  discoverable = false
  createOnBones = 1.0 { "DWARVES" }
}
"ANTS_OPEN" inherit "ANTS_CLOSED"
{
  settlement = {
    type = Builtin ANT_NEST "DUNGEON"
    inhabitants = {
      leader = { { "ANT_QUEEN" } }
      civilians = {
        count = {5 7}
        all = { 1 "ANT_WORKER" }
      }
      fighters = {
        count = {5 7}
        all = { 1 "ANT_SOLDIER" }
      }
    }
    surroundWithResources = 5
    tribe = ANT
    race = "ants"
  }
  createOnBones = 0.1 { "DWARVES" }
}
"ADA_GOLEMS"
{
  settlement = {
    type = Builtin VAULT "DUNGEON"
    inhabitants = {
      fighters = {
        count = {8 9}
        all = { 1 "ADA_GOLEM" }
      }
    }
    tribe = ANT
    race = "adamantine golems"
    dontConnectCave = true
    surroundWithResources = 3
    extraResources = "ADAMANTIUM_ORE"
  }
}
"CORPSES"
{
  settlement = {
    type = Builtin EMPTY "BRICK"
    tribe = MONSTER
    dontBuildRoad = true
    shopItems = {{10 15} "battle_corpse" }
  }
}
"GOBLIN_VILLAGE"
{
  settlement = {
    type = Builtin VILLAGE "BRICK"
    tribe = GREENSKIN
    inhabitants = {
      leader = { { "GOBLIN_KING" } }
      fighters = {
        count = {12 16}
        all = {
          4 "GOBLIN_WARRIOR_VILLAIN"
          1 "GOBLIN_GUARD_VILLAIN"
          1 "GOBLIN_WIZARD_VILLAIN"
          1 "GOBLIN_ARCHER_VILLAIN"
          1 "GOBLIN_PRIEST"
          1 "GOBLIN_ARTIFICER"
          1 "GOBLIN_KABOOMER"
          1 "TROLL_VILLAIN"
        }
        expLevelIncrease = {
          DAMAGE 10
          SPELL_DAMAGE 10
          RANGED_DAMAGE 10
        }
      }
    }
    locationNameGen = "TOWN"
    race = "greenskins"
    furniture = "roomFurniture"
    outsideFeatures = "villageOutside"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 16
    prisoners = true
  }
  behaviour = {
    ambushChance = 0.1
    minPopulation = 0
    minTeamSize = 8
    triggers = {Resource "GOLD" 500}
    attackBehaviour = StealResource "GOLD"
    ransom = 0.5 80
  }
  createOnBones = 0.1 { "DWARVES" "VILLAGE" }
  immigrants = {
    {
      ids = {"GOBLIN_WARRIOR"}
      traits = {FIGHTER}
      frequency = 3
    }
  }
}
"DEMON_DEN_ENTRY"
{
  settlement = {
    type = RandomLayout { "castle_empty" { 16 16 } "default"}
    tribe = MONSTER
    locationName = "Darkshrine Town"
    race = "ghosts"
    furniture = "dungeonOutside"
  }
  config = {
    conquerCondition = NEVER
  }
}
"DEMON_DEN"
{
  settlement = {
    type = RandomLayout { "castle_up_stairs" { 16 15 } "default"}
    tribe = MONSTER
    inhabitants = {
      leader = { { "DEMON_LORD" } }
      fighters = {
        count = {15 20}
        all = { 1 "DEMON_DWELLER" }
      }
    }
    locationName = "Darkshrine"
    race = "demons"
    furniture = "dungeonOutside"
    outsideFeatures = "dungeonOutside"
#    stockpiles = {{ "gold" 400 "TREASURE_CHEST" }}
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 16
    prisoners = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 3
    triggers = {RoomTrigger "DEMON_SHRINE" 0.0001}
    attackBehaviour = KillLeader
    ransom = 0.5 100
  }
  levelConnection = {
    direction = UP
    topLevel = ExtraEnemy { "DEMON_DEN_ENTRY" }
    levels = {
      {MainEnemy {17 22} BASIC none true }
    }
  }
  immigrants = {
    {
      ids = {"DEMON_DWELLER"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}
"VILLAGE"
{
  settlement = {
    type = Builtin VILLAGE "WOOD"
    tribe = HUMAN
    inhabitants = {
      leader = { { "KNIGHT" } }
      fighters = {
        count = {4 8}
        all = {
          1 "KNIGHT"
          1 "ARCHER"
        }
      }
      civilians = {
        count = {4 8}
        all = {
          1 "PESEANT"
          1 "CHILD"
          1 "DONKEY"
          1 "HORSE"
          1 "COW"
          1 "PIG"
        }
      }
      steeds = {
        all = { 1 "HORSE" }
      }
    }
    locationNameGen = "TOWN"
    race = "humans"
    shopItems = {{8 16} "armory" }
    furniture = "roomFurniture"
  }
  config = {
    spawnGhosts = 4
    ghostProb = 0.1
    alwaysMount = true
    prisoners = true
  }
}
"WARRIORS"
{
  settlement = {
    type = Builtin CASTLE2 "WOOD_CASTLE"
    tribe = HUMAN
    inhabitants = {
      leader = { { "SHAMAN" } }
      fighters = {
        count = {7 10}
        all = { 1 "WARRIOR" }
      }
    }
    locationNameGen = "TOWN"
    race = "humans"
    stockpiles = {{ "gold" 160 "TREASURE_CHEST" }}
    furniture = "roomFurniture"
    outsideFeatures = "castleOutside"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 10
    ghostProb = 0.1
    spawnGhosts = 6
    prisoners = true
  }
  behaviour = {
    ambushChance = 0.1
    minPopulation = 3
    minTeamSize = 5
    triggers = {
      RoomTrigger "THRONE" 0.0003
      RoomTrigger "THRONE_HUMAN" 0.0003
      RoomTrigger "IMPALED_HEAD" 0.0001
      SelfVictims
      NumConquered 2
      StolenItems
      FinishOff
      Proximity
      AggravatingMinions
    }
    attackBehaviour = KillLeader
    ransom = 0.8 140
  }
  immigrants = {
    {
      ids = {"WARRIOR"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}
"KNIGHTS"
{
  settlement = {
    type = RandomLayout { "castle" { 15 15 20 20 } "default"}
    tribe = HUMAN
    inhabitants = {
      leader = { { "DUKE" } }
      fighters = {
        count = {12 17}
        all = {
          1 "PRIEST"
          3 "KNIGHT"
          1 "ARCHER"
        }
      }
      civilians = {
        count = {6 9}
        uniques = { "FATHER_OBLIVION" }
        all = {
          1 "PESEANT"
          1 "CHILD"
          1 "DONKEY"
          1 "COW"
          1 "PIG"
        }
      }
      steeds = {
        all = { 1 "WARHORSE" }
      }
    }
    locationNameGen = "TOWN"
    race = "humans"
    stockpiles = {{ "gold" 140 "TREASURE_CHEST" }}
    shopItems = {{8 16} "villageShop" }
    furniture = "castleFurniture"
    outsideFeatures = "castleOutside"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 36
    ghostProb = 0.1
    spawnGhosts = 6
    alwaysMount = true
    prisoners = true
  }
  behaviour = {
    duelChance = 1.0
    minPopulation = 7
    minTeamSize = 10
    ambushChance = 0.05
    triggers = {
      RoomTrigger "THRONE" 0.0003
      RoomTrigger "THRONE_HUMAN" 0.0003
      RoomTrigger "IMPALED_HEAD" 0.0001
      SelfVictims
      NumConquered 3
      StolenItems
      FinishOff
      Proximity
      AggravatingMinions
    }
    attackBehaviour = KillLeader
    ransom = 0.9 400
  }
  immigrants = {
    {
      ids = {"ARCHER"}
      traits = {FIGHTER}
      frequency = 1
    }
    {
      ids = {"KNIGHT"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
  levelConnection = {
    topLevel = MainEnemy
    levels = {
      { ExtraEnemy { "MINOTAUR" { 1 2 } } {40 40} MAZE }
    }
  }
}
"TEUTONS"
{
  settlement = {
    type = Predefined { "castle1" "BRICK" } 
    tribe = HUMAN
    inhabitants = {
      leader = { { "TEUTON_BOSS" } }
      fighters = {
        count = {6 9}
        all = {
          1 "TEUTON"
        }
      }
      civilians = {
        count = {2 5}
        all = {
          1 "FRIAR"
        }
      }
    }
    locationNameGen = "TOWN"
    race = "Teutonic Knights"
    stockpiles = {{ "gold" 140 "TREASURE_CHEST" }}
    furniture = "castleFurniture"
    outsideFeatures = "castleOutside"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 14
    ghostProb = 0.1
    spawnGhosts = 6
    leaderAsFighter = true
    prisoners = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 5
    triggers = {
      RoomTrigger "THRONE" 0.0003
      RoomTrigger "THRONE_HUMAN" 0.0003
      RoomTrigger "IMPALED_HEAD" 0.0001
      SelfVictims
      NumConquered 3
      StolenItems
      FinishOff
      Proximity
      AggravatingMinions
    }
    attackBehaviour = KillLeader
    ransom = 0.9 1000
  }
  immigrants = {
    {
      ids = {"TEUTON"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}
Def BLACKSMITH(Tribe, Crafter, Troop1, Troop2)
{
  settlement = {
    type = RandomLayout { "blacksmith" { 8 12 } "blacksmith"}
    tribe = Tribe
    inhabitants = {
      leader = { { Crafter } }
      fighters = {
        count = {2 5}
        all = {
          1 Troop1
          1 Troop2
        }
      }
    }
    locationNameGen = "TOWN"
    furniture = "forge"
  }
  levelConnection = {
    topLevel = MainEnemy
    direction = DOWN
    levels = {
      { ExtraEnemy { "BLACKSMITH_CELLAR" {1} } {10 10} BASIC }
    }
  }
}
End
"HUMAN_BLACKSMITH" BLACKSMITH(HUMAN, "ARTISAN_VILLAIN", "KNIGHT", "ARCHER")
"GOBLIN_BLACKSMITH" BLACKSMITH(GREENSKIN, "GOBLIN_ARTIFICER_VILLAIN", "GOBLIN_GUARD_VILLAIN", "GOBLIN_ARCHER_VILLAIN")

"BLACKSMITH_CELLAR"
{
  settlement = {
    type = RandomLayout { "blacksmith_cellar" { 4 4 } "default"}
    tribe = HUMAN
  }
  config = {
    discoverAchievement = "blacksmith_stash"
  }
}
Def STABLE(Tribe, Mount1, Mount2, Creature1, Creature2)
{
  settlement = {
    type = RandomLayout { "stable" { 13 13 } "default"}
    tribe = Tribe
    race = "stable"
    locationNameGen = TOWN
    inhabitants = {
      fighters = {
        count = 2
        all = {
          1 Creature1
          1 Creature2
        }
      }
      civilians = {
        count = {3 8}
        all = {
          1 Mount1
          1 Mount2
        }
      }
    }
  }
  config = {
    prisoners = true
  }
}
End
"HUMAN_STABLE" STABLE(HUMAN, "HORSE_CAN_TRAIN", "WARHORSE", "KNIGHT", "PESEANT")
"THIEF_STABLE" STABLE(HUMAN, "CAMEL", "GOAT", "THIEF", "NOMAD")

"THIEF_STABLE" modify {
  biome = "DESERT"
  settlement = append {
    type = RandomLayout { "stable" { 13 13 } "thief_stable"}
  }
}

"GUARD_POST"
{
  settlement = {
    type = RandomLayout { "guard_post" { 14 14 } "default"}
    tribe = HUMAN
    inhabitants = {
      fighters = {
        combatExperience = -12
        count = {2 5}
        all = {
          1 "KNIGHT"
          1 "ARCHER"
        }
      }
      civilians = {
        count = {1 4}
        all = {
          1 "COW"
          1 "DONKEY"
          1 "DOG"
        }
      }
    }
  }
  config = {
    prisoners = true
  }
  levelConnection = {
    topLevel = MainEnemy
    direction = UP
    levels = {
      { ExtraEnemy { "GUARD_POST2" {1} } {10 10} BASIC }
      { ExtraEnemy { "GUARD_POST3" {1} } {10 10} BASIC }
    }
  }
}
"GUARD_POST2"
{
  settlement = {
    type = RandomLayout { "guard_post_floor2" { 5 7 } "guard_post_floor2"}
    tribe = HUMAN
  }
}
"GUARD_POST3"
{
  settlement = {
    type = RandomLayout { "guard_post_floor3" { 4 4 } "default"}
    tribe = HUMAN
  }
  config = {
    discoverAchievement = "guard_post_stash"
  }
}
"COTTAGE_CELLAR"
{
  settlement = {
    type = RandomLayout { "cottage_cellar" { 4 4 } "default"}
    tribe = HUMAN
  }
}
"MINOTAUR"
{
  settlement = {
    type = Builtin CAVE "BRICK"
    tribe = MONSTER
    inhabitants = {
      leader = { { "MINOTAUR" } }
    }
    locationName = "maze"
    race = "monsters"
    furniture = "roomFurniture"
  }
}
"RED_DRAGON"
{
  biome = "MOUNTAIN"
  settlement = {
    type = RandomLayout { "lava_cave" { 30 30 } "dragon" }
    inhabitants = {
      leader = { { "RED_DRAGON" } }
      civilians = {
        count = {4 5}
        all = { 1 "FIRE_ELEMENTAL" }
      }
    }
    race = "dragon"
    tribe = MONSTER
  }
  config = {
    leaderAsFighter = true
    ghostProb = 0.03
    spawnGhosts = 1
    prisoners = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    triggers = {
      EnemyPopulation 22
      NumConquered 3
      StolenItems
      FinishOff
      Proximity
    }
    attackBehaviour = KillMembers 12
  }
  createOnBones = 0.1 { "KNIGHTS" "DWARVES" "GREEN_DRAGON" "ELEMENTALIST" }
  levelConnection = {
    topLevel = ExtraEnemy {"MAIN_DUNGEON_ENTRY"}
    levels = {
      { MainEnemy {32 32} BASIC }
    }
  }
}
"BLACK_DRAGON" inherit "RED_DRAGON"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    inhabitants = {
      leader = { { "BLACK_DRAGON" } }
    }
    race = "dragon"
    tribe = MONSTER
    shopItems = {{16 20} "dragonCave" }
  }
  createOnBones = 1.0 { "KNIGHTS" "DWARVES" "GREEN_DRAGON" "WARRIORS" }
}
"GREEN_DRAGON"
{
  biome = "SWAMP"
  settlement = {
    type = RandomLayout { "fog_ruins" { 20 20 } "default"}
    inhabitants = {
      leader = { { "GREEN_DRAGON" } }
    }
    tribe = MONSTER
    race = "dragon"
    shopItems = {{16 20} "dragonCave" }
  }
  config = {
    leaderAsFighter = true
    ghostProb = 0.03
    spawnGhosts = 1
    prisoners = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    triggers = {
      EnemyPopulation 18
      NumConquered 2
      StolenItems
      FinishOff
      Proximity
    }
    attackBehaviour = KillMembers 7
  }
  createOnBones = 0.1 { "KNIGHTS" "DWARVES" "ELEMENTALIST" }
}
"DWARVES"
{
  settlement = {
    type = Builtin MINETOWN "DUNGEON"
    tribe = DWARF
    inhabitants = {
      leader = { { "DWARF_BARON" } }
      fighters = {
        count = {6 9}
        all = {
          1 "DWARF_FIGHTER"
        }
      }
      civilians = {
        count = {3 5}
        all = {
          2 "DWARF_FEMALE"
          1 "RAT"
        }
        uniques = { "DWARF_BLACKSMITH" }
      }
    }
    locationNameGen = "TOWN"
    race = "dwarves"
    stockpiles = {{ "gold" 200 "TREASURE_CHEST"} {"minerals" 120 }}
    shopItems = {{8 16} "dwarfShop" }
    outsideFeatures = "dungeonOutside"
    surroundWithResources = 5
    furniture = "roomFurniture"
  }
  config = {
    immigrantInterval = 500
    maxPopulation = 15
    ghostProb = 0.1
    spawnGhosts = 4
    prisoners = true
  }
  behaviour = {
    minPopulation = 3
    minTeamSize = 4
    triggers = {
      RoomTrigger "THRONE" 0.0003
      RoomTrigger "THRONE_HUMAN" 0.0003
      RoomTrigger "IMPALED_HEAD" 0.0001
      SelfVictims
      NumConquered 3
      StolenItems
      FinishOff
      Proximity
      AggravatingMinions
    }
    attackBehaviour = KillMembers 3
    ransom = 0.8 320
  }
  immigrants = {
    {
      ids = {"DWARF"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}
"ELVES"
{
  biome = "FOREST"
  settlement = {
    type = Builtin FORREST_VILLAGE "WOOD"
    inhabitants = {
      leader = { { "ELF_LORD" } }
      fighters = {
        count = {6 9}
        all = { 1 "ELF_ARCHER" }
      }
      civilians = {
        count = {6 9},
        all = {
          1 "ELF"
          1 "ELF_CHILD"
        }
      }
      steeds = {
        all = { 1 "ELF_LORD_DEER" }
      }
    }
    locationNameGen = "TOWN"
    tribe = ELF
    race = "elves"
    stockpiles = {{ "gold" 100 "TREASURE_CHEST"}}
    furniture = "roomFurniture"
  }
  config = {
    immigrantInterval = 500
    maxPopulation = 18
    ghostProb = 0.1
    spawnGhosts = 4
    alwaysMount = true
    prisoners = true
  }
  behaviour = {
    ambushChance = 0.05
    minPopulation = 4
    minTeamSize = 4
    triggers = {StolenItems}
    attackBehaviour = KillLeader
  }
  immigrants = {
    {
      ids = {"ELF_ARCHER"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}
"ELEMENTALIST_ENTRY"
{
  settlement = {
    type = Builtin TOWER "BRICK"
    tribe = HUMAN
  }
  discoverable = false
}
"ELEMENTALIST_FLOOR"
{
  settlement = {
    inhabitants = {
      fighters = {
        count = {1 3}
        all = {
          1 "AIR_ELEMENTAL"
          1 "WATER_ELEMENTAL"
          1 "FIRE_ELEMENTAL"
          1 "EARTH_ELEMENTAL"
        }
      }
    }
    type = Builtin TOWER "BRICK"
    tribe = HUMAN
  }
  discoverable = false
}
"ELEMENTALIST"
{
  biome = "GRASSLAND"
  settlement = {
    type = Builtin TOWER "BRICK"
    inhabitants = {
      leader = { { "ELEMENTALIST" } }
    }
    tribe = HUMAN
    furniture = "roomFurniture"
  }
  config = {
    leaderAsFighter = true
  }
  levelConnection = {
    direction = UP
    topLevel = ExtraEnemy { "ELEMENTALIST_ENTRY" }
    levels = {
      { ExtraEnemy { "ELEMENTALIST_FLOOR" { 3 6 }} {4 4} TOWER }
      { MainEnemy {5 5} TOWER }
    }
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    triggers = {
      RoomTrigger "THRONE" 0.0003
      RoomTrigger "THRONE_HUMAN" 0.0003
      RoomTrigger "IMPALED_HEAD" 0.0001
      NumConquered 3
      FinishOff
      Proximity
    }
    attackBehaviour = CampAndSpawn {
      count = {3 7}
      all = {
        1 "WATER_ELEMENTAL"
        1 "AIR_ELEMENTAL"
        1 "FIRE_ELEMENTAL"
        1 "EARTH_ELEMENTAL"
      }
    }
    ransom = 0.5 80
  }
}
"HELL_ESCAPE_FLOOR"
{
  settlement = {
    type = Builtin TOWER "HELL_ESCAPE"
    tribe = HUMAN
  }
  discoverable = false
}
"Z_LEVEL_LAVA"
{
  settlement = {
    type = RandomLayout { "z_level_lava" { 55 55 } "default" }
    tribe = MONSTER
    inhabitants = {
      leader = { { "RED_DRAGON" } }
      fighters = {
        count = {4 5}
        all = { 1 "FIRE_ELEMENTAL" }
      }
    }
  }
}
"Z_LEVEL_FULL"
{
  settlement = {
    type = RandomLayout { "z_level_full" { 80 80 } "default" }
    tribe = MONSTER
  }
}
"Z_LEVEL_FULL_ONLY_WATER"
{
  settlement = {
    type = RandomLayout { "z_level_full_only_water" { 80 80 } "default" }
    tribe = MONSTER
  }
}
"Z_LEVEL_HELL"
{
  settlement = {
    type = RandomLayout { "z_level_full_only_water" { 80 80 } "z_level_hell" }
    tribe = MONSTER
  }
}
"Z_LEVEL_ZOMBIE"
{
  settlement = {
    type = RandomLayout { "z_level_castle" { 80 80 } "default" }
    tribe = MONSTER
    inhabitants = {
      fighters = {
        count = {50}
        all = { 1 "SWARMER_ZOMBIE" }
      }
    }
  }
}
"Z_LEVEL_BLACK_DRAGON_DWARVES" inherit "DWARVES"
{
  settlement = append {
    type = RandomLayout { "z_level_castle2" { 80 80 } "z_level_castle" }
  }
}
"Z_LEVEL_BLACK_DRAGON"
{
  settlement = {
    type = RandomLayout { "z_level_castle2" { 80 80 } "z_level_castle" }
    tribe = MONSTER
    inhabitants = {
      leader = { { "BLACK_DRAGON" } }
    }
  }
  config = {
    prisoners = true
  }
  createOnBones = 1.0 { "Z_LEVEL_BLACK_DRAGON_DWARVES" }
}
"Z_LEVEL_BALROG"
{
  settlement = {
    type = RandomLayout { "balrog_z_level" { 80 80 } "z_level_castle" }
    tribe = MONSTER
    inhabitants = {
      leader = { { "BALROG" } }
      fighters = {
        count = {30}
        all = {
          1 "TROLL_VILLAIN"
          3 "GOBLIN_WARRIOR_VILLAIN"
          1 "GOBLIN_ARCHER_VILLAIN"
        }
        expLevelIncrease = {
          DAMAGE 10
          SPELL_DAMAGE 10
          RANGED_DAMAGE 10
        }
      }
    }
  }
  config = {
   leaderAsFighter = true
   prisoners = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 31
    attackBehaviour = KillLeader
  }
}
"Z_LEVEL_KRAKENS"
{
  settlement = {
    type = RandomLayout { "kraken_z_level" { 80 80 } "default" }
    tribe = DARK_KEEPER
    inhabitants = {
      fighters = {
        count = {6}
        all = { 1 "GOBLIN_MATRON" }
      }
    }
  }
}
"MAIN_DUNGEON"
{
  biome = "MOUNTAIN"
  settlement = {
    type = RandomLayout { "adoxie_temple" { 30 20 } "adoxie_temple"}
    tribe = MONSTER
    inhabitants = {
      leader = { { "ADOXIE_PRIEST" } }
      fighters = {
        count = {4 5}
        all = { 1 "ABOMINATION" }
      }
      civilians = {
        count = { 4 5 }
        all = { 1 "SPIDER_FOOD" }
      }
    }
  }
  config = {
    immigrantInterval = 500
    maxPopulation = 15
    canEnemyRetire = false
    prisoners = true
  }
  levelConnection = {
    topLevel = ExtraEnemy {"MAIN_DUNGEON_ENTRY"}
    levels = {
      { ExtraEnemy { "DUNGEON1" { 1 } } {40 30} BASIC }
      { ExtraEnemy { "BLACK_MARKET_ENTRY" { 1 } } {40 30} BASIC }
      { ExtraEnemy { "DUNGEON2" { 1 } } {40 30} BASIC }
      { ExtraEnemy { "DUNGEON3" { 1 } } {40 30} BASIC }
      { ExtraEnemy { "DUNGEON4" { 1 } } {40 30} BASIC }
      { MainEnemy {32 22} BASIC "Adoxie's Temple" }
      { ExtraEnemy { "DEATH" { 1 } } {40 30} BASIC none true false }
      { ExtraEnemy { "HELL" { 1 } } {40 30} DUNGEON "A Very Hot Place" true false }
      { ExtraEnemy { "SATAN" { 1 } } {32 22} BASIC "A Very Hot Place" true false }
      { ExtraEnemy { "HELL_ESCAPE_FLOOR" { 3 6 }} {4 4} TOWER }
      { ExtraEnemy { "OUTBACK_ENTRY" { 1 } } {100 100} OUTBACK "Down Under" true }
    }
  }
}
"MAIN_DUNGEON_ENTRY"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    tribe = BANDIT
  }
  config = {
    conquerCondition = NEVER
  }
}
"HELL"
{
  discoverable = false
  settlement = {
    type = Builtin MINETOWN "HELL"
    tribe = MONSTER
    furniture = "hellFurniture"
    inhabitants = {
      fighters = {
        count = {10 15}
        all = {
          10 "DEVIL"
          20 "SPIRIT"
        }
      }
    }
  }
}
"SATAN"
{
  discoverable = false
  settlement = {
    type = Predefined { "satan" "SATAN" } 
    tribe = MONSTER
    inhabitants = {
      leader = { { "SATAN" } }
      fighters = {
        count = {4 5}
        all = { 1 "DEVIL" }
      }
    }
  }
}
"OUTBACK_ENTRY"
{
  discoverable = false
  settlement = {
    type = Builtin CAVE "NATIVE"
    tribe = BANDIT
  }
  config = {
    discoverAchievement = "outback"
  }
}
"DEATH"
{
  settlement = {
    type = Predefined { "death" "BLACK" } 
    tribe = MONSTER
    inhabitants = {
      fighters = {
        count = {1}
        all = { 1 "DEATH" }
      }
    }
  }
}
"ADOXIE_VAULT"
{
  settlement = {
    type = Predefined { "adoxie_vault" "ADOXIE_VAULT" OUTDOOR }
    tribe = MONSTER
  }
  config = {
    conquerCondition = NEVER
  }
  levelConnection = {
    topLevel = MainEnemy
    levels = {
      { ExtraEnemy { "ADOXIE_VAULT_UNDER" {1} } {32 17} BASIC "Adoxie's Vault" }
    }
  }
}
"ADOXIE_VAULT_UNDER"
{
  settlement = {
    type = RandomLayout { "adoxie_statue_under" { 30 15 } "adoxie_statue_under"}
    tribe = MONSTER
  }
}
"WOLF_DEN"
{
  biome = "MOUNTAIN"
  settlement = {
    type = Builtin CAVE "DUNGEON"
    inhabitants = {
      fighters = {
        count = {4 9}
        all = {
          50 "WOLF"
          1 "FERAL_CHILD"
        }
      }
    }
    tribe = BANDIT
    race = "wolves"
  }
  config = {
    immigrantInterval = 1000
    maxPopulation = 10
  }
  immigrants = {
    {
      ids = { "WOLF" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 5
    attackBehaviour = KillLeader
  }
}
"BAT_DEN"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    inhabitants = {
      fighters = {
        count = {4 9}
        all = {
          50 "BAT"
        }
      }
    }
    tribe = MONSTER
    race = "bats"
  }
  config = {
    immigrantInterval = 1000
    maxPopulation = 10
  }
  immigrants = {
    {
      ids = { "BAT" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
"CAVE_BEAR_DEN"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    inhabitants = {
      leader = { { "CAVE_BEAR" } }
    }
    tribe = MONSTER
    race = "cave bear"
  }
  config = {
    leaderAsFighter = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    attackBehaviour = KillLeader
  }
}
"NO_AGGRO_BANDITS"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    inhabitants = {
      leader = {{ "BANDIT" }}
      fighters = {
        count = {4 9}
        all = { 1 "BANDIT" }
      }
    }
    tribe = BANDIT
    race = "bandits"
  }
  config = {
    immigrantInterval = 1000
    maxPopulation = 10
    prisoners = true
  }
  createOnBones = 0.1 { "KOBOLD_CAVE" }
  immigrants = {
    {
      ids = { "BANDIT" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
"BANDITS" inherit "NO_AGGRO_BANDITS"
{
  behaviour = {
    ambushChance = 0.05
    minPopulation = 0
    minTeamSize = 3
    triggers = {Resource "GOLD" 500}
    attackBehaviour = StealResource "GOLD"
    ransom = 0.5 80
  }
}
"COTTAGE_BANDITS" inherit "NO_AGGRO_BANDITS"
{
  biome = "GRASSLAND"
  createOnBones = 1.0 { "HUMAN_COTTAGE" }
}
"GOBLIN_CAVE"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    inhabitants = {
      leader = {{ "TROLL" }}
      fighters = {
        count = {4 9}
        all = { 1 "GOBLIN_WARRIOR" }
        expLevelIncrease = {
          DAMAGE 5
          SPELL_DAMAGE 5
          RANGED_DAMAGE 5
        }
      }
    }
    tribe = BANDIT
    race = "goblins"
  }
  config = {
    immigrantInterval = 1000
    maxPopulation = 10
    prisoners = true
  }
  behaviour = {
    ambushChance = 0.1
    minPopulation = 0
    minTeamSize = 3
    triggers = {Resource "GOLD" 500}
    attackBehaviour = StealResource "GOLD"
    ransom = 0.5 80
  }
  createOnBones = 0.1 { "KOBOLD_CAVE" }
  immigrants = {
    {
      ids = { "GOBLIN_WARRIOR" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
Def STRONGER(NAME, ORIGINAL, INCREASE)
NAME inherit ORIGINAL
{
  settlement = append {
    inhabitants = append {
      fighters = append {
        combatExperience = INCREASE
      }
      leader = append {
        combatExperience = INCREASE
      }
    }
  }
}
End

"GOBLINS_Z_LEVEL"
{
  settlement = {
    type = RandomLayout { "z_level_cave" { 80 80 } "default" }
    inhabitants = {
      leader = {{ "TROLL" }}
      fighters = {
        count = {4 9}
        all = { 1 "GOBLIN_WARRIOR" }
        expLevelIncrease = {
          DAMAGE 5
          SPELL_DAMAGE 5
          RANGED_DAMAGE 5
        }
      }
    }
    tribe = BANDIT
    race = "goblins"
  }
  config = {
    prisoners = true
  }
  discoverable = false
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    attackBehaviour = KillLeader
  }
}

"DARK_ELF_CAVE"
{
  biome = "MOUNTAIN"
  settlement = {
    type = Builtin SMALL_MINETOWN "DUNGEON"
    tribe = DARK_ELF
    inhabitants = {
      leader = {
        id = { "DARK_ELF_WARRIOR" }
        combatExperience = 7
      }
      fighters = {
        count = {2 5}
        all = { 1 "DARK_ELF_WARRIOR" }
        combatExperience = 7
      }
      civilians = {
        count = {2 5}
        all = { 1 "DARK_ELF" }
      }
    }
    race = "dark elves"
    stockpiles = {{ "minerals" 60 }}
    outsideFeatures = "dungeonOutside"
    furniture = "roomFurniture"
    surroundWithResources = 6
  }
  config = {
    prisoners = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    triggers = {SelfVictims StolenItems AggravatingMinions }
    attackBehaviour = KillLeader
    ransom = 0.5 80
  }
}

"DARK_ELVES_Z_LEVEL"
{
  settlement = {
    type = RandomLayout { "z_level_dungeon" { 80 80 } "default" }
    tribe = DARK_ELF
    inhabitants = {
      leader = {
        id = { "DARK_ELF_WARRIOR" }
        combatExperience = 7
      }
      fighters = {
        count = {2 5}
        all = { 1 "DARK_ELF_WARRIOR" }
        combatExperience = 7
      }
      civilians = {
        count = {2 5}
        all = { 1 "DARK_ELF" }
      }
    }
    race = "dark elves"
  }
  config = {
    prisoners = true
  }
  discoverable = false
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    attackBehaviour = KillLeader
  }
}

"NO_AGGRO_DWARF_CAVE"
{
  biome = "MOUNTAIN"
  settlement = {
    type = Builtin SMALL_MINETOWN "DUNGEON"
    tribe = DWARF
    inhabitants = {
      leader = {{ "DWARF" }}
      fighters = {
        count = {2 5}
        all = { 1 "DWARF" }
      }
      civilians = {
        count = {2 5}
        all = { 1 "DWARF_FEMALE" }
      }
    }
    race = "dwarves"
    stockpiles = {{ "minerals" 60}}
    outsideFeatures = "dungeonOutside"
    furniture = "roomFurniture"
    surroundWithResources = 6
  }
  config = {
    prisoners = true
  }
}

"DWARF_CAVE" inherit "NO_AGGRO_DWARF_CAVE"
{
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    triggers = { SelfVictims StolenItems AggravatingMinions }
    attackBehaviour = KillLeader
    ransom = 0.5 80
  }
}

"DWARVES_Z_LEVEL"
{
  settlement = {
    type = RandomLayout { "z_level_dungeon" { 80 80 } "default" }
    tribe = DWARF
    inhabitants = {
      leader = {{ "DWARF" }}
      fighters = {
        count = {2 5}
        all = { 1 "DWARF" }
      }
      civilians = {
        count = {2 5}
        all = { 1 "DWARF_FEMALE" }
      }
    }
    race = "dwarves"
  }
  config = {
    prisoners = true
  }
  discoverable = false
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    attackBehaviour = KillLeader
  }
}

"COTTAGE_GOBLINS" inherit "GOBLIN_CAVE"
{
  createOnBones = 1.0 { "ELVEN_COTTAGE" }
}
"LIZARDMEN_SMALL"
{
  settlement = {
    type = Builtin COTTAGE "MUD"
    tribe = LIZARD
    inhabitants = {
      fighters = {
        count = {3 5}
        all = { 1 "LIZARDMAN" }
      }
    }
    race = "lizardmen"
    furniture = "roomFurniture"
    outsideFeatures = "villageOutside"
  }
  config = {
    prisoners = true
  }
}
"LIZARDMEN"
{
  biome = "DESERT"
  settlement = {
    type = Builtin VILLAGE "MUD"
    tribe = LIZARD
    inhabitants = {
      leader = { { "LIZARDLORD" } }
      fighters = {
        count = {7 10}
        all = { 1 "LIZARDMAN" }
      }
    }
    locationNameGen = "TOWN"
    race = "lizardmen"
    shopItems = {{8 16} "goodMushrooms" }
    furniture = "roomFurniture"
    outsideFeatures = "villageOutside"
  }
  config = {
    immigrantInterval = 140
    maxPopulation = 11
    ghostProb = 0.1
    spawnGhosts = 4
    prisoners = true
  }
  behaviour = {
    ambushChance = 0.1
    minPopulation = 4
    minTeamSize = 4
    triggers = {
      RoomTrigger "IMPALED_HEAD" 0.0001
      NumConquered 2
      Power
      SelfVictims
      FinishOff
      Proximity
      StolenItems
      AggravatingMinions
    }
    attackBehaviour = KillLeader
  }
  createOnBones = 0.1 { "VILLAGE" "ELVES" }
  immigrants = {
    {
      ids = { "LIZARDMAN" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
"DARK_ELVES_ALLY"
{
  biome = "MOUNTAIN"
  settlement = {
    type = Builtin MINETOWN "DUNGEON"
    tribe = DARK_ELF
    inhabitants = {
      leader = { { "DARK_ELF_LORD" } }
      fighters = {
        count = {6 9}
        all = { 1 "DARK_ELF_WARRIOR" }
      }
      civilians = {
        count = {6 9},
        all = {
          1 "DARK_ELF"
          1 "DARK_ELF_CHILD"
          1 "RAT"
        }
      }
    }
    locationNameGen = "TOWN"
    race = "dark elves"
    outsideFeatures = "dungeonOutside"
    furniture = "roomFurniture"
  }
  config = {
    immigrantInterval = 500
    maxPopulation = 15
    prisoners = true
  }
  levelConnection = {
    topLevel = ExtraEnemy {"DARK_ELVES_ENTRY"}
    levels = {
      { ExtraEnemy { "DUNGEON1" { 2 4 } } {60 40} BASIC }
      { ExtraEnemy { "DUNGEON2" { 1 2 } } {60 40} BASIC }
      { MainEnemy {60 40} MINETOWN }
    }
  }
  immigrants = {
    {
      ids = { "DARK_ELF_WARRIOR" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
"DARK_ELVES_ENEMY" inherit "DARK_ELVES_ALLY"
{
  settlement = {
    type = Builtin MINETOWN "DUNGEON"
    tribe = DARK_ELF
    inhabitants = {
      leader = {
        id = { "DARK_ELF_LORD" }
        combatExperience = 30
      }
      fighters = {
        count = {6 9}
        all = { 1 "DARK_ELF_WARRIOR" }
        combatExperience = 30
      }
      civilians = {
        count = {6 9},
        all = {
          1 "DARK_ELF"
          1 "DARK_ELF_CHILD"
          1 "RAT"
        }
      }
    }
    locationNameGen = "TOWN"
    race = "dark elves"
    outsideFeatures = "dungeonOutside"
    furniture = "roomFurniture"
  }
}
"DARK_ELVES_ENTRY"
{
  settlement = {
    type = Builtin SMALL_MINETOWN "DUNGEON"
    tribe = DARK_ELF
    inhabitants = {
      fighters = {
        count = {3 7}
        all = { 1 "DARK_ELF_WARRIOR" }
      }
    }
    race = "dark elves"
    outsideFeatures = "dungeonOutside"
    furniture = "roomFurniture"
  }
  discoverable = false
}
"DUNGEON1"
{
  discoverable = false
  settlement = {
    type = RandomLayout { "dungeon" { 38 28 } "default"}
    tribe = MONSTER
    furniture = "roomFurniture"
    shopItems = {{5 10} "dungeon" }
    inhabitants = {
      fighters = {
        count = {10 15}
        all = {
          100 "BANDIT"
          15 "CYCLOPS"
          15 "WITCH"
          20 "CLAY_GOLEM"
          20 "STONE_GOLEM"
          20 "IRON_GOLEM"
          20 "LAVA_GOLEM"
          10 "FIRE_ELEMENTAL"
          10 "WATER_ELEMENTAL"
          10 "EARTH_ELEMENTAL"
          10 "AIR_ELEMENTAL"
          100 "GNOME"
          20 "GNOME_CHIEF"
          100 "DWARF"
          40 "DWARF_FEMALE"
          200 "JACKAL"
          200 "BAT"
          150 "SNAKE"
          200 "SPIDER"
          100 "FLY"
          100 "RAT"
        }
      }
    }
  }
  config = {
    prisoners = true
  }
}

"DUNGEON2" inherit "DUNGEON1"
{
  settlement = append {
    inhabitants = append {
      fighters = append {
        all = append {
          15 "GREEN_DRAGON"
          15 "SOFT_MONSTER"
          50 "CYCLOPS"
          50 "CLAY_GOLEM"
          50 "STONE_GOLEM"
          50 "IRON_GOLEM"
          50 "LAVA_GOLEM"
          80 "FIRE_ELEMENTAL"
          80 "WATER_ELEMENTAL"
          80 "EARTH_ELEMENTAL"
          80 "AIR_ELEMENTAL"
        }
        uniques = {
          "BLACK_NAGA"
          "BLACK_NAGA"
          "BLACK_NAGA"
        }
      }
    }
  }
}

"BLACK_MARKET"
{
  settlement = {
    type = Builtin TOWER "BLACK_MARKET"
    tribe = GNOME
    race = "the Black Market"
    furniture = "dungeonOutside"
    shopItems = {
        {10 15} "blackMarketAmulet"
        {10 15} "blackMarketScrolls"
        {10 15} "blackMarketPotions"
        {10 15} "blackMarketCrafting"
    }
    inhabitants = {
      fighters = {
        count = {8 10}
        all = {
          1 "BLACK_MARKET_GUARD"
        }
      }
    }
  }
  config = {
    prisoners = true
    discoverAchievement = "black_market"
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 3
    triggers = {
      StolenItems
    }
    attackBehaviour = KillLeader
  }
}


"BLACK_MARKET_ENTRY" inherit "DUNGEON1"
{
  settlement = append {
    type = RandomLayout { "dungeon" { 38 28 } "black_market_entry"}
  }
  levelConnection = {
    topLevel = MainEnemy
    direction = UP
    levels = {
      { ExtraEnemy {"BLACK_MARKET"} {30 20} BLACK_MARKET "Black market" }
    }
  }
}
"DUNGEON3" inherit "DUNGEON2"
{
  settlement = append {
    inhabitants = append {
      fighters = append {
        uniques = {
          "SHAPESHIFTER"
        }
      }
    }
  }
}
"DUNGEON4" inherit "DUNGEON2"
{
  settlement = append {
    furniture = "roomFurnitureAndBleedingTotem"
    inhabitants = append {
      fighters = append {
        all = append {
          150 "RED_DRAGON"
          150 "YELLOW_DRAGON"
        }
      }
    }
  }
}
"GNOMES"
{
  settlement = {
    type = Builtin MINETOWN "DUNGEON"
    tribe = GNOME
    inhabitants = {
      leader = { { "GNOME_CHIEF" } }
      fighters = {
        count = {8 14}
        all = { 1 "GNOME" }
      }
    }
    locationNameGen = "TOWN"
    race = "gnomes"
    shopItems = {{10 18} "gnomeShop" }
    outsideFeatures = "dungeonOutside"
    furniture = "roomFurniture"
  }
  levelConnection = {
    topLevel = ExtraEnemy {"GNOMES_ENTRY"}
    levels = {
      { ExtraEnemy { "DUNGEON1" { 2 4 } } {40 30} BASIC }
      { ExtraEnemy { "DUNGEON2" 1 } {40 30} BASIC }
      { MainEnemy {60 40} MINETOWN }
    }
  }
}
"GNOMES_ENTRY"
{
  settlement = {
    type = Builtin SMALL_MINETOWN "DUNGEON"
    tribe = GNOME
    inhabitants = {
      fighters = {
        count = {3 7}
        all = { 1 "GNOME" }
      }
    }
    race = "gnomes"
    outsideFeatures = "dungeonOutside"
    furniture = "roomFurniture"
  }
  discoverable = false
}
"WHITE_DRAGON_ENTRY" inherit "MAIN_DUNGEON_ENTRY"
{
  settlement = append {
    type = Builtin CAVE "GLACIER"
  }
}
"WHITE_DRAGON_FLOOR" inherit "DUNGEON1"
{
  settlement = append {
    type = Builtin MINETOWN "GLACIER"
    inhabitants = append {
      fighters = append {
        all = append {
          150 "WHITE_NAGA"
        }
      }
    }
  }
}
"WHITE_DRAGON" inherit "RED_DRAGON"
{
  biome = "SNOW"
  settlement = append {
    type = Builtin CAVE "GLACIER"
    inhabitants = {
      leader = { { "WHITE_DRAGON" } }
    }
  }
  createOnBones = none
  levelConnection = {
    direction = UP
    topLevel = ExtraEnemy { "WHITE_DRAGON_ENTRY" }
    levels = {
      { ExtraEnemy { "WHITE_DRAGON_FLOOR" { 2 4 }} {30 20} DUNGEON }
      { MainEnemy {30 20} DUNGEON }
    }
  }
  config = {
    prisoners = true
  }
}
"ENTS"
{
  settlement = {
    type = Builtin FOREST "WOOD"
    inhabitants = {
      fighters = {
        count = {7 10}
        all = { 1 "ENT" }
        uniques = { "ENT_WITH_DROP" "ENT_WITH_DROP" "ENT_WITH_DROP" }
      }
      civilians = {
        count = 2
        all = { 1 "CHILD_ENTS" }
      }
    }
    tribe = MONSTER
    race = "tree spirits"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 10
    alwaysMount = true
    prisoners = true
  }
  immigrants = {
    {
      ids = { "ENT" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
"DRIADS"
{
  settlement = {
    type = Builtin FOREST "WOOD"
    inhabitants = {
      leader = {{"DRIAD_LEADER"}}
      fighters = {
        count = {7 10}
        all = { 1 "DRIAD" }
      }
    }
    tribe = MONSTER
    race = "dryads"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 10
    prisoners = true
  }
  immigrants = {
    {
      ids = { "DRIAD" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
"SHELOB"
{
  biome = "MOUNTAIN"
  settlement = {
    type = RandomLayout { "shelob" { 12 12 } "default" CAVE}
    tribe = SHELOB
    inhabitants = {
      leader = { { "SHELOB" } }
      civilians = {
        count = {4 6},
        all = {
          1 "SPIDER_FOOD"
          1 "SPIDER"
        }
      }
    }
    race = "giant spider"
  }
  config = {
   leaderAsFighter = true
   prisoners = true
  }
  createOnBones = 0.1 { "DWARF_CAVE" "KOBOLD_CAVE" }
}
"CYCLOPS"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    inhabitants = {
      leader = { { "CYCLOPS" } }
    }
    race = "cyclops"
    tribe = HOSTILE
    shopItems = {{16 20} "cyclopsCave" }
  }
  config = {
    leaderAsFighter = true
    spawnGhosts = 1
    ghostProb = 0.03
    prisoners = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    triggers = {EnemyPopulation 13 AggravatingMinions StolenItems}
    attackBehaviour = KillMembers 4
  }
}
"YETI"
{
  biome = "SNOW"
  settlement = {
    type = Builtin EMPTY "DUNGEON"
    inhabitants = {
      leader = { { "YETI" } }
    }
    race = "yeti"
    tribe = HOSTILE
  }
  config = {
    prisoners = true
  }
}
"HYDRA"
{
  biome = "SWAMP"
  settlement = {
    type = RandomLayout { "hydra" { 20 20 } "default"}
    inhabitants = {
      leader = { { "HYDRA" } }
    }
    race = "hydra"
    tribe = HOSTILE
  }
  config = {
    leaderAsFighter = true
    spawnGhosts = 1
    ghostProb = 0.03
    prisoners = true
  }
}
"KRAKEN"
{
  settlement = {
    type = Builtin MOUNTAIN_LAKE "DUNGEON"
    inhabitants = {
      leader = { { "KRAKEN" } }
    }
    race = "kraken"
    tribe = MONSTER
  }
  config = {
    leaderAsFighter = true
  }
  discoverable = false
}
"CEMETERY"
{
  biome = "GRASSLAND"
  settlement = {
    type = RandomLayout { "zombie_crypt" { 25 25 } "default"}
    inhabitants = {
      fighters = {
        count = {8 12}
        all = { 1 "ZOMBIE" }
      }
    }
    locationName = "cemetery"
    tribe = MONSTER
    race = "undead"
  }
  levelConnection = {
    topLevel = ExtraEnemy { "CEMETERY_ENTRY" }
    levels = {
      {MainEnemy {40 40} BASIC }
    }
  }
}
"CEMETERY_ENTRY"
{
  settlement = {
    type = Builtin CEMETERY "BRICK"
    inhabitants = {
      fighters = {
        count = {1 2}
        all = {
          1 "ZOMBIE"
        }
      }
    }
    locationName = "cemetery"
    race = "undead"
    tribe = MONSTER
    furniture = "graves"
  }
  discoverable = false
}
"GOBLIN_CAVE_ALLY"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    tribe = GREENSKIN
    inhabitants = {
      fighters = {
        count = {4 8}
        all = { 1 "GOBLIN_WARRIOR" }
      }
    }
    closeToPlayer = true
    furniture = "roomFurniture"
    outsideFeatures = "villageOutside"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 10
  }
  immigrants = {
    {
      ids = { "GOBLIN_WARRIOR" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
"HARPY_CAVE"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    tribe = GREENSKIN
    inhabitants = {
      fighters = {
        count = {4 8}
        all = { 1 "HARPY" }
      }
    }
    closeToPlayer = true
    furniture = "roomFurniture"
    outsideFeatures = "villageOutside"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 10
    prisoners = true
  }
  immigrants = {
    {
      ids = { "HARPY" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
"Z_LEVEL_VAMPIRE_VAULT"
{
  settlement = {
    type = RandomLayout { "z_level_vault" { 80 80 } "z_level_vampire_vault" }
    tribe = GREENSKIN
    inhabitants = {
      fighters = {
        count = 4
        all = { 1 "VAMPIRE" }
      }
    }
  }
}
"Z_LEVEL_DWARF_VAULT"
{
  settlement = {
    type = RandomLayout { "z_level_vault" { 80 80 } "z_level_dwarf_vault" }
    tribe = DWARF
    inhabitants = {
      fighters = {
        count = 4
        all = { 1 "DWARF" }
      }
    }
  }
}
"SOKOBAN_ENTRY"
{
  settlement = {
    type = Builtin ISLAND_VAULT_DOOR "DUNGEON"
    tribe = MONSTER
  }
}
"SOKOBAN"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    tribe = DARK_KEEPER
    stockpiles = {{ "sokobanPrize" 1 "CHEST" }}
  }
  levelConnection = {
    direction = UP
    topLevel = ExtraEnemy { "SOKOBAN_ENTRY" }
    levels = {
      {MainEnemy {28 16} SOKOBAN "Sokoban" false true false }
    }
  }
  config = {
    discoverAchievement = "sokoban"
  }
  discoverable = false
}
"WITCH"
{
  biome = "SWAMP"
  settlement = {
    type = Builtin COTTAGE "WOOD"
    tribe = MONSTER
    inhabitants = {
      leader = { { "WITCH" } }
    }
    race = "witch"
    furniture = "witchInside"
  }
}
"ARMOR_SHOP"
{
  biome = "GRASSLAND"
  settlement = {
    type = Builtin COTTAGE "WOOD"
    tribe = PEACEFUL
    shopItems = {
      {15 30} "armory"
    }
  }
}
"POTION_SHOP" inherit "ARMOR_SHOP"
{
  settlement = append {
    shopItems = {
      {15 30} "potions"
    }
  }
}
"JEWELER_SHOP" inherit "ARMOR_SHOP"
{
  settlement = append {
    shopItems = {
      {15 30} "jeweler"
    }
  }
}
"TEMPLE"
{
  settlement = {
    type = Builtin TEMPLE "BRICK"
    tribe = HUMAN
    race = "altar"
    inhabitants = {
      leader = { { "PRIEST" } }
    }
    furniture = "templeInside"
  }
  discoverable = false
}
"EVIL_TEMPLE"
{
  settlement = {
    type = Builtin TEMPLE "WOOD"
    tribe = DARK_KEEPER
    race = "altar"
    inhabitants = {
      leader = {
        id = {"GOBLIN_WIZARD"}
        expLevelIncrease = { SPELL_DAMAGE 7 }
      }
    }
    furniture = "templeInside"
  }
  discoverable = false
}
"ADOXIE_FEET_ENTRY"
{
  settlement = {
    type = RandomLayout { "adoxie_feet_entry" { 5 5 } "adoxie_feet_entry"}
    tribe = MONSTER
    race = "altar of Evil God Adoxie"
  }
}
"ADOXIE_FEET"
{
  biome = "DESERT"
  settlement = {
    type = RandomLayout { "adoxie_feet_under" { 17 17 } "adoxie_feet"}
    tribe = HUMAN
    race = "altar of Evil God Adoxie"
    stockpiles = {{ "gold" 160 "TREASURE_CHEST" }}
  }
  discoverable = false
  levelConnection = {
    direction = DOWN
    topLevel = ExtraEnemy { "ADOXIE_FEET_ENTRY" }
    levels = {
      {MainEnemy {19 19} BASIC "Ancient tomb" false false }
    }
  }
}
"RUINS"
{
  settlement = {
    type = Builtin COTTAGE "RUINS"
    tribe = MONSTER
    race = "ruins"
    dontBuildRoad = true
    closeToPlayer = true
  }
  config = {
    immigrantInterval = 700
    maxPopulation = 3
    conquerCondition = DESTROY_BUILDINGS
  }
  immigrants = {
    {
      ids = {"LOST_SOUL"}
      traits = {FIGHTER}
      specialTraits = {
        {1.0 {Lasting { DISAPPEAR_DURING_DAY }}}
      }
      frequency = 1
      requirements = {
        {1.0 SunlightState NIGHT}
      }
      spawnLocation = InsideTerritory
    }
  }
}
"HUMAN_COTTAGE"
{
  biome = "GRASSLAND"
  settlement = {
    type = Builtin COTTAGE "WOOD"
    tribe = HUMAN
    crops = Crops()
    inhabitants = {
      fighters = {
        count = {2 4}
        all = { 1 "PESEANT" }
      }
      civilians = {
        count = {3 7},
        all = {
          1 "CHILD"
          1 "HORSE"
          1 "DONKEY_STEED"
          1 "COW"
          1 "PIG"
          1 "GOAT_STEED"
        }
      }
    }
    race = "humans"
    furniture = "roomFurniture"
  }
  config = {
    guardianInfo = "WITCHMAN" 0.003 1 2
    alwaysMount = true
  }
}
"KNIFE_COTTAGE" inherit "HUMAN_COTTAGE"
{
  settlement = append {
    type = Builtin COTTAGE "WOOD_HIDDEN_STAIRS"
  }
  levelConnection = {
    topLevel = MainEnemy
    direction = DOWN
    levels = {
      { ExtraEnemy { "COTTAGE_CELLAR" {1} } {10 10} BASIC }
    }
  }
}
"ESKIMO_COTTAGE" inherit "HUMAN_COTTAGE"
{
  biome = "SNOW"
  settlement = append {
    type = Builtin COTTAGE "SNOW"
    crops = none
    inhabitants = {
      fighters = {
        count = {2 4}
        all = { 1 "ESKIMO" }
      }
      civilians = {
        count = {5 10},
        all = {
          1 "ESKIMO_CHILD"
        }
      }
    }
    furniture = none
    outsideFeatures = "snowFurniture"
  }
}
"ESKIMO_VILLAGE" inherit "TUTORIAL_VILLAGE"
{
  settlement = append {
    type = Builtin SMALL_VILLAGE "SNOW"
    crops = none
    inhabitants = {
      fighters = {
        count = {2 4}
        all = { 1 "ESKIMO" }
      }
      civilians = {
        count = {5 10},
        all = {
          1 "ESKIMO_CHILD"
        }
      }
    }
    furniture = none
    outsideFeatures = "snowFurniture"
  }
}
"NOMAD_COTTAGE" inherit "HUMAN_COTTAGE"
{
  biome = "DESERT"
  settlement = append {
    type = Builtin COTTAGE "SANDSTONE_WALL"
    crops = none
    inhabitants = {
      fighters = {
        count = {2 4}
        all = { 1 "NOMAD" }
      }
      civilians = {
        count = {7 12},
        all = {
          3 "GOAT"
          3 "CAMEL"
          1 "NOMAD_CHILD"
        }
      }
    }
    furniture = none
  }
}
"NOMAD_VILLAGE" inherit "TUTORIAL_VILLAGE"
{
  settlement = append {
    type = Builtin SMALL_VILLAGE "SANDSTONE_WALL"
    crops = none
    inhabitants = {
      fighters = {
        count = {2 4}
        all = { 1 "NOMAD" }
      }
      civilians = {
        count = {5 10},
        all = {
          3 "GOAT"
          3 "CAMEL"
          1 "NOMAD_CHILD"
        }
      }
    }
    furniture = none
    outsideFeatures = none
  }
}
"NATIVE_VILLAGE"
{
  settlement = {
    type = Builtin SMALL_VILLAGE "NATIVE"
    tribe = HUMAN
    inhabitants = {
      fighters = {
        count = {4 6}
        all = {
          1 "NATIVE"
        }
      }
      civilians = {
        count = {3 7}
        all = {
          1 "NATIVE_CHILD"
        }
      }
    }
    race = "humans"
  }
}
"THIEVES"
{
  biome = "DESERT"
  settlement = {
    type = Builtin CASTLE2 "SANDSTONE_WALL"
    tribe = HUMAN
    inhabitants = {
      leader = { { "THIEF_LEADER" } }
      fighters = {
        count = {8 14}
        all = { 1 "THIEF" }
        uniques = { "SORCERER" }
      }
      steeds = { all = { 1 "CAMEL" } }
    }
    locationNameGen = "TOWN"
    race = "thieves"
    stockpiles = {{ "gold" 160 "TREASURE_CHEST" }}
    furniture = "roomFurniture"
    outsideFeatures = "bleedingTotem"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 20
    ghostProb = 0.1
    spawnGhosts = 6
    alwaysMount = true
    prisoners = true
  }
  behaviour = {
    ambushChance = 0.1
    minPopulation = 3
    minTeamSize = 5
    triggers = {
      RoomTrigger "THRONE" 0.0003
      RoomTrigger "THRONE_HUMAN" 0.0003
      RoomTrigger "IMPALED_HEAD" 0.0001
      SelfVictims
      NumConquered 2
      StolenItems
      FinishOff
      Proximity
      AggravatingMinions
    }
    attackBehaviour = KillLeader
    ransom = 0.8 140
  }
  immigrants = {
    {
      ids = {"THIEF"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}
"DJINN"
{
  settlement = {
    type = Builtin CAVE "SANDSTONE"
    tribe = MONSTER
    locationName = "maze"
    race = "monsters"
    shopItems = { 1 "magicLamp" }
  }
}
"ELVEN_COTTAGE"
{
  biome = "FOREST"
  settlement = {
    type = Builtin FORREST_COTTAGE "WOOD"
    tribe = ELF
    inhabitants = {
      leader = { { "ELF_ARCHER" } }
      fighters = {
        count = {2 3}
        all = { 1 "ELF" }
      }
      civilians = {
        count = {2 5}
        all = {
          1 "ELF_CHILD"
          1 "HORSE"
          1 "COW"
          1 "DOG"
        }
      }
    }
    race = "elves"
    furniture = "roomFurniture"
  }
  config = {
    prisoners = true
  }
}
"LIZARDMEN_COTTAGE"
{
  biome = "DESERT"
  settlement = {
    type = Builtin FORREST_COTTAGE "WOOD"
    tribe = LIZARD
    inhabitants = {
      fighters = {
        count = {2 3}
        all = { 1 "LIZARDMAN" }
      }
    }
    race = "lizardmen"
    furniture = "roomFurniture"
  }
  createOnBones = 1.0 { "ELVEN_COTTAGE" }
  config = {
    prisoners = true
  }
}
"KOBOLD_CAVE"
{
  settlement = {
    type = Builtin SMALL_MINETOWN "DUNGEON"
    tribe = DWARF
    inhabitants = {
      fighters = {
        count = {3 7}
        all = { 1 "KOBOLD" }
      }
    }
    race = "kobolds"
    stockpiles = {{ "minerals" 60 }}
  }
  config = {
    prisoners = true
  }
}
"RAT_CAVE"
{
  settlement = {
    type = Builtin VAULT "DUNGEON"
    inhabitants = {
      fighters = {
        count = {10 11} 
        all = {
          1 "RAT"
        }
      }
    }
    closeToPlayer = true
    dontConnectCave = true
    tribe = MONSTER
  }
  discoverable = false
}
"RAT_PEOPLE_Z_LEVEL"
{
  settlement = {
    type = RandomLayout { "z_level_cave_only_water" { 80 80 } "default" }
    tribe = MONSTER
    inhabitants = {
      leader = { { "RAT_KING" } }
      fighters = {
        count = {2 5}
        all = { 1 "RAT_SOLDIER" }
      }
      civilians = {
        count = {2 5}
        all = {
          1 "RAT_LADY"
          1 "RAT"
        }
      }
    }
  }
  discoverable = false
  config = {
    prisoners = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 1
    attackBehaviour = KillLeader
  }
}
"WIZARD_TOWER_ENTRY" inherit "ELEMENTALIST_ENTRY"
{
  settlement = append {
    type = Builtin TOWER "WIZARD_TOWER_FLOOR"
  }
}
"WIZARD_TOWER"
{
  settlement = {
    type = Predefined { "wizard_tower" "FOREST" } 
    inhabitants = {
      leader = { { "WHITE_WIZARD" } }
      civilians = {
        count = {5 7}
        all = { 1 "SUCCUBUS" }
      }
    }
    tribe = BANDIT
    furniture = "trees"
  }
  levelConnection = {
    direction = UP
    topLevel = ExtraEnemy { "WIZARD_TOWER_ENTRY" }
    levels = {
      { MainEnemy {20 20} BASIC "A wizard's tower" true }
    }
  }
}
"DARK_MAGE"
{
  settlement = {
    type = Builtin MINETOWN "DUNGEON"
    tribe = DARK_ELF
    inhabitants = {
      leader = {
        id = { "KEEPER_MAGE" }
        combatExperience = 12
      }
      fighters = {
        count = {12 18}
        all = {
          5 "GOBLIN_WARRIOR"
          2 "TROLL"
          1 "GOBLIN_PRIEST"
          1 "GOBLIN_WIZARD"
          1 "VAMPIRE"
          1 "SPECIAL_HMBN"
          1 "HARPY"
        }
        expLevelIncrease = {
          DAMAGE 10
          SPELL_DAMAGE 10
          RANGED_DAMAGE 6
        }
      }
      civilians = {
        count = {3 5}
        all = {
          1 "IMP"
        }
      }
    }
    locationNameGen = "TOWN"
    race = "dark mage"
    stockpiles = {{ "gold" 200 "TREASURE_CHEST"} {"minerals" 120 }}
    outsideFeatures = "dungeonOutside"
    furniture = "roomFurniture"
  }
  config = {
    immigrantInterval = 500
    maxPopulation = 15
    ghostProb = 0.1
    spawnGhosts = 4
    prisoners = true
  }
  behaviour = {
    minPopulation = 3
    minTeamSize = 4
    triggers = {
      RoomTrigger "THRONE" 0.0003
      RoomTrigger "THRONE_HUMAN" 0.0003
      RoomTrigger "IMPALED_HEAD" 0.0001
      SelfVictims
      NumConquered 3
      StolenItems
      FinishOff
      Proximity
      AggravatingMinions
    }
    attackBehaviour = KillMembers 3
    ransom = 0.8 320
  }
  immigrants = {
    {
      ids = {"DWARF"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}

# Legacy content, not in vanilla anymore

"ORC_VILLAGE"
{
  settlement = {
    type = Builtin VILLAGE "BRICK"
    tribe = GREENSKIN
    inhabitants = {
      fighters = {
        count = {12 16}
        all = {
          1 "ORC"
          1 "OGRE"
        }
      }
    }
    locationNameGen = "TOWN"
    race = "greenskins"
    furniture = "roomFurniture"
    outsideFeatures = "villageOutside"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 16
    prisoners = true
  }
  createOnBones = 0.1 { "DWARVES" "VILLAGE" }
  immigrants = {
    {
      ids = {"ORC"}
      traits = {FIGHTER}
      frequency = 3
    }
    {
      ids = {"OGRE"}
      traits = {FIGHTER}
      frequency = 1
    }
  }
}

"ORC_CAVE"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    inhabitants = {
      fighters = {
        count = {4 9}
        all = { 1 "ORC" }
      }
    }
    tribe = BANDIT
    race = "orcs"
  }
  config = {
    immigrantInterval = 1000
    maxPopulation = 10
    prisoners = true
  }
  behaviour = {
    minPopulation = 0
    minTeamSize = 3
    triggers = {Resource "GOLD" 500}
    attackBehaviour = StealResource "GOLD"
    ransom = 0.5 80
  }
  createOnBones = 0.1 { "KOBOLD_CAVE" }
  immigrants = {
    {
      ids = { "ORC" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}
"COTTAGE_ORCS" inherit "ORC_CAVE"
{
  createOnBones = 1.0 { "ELVEN_COTTAGE" }
}
"OGRE_CAVE"
{
  settlement = {
    type = Builtin CAVE "DUNGEON"
    tribe = GREENSKIN
    inhabitants = {
      fighters = {
        count = {4 8}
        all = { 1 "OGRE" }
      }
    }
    closeToPlayer = true
    furniture = "roomFurniture"
    outsideFeatures = "villageOutside"
  }
  config = {
    immigrantInterval = 300
    maxPopulation = 10
    prisoners = true
  }
  immigrants = {
    {
      ids = { "OGRE" }
      traits = { FIGHTER }
      frequency = 1
    }
  }
}

