##############################################################################
# tomb.des: Maps for the Tomb.
#
# <<1>> Tomb entry vaults.
# <<2>> Tomb:1 Map and subvaults.
# <<3>> Tomb:2 Map and subvaults.
# <<4>> Tomb:3 map and subvaults.
# <<5>> Tomb save compat vaults.
##############################################################################

{{
crawl_require('dlua/vault.lua')

function tomb_entry(e)
    e.tags("tomb_entry no_monster_gen no_item_gen transparent")
    e.mons("burial acolyte ; quarterstaff ego:pain / weeping skull w:6")
    e.mons("guardian mummy w:48 / soul eater w:2")
    e.mons("guardian sphinx")
    e.mons("guardian sphinx draugr")
    e.mons("mummy priest")
    e.kfeat("O = enter_tomb")
end

function tomb_1_mummy_set(e)
  e.mons("mummy / skeletal warrior w:1 / nothing")
end

function tomb_1_mummy_priest_set(e, chamber)
  e.mons("mummy priest w:30 / revenant soulmonger w:5 / lich w:5 / nothing w:30")
  if chamber then
    e.mons("royal mummy / nothing w:11")
    e.mons("obsidian statue / orange crystal statue")
  else
    e.mons("royal mummy")
  end
end

function tomb_mummy_set(e)
  e.mons("mummy / skeletal warrior w:2")
end

function tomb_mummy_priest_set(e)
  e.mons("mummy priest w:20 / lich w:2 / revenant soulmonger w:2")
  e.mons("royal mummy")
end

function tomb_guardian_set(e, include_nothing)
  if e.is_validating() then
     e.mons("guardian mummy w:233 / mummy / nothing w:233")
     return
  end
  if dgn.persist.tomb_guardian_sets == nil then
    dgn.persist.tomb_guardian_sets = { 0, 0, 0, 0, 0, 0 }
  end
  local sets =
    {
      "ushabti w:119 / guardian mummy w:79 / mummy w:28 / " ..
          "skeletal warrior w:8 / ancient champion w:8 / bennu w:8",
      "guardian mummy w:119 / death scarab band w:79 / mummy w:28 / " ..
          "skeletal warrior w:8 / ancient champion w:8 / bennu w:8",
      "guardian mummy w:98 / mummy w:18 / skeletal warrior w:38  / " ..
          "ancient champion w:28 / bennu w:28",
-- start TAG_MAJOR_VERSION == 34
      -- HACK: for save compat, double up the monster sets
      "ushabti w:119 / guardian mummy w:79 / mummy w:28 / " ..
          "skeletal warrior w:8 / ancient champion w:8 / bennu w:8",
      "guardian mummy w:119 / death scarab band w:79 / mummy w:28 / " ..
          "skeletal warrior w:8 / ancient champion w:8 / bennu w:8",
      "guardian mummy w:98 / mummy w:18 / skeletal warrior w:38  / " ..
          "ancient champion w:28 / bennu w:28",
-- end TAG_MAJOR_VERSION
    }
  local nothing = " / nothing w:248"
  local which_set = 0
  local mincount = math.min(table.unpack(dgn.persist.tomb_guardian_sets))
  local count = 0
  for i = 1, #sets do
    if dgn.persist.tomb_guardian_sets[i] == mincount then
      count = count + 1
      if crawl.random2(count) == 0 then
        which_set = i
      end
    end
  end
  dgn.persist.tomb_guardian_sets[which_set] =
      dgn.persist.tomb_guardian_sets[which_set] + 1
  if include_nothing then
    e.mons(sets[which_set] .. nothing)
  else
    e.mons(sets[which_set])
  end
end

-- If we get a lot more traps suited for large numbers in Tomb, setting them up
-- to vary per floor would help Tomb's variety a bunch. As is, just keep the
-- trap definition consistent between each of the uses.
function tomb_trap_set(e)
--[[
  if e.is_validating() then return end

  if dgn.persist.tomb_trap_sets == nil then
    local opt = { "tyrant's trap", "lobbyist's trap", "doom trap" }
    dgn.persist.tomb_trap_sets = { util.random_from(opt), util.random_from(opt),
                                   util.random_from(opt) }
  end
]]
  e.kfeat("^ = alarm trap / net trap / zot trap / dispersal trap / tyrant's trap")
  -- e.kfeat("~ = " .. dgn.persist.tomb_trap_sets[you.depth()])
  -- e.subst("^ = ^:36 ~:14")
end

--[[
Setup Tomb:1 central vault. For monsters, define plain mummies on '1', the
guardian set on '2', priest-level monsters on '3', greater-mummy-level monsters
on '4', and a statue monster on '5'. Define mostly non-mechanical traps on '^',
placing around 12 traps on-average on floor '.' squares. Set up the hatches to
Tomb:2.
]]
function tomb_1_centre_setup(e)
  tomb_1_mummy_set(e)
  tomb_guardian_set(e, true)
  tomb_1_mummy_priest_set(e, true)

  e.kfeat("^ = alarm trap w:5 / dispersal trap / net trap / zot trap")
  e.subst(". = ^ .:490")

  e.lua_marker(">", hatch_name("tomb2_entry"))
  e.lua_marker(">", hatch_dest_name("tomb2_exit"))
end

--[[
Setup Tomb:1 hall stairs. Vaults should place a P glyph for the hallway entry
destination, a Q glyph for the first hall exit (near P), and an R glyph for the
second hall exit (to the second set of rooms on Tomb:2). Any '.' glyphs have a
small chance of placing a '3' guardian or an appropriate trap type. About 7 '3'
and about 6 traps on average.
]]
function tomb_1_stairs_setup(e)
  e.lua_marker("P", hatch_dest_name("tomb1_hall_entry"))
  e.subst("P = .")

  e.lua_marker("Q", hatch_name("tomb1_hall_exit_1"))
  e.subst("Q = >")

  e.lua_marker("R", hatch_name("tomb1_hall_exit_2"))
  e.subst("R = >")

  tomb_guardian_set(e, true)
  tomb_1_mummy_priest_set(e)

  e.subst(". = 3 ^ .:230")
  tomb_trap_set(e)
end

--[[
Setup Tomb:2 central ambush. Sets up hatches back to the starting Tomb:1 area
and to the Tomb:1 hall. Places about 8 traps of appropriate types on-average.

Vaults should place an 'R' glyph for the ambush entry and a nearby 'S' glyph
for an exit back to the Tomb:1 hatch. If more than one S glyph exists, one will
be chosen at random for the exit hatch.
]]
function tomb_2_ambush_setup(e)
  tomb_guardian_set(e)
  tomb_mummy_priest_set(e)

  e.lua_marker("R", hatch_dest_name("tomb2_entry"))
  e.lua_marker("R", hatch_dest_name("tomb1_hall_exit_1"))
  e.subst("R = .")

  e.lua_marker("S", hatch_name("tomb2_exit"))
  e.nsubst("S = 1:< / *:.")

  e.subst(". =  ^ .:740")
  tomb_trap_set(e)
end

function tomb_3_khufu(e, glyph)
  e.kmons(glyph ..  " = Khufu w:3 / royal mummy, royal mummy")
end

--[[
Setup for Tomb:3 rune vaults. For monsters, it places a guardian monster set on
'1', a mummy priest set on '2', and a royal mummy set on '3'. Places about 12
appropriate traps on-average.

Vaults should place an 'O' glyph for the golden rune and can optionally place a
'K' glyph for a nearby guardian that has a chance of being Khufu.
]]
function tomb_3_rune_setup(e)
  tomb_guardian_set(e)
  tomb_mummy_priest_set(e)

  e.kmask("OR = no_item_gen")
  e.kitem("R = sanguine gem")
  e.kitem("O = golden rune of Zot")

  tomb_3_khufu(e, "K")

  e.subst(". = ^ .:490")
  tomb_trap_set(e)
end

}}

