###############################################################################
# altar.des: This contains most of the generic altar vaults.
#            All vaults in this file focus on the altar, in particular, all
#            maps are rather small.
#            Some maps containing altars should *not* go in this file.
#            These are
#            * Vaults placing in D with Temple god altars.
#              These should be overflow vaults instead, to give the dungeon
#              builder control over early altar placement.
#            * Ecumenical altar vaults for D:1-3.
#              Use ecumenical.des
#            * Branch-specific vaults
#              (Beogh altar minivaults for Orc, for example)
#              These go into the corresponding des-file of the branch.
#            * Entry vaults with altars
#              Don't make these, they encourage startscumming.
#            * Overflow altars.
#              (I.e. altars dedicated to Temple gods which can be used if the
#              gods do not show up in the Temple).
#              Use overflow.des.
#            * Large non-overflow vaults.
#              These are vaults where the altar is used for thematic reasons.
#              Use a file in the variable/ directory.
#
#            For a particularly elaborate altar map, using lots of lua, use a
#            single, new file.
#
# Content:
# I   General altars (containing a single C) placing outside of D
# II  Altars to minor gods
#
###############################################################################

##############################################################################
# I   General altars (containing a single C)
##############################################################################

# The D:2 chance placement is the only non-overflow-temple non-ecumenical
# altar in D and is part of early-game altar distribution. The remaining
# placements are more decorative.
NAME:   basic_altar
TAGS:   allow_dup extra no_monster_gen transparent decor
DEPTH:  1-
CHANCE: 20% (D:2)
CHANCE: 20% (Orc)
CHANCE: 10% (Snake)
CHANCE: 8% (Elf)
CHANCE: 5% (Lair, Slime, Crypt)
CHANCE: 1% (Zot)
CHANCE: 0
MAP
.....
.....
..C..
.....
.....
ENDMAP

NAME:   lemuel_altar_in_water
DEPTH:  Swamp, Shoals
WEIGHT: 9
TAGS:   transparent no_monster_gen no_rotate decor extra no_descent
: local brnd = crawl.random2(13)
: if not is_validating() and brnd <= 10 then
TAGS:   no_pool_fixup
: end
KPROP:  C = no_tele_into
KMASK:  C = opaque
MAP
   .........
  ...wwwww...
 ..wwwwwwwww..
..wwwwwwwwwww..
.wwwwwwwwwwwww.
.wwwwwwCwwwwww.
.wwwwwwwwwwwww.
..wwwwwwwwwww..
 .wwwwwwwww..
 ...wwwww...
   ........
ENDMAP

NAME:   lemuel_altar_in_water2
TAGS:   no_pool_fixup no_monster_gen decor extra transparent
DEPTH:  Lair, Snake, Swamp, Shoals
WEIGHT: 1
MAP
   www
  wwwww
 wwwwwww
 @..Cwww
 wwwwwww
  wwwww
   www
ENDMAP

NAME:  lemuel_oklob_altar
TAGS:  transparent
DEPTH: Lair, Snake, Shoals
MONS:  oklob plant, plant
MAP
 2
2C1
 2
ENDMAP

NAME:  lemuel_statue_altar
TAGS:  transparent decor extra
DEPTH: Orc, Depths, Elf, Crypt
SUBST: F = G:99 F:1
: if you.in_branch("Orc") then
KMONS: F = orange crystal statue / obsidian statue / ice statue
: else
KMONS: F = orange crystal statue
: end
KMASK: _>C = opaque
MAP
.........
.ccccccc.
.F___>Cc.
.ccccccc.
.........
ENDMAP

NAME:   lemuel_upstairs_altar
TAGS:   extra no_descent
DEPTH:  Elf, !Elf:$, Crypt, !Crypt:$
ORIENT: float
SUBST:  T:T., )=)}], c:ccx
KMASK:  T = no_monster_gen
MAP
ccccccc
cT...Tc
c.....ccccccc
c..C..+....)c
c.....ccccccc
cT...Tc
ccccccc
ENDMAP

# This is the generic version. A special version may occur for Orc, almost always
# to Beogh. Only one of these can come up.
NAME:  david_defended_altar_elf
DEPTH: Elf
MONS:  patrolling deep elf pyromancer / w:30 nothing
TAGS:  uniq_defended_altar transparent
MAP
ccccc...
c1..c...
c1C.+.G@
c1..c...
ccccc...
ENDMAP

