###############################################################################
# Lemuel's Castle - Sub-vault version
#
# Originally a castle by Lemuel in large.des. Now randomised by carwin using
# subvaults, and using its own des file due to size.
#
# A castle with a randomized interior. Contains depth-appropriate inhabitants
# and loot. Based on Lemuel's Castle vault. Interior is built as a subvault
# with the tag "lemuel_castle_interior." Feel free to make more!
# To make sure the subvault orients correctly with the bridge, the two
# characters on the bottom left and bottom right of each subvault should be
# left empty (spaces).

{{
-- Configuration for the Lemuel Castle vault and its subvaults. Monsters on
-- slots 1-3 are used exclusively in the subvaults, slot 4 is used in both
-- subvaults and the parent vault, and 5 and 6 are used exclusively in the
-- parent vault.
function castle_lemuel_setup(e)
    if you.in_branch("D") then
        if you.depth() < 6 then
           e.mons("gnoll / orc")
           e.mons("gnoll / orc / orc wizard w:2 / gnoll shaman w:2"
                  .. " / orc priest w:1")
           e.mons("ogre / gnoll sergeant / kobold brigand")
           e.mons("jackal / hound w:5 / howler monkey w:5")
           e.mons("gnoll / orc")
           e.mons("jackal")
           e.subst("* = $$$%")
           e.subst("| = *%%%")
        elseif you.depth() < 9 then
           e.mons("orc / gnoll / orc wizard / orc priest / ogre")
           e.mons("gnoll shaman / gnoll sergeant / orc warrior"
                  .. " / kobold brigand")
           e.mons("troll / two-headed ogre / cyclops / kobold demonologist")
           e.mons("hound / howler monkey / warg w:5")
           e.mons("orc / gnoll / ogre")
           e.mons("hound / howler monkey")
           e.subst("* = %$")
           e.subst("| = *%")
        elseif you.depth() < 12 then
           e.mons("orc wizard / orc priest / gnoll shaman / gnoll sergeant"
                  .. " / kobold brigand / orc warrior")
           e.mons("troll / two-headed ogre / kobold demonologist / cyclops w:5")
           e.mons("deep elf pyromancer / orc knight / orc sorcerer / ogre mage")
           e.mons("warg / hell hound w:2")
           e.mons("orc wizard / orc priest / gnoll shaman / gnoll sergeant")
           e.mons("howler monkey / warg")
           e.subst("* = %")
           e.subst("| = *")
        elseif you.depth() < 14 then
           e.mons("gnoll sergeant / orc warrior / two-headed ogre / troll"
                  .. " / kobold demonologist")
           e.mons("cyclops / deep elf pyromancer / tengu warrior"
                  .. " / tengu conjurer")
           e.mons("orc knight / ogre mage / orc sorcerer / orc high priest"
                  .. " / deep elf knight / deep elf archer"
                  .. " / deep elf zephyrmancer")
           e.mons("warg w:15 / hell hound / raiju w:5")
           e.mons("gnoll sergeant / orc warrior / troll")
           e.mons("howler monkey / warg w:50")
           e.subst("* = %*")
           e.subst("| = |*")
        else
           e.mons("two-headed ogre / troll / kobold demonologist / cyclops"
                  .. " / deep elf pyromancer / tengu warrior / tengu conjurer")
           e.mons("orc knight w:60 / ogre mage / orc sorcerer / orc high priest"
                  .. " / deep elf knight / deep elf archer"
                  .. " / deep elf zephyrmancer")
           e.mons("orc warlord / deep troll earth mage / fire giant"
                  .. " / frost giant / tengu reaver / deep elf annihilator"
                  .. " / deep elf high priest")
           e.mons("warg / hell hound / raiju")
           e.mons("two-headed ogre / troll / cyclops / tengu warrior")
           e.mons("warg / hell hound")
        end
    else
       -- Places draconians and other Zot-themed monsters along with the Zot
       -- entry on the final floor of Depths.
       if you.where() == dgn.level_name(dgn.br_entrance("Zot")) then
           e.kmons("1 = red draconian / white draconian / green draconian"
                   .. " / black draconian / purple draconian")
           e.kmons("2 = yellow draconian monk / purple draconian annihilator"
                   .. " / green draconian monk / golden dragon w:5")
           e.kmons("3 = red draconian scorcher / white draconian knight"
                   .. " / purple draconian shifter"
                   .. " / black draconian stormcaller")
           e.kmons("4 = tentacled monstrosity / quicksilver dragon"
                   .. " / golden dragon")
           e.kmons("5 = red draconian / green draconian / white draconian"
                   .. " / black draconian / purple draconian")
           e.kmons("6 = fire dragon / ice dragon / death drake / storm dragon"
                   .. " / shadow dragon")
           e.kfeat("3 = enter_zot")
           e.subst("w : wl")
       -- Depths uses a theme of mostly large/giant monsters.
       else
           e.mons("deep troll / iron troll / deep troll shaman / ettin"
                  .. " / stone giant / deep troll earth mage")
           e.mons("stone giant / deep troll earth mage / fire giant"
                  .. " / frost giant / juggernaut")
           e.mons("titan")
           e.mons("storm dragon / shadow dragon / quicksilver dragon"
                  .. " / golden dragon / tentacled monstrosity"
                  .. " / caustic shrike")
           e.mons("deep troll / iron troll / deep troll shaman / ettin")
           e.mons("fire dragon / ice dragon / death drake / spark wasp"
                  .. " / sphinx")
       end
   end
   e.kmons("p = plant / fungus w:1")
   e.kfeat("~ = alarm trap w:1 / floor")
   e.kfeat("m = iron_grate")
   e.subst("D = c +:1")
   e.subst("8 = 89")
   e.colour("? = brown")
   e.ftile("? = floor_mud")
   e.tile("c = wall_stone_smooth")
   e.ftile("DG+|*$.~ = floor_cobble_blood")
   e.ftile("12348 = floor_cobble_blood")
end
}}