##############################################################################
# <<1>> Tomb entry vaults.
##############################################################################

# simple entrance
NAME:   tomb_entry_simple_bobbens
NSUBST: + = 1:+ / *:c
: tomb_entry(_G)
MAP
cccc.cccc
c2.....2c
c.ccccc.c
c.c.3.c.c
..c.O.c..
c.c...c.c
c.c++cc.c
c2.....2c
cccc.cccc
ENDMAP

##############################################################################
# small pyramid leading to the bigger one
NAME:   tomb_entry_pyramid_bobbens
SUBST:  1 = 1:1 2:9 4:1
: tomb_entry(_G)
MAP
........................
........................
..cccccccccccccccccccc..
..cccccccccccccccccccc..
..cc....1...........cc..
..cc..............1.cc..
..cc....cccccccccc..cc..
..cc....c........c..cc..
..cc....c..ccccc.c..cc..
..cc....c..cO.5..c..cc..
..cc....c..ccccccc..cc..
..cc.1..c..1........cc..
..cc....c...........cc..
..cc....cccccccccccccc..
..cc................cc..
..cc....1......1....cc..
..cc...ccc++++ccc...cc..
..cc...cc......cc...cc..
..cc.1.cc.G..G.cc.1.cc..
..cc.V.cc......cc.V.cc..
..cc.$.cc......cc.$.cc..
..ccccccc.G..G.ccccccc..
..ccccccc......ccccccc..
........................
.......3........3.......
ENDMAP

##############################################################################
# sphere entry
NAME:   tomb_entry_sphere_bobbens
SUBST:  1 = 1:1 2:9 4:1
: tomb_entry(_G)
MAP
          ccccc
       cccc.1.cccc
     ccc.........ccc
    cc......c......cc
   cc....ccccccc....cc
   c....cc.1.1.ccc..1c
..cccc...........cc..cc
.1c..cc..........$c5O.c
..+..3ccccc.G.ccccccccc
.1c...c$..............c
..cc..cc.............cc
   c...ccc.1..1.cc...c
   cc....cccccccc...cc
    cc......c......cc
     ccc.........ccc
       cccc.1.cccc
          ccccc
ENDMAP

##############################################################################
# forgotten tomb entrance
NAME:   tomb_entry_forgotten_bobbens
KMONS:  f = withered plant
SUBST:  p = f.
: tomb_entry(_G)
MAP
cccccccccc
cfffffppp.
cfOfffppp.
cffffppp..
cffpppp..
cppppp..
cppp...
cpp..
c...
ENDMAP

##############################################################################
# she sells tomb entry shells by the sea shore
NAME:   tomb_entry_shell_bobbens
TAGS:   no_rotate
SUBST:  2 = 2:9 4:1
: tomb_entry(_G)
MAP
          c
        ccc..
      ccc.c2.
    ccc......
   cc.....c2.
  cc......cccc
 cc.......c..ccc
 c........c....cc
cc2.......c.O5..c
c.....2...c.....c
c.....ccUcc.....c
cc.....ccc2.....c
 cc............cc
  ccc........2cc
    ccc.....ccc
      ccccccc
ENDMAP

##############################################################################
NAME: nicolae_tomb_entry_grand_gallery
SUBST: + = ++++., - = +
: tomb_entry(_G)
MAP
cccc-cccccccc
cccc.....cccc
cccc..2..cccc
cccccccc+cccc
c..+2Oc1.+..c
c..c1ccc1c..c
c.2ccccccc2.c
c..c1ccc1c..c
c..+.1c1.+..c
cccc+ccc+cccc
cccc..2..cccc
cccc.....cccc
ccccccccccccc
ENDMAP

NAME:   nicolae_tomb_entry_rubble_hallway
TAGS:   no_wall_fixup
MONS:   pile of debris
KITEM:  s = stone q:1 / large rock q:1 w:5
NSUBST: R = 7:r / *:.
SUBST:  r = xx..., 1 = 1xx..., . = ....s
TILE:   x = wall_pebble_darkgray
: tomb_entry(_G)
MAP
ccccccccccccccccc
ccccccccccc1...1c
c..rrr.r1r..RRR.c
+.r.r.r.r.11ROR1c
c.rr.r1r.rr.RRR.c
ccccccccccc1...1c
ccccccccccccccccc
ENDMAP

NAME:   nicolae_tomb_entry_unfolded_pyramid_diagonal
NSUBST: C = 1:. / *:c, 1 = 1:4 / *:1
: tomb_entry(_G)
MAP
       .....
      ...c...
     ...ccc...
    ...cc.cc...
   .1.cc...cc.1.
  ...cc..1..cc...
 ...cc+ccccc+cc...
...cc.cC...Cc.cc...
..cc..c.1.2.c..cc..
.++..1c..O..c1..cc.
..cc..c.2.1.c..cc..
...cc.cC...Cc.cc...
 ...cc+ccccc+cc...
  ...cc..1..cc...
   .1.cc...cc.1.
    ...cc.cc...
     ...ccc...
      ...c...
       .....
ENDMAP

