###############################################################################
# ghost.des
#
# Vaults that place player ghosts and place in multiple branches. See the ghost
# vault guidelines in docs/develop/levels/guidelines.md. All vaults here should
# call the function ghost_setup().
#
# Organization:

# <<1>>          General/Abstract ghost vaults
#     <<1.1>>        Vaults with allow_dup
#     <<1.2>>        Vaults without allow_dup
# <<2>>          Themed ghost vaults
#
###############################################################################

: crawl_require("dlua/ghost.lua")
: crawl_require("dlua/vault.lua")

{{
-- Set up the non-flaming edged weapon "left" by the ghost in
-- gammafunk_ghost_hydra_chop.
function setup_hydra_weapon(e)
    -- Possible weapon types with weights. We stick to weapons wieldable by all
    -- non-felids.
    local weapons = {["long sword"] = 8, ["scimitar"] = 12,
                     ["demon blade"] = 1, ["double sword"] = 1,
                     ["war axe"] = 8, ["broad axe"] = 12, ["lajatang"] = 2}

    -- Basic set of egos with weights.
    local egos = {["none"] = 30, ["heavy"] = 15, ["freezing"] = 15,
            ["electrocution"] = 10, ["venom"] = 10, ["protection"] = 10,
            ["vampirism"] = 5, ["holy_wrath"] = 5, ["draining"] = 5,
            ["pain"] = 2, ["distortion"] = 2, ["antimagic"] = 2, ["speed"] = 1}

    local quality = crawl.one_chance_in(3) and "randart" or "good_item"
    local weapon_def = dgn.random_item_def(weapons, egos, quality)
    e.kitem("O = " .. weapon_def)
end

function wrathful_weapon(class, quality)
    local egos
    -- Only the egos Trog gifts, using equal weights for good_item but giving
    -- the more desirable antimagic brand for randarts, which are trying to be
    -- better quality.
    if quality == "good_item" then
        egos = {["antimagic"] = 10, ["heavy"] = 10, ["flaming"] = 10}
    elseif quality == "randart" then
        -- Increased chance for antimagic.
        egos = {["antimagic"] = 25, ["heavy"] = 10, ["flaming"] = 10}
    else
        error("Unknown weapon quality: " .. quality)
    end

    return dgn.monster_weapon(class, egos, quality)
 end

function disto_weapon(class, quality)
    return dgn.monster_weapon(class, "distortion", quality)
end
}}

# Only the below levels place ghost vaults. A specific ghost vault may only be
# appropriate for a subset of these levels, in which case they should set their
# own DEPTH. Note that if this default depth is changed, vaults below with
# branch-specific item/monster placement may need to be updated.
default-depth: D:3-, Lair, Elf, Orc, Snake, Shoals, Swamp, Spider, Depths, \
               Vaults, !Vaults:$, Crypt, Zot

###############################################################################
#
# <<1>> General/Abstract ghost vaults
#
# General ghost vaults in <<1>> use 098 monsters and any specified monsters
# would be generic things like statue monsters or branch-representative
# monsters. Any thematic aspect should be decorative and not involve specific
# monster types.
###############################################################################

###############################################################################
#
# <<1.1>> General/Abstract vaults with allow_dup
#
# All vaults here have allow_dup so they can be used potentially multiple times
# in the same game. It's necessary to have a set of these so we always have
# ghost vaults available. Vaults in this section
###############################################################################

NAME:   gammafunk_ghost_grave
TAGS:   transparent allow_dup vaults_orient_w
ORIENT: float
: lone_ghost_guarded_loot(_G, "O")
: lone_ghost_extra_loot(_G, "-")
KMONS:  O = player ghost
KMONS:  p = withered plant
SUBST:  t : tp
TILE:   G = dngn_gravestone
TILE:   t = dngn_tree_dead
COLOUR: t = brown
: set_feature_name("granite_statue", "a gravestone")
: set_feature_name("tree", "dead tree")
FTILE:  -|*%$OGt = floor_pebble_brown / floor_pebble_darkgray
: ghost_setup(_G, true)
MAP
  cccc
..ndtc
@.=OGc
..netc
  cccc
ENDMAP

NAME:   gammafunk_ghost_split
TAGS:   transparent allow_dup vaults_orient_w
ORIENT: float
KMONS: O = player ghost
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 6 then
SUBST:  d = *%, e = %$, fgh = .
NSUBST: D = 2=0 / 2=0. / 9. / .
:     elseif you.depth() < 9 then
SUBST:  d = *, e = *%, f = %$..,  gh = .
NSUBST: D = 2=0 / 3=0. / 9. / 98.. / .
:     elseif you.depth() < 12 then
SUBST:  e = *, f = %$,  gh = .
NSUBST: D = 2=0 / 4=0. / 2=9. / 8. / .
:     elseif you.depth() < 14 then
SUBST:  f = *, g = %$, h = .
NSUBST: D = 2=0 / 3=0. / 9 / 9. / 2=8. / 98.. / .
:     else
SUBST:  f = |*, g = *%, h = %$--
NSUBST: D = 2=0 / 2=0. / 9 / 2=9. / 8 / 8. / .
:     end
: elseif you.in_branch("Lair") then
SUBST:  f = *%, g = %$..
NSUBST: D = 3=0 / 3=0. / 2=9. / 8. / 98.. / .
: elseif you.in_branch("Orc") then
SUBST:  f = *, g = %$
NSUBST: D = 2=0 / 4=0. / 9 / 9. / 2=8. / .
# All remaining branches.
: else
SUBST:  fgh = |*
NSUBST: D = 0 / 2=0. / 2=9 / 2=9. / 8 / 2=8. / .
: end
SUBST:  p : x., q : x., x : xc
: ghost_setup(_G, true)
MAP
.............
.............
..cccnnnccc..
..nD..D..Dc..
..n..qpqg.c..
..=.Dpqpe.n..
.@=...O.dDn..
..=.Dpqpf.n..
..n..qpqh.c..
..nD..D..Dc..
..cccnnnccc..
.............
.............
ENDMAP

NAME:   gammafunk_ghost_arena
TAGS:   transparent passable allow_dup vaults_orient_w
ORIENT: float
KMASK:  -OQR089de|*%$ = opaque
KMONS:  O = player ghost
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 6 then
SUBST:  d = *%, e = %$, f = %$--, ghij = -
NSUBST: D = 2=0 / 2=0- / 9- / -
:     elseif you.depth() < 9 then
SUBST:  d = *, e = *%, f = %$,  ghij = -
NSUBST: D = 2=0 / 2=0- / 098- / 9- / -
:     elseif you.depth() < 12 then
SUBST:  e = *, f = *%,  g = %$--, hij = -
NSUBST: D = 2=0 / 3=0- / 2=9- / 8- / -
:     elseif you.depth() < 14 then
SUBST:  f = |*, g = *, h = %$, ij = -
NSUBST: D = 2=0 / 4=0- / 098- / 9 / 9- / 2=8- / -
:     else
SUBST:  f = |*, g = *, h = %$, ij = -
NSUBST: D = 3=0 / 3=0- / 9 / 2=9- / 8 / 8- / -
:     end
: elseif you.in_branch("Lair") then
SUBST:  f = *, g = %$, hij = -
NSUBST: D = 2=0 / 3=0- / 098- / 2=9- / 8- / -
: elseif you.in_branch("Orc") then
SUBST:  f = |*, g = *%, h = %$--, ij = -
NSUBST: D = 2=0 / 4=0- / 9 / 9- / 2=8- / -
: elseif you.in_branch("Vaults") or you.in_branch("Elf") then
SUBST:  fg = |*, h = *, i = %$, j = -
NSUBST: D = 3=0 / 4=0- / 9 / 3=9- / 8 / 2=8- / -
: elseif you.in_branch("Crypt") then
SUBST:  fgh = |*, i = *%, j = %$--
NSUBST: D = 3=0 / 4=0- / 098- / 9 / 3=9- / 8 / 2=8- / -
: elseif you.in_branch("Depths") then
SUBST:  fgh = |*, i = *, j = %$
NSUBST: D = 3=0 / 5=0- / 2=9 / 2=9- / 8 / 3=8- / -
: elseif you.in_branch("Zot") then
SUBST:  fghij = |*
NSUBST: D = 3=0 / 5=0- / 2=9 / 3=9- / 2=8 / 2=8- / -
# Lair branches
: else
SUBST:  fg = |*, h = *%, i = %$--, j = -
NSUBST: D = 3=0 / 3=0- / 098- / 9 / 2=9- / 8 / 8- / -
: end
SUBST:  r : x-, s : x-, x : cx
NSUBST: R = R / -
MARKER: P = lua:transp_loc("ghost_arena_entry")
MARKER: Q = lua:transp_dest_loc("ghost_arena_entry")
MARKER: R = lua:transp_loc("ghost_arena_exit")
MARKER: S = lua:transp_dest_loc("ghost_arena_exit")
: ghost_setup(_G, true)
MAP
 .............
...............
...nnnnnnnnn...
..nnRD---DRnn..
..nG-rsDsrDGn..
..nD-sr-rs-gn..
..n-D--D-Dien..
@Pn-O-DQD-DdnS@
..n-D--D-Djfn..
..nD-sr-rs-hn..
..nG-rsDsrDGn..
..nnRD---DRnn..
...nnnnnnnnn...
...............
 .............
ENDMAP

NAME:    gammafunk_ghost_cemetery
TAGS:    transparent allow_dup vaults_orient_s
ORIENT:  float
KMONS:   DFH = player ghost
KMONS:   p = withered plant
# 1/12 chance for 5 ghosts, 1/6 for 4, 1/4 for 3, 1/2 for 2.
SHUFFLE: FfrHhs / ZyzHhs / ZyzHhs / FfrZyz / FfrZyz / FfrZyz / ZyzZyz / \
         ZyzZyz / ZyzZyz / ZyzZyz / ZyzZyz / ZyzZyz
# 1.5 items per ghost, upgrading quality with depth.
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 6 then
NSUBST:  de = 2=*% / %$--, f = *% / %$--, h = 2=*% / %$--
:     elseif you.depth() < 9 then
NSUBST:  de = 2=* / *%--, f = * / *%--, h = 2=* / *%--
:     elseif you.depth() < 12 then
# From here on, one 'd' glyph is used by the good loot item, so we don't
# replace that one.
NSUBST:  d = d / *-, e = |* / *-, f = |* / *-, h = 2=|* / *-
:     else
# From here on, one 'd' glyph and one 'e' glyph are used by the good loot
# items, so we don't replace those.
NSUBST:  d = d / |*--, e = e / |*--, f = |* / |*--, h = 2=|* / |*--
:     end
# All non-Dungeon branches.
: else
NSUBST:  d = d / |*--, e = e / |*--, f = |* / |*--, h = 2=|* / |*--
: end
SUBST:   qrs = G, Z = -, y = p, z = V, p : tp
TILE:    G = dngn_gravestone
TILE:    t = dngn_tree_dead
COLOUR:  t = brown
FTILE:   -de|*%$DFHpGt = floor_pebble_brown / floor_pebble_darkgray
: set_feature_name("granite_statue", "a gravestone")
: set_feature_name("tree", "dead tree")
: ghost_setup(_G, true)
MAP
  ccccccc
 ccdfrfecc
ccq--F--qcc
cd-D---D-ec
ch-------hc
csH-----Hsc
ch-------hc
ccnn===nncc
  .......
  ...@...
ENDMAP

NAME:   ebering_ghost_rock_garden
TAGS:   allow_dup vaults_orient_s
ORIENT: float
KMONS:  O = player_ghost
: local large_rocks = crawl.random_range(3,7)
: kitem("O = large rock q:" .. large_rocks)
KITEM:  ' = stone q:1 / large rock w:1
NSUBST: r = O / d / e / tG / t'' / '
: lone_ghost_extra_loot(_G, "'")
COLOUR: '-O|*%$tG = yellow, c = white
FTILE:  '-O|*%$tG = floor_dirt
: ghost_setup(_G, true)
MAP
ccccccccc
c---r-r-c
crr-----c
c----r--c
c--r----c
cr----r-c
cnn===nnc
 .......
 ...@...
ENDMAP

NAME:   ebering_ghost_reflecting_pool
TAGS:   allow_dup vaults_orient_s
ORIENT: float
: lone_ghost_guarded_loot(_G, "O")
: lone_ghost_extra_loot(_G, "-")
KMONS:  O = player_ghost
KFEAT:  O = shallow_water
FTILE:  -|*%$O : floor_pebble_brown / floor_pebble_darkgray
: ghost_setup(_G, true)
MAP
ccccc
cdOec
c-w-c
c-w-c
c-w-c
c-W-c
cn=nc
 ...
 .@.
ENDMAP

