###############################################################################
# overflow.des: This is the place where vaults containing overflow altars go.
#
# Altar vaults do not just provide flavour. They are crucial for ensuring
# that granted gods without altars in the Temple will be present in the
# early part of the dungeon. Such altars are called "overflow temples".
# Sometimes, ordinary altar maps featuring a single C glyph (random altar)
# are used. However, there are also vaults dedicated to a special god.
# These look much more interesting, of course.
#
# There are two TAGs to be used for single-altar maps with a specified god:
#
# TAG: temple_overflow_1 temple_overflow_FOO
#      Says the map will only ever be used for overflow temples to god FOO.
#      (The 1 indicates there's only one god placed by this vault.)
# TAG: uniq_altar_FOO
#      If you also add this, then the map can be placed randomly. Random
#      placement will only occur after the deepest possible overflow depth.
#
# And there is a TAG if you want a single-altar map to a random god:
#
# TAG: temple_overflow_generic_1
#      Allows any of the overflow temple altars to be used.
#      For this, use one B glyph in your map.
#
# The level builder treats these tags specially, and vaults with
# a temple_overflow_FOO tag but without uniq_altar_FOO will not place as mini
# vaults. Generic overflow temples should not receive uniq_altar_ tags.
#
# Technical requirements for tags and depth directives for uniq_altar_*
# mini vaults
# - Add an interest_check(_G) if the vault is purely decorative to
#   automatically apply an extra tag as needed.
#
# If you want to check overflow temple placement in wizard mode, use the &:
# command. The levels overflow temples are placed on, and which gods are
# in them, are chosen at new-game time.
#
###############################################################################

{{
function interest_check(e)
  if not you.in_branch("D") or you.depth() > 10 then
    e.tags('extra')
  end
end

function get_overflow_altar_count(e)
  local params = dgn.map_parameters()
  if params ~= nil then
    local tag = unpack(params)
    if tag ~= nil then
      -- temple_overflow_generic_ is 24 characters
      local result = string.sub(tag, 25)
      if result ~= "" then return result end
    end
  end

  return nil
end

function callback.vampire_church_blood(data, triggerable, triggerer, marker, ev)
  local slaves = dgn.find_marker_positions_by_prop("slave_name", "vampire_church_blood")
  crawl.god_speaks("Kikubaaqudgha", "As you approach the altar, the fountains"
                                 .. " begin to flow with blood!")
  for i, slave in ipairs(slaves) do
    dgn.terrain_changed(slave.x, slave.y, "fountain_blood", false)
  end
end

function callback.hep_ancestral_shrine_los(data, triggerable, triggerer, marker, ev)
  if not dgn.persist.hep_ancestral_shrine_reborn and you.god() == "Hepliaklqana" then
    local trees = dgn.find_marker_positions_by_prop("dead_tree", 1)
    for i, slave in ipairs(trees) do
      dgn.tile_feat_changed(slave.x, slave.y, "DNGN_TREE")
    end
    dgn.reset_feature_name_for(trees[1].x, trees[1].y, "tree")
    local slime = dgn.find_marker_positions_by_prop("green_water", 1)
    for i, slave in ipairs(slime) do
      dgn.colour_at(slave.x, slave.y, "blue")
    end
    crawl.god_speaks("Hepliaklqana", "Let the past return from memory!")
    dgn.persist.hep_ancestral_shrine_reborn = true
  end
end

function callback.xom_greatest_gift(data, triggerable, triggerer, marker, ev)
  if not dgn.persist.xom_gg_heard and you.god() == "Xom" then
    dgn.persist.xom_gg_heard = true
    dgn.persist.xom_gg_granted = true
  elseif not dgn.persist.xom_gg_heard and you.god() ~= "Xom" then
    crawl.god_speaks("Xom", '"WORSHIP ME, MORTAL," Xom booms, "AND I SHALL'
                            .. ' GRANT YOU THE GREATEST GIFT OF ALL."')
    dgn.persist.xom_gg_heard = true
  elseif not dgn.persist.xom_gg_granted and you.god() == "Xom" then
    local pos = dgn.find_marker_positions_by_prop("gift", "altar")
    dgn.create_monster(pos[1].x, pos[1].y, "generate_awake att:good_neutral goblin")
    crawl.god_speaks("Xom", 'A goblin pops into existence! It looks at you'
                     .. ' with admiration.')
    crawl.god_speaks("Xom", '"Friendship. The greatest gift is friendship!"')

    dgn.persist.xom_gg_granted = true
  end
end

function callback.five_deadly_venoms(data, triggerable, triggerer, marker, ev)
  crawl.god_speaks("Wu Jian", "For a moment, you catch a glimpse of warriors who walked this path long ago.")
  local positions = dgn.find_marker_positions_by_prop(
    "positions", "five_deadly_venoms")
  for i, pos in ipairs(positions) do
    local x, y = pos:xy()
    dgn.create_monster(x, y, "generate_awake dur:1 " .. data.venoms[i])
  end
end

function species_mock(e)
  if you.race() == "Barachi" then
    return "cane toad"
  elseif you.race() == "Demigod" then
    return "titan simulacrum"
  elseif you.race() == "Demonspawn" then
    return "hell beast"
  elseif you.race() == "Djinni" then
    return "crimson imp"
  elseif you.race():find("Draconian") then
    return "wyvern"
  elseif you.race() == "Deep Dwarf" then
    return "deep dwarf zombie"
  elseif you.race() == "Deep Elf" then
    return "will-o-the-wisp"
  elseif you.race() == "Gnoll" then
    return "jackal"
  elseif you.race() == "Hill Orc" then
    return "goblin ; mundane hand axe . mundane ring mail"
  elseif you.race() == "Human" then
    return "killer klown"
  elseif you.race() == "Felid" then
    return "sphinx zombie"
  elseif you.race() == "Formicid" then
    return "giant cockroach"
  elseif you.race() == "Gargoyle" then
    return "earth elemental"
  elseif you.race() == "Ghoul" then
    return "necrophage"
  elseif you.race() == "Kobold" then
    return "boggart"
  elseif you.race() == "Merfolk" then
    return "bullfrog"
  elseif you.race() == "Minotaur" then
    return "yak"
  elseif you.race() == "Mummy" then
    return "human zombie"
  elseif you.race() == "Naga" then
    return "torpor snail"
  elseif you.race() == "Octopode" then
    return "tentacled monstrosity"
  elseif you.race() == "Ogre" then
    return "ettin skeleton"
  elseif you.race() == "Palentonga" then
    return "rat"
  elseif you.race() == "Spriggan" then
    return "unseen horror"
  elseif you.race() == "Tengu" then
    return "caustic shrike"
  elseif you.race() == "Troll" then
    return "ugly thing"
  elseif you.race() == "Vampire" then
    return "tyrant leech"
  elseif you.race() == "Vine Stalker" then
    return "thorn hunter"
  else
    return "spectral ugly thing"
  end
end

function callback.do_species_mock(data, triggerable, triggerer, marker, ev)
  if data.seen then return else data.seen = true end
  local positions = dgn.find_marker_positions_by_prop("mock_location", 1)
  for i, pos in ipairs(positions) do
    local x, y = pos:xy()
    dgn.create_monster(x, y, "generate_awake " .. species_mock())
  end
end
}}

default-depth: D:3-, Depths

# These must feature one of the temple_overflow_* TAGs (see header).
# Altars are sorted alphabetically by god, with the Shining One coming
# after Zin. At the end, there are altar vaults which can be used for
# more than just one god.

### Ashenzari overflow altars #################################################

NAME:   ashenzari_altar_1
TAGS:   uniq_altar_ashenzari temple_overflow_1 temple_overflow_ashenzari
TAGS:   transparent decor
KFEAT:  _ = altar_ashenzari
: interest_check(_G)
MAP
b@b
@_@
b@b
ENDMAP

# A ruined temple
NAME:   evilmike_ruin_ashenzari
TAGS:   uniq_altar_ashenzari temple_overflow_1 temple_overflow_ashenzari
TAGS:   transparent decor
SUBST:  x = xxxxx-, - = ----.
TILE:   x = WALL_BRICK_VINES
FTILE:  -V_ = FLOOR_SANDSTONE
KFEAT:  _ = altar_ashenzari
SUBST:  - = .
: interest_check(_G)
MAP
      .......
      .xx+xx.
     ..x---x..
   ....x---x....
   .xxxx---xxxx.
  ..xV-xx+xx-Vx..
....x---------x....
.xxxxx-------xxxxx.
.x---x-------x---x.
.x---+---_---+---x.
.x---x-------x---x.
.xxxxx-------xxxxx.
....x---------x....
  ..xV-xx+xx-Vx..
   .xxxx---xxxx.
   ....x---x....
     ..x---x..
      .xxxxx.
      .......
ENDMAP

NAME:   ashenzari_conservatory_becter
TAGS:   temple_overflow_1 temple_overflow_ashenzari transparent decor
TAGS:   uniq_altar_ashenzari
KFEAT:  _ = altar_ashenzari
: interest_check(_G)
MAP
   .....
 .........
 .........
....mmm....
....m_m....
....c+c....
xxxxx.xxxxx
     @
ENDMAP

NAME:  cheibrodos_ashenzari_chains
TAGS:  temple_overflow_1
TAGS:  temple_overflow_ashenzari uniq_altar_ashenzari transparent decor
TAGS:  uniq_altar_ashenzari
KFEAT: _ = altar_ashenzari
KFEAT: m = iron_grate
: interest_check(_G)
MAP
.............
.mmm.....mmm.
.mcmmc_cmmcm.
.mmm.....mmm.
.............
ENDMAP

NAME: nicolae_ashenzari_panopticon
TAGS: uniq_altar_ashenzari temple_overflow_1 temple_overflow_ashenzari \
      transparent decor
SHUFFLE: ABCDEF/abcdef
SUBST: ACEbdf = x, Ba = m, Dc = ., Fe = @
NSUBST: m = + / m
KFEAT: _ = altar_ashenzari
: interest_check(_G)
MAP
E....F..E..F...CE
CC...D..C..D..CC.
.CC..DD.C.DD.CC..
..CC..D.C.D.CC...
...CC.DDCDDCC....
FDD.CC.DCDCC..DDF
..DDDCABABA.DDD..
....DDB...BDD....
ECCCCCA._.ACCCCCE
....DDB...BDD....
..DDD.ABABACDDD..
FDD..CCDCD.CC.DDF
....CCDDCDD.CC...
...CC.D.C.D..CC..
..CC.DD.C.DD..CC.
.CC..D..C..D...CC
EC...F..E..F....E
ENDMAP

NAME:   nicolae_ashenzari_skybound
TAGS:   temple_overflow_ashenzari temple_overflow_1 decor
TAGS:   transparent uniq_altar_ashenzari
KFEAT:  _ = altar_ashenzari
COLOUR: m = blue
: interest_check(_G)
MAP
    ..@..
   .......
 ...mmmmm...
..mmm...mmm..
.mm.v._.v.mm.
.m..v...v..m.
mm..vv+vv..mm
m...........m
m    .@.    m
ENDMAP

### Cheibriados overflow altars ###############################################

NAME:  cheibriados_altar_1
TAGS:  uniq_altar_cheibriados temple_overflow_1 temple_overflow_cheibriados
TAGS:  transparent decor
KFEAT: _ = altar_cheibriados
: interest_check(_G)
MAP
...
._.
...
ENDMAP

NAME:   cheibriados_altar_2
TAGS:   uniq_altar_cheibriados temple_overflow_1 temple_overflow_cheibriados
TAGS:   transparent decor
WEIGHT: 1
KPROP:  1 = no_tele_into
KFEAT:  _ = altar_cheibriados
MONS:   torpor snail
SUBST:  1 : 1:50 2:30 3:10 4:10
NSUBST: 4 = 1:1 / 1:2 / 1:3
KMASK: 1234 = opaque
: interest_check(_G)
MAP
.......
.mmm...
.m1m...
.mmmmm.
.._m1m.
.mmmmm.
.m1m...
.mmm...
.......
ENDMAP

NAME:  slow_altar_1
TAGS:  patrolling no_monster_gen no_item_gen transparent
TAGS:  uniq_altar_cheibriados temple_overflow_1 temple_overflow_cheibriados
KMONS: _ = worm / mummy / iron imp
KFEAT: _ = altar_cheibriados
SUBST: x : xxxcccmnvb
: interest_check(_G)
MAP
xxx..@..xxx
xxx.....xxx
xxx.....xxx
...........
...........
@...._....@
...........
...........
xxx.....xxx
xxx.....xxx
xxx..@..xxx
ENDMAP

NAME:    slow_altar_2
TAGS:    patrolling no_monster_gen no_item_gen
TAGS:    uniq_altar_cheibriados temple_overflow_1 temple_overflow_cheibriados
KMONS:   _ = worm / mummy / iron imp
KFEAT:   _ = altar_cheibriados
SUBST:   x : xxxcccvb
: interest_check(_G)
MAP
x@@G@@x
x.....x
x.....x
xx+++xx
x.....x
x.....x
x.....x
x.....x
x.._..x
xxxxxxx
ENDMAP

NAME:   chei_slow_surprise
TAGS:   uniq_altar_cheibriados temple_overflow_1
TAGS:   temple_overflow_cheibriados transparent no_monster_gen
TAGS:   transparent
WEIGHT: 5
KMONS:  a = worm / mummy / iron imp
NSUBST: ' = 1:a / *:.
KFEAT:  _ = altar_cheibriados
: interest_check(_G)
MAP
 ........
..xxxxxx..
.xx''''xx.
.x'xxxx'x.
.x'm.<x'x.
.xx+._x'x.
..xxxxx'x.
.x.....xx.
.xxxxxxx..
.........
ENDMAP

NAME:   cheibrodos_worm_habitat
TAGS:   no_item_gen no_monster_gen temple_overflow_1 transparent
TAGS:   temple_overflow_cheibriados uniq_altar_cheibriados
WEIGHT: 5
KFEAT:  _ = altar_cheibriados
MONS:   worm
: interest_check(_G)
MAP
.............
.xxxxx.xxxxx.
.xTWWxxxWWTx.
.xWWWWWWWWWx.
.xWWWxWxWWWx.
.xxWxx.xxWxx.
..xWm._.mWx..
.xxWxx1xxWxx.
.xWWWxmxWWWx.
.xWWWWWWWWWx.
.xTWWx+xWWTx.
.xxxxx.xxxxx.
......@......
ENDMAP

NAME:   kennysheep_slug_shrine
TAGS:   uniq_altar_cheibriados temple_overflow_1 temple_overflow_cheibriados
TAGS:   no_pool_fixup no_monster_gen transparent
MONS:   patrolling dart slug
KMASK:  1 = opaque
KFEAT:  _ = altar_cheibriados
: interest_check(_G)
MAP
  .WWW
 .WwwwWbb
@.Ww1WW_b
 .WwwwWbb
  .WWW
ENDMAP

### Dithmenos overflow altars ################################################

NAME:   grunt_dithmenos_smoke
TAGS:   uniq_altar_dithmenos temple_overflow_1 temple_overflow_dithmenos
TAGS:   transparent decor
KFEAT:  C = altar_dithmenos
MARKER: C = lua:fog_machine { cloud_type = "black smoke", \
                              pow_min = 10, pow_max = 20, \
                              delay = 100, size = 1, walk_dist = 1 }
: interest_check(_G)
MAP
...
.C.
...
ENDMAP

# Reflect upon the darkness, mortal.
NAME:   grunt_dithmenos_smoke_and_mirrors
TAGS:   uniq_altar_dithmenos temple_overflow_1 temple_overflow_dithmenos
TAGS:   transparent decor
KFEAT:  C = altar_dithmenos
KFEAT:  O = .
MARKER: O = lua:fog_machine { cloud_type = "black smoke", \
                              pow_min = 25, pow_max = 25, \
                              delay = 30, size = 1, walk_dist = 0 }
: interest_check(_G)
MAP
  b@b
 b.O.b
b.b.b.b
@O.C.O@
b.b.b.b
 b.O.b
  b@b
ENDMAP

NAME:  grunt_dithmenos_shadows
TAGS:  uniq_altar_dithmenos temple_overflow_1 temple_overflow_dithmenos decor
DEPTH: D:5-
KFEAT: C = altar_dithmenos
{{
  if you.absdepth() >= 9 then
     mons("shadow")
  else
     local imp_weight = 9 - you.depth()
     if imp_weight > 0 then
         local phantom_weight = 9 - imp_weight
         mons("phantom w:" .. phantom_weight ..
              " / shadow imp w:" .. imp_weight)
     else
         mons("shadow imp")
     end
  end
}}
: interest_check(_G)
MAP
ccccc
c.C.c
c.1.c
c...c
cc+cc
ENDMAP

NAME: nicolae_dithmenos_the_darkroom
TAGS: temple_overflow_dithmenos temple_overflow_1 uniq_altar_dithmenos
TAGS: decor transparent
KFEAT: _ = altar_dithmenos
MARKER: ' = lua:fog_machine { cloud_type = "black smoke", pow_min = 30, \
   pow_max = 50, delay_min = 50, delay_max = 90, size = 1, walk_dist = 1, \
   spread_rate = 10 }
: interest_check(_G)
MAP
xxxx@@@xxxx
xxx.....xxx
xx'.....'xx
x.........x
@.........@
@...._....@
@.........@
x.........x
xx'.....'xx
xxx.....xxx
xxxx@@@xxxx
ENDMAP

NAME: nicolae_dithmenos_shadow_blocks
TAGS: temple_overflow_dithmenos temple_overflow_1 uniq_altar_dithmenos
TAGS: decor transparent
COLOUR: s' = magenta, c = white
TILE: c = dngn_stone_wall_white
TILE: s = dngn_stone_dark
FTILE: 's_ = floor_pebble_darkgray
KFEAT: cs = stone_wall
KFEAT: _ = altar_dithmenos
: interest_check(_G)
MAP
      .....
      ..c..
  .....ccc.....
  .cc..scs..cc.
  .ccs''s''scc.
  ..ss'''''ss..