###############################################################################
# Lemuel Castle Interior Subvaults
###############################################################################

# Lemuel Castle Interior original
NAME:   lemuel_castle_interior_original
TAGS:   lemuel_castle_interior unrand
: castle_lemuel_setup(_G)
MAP
+c....+~......+..+......~+.***c+
.c||..ccccccccc++ccccccccc.***c.
1c||2.c1......1321......1c.$$$c1
.cccccc.......2112.......cccccc.
.+....+..1.....22.....1..+....+.
.+....+......1....1......+....+.
.cccccccccccccc++cccccccccccDcc.
1c1.1..ccccccc....ccccccc..m..c1
.c.2...+.....+....+.....+..+.8c.
+c1.1..ccccccc....ccccccc..m..c+
  cccccccccccc++++cccccccccccc
ENDMAP

# Lemuel Castle Interior : Carwin Interior #1
NAME:   lemuel_castle_interior_carwin_1
TAGS:   lemuel_castle_interior unrand
: castle_lemuel_setup(_G)
MAP
+c....+........cc........+...*c+
.c.11.ccc+cccccccccccc+ccc..2.c.
.c|.2.D*m.1..........1.m|c....c.
.ccm+mc|m.....1111.....m|cm+mcc.
......c|m..1...22......m*c..1...
......c.+....1132.2....+.D..1...
.cccccccccccccccccccccccccccccc.
.c........1..m....m..1........c.
.+.12........+....+..........2+.
+c........1..m....m..1........c+
  cccccccccccc++++cccccccccccc
ENDMAP