# The mix of deep and shallow water is intended to keep the centaurs from
# escaping without requiring the player to be able to cross deep water.
NAME:  lemuel_centaur_altar
DEPTH: Shoals, Lair
TAGS:  no_pool_fixup no_monster_gen
MONS:  patrolling centaur
MAP
xxxxxxxxxxxxx
xxxxxxxxxxwxx
xxwx.1.1.xxwx
xwxx1.C.1xwwx
xwwxWwwWwWwxx
xwwWwwwwwwxxx
xxwWwWWwwWxxx
xxxwWwwWwxxxx
xxxwwwWwWxxxx
xxx...@..xxxx
ENDMAP

NAME:  lemuel_angel_altar
DEPTH: Depths
TAGS:  no_trap_gen no_descent
MONS: patrolling Daeva / patrolling Angel
KFEAT:  n = iron_grate
KFEAT: _ = altar_elyvilon / altar_zin / altar_the_shining_one
KPROP: >"1_ = no_tele_into
KMASK: . = !opaque
MAP
   .....
  ..cnc..
 ..xc>cx..
..xxc"cxx..
.ccc=1cccc.
.n>""_"">n.
.cccc"cccc.
..xxc"cxx..
 ..xc>cx..
  ..cnc..
   .....
ENDMAP

##############################################################################
# II   Altars to minor gods
#
# These are non-Temple gods like Beogh, Jiyva, Lugonu.
##############################################################################

### Altars possibly to Lugonu ################################################

# Hell themed, to Lugonu, Yredelemnul, Kikubaaqudgha or Makhleb
# Note: This altar would not make a decent overflow altar, it is too hard to
#       access the altar early.
#
NAME:  lemuel_hellish_altar
DEPTH: Crypt, Geh
TAGS:  no_monster_gen no_descent
MONS:  rust devil / orange demon
MONS:  hell beast / red devil
MONS:  iron imp
MONS:  hellion
KPROP: 1234_ = no_tele_into
SUBST: 2 = 23
SUBST: 2 = 12
SUBST: 3 = 3L
: if you.absdepth() >14 then
SUBST: 1 = 1:20 4
: end
SUBST: L = l.
SUBST: _ = _ P:1
KFEAT: _ = altar_lugonu/altar_yredelemnul/altar_kikubaaqudgha/altar_makhleb
KFEAT: P = enter_abyss
MAP
....LLLLL.....
..LlllllllL...
.LlllllllllLL..
.Llll323lllLLL.
LLll32123lllLL.
LLll33_33llLL..
.Llll323lllL...
.Lllll3llllL...
..LlllllllL...
...LlllllL...
 ...LLLLLL..
   ..LLLLLL.
ENDMAP

# Distorted/chaotic kobolds, to Lugonu or Xom (Jude)
# This vault originally placed in late game branches. I've reworked this to a
# Dungeon runed door vault with a more varied monsters and loot, but still
# respecting the kobolds + distortion/chaos theme. --gammafunk
NAME:   due_chaos_kobolds
TAGS:   patrolling no_monster_gen no_trap_gen transparent
DEPTH:  D:3-
ORIENT: float
WEIGHT: 5
# Either a Lucy theme or a Xom theme, setting the kobolds' weapon ego according
# to theme. We only ever use the orange crystal statue for the Xom theme, and
# only at sufficient depth. Otherwise the D location has the highest tier
# guardian that's equipped with good loot.
: if crawl.coinflip() then
:     ego = "distortion"
SUBST:  D = E
KFEAT:  _ = altar_lugonu
KFEAT:  EFH = enter_abyss
: else
:     ego = "chaos"
KFEAT:  _ = altar_xom
KMONS:  D = orange crystal statue
: end
MONS:   kobold
{{
local quality = crawl.x_chance_in_y(you.depth(), 15) and "randart"
                or "good_item"
mons("kobold; " .. dgn.monster_weapon("kobold", ego))
kmons("E = kobold ; " .. dgn.monster_weapon("kobold", ego, quality))

brigand_weap = {["dagger"] = 5, ["rapier"] = 10, ["short sword"] = 10}
mons("kobold brigand ; dart ego:poisoned | dart ego:curare w:5 . " ..
     dgn.random_item_def(brigand_weap, ego, nil, "|"))
kmons("F = kobold brigand ; dart ego:poisoned | dart ego:curare w:5 . " ..
     dgn.random_item_def(brigand_weap, ego, quality, "|"))

mons("kobold demonologist; dagger ego:" .. ego .. " . robe")
kmons("H = kobold demonologist; dagger ego:" .. ego .. " " .. quality ..
     ". robe good_item | robe randart")
}}
MONS:   ugly thing, very ugly thing
: if you.depth() < 5 then
SUBST:  D = E
NSUBST: 1 = 1 / 1. / 2 / 2. / .
: elseif you.depth() < 8 then
SUBST:  DE = F, * = ., ' = *
NSUBST: 1 = 2=2 / 3=2. / 3. / .
: elseif you.depth() < 11 then
SUBST:  DE = H, ' = *
NSUBST: 1 = 2=3 / 2=3. / 4. / 5 / 5. / .
: elseif you.depth() < 14 then
# From this depth we place an OCS on D for the chaos theme.
SUBST:  E = H, '" = *
NSUBST: 1 = 3 / 3. / 4 / 2=4. / 2=5 / 2=5. / .
: else
SUBST:  E = H, '- = *
NSUBST: 1 = 3 / 3. / 4 / 2=4. / 2=5 / 2=5. / 6 / 6. / .
: end
SUBST:  y  = c.
MARKER: J = lua:fog_machine { cloud_type="blue smoke", walk_dist=1, \
             size=9, pow_max=20, delay=10, buildup_amnt=14, buildup_time=7, \
             spread_rate=3, start_clouds=1, colour="blue" }