....'''''''''....
..cs'''''''''sc..
.cccs'''_'''sccc.
..cs'''''''''sc..
....'''''''''....
  ..ss'''''ss..
  .ccs''s''scc.
  .cc..scs..cc.
  .....ccc.....
      ..c..
      .....
ENDMAP

NAME: nicolae_dithmenos_through_a_glass_darkly
TAGS: temple_overflow_dithmenos uniq_altar_dithmenos temple_overflow_1
TAGS: decor transparent
COLOUR: x = magenta, m = lightmagenta
TILE: m = dngn_transparent_wall_darkgray
TILE: x = wall_brick_darkgray
KFEAT: _ = altar_dithmenos
: interest_check(_G)
MAP
  ..xxx
 .....xx
...mm..xx
..mm....x
@.m._...x
..mm....x
...mm..xx
 .....xx
  ..xxx
ENDMAP

### Elyvilon overflow altars ##################################################

NAME:   elyvilon_altar_1
TAGS:   uniq_altar_elyvilon temple_overflow_1 temple_overflow_elyvilon
TAGS:   transparent decor
KFEAT:  C = altar_elyvilon
SUBST:  X : T G t 1 2 3
MONS:   plant, bush, fungus
KMASK:  T = no_monster_gen
: interest_check(_G)
MAP
      xx@xx
      x...x
      x.X.x
      x...x
      xx.xx
       x.x
xxxxx xx.xx xxxxx
x...xxx...xxx...x
@.X.....C.....X.@
x...xxx...xxx...x
xxxxx xx.xx xxxxx
       x.x
      xx.xx
      x...x
      x.X.x
      x...x
      xx@xx
ENDMAP

NAME:   elyvilon_altar_3
TAGS:   uniq_altar_elyvilon temple_overflow_1 temple_overflow_elyvilon
TAGS:   no_pool_fixup decor transparent
KFEAT:  C = altar_elyvilon
KMASK:  wW = no_monster_gen
: interest_check(_G)
MAP
       xxxxxxxxxxxxxxx
      xxtttttttttttttxx
      xtttttttttttttttx
      tttttttt.tttttttt
  .....ttttt.....ttttt.....
 .......ttt.......ttt.......
...wWw...t...wWw...t...wWw...
..wwWww.....wwWww.....wwWww..
@.WWtWW.....WWCWW.....WWtWW.@
..wwWww.....wwWww.....wwWww..
...wWw...t...wWw...t...wWw...
 .......ttt.......ttt.......
  .....ttttt.....ttttt.....
      tttttttt.tttttttt
      xtttttttttttttttx
      xxtttttttttttttxx
       xxxxxxxxxxxxxxx
ENDMAP

NAME:   elyvilon_altar_4
TAGS:   uniq_altar_elyvilon temple_overflow_1 temple_overflow_elyvilon
TAGS:   no_monster_gen transparent decor
KFEAT:  C = altar_elyvilon
MONS:   patrolling quokka att:good_neutral
: interest_check(_G)
MAP
xxx.@.xxx
xWW...WWx
xW..t..Wx
....1....
@.t.C.t.@
.........
xW..t..Wx
xWW...WWx
xxx.@.xxx
ENDMAP

NAME:   elyvilon_altar_5
TAGS:   uniq_altar_elyvilon temple_overflow_1 temple_overflow_elyvilon decor transparent
KFEAT:  C = altar_elyvilon
KMASK:  T = no_monster_gen
: interest_check(_G)
MAP
.............
.c.c.c.c.c.c.
.............
...T.....T...
@.....C.....@
...T.....T...
.............
.c.c.c.c.c.c.
.............
ENDMAP

NAME:  nicolae_elyvilon_peaceful_grove
TAGS:  temple_overflow_elyvilon temple_overflow_1 transparent decor
TAGS:  uniq_altar_elyvilon
KFEAT: _ = altar_elyvilon
KMONS: P = bush w:20 / nothing
KMONS: _ = patrolling butterfly att:good_neutral
: interest_check(_G)
MAP
ww.PtttP.ww
wwP..P..Pww
.PPtt.ttPP.
P.ttP.Ptt.P
t.tP...Pt.t
tP..._...Pt
t.tP...Pt.t
P.ttP.Ptt.P
.PPtt.ttPP.
wwP..P..Pww
ww.PtttP.ww
ENDMAP

NAME:  nicolae_elyvilon_temple_path
TAGS:  temple_overflow_elyvilon temple_overflow_1 decor no_pool_fixup
TAGS:  no_trap_gen uniq_altar_elyvilon
SUBST: p = ppp....
KMONS: p = plant
KFEAT: _ = altar_elyvilon
: interest_check(_G)
MAP
  ccccc
 ccwwwcc @ppppppppp
ccwwUwwccppcppcppcp
cww...wwwwwwwwwwwww
cwU._..............@
cww...wwwwwwwwwwwww
ccwwUwwccppcppcppcp
 ccwwwcc @ppppppppp
  ccccc
ENDMAP

### Fedhas overflow altars ####################################################

NAME:   fedhas_altar_1
TAGS:   uniq_altar_fedhas temple_overflow_1 temple_overflow_fedhas
TAGS:   transparent decor
KFEAT:  C = altar_fedhas
MONS:   plant
: interest_check(_G)
MAP
.....
.1.1.
..C..
.1.1.
.....
ENDMAP

NAME:   fedhas_altar_2
TAGS:   uniq_altar_fedhas temple_overflow_1 temple_overflow_fedhas
TAGS:   transparent decor
KFEAT:  C = altar_fedhas
NSUBST: w = 2:W / *:w
SUBST:  . = ..wW
SUBST:  w = wwwP
: interest_check(_G)
MAP
.....
.www.
.wCw.
.www.
.....
ENDMAP

NAME:   fedhas_altar_3
TAGS:   uniq_altar_fedhas temple_overflow_1 temple_overflow_fedhas
TAGS:   transparent decor
KFEAT:  C = altar_fedhas
NSUBST: b = 1:. / *:1
MONS:   plant w:5 / fungus / nothing w:3
: interest_check(_G)
MAP
@111@
1b1b1
11C11
1b1b1
@111@
ENDMAP

NAME:   fedhas_altar_4
TAGS:   uniq_altar_fedhas temple_overflow_1 temple_overflow_fedhas
TAGS:   decor
KFEAT:  C = altar_fedhas
FTILE:  . = floor_moss
FTILE:  t = floor_moss
: interest_check(_G)
MAP
xxxxxxxxxxxxxxx
xxxtttttttxxxxx
xxtttttttttxxxx
xtttt.ttttttxxx
xtttt.C.ttttttt
xxtttt...ttttt.
xxtttttt......@
xxxxttttttttt..
xxxxxxttttttttx
xxxxxxxtttttttx
xxxxxxxxxxxxxxx
ENDMAP

# The oklob plant may be abusable (if so, remove it).
NAME:    tgw_fedhas
TAGS:    no_item_gen no_monster_gen
TAGS:    temple_overflow_1 temple_overflow_fedhas uniq_altar_fedhas
DEPTH:   D, Lair
KFEAT:   _ = altar_fedhas
KPROP:   xzd3P = no_tele_into
MONS:    plant, fungus, oklob plant, bush, toadstool
KFEAT:   d = floor
SUBST:   x = TTPPPPP.
# Only make "oklob behind bushes" situation possible a bit deeper.
: if you.absdepth() > 5 then
SHUFFLE: PQR
SUBST:   Q = 114, R = 11124
: end
SUBST:   P = 112
SUBST:   z = .
SHUFFLE: ...", TU
SUBST:   T = xt, U = xx
SUBST:   " = .....5
COLOUR:  . = green / none
COLOUR:  ' = green
: interest_check(_G)
MAP
ccccccccccccccccccccccc
cxxxxxxxxxxxxxxxxxxxxxc
cxxxxxxxxxxxxxxPxxd3xxc
cxxxxxxxxxxxxxxPddddxxc
cxxxxxxxxxxxxxxPPPxzdxc
cxxxxxxx.......xxPPxxxc
cxxxxxx..ww.ww..xxPPxxc
cxxxxx..www.www..xxxPxc
cxxxx..wwww.wwww..xxxxc
cxxxx.wwwww.wwwww.xxxxc
cxxxx.wwww'''wwww.xxxxc
cxxxx.wwww'_'wwww.xxxxc
cxxxx.wwww'''wwww.xxxxc
cxxxx.wwwwwwwwwww.xxxxc
cxxxx..wwwwwwwww..xxxxc
cxxxxx..wwwwwww..xxxxxc
cxxxxxx..wwwww..xxxxxxc
cxxxxxxx.......xxxxxxxc
cxxxxxxxxxc.cxxxxxxxxxc
cxxxxxxxxxc.cxxxxxxxxxc
ccccccccccc@ccccccccccc
ENDMAP

NAME:  fedhas_ov_isle_minmay
TAGS:  temple_overflow_1 temple_overflow_fedhas uniq_altar_fedhas no_monster_gen
TAGS:  transparent
DEPTH: D, !D:$
MONS:  plant / bush w:5
SUBST: 1 = 111t'''
KFEAT: _ = altar_fedhas
KMASK: _1'<> = opaque
: interest_check(_G)
MAP
     .....
   ...www...
  ..wwwwwww..
 ..wwwwwwwww..
 .wwwwwwwwwww.
..wwww1<1wwww..
.wwww11111wwww.
.wwww11_11wwww.
.wwww11111wwww.
..wwww1>1wwww..
 .wwwwwwwwwww.
 ..wwwwwwwww..
  ..wwwwwww..
   ...www...
     .....
ENDMAP