NAME: nicolae_tomb_entry_unfolded_pyramid_orthogonal
NSUBST: C = 1:. / *:c
KMONS: 1 = mummy
KMONS: O = guardian mummy
KFEAT: O = enter_tomb
: tomb_entry(_G)
MAP
  .............
 .......1.......
..ccccccccccccc..
..c....+++....c..
..c.1.ccCcc.1.c..
..c..cc...cc..c..
..c.cc.....cc.c..
..c+c...1...c+c..
.1c+C..1O1..C+c1.
..c+c...1...c+c..
..c.cc.....cc.c..
..c..cc...cc..c..
..c.1.ccCcc.1.c..
..c....+++....c..
..cccccccccccc+..
 .......1.......
  .............
ENDMAP

NAME:   tomb_entry_moat_badplayer
TAGS:   no_pool_fixup no_rotate
WEIGHT: 3
NSUBST: 12 = 1:4
: tomb_entry(_G)
MAP
      ...............
   .....................
  ......wwww...wwww......
 ......wwccc+++cccww......
......wwcc.......ccww......
.....wwccc.1...1.cccww.....
.....wcccc.......ccccw.....
.....wwwwccc+++cccwwww.....
...wwwwcwwwc...cwwwcwwww...
...w..wcccwc+++cwcccw..w...
...w.2...cw.....wc...2.w...
...w..wc.cw.....wc.cw..w...
...wwwwc.cw.....wc.cwwww...
......wc...........cw......
 .....wccc.1...1.cccw.....
  ....wwwc.......cwww....
   ....wcc.......ccw....
  ....ccc.........ccc....
 ....cc.............cc....
....cc...............cc....
....c...1..c+++c..1...c....
....c.....cc.2.cc.....c....
....cc....c.....c...cc....
 ....cc...c..O..c...cc....
  ....ccccc..5..ccccc....
   ......ccccccccc......
     ................
       ............
ENDMAP

NAME:   tekkud_tomb_entry_cross
TAGS:   no_rotate
WEIGHT: 5
NSUBST: ~ = 3:! / *:. , - = 4:? / 1:5.. / *:.
NSUBST: _ = 1:! / 3:? / *:. , Y = 3:? / 1:!!5 / *:.
SUBST:  ? = 122, ! = 34
: tomb_entry(_G)
MAP
        ccccc
       @c.1.c@
       c.....c
       c.....c
  cccccc.....cccccc
 cc~~~~.......~~~~cc
cc~~~~~.......~~~~~cc
ccccccc.......ccccccc
c_____c-------c___$$c
c$____c-------c____$c
c$___c+-------+c___$c
c$___c---------c____c
cccccc---------cccccc
     c---------c
     c---------c
     c---------c
    cc---------cc
    c...........c
    c...........c
    c...........c
    c...........c
   cc...........cc
   cccccc+++cccccc
   cYYYY.....YYYYc
   cYYYY.....YYYYc
   cYYYY.....YYYYc
   cYYYY..O..YYYYc
   ccccccccccccccc
ENDMAP

##############################################################################
# The three Tomb levels: these should generally be of a confusing layout.
##############################################################################

##############################################################################
# <<2>> Tomb:1 Map and subvaults.
#
# <<2.1>> Tomb:1 central subvaults.
# <<2.2>> Tomb:1 hall stair subvaults.
##############################################################################