NAME:   ebering_ghost_disaster_area
TAGS:   allow_dup vaults_orient_s
ORIENT: float
KMONS:  O = player ghost
NSUBST: ' = d / e / 8=wWl / -
: lone_ghost_guarded_loot(_G, "O")
: lone_ghost_extra_loot(_G, "-")
SUBST:  P = GTV
: ghost_setup(_G, true)
MAP
cccccccccc
cccc'c'ccc
cc''O''c'c
c'c'''''cc
c''P'c''cc
cc'''''''c
ccnn==nncc
  ......
  ..@@..
ENDMAP

###############################################################################
# <<1.2>> General/Abstract vaults without allow_dup
###############################################################################

NAME:   ebering_ghost_inner_flame
TAGS:   transparent vaults_orient_w
WEIGHT: 5 (D:3-7)
KPROP:  cn'O = w:5 bloody / nothing
KMONS:  O = player_ghost
KITEM:  O = scroll of immolation ident:all
NSUBST: ' = |* / |*$ / 998 / 2=F. / .
MARKER: F = lua:fog_machine { cloud_type = "black smoke", \
            pow_min = 10000, pow_max = 10000, delay = 1, \
            size = 1, walk_dist = 0, start_clouds = 1 }
: ghost_setup(_G, true)
MAP
  ccccc
..n'''c
@.='O'c
..n'''c
  ccccc
ENDMAP

NAME:   ebering_ghost_gozag
TAGS:   transparent vaults_orient_s
DEPTH:  D:3-, Orc, Shoals, Snake, Elf, Vaults, !Vaults:$, Crypt, Depths, Zot
WEIGHT: 5 (D:3-7)
ORIENT: float
: kitem("DE = " .. dgn.loot_potions)
# If ghost selectors ever happen this should be a gozag ghost
KMONS:  O = player_ghost
# D and F place an 8 monster plus potion or shop, E and H place the potion/shop
# without any monster. D, E, and J place an abandoned shop for decor.
KMONS:  DF = 8
MONS:   obsidian statue
: if you.in_branch("D") then
:     if you.depth() < 6 then
NSUBST: M = 0 / 2=0' / 9 / 8-JJ / J
SUBST:  1 = G
:     elseif you.depth() < 9 then
NSUBST: M = 0 / 2=09 / 8J / J
SUBST:  1 = G, D = DF, E = EH
:     elseif you.depth() < 12 then
# The 4th term gives a 50% chance of placing a potion/shop and an independent
# %50 chance of placing an 8.
NSUBST: M = 0 / 2=09 / 9J / DE8J / J
SUBST:  1 = 1GGGG, D = DF, E = EH
:     elseif you.depth() < 14 then
# The 5th term gives a 33% chance of placing a second potion/shop and an
# independent 50% chance of placing an 8.
NSUBST: M = 0 / 2=09 / 9 / DE / DE88JJ / J
SUBST:  1 = 1GG, D = DF, E = EH
:     else
# Chance like the one above, but 50% for second potion/shop.
NSUBST: M = 0 / 2=09 / 9 / D / DE8J / J
SUBST:  1 = 1G, D = DF, E = EH
:     end
: elseif you.in_branch("Orc") then
NSUBST: M = 0 / 2=09 / 9 / DE / DE88JJ / J
SUBST:  1 = 1GG, D = DF, E = EH
# Elf, Vaults, Crypt, Depths, and Zot
: else
NSUBST: M = 0 / 2=09 / 9 / 2=D / J
SUBST:  D = DF
: end
# The ' glyph is used to place gold.
: setup_gozag_gold(_G)
KFEAT:  ODEJ = abandoned_shop
KFEAT:  FH = antiques shop
KFEAT:  _ = altar_gozag
TILE:   G = dngn_golden_statue
FTILE:  -_DEFHJ$0189OG = floor_limestone
COLOUR: G = yellow
: set_feature_name("granite_statue", "golden statue")
: set_feature_name("stone_wall", "golden wall")
: ghost_setup(_G, true)
MAP
 ccccccc
ccMGOGMcc
cM'''''Mc
cG''1''Gc
cM''_''Mc
cc'''''cc
 nn===nn
 .......
 ...@...
ENDMAP

NAME:   hellmonk_ghost_happy_afterlife
TAGS:   transparent vaults_orient_s no_item_gen
ORIENT: float
ITEM:   any potion
: item(dgn.loot_potions)
ITEM:   any scroll
: item(dgn.loot_scrolls)
KMONS:  O = player ghost
: if you.in_branch("Dungeon") then
:     if you.depth() < 6 then
SUBST:  h = -
:     elseif you.depth() < 9 then
SUBST:  d = de, f = fg, h = df--
:     elseif you.depth() < 12 then
SUBST:  d = e, f = g, h = df
:     elseif you.depth() < 14 then
SUBST:  d = e, f = g, h = defg
:     else
SUBST:  d = e, f = g, h = eg
:     end
: else
SUBST:  d = e, f = g, h = eg
: end
COLOUR: -defgO = green
FTILE:  -defgOTt = floor_grass
: ghost_setup(_G, true)
MAP
    .....
   .......
  ...nnn...
 ...nnTnn...
...nn---nn...
..nn--h--nn..
..nT-dtf-Tn..
..nn--O--nn..
...nn---nn...
 ...nn-nn...
  ...n=n...
   .......
    .....
ENDMAP

NAME:   gammafunk_ghost_door_vault
TAGS:   transparent
DEPTH:  D:13-, Depths, Elf, Vaults, !Vaults:$, Crypt, Zot
WEIGHT: 2
ORIENT: float
: ghost_good_loot(_G, "45")
KMONS:  1 = 9
KMONS:  2 = 8
KMONS:  345 = player_ghost
# Ghosts on 4 and 5 will get upgraded loot.
NSUBST: 3 = 4 / 5 / 3, 1 = 5=23 / 3 / 1
: door_vault_setup(_G)
: ghost_setup(_G, true)
MAP
..............
..............
..aaaaaaaaaa..
..a++++++++a..
..a++++++++a..
..a++1111++a..
..a++1331++a..
..a++1331++a..
..a++1111++a..
..a++++++++a..
..a++++++++a..
..aaaaaaaaaa..
..............
..............
ENDMAP

NAME:    nzn_ghost_randoct
TAGS:    transparent passable vaults_orient_n
DEPTH:   D:7-, Depths, Lair, Vaults, !Vaults:$, Crypt, Spider, Zot
ORIENT:  float
KMASK:   'WwlOQR012345689de|*%$ = opaque
: ghost_good_loot(_G)
KMONS:   O = player_ghost
SHUFFLE: PS, QR
NSUBST:  Q = Q / ', R = R / '
NSUBST:  x = 2=' / c
SUBST:   DEFH = ':75 $:5, J = ':50 W:30 0, K = ':50 $ 0
: if you.in_branch("D") then
:     if you.depth() < 13 then
MONS:    ice statue / oklob plant
NSUBST:  M = O / 9 / e / %
SUBST:   L = ':60 9 0 %, % = %*, * = **e|
SUBST:   y = G:70 1
:     else
MONS:    obsidian statue / orange crystal statue
NSUBST:  M = O / d / * = * 9:1 O:2 8:2
SUBST:   L = ':20 %:50 9:20, % = %**ee, * = **|, f = dde
SUBST:   y = G:70 1
:     end
: elseif you.in_branch("Lair") then
MONS:    ice statue / oklob plant
NSUBST:  M = O / 9 / e / %
SUBST:   L = ':60 9 0 %, % = %*, * = **e|
SUBST:   y = G:70 1
: elseif you.in_branch("Spider") then
MONS:    orange crystal statue / oklob plant
KMONS:   2 = arachne / spark wasp, spark wasp
NSUBST:  M = O / 2 / * = * O:5 8:5
SUBST:   L = ':40 %:30 9:20, % = %**ee, * = **|, f = dde
SUBST:   y = G:70 1, ' = ':80 W:20
: elseif you.in_branch("Vaults") then
MONS:    orange crystal statue
MONS:    titan / golden dragon / ancient lich / dread lich
NSUBST:  M = O / 2 / * = * O:15 8:5
SUBST:   L = ':30 9:20 d:20 8 *, * = *|
SUBST:   y = G:70 1, W = '
: elseif you.in_branch("Crypt") then
MONS:    orange crystal statue / obsidian statue
MONS:    royal mummy / curse skull
NSUBST:  M = O / 2 / * = * O:15 8:5
SUBST:   L = ':30 9:20 d:20 8 *, * = *|
SUBST:   y = G:70 1, W = '
: elseif you.in_branch("Depths") then
MONS:    orange crystal statue
MONS:    caustic shrike / juggernaut / titan
NSUBST:  M = O / 2 / * = * O:15 8:5
SUBST:   L = ':30 9:20 d:20 8 *, * = *|
SUBST:   y = G:30 1, c : cvb, W : Wwl
# Zot
: else
MONS:    orange crystal statue
MONS:    orb of fire / ancient lich w:5 / dread lich w:5
NSUBST:  M = O / 2 / * = * O:15 8:5
SUBST:   L = ':30 9:20 d:20 8 |
SUBST:   y = G:30 1, c : ccb, W : Wwl
: end
MARKER:  P = lua:transp_loc("ghost_randoct_entry")
MARKER:  Q = lua:transp_dest_loc("ghost_randoct_entry")
MARKER:  R = lua:transp_loc("ghost_randoct_exit")
MARKER:  S = lua:transp_dest_loc("ghost_randoct_exit")
: ghost_setup(_G, true)
MAP
        ..@..
       ...P...
      ..ncncn..
     ..cnEREnc..
    ..ccEcncEcc..
   ..ncJKJKJKJcn..
  ..ccyJJKJKJJycc..
 ..ccJJcKxnxKcJJcc..
..nnDKJKxxMxxKJKHnn..
..cDcJKxxLLLxxKJcHc..
..nQnKJnMLLLMnJKnRn..
..cDcJKxxLLLxxKJcHc..
..nnDKJKxxMxxKJKHnn..
 ..ccJJcKxnxKcJJcc..
  ..ccyJJKJKJJycc..
   ..ncJKJKJKJcn..
    ..ccFcncFcc..
     ..cnFQFnc..
      ..ncncn..
       ...S...
        ..@..
ENDMAP

###############################################################################
#
# <<2>> Themed ghost vaults.
#
# Vaults in this section choose specific types of monsters according to some
# theme and often have thematic loot as well.
###############################################################################

NAME:   gammafunk_ghost_necromancy
TAGS:   transparent vaults_orient_w
# Omit Elf since that branch has few good monsters for derived undead.
WEIGHT: 0 (Elf)
ORIENT: float
KMONS:  O = player ghost
: ghost_good_loot(_G)
# Progressive depth/numbers of zombies and type/amount of loot.
: if you.in_branch("D") then
:     if you.depth() < 6 then
MONS:   skeleton place:D:6 / zombie place:D:6
SUBST:  d = *%, e = %$, fghij = -
NSUBST: 1 = 2=1 / 1---
:     elseif you.depth() < 9 then
MONS:   skeleton place:D:9 / zombie place:D:9 / spectre place:D:9 / \
        simulacrum place:D:9
SUBST:  d = *, e = *%, f = %$--, ghij = -
NSUBST: 1 = 2=1 / 1-
:     elseif you.depth() < 12 then
MONS:   w:5 zombie place:D:12 / spectre place:D:12 / simulacrum place:D:12
SUBST:  e = *, f = %$, ghij = -
NSUBST: 1 = 3=1 / 1-, - = 1- / -
:     elseif you.depth() < 14 then
MONS:   w:5 zombie place:D:$ / spectre place:D:$ / simulacrum place:D:$
SUBST:  f = |*, g = *%, h = %$--, ij = -
NSUBST: - = 4=1- / -
:     else
MONS:   place:Depths:1 zombie / place:Depths:1 spectre / \
        place:Depths:1 simulacrum
SUBST:  f = |*, g = *%, h = %$--, ij = -
NSUBST: - = 2=1 / 2=1- / -
:     end
# Set up derived undead from branch end for non-Dungeon branches.
: else
{{
  local undead_place = "place:" .. you.branch() .. ":" ..
                       dgn.br_depth(you.branch())
  mons(undead_place .. " spectre / " .. undead_place .. " simulacrum")
}}
# Handle loot/monsters for non-Dungeon branches.
:     if you.in_branch("Lair") then
SUBST:  f = *%, g = %$--, hij = -
NSUBST: 1 = 4=1 / 1-, - = 2=1- / -
:     elseif you.in_branch("Orc") then
SUBST:  f = *, g = %$, hij = -
NSUBST: 1 = 5=1 / 1-, - = 3=1- / -
:     elseif you.in_branch("Vaults") then
MONS:   lich
SUBST:  fg = |*, h = *%, i = %$--, j = -
NSUBST: 1 = 12 / 1, - = 3=1 / 4=1- / .
:     elseif you.in_branch("Crypt") then
MONS: revenant / curse skull
SUBST:  fg = |*, h = *, i = %$, j = -
NSUBST: 1 = 12 / 1, - = 4=1 / 4=1- / -
:     elseif you.in_branch("Depths") then
MONS: ancient lich / dread lich
SUBST:  fgh = |*, i = *%, j = %$--
NSUBST: 1 = 2=12 / 1, - = 4=1 / 6=1- / -
:     elseif you.in_branch("Zot") then
MONS: ancient lich / dread lich, curse toe
SUBST:  fghij = |*
NSUBST: 1 = 12 / 123 / 1, - = 5=1 / 6=1- / -
# Lair branches
:     else
SUBST:  f = |*, g = *, h = %$, ij = -
NSUBST: - = 2=1 / 4=1- / -
:     end
: end
FTILE:  -de|*%$O12G = floor_pebble_brown / floor_pebble_darkgray
: ghost_setup(_G, true)
MAP
  ccccccc
  n1c1c1c
..n---igc
..=---ecc
@.=---dOc
..=---fcc
..n---jhc
  n1c1c1c
  ccccccc
ENDMAP

NAME:   gammafunk_ghost_spectres
TAGS:   vaults_orient_w
DEPTH:  D:8-, Vaults, !Vaults:$, Crypt
ORIENT: float
KMONS:  O = player ghost
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 9 then
MONS:   wraith / shadow
SUBST:  d = *, e = *%, f = %$--,  ghi = -
NSUBST: D = 1--
:     elseif you.depth() < 12 then
MONS:   wraith / shadow, freezing wraith
SUBST:  e = *, f = %$,  ghi = -
NSUBST: D = 112---
:     elseif you.depth() < 14 then
MONS:   freezing wraith
MONS:   phantasmal warrior w:20 / shadow wraith / flayed ghost
SUBST:  f = |*, g = *%, h = %$--, i = -
NSUBST: D = 11122-
:     else
MONS:   freezing wraith
MONS:   phantasmal warrior / shadow wraith / flayed ghost
MONS:   eidolon
SUBST:  f = |*, g = *%, h = %$--, i = -
NSUBST: D = 2223--, - = 1:1 -:9
:    end
: elseif you.in_branch("Vaults") then
MONS:   freezing wraith / shadow wraith / phantasmal warrior / flayed ghost w:5
MONS:   eidolon, revenant
SUBST:  fg = |*, h = *%, i = %$--
NSUBST: D = 2223--, - = -----1
# Crypt
: else
MONS:   freezing wraith / shadow wraith / phantasmal warrior / flayed ghost
MONS:   eidolon, revenant
SUBST:  fg = |*, h = *, i = %$
NSUBST: D = 2233--,  - = ---1
: end
FTILE:  -de|*%$O1234G = floor_pebble_brown / floor_pebble_darkgray
: ghost_setup(_G, true)
MAP
  ccccccc
  nDcDcDc
..n----gc
..=---eGc
@.=--idOc
..=---fGc
..n----hc
  nDcDcDc
  ccccccc
ENDMAP

NAME:   gammafunk_ghost_ooze
TAGS:   vaults_orient_e
DEPTH:  D:8-, Lair, Elf, Vaults, !Vaults:$, Depths, Zot
ORIENT: float
KMONS:  O = player ghost
MONS:   jelly, slime creature, glowing orange brain / great orb of eyes
MONS:   eye of devastation / rockslime / quicksilver ooze
MONS:   glass eye / shining eye / golden eye band
MONS:   azure jelly / acid blob
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 10 then
SUBST:  d = *, e = *%, f = %$--,  ghijk = -
NSUBST: - = 2=1 / 2=1. / 2 / 2=2. / .
:     elseif you.depth() < 12 then
MONS:   jelly, slime creature
SUBST:  e = *, f = %$,  ghijk = -
NSUBST: - = 1 / 3=1. / 2=2 / 2=2. / 3. / .
:     elseif you.depth() < 14 then
SUBST:  fg = |*, h = *%, i = %$--, jk = -
NSUBST: - =  3=2 / 4=2. / 3. / 4 / 4. / 5. / 6.
:     else
SUBST:  fg = |*, h = *, i = %$, jk = -
NSUBST: - =  3=2 / 4=2. / 3. / 4 / 2=4. / 5. / 2=6.
:     end
: elseif you.in_branch("Lair") then
:     if you.depth() < 4 then
SUBST:  f = |*, g = *%, h = %$--, ij = -
NSUBST: - =  1 / 3=1. / 2=2 / 2=2. / 3. / .
:     else
SUBST:  f = |*, g = *, h = %$, ij = -
NSUBST: - =  3=2 / 3=2. / 3. / 4 / 4. / 6.
:     end
: elseif you.in_branch("Vaults") or you.in_branch("Elf") then
SUBST:  fgh = |*, i = *, j = %$, k = -
NSUBST: - =  3=2 / 4=2. / 3. / 2=4 / 2=4. / 5. / 6 / 2=6.
: elseif you.in_branch("Depths") then
SUBST:  fghi = |*, j = %*, k = %$--
NSUBST: - =  3 / 3. / 4=4 / 4=4. / 5. / 2=6 / 4=6.
# Zot
: else
SUBST:  fghi = |*, j = *, k = %$
NSUBST: - =  3 / 3. / 4=4 / 4=4. / 2=5. / 2=6 / 5=6.
: end
KFEAT:  _ = altar_jiyva
COLOUR: c = lightgreen
: ghost_setup(_G, true)
MAP
  ccccc
 cc---cc
cci----n..
ceg----=..
c_dkO--=.@
cfh----=..
ccj----n..
 cc---cc
  ccccc
ENDMAP

NAME:   gammafunk_ghost_mausoleum
TAGS:   transparent vaults_orient_w passable
DEPTH:  D:3-, Swamp, Spider, Vaults, !Vaults:$, Crypt, Depths, Zot
ORIENT: float
KMASK:  -OQR012389de|*%$ = opaque
KMONS:  O = player ghost
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 6 then
MONS:   skeleton place:D:6 / zombie place:D:6
MONS:   mummy / shadow imp / wight / necrophage / phantom
SUBST:  d = *%, e = %$, f = %$--, ghij = -
NSUBST: D = 2=1 / 2=1- / 2- / -
:     elseif you.depth() < 9 then
MONS:   skeleton place:D:9 / zombie place:D:9 / spectre place:D:9 \
        / simulacrum place:D:9 / mummy / shadow imp / wight / necrophage \
        / phantom
MONS:   wraith / vampire
SUBST:  d = *, e = *%, f = %$,  ghi = -
NSUBST: D = 2=1 / 3=1- / 2=2- / -
:     elseif you.depth() < 12 then
MONS:   mummy / wight / zombie place:D:12 / spectre place:D:12 \
        / simulacrum place:D:12 / phantom / wraith / vampire
MONS:   vampire mosquito band / shadow / death knight / skeletal warrior \
        / freezing wraith w:5
SUBST:  e = *, f = *%,  g = %$--, hi = -
NSUBST: D = 3=1 / 3=1- / 2=2- / -
:     elseif you.depth() < 14 then
MONS:   zombie place:D:$ / spectre place:D:$ / simulacrum place:D:$ \
        / vampire mosquito band / death knight / skeletal warrior
MONS:   freezing wraith / necromancer / shadow wraith / vampire knight \
        / phantasmal warrior / flayed ghost
SUBST:  f = |*, g = *%, h = %$--, ij = -
NSUBST: D = 3=1 / 5=1- / 2 / 2=2- / -
:     else
MONS:   zombie place:Depths:1 / spectre place:Depths:1 \
        / simulacrum place:Depths:1 / vampire mosquito band / death knight \
        / skeletal warrior / freezing wraith
MONS:   necromancer / shadow wraith / vampire knight / phantasmal warrior \
        / flayed ghost
SUBST:  f = |*, g = *, h = %$, ij = -
NSUBST: D = 4=1 / 4=1- / 2 / 2=2- / -
:     end
: elseif you.in_branch("Swamp") then
MONS:   spectre place:Swamp:$ / simulacrum place:Swamp:$ / bloated husk \
        / bog body / vampire mosquito band / tyrant leech
MONS:   ghost crab / bunyip spectre / bunyip simulacrum / hydra spectre \
        / hydra simulacrum
SUBST:  fg = |*, h = *%, i = %$--, j = -
NSUBST: D = 4=1 / 5=1- / 2 / 3=2- / -
: elseif you.in_branch("Spider") then
MONS:   wolf spider spectre / wolf spider simulacrum / entropy weaver spectre \
        / entropy weaver simulacrum / vampire mosquito band \
        / ghost moth spectre / ghost moth simulacrum
MONS:   death scarab / emperor scorpion spectre / emperor scorpion simulacrum
SUBST:  fg = |*, h = *%, i = %$--, j = -
NSUBST: D = 4=1 / 5=1- / 2 / 3=2- / -
: elseif you.in_branch("Vaults") then
MONS:   spectre place:Vaults:$ / simulacrum place:Vaults:$ / necromancer \
        / freezing wraith / phantasmal warrior / shadow wraith / flayed ghost \
        / deep elf death mage
MONS:   shadow dragon w:20 / lich w:20
MONS:   ancient lich / dread lich
SUBST:  fg = |*, h = *, i = %$, j = -
NSUBST: D = 4=1 / 5=1- / 2=2 / 2=2- / 3- / -
: elseif you.in_branch("Crypt") then
SUBST:  fgh = |*, i = *%, j = %$..
NSUBST: D = 5=0 / 5=0- / 2=9 / 3=9- / 8- / -
: elseif you.in_branch("Depths") then
MONS:   spectre place:Depths:$ / simulacrum place:Depths:$ / necromancer \
        / vampire knight / vampire mage / deep elf death mage / flayed ghost w:5
MONS:   lich / shadow dragon / juggernaut simulacrum \
        / juggernaut spectre / caustic shrike simulacrum \
        / caustic shrike spectre
MONS:   ancient lich / dread lich
SUBST:  fgh = |*, i = *, j = %$
NSUBST: D = 5=1 / 5=1- / 2=2 / 4=2- / 2=3- / -
: elseif you.in_branch("Zot") then
MONS:   death cob w:20 / shadow dragon w:20 / storm dragon simulacrum \
        / storm dragon spectre / draconian monk simulacrum \
        / draconian monk spectre
MONS:   bone dragon w:40 / golden dragon simulacrum / golden dragon spectre \
        / quicksilver dragon simulacrum / quicksilver dragon spectre \
        / killer klown simulacrum / killer klown spectre
MONS:   ancient lich / dread lich / curse toe
SUBST:  fghij = |*
NSUBST: D = 5=1 / 5=1- / 2=2 / 4=2- / 3 / 2=3- / -
: end
NSUBST: R = R / -
MARKER: P = lua:transp_loc("ghost_mausoleum_entry")
MARKER: Q = lua:transp_dest_loc("ghost_mausoleum_entry")
MARKER: R = lua:transp_loc("ghost_mausoleum_exit")
MARKER: S = lua:transp_dest_loc("ghost_mausoleum_exit")
FTILE:  -de|*%$O012389G = floor_pebble_brown / floor_pebble_darkgray
: ghost_setup(_G, true)
MAP
.................
.................
..ccccccccccccc..
..cR--D---D--Rc..
..n-D---D---D-n..
..c--ccc-ccc-ic..
..c-DcGcDcGcDgc..
..n----------en..
@PnOD-D-Q-D-DdnS.
..n----------fn..
..c-DcGcDcGcDhc..
..c--ccc-ccc-jc..
..n-D---D---D-n..
..cR--D---D--Rc..
..ccccccccccccc..
.................
.................
ENDMAP

NAME:   gammafunk_ghost_hydra_chop
DEPTH:  D:8-, Lair, Swamp
ORIENT: float
: setup_hydra_weapon(_G)
KMONS:  O = player ghost
{{
-- Set up hydra monster entry with a range of possible extra heads based on
-- depth.
local max_heads = 11 + math.floor((you.absdepth() - 8) / 2)
local hydra_def
for h = 9, max_heads do
    if hydra_def == nil then
        hydra_def = h .. "-headed hydra"
    else
        hydra_def = hydra_def .. " / " .. h .. "-headed hydra"
    end
end
mons(hydra_def)
}}
KMONS:  pq = plant
KFEAT:  q = W
SUBST:  t = tttWpq'
NSUBST: ' = d / e / f / g / -
: ghost_good_loot(_G)
: if you.absdepth() < 10 then
SUBST:  d = *, e  = *%
NSUBST: - = 1 / 1--- / -
: elseif you.absdepth() < 12 then
SUBST:  e = *, f =  %$--
NSUBST: - = 1 / 1- / -
: elseif you.absdepth() < 14 then
SUBST:  f = %$
NSUBST: - = 1 / 111- / -
: elseif you.absdepth() <= 16 then
SUBST:  f = *%, g = %$--
NSUBST: - = 1 / 2=1- / -
: else
SUBST:  fg = |*
NSUBST: - = 1 / 3=1- / -
: end
: ghost_setup(_G)
MAP
  ccccc
 cctttcn.
cct'''-n.
ct''---=.
ct'-O--=@
ct''---=.
cct'''-n.
 cctttcn.
  ccccc
ENDMAP

NAME:   gammafunk_ghost_fury_of_okawaru
TAGS:   transparent vaults_orient_s
DEPTH:  D:12-, Orc, Elf, Vaults, !Vaults:$, Crypt
ORIENT: float
KFEAT:  OP = altar_okawaru
KMONS:  OP = player ghost
# Bad Oka gift.
KITEM:  O = hat damaged ident:all / cloak damaged ident:all / \
        animal skin damaged ident:all / robe damaged ident:all / \
        leather armour damaged ident:all / whip damaged ident:all / \
        spear damaged ident:all / short sword damaged ident:all / \
        dagger damaged ident:all / hand axe damaged ident:all / \
        club damaged ident:all / sling damaged ident:all
KITEM:  P = robe plus:-8 randart ident:all
# An "Oka weapon gift" using the more useful types on 'd'
ITEM:   quick blade good_item w:5 / rapier good_item / scimitar good_item / \
        double sword good_item w:5 / demon blade good_item w:5 / \
        triple sword good_item w:5 /  morningstar good_item / \
        eveningstar good_item w:5 / demon whip good_item w:5 / \
        dire flail good_item / great mace good_item / broad axe good_item / \
        battleaxe good_item / executioner's axe good_item w:5 / \
        demon trident good_item w:5 / glaive good_item / \
        bardiche good_item w:5 / lajatang good_item w:5
# An "Oka armour gift" on 'e'
ITEM:   any armour good_item / any armour randart
# Rarely place the robe of misfortune or a bad randart robe.
SUBST:  O = O:49 P:1
: if you.in_branch("D") then
:      if you.depth() < 14 then
MONS:   orc warrior / centaur warrior / tengu warrior
MONS:   orc knight / naga warrior / merfolk impaler
MONS:   merfolk javelineer / deep elf knight / deep elf archer
SUBST:  e = |*e, f = |*, g = *%, h = %$--, ij = -
NSUBST: - = 2=1 / 4=1- / 12-- / 2 / 2=2- / 3- / -
:      else
MONS:   orc warrior / centaur warrior / tengu warrior / orc knight / \
        naga warrior / merfolk impaler
MONS:   merfolk javelineer / deep elf knight / deep elf archer
MONS:   stone giant / minotaur / fire giant / frost giant / orc warlord
SUBST:  e = |*ee, f = |*, g = *, h = %$, ij = -
NSUBST: - = 3=1 / 3=1- / 2 / 3=2- / 333- / -
:      end
: elseif you.in_branch("Orc") then
MONS:   orc warrior / centaur warrior / tengu warrior / orc knight
MONS:   naga warrior / merfolk impaler / merfolk javelineer / \
        deep elf knight / deep elf archer
MONS:   minotaur / stone giant / orc warlord
SUBST:  e = |*e, f = |*, g = *, h = %$--, ij = -
NSUBST: - = 2=1 / 4=1- / 12-- / 2 / 2=2- / 3- / -
: elseif you.in_branch("Vaults") or you.in_branch("Elf") then
MONS:   centaur warrior / tengu warrior / orc knight / naga warrior / \
        merfolk impaler / merfolk javelineer / deep elf knight / \
        deep elf archer
MONS:   minotaur / stone giant / orc warlord
MONS:   fire giant / frost giant / deep elf blademaster / \
        deep elf master archer / titan
SUBST:  fg = |*, h = *, i = %$, j = -
NSUBST: - = 3=1 / 4=1- / 2=2 / 2=2- / 2=3- / 3--- / -
# Crypt
: else
MONS:   centaur warrior / tengu warrior / naga warrior / merfolk impaler / \
        merfolk javelineer / deep elf knight / deep elf archer
MONS:   minotaur / stone giant / orc warlord / fire giant / frost giant / \
        deep elf blademaster / deep elf master archer
MONS:   titan
SUBST:  fgh = |*, i = *%, j = %$..
NSUBST: - = 3=1 / 4=1- / 12-- / 2=2 / 2=2- / 3 / 3- / -
: end
: ghost_setup(_G, true)
MAP
ccccccccccc
cGvvvvvvvGc
c-igvOvhj-c
c---edf---c
c-vG---Gv-c
c---------c
c-vG---Gv-c
c---------c
cnnn===nnnc
 .........
 ....@....
ENDMAP

NAME:   muffindrake_ghost_dual_entry
DEPTH:  D:10-, Depths
ORIENT: float
KMONS:  O = player_ghost
: if you.in_branch("D") then
MONS:   skeletal warrior / vampire
MONS:   wraith / simulacrum place:D:$
MONS:   necromancer
MONS:   lich
: else
MONS:   vampire knight / vampire mage
MONS:   flayed ghost / juggernaut simulacrum
MONS:   deep elf death mage
MONS:   ancient lich / dread lich
: end
: ghost_good_loot(_G)
NSUBST: - = 2=1 / 2=1- / 2 / 2=2- / 3 / -
TILE:   G = dngn_gravestone
TILE:   t = dngn_tree_dead
COLOUR: t = brown
FTILE:  GtO123498$*|- = floor_pebble_brown / floor_pebble_darkgray
: set_feature_name("granite_statue", "a gravestone")
: set_feature_name("tree", "dead tree")
: ghost_setup(_G)
MAP
     .@.
  cccc.ccc
  cd-n.n-cc
  c-$nnn-eccc
  c-|cGc$$-*c
  cc-cOc-cc$c
  cG-G4G-Gc-c
 cc---9-----c
 ct8-nnn-8--c
cc--nn.nn-t-c
c---n...n---c
c-t-n.T.nt-cc
cc--c...c--c
 c=cc. .cc=c
  @... ...@
ENDMAP

NAME:   muffindrake_ghost_three_little_ghosts
DEPTH:  Depths
ORIENT: float
KMONS:  O = player_ghost
MONS:   deep troll shaman band
MONS:   stone giant / deep troll earth mage / golden dragon
MONS:   iron troll / iron dragon, iron giant
: ghost_good_loot(_G)
NSUBST:  2 = 2=2 / 2=2., 3 = 2=3 / 2=3.
: ghost_setup(_G)
MAP
vvvvvvv
v$d|e$v
v$3O3$v
v.343.v
v.....v
v.....v
vvn=nvv
 v...v
bbb+bbb
b.*|$.b
b.2O2.b
b.2.2.b
b.....b
b.....b
bbn=nbb
 b...b
ccc+ccc
c.*|$.c
c..O..c
c..1..c
c.....c
c.....c
ccn=ncc
  .@.
ENDMAP

NAME:   muffindrake_ghost_dead_mans_drink
DEPTH:  Depths
ORIENT: float
KMONS:  p = col:brown fungus
KMONS:  O = player_ghost
MONS:   stone giant zombie / stone giant simulacrum / spectral stone giant
MONS:   titan zombie / titan simulacrum / spectral titan
MONS:   juggernaut zombie / juggernaut simulacrum / spectral juggernaut
: ghost_good_loot(_G)
NSUBST: 1 = 3=1 / 4=1., 2 = 2=2 / 4=2., 3 = 2=3 / 4=3.
: dgn.delayed_decay(_G, "'", "felid corpse")
: ghost_setup(_G)
MAP
 ccccccc
 c--+*Tc
.cT1xxxc  .@.
@n--+3Tccccncccc
.cT2xxxc|$$-2--c
 c--+3Tcd$$-3--c
 c+cccccvvvccc+c
 c----'vTOe--+-c
 c-----ppppppp-c
 c3p-'---3--2--c
 c-p1-1---2----c
 c2p--p2-3p-1p2c
 c-1--1-'----1-c
 ccncccn=ncccncc
  ......@.'....
ENDMAP

NAME:   biasface_ghost_demon_polymorph
DEPTH:  Depths
KITEM:  O = wand of polymorph ident:type
KMONS:  O = player ghost
MONS:   any common demon
MONS:   balrug / blizzard demon / cacodemon / green death / \
        hell beast / lorocyproca / shadow demon
MONS:   brimstone fiend / tzitzimitl / ice fiend / hell sentinel
: ghost_good_loot(_G)
SUBST:  f = |*
NSUBST: - = 4=1 / 6=1. / 2=2. / .
TILE:   G = dngn_statue_imp / dngn_statue_cerebov / \
            dngn_statue_demonic_bust / dngn_statue_ancient_evil
: ghost_setup(_G)
MAP
vvvvvvvvv
vGffdefGv
v$$232$$v
v--lll--v
v--lll--v
v--lll--v
v-.O...-v
vnn===nnv
G...@...G
ENDMAP

NAME:   ebering_ghost_funeral_grove
DEPTH:  D:8-, Lair, Swamp
ORIENT: float
# Monsters and loot
KITEM:  O = potion of lignification ident:all
KMONS:  O = player ghost
MONS:   wolf / black bear / polar bear
MONS:   spriggan ; spear | trident, spriggan ; spear randart | trident randart
MONS:   spriggan rider, spriggan rider ; spear randart | trident randart
MONS:   boggart, spriggan druid
# Place the loot glyphs randomly in the loot area.
NSUBST: ' = d / e / f / g / '
: ghost_good_loot(_G)
: if you.in_branch("Swamp") then
SUBST:  fg = |*
NSUBST: ' = 098 / 098. / 444. / 5 / 7 / .
# Lair and Dungeon
: else
:     if you.absdepth() < 10 then
SUBST:  d = *, e = *%, fg = '
NSUBST: ' = 1 / 1. / 2 / 2. / 3 / .
:     elseif you.absdepth() < 12 then
SUBST:  e = *, f = %$'', g = '
NSUBST: ' = 1 / 1. / 2 / 2. / 3 / 4. / .
:     elseif you.absdepth() < 14 then
SUBST:  f = %$, g = '
NSUBST: ' = 1 / 1. / 2 / 24.. / 5 / 6. / .
:     else
SUBST:  f = *%, g = %$''
NSUBST: ' = 1 / 122. / 244. / 5 / 6 / .
:     end
: end
# Foliage, 1/5 chance for death theme in swamp or Autumn theme elsewhere.
: if crawl.one_chance_in(5) then
:     if you.in_branch("Swamp") then
KMONS:  p = withered plant / fungus
COLOUR: t = lightgrey / brown / yellow
TILE: t = dngn_tree_dead / dngn_tree_yellow w:5
: set_feature_name("tree","dead tree")
:     else
KMONS:  p = plant / fungus
COLOUR: t = lightred / red w:4 / yellow w:4
TILE:   t = dngn_tree_lightred / dngn_tree_red w:4 / dngn_tree_yellow w:4
:     end
: else
KMONS:  p = plant / fungus w:2
: end
SUBST:  - = pt., S : GV A:1
# Dungeon needs floor color and tiles.
: if you.in_branch("Dungeon") then
COLOUR: .pO012345689de|*$ = green
FTILE:  tGVA.pO012345689de|*$ = floor_moss
: end
: ghost_setup(_G)
MAP
  ccccccccc
 cctttttttcc
 ctt'''--ttc
 ct'-t-..-tc