# Lemuel Castle Interior : Carwin Interior #2
NAME:   lemuel_castle_interior_carwin_2
TAGS:   lemuel_castle_interior unrand
: castle_lemuel_setup(_G)
SUBST:  $ = $:5 .
ITEM:   nothing w:20 / potion of ambrosia ident:type
MAP
+c....+.......1.............*|c+
...1..cccccccccccccccccccccccDc.
cc....c......cG..Gc.1.......c|c1
*cc++cc..cG..+....+...12....m|c.
|....~12.cG..+....+...23....+.c.
$....~.2.....c....c...12....m*c.
*cc++ccccccccc....ccccccc++ccDc+
cc~~~~c.m444dc....c2..$c.~~.....
...12.c.cm4mmc....c$cc.c12......
+c....+...2..c....c...........c+
  cccccccccccc++++cccccccccccc
ENDMAP

# Lemuel Castle Interior : Carwin Interior #3
NAME:   lemuel_castle_interior_carwin_3
TAGS:   lemuel_castle_interior unrand
: castle_lemuel_setup(_G)
SUBST:  $ = $:5 .
MAP
+c....+...*c*||cc||*cccccc$...c+
.c.1..ccccccmc1321cmcccccc....c.
.c..2........c.12.c...........c.
.cc++c.........ww.....2..1c++cc.
.....c.2.......ww.........c.....
.2...c...1...c..$.c...1...c..1..
.ccccc+cccccccccDcccccccc+ccccc.
.c.1.c.~..1..+....+2....~.c2..c.
.~.c$c.~2....c....c.....~.c$c1~.
+c..2c.~..1..c....c..1..~.c...c+
  cccccccccccc++++cccccccccccc
ENDMAP

# Main vault.
NAME:     lemuel_castle_with_subvaults
TAGS:     layout_city transparent no_monster_gen no_rotate
DEPTH:    D:3-, Depths
PLACE:    Depths:$
ORIENT:   northwest
: castle_lemuel_setup(_G)
SUBVAULT: E : lemuel_castle_interior
SUBST:    E = .
MAP
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x,,,,,,p,,,,,,,,,,,,,,,,,6,6,,,,,,p,,,,,,,,,,,,,,,,x
x,,,,,,,,,,,,,,p,,,,,,,,6,6,6,,,p,,,,,,,,,,,,,p,,,,x
x,,,,wwwwwwwwwwwwwwwwwwwwWwwwwwwwwwwwwwwwwwwwww,,,,x
x,,,,wwwwwwwwwwwwwwwwwwwwWwwwwwwwwwwwwwwwwwwwww,,,,x
x,,,,wwccnccwwwwwwwwwwwwwWwwwwwwwwwwwwwwccnccww,,,,x
x,,,,wwc1.1c4....4.......4......4....4..c1.1cww,,,,x
x,,,,wwc.1.cDccccccccccccccccccccccccccDc.1.cwwp,,,x
x,,,,wwcccEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEcccww,,,,x
x,,,,www.cEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEc.www,,,,x
x,,,,www.cEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEc.www,,p,x
x,,,,www.cEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEc.www,,,,x
x,,,,WWW.cEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEc.WWW,,,,x
x,p,,www.cEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEc.www,,,,x
x,,,,www.cEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEc.www,,,,x
x,,,,www.cEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEc.www,,,,x
x,,,,www.cEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEc.www,,,,x
x,,,,wwcccEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEcccwwp,,,x
x,,,pwwc.1.cEEEEEEEEEEEEEEEEEEEEEEEEEEEEc.1.cww,,,,x
x,,,,wwc1.1c............................c1.1cww,,,,x
x,,,,wwccnccwwwwwwwwwwww????wwwwwwwwwwwwccnccww,,,,x
x,,,,wwwwwwwwwwwwwwwwwww????wwwwwwwwwwwwwwwwwww,,,,x
xp,,,wwwwwwwwwwwwwwwwwww????wwwwwwwwwwwwwwwwwww,,,,x
x,,,,,,,,,,,,,,,,,,656,,,@,,,,656,,,,,,,,,,,,p,,,,,x
ENDMAP
