################################################################################
# uniques.des: This is where unique placement should be defined.
################################################################################
# Most of this should be self-explanatory. A unique vault can be defined by
#
# NAME:   uniq_linley
# DEPTH:  D:2-27, !Orc
# WEIGHT: 10
# TAGS:   place_unique
# MONS:   Linley
# MAP
# 1
# ENDMAP
#
# This assumes that the unique is defined as a monster in the files
#   enum.h, mon-gear.cc, mon-data.h,  mon-spll.h, tilemcache.cc, tilepick.cc
# Their speech is defined in
#   dat/database/monspeak.txt
#
# Vaults tagged as "place_unique" are assumed to place only one unique. If the
# unique is in a band, specify "unique band", (see uniq_duvessa, etc). Names of
# vault don't matter, except for the Boris vault.
#
# For most purposes, a vault like the above sample is desired. You can use the
# inline function place_unique in this case, reducing to
#
# NAME:   uniq_linley
# DEPTH:  D:2-27, !Orc
# : place_unique(_G, "Linley")
#
# The WEIGHT line was skipped as 10 is the default.
# You have to deviate from this simple 3 liner only if
# * You want a more complicated map, e.g. with items or other monsters.
#   (Not needed for unique in bands: place_unique(_G, "Linley band") works.)
# * You want additional tags, for example because you want to make a number
#   of Linley vaults. In this case, you can still use the inline function;
#   just add a TAG line.
# * You want different WEIGHTS. In this case, just add a WEIGHT line.
#
# If you want to weight uniques differently for some vaults, the weights for
# these vaults should all add up to 10 (the default weight for uniques),
# unless you want to make that unique appear more or less frequent on purpose.
# You can use multiple vaults that are tagged "uniq_<name>", with different
# weights for each of the vaults. See uniq_ribbit for examples of all this.
#
# Note also that uniques are never placed on D:1, so specifying placement there
# will only cause confusion.
#
# As a final caveat, you.branches[you.where_are_you].has_uniques is still
# checked before vaults are even considered; unique vaults with depths that
# could go in Lair should be specified !Lair, !Slime (unless you want them in
# lair).
#
# You can define DEBUG_UNIQUE_PLACEMENT and get a per-level unique generation
# report in "unique_placement.log" in debug mode.
#
# NOTE: Does not deal with fixed-place uniques such as the Royal Jelly, the Hell
# bosses, and the Pan bosses.
################################################################################

{{
function place_unique(e, monster)
   e.mons(monster)
   e.tags("place_unique")
   e.tags("transparent can_overwrite")
   e.map("1")
end
}}

################################################################################
# Dummy, these are used to weight uniques per branch.
################################################################################
NAME:   uniq_dummy
DEPTH:  1-50, !Lair, !Slime
WEIGHT: 20
TAGS:   place_unique dummy
MAP
.
ENDMAP

NAME:   uniq_dummy_lair
DEPTH:  Lair
WEIGHT: 80
TAGS:   place_unique dummy
MAP
.
ENDMAP

NAME:   uniq_dummy_slime
DEPTH:  Slime
WEIGHT: 200
TAGS:   place_unique dummy
MAP
.
ENDMAP

################################################################################
# General dungeon uniques:
################################################################################

NAME:   uniq_agnes
DEPTH:  D:14-22, Elf, Dwarf, Swamp, Snake, Shoals, Spider, Vaults:1-6, Crypt:1-3, Blade, Tomb:1
: place_unique(_G, "Agnes")

NAME:   uniq_aizul
DEPTH:  D:14-20, Elf, Dwarf, Swamp, Snake, Shoals, Spider, Vaults:1-4, Crypt:1
: place_unique(_G, "Aizul")

NAME:   uniq_azrael
DEPTH:  D:14-19, Elf, Dwarf, Snake:1-4, Spider:1-4, Vaults:1-3
: place_unique(_G, "Azrael band")

NAME:   uniq_blork_the_orc
DEPTH:  D:4-9, Orc:1
: place_unique(_G, "Blork the orc")