MAP
   .@.
  ccncc
 cc'*'cc
cc-1D1-cc
 cc1"1cc
 cccJcccc
ccyy.yyyccc
cy..111.yyc
cc..1_1..cc
cyy.111..yc
cccyy..yycc
  ccc..ccc
    c==c
     @@
ENDMAP

# Authors note: this could be a good candidate for expansion into a group
# of vault layouts that share a weight allocation, each with a different
# 'pattern' of hand-crafted corruption layouts
#
NAME:     amcnicky_altar_lugonu_corruption
TAGS:     transparent no_monster_gen
# Lugonu cares not about moderate vault placement
DEPTH:    D:3-, Depths, Crypt, Zot, Pan, Geh, Coc, Dis, Tar
WEIGHT:   2
KMONS:    q = lurking_horror
KFEAT:    p = altar_lugonu
KFEAT:    r = enter_abyss
: if crawl.coinflip() then
SUBST:    ' = xxx'.
: else
SUBST:    ' = x'.
: end
: if you.in_branch("Swamp") then
SUBST:    x = t
KFEAT:    t = demonic_tree
TILE:     t = dngn_demonic_tree_11 w:6 / dngn_demonic_tree_12 w:6 / \
              dngn_demonic_tree_13 / dngn_demonic_tree_14
: end
SUBST:    z = zz.
# Ordered chaos, like the abyss builder
COLOUR:   ' : blue / green / cyan / red / magenta / brown / \
              lightblue / lightgreen / lightcyan / lightred / lightmagenta / \
              yellow
COLOUR:   uq : blue / green / cyan / red / magenta / brown / \
              lightblue / lightgreen / lightcyan / lightred / lightmagenta / \
              yellow
COLOUR:   z : blue / green / cyan / red / magenta / brown / \
              lightblue / lightgreen / lightcyan / lightred / lightmagenta / \
              yellow
COLOUR:   x : blue / red / magenta / brown / lightgreen / lightred / \
              lightmagenta / yellow / white
NSUBST:   u = 1=p / 1=r / 1=q / 2=q...
FTILE:    'upqrzc : floor_nerves
MARKER:   r = lua:fog_machine { cloud_type="purple smoke", walk_dist=1, \
            size=1, pow_max=5, delay=10, buildup_amnt=7, buildup_time=7, \
            spread_rate=2, start_clouds=1, colour="purple" }
TILE:     x : wall_abyss
MAP
 .'z'''x.
.xx'z''xx.
.x'z'z''''.
.z''u'z''''.
.'z'u''z'zz.
.'uu'u''z''.
.''u'''z''.
.x''z'z'z''.
 .xx'z'z''x.
  .x''z'''.
   .'z'z'.
    .'z'.
ENDMAP

### Altars possibly to Beogh #################################################

NAME:  david_defended_altar_orc
DEPTH: D:7-14, Orc
MONS:  patrolling orc priest
TAGS:  uniq_defended_altar transparent
KFEAT: _ = altar_beogh / w:1 altar_okawaru / w:1 altar_makhleb / w:1 altar_trog
MAP
ccccc...
c1..c...
c1_.+.I@
c1..c...
ccccc...
ENDMAP


### Altars to Jiyva ##########################################################

NAME:   jiyva_altar_1
TAGS:   transparent
DEPTH:  D:8-
KFEAT:  _ = altar_jiyva
: if you.depth() > 9 then
NSUBST: 1 = 3:1 / *:2
: elseif you.depth() > 11 then
NSUBST: 1 = 2:1 / *:2
: elseif you.depth() > 13 then
NSUBST: 1 = 1:1 / *:2
: end
MONS:  jelly, slime creature
MAP
.....
..1..
.1_1.
..1..
.....
ENDMAP