cctt-'O--.tcc
ctt-..t--.ttc
ct-'-.---t'tc
ct'cnn=nnc'tc
cccnS...Snccc
   ...@...
ENDMAP

NAME:   biasface_ghost_orc_armoury
TAGS:   transparent vaults_orient_s
DEPTH:  D:3-, Orc, Vaults, !Vaults:$
:item(dgn.aux_armour)
:item(dgn.good_aux_armour)
ITEM:   any armour, any armour good_item, any weapon, any weapon good_item
ITEM:   any jewellery, any jewellery good_item
: kitem("p = " .. dgn.loot_potions .. " / " .. dgn.loot_scrolls)
KMONS:  O = player ghost
MONS:   orc, orc ; any weapon good_item | any weapon randart . \
            leather armour good_item | leather armour randart | \
            ring mail good_item | ring mail randart | scale mail good_item | \
            scale mail randart | chain mail good_item | chain mail randart
MONS:   orc priest, warg, orc warrior, orc knight, orc high priest
KMONS:  H = stone giant
KMONS:  J = orc warlord
: setup_armoury_orcs(_G)
: if you.in_branch("D") then
:     if you.depth() < 4 then
SUBST:  hjp = -
NSUBST: - = 3=1 / 6=1. / 2 / 3... / .
:     elseif you.depth() < 6 then
SUBST:  h = h-, jp = -
NSUBST: - = 3=1 / 6=1. / 2 / 3 / 3. / D... / .
:     elseif you.depth() < 9 then
SUBST:  d = e, jp = -
NSUBST: - = 3=1 / 6=1. / 3 / 3. / 4... / D / 2=5. / .
:     elseif you.depth() < 12 then
SUBST:  d = e, f = g, j = j-, p = -
NSUBST: - = 3=1 / 6=1. / 3 / 3. / 4. / D / 5 / 2=5. / .
:     elseif you.depth() < 14 then
SUBST:  d = e, f = g, h = i, p = -
NSUBST: - = 3=1 / 4=1. / 3 / 2=3. / 4. / DDDE / 2=5 / 4=5. / .
:     else
SUBST:  d = e, f = g, h = i, j = k, p = p-
NSUBST: - = 3=1 / 4=1. / 3 / 3. / 4. / 2=5 / 2=5. / EEEF / 2=6 / 2=6. / .7 / .
:    end
: elseif you.in_branch("Orc") then
SUBST:  d = e, f = g, h = i, j = k, p = -
NSUBST: - = 3=1 / 4=1. / 3 / 3. / 4. / 2=5 / 2=5. / EEEF / 2=6 / 2=6. / .7 / .
# Vaults
: else
SUBST:  d = e, f = g, h = i, j = k
NSUBST: - = 3=6 / 4=6. / 7 / 2=7. / F / H / 2=H. / 2=7J..
: end
KFEAT:  _ = altar_beogh
: ghost_setup(_G, true)
MAP
ccccccccccccccc
cI---hd_fj---Ic
c-----p-p-----c
c-cIc--I--cIc-c
c-cnc--O--cnc-c
c----ccncc----c
c.............c
cnnnnn===nnnnnc
I.............I
.......@.......
ENDMAP