###############################################################################
# Do *not* change the name of this vault without changing the relevant section
# in monstuff.cc:monster_die. If wishing to alter Boris' weights by using
# multiple uniq_boris TAG'd maps, ensure that you add the relevant line to
# remove the tag in monstuff.cc:monster_die.
NAME:   uniq_boris
DEPTH:  D:20-27, Swamp:5, Snake:5, Shoals:5, Spider:5, Vaults:4-, Crypt, Blade, Tomb
: place_unique(_G, "Boris")

NAME:   uniq_donald
# XXX: add Vaults:1-4 when finished re-do of vaults.
TAGS:   lab
DEPTH:  Swamp, Snake, Shoals, Spider, Slime, Crypt:1-4, Blade, Elf, Dwarf, Orc:3-4, Lab
: place_unique(_G, "Donald")

NAME:   uniq_duvessa
DEPTH:  D:4-9, Orc:1
: place_unique(_G, "Duvessa band")

NAME:   uniq_edmund
DEPTH:  D:4-9, Orc:1
: place_unique(_G, "Edmund")

NAME:   uniq_erica
DEPTH:  D:10-16, Orc:2-, Elf:1, Lair:1-5, Swamp:1, Shoals:1, Snake:1, Spider:1
: place_unique(_G, "Erica")

NAME:   uniq_erolcha
DEPTH:  D:8-13, Orc
: place_unique(_G, "Erolcha")

NAME:   uniq_eustachio
DEPTH:  D:4-10, Orc:1-2
: place_unique(_G, "Eustachio")

NAME:   uniq_frances
DEPTH:  D:17-27, Elf:2-, Dwarf, Swamp:2-, Snake:2-, Shoals:2-, Spider:2-, Vaults, Crypt, Blade, Tomb
: place_unique(_G, "Frances")

NAME:   uniq_frederick
DEPTH:  D:20-27, Swamp:5, Snake:5, Shoals:5, Spider:5, Vaults:4-, Crypt, Blade, Tomb
: place_unique(_G, "Frederick")

NAME:   uniq_fannar
DEPTH:  D:10-16, Orc:2-, Elf, Lair:1-5, Swamp:1, Shoals:1, Snake:1, Spider:1
: place_unique(_G, "Fannar")

NAME:   uniq_gastronok_1
DEPTH:  D:8-13, Orc
TAGS:   uniq_gastronok
WEIGHT: 5
: place_unique(_G, "Gastronok")

NAME:   uniq_gastronok_2
DEPTH:  Lair:1-3
TAGS:   uniq_gastronok
WEIGHT: 15
: place_unique(_G, "Gastronok")

NAME:   uniq_grum
DEPTH:  D:8-13, Orc
: place_unique(_G, "Grum band")

NAME:   uniq_grinder
DEPTH:  D:3-6
: place_unique(_G, "Grinder")

NAME:   uniq_harold
DEPTH:  D:10-16, Orc:2-, Elf:1, Lair:1-5, Swamp:1, Shoals:1, Snake:1, Spider:1
: place_unique(_G, "Harold")

NAME:   uniq_iyjb
DEPTH:  D:2-7
: place_unique(_G, "Ijyb")

NAME:   uniq_jessica
DEPTH:  D:2-3
: place_unique(_G, "Jessica")

NAME:   uniq_joseph
DEPTH:  D:7-12, Orc, Lair:1
: place_unique(_G, "Joseph")

NAME:   uniq_josephine
DEPTH:  D:10-16, Orc:2-, Elf:1, Swamp:1, Shoals:1, Snake:1, Spider:1
: place_unique(_G, "Josephine band")

NAME:   uniq_kirke
DEPTH:  D:14-19, Elf, Dwarf, Swamp:1-4, Snake:1-4, Shoals:1-4, Spider:1-4, Vaults:1-3
: place_unique(_G, "Kirke band")

NAME:   uniq_louise
DEPTH:  D:14-19, Elf, Dwarf, Swamp:1-4, Snake:1-4, Shoals:1-4, Spider:1-4, Vaults:1-3
: place_unique(_G, "Louise")

NAME:   uniq_margery
DEPTH:  D:20-27, Swamp:5, Snake:5, Shoals:5, Spider:5, Vaults:4-, Crypt, Blade, Tomb
: place_unique(_G, "Margery band")