NAME:   fedhas_altar_fruit_tree
TAGS:   uniq_altar_fedhas temple_overflow_1 temple_overflow_fedhas
TAGS:   no_item_gen no_rotate no_vmirror decor
NSUBST: g = 4:f/*:.
NSUBST: f = 4:A/*:.
NSUBST: w = 2:4 / *:w
KFEAT:  C = altar_fedhas
KFEAT:  A = .
FTILE:  .tfCA = floor_moss
FTILE:  d = floor_hall
COLOUR: fd = brown
COLOUR: AC. = green
: interest_check(_G)
MAP
xxxxxxxxxxxxxxxxx
xtttttttttttttttx
xtttttttttttttttx
xttttttgfgttttttx
xtttttgf.fgtttttx
xttttgf.f.fgttttx
xtttgf..C..fgtttx
xtttgf.f.f.fgtttx
xttgfffffffffgttx
xttgt.......tgttx
xttttttdddttttttx
xttttttdddttttttx
xtttttdd@ddtttttx
ENDMAP

NAME:  fedhas_bush_and_centaur_altar
TAGS:  temple_overflow_1 temple_overflow_fedhas uniq_altar_fedhas transparent
# Centaur depth
DEPTH: D:5-13
KFEAT: _ = altar_fedhas
MONS:  centaur, bush
MAP
    x
 .......
 .2222..
 .21222.
x.22_22.x
 ...22..
 .222...
    x
ENDMAP

NAME:   fedhas_altar_decomposition
TAGS:   uniq_altar_fedhas temple_overflow_1 temple_overflow_fedhas
TAGS:   no_item_gen no_monster_gen no_trap_gen
# Necrophage depth
DEPTH:  D:4-8
MONS:   bush, plant, necrophage, zombie
KFEAT:  _ = altar_fedhas
FTILE:  '!12@ = floor_moss
COLOUR: '!@ = green
NSUBST: 3 = 3:3 / 3 = 3 4:25 / 3 = 4 .:25 / *:.
KPROP:  .3 = no_tele_into
MAP
 xxxxxxxxx
xx33...33xx
x33.222.33x
x332111233x
x3321_1233x
x3321'1233x
x3.2x'x2.3x
x3..x'x..3x
xxxxx'xxxxx
   xx'xx
   x2@2x
ENDMAP

### Gozag overflow altars #####################################################

NAME:   grunt_gozag_statues
TAGS:   transparent no_item_gen no_monster_gen no_trap_gen temple_overflow_1
TAGS:   temple_overflow_gozag uniq_altar_gozag decor
KFEAT:  _ = altar_gozag
TILE:   G = dngn_golden_statue
FTILE:  _-G = floor_limestone
RTILE:  x = wall_sandstone
COLOUR: xG = yellow
: set_feature_name("granite_statue", "golden statue")
: interest_check(_G)
MAP
     @
  xxx-xxx
 xx-----xx
 x-G---G-x
 x-------x
@----_----@
 x-------x
 x-G---G-x
 xx-----xx
  xxx-xxx
     @
ENDMAP

NAME:   grunt_gozag_breadcrumbs
TAGS:   transparent no_item_gen no_monster_gen no_trap_gen temple_overflow_1
TAGS:   temple_overflow_gozag uniq_altar_gozag decor
KFEAT:  _ = altar_gozag
ITEM:   gold q:1
KITEM:  e = gold q:1
TILE:   G = dngn_golden_statue
FTILE:  _-Ge = floor_limestone
RTILE:  x = wall_sandstone
COLOUR: xG = yellow
: set_feature_name("granite_statue", "golden statue")
: interest_check(_G)
MAP
        xxxxx
.@......x-eGx
@d.d.d.d-e-_x
.@......x-eGx
        xxxxx
ENDMAP

NAME:  nicolae_gozag_cash_rules_everything_around_me
TAGS:  temple_overflow_gozag temple_overflow_1 uniq_altar_gozag \
       no_hmirror no_vmirror no_rotate no_item_gen transparent decor
KFEAT: _ = altar_gozag
: interest_check(_G)
MAP
bbb@bbb
b....$b
b.b.bbb
b.._..b
bbb.b.b
b$....b
bbb@bbb
ENDMAP

# No, you probably can't afford any of it.
# You should have thought of that before being poor.
NAME:  nicolae_gozag_zags_fifth_avenue
TAGS:  temple_overflow_gozag temple_overflow_1 uniq_altar_gozag
TAGS:  no_pool_fixup no_item_gen no_monster_gen decor transparent
WEIGHT: 5
FTILE: '_TS = floor_limestone
KFEAT: _ = altar_gozag
KFEAT: S = general shop name:Gozag type:Platinum suffix:Reserve count:4 \
        greed:100 ; any weapon randart | any armour randart | any jewellery randart
: interest_check(_G)
MAP
wwwwwww....
w'''''wwww.
w'T'T''''w.
w''S'''_''@
w'T'T''''w.
w'''''wwww.
wwwwwww....
ENDMAP

NAME:  nicolae_gozag_seed_capital
TAGS:  temple_overflow_gozag temple_overflow_1 uniq_altar_gozag decor
TAGS:  transparent no_item_gen
ITEM:  gold q:1 / gold q:2
KFEAT: _ = altar_gozag
: interest_check(_G)
MAP
ddd
d_d
ddd
ENDMAP

NAME:   nicolae_gozag_conspicuous_consumption
TAGS:   temple_overflow_gozag temple_overflow_1 no_pool_fixup decor
TAGS:   transparent no_trap_gen uniq_altar_gozag
WEIGHT: 1
KPROP:  $ = no_tele_into
KMASK:  $ = opaque
KMASK:  $ = no_monster_gen
KITEM:  $ = gold
KFEAT:  _ = altar_gozag
TILE:   G = dngn_golden_statue
TILE:   n = dngn_transparent_stone_yellow
TILE:   m = dngn_transparent_wall_yellow
FTILE:  ._Gmn$U = floor_limestone
COLOUR: .Gmn$U = yellow
: set_feature_name("granite_statue", "golden statue")
MAP
    .....
 G...._....G
 ...G...G...
 ..UwwwwwU..
..GwnmmmnwG..
...wm$$$mw...
._.wm$$$mw._.
...wm$$$mw...
..GwnmmmnwG..
 ..UwwwwwU..
 ...G...G...
 G...._....G
    .....
ENDMAP

### Hepliaklqana overflow altars #############################################

NAME:   worldfamousw_hep_ancestral_shrine
TAGS:   uniq_altar_hepliaklqana temple_overflow_hepliaklqana temple_overflow_1
TAGS:   no_monster_gen no_item_gen no_pool_fixup
KFEAT:  _ = altar_hepliaklqana
COLOUR: w = green
TILE:   G = dngn_gravestone
COLOUR: t = brown
TILE:   t = DNGN_TREE_DEAD
{{
set_feature_name("granite_statue", "a gravestone")
set_feature_name("tree", "dead tree")
dgn.persist.hep_ancestral_shrine_reborn = false

local los_marker = TriggerableFunction:new {
  func="callback.hep_ancestral_shrine_los",
  repeated=true
}
los_marker:add_triggerer(DgnTriggerer:new {
  type="player_los"})

lua_marker('_', los_marker)
lua_marker("t", portal_desc { dead_tree=1 })
lua_marker("w", portal_desc { green_water=1 })
}}
MAP
 xxxxx
xxwwwxx
xwwwwwx
xwwwwwx
xwtGtwx
xt...tx
x.._..x
xt...tx
xxt.txx
 xx+xx
   @
ENDMAP

NAME:   nzn_hepliaklqana_mist_gate
TAGS:   temple_overflow_1 temple_overflow_hepliaklqana no_monster_gen
TAGS:   transparent decor uniq_altar_hepliaklqana
KFEAT:  _ = altar_hepliaklqana
MARKER: A = lua:fog_machine { cloud_type = "grey smoke", pow_min = 20, \
                              pow_max = 40, delay = 10, size = 1, \
                              spread_rate = -1 }
: interest_check(_G)
MAP
xxxxx
x...x
x._.x
x...x
xx.xx
 xAx
 x.x
  @
ENDMAP

# A long-forgotten ecumenical temple. Only Hepliaklqana clearly remains,
# although a few forgotten altars are still around.
NAME:   nicolae_hepliaklqana_ecumenical_no_more
TAGS:   temple_overflow_hepliaklqana temple_overflow_1 transparent decor
TAGS:   uniq_altar_hepliaklqana
WEIGHT: 5
KMONS:  WD = plant / nothing
NSUBST: E = - / E, H = _ / - / E, E = E / . / EEE-.., P = 4=W / WDD / D
SUBST:  ' = '''., c = ccx
KFEAT:  WS = W
KFEAT:  _ = altar_hepliaklqana
KFEAT:  - = altar_ecumenical
FTILE:  WVD = floor_mud
COLOUR: D = darkgrey
FTILE:  ' = floor_w_marble
COLOUR: ' = white
FTILE:  _-E = floor_limestone
COLOUR: E = yellow
: interest_check(_G)
MAP
xxxxx.@.xxxxx
xxccxx+xxccxx
xccc''.''cccx
xcc''E'E''ccx
xc'''''''''cx
xc'E'PPP'E'cx
xc'''PVP'''cx
xc'H'PPP'H'cx
xc'''''''''cx
xcc''H'H''ccx
xccc'''''cccx
xxcccccccccxx
xxxxxxxxxxxxx
ENDMAP

NAME:   nicolae_hepliaklqana_hazy_memory
TAGS:   temple_overflow_hepliaklqana temple_overflow_1 transparent decor
TAGS:   uniq_altar_hepliaklqana
MONS:   plant
SUBST:  ' = ..', . = ...1
CLEAR:  '
KFEAT:  _ = altar_hepliaklqana
MARKER: _ = lua:fog_machine { cloud_type = "thin mist", size = 1, pow_min = 5, \
  pow_max = 7, delay = 10, start_clouds = 1, walk_dist = 5, spread_rate = 10 }
: interest_check(_G)
MAP
    '''
 ''''.''''
 '.'.'.'.'
 ''.'''.''
''.'...'.''
'.''._.''.'
''.'...'.''
 ''.'''.''
 '.'.'.'.'
 ''''.''''
    '''
ENDMAP

# Or should that be "heppocampus"...?
NAME:  nicolae_hepliaklqana_hippocampus
TAGS:  temple_overflow_hepliaklqana temple_overflow_1 transparent decor
TAGS:  uniq_altar_hepliaklqana
KFEAT: _ = altar_hepliaklqana
SUBST: D = cxx, E = cx
: interest_check(_G)
MAP
    xxxxxxxx
   @....xxxx
    xxx..xxx
xxxxxxxx.xxx
xcccccxx..xx
xc...cxx..xx
xc._.cxD..xx
xc...cxD..Dx
xc..ccxD..Dx
xc...EE...Dx
xc........Dx
xcE......DDx
xxEEEEEDDDxx
xxxxxxxxxxxx
ENDMAP

NAME:    nicolae_hepliaklqana_monster_ancestors
TAGS:    temple_overflow_hepliaklqana temple_overflow_1 transparent
TAGS:    uniq_altar_hepliaklqana
TAGS:    patrolling no_monster_gen no_trap_gen
MONS:    goblin, spectral goblin, kobold, spectral kobold, hobgoblin
MONS:    spectral hobgoblin, orc
KMONS:   D = spectral orc
SHUFFLE: 12 / 34 / 56 / 7D
KFEAT:   _ = altar_hepliaklqana
: interest_check(_G)
MAP
xxxxxxxxx
xxwwwwwxx
x..1....x
+....._.x
x..2....x
xxwwwwwxx
xxxxxxxxx
ENDMAP

NAME:    beargit_hepliaklqana_dungeon_heroes
TAGS:    temple_overflow_hepliaklqana temple_overflow_1
TAGS:    no_monster_gen patrolling no_trap_gen uniq_altar_hepliaklqana
SHUFFLE: 123
SHUFFLE: _-G
: if you.in_branch("D") then
:     if you.depth() < 4 then
KMONS:   1 = orc wizard; quarterstaff . robe
# Early for kobold brigands, but they get a wand of charming instead of darts,
# so less threatening.
KMONS:   2 = jessica; dagger . robe . wand of charming \
             / kobold brigand ; dagger . wand of charming \
             , kobold brigand ; dagger . wand of charming
KMONS:   3 = orc ; flail . kite shield . chain mail
# We generate one ancestor monster for D:3-9
NSUBST:  123 = 2=.
:     elseif you.depth() < 7 then
KMONS:   1 = blork the orc ; quarterstaff good_item . robe \
             / orc wizard ; quarterstaff good_item . robe \
             , orc wizard ; quarterstaff good_item . robe
KMONS:   2 = sigmund; scythe ego:draining . robe \
             / kobold brigand ; dagger ego:draining . wand of charming \
             , kobold brigand ; dagger ego:draining . wand of charming
KMONS:   3 = edmund ; flail good_item . kite shield . chain mail \
             / orc warrior ; flail good_item . kite shield . chain mail \
             / gnoll sergeant ; flail good_item . kite shield . chain mail \
             , orc warrior ; flail good_item . kite shield . chain mail \
             / gnoll sergeant ; flail good_item . kite shield . chain mail
NSUBST:  123 = 2=.
:     elseif you.depth() < 10 then
MONS:    gargoyle ; quarterstaff good_item
MONS:    kobold brigand ; dagger ego:draining good_item . wand of paralysis \
             . dart ego:atropa \
         / spriggan ; dagger ego:draining good_item . robe good_item . buckler \
             . wand of paralysis \
         / vampire ; dagger ego:draining good_item . robe good_item
MONS:    orc warrior ; flail good_item . kite shield . chain mail good_item \
         / gnoll sergeant ; flail good_item . kite shield . chain mail good_item
NSUBST:  123 = 2=.
:     elseif you.depth() < 13 then
MONS:    gargoyle ; quarterstaff good_item \
         / molten gargoyle w:5 ; quarterstaff good_item
MONS:   kobold brigand ; dagger ego:draining good_item . wand of paralysis \
             . dart ego:atropa . potion of haste \
         / spriggan ; dagger ego:draining good_item . robe good_item . buckler \
             . wand of paralysis . potion of haste \
         / vampire ; dagger ego:draining good_item . robe good_item \
             . potion of haste
MONS:    orc warrior ; flail good_item . kite shield . chain mail good_item \
         / gnoll sergeant ; flail good_item . kite shield \
             . chain mail good_item \
         / skeletal warrior ; flail good_item . kite shield \
             . chain mail good_item
# Generate two ancestor monsters for D:10-D:12
NSUBST:  123 = 1=.
# For D:13- and Depths, we generate all three ancestor monsters.
:     else
MONS:    ogre mage; lajatang ego:freezing . potion of haste \
         / molten gargoyle ; lajatang ego:flaming . potion of haste
MONS:    spriggan ; dagger ego:draining good_item . robe good_item \
             . buckler good_item . wand of paralysis . potion of haste \
         / vampire ; dagger ego:draining good_item . robe good_item \
             . buckler . wand of paralysis . potion of haste
MONS:    orc knight; broad axe ego:flaming . chain mail good_item \
             . tower shield ego:reflection . potion of haste \
         / tengu warrior ; broad axe ego:flaming . chain mail good_item \
             . tower shield ego:reflection . potion of haste \
         / naga warrior ; broad axe ego:flaming . chain mail good_item \
             . tower shield ego:reflection . potion of haste \
         / skeletal warrior ; broad axe ego:flaming . chain mail good_item \
             . tower shield ego:reflection . potion of haste
:     end
# Depths
: else
MONS:    tengu reaver ; lajatang ego:freezing good_item \
             | lajatang ego:freezing randart . scale mail . potion of haste \
             . potion of haste \
         / ancient champion ; lajatang ego:freezing good_item \
             | lajatang ego:freezing randart . scale mail
MONS:    vampire knight; quick blade ego:antimagic . buckler good_item \
             . shadow dragon scales good_item . potion of haste \
             . potion of haste \
         / spriggan defender; quick blade ego:antimagic w:20 \
             . robe good_item . buckler good_item . wand of paralysis \
             . potion of haste . potion of haste
MONS:    minotaur ; broad axe ego:speed good_item \
             | broad axe ego:speed randart | arga w:1 . plate armour good_item \
             . tower shield ego:reflection good_item . potion of haste \
             . potion of haste \
         / orc warlord ; broad axe ego:speed good_item \
             | broad axe ego:speed randart | arga w:1 . plate armour good_item \
             . tower shield ego:reflection good_item . potion of haste \
             . potion of haste
: end
KFEAT:   _ = altar_hepliaklqana
KFEAT:   - = altar_ecumenical
MARKER:  ` = lua:fog_machine { cloud_type = "thin mist", \
                              pow_min = 100, pow_max = 200, \
                              delay = 100, size = 2, walk_dist = 1 }
TILE:   G = dngn_gravestone
: interest_check(_G)
MAP
    ccccc
    c...c
    c.-.c
    c.2.c     cc
ccccc...ccccccc.
c.......`..`..`.
c._1..c.........
c.......`..`..`.
ccccc...ccccccc.
    c.3.c     cc
    c.G.c
    c...c
    ccccc
ENDMAP

### Kikubaaqudgha overflow altars #############################################

NAME:   lemuel_zombie_altar_kikubaaqudgha
TAGS:   no_pool_fixup no_monster_gen no_trap_gen
TAGS:   temple_overflow_1 temple_overflow_kikubaaqudgha
TAGS:   uniq_altar_kikubaaqudgha uniq_zombie_altar
KFEAT:  _ = altar_kikubaaqudgha
MONS:   rat zombie / bat zombie / nothing w:90
: interest_check(_G)
MAP
xxxxxxxxxxxxxxxx
xxxxwwwwwwwwxxxx
xxxx11111111xxxx
@............._x
xxxx11111111xxxx
xxxxwwwwwwwwxxxx
xxxxxxxxxxxxxxxx
ENDMAP

NAME:   lemuel_mausoleum_altar_kikubaaqudgha
TAGS:   uniq_altar_kikubaaqudgha temple_overflow_1
TAGS:   temple_overflow_kikubaaqudgha uniq_mausoleum_altar
# slightly ood for wights, but where necrophages start
# zombies scale with depth so we'll let it place in Crypt, too, but with an
# interest check
DEPTH:  D:4-10, Crypt
MONS:   zombie, mummy, wight, necrophage
NSUBST: ? = 1:_ / *:1
SUBST:  1 = 1:30 2 3 4
KFEAT:  _ = altar_kikubaaqudgha
KMONS:  _ = human zombie
: interest_check(_G)
MAP
ccccccccccccccc
c?c?c?c?c?c?ccG
c+c+c+c+c+c+ccc
c............+@
c+c+c+c+c+c+ccc
c?c?c?c?c?c?ccG
ccccccccccccccc
ENDMAP

NAME:   kiku_gazebo_garden_becter
TAGS:   temple_overflow_1 temple_overflow_kikubaaqudgha transparent decor
TAGS:   uniq_altar_kikubaaqudgha
KMONS:  f = withered plant
KFEAT:  _ = altar_kikubaaqudgha
SUBST:  ` = f....
COLOUR: c = magenta
COLOUR: i' = brown
COLOUR: " = yellow
TILE:   c = dngn_stone_wall_magenta
FTILE:  '"_ = floor_pebble_yellow
: interest_check(_G)
MAP
..````
.ccc`````
.c'c"`````
.c''""````
.c'''"c````
.c'_''cc```
.c'''"c````
.c''""````
.c'c"`````
.ccc`````
..````
ENDMAP

NAME:   kiku_gazebo_pond_becter
TAGS:   temple_overflow_1 temple_overflow_kikubaaqudgha transparent decor
TAGS:   uniq_altar_kikubaaqudgha
KFEAT:  _ = altar_kikubaaqudgha
KMASK:  Ww = no_monster_gen
SUBST:  M = W..
COLOUR: c = magenta
COLOUR: i' = brown
COLOUR: " = yellow
COLOUR: w = green
COLOUR: W = lightgreen
TILE:   c = dngn_stone_wall_magenta
FTILE:  '"_ = floor_pebble_yellow
: interest_check(_G)
MAP
..........
.cccccccc.
.c''''cc...
.c'_'""..V.
.c'W""MMM..
.c'"WWWwwM.
.cc".MWwwM.
.cc..MwwwM.
.c...MwwwM.
...V..MMM..
.........
ENDMAP

NAME:   kennysheep_vampire_church
TAGS:   no_monster_gen temple_overflow_1 temple_overflow_kikubaaqudgha
TAGS:   uniq_altar_kikubaaqudgha
MONS:   vampire bat / nothing w:7, bat skeleton / bat zombie
KFEAT:  A = altar_kikubaaqudgha
NSUBST: . = 4:2 / 3 = 2. / *:.
{{
local trig_marker = TriggerableFunction:new {
  func="callback.vampire_church_blood",
  repeated = false
}
trig_marker:add_triggerer(DgnTriggerer:new { type = "player_move" })
lua_marker("A", trig_marker)
lua_marker("V", portal_desc { slave_name = "vampire_church_blood" })
}}
: interest_check(_G)
MAP
  xxxxxxxxx
  xx.V1V.xx
xxx..1A1..xxx
xx.x.VdV.x.xx
x.V.x...x.V.x
xx.x.x.x.x.xx
x.x.V.x.V.x.x
xx.x.x.x.x.xx
x.V.x.V.x.V.x
xx.x.x.x.x.xx
xxx.V.x.V.xxx
xx.x.x.x.x.xx
xx..x.V.x..xx
xx.x.x.x.x.xx
xxx.V.x.V.xxx
xxxx.....xxxx
xxxxx+++xxxxx
ENDMAP

NAME:   nicolae_kikubaaqudgha_miasma_corner
TAGS:   temple_overflow_kikubaaqudgha temple_overflow_1 transparent decor
TAGS:   uniq_altar_kikubaaqudgha
KFEAT:  _ = altar_kikubaaqudgha
MARKER: M = lua:fog_machine { cloud_type = "foul pestilence", pow_min = 10, \
    pow_max = 20, delay_min = 1, delay_max = 1, size = 1, walk_dist = 0, \
    spread_rate = 0 }
COLOUR: c = darkgrey
: interest_check(_G)
MAP
    .
 ccc.ccc
 cM...Mc
 c.....c
...._....
 c.....c
 cM...Mc
 ccc.ccc
    .
ENDMAP

### Makhleb overflow altars ###################################################

NAME:    demons_altar
DEPTH:   D, Orc, !Orc:$
TAGS:    no_monster_gen patrolling temple_overflow_1 temple_overflow_makhleb
TAGS:    transparent layout_rooms layout_city layout_open uniq_altar_makhleb
KFEAT:   _ = altar_makhleb
# Either one type 3 or 4 demon (rust devil or smoke demon) or
# three slow type 5 demons (iron imp).
# The higher demons can only come up in D:9-11.
: if you.absdepth() > 9 then
SHUFFLE: 123
NSUBST:  1 = 1:1 / *:.
NSUBST:  2 = 1:2 / *:.
: end
MONS:    rust devil, smoke demon, iron imp
MAP
xxxxxxxxxxxxxxx
x.............x
x.ll.......ll.x
x.ll..3_3..ll.x
x.ll...3...ll.x
x..ll.....ll..x
x...lll.lll...x
x....llGll....x
x......l......x
x.............x
x.............x
x.............x
x.............x
ENDMAP

NAME:  bloody_makhleb
TAGS:  uniq_altar_makhleb temple_overflow_1 temple_overflow_makhleb
TAGS:  transparent decor
DEPTH: D, Orc
KPROP: . = bloody / nothing
KFEAT: _ = altar_makhleb
KITEM: _ = robe, whip
: interest_check(_G)
MAP
...
._.
...
ENDMAP

NAME:  makhleb_altar_promises_db
TAGS:  uniq_altar_makhleb temple_overflow_1 temple_overflow_makhleb
TAGS:  transparent
KFEAT: _ = altar_makhleb
KPROP: 12 = no_tele_into
KMASK: 12 = no_trap_gen
KMASK: 12 = opaque
MONS:  executioner / balrug / green death / cacodemon / blizzard demon
MONS:  orange demon / ynoxinul / neqoxec / hellwing / smoke demon
: interest_check(_G)
MAP
  ccc
  c1c
cccnccc
c2n_n2c
ccc.ccc
  c.c
  c@c
ENDMAP

NAME:   makhleb_blood_cavern_becter
TAGS:   uniq_altar_makhleb temple_overflow_1 temple_overflow_makhleb
# necrophage depth (contains hound too)
DEPTH:  D:4-8
: if crawl.coinflip() then
: dgn.delayed_decay(_G, '1', 'human corpse')
KMONS:  2 = hound
: else
KMONS:  1 = necrophage
KMONS:  2 = hound skeleton
: end
KFEAT:  _ = altar_makhleb
KPROP:  y' = bloody
TILE:   c = wall_hall
SUBST:  ' = .
SUBST:  y = x
MAP
  @@@
 x..'.xxx
 xx...'yxx
 xxxx..'yxx
 xxxxxx.'yx
 xxxxxxy'.x
xxxx.'y'.xx
xcc.12'.xx
xcA_'.xxx
xcc..xxx
xxxxxx
ENDMAP

NAME:   makhleb_heckhound_becter
TAGS:   uniq_altar_makhleb temple_overflow_1 temple_overflow_makhleb
TAGS:   no_monster_gen
# hound depth
DEPTH:  D:4-7
KFEAT:  _ = altar_makhleb
KMONS:  _ = patrolling hound
TILE:   c = wall_hall
SUBST:  y = xx.
MAP
 xxxxx
xxcccxx
xycAcyx
x.._..x
xy...yx
 y...y
  @@@
ENDMAP

NAME:   makhleb_grotto_becter
TAGS:   no_monster_gen temple_overflow_1 temple_overflow_makhleb
TAGS:   uniq_altar_makhleb
# white imp depth
DEPTH:  D:5-8
MONS:   iron imp w:1 / shadow imp w:1 / crimson imp
KFEAT:  _ = altar_makhleb
TILE:   c = wall_hall
FTILE:  A_'1 = floor_grey_dirt
SUBST:  ' = .
MAP
 xxxxx
xxcccxx
xwcAcwx
xww_wwx
xww1wwx
x.w'w.x
xx...xx
 xx+xx
   @
ENDMAP

NAME:   nzn_makhleb_speed_demon
TAGS:   no_monster_gen temple_overflow_1 temple_overflow_makhleb
TAGS:   uniq_altar_makhleb
DEPTH:  D:7-11
WEIGHT: 2
KFEAT:  _ = altar_makhleb
KMONS:  _ = sixfirhy
MAP
.....
.ccc.
.c_c.
.c=c.
..@..
ENDMAP

### Nemelex overflow altars ###################################################

NAME:  nemelex_xobeh_ov_fountains_minmay
TAGS:  temple_overflow_1 temple_overflow_nemelex_xobeh uniq_altar_nemelex_xobeh
TAGS:  transparent decor
KFEAT: _ = altar_nemelex_xobeh
: interest_check(_G)
MAP
U@U
@_@
U@U
ENDMAP

###################################################################
# Nemelex altar (Shiori)
# Perhaps could have different parameters for the two types of clouds,
# and different patterns.
NAME:   nemelex_altar_shiori
TAGS:   temple_overflow_1 temple_overflow_nemelex_xobeh uniq_altar_nemelex_xobeh
TAGS:   no_pool_fixup no_monster_gen no_item_gen
TAGS:   decor no_rotate
TAGS:   layout_rooms layout_city layout_open
KPROP:  abcdefghBR' = no_tele_into
KFEAT:  _ = altar_nemelex_xobeh
SUBST:  b:aa. , a:n. , d:c. , c:nn. , f:ee. , e:nn. , h:g. , g:n.
SUBST:  G:GTUVblw> , C=c
SUBST:  ':.
MARKER: R = lua:fog_machine { cloud_type="flame", walk_dist=1, size=9, \
            pow_max=20, delay=10, buildup_amnt=14, buildup_time=7, \
            spread_rate=3, start_clouds=1 }
MARKER: B = lua:fog_machine { cloud_type="foul pestilence", walk_dist=1, \
            size=9,  pow_max=20, delay=10, buildup_amnt=14, buildup_time=7, \
            spread_rate=3, start_clouds=1 }
KFEAT:  RB = floor
: interest_check(_G)
MAP
CCCCCCCC+++CCCCCCCC
Cnnnnnnn...nnnnnnnC
Cnab'ban...ncd'dcnC
Cnb'''bn.G.nd'''dnC
Cn''B''n...n''R''nC
Cnb'''bn...nd'''dnC
Cnab'ban...ncd'dcnC
Cnnnnnnn...nnnnnnnC
CG......._.......GC
Cnnnnnnn...nnnnnnnC
Cnef'fen...ngh'hgnC
Cnf'''fn...nh'''hnC
Cn''R''n...n''B''nC
Cnf'''fn.G.nh'''hnC
Cnef'fen...ngh'hgnC
Cnnnnnnn...nnnnnnnC
CCCCCCCC+++CCCCCCCC
ENDMAP

NAME:    nemelex_dance_club_becter
TAGS:    temple_overflow_1 temple_overflow_nemelex_xobeh transparent
TAGS:    no_rotate no_vmirror no_monster_gen no_item_gen
TAGS:    uniq_altar_nemelex_xobeh
# orc and ogre depth
DEPTH:   D:3-7
: if you.depth() <= 4 then
MONS:    orc ; club
: else
MONS:    ogre ; giant club
: end
MONS:    endoplasm
KFEAT:   _ = altar_nemelex_xobeh
SHUFFLE:  12_
COLOUR:  x = darkgray
COLOUR:  12' = random
TILE:    x = wall_pebble_darkgray
MAP
    .....
   ..xxx..
   .xx'xx.
 ...x'1'x...
..xxxx'xxxx..
.xx''x+x''xx.
.x'2'+.+'_'x.
.xx'xx.xx'xx.
..xxx.x.xxx..
 .....x.....
    .xxx.
    .....
ENDMAP

NAME:   nemelex_diamond_rough_becter
TAGS:   temple_overflow_1 temple_overflow_nemelex_xobeh transparent decor
TAGS:   uniq_altar_nemelex_xobeh
KFEAT:  _ = altar_nemelex_xobeh
COLOUR: x = lightred
COLOUR: 'b = silver
TILE:   x = wall_pebble_red
TILE:   b = dngn_crystal_white
: interest_check(_G)
: set_feature_name("crystal_wall", "wall of white crystal")
MAP
    ...
   ..x..
  ..xxx..
 ..xxbxx..
..xxb'bxx..
.xxb'_'bxx.
..xxb'bxx..
 ..x+b+x..
  ..xxx..
   ..x..
    ...
ENDMAP

NAME:   nemelex_lonely_heart_becter
TAGS:   uniq_altar_nemelex_xobeh transparent decor
TAGS:   temple_overflow_1 temple_overflow_nemelex
TAGS:   no_rotate no_vmirror no_monster_gen no_item_gen
MONS:   nothing w:4 / jessica w:1
KFEAT:  _ = altar_nemelex_xobeh
COLOUR: x = lightred
TILE:   x = wall_pebble_red
: interest_check(_G)
MAP
  .... ....
 ..xx...xx..
..xxxx.xxxx..
.xx..x+x..xx.
.xx.......xx.
..xx.._..xx..
 ..xx.1.xx..
  ..xx.xx..
   ..xxx..
    .....
ENDMAP

NAME:   nemelex_spade_bored_becter
TAGS:   temple_overflow_1 temple_overflow_nemelex_xobeh transparent decor
TAGS:   no_rotate no_vmirror no_monster_gen no_item_gen
TAGS:   uniq_altar_nemelex_xobeh
KFEAT:  _ = altar_nemelex_xobeh
:  if you.depth() ~= dgn.br_depth(you.branch()) then
KFEAT:  a = shaft trap
:  end
NSUBST: ' = 6:a / *:.
COLOUR: x = darkgray
TILE:   x = wall_pebble_darkgray
: interest_check(_G)
MAP
     .....
    ..xxx..
   ..xx'xx..
  ..xx'''xx..
 ..xx''_''xx..
..xx'''''''xx..
.xx'''''''''xx.
.x'''xxxxx'''x.
.xx'+x.x.x+'xx.
..xxx..x..xxx..
 .....xxx.....
     .....
ENDMAP

### Okawaru overflow altars ###################################################

NAME:    okawaru_metal_pillars_1_2
TAGS:    temple_overflow_1 temple_overflow_okawaru uniq_altar_okawaru
TAGS:    transparent decor
DEPTH:   D, Orc
WEIGHT:  7
KFEAT:   _ = altar_okawaru
SHUFFLE: v'
SUBST:   ' = .
: interest_check(_G)
MAP
.....
.v'v.
.'_'.
.v'v.
.....
ENDMAP

NAME:   okawaru_metal_pillars_3
TAGS:   temple_overflow_1 temple_overflow_okawaru uniq_altar_okawaru
TAGS:   transparent decor
DEPTH:  D, Orc
WEIGHT: 3
KFEAT:  _ = altar_okawaru
: interest_check(_G)
MAP
.......
...v...
..v.v..
.v._.v.
..v.v..
...v...
.......
ENDMAP

NAME:   okawaru_trees_1
TAGS:   temple_overflow_1 temple_overflow_okawaru uniq_altar_okawaru
TAGS:   transparent decor
WEIGHT: 5
KFEAT:  _ = altar_okawaru
: interest_check(_G)
MAP
.........
.v.t.t.v.
.........
.t.t.t.t.
...._....
.t.t.t.t.
.........
.v.t.t.v.
.........
ENDMAP

NAME:   okawaru_trees_2
TAGS:   temple_overflow_1 temple_overflow_okawaru uniq_altar_okawaru
TAGS:   transparent decor
WEIGHT: 5
KFEAT:  _ = altar_okawaru
: interest_check(_G)
MAP
...........
.v...t...v.
....t.t....
...t.t.t...
..t.t.t.t..
.t.t._.t.t.
..t.t.t.t..
...t.t.t...
....t.t....
.v...t...v.
...........
ENDMAP

NAME:  okawaru_ov_weapons_minmay
TAGS:  temple_overflow_1 temple_overflow_okawaru uniq_altar_okawaru
TAGS:  transparent decor
ITEM:  hand axe, falchion, mace, spear
KFEAT: _ = altar_okawaru
: interest_check(_G)
MAP
   .....
  ...v...
 ...vvv...
...........
..v.e.f.v..
.vv.._..vv.
..v.d.g.v..
...........
 ...vvv...
  ...v...
   .....
ENDMAP

NAME:  okawaru_altar_gauntlet_db
TAGS:  uniq_altar_okawaru temple_overflow_1 temple_overflow_okawaru
KFEAT: _ = altar_okawaru
KPROP: 1 = no_tele_into
MONS:  goblin; stone q:5 / hobgoblin; stone q:5 / gnoll; stone q:5 /\
       orc; stone q:5 / kobold; stone q:5
: interest_check(_G)
MAP
  xxx
xxx_xxx
x1w.wxx
xxw.w1x
x1w.wxx
xxw.w1x
x1w.wxx
xxw.w1x
xxx+xxx
ENDMAP

NAME:   okawaru_gym_becter
TAGS:   uniq_altar_okawaru temple_overflow_1 temple_overflow_okawaru
TAGS:   transparent decor
KFEAT:  _ = altar_okawaru
: interest_check(_G)
MAP
   .....
 .........
 .vv...vv.
..v.....v..
....._.....
..v.....v..
 .vv...vv.
 .........
   .....
ENDMAP

NAME:    okawaru_humans
TAGS:    uniq_altar_okawaru temple_overflow_1 temple_overflow_okawaru
TAGS:    no_monster_gen no_wall_fixup transparent
DEPTH:   D:7-12
COLOUR:  1 = yellow, ' = yellow, x = white
MONS:    human ; long sword . ring mail
FTILE:   1'xO = floor_sandstone
RTILE:   x = wall_tomb
KFEAT:   _ = altar_okawaru
MAP
.........
.xxxxxxx.
.x1'_'1x.
.x'''''x.
.x'x'x'x.
.xGx'xGx.
.xxx'xxx.
....'....
ENDMAP

NAME:   kennysheep_okawaru_gauntlet
TAGS:   temple_overflow_1 temple_overflow_okawaru uniq_altar_okawaru
TAGS:   no_pool_fixup transparent
KFEAT:  _ = altar_okawaru
KMONS:  1 = goblin ; spear
KPROP:  1 = no_tele_into
KMASK:  1 = opaque
: interest_check(_G)
MAP
      vvvvvvv
 .....w1w...v
......www.G.v
@........G_Gv
......www.G.v
 .....w1w...v
      vvvvvvv
ENDMAP

### Qazlal overflow altars ####################################################

# There's always a safe path to the altar.
NAME:   grunt_qazlal_clouds
TAGS:   transparent no_monster_gen no_item_gen no_trap_gen temple_overflow_1
TAGS:   temple_overflow_qazlal uniq_altar_qazlal decor
KFEAT:  _ = altar_qazlal
MARKER:  L = lua:fog_machine { cloud_type = "flame", \
                               pow_min = 5, pow_max = 7, delay_min = 55, \
                               delay_max = 75, size = 1, walk_dist = 0, \
                               spread_rate = 0, excl_rad = 0 }
MARKER:  M = lua:fog_machine { cloud_type = "freezing vapour", \
                               pow_min = 5, pow_max = 7, delay_min = 55, \
                               delay_max = 75, size = 1, walk_dist = 0, \
                               spread_rate = 0, excl_rad = 0 }
MARKER:  N = lua:fog_machine { cloud_type = "sparse dust", \
                               pow_min = 5, pow_max = 7, delay_min = 55, \
                               delay_max = 75, size = 1, walk_dist = 0, \
                               spread_rate = 0 }
# not a storm cloud - it would be too noisy
MARKER:  O = lua:fog_machine { cloud_type = "rain", \
                               pow_min = 5, pow_max = 7, delay_min = 55, \
                               delay_max = 75, size = 1, walk_dist = 0, \
                               spread_rate = 0 }
SHUFFLE: LMNO
KPROP:   LMNO- = no_tele_into
KFEAT:   - = .
: interest_check(_G)
MAP
ccc@ccc
cL-.-Mc
c-...-c
@.._..@
c-...-c
cN-.-Oc
ccc@ccc
ENDMAP

NAME:   grunt_qazlal_sundering
TAGS:   no_monster_gen no_item_gen no_trap_gen temple_overflow_1
TAGS:   temple_overflow_qazlal uniq_altar_qazlal
KFEAT:  _ = altar_qazlal
KPROP:  c = no_tele_into
SUBST:  c = cccl^.
SUBST:  - = ..l^
:  if you.depth() ~= dgn.br_depth(you.branch()) then
KFEAT:  ^ = shaft trap
:  end
KITEM:  . = nothing w:189 / stone / large rock q:1 w:1
KFEAT:  . = .
: interest_check(_G)
MAP
 ----@----
-ccc-.-ccc-
-ccc-.-ccc-
-ccc-.-ccc-
-----.-----
@...._....@
-----.-----
-ccc-.-ccc-
-ccc-.-ccc-
-ccc-.-ccc-
 ----@----
ENDMAP

NAME:  nicolae_qazlal_eye_of_the_storm
TAGS:  temple_overflow_qazlal temple_overflow_1 uniq_altar_qazlal
TAGS:  no_trap_gen no_item_gen no_monster_gen decor
KPROP: 'd = no_tele_into
KMONS: d = diamond obelisk
KFEAT: _ = altar_qazlal
: interest_check(_G)
MAP
 ccccccccccccc
 c'''''''''''c
 c'''''''''''c
 c'''''''''''c
 c'''''''''''c
@nnnnnn''''''c
@...._nd'''''c
@nnnnnn''''''c
 c'''''''''''c
 c'''''''''''c
 c'''''''''''c
 c'''''''''''c
 ccccccccccccc
ENDMAP

NAME:    nicolae_qazlal_style_of_elements
TAGS:    temple_overflow_qazlal temple_overflow_1 uniq_altar_qazlal
TAGS:    no_trap_gen no_item_gen no_monster_gen transparent decor
SHUFFLE: faew
KPROP:   faew = no_tele_into
KMASK:   faew = opaque
KMONS:   f = fire elemental
KMONS:   a = air elemental
KMONS:   e = earth elemental
KMONS:   w = water elemental
KFEAT:   _ = altar_qazlal
KFEAT:   f = lava
KFEAT:   w = deep_water
MARKER:  a = lua:fog_machine { cloud_type = "thin mist", \
                               pow_min = 100, pow_max = 100, delay = 1, \
                               size = 1, walk_dist = 0, start_clouds = 1 }
MARKER:  e = lua:fog_machine { cloud_type = "sparse dust", \
                               pow_min = 100, pow_max = 100, delay = 1, \
                               size = 1, walk_dist = 0, start_clouds = 1 }
: interest_check(_G)
MAP
ccc.@.ccc
cfn...nac
cnn...nnc
.........
...._....
.........
cnn...nnc
cwn...nec
ccc...ccc
ENDMAP

# general_overflow_altar cannot contain the power of Qazlal
NAME:    nicolae_qazlal_general_emergency
TAGS:    temple_overflow_qazlal temple_overflow_1 uniq_altar_qazlal
TAGS:    no_monster_gen no_pool_fixup transparent decor
SHUFFLE: xXY / xXY / xXY / abc
SHUFFLE: XY
SUBST:   z = w.., X = +++w., Y = xxxxw., x = wxxx, a = w, b = w, c = w
SHUFFLE: ABCD
SUBST:   A = >, C = 'GTU, D = '
KFEAT:   B = altar_qazlal
KMASK:   B>'GTU = opaque
SHUFFLE: wll
: interest_check(_G)
MAP
...........z.
.z...z.zzz...
..zz.z.wwwz..
..wxXYYxwwz..
.zwwwwwwxwz..
zwwxwABwxz...
zwwxwCDwx..z.
.zzxwwwwx.z..
...xxxwxxwz..
.z...zwwwz...
...z..zzz....
...........z.
ENDMAP

NAME: nicolae_qazlal_scattered_showers
# The rain is localized to a 5x5 square centered on the altar.
# There's some rain water that occasionally gets deep but it's passable.
TAGS:   temple_overflow_qazlal temple_overflow_1 transparent decor
TAGS:   no_trap_gen uniq_altar_qazlal
KFEAT:  _ = altar_qazlal
MARKER: _ = lua:fog_machine { cloud_type = "rain", pow_min = 10, \
    pow_max = 15, delay_min = 5, delay_max = 15, size = 1, walk_dist = 2, \
    spread_rate = 0 }
: interest_check(_G)
MAP
.......
.......
.......
..._...
.......
.......
.......
ENDMAP


# Ru overflow altar vaults ####################################################

# A few unlucky monsters permanently afflicted with Ru's various status effects.
# the monsters in group B should all be non-intelligent, so that TSO won't get upset
# about attacking them while blind. it's a pain for a monster you're not allowed
# to attack to chase you throughout the level
NAME: nicolae_ru_great_annihilating_truth
TAGS: temple_overflow_ru temple_overflow_1 uniq_altar_ru transparent
TAGS: no_monster_gen no_item_gen
SHUFFLE: MCSBP
KFEAT: _ = altar_ru
KMONS: P = ball python perm_ench:paralysis / rat perm_ench:paralysis / \
  frilled lizard perm_ench:paralysis / giant cockroach perm_ench:paralysis / \
  quokka perm_ench:paralysis / kobold w:5 perm_ench:paralysis / \
  goblin w:5 perm_ench:paralysis / hobgoblin w:5 perm_ench:paralysis
KMONS: C = bat perm_ench:corona / adder perm_ench:corona / \
  kobold perm_ench:corona / goblin perm_ench:corona / hobgoblin perm_ench:corona
KMONS: S = jackal perm_ench:slow / bat perm_ench:slow / adder perm_ench:slow / \
  kobold perm_ench:slow / goblin perm_ench:slow / hobgoblin perm_ench:slow
KMONS: B = ball python perm_ench:blind / frilled lizard perm_ench:blind / \
  giant cockroach perm_ench:blind / bat perm_ench:blind
KMONS: M = orc wizard perm_ench:mute
MAP
@...   ...@
.+xxxxxxx+.
.x...x...x.
.x.P.x.C.x.
 x.......x
 xxx._.xxx
 x.......x
.x.S.x.B.x.
.x...x...x.
.+xxxxxxx+.
@...   ...@
ENDMAP

NAME: nicolae_ru_awakened_eye
TAGS: temple_overflow_ru temple_overflow_1 uniq_altar_ru transparent decor
TAGS: no_pool_fixup
: interest_check(_G)
KFEAT: _ = altar_ru
MAP
    .......
   .ccccccc.
  .c..WWW..c.
 .c..W...W..c.
.c...W._.W...c.
 .c..W...W..c.
  .c..WWW..c.
   .ccccccc.
    .......
ENDMAP

# Overgrown and disused, since many pilgrims find Ru's sacrifices too onerous.
NAME:   nicolae_ru_the_path_less_chosen
TAGS:   temple_overflow_ru temple_overflow_1 uniq_altar_ru transparent decor
TAGS:   no_item_gen no_monster_gen
: interest_check(_G)
KMONS:  p = plant / fungus w:3
NSUBST: r = 3=^ / ^p / 7=p / 2:p. / ., i = ^^p. / 2=p / .
NSUBST: D = . / xxp / x, E = . / xxp / x, F = xxp / .
KFEAT:  _ = altar_ru
KFEAT:  ^ = web trap
MAP
xxxxxxx
xrrrrrxxxxx
xriiirxDFEx
xri_ir.D.E.@
xriiirxDFEx
xrrrrrxxxxx
xxxxxxx
ENDMAP

NAME: nicolae_ru_sacrificial_ziggurat
TAGS: temple_overflow_ru temple_overflow_1 uniq_altar_ru transparent decor
: interest_check(_G)
SUBST: b = B.., @ = %@@
KPROP: B% = bloody
SUBST: B = ., % = @
FTILE: ' = floor_sandstone
FTILE: .@_ = floor_limestone
TILE: c = wall_sandstone
KFEAT: _ = altar_ru
MAP
cccccc@cccccc
c'''''b'''''c
c'ccccbcccc'c
c'c'''b'''c'c
c'c'ccbcc'c'c
c'c'cBBBc'c'c
@bbbbB_Bbbbb@
c'c'cBBBc'c'c
c'c'ccbcc'c'c
c'c'''b'''c'c
c'ccccbcccc'c
c'''''b'''''c
cccccc@cccccc
ENDMAP

NAME: nicolae_ru_path_of_blood
TAGS: temple_overflow_ru temple_overflow_1 uniq_altar_ru transparent decor
TAGS: no_monster_gen
: interest_check(_G)
KPROP: , = bloody
KPROP: l = no_cloud_gen
KFEAT: _ = altar_ru
MAP
@lcccccccccc
l,......,llc
@l,l,l,l,_lc
l,......,llc
@lcccccccccc
ENDMAP

NAME:   hangedman_ru_absence
TAGS:   temple_overflow_ru temple_overflow_1 uniq_altar_ru transparent decor
TAGS:   no_pool_fixup
WEIGHT: 5
KFEAT:  _ = altar_ru
SUBST:  X : x., x : cxx, b: cbxx, + : W+++, m : mmw
KMASK:  wW = no_monster_gen
: interest_check(_G)
MAP
......xxxxx......
..x...........x..
xxxxxx.....xxxxxx
..x..x.....x..x..
..x..x.XxX.x..x..
.....+..b..+.....
....xxbbbbbxx....
.....+..b_.+.....
..x..x.XxX.m..m..
..x..x.....m..m..
xxxxxx.....mmmmmm
..x...........m..
......xxxxx......
ENDMAP

### Sif Muna overflow altars ##################################################

NAME:   lemuel_blue_sif_altar
TAGS:   no_monster_gen temple_overflow_1 temple_overflow_sif_muna
TAGS:   uniq_altar_sif_muna decor
COLOUR: . = blue
FTILE:  . = floor_hall, C = floor_hall, @ = floor_hall, + = floor_hall
KFEAT:  _ = altar_sif_muna
: interest_check(_G)
MAP
xxxxxxxxxxxxxx
...........xxx
@..........+_x
...........xxx
xxxxxxxxxxxxxx
ENDMAP

NAME:       tgw_sif
TAGS:       no_item_gen no_monster_gen no_pool_fixup
TAGS:       temple_overflow_1 temple_overflow_sif_muna uniq_altar_sif_muna
KFEAT:      _ = altar_sif_muna
: if you.absdepth() <= 3 then
MONS:       Jessica
: elseif you.absdepth() <= 6 then
MONS:       orc wizard w:15 / Blork the orc
: else
MONS:       orc wizard
: end
: interest_check(_G)
NSUBST:     M = 1:1 / *:"
SUBST:      ' : "'., ' = ''.
COLOUR:     . = blue
SUBST:      ' = ., " = .
MAP
        xx@xx
        x...x
        x...x
      xxx...xxx
     xx'''''''xx
    xx'''...'''xx
    x'''.www.'''x
   xx''.wwwww.''xx
   x''.wwM"Mww.''x
   x''.wwM>Mww.''x
   x''.wwMMMww.''x
   xx''.wwwww.''xx
    x'''.www.'''x
    xx'''...'''xx
     xx'''''''xx
      xxx...xxx
        x._.x
        x...x
        xxxxx
ENDMAP

NAME:   led_sif_book
DEPTH:  D, Orc
TAGS:   no_item_gen no_pool_fixup no_monster_gen
TAGS:   temple_overflow_1 temple_overflow_sif_muna uniq_altar_sif_muna
KPROP:  1d = no_tele_into
KFEAT:  _ = altar_sif_muna
KFEAT:  d = escape_hatch_down
KITEM:  d = randbook owner:Sif_Muna numspells:1 slevels:1
MONS:   orc wizard
COLOUR: .@+1 = blue
FTILE:  .@+1G_ = floor_marble
: interest_check(_G)
MAP
xxxxxxxxx
xbbbbx..xx
x1w..xG..x
xdw..+._.@
x1w..xG..x
xbbbbx..xx
xxxxxxxxx
ENDMAP

NAME:   led_sif_pool
TAGS:   no_item_gen no_monster_gen no_pool_fixup
TAGS:   temple_overflow_1 temple_overflow_sif_muna uniq_altar_sif_muna decor
KFEAT:  _ = altar_sif_muna
COLOUR: . = blue
FTILE:  ._ = floor_marble
: interest_check(_G)
MAP
 xxx@xxx
 xxx+xxx
xxWW.WWxx
xWWW.WWWx
xWW...WWx
xWW._.WWx
xWW...WWx
xWWWWWWWx
xxWWWWWxx
 xxxxxxx
ENDMAP

NAME:   nicolae_sif_muna_condensation
TAGS:   temple_overflow_sif_muna temple_overflow_1 transparent decor
TAGS:   no_trap_gen no_pool_fixup uniq_altar_sif_muna
KFEAT:  _ = altar_sif_muna
MARKER: _ = lua:fog_machine { cloud_type = "magical condensation", \
    pow_min = 5, pow_max = 15, delay_min = 5, delay_max = 20, size = 1, \
    walk_dist = 3, spread_rate = 1 }
FTILE:  ._w = floor_marble
COLOUR: . = blue
: interest_check(_G)
MAP
.......
.wwwww.
.wwwww.
..._ww.
.wwwww.
.wwwww.
.......
ENDMAP

NAME:   nicolae_sif_muna_little_library
TAGS:   temple_overflow_sif_muna temple_overflow_1 no_trap_gen
TAGS:   uniq_altar_sif_muna
NSUBST: D = + / x
KPROP:  a = no_tele_into
KMASK:  a = no_item_gen
KMASK:  a = no_monster_gen
KITEM:  a = any randbook ident:all owner:Sif_Muna slevels:1
KFEAT:  _ = altar_sif_muna
FTILE:  a._mc+ = floor_marble
COLOUR: a.mc+ = blue
: interest_check(_G)
MAP
xxxxDDDx
xccc...D
xcam...D
xcam._.D
xcam...D
xccc...D
xxxxDDDx
ENDMAP

NAME:   kennysheep_orc_sif_temple
TAGS:   no_item_gen no_monster_gen no_trap_gen no_pool_fixup
TAGS:   temple_overflow_1 temple_overflow_sif_muna uniq_altar_sif_muna
DEPTH:  D, Orc
KFEAT:  _ = altar_sif_muna
: if you.absdepth() < 6 then
MONS:   orc wizard w:2 / nothing, orc
: else
MONS:   orc wizard / nothing, orc warrior
: end
MAP
     xxxxx
   xxxwwwxxx
  xxwwwwwwwxx
 xxww.vvv.wwxx
 xww.nv_vn.wwx
xxww.v111v.wwxx
xwww.v1d1v.wwwx
xxww.nv1vn.wwxx
 xwwwWv+vWwwwx
 xxwwWG.GWwwxx
  xxww.2.wwxx
   xxxG.Gxxx
     x...x
     xG.Gx
       @
ENDMAP


### Trog overflow altars ######################################################

NAME:  bloody_trog
TAGS:  uniq_altar_trog temple_overflow_1 temple_overflow_trog
TAGS:  transparent decor
KPROP: . = bloody / nothing
KFEAT: _ = altar_trog
KITEM: _ = animal skin, dagger
: interest_check(_G)
MAP
...
._.
...
ENDMAP

NAME:   trog_ov_bears_minmay
TAGS:   temple_overflow_1 temple_overflow_trog uniq_altar_trog
TAGS:   transparent
# begin at bear range
DEPTH:  D:4-
: if you.absdepth() < 10 then
MONS:   black bear
: else
MONS:   polar bear
: end
MONS:   bush
NSUBST: ' = 2:2 / 2=2. / *=.
KFEAT:  _ = altar_trog
MAP
.....
.'''.
.1_1.
.'''.
.....
ENDMAP

NAME:   tgw_trog
TAGS:   no_item_gen no_monster_gen patrolling
TAGS:   temple_overflow_1 temple_overflow_trog uniq_altar_trog
KFEAT:  _ = altar_trog
KPROP:  1 = no_tele_into
: if you.absdepth() < 16 then
MONS:   moth of wrath, rat / worm w:5
: else
MONS:   moth of wrath, dire elephant / boulder beetle w:5
: end
ITEM:   any weapon
NSUBST: M = 4:d / *:.
SUBST:  + = +....
KFEAT:  o = iron_grate
: interest_check(_G)
MAP
      xxxxxxx
     xxxMMMxxx
    xxMMM2MMMxx
   xxMM22_22MMxx
   xx.........xx
   x....ooo....x
   x...oo1oo...x
   x....ooo....x
   x...........x
   xx.........xx
    xx.......xx
     xxxx+xxxx
       xx@xx
ENDMAP

NAME:   trog_antimagical
TAGS:   uniq_altar_trog temple_overflow_1 temple_overflow_trog patrolling
# range of orc + orc warrior
DEPTH:  D:3-12
WEIGHT: 4
: if you.absdepth() > 5 then
KMONS:  1 = ogre god:trog ; giant club ego:antimagic ident:type | w:3 giant club / \
        ogre god:trog ; giant spiked club ego:antimagic ident:type | w:5 giant spiked club / \
        orc warrior god:trog ; halberd ego:antimagic ident:type | war axe ego:antimagic ident:type | \
        flail ego:antimagic ident:type | great mace ego:antimagic ident:type | any weapon / \
        kobold brigand god:trog ; short sword ego:antimagic ident:type | dagger ego:antimagic ident:type | \
        rapier ego:antimagic ident:type | rapier
: else
KMONS:  1 = orc god:trog ; spear ego:antimagic ident:type | hand axe ego:antimagic ident:type | \
        war axe ego:antimagic ident:type | any weapon / \
        kobold god:trog ; short sword ego:antimagic ident:type | hand axe ego:antimagic ident:type | \
        club ego:antimagic ident:type | whip ego:antimagic ident:type | any weapon / \
        goblin god:trog ; dagger ego:antimagic ident:type | short sword ego:antimagic ident:type / \
        gnoll god:trog ; spear ego:antimagic ident:type | trident ego:antimagic ident:type | \
        halberd ego:antimagic ident:type | whip ego:antimagic ident:type | halberd | any weapon
: end
KFEAT:  _ = altar_trog
MAP
  xxxxx
 xx.1.xx
xx.._..xx
x..1.1..x
x.......x
x.G...G.x
xx.....xx
 xx@@@xx
ENDMAP

NAME:   trog_butcher_becter
TAGS:   temple_overflow_1 temple_overflow_trog uniq_altar_trog
TAGS:   no_monster_gen no_item_gen
DEPTH:  D, Orc, !Orc:$
: if you.absdepth() < 6 then
MONS:   orc ; hand axe . animal skin
MONS:   rat / frilled lizard / quokka w:20
: else
MONS:   orc warrior ; war axe . animal skin
MONS:   iguana / scorpion
: end
NSUBST: ' = 3=2 / .
SUBST:  y = x, " = .
KPROP:  1y" = bloody
KFEAT:  _ = altar_trog
: if you.depth() ~= dgn.br_depth(you.branch()) then
KFEAT:  ^ = shaft trap
: end
KFEAT:  m = iron_grate
MAP
  xxxxxxx
 xx'''''xx
xx.xxxxxxxx
xx+xmmmx^yx
xx.."1"""yx
xx..._"..xx
 xx.....xx
  xx...xx
     @
ENDMAP

NAME:   trog_hazing_becter
TAGS:   temple_overflow_1 temple_overflow_trog uniq_altar_trog
TAGS:   no_monster_gen no_item_gen no_pool_fixup
MONS:   goblin ; stone q:5 . animal skin / \
        hobgoblin ; stone q:5 . animal skin / \
        kobold ; stone q:5 | throwing net q:1 . animal skin
ITEM:   stone
NSUBST: D = 6=1 / .
SUBST:  . = d....
KFEAT:  _ = altar_trog
KFEAT:  m = iron_grate
: interest_check(_G)
MAP
  xxxxx
 xxmmmxx
xx.._..xx
xDw...wDx
xDWw.wWDx
xDDw.wDDx
xxDw.wDxx
 xxx.xxx
  xx@xx
ENDMAP

NAME:   trog_three_pillars_becter
TAGS:   temple_overflow_1 temple_overflow_trog transparent decor
TAGS:   uniq_altar_trog
KFEAT:  _ = altar_trog
SUBST:  y = x..
SUBST:  z = xx.
: interest_check(_G)
MAP
 ..........
.......yy..
..yy..zxxy.
.yxxz.xbxy.
.yxb...xxy.
.yxx._.....
.......xy..
.....zbxy..
   ..yxxy..
   ...yy...
    ......
ENDMAP

### Uskayaw overflow altars ###################################################

NAME:   dancing_weapons_uskayaw
TAGS:   temple_overflow_1 temple_overflow_uskayaw transparent
TAGS:   uniq_altar_uskayaw
MONS:   generate_awake dancing weapon ; dagger | hand axe
KFEAT:  _ = altar_uskayaw
NSUBST: ' = 2:1 / *:'
KMASK:  1' = no_monster_gen
KMASK:  1' = no_item_gen
KMASK:  1' = no_trap_gen
KMASK:  1' = opaque
KPROP:  1' = no_tele_into
: interest_check(_G)
MAP
.......
.mmmmm.
.m'''m.
.m'''m.
.mmmmm.
.......
..._...
 .....
ENDMAP

NAME:   eat_drink_and_be_merry_uskayaw
TAGS:   temple_overflow_1 temple_overflow_uskayaw transparent
TAGS:   uniq_altar_uskayaw
KFEAT:  _ = altar_uskayaw
ITEM:   any potion q:1, any weapon
: interest_check(_G)
# TODO: replace ration flavor?
MAP
...........
.G.......G.
...........
.G.......G.
....def....
.G..._...G.
....ccc....
  .......
ENDMAP

NAME:    nicolae_uskayaw_dance_hall
# Either a square dance or a round dance depending on how the shuffle goes.
TAGS:    temple_overflow_uskayaw temple_overflow_1 transparent decor
TAGS:    uniq_altar_uskayaw
SHUFFLE: Gg
SUBST:   g : ., b : bvcmn
KFEAT: _ = altar_uskayaw
: interest_check(_G)
MAP
xxxx.........
x......GgG...
x.b...g...g..
x....G.....G.
 ._..g.....g.
x....G.....G.
x.b...g...g..
x......GgG...
xxxx.........
ENDMAP

NAME:   nicolae_uskayaw_dance_studio
TAGS:   temple_overflow_uskayaw temple_overflow_1 no_monster_gen transparent
TAGS:   patrolling uniq_altar_uskayaw
# kobold brigand depth
DEPTH:  D:6-11
KMONS:  _ = kobold brigand band
KFEAT:  _ = altar_uskayaw
MAP
xxxx+xxxx
xmmm.mmmx
xm.....mx
xm.....mx
xm.._..mx
xm.....mx
xm.....mx
xmmmmmmmx
xxxxxxxxx
ENDMAP

NAME:   nicolae_uskayaw_en_pointe
TAGS:   temple_overflow_uskayaw temple_overflow_1
TAGS:   no_trap_gen generate_awake transparent decor uniq_altar_uskayaw
KPROP:  'D = no_tele_into
MONS:   dancing weapon ; mundane short sword
MONS:   dancing weapon ; mundane falchion, dancing weapon ; mundane spear
MONS:   dancing weapon ; mundane dagger
NSUBST: D = 2=1 / 2=2 / 2=3 / 2=4
KFEAT:  _ = altar_uskayaw
KMASK:  '1234n = opaque
KMASK:  '1234 = no_item_gen
KMASK:  '1234 = no_monster_gen
TILE:   n = dngn_transparent_stone_red
TILE:   c = dngn_stone_wall_lightred
COLOUR: n = red
COLOUR: c = lightred
: interest_check(_G)
MAP
 .............
...nnnnncccc...
..nnD'Dnn..ccc.
..nDn'nDnn...c.
@.n''n'''n._.+.
..nDn'nDnn...c.
..nnD'Dnn..ccc.
...nnnnncccc...
 .............
ENDMAP

NAME:   nicolae_uskayaw_murder_on_the_dancefloor
# But you'd better not kill the groove.
TAGS:   temple_overflow_uskayaw temple_overflow_1 transparent decor
TAGS:   uniq_altar_uskayaw
KFEAT:  _ = altar_uskayaw
NSUBST: . = 4=D / 3=D.
SUBST:  . = ..a, D = DDE
: dgn.delayed_decay(_G, "DE","random corpse")
KPROP:  aE = bloody
KFEAT:  b = .
COLOUR: ._aDE = disco
FTILE:  ._aDE = floor_pebble
: interest_check(_G)
MAP
xxxx@xxxx
x.......x
x.......x
x.......x
@..._...@
x.......x
x.......x
x.......x
xxxx@xxxx
ENDMAP

# https://www.youtube.com/watch?v=vpULWBT1WEg
NAME:    nicolae_uskayaw_suspiria
TAGS:    temple_overflow_uskayaw temple_overflow_1 transparent decor
TAGS:    uniq_altar_uskayaw
SHUFFLE: Aa, Bb
SUBST:   D : l, E : ...l, F : l, H : .l, J : ...l, K : ...l, L : ...l
SUBST:   M : ...l, N : .lll, O : ...l, P : ...l, Q : ...l
KPROP:   l = no_cloud_gen
KFEAT: _ = altar_uskayaw
: interest_check(_G)
MAP
xxxxxxlll..O..ll
x.FllH.L..ll.JNl
x.....M.ll..P.K.
x_.lll.Q...E.D.@
x.....M.ll..P.K.
x.FllH.L..ll.JNl
xxxxxxlll..O..ll
ENDMAP


### Vehumet overflow altars ###################################################

# Rather than put the flame cloud on the altar, flames now surround the
# altar, and the maximum delay between flames has gone away. Thus, standing
# on the altar properly is safe, and a cautious player can time their entrance
# to take no damage.
NAME:   fiery_altar_vehumet
WEIGHT: 8
TAGS:   temple_overflow_1 temple_overflow_vehumet transparent decor
TAGS:   uniq_altar_vehumet
MARKER: : = lua:fog_machine { cloud_type = "flame", \
               pow_min = 6, pow_max = 8, delay_min = 55, delay_max = 75, \
               size = 2, walk_dist = 0, spread_rate= 0 }
KFEAT:  _ = altar_vehumet
: interest_check(_G)
MAP
.....
.:.:.
.._..
.:.:.
.....
ENDMAP

NAME:    vehumet_statue
TAGS:    temple_overflow_1 temple_overflow_vehumet transparent
TAGS:    uniq_altar_vehumet
SHUFFLE: 12
MONS:    statue name:charred name_adjective tile:mons_statue_mage \
             hp:12 hd:3 spells:throw_flame.53.magical
MONS:    statue name:frost-covered name_adjective tile:mons_statue_mage \
             hp:12 hd:3 spells:throw_frost.53.magical
KFEAT:   _ = altar_vehumet
: interest_check(_G)
MAP
...........
.bbbbbbbbb.
.b.......b.
.b.1._.....
.b.......b.
.bbbbbbbbb.
...........
ENDMAP

NAME:    vehumet_crystals
TAGS:    temple_overflow_1 temple_overflow_vehumet transparent decor
TAGS:    uniq_altar_vehumet
KFEAT:   _ = altar_vehumet
: interest_check(_G)
MAP
.........
..b...b..
.bbb.bbb.
..b...b..
...._....
..b...b..
.bbb.bbb.
..b...b..
.........
ENDMAP

NAME:  vehumet_altar_wand_db
TAGS:  uniq_altar_vehumet temple_overflow_1 temple_overflow_vehumet
TAGS:  transparent patrolling
KFEAT: _ = altar_vehumet
MONS:  goblin; wand of flame /\
       hobgoblin; wand of flame /\
       kobold; wand of flame
: interest_check(_G)
MAP
.......
...x...
...1...
.x._.x.
.......
...x...
.......
ENDMAP

# It's part of the design from the Vehumet altar tile.
NAME:   nicolae_vehumet_altar_sigil
TAGS:   temple_overflow_vehumet temple_overflow_1 transparent decor
TAGS:   uniq_altar_vehumet
KFEAT:  _ = altar_vehumet
COLOUR: . = white
COLOUR: + = green
COLOUR: D = lightblue
COLOUR: E = lightgreen
FTILE:  .DE+ = floor_pebble
FTILE:  _ = floor_pebble_lightgreen
: interest_check(_G)
MAP
 bbb+bbb
bb..E..bb
b..DDD..b
b.D.E.D.b
+EDE_EDE+
b.D.E.D.b
b..DDD..b
bb..E..bb
 bbb+bbb
ENDMAP

NAME:    nicolae_vehumet_radiance
TAGS:    temple_overflow_vehumet temple_overflow_1 no_trap_gen transparent
TAGS:    decor uniq_altar_vehumet
SHUFFLE: DEFHJKLM / FHDELMJK, DE, JK
SUBST:   DJ = N, EKFHLM = ., N : cb
KFEAT:   _ = altar_vehumet
: interest_check(_G)
MAP
     xxxxx
    .......
   ..MLMLM..
  ..LJKJKJL..
 ..MK.HFH.KM..
x.LJ.FDEDF.JL.x
x.MKHE...EHKM.x
x.LJFD._.DFJL.x
x.MKHE...EHKM.x
x.LJ.FDEDF.JL.x
 ..MK.HFH.KM..
  ..LJKJKJL..
   ..MLMLM..
    .......
     xxxxx
ENDMAP

### Wu Jian overflow altars ###################################################

NAME:   nzn_wu_jian_council_hall
TAGS:   temple_overflow_1 temple_overflow_wu_jian no_monster_gen no_item_gen
TAGS:   transparent decor uniq_altar_wu_jian
KFEAT:  _ = altar_wu_jian
: interest_check(_G)
MAP
    x@x
  xxx.xxx
 xxG...Gxx
xx.......xx
xG..._...Gx
xx.......xx
 xxG...Gxx
  xxxGxxx
    xxx
ENDMAP

NAME:    nzn_wu_jian_contemplation
TAGS:    temple_overflow_1 temple_overflow_wu_jian no_monster_gen no_item_gen
TAGS:    no_pool_fixup transparent decor uniq_altar_wu_jian
ITEM:    mundane spear / w:2 mundane quarterstaff / w:2 mundane trident, stone
NSUBST:  ' = 3=e / ', " = 4=W / ', t = t / d / -
SUBST:   ` = '
KFEAT:   _ = altar_wu_jian
FTILE:   e' = floor_sand
FTILE:   td- = floor_grass
COLOUR:  e' = yellow
COLOUR:  d- = green
: interest_check(_G)
MAP
 x@x
xx.xxxxxxxxxx
x'`.```'``"Wx
x```.`'``"WWx
x'`.````"WWWx
x`.t`'``"WWWx
x`t_t`'`"WWWx
x``t.'`'`"WWx
x'`'`.``'`"Wx
xxxxxx.xxxxxx
     x@x
ENDMAP

NAME:   pdpol_wu_jian_five_deadly_venoms
TAGS:   no_item_gen no_monster_gen temple_overflow_1 temple_overflow_wu_jian
TAGS:   decor uniq_altar_wu_jian
KFEAT:  _ = altar_wu_jian
KPROP:  F = no_tele_into
MARKER: F = lua:fog_machine { \
            cloud_type="thin mist", size = 1, \
            pow_max = 3, pow_min = 3, delay = 10, \
            start_clouds = 0 }
{{
  local trig_marker = TriggerableFunction:new {
    func="callback.five_deadly_venoms",
    repeated=false,
    data={
      venoms={
        "spectral demonic crawler name:centipede name_species name_replace name_descriptor",
        "spectral black mamba",
        "spectral scorpion",
        "spectral frilled lizard",
        "spectral cane toad"
      }
    }
  }
  trig_marker:add_triggerer(DgnTriggerer:new { type = "player_move" })
  lua_marker("_", trig_marker)
  lua_marker("F", portal_desc { positions = "five_deadly_venoms" })
}}
: interest_check(_G)
MAP
   ccc
   cFc
  ccncc
ccc...ccc
cFn._.nFc
cccn.nccc
 cFc.cFc
 ccc.ccc
   c@c
ENDMAP

# As an enticement to join, the Wu Jian Council has placed weapons beyond lava,
# but you can get to them if you know how to wall jump off of the metal walls.
# You can also get to them in other ways, of course, which is why most of the
# weapons are just plain.
NAME:   nicolae_wu_jian_glorious_leap
TAGS:   temple_overflow_wu_jian temple_overflow_1 no_trap_gen
TAGS:   uniq_altar_wu_jian
WEIGHT: 5
KITEM:  I = any weapon level:-2
KITEM:  i = any weapon
NSUBST: i = I / i
KFEAT:  _ = altar_wu_jian
KMASK:  >Ii' = no_monster_gen
KMASK:  >Ii' = no_item_gen
KMASK:  >Ii' = opaque
: interest_check(_G)
MAP
xxxxxxxxxxxxxxx
xccccccccvccccx
xcccilll.....cx
xcccivlll....cx
xc>+i''ll._...+
xcccivlll....cx
xcccilll.....cx
xccccccccvccccx
xxxxxxxxxxxxxxx
ENDMAP

# Abstract representations of the moves of Wu Jian's three martial arts.
# The green space is where you start, the red space is where you move to,
# the statue is where the monster is.
NAME:   nicolae_wu_jian_immortal_techniques
TAGS:   temple_overflow_wu_jian temple_overflow_1 decor transparent
TAGS:   uniq_altar_wu_jian
KFEAT:  _ = altar_wu_jian
KFEAT:  DE = .
FTILE:  D = floor_pebble_lightgreen
FTILE:  E = floor_pebble_lightred
COLOUR: D = green
COLOUR: E = red
: interest_check(_G)
MAP
cc+cccccc
c.D.c.EEc
c.E...DGc
c.G.c.EEc
ccnccc.cc
c...c...c
c._..EGDc
c...c...c
ccccccccc
ENDMAP

# The five elements, or five phases, Wood, Fire, Earth, Metal, Water,
# in a cycle of either mutual generation or mutual overcoming.
NAME:    nicolae_wu_jian_wuxing_cycle
TAGS:    temple_overflow_wu_jian temple_overflow_1 transparent \
         no_pool_fixup decor uniq_altar_wu_jian
SHUFFLE: tlcvw/lcvwt/cvwtl/vwtlc/wtlcv/tcwlv/cwlvt/wlvtc/lvtcw/vtwcl
NSUBST:  Q = 4=@ / x
KFEAT:   _ = altar_wu_jian
: interest_check(_G)
MAP
     xxQxx
   xx.....xx
  Q.........Q
 x......ll...x
 x..tt..ll...x
x...tt........x
x.............x
Q......_..cc..Q
x..ww.....cc..x
x..ww.........x
 x.....vv....x
 x.....vv....x
  Q.........Q
   xx.....xx
     xxQxx
ENDMAP

### Xom overflow altars #######################################################

NAME:   tgw_xom
TAGS:   no_item_gen no_monster_gen temple_overflow_1 temple_overflow_xom
TAGS:   uniq_altar_xom no_tele_into
KFEAT:  _ = altar_xom
MONS:   place:D:1
MONS:   orc ; club ego:chaos | dagger ego:chaos | spear ego:chaos
MONS:   gnoll ; club ego:chaos | dagger ego:chaos | spear ego:chaos
MONS:   boggart ; flail ego:chaos | long sword ego:chaos | trident ego:chaos
MONS:   rakshasa ; flail ego:chaos | long sword ego:chaos | trident ego:chaos
:  if you.depth() == dgn.br_depth(you.branch()) then
KFEAT:  ~ = teleport trap w:20 / alarm trap w:3 / dispersal trap
:  else
KFEAT:  ~ = shaft trap / teleport trap / alarm trap w:3 / dispersal trap
:  end
# Previously on raw average 5.17 M glyphs.
NSUBST: ' = _ / .
NSUBST: . = 8=M / * = .:220 W:60 w:50 x:80 n:80 v b l % T U ~
NSUBST: % = *% / %
SUBST:  M : .111123M
NSUBST: 1 = 0 / 1 / 01., 2 = 2 / 2=2. / 2...
NSUBST: 3 = 3 / 2=3. / 3..., M = 1 / 123.
:  if you.in_branch("Depths") then
SUBST:  2 = 4, 3 = 5
:  end
COLOUR: . = random
MAP
   xxxxxx@xxxxxx
  xx...........xx
 xx.............xx
xx...............xx
x.................x
x.................x
x'...............'x
x'...............'x
xx'.............'xx
 xx'''''''''''''xx
  xx'''''''''''xx
   xxxxxxxxxxxxx
ENDMAP

NAME:    xom_teletrap_fun
TAGS:    temple_overflow_1 temple_overflow_xom uniq_altar_xom
TAGS:    transparent decor
KFEAT:   _ = altar_xom
NSUBST:  T = . / T
KFEAT:   T = teleport trap
: interest_check(_G)
MAP
.....
.TTT.
.T_T.
.TTT.
.....
ENDMAP

NAME:    xom_butterflies
TAGS:    temple_overflow_1 temple_overflow_xom transparent patrolling
KFEAT:   _ = altar_xom
KITEM:   _ = piece from Xom's chessboard
COLOUR:  . = random
NSUBST:  . = 2: 1/ *: .
MONS:    butterfly
: interest_check(_G)
MAP
...
._.
...
ENDMAP

NAME:    xom_shifter_show
TAGS:    temple_overflow_1 temple_overflow_xom uniq_altar_xom
DEPTH:   D:7-
MONS:    shapeshifter hd:1
KFEAT:   _ = altar_xom
NSUBST:  . = 2:1 / 1:> / * = _...
:  if you.depth() == dgn.br_depth(you.branch()) then
SUBST:   > = <
:  end
SUBST:   x = bmv
KMASK:   .1 = no_trap_gen
COLOUR:  .1 = random
FTILE:   ._<>1 = floor_pebble
MAP
 xxxxxxx
 x.....x
 m.....x
@m.._..x
 m.....x
 x.....x
 xxxxxxx
ENDMAP

NAME:    xom_confusion_cloud
TAGS:    temple_overflow_1 temple_overflow_xom uniq_altar_xom
KFEAT:   _ = altar_xom
MARKER:  _ = lua:fog_machine { cloud_type = "noxious fumes", \
               pow_min = 6, pow_max = 8, delay_min = 35, delay_max = 55, \
               size = 3, walk_dist = 0, spread_rate= 0 }
SUBST:   . = 1.
SHUFFLE: wW/l.
MONS:    random
MAP
  wwwww
 ww...ww
 w.....w
@W.._..w
 w.....w
 ww...ww
  wwwww
ENDMAP

# not guaranteed to be fully navigable, so not transparent. It would be better
# for avoiding vetoes if this guaranteed a path somehow...
NAME:    xom_redecorated
TAGS:    temple_overflow_1 temple_overflow_xom uniq_altar_xom decor
SUBST:   c = ccbbbv
NSUBST:  . = 2=^ / .
SUBST:   . = lWwtm_~......
NSUBST:  ^ = 3=^ / .
KFEAT:   _ = altar_xom
KFEAT:   ^ = teleport trap
:  if you.depth() == dgn.br_depth(you.branch()) then
KFEAT:  ~ = teleport trap / alarm trap / dispersal trap
:  else
KFEAT:  ~ = shaft trap / teleport trap / alarm trap / dispersal trap
:  end
: interest_check(_G)
MAP
      @
   cccTccc
  cc.....cc
 cc.......cc
 c.........c
@T...._....T@
 c.........c
 cc.......cc
  cc.....cc
   cccTccc
      @
ENDMAP

NAME:   led_xom_imps
TAGS:   temple_overflow_1 temple_overflow_xom uniq_altar_xom
MONS:   crimson imp, crimson imp ; dagger ego:chaos
KPROP:  1 = no_tele_into
NSUBST: 1 = 2 / 1
KFEAT:  _ = altar_xom
KFEAT:  ^ = teleport trap / dispersal trap
: interest_check(_G)
MAP
xxxx+xxxx
x1^...^1x
xxx._.xxx
x1^...^1x
xxxx+xxxx
ENDMAP

NAME: nicolae_xom_altar_mimics
TAGS: temple_overflow_1 temple_overflow_xom uniq_altar_xom decor transparent
WEIGHT: 1
NSUBST: _ = 1:_ / 2:XXX_ / *:X
KFEAT: _ = altar_xom
KFEAT: X = altar_xom mimic
: interest_check(_G)
MAP
  .......
  ._..._.
 .........
 .........
...........
._..._..._.
...........
 .........
 .........
  ._..._.
  .......
ENDMAP

NAME:    brannock_xom_greatest_gift
TAGS:    temple_overflow_1 temple_overflow_xom uniq_altar_xom transparent
WEIGHT:  2
KFEAT:   _ = altar_xom
MARKER:  _ = lua:portal_desc {gift="altar"}
{{
    dgn.persist.xom_gg_granted = false

    local los_marker = TriggerableFunction:new {
      func="callback.xom_greatest_gift",
      repeated=true
    }
    los_marker:add_triggerer(DgnTriggerer:new {
      type="player_los"})

    lua_marker('_', los_marker)
}}
: interest_check(_G)
MAP
...
._.
...
ENDMAP

NAME:   doesnt_xom_only_xom
TAGS:   temple_overflow_1 temple_overflow_xom uniq_altar_xom transparent decor
KFEAT:  _ = altar_xom
KFEAT:  C = C mimic
NSUBST: C = 1:_ / *:C
: interest_check(_G)
MAP
xxxxxxxxxxx
x.G.G.G.G.x
xGC..C..CGx
x.........x
x.........x
xG.......Gx
x.C..C..C.x
xG.......Gx
xxxx...xxxx
   x...x
   x...x
   xG.Gx
   xx+xx
ENDMAP

### Yredelemnul overflow altars ###############################################

NAME:   yredelemnul_altar_generic
TAGS:   uniq_altar_yredelemnul temple_overflow_1 temple_overflow_yredelemnul
TAGS:   transparent decor
KFEAT:  C = altar_yredelemnul
KMONS:  f = withered plant
: interest_check(_G)
MAP
.....
.f.f.
..C..
.f.f.
.....
ENDMAP

NAME:   lemuel_zombie_altar_yredelemnul
TAGS:   no_pool_fixup uniq_altar_yredelemnul no_monster_gen temple_overflow_1
TAGS:   temple_overflow_yredelemnul transparent  uniq_zombie_altar
KFEAT:  _ = altar_yredelemnul
MONS:   patrolling zombie
NSUBST: A = 2:1 / *:.
MAP
xxxxxxxxxxxxxxxx
xxxxAAAAAAAAxxxx
xxxx........xxxx
@............._x
xxxx........xxxx
xxxxAAAAAAAAxxxx
xxxxxxxxxxxxxxxx
ENDMAP

NAME:   lemuel_mausoleum_altar_yredelemnul
TAGS:   uniq_altar_yredelemnul temple_overflow_1 temple_overflow_yredelemnul
TAGS:   uniq_mausoleum_altar
# see the kiku mausoleum altar for the depth
DEPTH:  D:4-10, Crypt
MONS:   zombie, mummy, wight, necrophage
NSUBST: ? = 1:_ / *:1
SUBST:  1 = 1:30 2 3 4
KFEAT:  _ = altar_yredelemnul
KMONS:  _ = human zombie
MAP
ccccccccccccccc
c?c?c?c?c?c?ccG
c+c+c+c+c+c+ccc
c............+@
c+c+c+c+c+c+ccc
c?c?c?c?c?c?ccG
ccccccccccccccc
ENDMAP

NAME:   yredelemnul_forgotten_temple_becter
TAGS:   temple_overflow_1 temple_overflow_yredelemnul no_monster_gen no_item_gen
TAGS:   transparent uniq_altar_yredelemnul
KFEAT:  _ = altar_yredelemnul
KFEAT:  . = web trap / .
KMONS:  _ = spectral orc
: interest_check(_G)
MAP
xxxxxxxxx
xcccccccx
xc.._..cx
xcc...ccx
xc.....cx
xcc...ccx
xxcc+ccxx
 xxx@xxx
ENDMAP

NAME: nicolae_yredelemnul_corpse_copse
TAGS: temple_overflow_yredelemnul temple_overflow_1 no_monster_gen
TAGS: transparent patrolling uniq_altar_yredelemnul
# Statistically, the probability that none of the edge glyphs will end up as .
# and the level builder won't be able to connect the vault is extremely small.
# ...but not zero. Thus:
MONS:   zombie
NSUBST: D = . / E
NSUBST: t = . / ttE
SUBST:  E = tt.
: nsubst( ". = " .. you.absdepth() .. "=1 / 1=1. / ." )
KFEAT:  _ = altar_yredelemnul
COLOUR: t = lightgrey w:5 / brown
TILE:   t = dngn_tree_dead
: set_feature_name("tree", "dead tree")
MAP
   DDDDD
  DE.E.ED
 DE.E.E.ED
DE.ttttt.ED
D.Et...tE.D
DE.t._.t.ED
D.Et...tE.D
DE.ttttt.ED
 DE.E.E.ED
  DE.E.ED
   DDDDD
ENDMAP

NAME:   nicolae_yredelemnul_ghost_church
TAGS:   temple_overflow_yredelemnul temple_overflow_1 transparent
TAGS:   uniq_altar_yredelemnul
TAGS:   no_trap_gen
WEIGHT: 5
KPROP:  dO' = no_tele_into
KMASK:  dO' = no_monster_gen
NSUBST: d = * / $ / %
KFEAT:  _ = altar_yredelemnul
KMONS:  O = player ghost
KMONS:  z = patrolling zombie
: interest_check(_G)
MAP
xxxxxxxxxxx
xxxcccccxxx
xxcc...ccxx
xxcz._.zcxx
xccc...cccx
xc.......cx
xc.n===n.cx
xc.n'O'n.cx
+..ndddn..+
xcccccccccx
xxxxxxxxxxx
ENDMAP

### Zin overflow altars #######################################################

NAME:   zin_angel
TAGS:   no_item_gen no_monster_gen temple_overflow_1 temple_overflow_zin decor
TAGS:   uniq_altar_zin
KFEAT:  _ = altar_zin
KPROP:  1 = no_tele_into
COLOUR: G = lightgray
COLOUR: c = white
TILE:   c = wall_church
FTILE: _.G1m+ = floor_limestone
MONS:   angel god:zin dbname:zin_angel / \
        angel god:zin dbname:zin_angel ; any weapon level:20 ego:holy_wrath ident:type / \
        angel god:zin dbname:zin_angel ; long sword ego:holy_wrath ident:type / \
        angel god:zin dbname:zin_angel ; mace ego:holy_wrath ident:type
: interest_check(_G)
MAP
xxxxxxxxx
xcccccccx
xc1m.._cx
xcmm...cx
xc.....cx
xcG...Gcx
xccc+cccx
    @
ENDMAP

NAME:   zin_treasury
TAGS:   no_item_gen no_monster_gen temple_overflow_1 temple_overflow_zin
TAGS:   uniq_altar_zin
KFEAT:  _ = altar_zin
KFEAT:  m = iron_grate
KPROP:  $ = no_tele_into
COLOUR: c = white
TILE:   c = wall_church
FTILE:  _.m+$ = floor_limestone
: interest_check(_G)
MAP
  xxxxxxx
  xcccccx
 xxc$$$cxx
xxcc$$$ccxx
xccmm$mmccx
xcc.mmm.ccx
xcc.._..ccx
xxc.....cxx
 xccc+cccx
     @
ENDMAP

NAME:   zin_purify
TAGS:   no_item_gen no_monster_gen temple_overflow_1 temple_overflow_zin
TAGS:   transparent uniq_altar_zin
KFEAT:  _ = altar_zin
KFEAT:  v = general shop name:Zin type:Purification suffix:Station count:1 \
        greed:30 ; \
        potion of curing
COLOUR: c = white
COLOUR: ' = white
TILE:   c = wall_church
FTILE:  Td'_ = floor_limestone
SUBST:  ' = .
: interest_check(_G)
MAP
 .....
..ccc..
.ccTcc.
..c_c..
 .....
...'...
..'v'..
 ..'..
  ...
ENDMAP

NAME:   zin_scriptorium
TAGS:   no_item_gen no_monster_gen temple_overflow_1 temple_overflow_zin
TAGS:   uniq_altar_zin
ITEM:   any scroll
KFEAT:  _ = altar_zin
KFEAT:  m = iron_grate
KPROP:  ? = no_tele_into
COLOUR: c = white
TILE:   c = wall_church
FTILE:  _.m+d = floor_limestone
NSUBST: ? = 2:d / *:.
: interest_check(_G)
MAP
  xxxxxxx
  xcccccx
 xxc???cxx
 xcc???ccx
xxcccmcccxx
xcc.....ccx
xcc.._..ccx
xxc.....cxx
 xccc+cccx
     @
ENDMAP

NAME:   zin_academy
TAGS:   no_item_gen no_monster_gen temple_overflow_1 temple_overflow_zin
TAGS:   transparent uniq_altar_zin
KFEAT:  _ = altar_zin
COLOUR: c = white
COLOUR: ' = white
TILE:   c = wall_church
FTILE:  _' = floor_limestone
SUBST:  ' = .
: interest_check(_G)
MAP
  ccccccc
ccc.ttttccc
c.tt'_'t..c
....'''....
...........
...'''''...
 .........
   .....
ENDMAP

NAME:   zin_statuary
TAGS:   no_item_gen no_monster_gen temple_overflow_1 temple_overflow_zin
TAGS:   transparent uniq_altar_zin
KFEAT:  _ = altar_zin
COLOUR: c = white
TILE:   c = wall_church
FTILE:  _'+ = floor_limestone
SUBST:  ' = .
: interest_check(_G)
MAP
 .......
..ccccc..
.cc'_'cc.
..cc+cc..
...'''...
.G.....G.
 ..G.G..
  .....
ENDMAP

### The Shining One overflow altars ###########################################

# TSO's small temple (1KB)
# Idea stolen from protected_by_tso_3.
NAME:     tso_altar
TAGS:     no_item_gen no_rotate decor
TAGS:     temple_overflow_1 temple_overflow_the_shining_one
TAGS:     uniq_altar_the_shining_one
COLOUR:   _ = yellow
FTILE:    _A = floor_limestone
SUBST:    _ = .
COLOUR:   c = white
TILE:     c = wall_church
KFEAT:    A = altar_the_shining_one
: interest_check(_G)
MAP
  xxxxx
xxxcccxxx
xcccAcccx
xc.___.cx
xct._.tcx
xc.._..cx
xct...tcx
xccc+cccx
ENDMAP

NAME:    tso_metal_star
TAGS:    no_monster_gen no_trap_gen no_pool_fixup no_item_gen decor
TAGS:    temple_overflow_1 temple_overflow_the_shining_one transparent
TAGS:    uniq_altar_the_shining_one
KFEAT:   _ = altar_the_shining_one
SUBST:   ! : vmmTG..
: interest_check(_G)
MAP
          @
          .
         ...
         .v.
        ..v..
       ..vvv..
      ..vv.vv..
     ..vv...vv..
    ..vm..!..mv..
  ...vv..!.!..vv...
@..vvv..!._.!..vvv..@
  ...vv..!.!..vv...
    ..vm..!..+v..
     ..vv...vv..
      ..vv.vv..
       ..vvv..
        ..v..
         .v.
         ...
          .
          @
ENDMAP

NAME:   tso_oasis_becter
TAGS:   temple_overflow_1 temple_overflow_the_shining_one transparent
TAGS:   no_item_gen no_monster_gen uniq_altar_the_shining_one
KMONS:  f = plant
SUBST:  ` = ff.
COLOUR: . = yellow
FTILE:  `.Tf = floor_sand
FTILE:  _ = floor_limestone
COLOUR: c = white
TILE:   c = wall_church
KFEAT:  _ = altar_the_shining_one
: interest_check(_G)
MAP
  ....
 ..``....
 .`ww`...
 ..``..c..
......+cc..
..T..cc_cc.
 .....ccc..
   ....c..
     ....
ENDMAP

NAME: nicolae_tso_swordbearing_angel
TAGS: temple_overflow_the_shining_one uniq_altar_the_shining_one
TAGS: temple_overflow_1 decor transparent
COLOUR: . = yellow
COLOUR: c = white
FTILE: @._+ = floor_limestone
TILE: c = wall_church
KFEAT: _ = altar_the_shining_one
: interest_check(_G)
MAP
     xxxxx
    xxcccxx
    xcc.ccx
xxxxxc._.cxxxxx
xcccccc.ccccccx
xc...........cx
xcc....v....ccx
xxcc..vvv..ccxx
 xxcc..v..ccxx
  xxcc.v.ccxx
   xxc.v.cxx
    xc.v.cx
    xc.v.cx
    xc...cx
    xcc+ccx
ENDMAP


NAME: nicolae_tso_carved_into_rock
TAGS: temple_overflow_the_shining_one uniq_altar_the_shining_one
TAGS: temple_overflow_1 transparent decor
SUBST: X = xxx.
COLOUR: ' = yellow
COLOUR: c = white
TILE: G = dngn_golden_statue
TILE: c = wall_church
FTILE: G'_ = floor_limestone
KFEAT: _ = altar_the_shining_one
: interest_check(_G)
MAP
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxXXXXxxxxxxxxxxxxx
xxxxxxxXXXXXX....XXXXXXxxxxxxx
xxxxXXX................XXXxxxx
xxXX......................XXxx
xX......XxX........XxX......Xx
X.....XXxxxxcG'''GcxxxXX.....X
.....Xxxxxxxccc'cccxxxxxX.....
@...Xxxxxxxxxc'''cxxxxxxxX...@
..Xxxxxxxxxxxc'_'cxxxxxxxxXX..
XXxxxxxxxxxxxc'''cxxxxxxxxxxXX
xxxxxxxxxxxxxcccccxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ENDMAP

NAME: nicolae_tso_besieged_by_evil
TAGS: temple_overflow_the_shining_one uniq_altar_the_shining_one
TAGS: temple_overflow_1 patrolling transparent no_monster_gen
# imp ranges
DEPTH: D:3-8
SUBST: c = ccc' s:2 z:2, + = ++'
NSUBST: ' = 2:s / 2:z / 2:sz'' / *:'
COLOUR: 'sz = yellow / none w:5
COLOUR: c = white
TILE: c = wall_sandstone
FTILE: +'_sz = floor_sandstone / none w:5
KMONS: s = orc skeleton / kobold skeleton / goblin skeleton / hobgoblin zombie
KMONS: z = orc zombie / kobold zombie / goblin zombie / hobgoblin zombie
: if you.absdepth() <= 4 then
KMONS: _ = crimson imp / white imp w:5
: else
KMONS: _ = crimson imp / white imp / shadow imp / iron imp / quasit
: end
KFEAT: _ = altar_the_shining_one
MAP
.............
.............
..cccc.cccc..
..cccc+cccc..
..cc'''''cc..
..cc'''''cc..
...+''_''+...
..cc'''''cc..
..cc'''''cc..
..cccc+cccc..
..cccc.cccc..
.............
.............
ENDMAP

### Multiple god overflow altars ###############################################

# These ones are multiple overflows to specific gods;
# they get tags temple_overflow_N and temple_overflow_<god>.

NAME:    good_gods_temple_1
TAGS:    temple_overflow_3 temple_overflow_elyvilon
TAGS:    temple_overflow_zin temple_overflow_the_shining_one
TAGS:    no_monster_gen no_trap_gen decor
MONS:    plant
KFEAT:   D = altar_elyvilon
KFEAT:   E = altar_zin
KFEAT:   F = altar_the_shining_one
SHUFFLE: DEF
SUBST:   1 : GTV1
SUBST:   X : GTt
SUBST:   ? : t@
MAP
  ttttttt
 tt.....tt
tt...E...tt
tt.D...F.tt
tt...1...tt
 tt.....tt
  tt...tt
   ?X@X?
ENDMAP

NAME:    good_gods_mini_temple
TAGS:    temple_overflow_3 temple_overflow_elyvilon
TAGS:    temple_overflow_zin temple_overflow_the_shining_one
TAGS:    no_monster_gen no_trap_gen no_pool_fixup
TAGS:    no_item_gen decor
MONS:    plant
KFEAT:   D = altar_elyvilon
KFEAT:   E = altar_zin
KFEAT:   F = altar_the_shining_one
: if crawl.coinflip() then
SHUFFLE: x" / t1 / wT / IJ
: else
SUBST:   " : ..x
: end
SUBST:   HI : x
SUBST:   x : xcvb
SUBST:   ' : .
SHUFFLE: EG/'E
SUBST:   J : G
SHUFFLE: DEF
MAP
 xxxxx
xxxGxxx
xD.E.Fx
xx+++xx
 ""@""
ENDMAP

NAME:  grunt_temple_overflow_champion_of_chaos
TAGS:  temple_overflow_2 temple_overflow_makhleb temple_overflow_xom
TAGS:  no_monster_gen
MONS:  crimson imp ; dagger ego:chaos ident:type
KFEAT: A = altar_makhleb
KFEAT: B = altar_xom
MAP
xxxxx
xA.Bx
x.1.x
x...x
xx+xx
ENDMAP

NAME:  grunt_temple_overflow_growth_and_decay
TAGS:  temple_overflow_2 temple_overflow_fedhas temple_overflow_kikubaaqudgha
TAGS:  transparent
KFEAT: A = altar_fedhas
KFEAT: B = altar_kikubaaqudgha
MONS:  plant / nothing
MONS:  withered plant / nothing
MAP
xxxxx
x111xx@@
x1A111..xxx
x11.....22xxxx
xxxx11.....22x
   xxx..222B2x
      @@xx222x
         xxxxx
ENDMAP

NAME:   grunt_temple_overflow_holy_war
TAGS:   temple_overflow_2 temple_overflow_the_shining_one
TAGS:   temple_overflow_yredelemnul transparent
MONS:   angel, profane servitor
FTILE:  A+_Kn1 = floor_limestone
FTILE:  B-;LN2 = floor_crypt
TILE:   c = wall_church
TILE:   C = wall_catacombs
KFEAT:  A = altar_the_shining_one
KFEAT:  B = altar_yredelemnul
KFEAT:  C = stone_wall
KFEAT:  KL = floor
KFEAT:  - = closed_door
KFEAT:  N = clear_stone_wall
KPROP:  12 = no_tele_into
KMASK:  12 = opaque
COLOUR: c = white
COLOUR: C = magenta
MARKER: K = lua:fog_machine {cloud_type = "blessed fire", \
                             pow_min = 10, pow_max = 10, delay = 10, \
                             size = 1, walk_dist = 0, spread_rate = 0, \
                             excl_rad = 0 }
MARKER: L = lua:fog_machine {cloud_type = "foul pestilence", \
                             pow_min = 10, pow_max = 10, delay = 10, \
                             size = 1, walk_dist = 0, spread_rate = 0, \
                             excl_rad = 0 }
MAP
xxxxxxxxxxxx@xxxxxxxxxxxx
xcccccccccc...CCCCCCCCCCx
xcnnK_K_K_c...C;L;L;LNNCx
xc1n_A____+...-;;;;B;N2Cx
xcnnK_K_K_c...C;L;L;LNNCx
xcccccccccc...CCCCCCCCCCx
xxxxxxxxxxxx@xxxxxxxxxxxx
ENDMAP

NAME:  grunt_temple_overflow_lords_of_destruction
TAGS:  temple_overflow_2 temple_overflow_makhleb temple_overflow_vehumet
KFEAT: A = altar_makhleb
KFEAT: B = altar_vehumet
MONS:  crimson imp ; wand of flame charges:1
MAP
 xxxxx
xxA.Bxx
x..1..x
xx...xx
 xx.xx
  x+x
ENDMAP

NAME:  grunt_temple_overflow_order_and_chaos_1
TAGS:  temple_overflow_2 temple_overflow_xom temple_overflow_zin transparent
KPROP: _1 = no_tele_into
KMASK: _1 = opaque
KMASK: _1 = no_trap_gen
KFEAT: A = altar_xom
KFEAT: B = altar_zin
FTILE: n_1 = floor_limestone
MONS:  angel god:zin dbname:zin_angel perm_ench:confusion generate_awake / \
       angel god:zin dbname:zin_angel perm_ench:mute generate_awake w:1 / \
       angel god:zin dbname:zin_angel perm_ench:mad generate_awake w:1 / \
       angel god:zin dbname:zin_angel perm_ench:dumb generate_awake w:1
MAP
 .......
....A....
..nnnnn..
..n___n..
@.n_1_n.@
..n___n..
..nnnnn..
....B....
 .......
ENDMAP

NAME:   grunt_temple_overflow_order_and_chaos_2
TAGS:   temple_overflow_2 temple_overflow_makhleb temple_overflow_zin
TAGS:   transparent
KFEAT:  A = altar_makhleb
KFEAT:  B = altar_zin
MONS:   executioner / balrug / green death / cacodemon / blizzard demon
MONS:   angel god:zin dbname:zin_angel
SUBST:  ; = -_
KPROP:  - = bloody / nothing
KPROP:  12 = no_tele_into
KMASK:  12 = opaque
SUBST:  - = _L
KFEAT:  L_ = floor
KFEAT:  C = stone_wall
KFEAT:  N = clear_stone_wall
SUBST:  X = CL
FTILE:  _BN2 = floor_limestone
TILE:   C = wall_church
COLOUR: C = white
MAP
    x.@.x
  xxx...xxx
xxxXXX+CCCxxx
xccc--;__CCCx
xc1nA-;_BN2Cx
xccc--;__CCCx
xxxXXX+CCCxxx
  xxx...xxx
    x.@.x
ENDMAP

# If the berserker scares you, use the escape hatch.
NAME:   grunt_temple_overflow_bloody_war
TAGS:   temple_overflow_2 temple_overflow_okawaru temple_overflow_trog
TAGS:   patrolling
WEIGHT: 5
KFEAT:  A = altar_okawaru
KFEAT:  B = altar_trog
KPROP:  . = bloody / nothing
: if you.absdepth() < 8 then
MONS:   gnoll ; club | spear | nothing . potion of berserk rage / \
        orc ; club | hand axe | short sword . \
              leather armour | nothing . potion of berserk rage
: else
MONS:   orc warrior ; club | hand axe | short sword . \
                      leather armour | ring mail . \
                      potion of berserk rage
: end
MAP
xxxxxxx
xxxxxxx
xxA.Bxx
xx.1.xx
xx...xx
xx...xx
xx...xx
xx...xx
xxx+xxx
  .@<
ENDMAP

NAME:    grunt_temple_overflow_magic_moments
TAGS:    temple_overflow_3 temple_overflow_kikubaaqudgha
TAGS:    temple_overflow_sif_muna temple_overflow_vehumet
TAGS:    no_item_gen
KFEAT:   A = altar_kikubaaqudgha
KFEAT:   B = altar_sif_muna
KFEAT:   C = altar_vehumet
ITEM:    randbook owner:Kikubaaqudgha disc:necromancy spells:pain \
         numspells:1 / \
         randbook owner:Kikubaaqudgha disc:necromancy spells:animate_skeleton \
         numspells:1
# You already got a direct damage spell by looting the other gods' altars.
ITEM:    randbook owner:Sif_Muna disc:hexes numspells:1 slevels:1 / \
         randbook owner:Sif_Muna disc:transmutation numspells:1 slevels:1 / \
         randbook owner:Sif_Muna disc:summoning numspells:1 slevels:1 / \
         randbook owner:Sif_Muna disc:translocation numspells:1 slevels:1
ITEM:    randbook owner:Vehumet disc:conjuration spells:magic_dart numspells:1
SHUFFLE: AdB"C` / A'BeC` / A'B"Cf
MAP
     xxxxx
    xx.B.xx
  xxxG.".Gxxx
 xxGxx...xxGxx
 x...xx.xx...x
 xAd.......`Cx
 x...x.U.x...x
 xGxx...xxGxx
  xxx  @  xxx
ENDMAP

# This doesn't place multiple gods, but it can place one of two distinct
# gods.
# Shouldn't get uniq_altar tags because it will eat both trog and makhleb
# while only placing one of the two.
NAME:  lightli_temple_of_fire
TAGS:  temple_overflow_1 temple_overflow_trog temple_overflow_makhleb
KPROP: Y = no_tele_into
KMASK: Y = no_monster_gen
{{
  local params = dgn.map_parameters()
  if params ~= nil then
    local tag = unpack(params)
    if tag ~= nil then
      if string.find(tag, "trog") ~= nil then
        kfeat('_ = altar_trog')
      elseif string.find(tag, "makhleb") ~= nil then
        kfeat('_ = altar_makhleb')
      else
        kfeat('_ = altar_trog / altar_makhleb')
      end
    else
      kfeat('_ = altar_trog / altar_makhleb')
    end
  else
    kfeat('_ = altar_trog / altar_makhleb')
  end
}}
MAP
llcccccc
lccYcYccc
lclllllcc
lcl...lcc
lcl...lYc
@+.._.lcc
lcl...lYc
lcl...lcc
lclllllcc
lccYcYccc
llcccccc
ENDMAP

NAME:    grunt_temple_overflow_opulence
TAGS:    temple_overflow_2 temple_overflow_gozag temple_overflow_nemelex_xobeh
TAGS:    transparent
SHUFFLE: GU, _O
KFEAT:   _ = altar_gozag
KFEAT:   O = altar_nemelex_xobeh
TILE:    G = dngn_golden_statue
FTILE:   ._GOU+ = floor_limestone
RTILE:   x = wall_sandstone
COLOUR:  xG = yellow
: set_feature_name("granite_statue", "golden statue")
MAP
  xxxxxxx
 xx.....xx
xx...U...xx
x.........x
x.G._.O.G.x
x.........x
xx...U...xx
 xx.....xx
  xxx+xxx
ENDMAP

NAME:   grunt_temple_overflow_gold_and_silver
TAGS:   temple_overflow_2 temple_overflow_gozag temple_overflow_zin
TAGS:   transparent
KITEM:  $ = gold q:1 / gold q:2
KFEAT:  _ = altar_gozag
KFEAT:  O = altar_zin
TILE:   G = dngn_golden_statue
COLOUR: G = yellow
TILE:   v = dngn_metal_wall_white
COLOUR: v = white
FTILE:  +._O$ = floor_limestone
: set_feature_name("granite_statue", "golden statue")
: set_feature_name("metal_wall", "silver wall")
MAP
vvvvvvvvv
v..$$$..v
v._.$.O.v
v.......v
vv.....vv
 vvv+vvv
ENDMAP

NAME:   grunt_temple_overflow_forces_of_nature
TAGS:   temple_overflow_2 temple_overflow_fedhas temple_overflow_qazlal
TAGS:   transparent
MONS:   fungus / plant / bush
SUBST:  2 = 1.
KFEAT:  _ = altar_fedhas
KFEAT:  O = altar_qazlal
KPROP:  12Ll = no_tele_into
SUBST:  L = ll^.
SUBST:  l = cll.
: if you.depth() ~= dgn.br_depth(you.branch()) then
KFEAT:  ^ = shaft trap
: end
MAP
 222.@.LLL
21112.LlllL
21_.....OlL
21112.LlllL
 222.@.LLL
ENDMAP

NAME:   kennysheep_ying_yang
TAGS:   temple_overflow_2 temple_overflow_elyvilon temple_overflow_yredelemnul
TAGS:   no_monster_gen no_trap_gen no_pool_fixup patrolling transparent
KFEAT:  A = altar_elyvilon
KFEAT:  B = altar_yredelemnul
KFEAT:  D = tree
KFEAT:  '"wW = floor
TILE:   D = dngn_tree_dead
FTILE:  .t1ATW = floor_grass
COLOUR: tW = white
FTILE:  'D2BVw = floor_crypt
COLOUR: Dw = black
MAP
       """""""
     """""ccc"""
  """""""''Dccc"""
  "ccccccD''DDccc"
 ""ctttttcD'''DDc""
 "cct....tcD'''Dcc"
 "ct.www.TtD''''Dc""
""ct.wwwA.tD''''Dcc"
"cct.www.TtD'''''Dc"
"ct......tcD'''''Dc"
"ct.....tccD'''''Dc"
"ct.....tcD''''''Dc"
"ct.....tDV'WWW'DDc"
"cct....tD'BWWW'Dcc"
""ct....tDV'WWW'Dc""
 "cct...tcD''''Dcc"
 ""ctt...tcDDDDDc""
  "ccctt..tcccccc"
  """ccct.."""""""
    """ccc"""""
      """""""
ENDMAP

NAME:    palyth_temple_overflow_mages
TAGS:    temple_overflow_3 temple_overflow_sif_muna
TAGS:    temple_overflow_kikubaaqudgha temple_overflow_vehumet
TAGS:    no_item_gen no_monster_gen patrolling
# 3/5 chance for one altar to have a low-level randbook and extra orc wizards.
KMONS:   xyzXYZ~ = orc wizard
KFEAT:   xX = altar_sif_muna
KFEAT:   yY = altar_kikubaaqudgha
KFEAT:   zZ = altar_vehumet
KITEM:   X = randbook owner:Sif_Muna disc:summoning numspells:1 slevels:1
KITEM:   Y = randbook owner:Kikubaaqudgha disc:necromancy numspells:1 slevels:1
KITEM:   Z = randbook owner:Vehumet disc:conjuration numspells:1 slevels:1
SHUFFLE: x'y"z` / x'y"z` / X~y"z` / x'Y~z` / x'y"Z~
SUBST:   '"` = ., ~ = ~.
MAP
ccccccccccccc
c'x'c"y"c`z`c
c'''c"""c```c
cc+ccc+ccc+cc
c...........c
c....T.T....c
cc....T....cc
 cc..T.T..cc
  cc.....cc
   ccc@ccc
ENDMAP

# Xom seems to not think much of Hepliaklqana's ancestral focus,
# and mocks the species roots of incoming pilgrims.
# This will probably go over most players' heads, but it's neat anyway -- PF
NAME:    regret_index_temple_of_mockery
TAGS:    temple_overflow_2 temple_overflow_xom temple_overflow_hepliaklqana
# we place the monster on demand via a marker rather than in the builder because
# the dependency on the player species otherwise can affect seed stability
{{
    local los_marker = TriggerableFunction:new {
      func="callback.do_species_mock",
      repeated=true,
      props = {mock_location=1}
    }
    los_marker:add_triggerer(DgnTriggerer:new {
      type="player_los"})

    lua_marker('1', los_marker)
}}
KMONS:   2 = spectral ugly thing
KFEAT:   A = altar_xom
KFEAT:   B = altar_hepliaklqana
SHUFFLE: AB
SUBST:   G = G...
KPROP:   12' = no_tele_into
KMASK:   12' = no_item_gen
KMASK:   12' = no_trap_gen
KMASK:   ' = no_monster_gen
# TODO: this fog machine doesn't do much, is it supposed to spread?
MARKER:  2 = lua:fog_machine { cloud_type = "thin mist", \
             pow_min = 100, pow_max = 100, delay = 1, \
             size = 1, walk_dist = 0, start_clouds = 1 }
MAP
cccccc
ccb'bccccc
cb2n1bc.+.
c'nnnnc.c.
cb1nA...cc
ccbn.G.bc
cccc..Bcc
 c...bcc
 c+cccc
 c..c
ENDMAP

NAME:   gammafunk_temple_of_torment
WEIGHT: 2
TAGS:   no_monster_gen no_trap_gen temple_overflow_2
TAGS:   temple_overflow_kikubaaqudgha temple_overflow_yredelemnul
: if you.depth() <= 4 then
MONS: zombie / skeleton
MONS: mummy / shadow imp / wight / necrophage / phantom
KMONS: 3 = menkaure, necrophage / wight
SUBST: 2 = 2---
: elseif you.depth() <= 7 then
MONS: zombie / skeleton / mummy / shadow imp / wight / necrophage / phantom
MONS: wraith / vampire
KMONS: 3 = menkaure, wraith / vampire
SUBST: 2 = 12--
: else
MONS: mummy / wight / zombie / skeleton / phantom
MONS: wraith / vampire / shadow / w:5 death knight / w:5 skeletal warrior
MONS: flayed ghost / death knight
NSUBST: 2 = 2 / 2-
: end
SUBST:  1 = 11-
NSUBST: R = R / -
KFEAT:  D = altar_kikubaaqudgha
KFEAT:  E = altar_yredelemnul
MARKER: P = lua:transp_loc("temple_of_torment_entry")
MARKER: Q = lua:transp_dest_loc("temple_of_torment_entry")
MARKER: R = lua:transp_loc("temple_of_torment_exit")
MARKER: S = lua:transp_dest_loc("temple_of_torment_exit")
TILE:   G = dngn_sarcophagus_pedestal_left
TILE:   c = wall_tomb
FTILE:  -QRVDE|*$123Gcn = floor_tomb
COLOUR: G = yellow
COLOUR: -QR|*$123 = brown
: set_feature_name("granite_statue", "sarcophagus")
MAP
 ...............
 .nnnnnnnnnnnnn.
 .nR----1----Rn.
 .n-2-------2*n.
 .n--ccc-ccc-$n.
 .n--cGc-cGc-Dn.
..n----------|n..
@Pn1----Q---3YnS@
..n----------*n..
 .n--cGc-cGc-En.
 .n--ccc-ccc-$n.
 .n-2-------2|n.
 .nR----1----Rn.
 .nnnnnnnnnnnnn.
 ...............
ENDMAP

#Hep and Dith chose the same way to attract worshippers
NAME:   riverfiend_overflow_shadow_ancestor
TAGS:   temple_overflow_2
TAGS:   temple_overflow_hepliaklqana temple_overflow_dithmenos
KPROP:  12- = no_tele_into
KMASK:  12- = no_item_gen
KMASK:  12- = no_monster_gen
MONS:   ancestor, shadow
KFEAT:  A = altar_hepliaklqana
KFEAT:  B = altar_dithmenos
KFEAT:  DE = stone_wall
MARKER: 1 = lua:fog_machine { cloud_type = "thin mist", pow_min = 100, pow_max = 100, \
                            delay = 100, size = 1, start_clouds = 1 , spread_rate = 50 }
MARKER: 2 = lua:fog_machine { cloud_type = "black smoke", pow_min = 100, pow_max = 100, \
                            delay = 100, size = 1, start_clouds = 1 , spread_rate = 50 }
TILE:   D = wall_stone_smooth
TILE:   E = wall_stone_dark
MAP
   ccccc
 DDD...cEE
DD-n....nEE
D-1n....n-EE
D--nA..Bn2-E
DD-n....n--E
 DDD....n-EE
   cc@@cEEE
ENDMAP

NAME:   pdpol_temple_overflow_zin_treasury_gozag_greed
TAGS:   temple_overflow_2 temple_overflow_zin temple_overflow_gozag
TAGS:   no_item_gen no_monster_gen
KFEAT:  _ = altar_zin
KFEAT:  O = altar_gozag
KITEM:  O = wand of digging charges:1
KFEAT:  m = iron_grate
KPROP:  $ = no_tele_into
KITEM:  $ = gold q:1 / gold q:2
RTILE:  x = wall_sandstone
COLOUR: x = yellow
COLOUR: c = white
TILE:   c = wall_church
FTILE:  _.m+c$ = floor_limestone
: interest_check(_G)
MAP
  ccccccxxxxx
 cc..mm$x...xx
@+.._m$$x.O..+@
 cc..mm$x...xx
  ccccccxxxxx
ENDMAP

NAME:    nzn_overflow_gifts_of_might_and_magic
TAGS:    temple_overflow_2 temple_overflow_trog temple_overflow_sif_muna
TAGS:    no_item_gen no_monster_gen patrolling
SHUFFLE: D1-/E2'
COLOUR:  1- = red
COLOUR:  2' = blue
KFEAT:   D = altar_trog
KFEAT:   E = altar_sif_muna
: local egos = {["antimagic"] = 1, ["vorpal"] = 2, ["flaming"] = 2}
: if you.absdepth() <= 3 then
{{
local enchant = 2 + (crawl.one_chance_in(3) and 1 or 0)
local weapons = {["spear"] = 1, ["hand axe"] = 1, ["mace"] = 1,
                 ["falchion"] = 1}
kitem("1 = " .. dgn.random_item_def(weapons, nil, "ego:none plus:" .. enchant))
}}
KMONS:   1 = gnoll ; animal skin / w:2 Terence
KMONS:   2 = white imp / w:2 Jessica
KITEM:   2 = randbook owner:Sif_Muna numspells:1 slevels:1
: elseif you.absdepth() <= 7 then
:     if crawl.one_chance_in(5) then
KMONS:   1 = duvessa
KMONS:   2 = dowan
:     else
KMONS:   1 = orc warrior
KMONS:   2 = orc wizard
:     end
{{
local weapons = {["trident"] = 1, ["war axe"] = 1, ["flail"] = 1,
                 ["long sword"] = 1}
kitem("1 = " .. dgn.random_item_def(weapons, egos, "plus:0"))
}}
KITEM:   2 = randbook owner:Sif_Muna numspells:2 slevels:2
: else
KMONS:   1 = troll
KMONS:   2 = ynoxinul
{{
local weapons = {["trident"] = 1, ["war axe"] = 1, ["morningstar"] = 1,
                 ["scimitar"] = 1}
kitem("1 = " .. dgn.random_item_def(weapons, egos, "plus:0"))
}}
KITEM:   2 = randbook owner:Sif_Muna numspells:3 slevels:4
: end
MAP
     xx@@@x
    xx...xx
   xx...xxxxx
  xx...xx-D-x
 xx...xxx-1-x
xx...xAx...xx
x'2'xxx...xx
x'E'xx...xx
xxxxx...xx
  xx...xx
  x@@@xx
ENDMAP

### Variable overflow altars ##################################################

# To make an overflow temple for N altars, give it the tag
# "temple_overflow_generic_N".

# The boring standard.
# B places the altar to a guaranteed god.
NAME:   overflow_temple_1_default
TAGS:   temple_overflow_generic_1 allow_dup transparent
MAP
B
ENDMAP

# General overflow vault, can be used for all gods.
NAME:     general_overflow_altar
WEIGHT:   10
TAGS:     no_monster_gen no_pool_fixup temple_overflow_generic_1
SHUFFLE:  xXY / xXY / xXY / abc
SHUFFLE:  XY
SUBST:    X=+, Y=x, a=w, b=w, c=w
SHUFFLE:  ABCD
SUBST:    A=>, C='GTU, D='
SHUFFLE:  wll
KMASK:    . = !opaque
MAP
........
.xXYYxx.
.xwwwwx.
.xwABwx.
.xwCDwx.
.xwwwwx.
.xxxxxx.
........
ENDMAP

NAME:    old_standard_altar
TAGS:    transparent allow_dup decor temple_overflow_generic_1
SHUFFLE: cvxxxx
MAP
...........
.xxxx.xxxx.
.xx.....xx.
.x.......x.
.x.......x.
.....B.....
.x.......x.
.x.......x.
.xx.....xx.
.xxxx.xxxx.
...........
ENDMAP

NAME:    lemuel_round_altar
TAGS:    allow_dup transparent decor temple_overflow_generic_1
SUBST:   X:x@
SHUFFLE: cvxx
MAP
   xxXxx
  xx...xx
 xx.....xx
 x.......x
 X...B...@
 x.......x
 xx.....xx
  xx...xx
   xxXxx
ENDMAP

NAME:  lemuel_crystal_altar
TAGS:  transparent allow_dup decor temple_overflow_generic_1
MAP
b@b
@B@
b@b
ENDMAP

NAME:    lemuel_doored_altar
TAGS:    transparent decor temple_overflow_generic_1
SHUFFLE: XY
SUBST:   X = .
SUBST:   Y = +
MAP
.........
.xxxmxxx.
.xxxmxxx.
.xxxmxxx.
.X.YBY.X.
.xxxYxxx.
.xxx.xxx.
.xxxXxxx.
.........
ENDMAP

NAME:   lemuel_coloured_pillars_altar
TAGS:   no_rotate decor temple_overflow_generic_1
COLOUR: c = blue / yellow / red / cyan
MAP
xxxxxxxxxxxxxxxxxxxx
...................x
c...c...c...c...c..x
@.................Bx
c...c...c...c...c..x
...................x
xxxxxxxxxxxxxxxxxxxx
ENDMAP

NAME: nicolae_overflow_crystal_walls
TAGS: temple_overflow_generic_1 transparent
SHUFFLE: ACDE, FGHI
SUBST: A : b, C : b., D : b., E : b., F : b, G : b., H : b., I : b.
MAP
AAAAA@FFFFF
ACCCC.GGGGF
ACDDD.HHHGF
ACDEE.IIHGF
ACDE...IHGF
@....B....@
FGHI...EDCA
FGHII.EEDCA
FGHHH.DDDCA
FGGGG.CCCCA
FFFFF@AAAAA
ENDMAP

NAME:    marbit_many_paths
TAGS:    temple_overflow_generic_1
SHUFFLE: pqr / bqr / pbr / pqb / bbr / pbb / bqb
SUBST:   pqr = .
NSUBST:  . = 1:0 / *:.
FTILE:   .B0 = FLOOR_PEBBLE_GREEN
MAP
 xxxxxxxxx
xx..qxq..xx
xpqrpqrpqrxx
@qrpqrpqrpBx
xrpqrpqrpqxx
xx..pxp..xx
 xxxxxxxxx
ENDMAP

NAME:  lemuel_tele_altar
TAGS:  temple_overflow_generic_1 transparent decor
SUBST: D = ^ x
KFEAT: ^ = teleport trap
KMASK: 'B = opaque
MAP
...........
.xxxx^xxxx.
.x'''''''x.
.x'''''''x.
.x'''''''x.
.D'''B'''D.
.x'''''''x.
.x'''''''x.
.x'''''''x.
.xxxxDxxxx.
...........
ENDMAP

NAME:  pf_just_have_faith
WEIGHT: 1
TAGS: no_monster_gen temple_overflow_generic_1
KMASK: $ = no_trap_gen
KFEAT: m = lava mimic
# We use a statue mimic to stop autoexplore before the player reaches the lava.
KFEAT: G = granite_statue mimic
# The gold pulls an unspoiled player next to the mimics.
KITEM: $ = gold q:3
MAP
xxxxx
xl.lx
x.B.x
x.$.x
xlmlx
xl$lx
xlmlx
x.$.x
x.G.x
..@..
ENDMAP

NAME:   amcnicky_altar_gilded
TAGS:   transparent no_monster_gen temple_overflow_generic_1
SUBST: p = . $:5
SUBST: q = . $:2
MAP
.........
.mmmmmmm.
.mqqqqqm.
.mqpppqm.
.+qpBpqm.
.mqpppqm.
.mqqqqqm.
.mmmmmmm.
.........
ENDMAP

NAME:   mainiacjoe_overflow_brackets
TAGS:   temple_overflow_generic_1 transparent
SUBST:  c : cnvbt
NSUBST: w = 1:. / *:w
SUBST:  w : wl
KMASK:  lw = no_monster_gen
KMASK:  w = no_pool_fixup
MAP
...........
.wwwwwwwww.
.w.......w.
.w.ccccc.w.
.w.c.....w.
.w.c.B.c.w.
.w.....c.w.
.w.ccccc.w.
.w.......w.
.wwwwwwwww.
...........
ENDMAP

NAME:  mainiacjoe_overflow_boulevard
TAGS:  temple_overflow_generic_1 transparent
SUBST: P : cnvbtwl123
SUBST: Q : cnvbtwl123
MONS:  plant, bush, fungus
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
.............................
@.PPPP..QQQQ..B..QQQQ..PPPP.@
.............................
ENDMAP

NAME:  mainiacjoe_overflow_six_doors_small
TAGS:  temple_overflow_generic_1 transparent
SUBST: c : cvbt
SUBST: P : cnvbtwl
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
cccc+cccc
+.......+
c.P...P.c
c.P.B.P.c
c.P...P.c
+.......+
cccc+cccc
ENDMAP

NAME:  mainiacjoe_overflow_tiny_flanked
TAGS:  temple_overflow_generic_1 transparent
SUBST: P : cnvbtwl123
MONS:  plant, bush, fungus
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
.......
.P.B.P.
.......
ENDMAP

NAME:   mainiacjoe_overflow_cross_hatched
TAGS:   temple_overflow_generic_1 transparent
SUBST:  p : cnvbtwl123
MONS:   plant, bush, fungus
KMASK:  wl = no_monster_gen
KMASK:  w = no_pool_fixup
MAP
...........
.p.ppppp.p.
.p.......p.
.p.p...p.p.
.p.p.B.p.p.
.p.p...p.p.
.p.......p.
.p.ppppp.p.
...........
ENDMAP

NAME:  mainiacjoe_overflow_chevrons
TAGS:  temple_overflow_generic_1
SUBST: c : cvbn
SUBST: p : cnvbtwl123
SUBST: q : cnvbtwl123G
MONS:  plant, bush, fungus
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
...........
...........
..ppppppp..
..ppppppp..
..pp.......
..pp.......
..pp..qqqq.
..pp..q....
..pp..q.B..
......q....
...........
ENDMAP

NAME:  mainiacjoe_overflow_24_doors
TAGS:  temple_overflow_generic_1 transparent
SUBST: c : xcvb
MAP
ccc+cc+cc+ccc
c.....c.....c
c.....c.....c
+cc+cc+cc+cc+
c..c.....c..c
c..c+ccc+c..c
c..c.....c..c
+..+..B..+..+
c..c.....c..c
c..c+ccc+c..c
c..c.....c..c
+cc+cc+cc+cc+
c.....c.....c
c.....c.....c
ccc+cc+cc+ccc
ENDMAP

NAME:   mainiacjoe_overflow_surrounded_room
TAGS:   temple_overflow_generic_1 transparent
SUBST:  c : cvb
MAP
    .......
.....ccccc.....
.ccccc...ccccc.
.+.....B.....+.
.ccccc...ccccc.
.....ccccc.....
    .......
ENDMAP

NAME:  mainiacjoe_overflow_alcove_1
TAGS:  temple_overflow_generic_1 transparent
SUBST: c : xcvbt
MAP
ccccccc
c.....c
c..B..c
cc@@@cc
ENDMAP

NAME:  mainiacjoe_overflow_alcove_2
TAGS:  temple_overflow_generic_1 transparent
SUBST: c : xcvb
SUBST: G : GTUV
MAP
ccccccc
c.....c
c..B..c
c.....c
cGc.cGc
ccc@ccc
ENDMAP

NAME:  mainiacjoe_overflow_alcove_4
TAGS:  temple_overflow_generic_1 transparent
SUBST: c : xcnvb
SUBST: p : cnvbt123wl
MONS:  plant, bush, fungus
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
ccccccccc
c.......c
c.p.B.p.c
c.p...p.c
c.ppppp.c
c.......c
ccc+++ccc
ENDMAP

NAME:    mainiacjoe_overflow_concentric_impassable
TAGS:    temple_overflow_generic_1 transparent
NSUBST:  l = 1:. / *:l
NSUBST:  w = 1:. / *:w
KMASK:   wl = no_monster_gen
KMASK:   w = no_pool_fixup
SHUFFLE: wl
MAP
...........
.lllllllll.
.l.......l.
.l.wwwww.l.
.l.w...w.l.
.l.w.B.w.l.
.l.w...w.l.
.l.wwwww.l.
.l.......l.
.lllllllll.
...........
ENDMAP

NAME:  mainiacjoe_overflow_catwalk
TAGS:  temple_overflow_generic_1
TAGS:  transparent
SUBST: l : lw
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
..........
..lllllll.
.llllll...
.llB....G.
.llllll...
..lllllll.
..........
ENDMAP

NAME:   mainiacjoe_overflow_paths
TAGS:   temple_overflow_generic_1 transparent
SUBST:  c : xcbvt
SUBST:  w : lw
KMASK:  wl = no_monster_gen
KMASK:  w = no_pool_fixup
MAP
@ccccccccc@
c..wwwww..c
c.w.....w.c
c.w.www.w.c
c.ww...ww.c
c.ww.B.ww.c
c.ww...ww.c
c.w.www.w.c
c.w.....w.c
c..wwwww..c
@ccccccccc@
ENDMAP

NAME:   mainiacjoe_overflow_small_starburst
TAGS:   temple_overflow_generic_1 transparent
SUBST:  c : cvbtwl
KMASK:  w = no_pool_fixup
KMASK:  wl = no_monster_gen
MAP
  .........
 ...cc.cc...
..c..c.c..c..
..cc.....cc..
......B......
..cc.....cc..
..c..c.c..c..
 ...cc.cc...
  .........
ENDMAP

NAME:   amethyst_overflow_temple_binary
TAGS:   temple_overflow_generic_2
SUBST:  p : .:15 c:10 g:3 n:2
SUBST:  G : G:20 T:10 U:1 .:1
SUBST:  g : t:10 T:10 .:5 w:5 U:1 l:1
SUBST:  c : c:20 x:5 v:1 b:1
SUBST:  + : +:10 .:10 A:5
KMASK:  TUw = no_monster_gen
MAP
  ccc     ccc
 ccGcccccccGcc
cc...ccgcc...cc
cB.p..+.+..p.Bc
cc...cc.cc...cc
 ccGccg.gccGcc
  ccccc+ccccc
       @
ENDMAP

NAME:   gammafunk_temple_overflow_statue
TAGS:   temple_overflow_generic_2
SUBST:  g : t:10 T:10 .:5 w:5 l:5 U:1
KMASK:  wlTU = no_monster_gen
MAP
  ccc
cccGccc
c.B.B.c
cc...cc
ccg.gcc
 cc+cc
   @
ENDMAP

NAME:   gammafunk_temple_overflow_pools
TAGS:   temple_overflow_generic_2
SUBST:  G : G:20 T:10 U:1 .:1
KMASK:  TU = no_monster_gen
MAP
 ccccc ccccc
cc.B.ccc.B.cc
c.....G.....c
c..T.....T..c
cc.........cc
 ccc.....ccc
   ccc+ccc
      @
ENDMAP

NAME:    gammafunk_temple_overflow_elements
TAGS:    temple_overflow_generic_2
SHUFFLE: lw
KMASK:   lw = no_monster_gen
MAP
 ccccccc
ccB...Bcc
cclc+cwcc
 ccc@ccc
ENDMAP

NAME:    gammafunk_temple_overflow_wave
TAGS:    temple_overflow_generic_2
SUBST:   p = G:20 c:20 1 w:5 l:5
MONS:    plant / bush
KMASK:   Twl = no_monster_gen
MAP
   ccccc
 cccpcc
ccTB.+@
ccTB.+@
 cccpcc
   ccccc
ENDMAP

NAME:    jmf_multi_god_temple
TAGS:    transparent temple_overflow_generic_2
SHUFFLE: abc
SUBST:   a:+, b:x, c:x
MAP
............
.axxxxxxxxa.
.x........x.
.bT......Tb.
.x..B..B..x.
.cT......Tc.
.xxxxmmxxxx.
.xxx$$$$xxx.
.xx0....0xx.
..xx....xx..
...xG..Gx...
............
ENDMAP

NAME:  jmf_multi_god_temple2
TAGS:  transparent temple_overflow_generic_2
MAP
............
..vvvvvvvv..
.vv......vv.
.v..x..x..v.
.v.Bx..xB.v.
.v..x..x..v.
.vT0x..x0Tv.
.vvvx==xvvv.
...Gx..xG...
...+....+...
...GxxxxG...
............
ENDMAP

NAME:   mainiacjoe_overflow_catch_the_wave
TAGS:   temple_overflow_generic_2 transparent
NSUBST: p = 1:@ / *:.
NSUBST: q = 1:@ / *:.
SUBST:  b : cvbtwl123
MONS:   plant, bush, fungus
MAP
              .......
            ...bbbbb...
    ... .....bbb...bbb...
.....B...bbbbb......bbbb.
.bbb...bbb......bbb....b.
..bbbbbb......bbbbbb.....
....bbb...bbbbbb...bbbb..
.b......bbbbbb...B...bbb.
.bbb...bbb..... ... .....
...bbbbb...
  .......
ENDMAP

NAME:  mainiacjoe_overflow_two_lobes
TAGS:  temple_overflow_generic_2 transparent
SUBST: l : lwn
SUBST: b : bvt
KMASK: w = no_pool_fixup
KMASK: wl = no_monster_gen
MAP
  cccccc        cccccc
 cc....ccc    ccc....cc
 c.......cc  cc.......c
cc.bbb....c  c....bbb.cc
c....bbb..cccc..bbb....c
c......bb..ll..bb......c
c...B...b..ll..b...B...c
c......bb..ll..bb......c
c....bbb..+cc+..bbb....c
cc.bbb....c@@c....bbb.cc
 c.......cc  cc.......c
 cc....ccc    ccc....cc
  cccccc        cccccc
ENDMAP

NAME:  mainiacjoe_overflow_catwalk_spiral
TAGS:  temple_overflow_generic_2 transparent
SUBST: w : wl
KMASK: w = no_pool_fixup
KMASK: wl = no_monster_gen
MAP
...............
.wwwww.wwwwwww.
.w.....w.....w.
.w.wwwww.www.w.
.w.w...w.wBw.w.
.w.w.w.w.w.w.w.
.w.wBw.w...w.w.
.w.www.wwwww.w.
.w.....w.....w.
.wwwwwww.wwwww.
...............
ENDMAP

NAME:  mainiacjoe_overflow_big_doors
TAGS:  temple_overflow_generic_2 transparent
SUBST: c : cvb
SUBST: p : nvbtwl123G
MONS:  plant, bush, fungus
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
cccccc+++cccccc
c...+.....+...c
c.B.+.ppp.+.B.c
c...+.....+...c
cccccc+++cccccc
ENDMAP

NAME:  mainiacjoe_overflow_swirl
TAGS:  temple_overflow_generic_2 transparent
SUBST: c : cvb
MAP
       ccccc
       c...c
       c.B.c
 +cccccc...c
 c...c.ccc.c
 c.c.c....cc
 c.c...cc.c
 c.cc...c.c
cc....c.c.c
c.ccc.c...c
c...cccccc+
c.B.c
c...c
ccccc
ENDMAP

NAME:  mainiacjoe_overflow_divided_tiny
TAGS:  temple_overflow_generic_2 transparent
SUBST: c : xcvb
SUBST: l : wl
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
+cccccccc
c...l...c
c.B.l.B.c
c...l...c
cccccccc+
ENDMAP

NAME:  mainiacjoe_overflow_large_starburst
TAGS:  temple_overflow_generic_2 transparent
SUBST: b : cnvbtwl
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
.............
.b.bbb.bbb.b.
.b...b.b...b.
.bbb.b.b.bbb.
...b.b.b.b...
.B.........B.
...b.b.b.b...
.bbb.b.b.bbb.
.b...b.b...b.
.b.bbb.bbb.b.
.............
ENDMAP

NAME: minmay_overflow_temple_star_quad
TAGS: temple_overflow_generic_3
MAP
           c
           c
          ccc
          cBc
         cc.cc
         c...c
        cc...cc
        c.....c
      ccc.....ccc
    ccc....G....ccc
  ccc......c......ccc
cccB.....GcccG.....Bccc
  ccc......c......ccc
    ccc....G....ccc
      ccc.....ccc
        c.....c
        cc...cc
         c...c
         cc.cc
          c.c
          c+c
           @
ENDMAP

NAME:   gammafunk_temple_overflow_forgotten
TAGS:   temple_overflow_generic_3
SUBST:  p = x:50 . 1, T = V:30 T, + = +:20 .
NSUBST: _ = 3:1 / *:_
MONS:   plant / bush
KMASK:  T = no_monster_gen
TILE:   x = wall_brick_brown_vines
FTILE:  _+T12B = floor_pebble_yellow
MAP
 ppppppp
pxB_B_Bxp
p_______p
p___T___p
px_____xp
 xxx+xxx
    @
ENDMAP

NAME:   grunt_temple_overflow_diamond
TAGS:   temple_overflow_generic_3
SUBST:  T = T G V:1 U:1 t:1
MAP
      c
     ccc
    ccBcc
   cc...cc
  cccc+cccc
 cc.c...c.cc
ccB.+.T.+.Bcc
 cc.c...c.cc
  cccc+cccc
   cc...cc
    cc.cc
     c.c
      @
ENDMAP

NAME:   gammafunk_temple_overflow_claw
TAGS:   temple_overflow_generic_3 transparent
SUBST:  l : lw
KMASK:  lw = no_monster_gen
MAP
  ...........
 ..cc..c..cc..
..cc..ccc..cc..
.ccc..ccc..ccc.
.ccc.ccccc.ccc.
.ccccccGcccccc.
.ccGB..B..BGcc.
..ccl.....lcc..
..ccll...llcc..
 ..ccll.llcc..
  ..ccl.lcc..
   ..cc+cc..
    ...@...
ENDMAP

NAME:   grunt_temple_overflow_cloverleaf
TAGS:   temple_overflow_generic_4 transparent
SUBST:  T : T U:1 V:1
MAP
 ccccc.@.ccccc
cc...cc.cc...cc
c.G.G.c.c.G.G.c
c..B..c.c..B..c
c.G...c.c...G.c
cc...+c.c+...cc
.ccccc...ccccc.
@......T......@
.ccccc...ccccc.
cc...+c.c+...cc
c.G...c.c...G.c
c..B..c.c..B..c
c.G.G.c.c.G.G.c
cc...cc.cc...cc
 ccccc.@.ccccc
ENDMAP

NAME: nicolae_overflow_quartered_altars
TAGS: temple_overflow_generic_4
SHUFFLE: fgh/ijk, pq/rs
SUBST: pqi = ., rk = c, s = +, z : cm, j : GTt
CLEAR: fgh
MAP
  ffghgff
 @.ccccc.@
f.qp.c.pq.f
fcp..z..pcf
gc..BcB..cg
hcczccczcch
gc..BcB..cg
fcp..z..pcf
f.qp.c.pq.f
 @.ccccc.@
  ffghgff
ENDMAP

NAME:  mainiacjoe_overflow_alcove_3
TAGS:  temple_overflow_generic_4 transparent
SUBST: c : xcvb
SUBST: p : cnvbt123wl
MONS:  plant, bush, fungus
KMASK: wl = no_monster_gen
KMASK: w = no_pool_fixup
MAP
ccccccc
cB.c.Bc
c.....c
cc.p.cc
c..p..c
cB...Bc
ccc@ccc
ENDMAP

NAME:   minmay_overflow_temple_star_hex
TAGS:   temple_overflow_generic_5
KMASK:  T = no_monster_gen
MAP
          ccc
         ccBcc
        cc...cc
       cc.....cc
cccccccc...G...cccccccc
cB...................Bc
ccc......G...G......ccc
  ccc.............ccc
    ccc....T....ccc
  ccc.............ccc
ccc......G...G......ccc
cB...................Bc
cccccccc...G...cccccccc
       cc.....cc
        cc...cc
         cc.cc
          c+c
          ...
          .@.
ENDMAP

NAME:   minmay_overflow_temple_hex
TAGS:   temple_overflow_generic_6
MAP
   cccccccccc
   cB......Bc
  cc........cc
  c...c..c...c
 cc..........cc
 c...c....c...c
cc............cc
cB..c......c..Bc
cc............cc
 c...c....c...c
 cc..........cc
  c...c..c...c
  cc........cc
   cB......Bc
   cccc++cccc
      ....
      ....
      .@@.
ENDMAP

NAME:  grunt_temple_overflow_octagram
TAGS:  temple_overflow_generic_7
SUBST: T : T G t V:1
MAP
          c
         ccc
        ccBcc
   cccccc...cccccc
   cB..ccc+ccc..Bc
   c..cc.....cc..c
   c.c+.......+c.c
   ccc....T....ccc
  ccc...T...T...ccc
 cc.c...........c.cc
ccB.+..T..T..T..+.Bcc
 cc.c...........c.cc
  ccc...T...T...ccc
   ccc....T....ccc
   c.c+.......+c.c
   c..cc.....cc..c
   cB..ccc+ccc..Bc
   cccccc...cccccc
        cc.cc
         c.c
          @
ENDMAP

NAME:    grunt_temple_overflow_open
TAGS:    temple_overflow_generic_8 temple_overflow_generic_7
TAGS:    temple_overflow_generic_6 temple_overflow_generic_5
TAGS:    temple_overflow_generic_4 temple_overflow_generic_3
TAGS:    temple_overflow_generic_2
TAGS:    transparent
SHUFFLE: defghijk / efghijkd
{{
  local altarcount = 1
  if is_validating() then
    altarcount = 8
  else
    altarcount = get_overflow_altar_count(_G)
  end
  if altarcount == "1" then
    subst("d = B")
    subst("efghijk = .")
  elseif altarcount == "2" then
    subst("dh = B")
    subst("efgijk = .")
  elseif altarcount == "3" then
    subst("dgi = B")
    subst("efhjk = .")
  elseif altarcount == "4" then
    subst("dfhj = B")
    subst("egik = .")
  elseif altarcount == "5" then
    subst("dfgij = B")
    subst("ehk = .")
  elseif altarcount == "6" then
    subst("defhij = B")
    subst("gk = .")
  elseif altarcount == "7" then
    subst("defghij = B")
    subst("k = .")
  else
    subst("defghijk = B")
  end
}}
SUBST: G = G T V:1 U:1 t:1
MAP
   ...
 ...d...
 .k...e.
.........
.j..G..f.
.........
 .i...g.
 ...h...
   ...
ENDMAP

# Formerly minivault_3; resurrected after being removed way back in late 2009.
NAME:  minitemple
TAGS:  temple_overflow_generic_14 temple_overflow_generic_13
TAGS:  temple_overflow_generic_12 temple_overflow_generic_11
TAGS:  temple_overflow_generic_10 temple_overflow_generic_9
TAGS:  temple_overflow_generic_8 temple_overflow_generic_7
TAGS:  temple_overflow_generic_6 temple_overflow_generic_5
TAGS:  temple_overflow_generic_4 temple_overflow_generic_3
TAGS:  temple_overflow_generic_2
# The original vault had allow_dup; I think that's overkill.
{{
  local altarcount = get_overflow_altar_count(_G)
  if is_validating() or altarcount == nil then
    altarcount = 14
  end
  nsubst("B : " .. altarcount .. ":B / *:x")
}}
SUBST: x = .:50 c:50 G T t:1 V:1 U:1
MAP
cccccccccccc
cBcBcBcBcBcc
G.c.c.c.c.Bc
@.........Bc
@.........Bc
G.c.c.c.c.Bc
cBcBcBcBcBcc
cccccccccccc
ENDMAP

NAME: nicolae_overflow_hidden_temple
TAGS: temple_overflow_generic_5 temple_overflow_generic_4 temple_overflow_generic_3 \
      temple_overflow_generic_2 temple_overflow_generic_1 no_monster_gen
{{
  local altarcount = 1
  if is_validating() then
    altarcount = 5
  else
    altarcount = get_overflow_altar_count(_G)
  end
  if altarcount == "1" then
    subst("c = B")
    subst("abde = G")
  elseif altarcount == "2" then
    subst("bd = B")
    subst("ace = G")
  elseif altarcount == "3" then
    shuffle("ae/bd")
    subst("cbd = B")
    subst("ae = G")
  elseif altarcount == "4" then
    subst("abde = B")
    subst("c = G")
  else
    subst("abcde = B")
  end
}}
SUBST: } = })]
MAP
 xxxxxxxxxxxxx
 xxxxaxxxbxxxx
 xxG...G...Gxx
 mm.........mm
@m}.........cm@
 mm.........mm
 xxG...G...Gxx
 xxxxexxxdxxxx
 xxxxxxxxxxxxx
ENDMAP

NAME:   chequers_temple_overflow_statue_of_worship
TAGS:   temple_overflow_generic_2 temple_overflow_generic_3
TAGS:   temple_overflow_generic_4 transparent
{{
  local altarcount = get_overflow_altar_count(_G)
  if altarcount == nil then
    altarcount = "2"
  end
  if altarcount == "2" then
    subst("C = .")
  else
    subst("C = B")
  end
  nsubst("B = " .. altarcount .. ":B / *:.")
}}
MAP
.....
..C..
.BGB.
..C..
.....
ENDMAP

NAME:  chequers_temple_overflow_minitemple
TAGS:  temple_overflow_generic_5 temple_overflow_generic_4
TAGS:  temple_overflow_generic_3
{{
  local altarcount = get_overflow_altar_count(_G)
  if is_validating() or altarcount == nil then
    altarcount = 5
  end
  nsubst("O = " .. altarcount .. ":B / *:l")
}}
KFEAT: l = altar_ecumenical
MAP
        @
       c+c
   ccccc.ccccc
  cc.........cc
ccc..ccccccc..ccc
cO..cccO.Occc..Oc
ccc..cc...cc..ccc
  cc.........cc
   cccc...cccc
      ccOcc
       ccc
ENDMAP

NAME: gammafunk_temple_overflow_arena
TAGS: temple_overflow_generic_3 temple_overflow_generic_2
TAGS: temple_overflow_generic_1 no_monster_gen no_trap_gen no_tele_into
WEIGHT: 1
{{
  local altarcount = 3
  if not is_validating() then
    altarcount = tonumber(get_overflow_altar_count(_G))
  end
  if altarcount == 1 then
    subst("h = a")
  elseif altarcount == 2 then
    subst("B = a")
  end
}}
SUBST: a = |*%$ .:80, 0 = 09., h = B, i : x., j : x., x : bcvx
NSUBST: R = R / .
MARKER: P = lua:transp_loc("temple_overflow_arena_entry")
MARKER: Q = lua:transp_dest_loc("temple_overflow_arena_entry")
MARKER: R = lua:transp_loc("temple_overflow_arena_exit")
MARKER: S = lua:transp_dest_loc("temple_overflow_arena_exit")
MAP
  ...........
 ..nnnnnnnnn..
 .nn0..R...nn.
 .nG.ji0ij.Gn.
 .n..ij.ji%$n.
..n......8*hn..
@Pn..Q....$BnS@
..n......9*hn..
 .n..ij.ji%$n.
 .nG.ji0ij.Gn.
 .nn0..R...nn.
 ..nnnnnnnnn..
  ...........
ENDMAP