NAME:   gammafunk_ghost_icy
DEPTH:  D:3-, Lair, Depths
ORIENT: float
KMONS:  O = player ghost
MONS:   simulacrum, white imp, ice beast, rime drake, ice devil
MONS:   blizzard demon, ice dragon
KMONS:  D = frost giant
KMONS:  E = ice fiend
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 4 then
KITEM:  O = ring of fire ident:type
SUBST:  d = *%, e = %$, fghij = -
NSUBST: - = 3=1 / 4=1' / 2''' / '
:     elseif you.depth() < 6 then
KITEM:  O = ring of fire ident:type
SUBST:  d = *%, e = %$, fghij = -
NSUBST: - = 3=1 / 4=1' / 23 / 23'' / '
:     elseif you.depth() < 9 then
KITEM:  O = ring of fire ident:type / ring of fire randart ident:all w:5
SUBST:  d = *, e = *%, f = %$--, ghij = -
NSUBST: - = 3=12 / 4=12'' / 3 / 3=3' / '
:     elseif you.depth() < 12 then
KITEM:  O = ring of fire ident:type / ring of fire randart ident:all w:5
SUBST:  e = *, f = %$, ghij = -
NSUBST: - = 3=12 / 4=12'' / 2=3 / 3=3' / 45'''''' / '
:     elseif you.depth() < 14 then
KITEM:  O = ring of fire ident:type / ring of fire randart ident:all
SUBST:  f = *, g = %$, hij = -
NSUBST: - = 4=1 / 6=1' / 2=45 / 3=45'' / 67'''''' / '
:     else
KITEM:  O = ring of fire ident:type / ring of fire randart ident:all
SUBST:  f = |*, g = *%, h = %$--, ij = -
NSUBST: - = 4=1 / 6=1' / 2=45 / 3=45'' / 67 / D''' / '
:     end
: elseif you.in_branch("Lair") then
KITEM:  O = ring of fire ident:type / ring of fire randart ident:all
SUBST:  f = *%, g = %$--, hij = -
NSUBST: - = 4=1 / 5=1' / 2=4 / 2=4' / 7''' / '
# Depths
: else
KITEM:  O = ring of fire randart ident:all
SUBST:  fghij = |*
NSUBST: - = 4=1 / 6=1' / 5 / 2=5' / 6 / 2=6' / 2=7D / 2=7D'' / E' / '
: end
COLOUR: xc = white
COLOUR: O1234567DEde|*%$' = blue
RTILE:  x = wall_ice_block
FTILE:  =cnO1234567DEde|*%$' = floor_ice
: ghost_setup(_G)
MAP
     ...........
    ..cnn===nnc..
   ..cc'''''''cc.
   .cc'''''''''c..
  ..c''''''''''cc.
  .cc''''xxxx'''c..
  .c'''xxxdexx''cc.
  .c''xxhfijgxx''c.
 ..n''x---O---x''n.
 .cc''x------xx''c.
 .c'''-----xxx''cc.
 .cc''--------''c..
 ..ccc--cnnc--'cc.
  ...cccc..ccccc..
    .............
ENDMAP