NAME:   uniq_maud
DEPTH:  D:14-16, Lair:3-5, Swamp:1, Snake:1, Shoals:1, Spider:1, Elf:1
: place_unique(_G, "Maud")

NAME:   uniq_mara
DEPTH:  D:18-25, Elf:3-, Dwarf, Swamp:3-5, Snake:3-5, Shoals:3-5, Spider:3-5, Vaults:2-, Crypt, Blade, Tomb
: place_unique(_G, "Mara")

NAME:   uniq_maurice
DEPTH:  D:8-13, Orc
: place_unique(_G, "Maurice")

NAME:   uniq_menkaure
DEPTH:  D:4-7
: place_unique(_G, "Menkaure")

NAME:   uniq_nergalle
DEPTH:  D:14-19, Orc:3-4, Elf, Dwarf, Swamp:1-4, Snake:1-4, Shoals:1-4, Spider:1-4, Vaults:1-3
: place_unique(_G, "Nergalle")

NAME:   uniq_nessos
DEPTH:  D:11-17, Orc:3-, Elf:1-2, Swamp:1-2, Snake:1-2, Shoals:1-2, Spider:1-2, Vaults:1
: place_unique(_G, "Nessos")

NAME:   uniq_nikola
DEPTH:  D:14-19, Elf, Dwarf, Swamp:1-4, Snake:1-4, Shoals:1-4, Spider:1-4, Vaults:1-3
: place_unique(_G, "Nikola")

NAME:   uniq_norris
DEPTH:  D:17-19, Elf:2-, Dwarf, Swamp:2-4, Snake:2-4, Shoals:2-4, Spider:2-4, Vaults:1-3
: place_unique(_G, "Norris")

NAME:   uniq_pikel
DEPTH:  D:4-9
: place_unique(_G, "Pikel band")

NAME:   uniq_prince_ribbit1
DEPTH:  D:4-9, Orc:1
WEIGHT: 7
TAGS:   uniq_ribbit
: place_unique(_G, "Prince Ribbit")

NAME:   uniq_prince_ribbit2
DEPTH:  Lair:1-3
WEIGHT: 3
TAGS:   place_unique uniq_ribbit transparent
MONS:   Prince Ribbit, blink frog band
MAP
1..2
ENDMAP

NAME:   uniq_psyche
DEPTH:  D:8-13, Orc
: place_unique(_G, "Psyche")

NAME:   uniq_purgy
DEPTH:  D:3-4
WEIGHT: 1
: place_unique(_G, "Purgy")

NAME:   uniq_roxanne
DEPTH:  D:14-19, Elf, Dwarf, Swamp:1-4, Snake:1-4, Shoals:1-4, Spider:1-4, Vaults:1-3
TAGS:   place_unique transparent
MONS:   Roxanne
MAP
...
.1.
...
ENDMAP

NAME:   uniq_rupert
DEPTH:  D:14-19, Lair:3-, Elf, Dwarf, Swamp:1-4, Snake:1-4, Shoals:1-4, Spider:1-4, Vaults:1-3, Slime:1-2
: place_unique(_G, "Rupert")

NAME:   uniq_saint_roka
DEPTH:  Orc:4, D:17-27, Elf:2-, Dwarf, Swamp:2-, Snake:2-, Shoals:2-, Vaults, Crypt, Blade, Tomb
: place_unique(_G, "Saint Roka band")

NAME:   uniq_sigmund
DEPTH:  D:2-7
: place_unique(_G, "Sigmund")

NAME:   uniq_snorg
DEPTH:  D:14-19, Elf, Dwarf, Swamp:1-4, Snake:1-4, Shoals:1-4, Spider:1-4, Vaults:1-3
: place_unique(_G, "Snorg")

NAME:   uniq_sonja
DEPTH:  D:10-16, Orc:2-, Elf:1, Swamp:1, Shoals:1, Snake:1, Spider:1
: place_unique(_G, "Sonja")

NAME:   uniq_terence
DEPTH:  D:2-3
: place_unique(_G, "Terence")

NAME:   uniq_urug
DEPTH:  D:10-16, Orc:2-, Elf:1, Swamp:1, Shoals:1, Snake:1, Spider:1
: place_unique(_G, "Urug")