NAME:     tomb_1
PLACE:    Tomb:1
ORIENT:   encompass
TAGS:     no_dump
SUBVAULT: A : tomb_1_centre
SUBVAULT: B : tomb_1_hall_stairs
: tomb_guardian_set(_G, true)
MONS:     royal mummy / nothing
MONS:     guardian sphinx, guardian sphinx draugr
MONS:     obsidian statue / orange crystal statue
NSUBST:   ( = 1:( / *:., 3 = 3:3 / 5 = 34 / *:.
# Set up decorative statues.
: if crawl.x_chance_in_y(3, 4) then
SUBST:    I = I:900 6, N = N:900 6
SUBST:    J = J:750 6, O = O:750 6
SUBST:    K = K:550 6, P = P:550 6
SUBST:    L = L:300 6, Q = Q:300 6
:   vault_granite_statue_setup(_G, "FIJKLMNOPQ", "sarcophagus")
TILE:     FIJKL = dngn_sarcophagus_pedestal_left
: else
SUBST:    FIJKLMNOPQ = G
: end
# Add greater mummies and traps to the long hall. About 16 greater mummies and
# 6 traps on-average.
SUBST:    ' = 2:24 ^:8 .:212
: tomb_trap_set(_G)
: set_feature_name("escape_hatch_down", "one-way staircase leading down")
MAP
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxx(.............................(..............................(xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxx..........ccccccccccccccccccccccccccccccccccccccccccc.........xxxxxxxxx
xxxxxxxxx..........ccccccccccccccccccccccccccccccccccccccccccc.........xxxxxxxxx
xxxxxxxxx..........cc'''''''''''''''''''''''''''''''''''''''cc.........xxxxxxxxx
xxxxxxxxx..........cc'''''''''''''''''''''''''''''''''''''''cc.........xxxxxxxxx
xxxxxxxxx..........cc''ccccccccccccccccccccccccccccccccccc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........cc''cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc''cc.........xxxxxxxxx
xxxxxxxxx..........ccBBccccccccccccccAAAAAAAccccccccccccccBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBccc+++++cccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.1...1.ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.L...Q.ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.......ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.1...1.ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.K...P.ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.......ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.1...1.ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.J...O.ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.......ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........ccBBBBBBBBBBBBBBcc.......ccBBBBBBBBBBBBBBcc.........xxxxxxxxx
xxxxxxxxx..........cccccccccccccccccc.I...N.cccccccccccccccccc.........xxxxxxxxx
xxxxxxxxx..........cccccccccccccccccc.......cccccccccccccccccc.........xxxxxxxxx
xxxxxxxxx.............................3...3............................xxxxxxxxx
xxxxxxxxx.............................F...M............................xxxxxxxxx
xxxxxxxxx...........................3.3...3.3..........................xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxx...........................3..V.V..3..........................xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxx.............................3...3............................xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxx...........................3.......3..........................xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxx..............................................................xxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ENDMAP

##############################################################################
# <<2.1>> Tomb:1 central subvaults.
##############################################################################

NAME:    tomb_1_centre_old
TAGS:    tomb_1_centre unrand
SHUFFLE: AB>, _-
SUBST:   AB = |*, ' = ^-, 5 = 5 ^:40 -:30
NSUBST:  . = 11=2 / 11=3 / .
: tomb_1_centre_setup(_G)
SUBST:   - = .
MAP
...........'c................c''>
..ccccccccc.c................c'5'
..cA22c'11c.c...............4c.''
..c2c'22c'1'c................+ccc
..ccccccccccc.................4..
.......4.........................
.................................
ccccccccccccc....................
............c....................
............c....................
..cccccccc..c....................
..c'.'c2Bc..c....................
..c.c.c'2c..c....................
..c.c'11cc..c....................
..c.cccccc..c....................
..c'........c....................
..ccccccccccc....................
.......4.........................
.................................
             .......
ENDMAP

NAME:    tomb_1_centre_grunt_parallel
TAGS:    tomb_1_centre unrand no_hmirror
TILE:    F  = dngn_sarcophagus_pedestal_left
TILE:    M  = dngn_sarcophagus_pedestal_right
COLOUR:  FM = yellow
SUBST:   FM = G
SUBST:   _  = V:70 5
NSUBST:  >  = > / | / * / _
: tomb_1_centre_setup(_G)
: set_feature_name("granite_statue", "sarcophagus")
MAP
>1..c..c.................c..c..1>
1...c..c.4.............4.c..c...1
....c..c..2...........2..c..c....
....c..c...2.........2...c..c....
c++cc.3c....4.......4....c3.cc++c
....c..c..c...........c..c..c....
....c..c.3c...........c3.c..c....
F...c..c..c..F.....M..c..c..c...M
.2.....c..c...........c..c.....2.
..3..2.c..c...........c..c2...3..
.2.....c..c..F.....M..c..c.....2.
F...c..c..c.....3.....c..c..c...M
....c..c..c...........c..c..c....
....c..c..c..F.....M..c..c..c....
c++cc.3c..c...2.2.2...c..c3.cc++c
....c..c..c....2.2....c..c..c....
....c..c3.c..F.....M..c.3c..c....
1...c..2..c...........c..2..c...1
>1..c.....c...........c.....c..1>
             .......
ENDMAP

NAME:    tomb_1_centre_grunt_layered
TAGS:    tomb_1_centre unrand no_hmirror
TILE:    F  = dngn_sarcophagus_pedestal_left
TILE:    M  = dngn_sarcophagus_pedestal_right
COLOUR:  FM = yellow
SUBST:   FM = G
SUBST:   _  = V:70 5
SHUFFLE: ABCD, EHIJ, de, fg, hi, jk
SHUFFLE: NOPQRSTU, WXYZ6789
SUBST:   AEdfhjNW = c, egik = +, BCDHIJOPQRSTUXYZ6789 = .
NSUBST:  >  = > / | / * / _
: tomb_1_centre_setup(_G)
: set_feature_name("granite_statue", "sarcophagus")
MAP
...D............3............E...
.F.D....2.....F...M.....2....E.M.
...D............4............E...
CCCccccceeccccc...cccccffcccccHHH
...c...O..P...c...c...X..Y...c...
...c.1.O..P.1.c...c.1.X..Y.1.c...
...c...O23P...c...c...X32Y...c...
.3.cNNNccccQQQc.3.cWWWccccZZZc.3.
...c..3c>.c...c...c...c.>c3..c...
.F.d...c>4i.M.c.2.c.F.j4>c...g.M.
...c..3c..c...c...c...c..c3..c...
.3.cRRRchhcUUUc.3.c666ckkc999c.3.
...c...S32T...c...c...7238...c...
...c.1.S..T.1.c...c.1.7..8.1.c...
...c...S..T...c...c...7..8...c...
BBBcccccccccccc...ccccccccccccIII
...A............4............J...
.F.A....2...3.F...M.3...2....J.M.
...A...........2.2...........J...
             .......
ENDMAP

NAME:    tomb_1_centre_nicolae_necropolis
TAGS:    tomb_1_centre unrand
SHUFFLE: AaBbQqDd/EeFfGgHh/IiJjKkLl/MmNnOoPp/RrSsUuVv
SHUFFLE: Aa/Bb/Qq/Dd, Ee/Ff/Gg/Hh, Ii/Jj/Kk/Ll, Mm/Nn/Oo/Pp, Rr/Ss/Uu/Vv
SUBST:   AEIMR = +, a = >, ei = *|, mr = %, bq = 4, dhlpv = 3
SUBST:   BQDFGHJKLNOPSUV = c, fgjknosu = ', ' = ^--112
: tomb_trap_set(_G)
: tomb_1_centre_setup(_G)
SUBST:   - = .
MAP
.................................
..cccAccc.....2...2.....cccEccc..
..cc'q'cc...............cc'g'cc..
..c'''''c...............c'''''c..
..Db'c'dB..3.........3..Hf'c'hF..
..c'''''c...............c'''''c..
..cc'a'cc....cccRccc....cc'e'cc..
..cccQccc....cc'u'cc....cccGccc..
.............c'''''c.............
.....3...4...Vs'c'vS...4...3.....
.............c'''''c.............
..cccMccc....cc'r'cc....cccIccc..
..cc'o'cc....cccUccc....cc'k'cc..
..c'''''c...............c'''''c..
..Pn'c'pN..3.........3..Lj'c'lJ..
..c'''''c...............c'''''c..
..cc'm'cc...............cc'i'cc..
..cccOccc.....2...2.....cccKccc..
.................................
             .......
ENDMAP

##############################################################################
# <<2.2>> Tomb:1 hall stair subvaults.
##############################################################################

NAME:    tomb_1_hall_stairs_old
TAGS:    tomb_1_hall_stairs unrand
SHUFFLE: PQ / RS
SUBST:   S = .
: tomb_1_stairs_setup(_G)
SUBST:   - = .
MAP
..                                   ..
..c...........           ...........c..
..c...........           ...........c..
..c..ccccccc..           ..ccccccc..c..
..c..cc-211c..           ..c11--cc..c..
..c..cP-c11c..           ..c11c-Rc..c..
..c..cccc..c..           ..c2.cccc..c..
..c........c..           ..c........c..
..cQ.......c..           ..c.......Sc..
..cccccccccc..           ..cccccccccc..
..............           ..............
..............           ..............
ENDMAP

NAME:    tomb_1_hall_stairs_grunt_patterns
TAGS:    tomb_1_hall_stairs unrand
SHUFFLE: PR
SHUFFLE: ABCD / ACBD / ACDB / CABD / CADB / CDAB
SHUFFLE: EFGH / EGFH / EGHF / GEFH / GEHF / GHEF
SUBST:   ABEF = c, CDGH = .
NSUBST:  P = P / Q / ., R = R / .
: tomb_1_stairs_setup(_G)
SUBST:   - = .
MAP
..                                   ..
..c...D....c-P           R-c....G...c..
..c...D....c--           --c....G...c..
cc+........+cc           cc+........+cc
......A.......           .......E......
.....1A1......           ......1E1.....
CC..BB2BB...CC           HH...FF2FF..HH
.....1A1......           ......1E1.....
......A.......           .......E......
cc+........+cc           cc+........+cc
--c...D....c--           --c....G...c--
P-c...D....c-P           R-c....G...c-R
ENDMAP

NAME:    tomb_1_hall_stairs_grunt_snakey
TAGS:    tomb_1_hall_stairs unrand
SHUFFLE: PQ / RS
SUBST:   S = .
: tomb_1_stairs_setup(_G)
SUBST:   - = .
MAP
..                                   ..
..............           ..............
..............           ..............
cccccccccccc..           ...ccccccccccc
..............           ..............
..............           ..............
..cccccccccccc           cccccccccccc..
..............           ..............
..............           ..............
cccccccccccc..           ..cccccccccccc
--211.........           .........112--
P--11........Q           R........11--S
ENDMAP

NAME:    tomb_1_hall_stairs_nicolae_cartouches
TAGS:    tomb_1_hall_stairs unrand
SHUFFLE: PQ / RS
SUBST:   S = .
: tomb_1_stairs_setup(_G)
SUBST:   - = .
MAP
..                                   ..
..cc......cccc           cccc......cc..
..c........ccc           ccc........c..
.....cccc...cc           cc...cccc.....
....cc...c...c           c...c...cc....
...cc-...1c...           ...c1...-cc...
..ccP-..211c.Q           S.c112..-Rcc..
...cc-...1c...           ...c1...-cc...
....cc...c...c           c...c...cc....
.....cccc...cc           cc...cccc.....
..c........ccc           ccc........c..
..cc......cccc           cccc......cc..
ENDMAP

NAME: tomb_1_hall_stairs_nicolae_galleries
TAGS: tomb_1_hall_stairs unrand
# First shuffle randomizes which side is entry/exit, second two shuffles
# randomizes gallery configurations shared by both sides.
SHUFFLE: ABDF / HIJK, ACDHJa / BEFIKb, pq
SUBST: CJp = ., a = +, EFKbq = c, A = P, D = Q, BI = 2, H = R
: tomb_1_stairs_setup(_G)
MAP
..                                   ..
..EEEEEEEEFccc           cccKEEEEEEEE..
..EEEEEEEEEccc           cccEEEEEEEEE..
CCcccccccbbccc           cccbbcccccccCC
CCc..qppq.Accc           cccH.qppq..cCC
CCc....1...ccc           ccc...1....cCC
CCcq.p..p.qccc           cccq.p..p.qcCC
CCcp1.qq..pccc           cccp..qq.1pcCC
CCcp..qq.1pccc           cccp1.qq..pcCC
CCcq.p..p.qccc           cccq.p..p.qcCC
CCa...1....ccc           ccc....1...aCC
DCaB.qppq..ccc           ccc..qppq.IaCJ
ENDMAP

##############################################################################
# <<3>> Tomb:2 Map and subvaults.
#
# <<3.1>> Tomb:2 central subvaults.
##############################################################################

# Main map of Tomb:2.
NAME:     tomb_2
PLACE:    Tomb:2
# Can be rotated!
ORIENT:   encompass
TAGS:     no_dump no_trap_gen
SUBVAULT: B : tomb_2_ambush
MONS:     mummy
: tomb_guardian_set(_G)
: tomb_mummy_priest_set(_G)
# Tomb:1 Hall entry hatch
NSUBST:   A = A / '
MARKER:   A = lua:hatch_name("tomb1_hall_entry")
SUBST:    A = <
# Tomb:1 Hall exit destination
MARKER:   C = lua:hatch_dest_name("tomb1_hall_exit_2")
SUBST:    C = .
# Tomb:2 rooms exit hatch
MARKER:   D = lua:hatch_name("tomb2_exit")
SUBST:    D = <
# Tomb:2 Room features
SHUFFLE:  Ww/Yy/Zz, Uu/Vv, Qq/Rr/Ss
SUBST:    W=', w=c, Y=T, y=+, Z=T, z=+
SUBST:    U=', u=c, V=T, v=+
SUBST:    Q=', q=c, R=T, r=+, S=T, s=+
# Tomb:3 ambush hatches
SHUFFLE:  EH / FI
MARKER:   E = lua:hatch_name("tomb3_entry_1")
MARKER:   F = lua:hatch_name("tomb3_entry_2")
SUBST:    EF = >
# Tomb:3 exit destinations
MARKER:   H = lua:hatch_dest_name("tomb3_exit_1")
MARKER:   I = lua:hatch_dest_name("tomb3_exit_2")
SUBST:    HI = .
# Add traps near doors and both traps and monsters throughout both groups of
# rooms.
SUBST:    T = ^..., ' = ^ ':220, ' = 1:5 2:5 3:1 .:89
SUBST:    " = ^ ":140, " = 2:3 3:1 .:96
: tomb_trap_set(_G)
#
# Number of ' symbols is 211+3=214, hence statistically in the lower
# circumference we'll have 10.7 mummies, another 10.7 guardian mummies
# and 2.1 mummy priests.
# Number of " symbols is 205+3=208, hence the upper circumference
# has in mean 4.0 mummy priests and 8.3 guardian mummies.
#
# Perhaps to do: use KFEAT to make mummies possibly appear at T spots.
#                have clustering of 1, 2 in the lower area as before?
#
: set_border_fill_type("permarock_wall")
: set_feature_name("escape_hatch_down", "one-way staircase leading down")
: set_feature_name("escape_hatch_up", "one-way staircase leading up")
#
MAP
ccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc
cc""""c""""""c"""""C""""c""""""""c"""""""cc
cc""""c"""""TcT""""""""TcT""""""TcT""""""cc
cc"H""c"""2"T+T""""""""T+T""2"""T+T"""I""cc
cc"""TcT""""TcT""""""""TcT""""""TcT""""""cc
cc""TT+T"""""c"""""D""""c""""""""c"""""""cc
ccccc+ccccccccccccccccccccccccccccccc""""cc
cc""TTcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc"3""cc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc""""cc
cc""3"cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc""""cc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc""""cc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc"""Fcc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBccccccc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBcT'''cc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBB+T'''cc
ccE"""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBcT'''cc
cccccccBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cc''''cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc'QQQcc
cc'''TcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBcccqccc
cc'''T+BBBBBBBBBBBBBBBBBBBBBBBBBBBBBc'QQQcc
cc'''TcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cc'ZZZcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cccczccBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cc'ZZZcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
ccA'''cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cc'YYYcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
ccccyccBBBBBBBBBBBBBBBBBBBBBBBBBBBBBcRRRAcc
cc'YYYcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBccrcccc
cc''''ccccc+ccccccccccccccc+cccccccccRRR'cc
cc''''''c'TTTc''''''''''''cTT''''''c'''''cc
cc'''''WcW''UcU''''''''''VcV''''''ScS''''cc
cc'''''WwW''UuU''''''''''VvV''''''SsS''''cc
cc'''''WcW''UcU''''''''''VcV''''''ScS''''cc
ccA'''''c''''cA'''''''''''c''''''''c''''Acc
ccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc
ENDMAP

##############################################################################
# <<3.1>> Tomb:2 central subvaults.
##############################################################################

NAME: tomb_2_ambush_old
TAGS: tomb_2_ambush unrand
MONS: mummy / skeletal warrior w:2
: tomb_2_ambush_setup(_G)
MAP
.............................
.............................
..xxx4.................4xxx..
..xxx...................xxx..
..xxx.........1.........xxx..
..xxx.....2.......2.....xxx..
...S.....................S...
.............................
........x...........x........
.............................
.....3........R........3.....
.............................
........x...........x........
.............................
...S.....................S...
..xxx.....2.......2.....xxx..
..xxx.........1.........xxx..
..xxx...................xxx..
..xxx4.................4xxx..
.............................
.............................
.............................
ENDMAP

NAME:    tomb_2_ambush_grunt_patterns
TAGS:    tomb_2_ambush unrand
MONS:    mummy / skeletal warrior w:2
: tomb_2_ambush_setup(_G)
SHUFFLE: AB / Ad / dA, CD / Ce / eC, EF / Ef / fE
SUBST:   ABCDEF = x, def = .
MAP
.............................
............DD.CC............
....EES....DD.3.CC....SEE....
..FFEE.................EEFF..
..FF4..................44FF..
........BB.........BB........
........BxA.......AxB........
.........AA.......AA.........
......C....2.....2....D......
.....CC...............DD.....
.....C.................D.....
.......1......R......1.......
.....D.................C.....
.....DD...............CC.....
......D....2.....2....C......
.........AA.......AA.........
........BxA.......AxB........
........BB.........BB........
..FF4...................4FF..
..FFEE.....CC.3.DD.....EEFF..
....EES.....CC.DD.....SEE....
.............................
ENDMAP

NAME: tomb_2_ambush_grunt_arcs
TAGS: tomb_2_ambush unrand
MONS: mummy / skeletal warrior w:2
: tomb_2_ambush_setup(_G)
MAP
.............................
.............................
....S4xxxx.........xxxx4S....
..........xxx...xxx..........
.............xxx.............
............xx1xx............
..........xx.....xx..........
........2x.........x2........
........x...........x........
.......x.............x.......
.......x3.....R.....3x.......
.......x.............x.......
........x...........x........
........2x.........x2........
..........xx.....xx..........
............xx1xx............
.............xxx.............
..........xxx...xxx..........
....S4xxxx.........xxxx4S....
.............................
.............................
.............................
ENDMAP

NAME: tomb_2_ambush_grunt_hexed
TAGS: tomb_2_ambush unrand
MONS: mummy / skeletal warrior w:2
: tomb_2_ambush_setup(_G)
MAP
.............................
..............x..............
........4.....x.....4........
......xx.............xx......
....Sxxx...xxxxxxx...xxxS....
....xxx....xxxxxxx....xxx....
...xxx..2.....1.....2..xxx...
...xx...................xx...
.............................
.............................
..3.xx........R........xx.3..
.............................
.............................
...xx...................xx...
...xxx..2.....1.....2..xxx...
....xxx....xxxxxxx....xxx....
....Sxxx...xxxxxxx...xxxS....
......xx.............xx......
........4.....x.....4........
..............x..............
.............................
.............................
ENDMAP

##############################################################################
# <<4>> Tomb:3 map and subvaults.
#
# <<4.1>> Tomb:3 central subvaults.
##############################################################################

NAME:     tomb_3
PLACE:    Tomb:3
ORIENT:   encompass
TAGS:     no_rotate no_dump no_trap_gen
SUBVAULT: A : tomb_3_rune
ITEM:     figurine of a ziggurat no_pickup
KITEM:    $ = $ no_pickup
KITEM:    * = * no_pickup
KITEM:    | = | no_pickup
: tomb_guardian_set(_G)
# Randomize some loot placement in the treasure rooms, and add the zig fig in
# the loot pile. Add traps to treasure rooms and the arrival area.
SUBST:    ' = $., $ = |:1 *:2 $:17, . = ^ .:260
NSUBST:   | = d / |
MARKER:   D = lua:hatch_dest_name("tomb3_entry_1")
MARKER:   E = lua:hatch_dest_name("tomb3_entry_2")
SUBST:    DE = .
MARKER:   F = lua:hatch_name("tomb3_exit_1")
MARKER:   H = lua:hatch_name("tomb3_exit_2")
SUBST:    FH = <
: tomb_trap_set(_G)
: set_border_fill_type("permarock_wall")
: set_feature_name("escape_hatch_down", "one-way staircase leading down")
: set_feature_name("escape_hatch_up", "one-way staircase leading up")
MAP
ccccccccccccccccccccccccccccccccccccccccccc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cccccccc....ccAAAAAAAAAAAAAAAAcc....ccccccc
cccccc.......cc11111111111111cc.....'$ccccc
cccc..........cc............cc.......'$cccc
cccc'.........Fcc..........ccH.......'$cccc
ccc$''..........cc........cc.........'$$ccc
ccc$$$'..........cc111111cc........''$$$ccc
ccc|$$$''........cc......cc......''$$$$$ccc
ccc||$$$$'........c......c......'$$$$$$$ccc
ccc|||||$$'.......c......c.....'$$$$$$$$ccc
cccc|||||$'.......+......+....'$$$$$$$$cccc
ccccc||||$$'......c......c....'$$$$$$$ccccc
cccccc||||$'......c......c....'$$$$$$cccccc
ccccccc|||$$'....cc......cc..'$$$$$$ccccccc
cccccccc|||$'....cc......cc..'$$$$$cccccccc
ccccccccc||$'...ccc......ccc'$$$$$ccccccccc
cccccccccc|$'..cccc.D..E.cccc$$$$cccccccccc
ccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc
ENDMAP

##############################################################################
# <<4.1>> Tomb:3 central subvaults.
##############################################################################

NAME: tomb_3_rune_old
TAGS: tomb_3_rune unrand
: tomb_3_rune_setup(_G)
MAP
ccccccccccccccccccccccccccccccccccccccccc
cccccc.............................cccccc
ccc...............cccccc..............ccc
cc...............cccccccc..............cc
cc.......3......ccccKOcccc......3......cc
cc............cccc..R...cccc...........cc
c............cccc........cccc...........c
c............cccc........cccc...........c
c...........cccc..333333..cccc..........c
c.......................................c
c.......................................c
c.................111111................c
cc................112211...............cc
cc...2............112211............2..cc
ccc...............111111..............ccc
ccc....1..........................1...ccc
ccccc....1......................1....cccc
ccccccc............................cccccc
cccccccc+ccc..................ccc+ccccccc
             ................
ENDMAP

NAME: tomb_3_rune_grunt_curves
TAGS: tomb_3_rune unrand
: tomb_3_rune_setup(_G)
MAP
ccccccccccccccccccccccccccccccccccccccccc
cccccc............ccccccc...........ccccc
cccc................ccc...............ccc
ccc...............3..c..3..............cc
ccc.....2........3.......3.......2.....cc
cc.........ccccc..........ccccc.........c
cc..2.....cc..ccccc..R..cccc..cc.....2..c
cc.....3.1......cccc...cccc.....1.3.....c
cc..cc..1........ccccOcccc.......1..cc..c
cc..cccc..........ccccccc.........cccc..c
cc..ccccc.....1....ccccc...1.....ccccc..c
cc..cccccc...2......ccc.....2...cccccc..c
cc..cccccc..1.......ccc......1..cccccc..c
cc..ccccccc..........c.........ccccccc..c
cc..ccccccc......11..c..11.....ccccccc..c
cc...ccccccc....3.........3...ccccccc...c
ccc......ccc..11.....2.....11.ccc......cc
cccc......cc.........2........cc......ccc
cccccccc+cccc................cccc+ccccccc
             ................
ENDMAP

NAME: tomb_3_rune_grunt_snapback
TAGS: tomb_3_rune unrand
: tomb_3_rune_setup(_G)
MAP
ccccccccccccccccccccccccccccccccccccccccc
cccccc......ccccccc.KO.ccccccc......ccccc
cccc.1......1.ccccc.R..ccccc.1......1.ccc
ccc.....3......cccc....cccc.....3......cc
ccc....1..1....ccc......ccc....1..1....cc
cc......cc......cc......cc......cc......c
cc......cc......cc......cc......cc......c
cc......cc......cc.1..1.cc......cc......c
cc..2...cc...2...c......c...2...cc...2..c
cc......cc.......c......c.......cc......c
cc.....1.cc......c......c......cc.1.....c
cc....1...cc....1........1....cc...1....c
cc...c.....cc...1..3..3..1...cc.....c...c
cc...cc..3..cccccc......cccccc..3..cc...c
cc...ccc........1cccccccc1........ccc...c
cc....ccc......1..........1......ccc....c
ccc....ccc....2....3..3....2....ccc....cc
cccc.....c...1..............1...c.....ccc
cccccccc+cccc................cccc+ccccccc
             ................
ENDMAP

NAME: tomb_3_rune_grunt_layered
TAGS: tomb_3_rune unrand
: tomb_3_rune_setup(_G)
MAP
ccccccccccccccccccccccccccccccccccccccccc
cccccc..............1...............ccccc
cccc1.......3................3.......1ccc
ccc..2..............1...............2..cc
ccc...1cccc...cccccccccccccc...cccc1...cc
cc....cc..........................cc....c
cc...cc............................cc...c
cc...c.....cccccccccccccccccccc.....c...c
cc...c....cc........O.........cc....c...c
cc.3.c1.21c3.1ccccccccccccc1.3.c12.1c.3.c
cc...c....cc........R.........cc....c...c
cc...c.....cccccccc.K.ccccccccc.....c...c
cc...cc.......1............1.......cc...c
cc....cc......1............1......cc....c
ccc...1cccccccccccccccccccccccccccc1...cc
ccc..2..........1........1..........2..cc
cccc1.......3................3.......1ccc
cccccc........1............1........ccccc
cccccccc+cccc................cccc+ccccccc
             ................
ENDMAP

NAME:   tomb_3_rune_grunt_doroklohe
TAGS:   tomb_3_rune unrand
: tomb_3_rune_setup(_G)
: tomb_3_khufu(_G, "O")
KMONS:  R = royal mummy
NSUBST: 3 = 1:O / 1:R / *:3
MAP
ccccccccccccccccccccccccccccccccccccccccc
cccccc..........1.......1...........ccccc
cccc................2.................ccc
ccc.............1.......1..............cc
ccc....xxx..1..xxx.....xxx..1..xxx.....cc
cc.....+3x.....x3+.....+3x.....x3+......c
cc.....xxx..1..xxx..2..xxx..1..xxx......c
cc......................................c
cc......1..x+x..1..x+x..1..x+x..1.......c
cc.........x3x.....x3x.....x3x..........c
cc......1..xxx..1..xxx..1..xxx..1.......c
cc......................................c
cc.....+xx........1....1.......xx+......c
cc.....x3x.......1......1......x3x......c
ccc....xxx......2........2.....xxx.....cc
ccc............1..........1............cc
cccc..........2............2..........ccc
cccccc.......1..............1.......ccccc
cccccccc+cccc................cccc+ccccccc
             ................
ENDMAP

# start TAG_MAJOR_VERSION == 34

##############################################################################
# <<5>> Tomb save compat vaults.
##############################################################################

# Save compat vaults for games started before stone stairs were changed to
# hatches. These do need to be kept in working order for old games to transfer
# smoothly. The only difference between these vaults and the original versions
# is that they must place all three stone upstairs/downstairs (only upstairs
# for Tomb:3)
NAME:     tomb_2_stone_stairs
DEPTH:    Tomb:2
ORIENT:   encompass
TAGS:     tomb_stone_stairs unrand no_dump no_trap_gen
SUBVAULT: B : tomb_2_ambush_stone_stairs
MONS:     mummy
: tomb_guardian_set(_G)
: tomb_mummy_priest_set(_G)
# Tomb:1 Hall entry stairs
NSUBST:   A = [ / '
# Tomb:2 Room features
SHUFFLE:  Ww/Yy/Zz, Uu/Vv, Qq/Rr/Ss
SUBST:    W=', w=c, Y=T, y=+, Z=T, z=+
SUBST:    U=', u=c, V=T, v=+
SUBST:    Q=', q=c, R=T, r=+, S=T, s=+
# Tomb:3 entry stairs
SHUFFLE:  ])}def
SUBST:    d=", e=", f="
# Add traps near doors and both traps and monsters throughout both groups of
# rooms.
SUBST:    T = ^..., ' = ^ ':210, ' = 1:5 2:5 3:1 .:89
SUBST:    " = ^ ":130, " = 2:3 3:1 .:96
KFEAT:    ^ = alarm trap / net trap / zot trap w:5 / dispersal trap w:5
: set_border_fill_type("permarock_wall")
#
MAP
ccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc
cc""""c""""""c"""""{""""c""""""""c"""""""cc
cc""""c"""""TcT""""""""TcT""""""TcT""""""cc
cc""""c"""2"T+T""""""""T+T""2"""T+T""""""cc
cc"""TcT""""TcT""""""""TcT""""""TcT""""""cc
cc""TT+T"""""c""""""""""c""""""""c"""""""cc
ccccc+ccccccccccccccccccccccccccccccc""""cc
cc""TTcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc"3""cc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc""""cc
cc""3"cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc"""fcc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc""""cc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc)""}cc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBccccccc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cce"""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBcT'''cc
cc""""cBBBBBBBBBBBBBBBBBBBBBBBBBBBBB+T'''cc
cc]""dcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBcT'''cc
cccccccBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cc''''cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc'QQQcc
cc'''TcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBcccqccc
cc'''T+BBBBBBBBBBBBBBBBBBBBBBBBBBBBBc'QQQcc
cc'''TcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cc'ZZZcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cccczccBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cc'ZZZcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
ccA'''cBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
cc'YYYcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBc''''cc
ccccyccBBBBBBBBBBBBBBBBBBBBBBBBBBBBBcRRRAcc
cc'YYYcBBBBBBBBBBBBBBBBBBBBBBBBBBBBBccrcccc
cc''''ccccc+ccccccccccccccc+cccccccccRRR'cc
cc''''''c'TTTc''''''''''''cTT''''''c'''''cc
cc'''''WcW''UcU''''''''''VcV''''''ScS''''cc
cc'''''WwW''UuU''''''''''VvV''''''SsS''''cc
cc'''''WcW''UcU''''''''''VcV''''''ScS''''cc
ccA'''''c''''cA'''''''''''c''''''''c''''Acc
ccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc
ENDMAP

NAME: tomb_2_ambush_old_stone_stairs
TAGS: tomb_2_ambush_stone_stairs unrand
MONS: mummy / skeletal warrior w:2
: tomb_guardian_set(_G)
: tomb_mummy_priest_set(_G)
MAP
.............................
.............................
..xxx4.................4xxx..
..xxx...................xxx..
..xxx.........1.........xxx..
..xxx.....2.......2.....xxx..
.............................
.............................
........x...........x........
.............................
.....3........(........3.....
.............................
........x...........x........
.............................
.............................
..xxx.....2.......2.....xxx..
..xxx.........1.........xxx..
..xxx...................xxx..
..xxx4.................4xxx..
.............................
.............................
.............................
ENDMAP

NAME:     tomb_3_stone_stairs
DEPTH:    Tomb:3
ORIENT:   encompass
TAGS:     tomb_stone_stairs unrand no_rotate no_dump no_trap_gen
SUBVAULT: A : tomb_3_rune_stone_stairs
ITEM:     figurine of a ziggurat no_pickup
KITEM:    | = | no_pickup
KITEM:    $ = $ no_pickup
KITEM:    * = * no_pickup
: tomb_guardian_set(_G)
# Randomize some loot placement in the treasure rooms, and add the zig fig in
# the loot pile. Add traps to treasure rooms and the arrival area.
SUBST:    ' = $., $ = |:1 *:2 $:17, . = ^ .:240, " = .
NSUBST:   | = 1:d / *:|
: tomb_trap_set(_G)
: set_border_fill_type("permarock_wall")
MAP
ccccccccccccccccccccccccccccccccccccccccccc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc
cccccccc....ccAAAAAAAAAAAAAAAAcc....ccccccc
cccccc.......cc11111111111111cc.....'$ccccc
cccc..........cc............cc.......'$cccc
cccc'..........cc..........cc........'$cccc
ccc$''..........cc........cc.........'$$ccc
ccc$$$'..........cc111111cc........''$$$ccc
ccc|$$$''.........c......c.......''$$$$$ccc
ccc||$$$$'........c......c......'$$$$$$$ccc
ccc|||||$$'.......c......c.....'$$$$$$$$ccc
cccc|||||$'.......c......c....'$$$$$$$$cccc
ccccc||||$$'......c......c....'$$$$$$$ccccc
cccccc||||$'......c......c....'$$$$$$cccccc
ccccccc|||$$'.....c."""".c...'$$$$$$ccccccc
cccccccc|||$'....cc."{"".cc..'$$$$$cccccccc
ccccccccc||$'....cc.""(".cc.'$$$$$ccccccccc
cccccccccc|$'..cccc."["".cccc$$$$cccccccccc
ccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc
ENDMAP

NAME:  tomb_3_rune_stone_stairs
TAGS:  tomb_3_rune_stone_stairs unrand
: tomb_guardian_set(_G)
: tomb_mummy_priest_set(_G)
KMASK: O = no_item_gen
KITEM: O = golden rune of Zot
KITEM: R = sanguine gem
KMONS: K = Khufu w:3 / royal mummy, royal mummy
MAP
ccccccccccccccccccccccccccccccccccccccccc
cccccc.............................cccccc
ccc...............cccccc..............ccc
cc...............cccccccc..............cc
cc.......3......ccccKOcccc......3......cc
cc............cccc..R...cccc...........cc
c............cccc........cccc...........c
c............cccc........cccc...........c
c...........cccc..333333..cccc..........c
c.......................................c
c.......................................c
c.................111111................c
cc................112211...............cc
cc...2............112211............2..cc
ccc...............111111..............ccc
ccc....1..........................1...ccc
ccccc....1......................1....cccc
ccccccc............................cccccc
cccccccc+ccc..................ccc+ccccccc
             ................
ENDMAP

# end TAG_MAJOR_VERSION