NAME:   maelrawn_ghost_gauntlet_escape
# Same depths where Gauntlets can place
TAGS:   transparent
DEPTH:  D:11-, Lair, Orc:$
ORIENT: float
KPROP:  x = bloody
KMONS:  O = player ghost
MONS:   minotaur
: ghost_good_loot(_G)
NSUBST: ' = 1 / -
: if you.in_branch("D") then
:     if you.depth() < 12 then
SUBST:  e = *, f = %$, gh = -
NSUBST: - = 2=0 / 2=0- / -
:     elseif you.depth() < 14 then
SUBST:  f = *, g = %$, h = -
NSUBST: - = 2=0 / 3=0- / 2=9- / -
:     else
SUBST:  f = |*, g = *%, h = %$--
NSUBST: - = 2=0 / 3=0- / 9 / 9- / -
:     end
: elseif you.in_branch("Lair") then
SUBST:  f = *%, g = %$--, h = -
NSUBST: - = 2=0 / 2=0- / 9- / -
: elseif you.in_branch("Orc") then
SUBST:  f = *, g = %$, h = -
NSUBST: - = 2=0 / 2=0- / 2=9- / -
: end
SUBST:  a = c.
KFEAT:  O = expired_portal
FTILE:  O = dngn_portal_gauntlet_gone
: ghost_setup(_G)
MAP
...........
.nnccnccnn.
.n-gxOxh-n.
.cc'edf'cc.
.c-c'''c-c.
.cac-caa-c.
.c-a---cac.
.c-cc--c-c.
.c-------c.
.cnn===nnc.
.....@.....
ENDMAP

NAME:   ebering_ghost_xom
TAGS:   transparent allow_dup vaults_orient_s
WEIGHT: 0 (D:3-5), 5 (D:6-7)
ORIENT: float
: lone_ghost_guarded_loot(_G, "O")
: lone_ghost_extra_loot(_G, "-")
: setup_xom_dancing_weapon(_G)
KMONS:  O = player_ghost
KFEAT:  O = altar_xom
FTILE:  -|*%$O1 : floor_pebble_brown / floor_pebble_darkgray
: ghost_setup(_G, true)
MAP
 ccc
cc1cc
cdOec
cn=nc
.....
..@..
ENDMAP

# based on sewer_entry_d
NAME:   ebering_ghost_sewer_d
TAGS:   transparent
ORIENT: float
DEPTH:  D:3-6
KMONS:  O = player_ghost
KFEAT:  O = expired_portal
KMONS:  1 = adder
KMONS:  2 = bullfrog
KFEAT:  12*%$ = W
: lone_ghost_guarded_loot(_G, "O")
: if you.depth() < 6 then
SUBST:  d = %$, e = W
NSUBST: 1 = 1 / 1W / 122WWW / W
: else
SUBST:  d = *%, e = %$WW
NSUBST: 1 = 1 / 2 / 12WW / W
: end
COLOUR: 12*%$W = lightgreen / cyan w:5
FTILE:  O = dngn_portal_sewer_rusted
TILE:   c = wall_stone_mossy
: ghost_setup(_G)
MAP
       ..
ccccccnn.
cdOe111=.
ccccccnn.
       ..
ENDMAP

# based on sewer_entry_f
NAME:   ebering_ghost_sewer_f
ORIENT: float
DEPTH:  D:3-6
KMONS:  O = player_ghost
KMONS:  1 = quokka / giant cockroach / rat / ball python
KMONS:  2 = adder / ribbon worm / river rat
KMONS:  3 = bullfrog
KFEAT:  O = expired_portal
KFEAT:  123*%$ = W
: lone_ghost_guarded_loot(_G, "O")
: if you.depth() < 6 then
SUBST:  d = %$, e = W
NSUBST: W = 1 / 2=112WWW / 2 / 2W / 3WW / W
: else
SUBST:  d = *%, e = %$WW
NSUBST: W = 1 / 2=1223WW / 2 / 3 / 3W / W
: end
COLOUR: 123*%$W = lightgreen / cyan w:5
FTILE:  O = dngn_portal_sewer_rusted
TILE:   c = wall_stone_mossy
: ghost_setup(_G)
MAP
 ccccccccccc
.nWWWWeWWWWn.
@=WWWWOWWWW=@
.nWWWWdWWWWn.
 ccccccccccc
ENDMAP

NAME:   ploomutoo_gammafunk_ghost_potion_laboratory
TAGS:   transparent allow_dup vaults_orient_s
DEPTH:  D:8-, Elf, Vaults, !Vaults:$, Depths
ORIENT: float
ITEM:   potion of mutation ident:type q:1
: item(dgn.loot_potions)
ITEM:   hat / robe good_item / pair of gloves / pair of boots / cloak
ITEM:   hat good_item / robe good_item / pair of gloves good_item \
        / pair of boots good_item / cloak good_item
ITEM:   hat randart / robe randart / pair of gloves randart \
        / pair of boots randart / cloak randart
KITEM:  O = potion of cancellation q:2 ident:type
KMONS:  O = player ghost
MONS:   ugly thing, neqoxec, shapeshifter, glowing orange brain, very ugly thing
MONS:   glowing shapeshifter, cacodemon
KMONS:  D = tentacled monstrosity
NSUBST: - = 2=P / 2=P; / ;, ' = 2=P` / `
: if you.in_branch("D") then
:     if you.depth() < 9 then
NSUBST: ; = d. / 2=e / 2=1 / 4=1. /  4. / .
NSUBST: " = d / d. / f / ", ` = 2=3 / 2=3. / 2 / 2. / .
:     elseif you.depth() < 12 then
NSUBST: ; = d. / 2=e / e. / 3=1 / 3=1. / 4. / 6. / .
NSUBST: " = 2=d / ffg / ", ` = 2=3 / 3=3. / 2 / 2=2. / 7... / .
:     elseif you.depth() < 14 then
NSUBST: ; = d / 3=e / 3=1 / 4=1. / 2=4. / 6 / 6. / .
NSUBST: " = 2=d / d. / e. / fg / ", ` = 3=3 / 3=3. / 2 / 3=2. / 7. / D... / .
:     else
NSUBST: ; = d / 3=e / e. / 3=1 / 4=1. / 4 / 4. / 6 / 2=6. / .
NSUBST: " = 3=d / e. / ggh / ", ` = 3=3 / 3=3. / 2 / 3=2. / 7 / D. / .
:     end
: elseif you.in_branch("Elf") or you.in_branch("Vaults") then
NSUBST: ; = d / d. / 4=e / 4=5 / 4=5. / 4 / 4. / 2=D / 2=D. / .
NSUBST: " = 3=d / d. / e / h / ", ` = 4=3 / 4=3. / 6 / 3=6. / 7 / 2=7. / .
# Depths
: else
NSUBST: ; = d / d. / 5=e / 4=5 / 5=5. / 4 / 4. / 3=D / 3=D. / .
NSUBST: " = 4=d / d. / e / h / ", ` = 4=3 / 4=3. / 2=6 / 3=6. / 2=7 / 2=7. / .
: end
MARKER: P = lua:fog_machine { cloud_type = "mutagenic fog", pow_min = 3, \
                pow_max = 5, delay = 5, start_clouds = 3, size = 1, \
                spread_rate = 0, excl_rad = 0 }
MARKER: U = lua:fog_machine { cloud_type = "mutagenic fog", pow_min = 3, \
                pow_max = 5, delay = 5, start_clouds = 3, size = 2, \
                spread_rate = 0, excl_rad = 0 }
: ghost_setup(_G, true)
MAP
bbbbbbbbb
bbU"P"Ubb
b"""O"""b
b'''''''b
b'b'''b'b
b```````b
bnn===nnb
c-------c
c-c---c-c
cc-c-c-cc
c-c---c-c
c;;;c;;;c
c;c;;;c;c
c;;;;;;;c
cnn===nnc
c.......c
....@....
ENDMAP

NAME:   gammafunk_ghost_stat_death
DEPTH:  D:3-, Orc
ORIENT: float
KMONS:  O = player ghost
MONS:   quasit, neqoxec
NSUBST: R = R / -
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 6 then
KITEM:  O = ring of dexterity ident:type
SUBST:  d = *%, e = %$, fgh = -
NSUBST: - = 2=1 / 2=1- / -
:     elseif you.depth() < 9 then
KITEM:  O = ring of dexterity ident:type / \
            ring of dexterity good_item ident:type w:5
SUBST:  d = *, e = *%, f = %$--, gh = -
NSUBST: - = 2=1 / 4=1- / -
:     elseif you.depth() < 12 then
KITEM:  O = ring of dexterity ident:type / \
            ring of dexterity good_item ident:type w:5 / \
            ring of intelligence ident:type / \
            ring of intelligence good_item ident:type w:5
SUBST:  e = *, f = %$, gh = -
NSUBST: - = 2=1 / 2=1- / 2 / 2=2- / -
:     elseif you.depth() < 14 then
KITEM:  O = ring of dexterity good_item ident:type / \
            ring of dexterity randart ident:all w:5 / \
            ring of intelligence good_item ident:type / \
            ring of intelligence randart ident:all w:5
SUBST:  f = *, g = %$, h = -
NSUBST: - = 2=1 / 2=1- / 2=2 / 4=2- / -
:     else
KITEM:  O = ring of dexterity good_item ident:type / \
            ring of dexterity randart ident:all / \
            ring of intelligence good_item ident:type / \
            ring of intelligence randart ident:all
SUBST:  f = |*, g = *%, h = %$--
NSUBST: - = 2=1 / 2=1- / 3=2 / 4=2- / -
:     end
: elseif you.in_branch("Orc") then
KITEM:  O = ring of dexterity good_item ident:type / \
            ring of dexterity randart ident:all w:5 / \
            ring of intelligence good_item ident:type / \
            ring of intelligence randart ident:all w:5
SUBST:  f = *, g = %$, h = -
NSUBST: - = 2=1 / 2=1- / 2=2 / 4=2- / -
: end
MARKER: P = lua:transp_loc("stat_death_entry")
MARKER: Q = lua:transp_dest_loc("stat_death_entry")
MARKER: R = lua:transp_loc("stat_death_exit")
MARKER: S = lua:transp_dest_loc("stat_death_exit")
: ghost_setup(_G)
MAP
    ....@.....
   ..cncScccc.....
  ..ccRccc--cccnc.
  .cc------x---Rc..
  .c----x---x---cc.
  .c--xx--x------c.
 ..nR--x--Q--xx-Rn.
 .cc-x-----x-----c.
 .c----xxxO--xx-cc.
 .cc--x-gedfh---c..
 ..ccc--cnnnc--cc.
  ...cccc.P.cccc..
    ......@......
ENDMAP

NAME:    gammafunk_ghost_smash
TAGS:    transparent passable vaults_orient_n
DEPTH:   D:3-, Orc, Vaults, !Vaults:$, Depths
ORIENT:  float
KMASK:   -OQR1234567DEFHJKde|*%$ = opaque
KMONS:   O = player ghost
# In each branch, one monster gets a fancy randart weapon (or two).
MONS:    ogre
MONS:    ogre ; dire flail good_item | dire flail randart \
            | great mace good_item | great mace randart \
            | giant club good_item w:3 | giant club randart w:3 \
            | giant spiked club good_item w:2 | giant spiked club randart w:2
MONS:    two-headed ogre
MONS:    two-headed ogre ; dire flail good_item \
            | dire flail randart | great mace good_item | great mace randart \
            | giant club good_item w:3 | giant club randart w:3 \
            | giant spiked club good_item w:2 | giant spiked club randart w:2 \
            . dire flail good_item | dire flail randart \
            | great mace good_item | great mace randart \
            | giant club good_item w:3 | giant club randart w:3 \
            | giant spiked club good_item w:2 | giant spiked club randart w:2
MONS:    ettin
MONS:    ettin ; great mace good_item w:20 | great mace randart w:20 \
            | giant club good_item w:3 | giant club randart w:3 \
            | giant spiked club good_item w:2 | giant spiked club randart w:2 \
            .  great mace good_item w:20 | great mace randart w:20 \
            | giant club good_item w:3 | giant club randart w:3 \
            | giant spiked club good_item w:2 | giant spiked club randart w:2
MONS:    ironbound thunderhulk
KMONS:   D = ironbound thunderhulk ; great mace ego:electrocution randart w:20 \
            | giant club ego:electrocution randart w:3 \
            | giant spiked club ego:electrocution randart w:2 \
            . scale mail good_item
KMONS:   E = fire giant ; great mace ego:flaming w:20 \
            | giant club ego:flaming w:3 \
            | giant spiked club ego:flaming w:2
KMONS:   F = fire giant ; great mace ego:flaming randart w:20 \
            | giant club ego:flaming randart w:3 \
            | giant spiked club ego:flaming randart w:2
KMONS:   H = frost giant ; great mace ego:freezing w:20 \
            | giant club ego:freezing w:3 \
            | giant spiked club ego:freezing w:2
KMONS:   J = frost giant ; great mace ego:freezing randart w:20 \
            | giant club ego:freezing randart w:3 \
            | giant spiked club ego:freezing randart w:2
KMONS:   K = iron giant ; great mace ego:heavy randart w:20 \
            | giant club ego:heavy randart w:3 \
            | giant spiked club ego:heavy randart w:2
# Use one of the two inner wall patterns.
SHUFFLE: xv
SUBST:   v = -, x : xcbv
NSUBST:  R = R / -
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 6 then
SUBST:   d = *%, e = %$, fghij = -
NSUBST:  - = 2=1- / 2 / -
:     elseif you.depth() < 9 then
SUBST:   d = *, e = *%, f = %$--, ghij = -
NSUBST:  - = 1 / 2=1- / 24 / -
:     elseif you.depth() < 12 then
SUBST:   e = *, f = %$, ghij = -
NSUBST:  - = 2=3 / 2=3- / 4 / -
:     elseif you.depth() < 14 then
SUBST:   f = *, g = %$, hij = -
NSUBST:  - = 3=3 / 4=3- / 46 / -
:     else
SUBST:   f = |*, g = *%, h = %$--, ij = -
NSUBST:  - = 3=3 / 4=3- / 2=5EH--- / 6FJ / -
:     end
: elseif you.in_branch("Orc") then
SUBST:   f = *, g = %$, hij = -
NSUBST:  - = 2=3 / 4=3- / 46 / -
: elseif you.in_branch("Vaults") then
SUBST:   fg = |*, h = *%, i = %$--, j = -
NSUBST:  - = 4=57EH / 6=57EH---- / 6DFJ / -
# Depths
: else
SUBST:   fgh = |*, i = *%, j = %$--
NSUBST:  - = 5=5EH / 5=5EH--- / 6FJ / K- / -
: end
MARKER: P = lua:transp_loc("smash_entry")
MARKER: Q = lua:transp_dest_loc("smash_entry")
MARKER: R = lua:transp_loc("smash_exit")
MARKER: S = lua:transp_dest_loc("smash_exit")
: ghost_setup(_G, true)
MAP
......@......
.....P.S.....
nnnnnnnnnnnnn
cR-igedfhj-Rc
c-vxxvOvxxv-c
c-xvvx-xvvx-c
c-xvvx-xvvx-c
c-vxxv-vxxv-c
cR----Q----Rc
ccccccccccccc
ENDMAP

NAME:   gammafunk_ghost_nasty_kobolds
DEPTH:  D:3-13
KMONS:  pq = plant / fungus
KFEAT:  q = W
KMONS:  O = player ghost
MONS:   kobold, kobold brigand, kobold demonologist
KMONS:  D = kobold ; dart ego:poisoned . dagger | short sword | whip
KMONS:  E = kobold ; wand of flame | any beam wand | any blast wand \
                | wand of mindburst | wand of polymorph | wand of charming \
                | wand of paralysis . dagger | short sword | whip
KMONS:  F = kobold brigand ; dart ego:poisoned | dart ego:curare w:5 \
                . wand of flame | any beam wand | any blast wand \
                | wand of mindburst | wand of polymorph | wand of charming \
                | wand of paralysis . dagger | short sword | whip
# Define some kobolds with more general nasty ego weapons.
{{
    kmons("H = kobold ; " .. disto_weapon("kobold"))
    kmons("J = kobold brigand ; dart ego:poisoned | dart ego:curare w:5 . " ..
          disto_weapon("kobold"))

    local egos = {["chaos"] = 10, ["venom"] = 10, ["draining"] = 10,
                  ["pain"] = 5, ["electrocution"] = 5, ["distortion"] = 5}
    local basic_def = dgn.monster_weapon("kobold", egos)
    local good_def = dgn.monster_weapon("kobold", egos,
        crawl.coinflip() and "randart" or "good_item")
    kmons("K = kobold ; " .. basic_def)
    kmons("L = kobold brigand ; dart ego:poisoned | dart ego:curare w:5 . " ..
          basic_def)
    kmons("M = kobold brigand ; dart ego:poisoned | dart ego:curare w:5 . " ..
          good_def)
}}
# 50% of time put statue/tree/fountain with plants and vertical wall, otherwise
# add some diagonal wall instead. The second shuffle makes any statue sometimes
# be fountain + water plants.
SHUFFLE: Gprs / Zrsr, Gp / Tq
SUBST: r = -, Z = T, s = x, G : GGt, T : TTUV, x : xcbv
: ghost_good_loot(_G)
: if you.depth() < 6 then
SUBST:  d = *%, e = %$, fg = -
NSUBST: - = 2=1 / 4=1. / DE / DE.. / H / 2=K. / M / .
: elseif you.depth() < 9 then
SUBST:  d = *, e = *%, f = %$--, g = -
NSUBST: - = 2=2 / 4=2. / F / F. / J / 3=L. / M / 3. / .
: elseif you.depth() < 12 then
SUBST:  e = *, f = %$, g = -
NSUBST: - = 2=2 / 2=2. / F / 2=F. / J / 3=L. / M / 3 / 2=3. / .
: else
SUBST:  f = *, g = %$
NSUBST: - = 2 / F / 2=F. / 2=M / 2=J / 3=L. / 2=3 / 4=3. / .
: end
: ghost_setup(_G)
MAP
  ccccc
 ccedfcc
cc--g--cc
cprs-srpc
cG-xOx-Gc
cprs-srpc
cn-----nc
.nn===nn.
....@....
ENDMAP

NAME:   gammafunk_ghost_hive
DEPTH:  D:5-, Lair
KITEM:  ' = potion of ambrosia ident:type
KMONS:  O = player ghost
MONS:   killer bee, queen bee, hornet, meliai
# Chance to make a partial wall in each of the full cells. Add 0-4 ambrosias.
NSUBST: p = x- / -, q = x- / -, r = x- / -, s = x- / -, - = 4='- / -
: ghost_good_loot(_G)
: if you.in_branch("D") then
:   if you.depth() < 6 then
SUBST:  de = *%, f = %$, ghi= -
NSUBST: - = 4=1 / 4=1. / 3... / .
:   elseif you.depth() < 9 then
SUBST:  de = *, f = *%, g = %$--, hi= -
NSUBST: - = 4=1 / 4=1. / 2. / 3. / .
:   elseif you.depth() < 12 then
SUBST:  e = |*, f = *, g = %$, hi= -
NSUBST: - = 4=1 / 4=1. / 2 / 2=3. / 4... / .
:   elseif you.depth() < 14 then
SUBST:  f = |*, g = *, h = %$, i= -
NSUBST: - = 4=1 / 4=1. / 2 / 3 / 2=3. / 2=4. / .
:   else
SUBST:  fg = |*, h = *%, i = %$--
NSUBST: - = 4=1 / 4=1. / 2 / 3 / 2=3. / 4 / 2=4. / .
:   end
# Lair
: else
:   if you.depth() < 4 then
SUBST:  f = |*, g = *, h = %$--, i= -
NSUBST: - = 4=1 / 4=1. / 2 / 3 / 3. / 4. / .
:   else
SUBST:  f = |*, g = *, h = %$, i= -
NSUBST: - = 4=1 / 4=1. / 2 / 3 / 2=3. / 2=4. / .
:   end
: end
COLOUR: x = yellow
TILE:   x = wall_wax
: ghost_setup(_G)
MARKER: P = lua:transp_loc("ghost_hive_entry")
MARKER: Q = lua:transp_dest_loc("ghost_hive_entry")
MARKER: R = lua:transp_loc("ghost_hive_exit")
MARKER: S = lua:transp_dest_loc("ghost_hive_exit")
MAP
         @
  .......P.......
 ..cccccnnnccccc..
..cnxxxfdRegxxxnc..
.cnx-q-xhOix-p-xnc.
.cx--x--xxx--x--xc.
.cnx-q-x---x-p-xnc.
@.ccxxx--x--xxxcc.@
.cnx-r-x---x-s-xnc.
.cx--x--xxx--x--xc.
.cnx-r-x---x-s-xnc.
..cnxxx--Q--xxxnc..
 ..cccccnnnccccc..
  .......S.......
         @
ENDMAP

# Inspired by lemuel_castle_with_subvaults
NAME:    gammafunk_ghost_gnarly_gnolls
TAGS:    no_pool_fixup
DEPTH:   D:3-8
ITEM:    any manual
ITEM:    any jewellery, any jewellery good_item, any jewellery randart
KMONS:   p = plant
KMONS:   O = player ghost
MONS:    gnoll, gnoll bouda, gnoll sergeant, grum band
KMONS:   D = gnoll ; wand of flame | any beam wand | \
                wand of polymorph | wand of charming | \
                wand of paralysis | wand of mindburst \
            . spear w:20 | halberd | club | whip | flail | nothing w:15
# Define some gnolls with reach weapons.
{{
    local basic_weapons = {["halberd"] = 1, ["spear"] = 1}
    local sgt_weapons = {["trident"] = 1, ["spear"] = 1}
    egos = {["venom"] = 15, ["vampirism"] = 5, ["pain"] = 5,
            ["electrocution"] = 5, ["chaos"] = 5}

    local basic_def = dgn.random_item_def(basic_weapons, egos, nil, "|")
    local sgt_basic_def = dgn.random_item_def(sgt_weapons, egos, nil, "|")

    local quality = crawl.one_chance_in(3) and "randart" or "good_item"
    local good_def = dgn.random_item_def(basic_weapons, egos, quality, "|")
    local sgt_good_def = dgn.random_item_def(sgt_weapons, egos, quality, "|")

    kmons("E = gnoll ; " .. basic_def .. " . throwing net | nothing")
    kmons("F = gnoll ; " .. good_def .. " . throwing net | nothing")
    kmons("H = gnoll sergeant ; " .. sgt_basic_def ..
          "    . buckler | kite shield | nothing w:40" ..
          "    . ring mail | scale mail")
    kmons("J = gnoll sergeant ; " .. sgt_good_def ..
          "    . buckler good_item | buckler randart w:5 " ..
          "        | kite shield good_item | kite shield randart w:5 " ..
          "    . ring mail good_item | ring mail randart w:5 " ..
          "        | scale mail good_item | scale mail randart w:5")
}}
# Sometimes add an additional pairs of doors near the landing area. Also
# randomize exit transporters and tower inner walls.
SHUFFLE: qK / rL
NSUBST:  R = R / '
SUBST:   q = c, r = ~, K = T, L = -, s : ccG-
# Scale loot and monsters with depth.
: if you.depth() < 5 then
SUBST:   h = %$, ij= `, 2 = 2'
NSUBST:  - = 2=1 / 2=1. / D / D. / ., ' = E / E. / FFFJ / .
NSUBST:  R = R / E / E.
: elseif you.depth() < 7 then
SUBST:   e = f, h = *, i = %$, j= `
NSUBST:  - = 2=1 / 2=1. / D / D. / ., ' = E / E. / 3 / H. / J / .
: else
SUBST:   e = g, h = |*, i = *, j = %$
NSUBST:  - = 2=1 / 2=1. / D / 2=D. / ., ' = E / 2=E. / 3 / 3. / 2=H. / J / .
:     if not you.uniques("Grum") and crawl.one_chance_in(3) then
NSUBST:   3 = 4 / 3
:     end

: end
KFEAT:   ~ = closed_clear_door
MARKER:  P = lua:transp_loc("gnarly_gnolls_entry")
MARKER:  Q = lua:transp_dest_loc("gnarly_gnolls_entry")
MARKER:  R = lua:transp_loc("gnarly_gnolls_exit")
MARKER:  S = lua:transp_dest_loc("gnarly_gnolls_exit")
TILE:    c = wall_stone_smooth
COLOUR:  `defghij|*%$O = cyan
FTILE:   `defghij|*%$O = floor_cobble_blood
COLOUR:  " = brown
FTILE:   " = floor_mud
: ghost_setup(_G)
MAP
...........................
.wwwwwwwwwwwwWwwwwwwwwwwww.
.wwwwwwwwwwwwWwwwwwwwwwwww.
.wwncccn...........ncccnww.
.wwc's-c.cnc.S.cnc.c-s'cww.
.wwc---cncRccnccRcnc---cww.
.wwncc---------------ccnww.
.ww.Gc-cnqncc~ccncnc-cG.ww.
.ww.cc-cpKpcp-Gcej$c-cc.ww.
.WW.n'-~-----QTcdO$~-2n.WW.
.ww.cc-cpKpcp-Gchi$c-cc.ww.
.ww.Gc-cnqncc~ccncnc-cG.ww.
.wwncc---------------ccnww.
.wwc---cncRccnccRcnc---cww.
.wwc's-c.cnc.P.cnc.c-s'cww.
.wwncccn...........ncccnww.
.wwwwwwwwwww"""wwwwwwwwwww.
.wwwwwwwwwww"""wwwwwwwwwww.
...........................
ENDMAP

NAME:   gammafunk_ghost_tricky_traps
TAGS:   transparent vaults_orient_s
DEPTH:  D:$, Shoals, Spider, Vaults, Elf, !Vaults:$, Depths, Zot
KFEAT:  ^ = zot trap / dispersal trap w:5 / alarm trap w:1 / floor w:16
KFEAT:  ' = zot trap / dispersal trap w:5 / alarm trap w:1 / floor w:8
: kitem("O = " .. dgn.randart_aux_armour)
KMONS:  O = player ghost
: ghost_good_loot(_G)
: if you.in_branch("D") then
MONS:   boggart
SUBST:  f = |*, g = %$, hi = -
NSUBST: - = 1 / 2=1. / 4=0 / 6=0. / .
: elseif you.in_branch("Shoals") then
MONS:   merfolk aquamancer
SUBST:  f = |*, g = *%, h = %$--, i = -
NSUBST: - = 1 / 2=1. / 5=0 / 6=0. / .
: elseif you.in_branch("Spider") then
MONS:   jumping spider
SUBST:  f = |*, g = *%, h = %$--, i = -
NSUBST: - = 1 / 2=1. / 5=0 / 6=0. / .
: elseif you.in_branch("Vaults") then
MONS:   boggart, rakshasa
SUBST:  f = |*, g = *, h = %$, i = -
NSUBST: - = 1 / 2=1. / 5=0 / 6=0. / 2 / .
: elseif you.in_branch("Elf") then
MONS:   deep elf archer
SUBST:  f = |*, g = *, h = %$, i = -
NSUBST: - = 1 / 2=1. / 6=0 / 6=0. / .
: elseif you.in_branch("Depths") then
MONS:   boggart, rakshasa
SUBST:  fg = |*, h = *, i = %$
NSUBST: - = 1 / 2=1. / 6=0 / 8=0. / 2 / .
: elseif you.in_branch("Zot") then
MONS:   draconian shifter, electric golem
SUBST:  fghi = |*
NSUBST: - = 1 / 2=1. / 7=0 / 8=0. / 2 / 2.. / .
: end
SUBST:  G : GGtU
: ghost_setup(_G, true)
MAP
ccccccccccccc
cG-hfdOegi-Gc
c-n-n-n-n-n-c
c'-'-'-'-'-'c
c-'-n-n-n-'-c
cG-'-'-'-'-Gc
cccnn===nnccc
.^.^.....^.^.
^.^.^.^.^.^.^
.^.^.^.^.^.^.
^.^.^.^.^.^.^
ENDMAP

NAME:    gammafunk_ghost_crypt
TAGS:    vaults_orient_s
DEPTH:   D:13-, Vaults, !Vaults:$, Crypt, Depths, Zot
: item(dgn.loot_scrolls .. " / " .. dgn.loot_potions)
# Always place one randart aux, one randart jewel, and one nice book, each
# using the possible ghost locations.
: kitem("D = " .. dgn.randart_aux_armour)
KITEM:   EHK = any jewellery randart
KITEM:   FJL = randbook owner:Kikubaaqudgha disc:necromancy numspells:6 \
               / necronomicon / manual of necromancy
KITEM:   12 = superb_item / star_item
KMONS:   DEF = player ghost
KMONS:   HJ1 =  lich
KMONS:   KL2 =  ancient lich / dread lich
# 1/7 chance for 3 ghosts, 2/7 chance for 2 ghosts, 4/7 chance for 1 ghost.
# Any ghost that doesn't place will place a depth-appropriate lich instead.
SHUFFLE: EF / EJ / EJ / HJ / HJ / HJ / HJ
# For later branches, guarantee at least one ancient or dread lich and
# upgrade ordinary liches by depth.
: if you.in_branch("Vaults") then
SUBST:   H = HHHK, J = JJJL
NSUBST:  1 = 2 / 1112
: elseif you.in_branch("Crypt") then
SUBST:   H = HHK, J = JJL
NSUBST:  1 = 2 / 112
: elseif you.in_branch("Depths") then
SUBST:   H = HK, J = JL
NSUBST:  1 = 2 / 12
: elseif you.in_branch("Zot") then
SUBST:   H = K, J = L, 1 = 2
: end
# 1.5 loot items per ghost/lich total. Mix in good loot scrolls and potions.
SUBST:  d = dd|*----, V = VY
KFEAT:  _ = altar_kikubaaqudgha
FTILE:  -d|*%$ODEFHJKL12VY_ = floor_pebble_brown / floor_pebble_darkgray
: ghost_setup(_G, true)
MAP
    ccc
  cccDccc
cccEcdcFccc
c1ddV_Vdd1c
cc-------cc
 cnn===nnc
  .......
  ...@...
ENDMAP

NAME:   gammafunk_ghost_berserking_beasts
DEPTH:  D:7-, Lair, Orc, Shoals, Snake, Spider, Swamp, Elf, Depths, Zot
KITEM:  D = any jewellery good_item
: kitem("E = " .. dgn.good_aux_armour)
KITEM:  F = any jewellery randart
: kitem("H = " .. dgn.randart_aux_armour)
KMONS:  DEFH = player ghost
MONS:   moth of wrath
NSUBST: R = R / -
: ghost_good_loot(_G)
: if you.in_branch("D") then
:     if you.depth() < 9 then
MONS:   water moccasin / ice beast / bullfrog / black bear
MONS:   yak / wyvern / killer bee band
MONS:   komodo dragon / redback / basilisk / hydra / hornet / manticore /\
        acid dragon / catoblepas
SUBST:  D = DE, d = *, e = *%, f = %$, ghij= -
NSUBST: - = 1 / 2=2 / 3=2. / 3. / 4... / .
:     elseif you.depth() < 12 then
MONS:   killer bee band / yak / water moccasin / wyvern / komodo dragon
MONS:   hydra / redback / basilisk / hornet / manticore / acid dragon
MONS:   catoblepas / fire dragon / wolf spider / ice dragon
SUBST:  D = DE, e = *, f = *%, g = %$--, hij= -
NSUBST: - = 1 / 2=2 / 4=2. / 3 / 4... / .
:     elseif you.depth() < 14 then
MONS:   water moccasin / komodo dragon / hydra / redback / basilisk /\
        manticore / acid dragon
MONS:   catoblepas / harpy
MONS:   fire dragon / wolf spider / ice dragon
SUBST:  D = DEFH, f = |*, g = *%, h = %$--, ij= -
NSUBST: - = 1 / 1. / 3=2 / 3=2. / 3 / 3. / 4. / .
:     else
MONS:   hydra / redback / manticore / acid dragon / catoblepas / harpy
MONS:   fire dragon / wolf spider / ice dragon
MONS:   storm dragon / shadow dragon / iron dragon
SUBST:  D = FH, f = |*, g = *, h = %$, ij= -
NSUBST: - = 1 / 1. / 3=2 / 4=2. / 3 / 2=3. / 4. / .
:     end
: elseif you.in_branch("Lair") then
SUBST:  D = DEFH, f = *, g = %$, hij= -
NSUBST: - = 1 / 1. / 2=0 / 4=0. / 9 / 9. / 8... / .
: elseif you.in_branch("Orc") then
# I hope you like wargs.
MONS:   warg
SUBST:  D = DEFH, f = |*, g = *%, h = %$--, ij= -
NSUBST: - = 1 / 1. / 4=2 / 5=2. / .
: elseif you.in_branch("Shoals") then
MONS:   snapping turtle / manticore
MONS:   harpy / sea snake
MONS:   alligator snapping turtle
SUBST:  D = FH, fg = |*, h = *%, i = $%--, j= -
NSUBST: - = 1 / 1. / 3=2 / 5=2. / 3 / 3=3. / 4. / .
: elseif you.in_branch("Snake") then
MONS:   black mamba / mana viper / anaconda
MONS:   guardian serpent / shock serpent
SUBST:  D = FH, fg = |*, h = *%, i = $%--, j= -
NSUBST: - = 1 / 1. / 3=2 / 5=2. / 3 / 4=3. / .
: elseif you.in_branch("Spider") then
MONS:   hornet / redback / tarantella / jumping spider / orb spider
MONS:   wolf spider / emperor scorpion / spark wasp
MONS:   torpor snail / ghost moth
SUBST:  D = FH, fg = |*, h = *%, i = $%--, j= -
NSUBST: - = 1 / 1. / 3=2 / 5=2. / 3 / 3=3. / 4. / .
: elseif you.in_branch("Swamp") then
MONS:   goliath frog / tyrant leech
MONS:   hydra / alligator / swamp dragon
MONS:   bunyip
SUBST:  D = FH, fg = |*, h = *%, i = $%--, j= -
NSUBST: - = 1 / 1. / 3=2 / 5=2. / 3 / 3=3. / 4. / .
: elseif you.in_branch("Elf") then
MONS:   shapeshifter
MONS:   glowing shapeshifter
SUBST:  D = FH, fg = |*, h = *, i = $%, j= -
NSUBST: - = 1 / 2=1. / 4=2 / 4=2. / 2=3 / 2=3. / .
: elseif you.in_branch("Depths") then
MONS:   spark wasp / very ugly thing / fire dragon / ice dragon / glass eye w:5
MONS:   storm dragon / shadow dragon / quicksilver dragon / golden dragon \
        / iron dragon
MONS:   caustic shrike
SUBST:  D = FH, fgh = |*, i = *, j= %$
NSUBST: - = 2=1 / 1. / 4=2 / 4=2. / 2=3 / 2=3. / 4 / 4. / .
: elseif you.in_branch("Zot") then
MONS:   ghost moth / storm dragon / shadow dragon / quicksilver dragon \
        / golden dragon
MONS:   caustic shrike / shard shrike
SUBST:  D = FH, fghij = |*
NSUBST: - = 2=1 / 2=1. / 4=2 / 5=2. / 3=3 / 3=3. / .
: end
MARKER: P = lua:transp_loc("berserking_beasts_entry")
MARKER: Q = lua:transp_dest_loc("berserking_beasts_entry")
MARKER: R = lua:transp_loc("berserking_beasts_exit")
MARKER: S = lua:transp_dest_loc("berserking_beasts_exit")
: ghost_setup(_G)
MAP
    ....@.....
   ..cncScccc.....
  ..ccRccc--cccnc.
  .cc------x---Rc..
  .c----x---x---cc.
  .c--xx--x------c.
 ..nR--x--Q--xx-Rn.
 .cc-x-----x-----c.
 .c----xxxD--xx-cc.
 .cc--xigedfhj--c..
 ..ccc--cnnnc--cc.
  ...cccc.P.cccc..
    ......@......
ENDMAP

# Map inspired by trog_three_pillars_becter
NAME:    gammafunk_ghost_wrathful_warriors
TAGS:    transparent passable vaults_orient_n
DEPTH:   D:7-, Lair, Orc, Shoals, Snake, Swamp, Elf, Vaults, !Vaults:$, Depths
DEPTH:   Zot
KMASK:   -_OQRDEFHJKLdeqrsyuz1234|*%$ = opaque
KMONS:   O = player ghost
MONS:    moth of wrath
# Definitions needed across branches
{{
kmons("D = orc knight; " .. wrathful_weapon("knight", "randart") ..
      "    . chain mail good_item | plate armour good_item")
kmons("E = ettin ; " .. wrathful_weapon("ogre", "randart") ..
      "    . " .. wrathful_weapon("ogre",
                      crawl.coinflip() and "randart" or "good_item"))
kmons("F = orc warlord ; " .. wrathful_weapon("knight", "randart") ..
      "    . kite shield good_item | tower shield good_item w:5" ..
      "    . chain mail good_item | plate armour good_item")
kmons("H = spriggan rider ; " .. wrathful_weapon("rider", "randart") ..
      "    . robe good_item . buckler good_item")
kmons("J = spriggan berserker ; " .. wrathful_weapon("berserker", "randart") ..
      "    . robe good_item | buckler good_item")
kmons("K = spriggan defender ; " .. wrathful_weapon("defender", "randart") ..
      "    . robe good_item  . buckler good_item")
kmons("L = deep elf blademaster ; " ..
       wrathful_weapon("blademaster", "randart") ..
       " . " .. wrathful_weapon("blademaster",
                    crawl.coinflip() and "randart" or "good_item") ..
       " . leather armour good_item")
}}
SUBST:  ' = a--, " = aa-
NSUBST: R = R / -
: ghost_good_loot(_G)
: if you.in_branch("D") then
{{
kmons("q = kobold; " .. wrathful_weapon("kobold",
               crawl.one_chance_in(3) and "randart" or "good_item") ..
      "    . dart ego:curare | dart ego:poisoned w:5")
kmons("r = gnoll sergeant ; " .. wrathful_weapon("sergeant",
               crawl.one_chance_in(3) and "randart" or "good_item") ..
      "    . leather armour good_item | ring mail good_item" ..
      "    . buckler good_item | kite shield good_item w:5")
kmons("s = orc warrior ; " .. wrathful_weapon("warrior",
               crawl.one_chance_in(3) and "randart" or "good_item") ..
      "    . chain mail good_item | plate armour good_item")
kmons("u = ogre ; " .. wrathful_weapon("ogre",
               crawl.one_chance_in(3) and "randart" or "good_item"))
kmons("y = two-headed ogre ; " .. wrathful_weapon("ogre",
               crawl.one_chance_in(3) and "randart" or "good_item") ..
      "    . " .. wrathful_weapon("ogre", "good_item"))
kmons("z = tengu warrior ; " .. wrathful_weapon("warrior-1h", "randart") ..
      "    . leather armour good_item | ring mail good_item" ..
      "    . buckler good_item | kite shield good_item")
}}
:     if you.depth() < 9 then
MONS:   gnoll sergeant / ogre / orc warrior
MONS:   troll / two-headed ogre
SUBST:  d = *, e = *%, f = %$, ghij= -
NSUBST: - = 1 / qrsu / 2 / 3=2- / 3y-- / -
:     elseif you.depth() < 12 then
MONS:   orc warrior / troll / two-headed ogre
MONS:   deep troll / tengu warrior
SUBST:  e = *, f = *%, g = %$--, hij= -
NSUBST: - = 1 / sy / 2 / 4=2- / 3z / -
:     elseif you.depth() < 14 then
MONS:   troll / two-headed ogre
MONS:   tengu warrior / orc knight
MONS:   deep troll / stone giant
SUBST:  f = |*, g = *%, h = %$--, ij= -
NSUBST: - = 1 / 1- / 3=2 / 3=2- / zD / zD-- / 4E-- / -
:     else
MONS:   two-headed ogre / tengu warrior
MONS:   deep troll
MONS:   stone giant
SUBST:  f = |*, g = *, h = %$, ij= -
NSUBST: - = 1 / 1- / 3=2 / 4=2- / D / 2=D3-- / 4EF--- / -
:     end
: elseif you.in_branch("Lair") then
MONS:   spriggan
SUBST:  f = *, g = %$, hij= -
NSUBST: - = 1 / 1- / 2=2 / 4=2- / H / H- / J--- / -
: elseif you.in_branch("Orc") then
MONS:   orc warrior / troll / two-headed ogre
MONS:   deep troll
MONS:   stone giant
SUBST:  f = |*, g = *%, h = %$--, ij= -
NSUBST: - = 1 / 1- / 2=2 / 4=2- / D / D3-- / 4EF--- / -
: elseif you.in_branch("Shoals") then
# Place merfolk through merfolk impaler bands so they get better equipment.
# Each band is 2-5 merfolk, 3.5 on-average.
{{
kmons("q = merfolk impaler band ; " .. wrathful_weapon("impaler", "randart") ..
      "    . robe good_item | leather armour good_item")
}}
MONS:   merfolk
MONS:   merfolk impaler
SUBST:  fg = |*, h = *%, i = $%--, j= -
NSUBST: - = 1 / 1- / q / 2=q- / 3=3- / -
: elseif you.in_branch("Snake") then
{{
kmons("q = naga warrior ; " .. wrathful_weapon("warrior", "randart") ..
      "    . robe good_item w:95 | barding good_item w:5" ..
      "    . kite shield good_item | tower shield good_item")
}}
MONS:   naga / salamander
MONS:   naga warrior
SUBST:  fg = |*, h = *%, i = $%--, j= -
NSUBST: - = 1 / 1- / 3=2 / 5=2- / q / 2=q- / 2=3- / -
: elseif you.in_branch("Swamp") then
MONS:   spriggan w:20 / spriggan rider
MONS:   spriggan rider / spriggan berserker
SUBST:  fg = |*, h = *%, i = $%--, j= -
NSUBST: - = 1 / 1- / 3=2 / 5=2- / J / HJ-- / 2=3- / K- / -
: elseif you.in_branch("Elf") then
MONS:   deep elf blademaster
SUBST:  fg = |*, h = *, i = $%, j= -
# There aren't any good lower-tier, trog-appropriate warrior types. So use all
# blademasters, but reduce the monster count.
NSUBST: - = 1 / 2=1- / 2=L / 3=2- / -
: elseif you.in_branch("Vaults") then
MONS:   deep troll w:5 / vault guard
MONS:   ettin / stone giant
SUBST:  fgh = |*, i = *, j= %$
NSUBST: - = 2=1 / 1- / 4=2 / 4=2- / 3 / 2=3- / EF / EF-- / -
: elseif you.in_branch("Depths") then
MONS:   tengu warrior / deep troll / spriggan berserker / stone giant / ettin
MONS:   deep elf blademaster / spriggan defender
MONS:   juggernaut
SUBST:  fgh = |*, i = *, j= %$
NSUBST: - = 2=1 / 1- / 4=2 / 4=2- / 2=KL / KL-- / 3- / 4 / 4- / -
: elseif you.in_branch("Zot") then
{{
kmons("q = base draconian; " .. wrathful_weapon("knight", "randart"))
kmons("r = draconian monk; cloak randart")
}}
MONS:   base draconian
MONS:   draconian monk
SUBST:  fghij = |*
NSUBST: - = 2=1 / 2=1- / 3=q / 2 / 5=2- / 2=r / 3 / 3=3- / -
: end
KFEAT:  _ = altar_trog
KFEAT:  a = rock_wall
MARKER: P = lua:transp_loc("wrathful_warriors_entry")
MARKER: Q = lua:transp_dest_loc("wrathful_warriors_entry")
MARKER: R = lua:transp_loc("wrathful_warriors_exit")
MARKER: S = lua:transp_dest_loc("wrathful_warriors_exit")
COLOUR: a = lightred
TILE:   a = wall_pebble_red
: ghost_setup(_G, true)
MAP
       .@.
    ....P....
  ....cnnnc....
 ...ccc-R-ccc...
 ..cc-----'acc..
...ca''--"aaac...
..cc'aa"-ala'cc..
..n-'aledfaa'-n..
..nR'aag_h---Rn..
..n----iOja'--n..
..cc----"la'-cc..
...c----'aa--c...
 ..cc----''acc..
 ...ccc-Q-ccc...
  ....cnnnc....
    ....S....
      .....
ENDMAP

NAME:   gammafunk_ghost_abyssal_escape
TAGS:   transparent passable preserve_wall
ORIENT: float
KMASK:  -DEFHNOQRdeqrsyuz1234|*%$^ = opaque
KITEM:  N = scroll of teleportation q:3 ident:all w:20 \
            / scroll of blinking ident:all w:20 \
            / dart ego:dispersal ident:all \
            / book of spatial translocations \
            / book of the warp \
            / there-and-back book \
            / book of displacement \
            / randbook owner:Lugonu disc:translocation ident:all w:5 \
            / manual of translocations w:2 / rift w:2
KMONS:  O = player ghost
KFEAT:  O = enter_abyss
KFEAT:  ^ = dispersal trap
KFEAT:  t = demonic_tree
KFEAT:  a = x
SUBST:  c = c:30 v b, ' = '.
COLOUR: -apQ = magenta
FTILE:  -'apPQncbv = floor_nerves
# Randomize transporter feature placement among set of specific locations on
# 'P', using remaining instances for loot.
NSUBST: P = P / S, Q = Q / R, R = R / k, S = S / '
NSUBST: k = d / e / f / g / h / i / j / -
# Place some rocks and dispersal traps in the inner area and along the inner
# wall, but with lower density along wall to make fewer choke points.
SUBST:  a = a -:7 ^:1, p = a -:37 ^:1
# Place ghost and translocation loot, remaining instances of '-' will be used
# for further loot and monster placement.
NSUBST: - = O / N / -
: ghost_good_loot(_G)
# Some monsters we use in multiple branches
{{
kmons("D = orc knight; " .. disto_weapon("knight", "randart") ..
      "    . chain mail good_item | plate armour good_item")
kmons("E = spriggan rider; " .. disto_weapon("rider", "randart") ..
      "    . robe good_item . buckler good_item")
kmons("F = deep elf knight; " .. disto_weapon("elf knight", "randart") ..
      "    . leather armour good_item | ring mail good_item" ..
      "      | scale mail good_item | chain mail good_item" ..
      "    . buckler good_item")
kmons("H = orc warlord; " .. disto_weapon("knight", "randart") ..
      "    . kite shield good_item | tower shield good_item w:5" ..
      "    . chain mail good_item | plate armour good_item")
}}
: if you.in_branch("D") then
{{
kmons("q = kobold; " .. disto_weapon("kobold",
               crawl.one_chance_in(3) and "randart" or "good_item"))
kmons("r = gnoll; " .. disto_weapon("gnoll",
               crawl.one_chance_in(3) and "randart" or "good_item"))
kmons("s = kobold brigand; " .. disto_weapon("kobold",
               crawl.one_chance_in(3) and "randart" or "good_item"))
kmons("u = gnoll sergeant; " .. disto_weapon("sergeant",
               crawl.one_chance_in(3) and "randart" or "good_item") ..
      "    . leather armour good_item | ring mail good_item" ..
      "    . buckler good_item | kite shield good_item w:5")
kmons("y = orc warrior ; " .. disto_weapon("warrior",
               crawl.one_chance_in(3) and "randart" or "good_item") ..
      "    . chain mail good_item | plate armour good_item")
kmons("z = skeletal warrior ; " .. disto_weapon("warrior", "randart"))
}}
:     if you.depth() < 6 then
MONS:   any lesser demon / small abomination
MONS:   toenail golem / ancient zyme
SUBST:  d = *%, e = %$, fghij= -
NSUBST: - = qrs / 2=1 / 2=1- / 2--- / -
:     elseif you.depth() < 9 then
MONS:   any lesser demon w:5 / small abomination
MONS:   toenail golem / ancient zyme / any common demon / ugly thing
MONS:   worldbinder / large abomination / raiju / shapeshifter / rakshasa \
        / arcanist / occultist / hell hog / thrashing horror
SUBST:  d = *, e = *%, f = %$, ghij= -
NSUBST: - = suy / 2=1 / 2=1- / 2=2- / 3--- / -
:     elseif you.depth() < 12 then
MONS:   small abomination / toenail golem / any common demon w:5
MONS:   ugly thing / large abomination / raiju / shapeshifter / arcanist \
        / occultist / hell hog / thrashing horror
MONS:   ancient zyme / worldbinder / rakshasa
MONS:   great orb of eyes / glowing orange brain / very ugly thing \
        / lurking horror / wretched star / tentacled starspawn
SUBST:  e = *, f = *%, g = %$--, hij= -
NSUBST: - = uyz / 2=1 / 2=1- / 2 / 2- / 3- / 4--- / -
:     elseif you.depth() < 14 then
MONS:   any common demon / ugly thing / large abomination / worldbinder
MONS:   raiju / shapeshifter / thrashing horror / arcanist / occultist \
        / hell hog / very ugly thing
MONS:   ancient zyme / rakshasa / great orb of eyes / glowing orange brain
MONS:   lurking horror / wretched star / tentacled starspawn / cacodemon \
        / hellion / apocalypse crab / glowing shapeshifter / crystal guardian \
        / tentacled monstrosity w:2 / starcursed mass w:2 / daeva god:Xom w:2 \
        / executioner w:2 / profane servitor w:2
SUBST:  f = |*, g = *%, h = %$--, ij= -
NSUBST: - = yzDF / 2=1 / 3=1- / 2 / 2=2- / 3 / 4- / -
:     else
MONS:   ugly thing / large abomination / worldbinder / raiju / shapeshifter \
        / rakshasa / thrashing horror / arcanist / occultist
MONS:   arcanist / occultist / hell hog / great orb of eyes / very ugly thing \
        / glowing orange brain / tentacled starspawn / cacodemon
MONS:   lurking horror / wretched star / hellion / apocalypse crab
MONS:   glowing shapeshifter / crystal guardian / tentacled monstrosity \
        / starcursed mass / daeva god:Xom / executioner / profane servitor \
        / hell sentinel w:5 / hellephant w:5
SUBST:  f = |*, g = *, h = %$, ij= -
NSUBST: - = qDFH / 2=1 / 3=1- / 2 / 3=2- / 3 / 4 / -
:     end
: elseif you.in_branch("Lair") then
{{
kmons("q = spriggan; " .. disto_weapon("spriggan",
      crawl.one_chance_in(3) and "randart" or "good_item"))
}}
MONS:   any common demon / ugly thing
MONS:   large abomination / raiju / shapeshifter / rakshasa / hell hog \
        / thrashing horror
MONS:   ancient zyme / worldbinder
MONS:   great orb of eyes / glowing orange brain / very ugly thing \
        / lurking horror / tentacled starspawn / wretched star \
        / cacodemon / hellion / apocalypse crab / glowing shapeshifter
SUBST:  f = *, g = %$, hij= -
NSUBST: - = qE / 2=1 / 2=1- / 2 / 2=2- / 3- / 4- / -
FTILE:  'PSncbv = floor_nerves_green
: elseif you.in_branch("Orc") then
MONS:   any common demon / ugly thing / large abomination / worldbinder / raiju
MONS:   shapeshifter / rakshasa / thrashing horror / occultist / hell hog \
        / very ugly thing
MONS:   ancient zyme / great orb of eyes / glowing orange brain
MONS:   lurking horror / wretched star / tentacled starspawn / cacodemon \
        / hellion / apocalypse crab / glowing shapeshifter / crystal guardian \
        / tentacled monstrosity w:2 / starcursed mass w:2 / daeva god:Xom w:2 \
        / executioner w:2 / profane servitor w:2
SUBST:  f = |*, g = *%, h = %$--, ij= -
NSUBST: - = DH / 2=1 / 3=1- / 2 / 2=2- / 3 / 4- / -
FTILE:  'PSncbv = floor_nerves_brown
: elseif you.in_branch("Shoals")
:        or you.in_branch("Snake")
:        or you.in_branch("Swamp")
:        or you.in_branch("Spider") then
# Use the same basic monster list for all 4 Lair branches.
MONS:   ugly thing / large abomination / worldbinder / raiju \
        / thrashing horror / occultist / hell hog
MONS:   great orb of eyes / glowing orange brain / very ugly thing \
        / tentacled starspawn / cacodemon
MONS:   lurking horror / wretched star / hellion / apocalypse crab
MONS:   glowing shapeshifter / crystal guardian / tentacled monstrosity \
        / starcursed mass / daeva god:Xom / executioner / profane servitor \
        / hell sentinel / hellephant
# Define any branch-specific disto warriors and other substitutions.
:     if you.in_branch("Shoals") then
{{
kmons("q = merfolk impaler ; " .. disto_weapon("impaler", "randart") ..
      "    . robe good_item | leather armour good_item")
}}
NSUBST: - = q / -
FTILE:  'PSncbv = floor_nerves_yellow
:     elseif you.in_branch("Snake") then
{{
kmons("q = naga warrior ; " .. disto_weapon("warrior", "randart") ..
      "    . robe good_item w:90 | barding good_item" ..
      "    . kite shield good_item | tower shield good_item")
kmons("r = nagaraja ; " .. disto_weapon("warrior", "randart") ..
      "    . robe good_item w:40 | barding good_item")
}}
NSUBST: - = qr / -
FTILE:  'PSncbv = floor_nerves_green
:     elseif you.in_branch("Swamp") then
{{
kmons("q = spriggan druid ; " .. disto_weapon("druid", "randart") ..
      "    . robe good_item")
}}
# Potential druids need some trees!
SUBST:  a = taaa
NSUBST: - = Eq / -
FTILE:  'PSncbv = floor_nerves_brown
:     elseif you.in_branch("Spider") then
# No good humanoids to wield distortion in Spider, so let's go with a narrative
# of the player getting banished by a zot trap.
KFEAT:  ~ = zot trap
NSUBST: - = ~ / 2=~- / -
FTILE:  'PSncbv = floor_nerves_brown
:     end
# Common monster/loot placement for all Lair branches.
SUBST:  fg = |*, h = *%, i = $%--, j= -
NSUBST: - = 2=1 / 4=1- / 2=2 / 2=2- / 3 / 4 / -
# Vaults and Elf mostly share the same monster/loot counts and monster lists.
: elseif you.in_branch("Vaults") or you.in_branch("Elf") then
:     if you.in_branch("Vaults") then
{{
kmons("q = vault warden ; " .. disto_weapon("knight", "randart") ..
      "    . kite shield good_item | tower shield good_item w:5" ..
      "    . chain mail good_item | plate armour good_item")
}}
:     else
# Vaults needs the warlord on H, so just redefine H in Elf so we can use the
# same NSUBST.
{{
kmons("qH = deep elf blademaster; " .. disto_weapon("blademaster", "randart") ..
      " . " .. disto_weapon("blademaster",
                   crawl.one_chance_in(3) and "randart" or "good_item") ..
      " . leather armour good_item")
}}
:     end
MONS:   large abomination / worldbinder / shapeshifter / thrashing horror \
        / rakshasa / very ugly thing / great orb of eyes / glowing orange brain
MONS:   tentacled starspawn / cacodemon / deep elf demonologist \
        / deep elf sorcerer / glowing shapeshifter / crystal guardian
MONS:   wretched star / lurking horror / hellion / apocalypse crab
MONS:   tentacled monstrosity / starcursed mass / daeva god:Xom / executioner \
        / profane servitor / hellephant / hell sentinel
SUBST:  fg = |*, h = *, i = $%, j= -
NSUBST: - = qH / 3=1 / 3=1- / 2=2 / 2=2- / 3 / 4 / 4- / -
FTILE:  'PSncbv = floor_nerves_cyan
: elseif you.in_branch("Crypt") then
{{
kmons("q = ancient champion ; " .. disto_weapon("warrior-2h", "randart") ..
      "    . chain mail good_item | plate armour good_item")
}}
MONS:   thrashing horror / rakshasa / very ugly thing / great orb of eyes \
        / glowing orange brain / tentacled starspawn / cacodemon
MONS:   glowing shapeshifter / crystal guardian / lich
MONS:   lurking horror / wretched star / hellion / apocalypse crab
MONS:   tentacled monstrosity / starcursed mass / daeva god:Xom / executioner \
        / profane servitor / hellephant / hell sentinel
SUBST:  fgh = |*, i = *%, j= $%--
NSUBST: - = q / 3=1 / 4=1- / 2=2 / 2=2- / 3 / 3- / 4 / 4- / -
: elseif you.in_branch("Depths") then
{{
kmons("q = spriggan defender; " .. disto_weapon("defender", "randart") ..
      "    . robe good_item  . buckler good_item")
kmons("r = tengu reaver; " .. disto_weapon("knight-1h", "randart") ..
      "    . scale mail good_item  . buckler good_item")
}}
MONS:   rakshasa / very ugly thing / great orb of eyes / glowing orange brain \
        / tentacled starspawn / cacodemon
MONS:   glowing shapeshifter / crystal guardian / tentacled monstrosity \
        / daeva god:Xom / executioner / profane servitor
MONS:   lurking horror / wretched star / hellion / apocalypse crab \
        / starcursed mass
MONS:   ancient lich / dread lich / hellephant / hell sentinel
SUBST:  fgh = |*, i = *, j= %$
NSUBST: - = Hqr / 4=1 / 4=1- / 2=2 / 2=2- / 3 / 3- / 4 / 4- / -
: elseif you.in_branch("Zot") then
{{
kmons("q = draconian knight; " .. disto_weapon("knight", "randart") ..
      "    . cloak good_item . kite shield good_item | tower shield good_item")
kmons("r = killer klown; club ego:distortion plus:" ..
       tostring(8 + crawl.random2(5)))
}}
MONS:   rakshasa w:5 / very ugly thing w:5 / great orb of eyes w:5 \
        / glowing orange brain / tentacled starspawn / cacodemon \
        / glowing shapeshifter / crystal guardian / tentacled monstrosity
MONS:   draconian shifter / daeva god:Xom / executioner / profane servitor \
        / killer klown
MONS:   lurking horror / wretched star / hellion / apocalypse crab \
        / starcursed mass
MONS:   ancient lich / dread lich / hellephant / hell sentinel
SUBST:  fghij = |*
NSUBST: - = qr / 4=1 / 4=1- / 2=2 / 3=2- / 3 / 3- / 4 / 2=4- / -
: end
MARKER: P = lua:transp_loc("abyssal_escape_entry")
MARKER: Q = lua:transp_dest_loc("abyssal_escape_entry")
MARKER: R = lua:transp_loc("abyssal_escape_exit")
MARKER: S = lua:transp_dest_loc("abyssal_escape_exit")
# Color weights similar to that used for rock in the Abyss.
COLOUR: a = blue:13 / red:66 / magenta:50 / brown:90 / lightgreen:68 \
            / lightred:110 / lightmagenta:38 / yellow / white
RTILE:  a = wall_abyss
: ghost_setup(_G, true)
MAP
....................
......''''..........
....'''cc''..''P''..
..'''Pcccc''''cnc'..
.''ccnc-pcc''ccQc'..
.'cc-Q-a-QnP'cp-c''.
.'c-aaappcc''cc-cc'.
.'cc-apccc'''cc-pc'.
.''cc-pc''''cc-apc'.
.''ccp-ccPcccp-pcc'.
.'ccpaa-cncpp-ccc''.
.PnQ-aaa-Q-aaQnP''..
.'cc-aaaaa-aa-cc''..
.''cc-aap-Q--a-cc''.
..''c-aa-cnccpa-cc'.
..'ccp--ccP'cppa-c'.
..'cpQccc'''cccQcc'.
..'ccnc'''''''cnc''.
..'''P''.....''P''..
....................
ENDMAP

NAME:   hellmonk_ghost_big_iron
TAGS:   vaults_orient_s
DEPTH:  D:8-13, Elf, Vaults, !Vaults:$, Crypt, Depths, Zot
ORIENT: float
ITEM:   book of iron, javelin q:1
KMONS:  O = player ghost
KMONS:  p = plant
KMONS:  - = bush
: if you.in_branch("D") then
KMONS:  D = ynoxinul
: elseif you.in_branch("Elf") then
ITEM:   hat, pair of boots
KMONS:  D = deep elf annihilator / ancient champion
: elseif you.in_branch("Vaults") then
ITEM:   hat, pair of boots
KMONS:  D = deep elf annihilator / ancient champion
: elseif you.in_branch("Crypt") then
ITEM:   hat / hat good_item, pair of boots
KMONS:  D = ancient champion
: elseif you.in_branch("Depths") then
ITEM:   hat / hat good_item, pair of boots
:item(dgn.loot_scrolls)
KMONS:  D = ancient champion / deep elf annihilator / iron giant
# Zot
: else
ITEM:   hat good_item, pair of boots, scroll of blinking ident:all
KMONS:  D = draconian annihilator / iron giant / hell sentinel
: end
KFEAT:  ~ = abandoned_shop
SUBST:  ~ = ~~~p, p = p''', - = -'
FTILE:  defghODp~-' = floor_sand
COLOUR: defghODp~-' = yellow
: ghost_setup(_G, true)
MAP
...........
...........
..nnnnnnn..
..npfegpn..
..n~'d'~n..
..nh'O'pn..
..n~'''~n..
..np'-'pn..
..n~'''~n..
..np'D'pn..
..n~'''~n..
..nnn=nnn..
.....@.....
...........
ENDMAP

NAME:   hellmonk_ghost_time_enough
TAGS:   transparent no_item_gen
DEPTH:  Depths
ORIENT: float
KMONS:  O = player ghost
MONS:   walking crystal tome / walking earthen tome / walking frostbound tome /\
        walking divine tome
ITEM:   any book good_item / any manual w:1
NSUBST: - = 3:d / 5 = d. / 2:1 / *=1.
TILE:   c = wall_studio
: ghost_setup(_G)
MAP
...............
.nnnnnnnnnnnnn.
.n-....-....-n.
.n.ccc...ccc.n.
.n-...-.-...-n.
.n.ccc...ccc.n.
.n..-..-..-..n.
.n.ccc.O.ccc.n.
.n-.........-n.
.nnnnn===nnnnn.
...............
ENDMAP