NAME:   uniq_wiglaf
DEPTH:  D:17-27, Elf:2-, Dwarf, Swamp:2-, Snake:2-, Shoals:2-, Spider:2-, Vaults, Crypt, Blade, Tomb
: place_unique(_G, "Wiglaf")

NAME:   uniq_xtahua
DEPTH:  D:20-27, Swamp:5, Snake:5, Shoals:5, Spider:5, Vaults:4-, Crypt, Blade, Tomb
: place_unique(_G, "Xtahua")

NAME:   uniq_mennas
# would be cool to get him wandering around Pan too
DEPTH:  D:20-27, Swamp:5, Snake:5, Shoals:5, Spider:5, Vaults:4-, Crypt, Blade, Tomb
: place_unique(_G, "Mennas")


################################################################################
# Non-dungeon Uniques
################################################################################

NAME:   uniq_dissolution
DEPTH:  Slime:2-6
WEIGHT: 100
: place_unique(_G, "Dissolution")

NAME:   uniq_polyphemus
DEPTH:  Shoals
WEIGHT: 50
: place_unique(_G, "Polyphemus band")

NAME:   uniq_ilsuiw
DEPTH:  Shoals:3-
: place_unique(_G, "Ilsuiw band")

NAME:   uniq_arachne
DEPTH:  Spider:2-
WEIGHT: 50
: place_unique(_G, "Arachne")

NAME:   uniq_khufu
DEPTH:  Tomb, Crypt
: place_unique(_G, "Khufu band")

NAME:   uniq_tiamat
DEPTH:  Zot
: place_unique(_G, "Tiamat band")

NAME:   uniq_ignacio
DEPTH:  Pan
CHANCE: 25%
# TODO: use regular unique code instead?
TAGS:   transparent extra allow_dup luniq_ignacio
veto {{
  if you.uniques("Ignacio") then
    return true -- don't spam the list of vaults
  end
  if not dgn.persist.ignacio_spawned then
    local runes = 0;
    for _, r in ipairs({"demonic","glowing","magical","fiery","dark"}) do
      if you.have_rune(r) then
        runes = runes + 1
      end
    end
    if crawl.x_chance_in_y(runes * runes, 100) then
      dgn.persist.ignacio_spawned = true
      dgn.persist.ignacio_forbid = crawl.coinflip()
    else
      return true
    end
  end
  if dgn.persist.ignacio_forbid then
    return true
  end
  return false
}}
MONS: Ignacio
MAP
1
ENDMAP

###############################################################################
# Crazy Yiuf! Only in his cottage.
NAME:    uniq_crazy_yiuf_cottage
DEPTH:   D:2-7
TAGS:    place_unique no_monster_gen no_item_gen
MONS:    Crazy Yiuf
MONS:    fungus / bush w:1
ITEM:    hammer
# Randomisation 1: Some chance for a gate. Very rarely secret doors.
SHUFFLE: Bb/Aa
SUBST:   B=;, b=;
: if crawl.one_chance_in(3) then
SUBST:   A:AAAa, a:+++=, A=x
: else
SUBST:   A:;;;x, a=;
: end
# Randomisation 2: Rarely, the cottage will have a door.
SUBST:   C = +''''
# Randomisation 3: Plants might be in the way -- Yiuf seems to be a bad
#                  gardener. Sometimes.
SUBST:   P:PQ;; , Q=2;
NSUBST:  P=1:t / *:2;
# Randomisation 4: Hammers. Hammers. Hammers.
SUBST:   ; : .:100 ;:10 d:2
SUBST:   ; = .:10 d:2
: if crawl.one_chance_in(300) then
SUBST:   t="
: end
SUBST:   ':.......' , "=' , ':d' , '=..d
# Randomisation 5: trees or rock
SUBST:   t : ttx
MAP
 xxxxxxxxxxxxxxxx
 xxtttttttxxtttxx
 xxtttttttttttttx
 BAP't'tttccccctx
;baPP't''tc'''ctx
@baPPtttt'C''1ctx
;BAPttttttc''dctx
 xxtttttttccccctx
 xxtttttttttttttx
 xxxxxttttttttxxx
 xxxxxxxxxxxxxxxx
ENDMAP
