##############################################################################
#
# Treasure Trove (by due)
#
# Troves are once-only (tolled) and timed portals to a treasure chamber, most
# of which are weighted acquirement-esque towards your skills. Of course,
# there's a chance that you'll get rubbish (casters in an weapon/armour room
# and melee fighters in a library), but that's kind of the point.
#
# Two Trove portals are 'nasty': one features vampires behind (diggable) glass,
# and the other features two wandering shining eyes. Have a nice time!
#
# -- comments by dpeg:
# The idea (you spend a lot and gain a meta-acquirement) of troves is cool and
# robust. There are some slight issues with the current setup:
# a) The choice between pay-large-sum and make-permanent is not relevant. If
#    you have the money, you will just buy access to the trove. Therefore, we
#    should remove the buying option.
# b) It is a bug that troves hand out incredible sums of money (when they
#    give money).
# c) Paying a small sum upfront (thematically, to "lock" the trove) is just
#    meant to get players emotionally invested into fulfilling the second
#    trove condition. This may not have been my best idea -- here's another
#    suggestion: The trove asks you for something and you have to deliver
#    quickly with a first set. That's easy for the "12 scrolls of identify
#    scrolls" type quests (i.e. where you have to collect some number of a
#    common, useful item): you just ask for one or two scrolls of identify.
#    We can also make it so that the player can take some time for the first
#    payment -- but the longer it takes, the more the trove wants. (And the
#    trove will vanish if the total cost exceeds some threshold.)
#    For quests like "one  potion of acquirement" (where you have to part with
#    very few, very good items), the trove would ask for items of the same
#    type (scrolls, potions, wands) of sufficient worth: we wouldn't even need
#    to tell the player the exact value.
#    And for money demands (usually in the form of "bring me [shop randart]",
#    the trove would ask for a sum of money.
#
##############################################################################
{{

trove = {}

function trove.get_trove_item(e, value, base_item)
  -- This function should return a table with the following values:
  --  quantity=0 (number of items, 1 unless consumables)
  --  base_type="armour" (armour, weapon, potion, scroll, jewellery or book)
  --  sub_type="robe" (short sword, etc)
  --  ego_type="resistance" (or false)
  --  plus1=4 (or false)
  --  plus2=false
  --  artefact_name=false (setting this will compare artefact names and status
  --                       and will be used as the full title for artefact books
  --                       and so-on. leave as false for non-artefacts.)
  local item = {
    quantity=1,
    base_type="",
    sub_type="",
    ego_type=false,
    plus1=false,
    plus2=false,
    artefact_name=false,
  }

  -- For testing purposes, you can force an item.
  if base_item ~= nil then
    item.quantity = base_item.quantity
    local p1, p2 = base_item.pluses()
    item.plus1 = p1
    item.plus2 = p2
    item.ego_type = base_item.ego_type
    item.base_type = base_item.base_type
    item.sub_type = base_item.sub_type
    item.artefact_name = base_item.artefact_name
    return item
  end

  if you.skill("armour") > 10 and crawl.one_chance_in(4) then
    return {
      quantity=1,
      base_type="armour",
      sub_type="gold dragon armour",
      ego_type=false,
      plus1=3+crawl.random2(3),
      plus2=false,
      artefact_name=false
    }
  elseif you.skill("dodging") > 10 and crawl.one_chance_in(4) then
    return {
      quantity=1,
      base_type="armour",
      sub_type="robe",
      ego_type="resistance",
      plus1=3+crawl.random2(3),
      plus2=false,
      artefact_name=false
    }
  end

  local floorlist, shoplist
  floorlist, shoplist = dgn.stash_items(value, true)
  if #shoplist ~= 0 then
    shop_item = shoplist[crawl.random2(#shoplist)+1]
    if not shop_item.identified() then
      shop_item = shoplist[crawl.random2(#shoplist)+1]
    end
    local jwith_pluses = {"ring of protection", "ring of evasion",
                          "ring of strength", "ring of intelligence",
                          "ring of dexterity"}
    local bt = shop_item.base_type
    if bt == "armour" or bt == "weapon" or bt == "jewellery" or bt == "book" then
      if shop_item.identified() then
        item.quantity = shop_item.quantity
        item.base_type = shop_item.base_type
        item.sub_type = shop_item.sub_type
        item.ego_type = shop_item.ego_type
        if shop_item.artefact then
          item.artefact_name = shop_item.artefact_name
        end
        local shop_plus1, shop_plus2 = shop_item.pluses()
        if item.base_type == "armour" then
          item.plus1 = shop_plus1
          item.plus2 = false
        elseif item.base_type == "weapon" then
          item.plus1 = shop_plus1
          item.plus2 = shop_plus2
        elseif item.base_type == "jewellery" then
          if item.sub_type == "ring of slaying" then
            item.plus1 = shop_plus1
            item.plus2 = shop_plus2
          elseif util.contains(jwith_pluses, item.sub_type) then
            item.plus1 = shop_plus1
            item.plus2 = false
          end
        else
          item.plus1 = false
          item.plus2 = false
        end
        return item
      end
    end
  end

  -- Default to consumables.
  local d = crawl.roll_dice

  -- Generation chances from makeitem.cc listed as comments; we don't
  -- have to follow too closely, as we randomise quantities anyway.
  -- Note that scrolls and potions can come in stacks of 2 or 3.

  local wands = {
       {wand="healing",          charges=2+d(2)},               -- max 8
       {wand="hasting",          charges=2+d(2)},               -- max 8
       {wand="cold",             charges=15},                   -- max 15
       {wand="fire",             charges=15} }                  -- max 15

  local potions = {
       {potion="healing",        quantity=12+d(4)+d(4)},        -- 23%
       {potion="heal wounds",    quantity=8+d(3)+d(3)},         -- 11%
       {potion="might",          quantity=6+d(3)+d(3)},         --  5%
       {potion="agility",        quantity=6+d(3)+d(3)},         --  5%
       {potion="brilliance",     quantity=6+d(3)+d(3)},         --  5%
       {potion="speed",          quantity=3+d(3)+d(2)},         --  5%
       {potion="resistance",     quantity=3+d(3)+d(2)},         --  2%
       {potion="levitation",     quantity=3+d(3)+d(2)},         --  2%
       {potion="magic",          quantity=3+d(3)+d(2)},         --  2%
       {potion="cure mutation",  quantity=d(2)},                --  1%
       {potion="gain strength",  quantity=1, weight=1},         -- <1%, single
       {potion="gain dexterity", quantity=1, weight=1},         -- <1%, single
       {potion="gain strength",  quantity=1, weight=1},         -- <1%, single
       {potion="experience",     quantity=1, weight=1} }        -- <1%, single

  local scrolls = {
       {scroll="identify",           quantity=12+d(4)+d(4)},    -- 18%
       {scroll="remove curse",       quantity=9+d(3)+d(3)},     -- 13%
       {scroll="fear",               quantity=6+d(3)},          --  3%
       {scroll="fog",                quantity=6+d(3)},          --  3%
       {scroll="blinking",           quantity=3+d(3)},          --  3%
       {scroll="magic mapping",      quantity=3+d(3)},          --  3%
       {scroll="recharging",         quantity=3+d(3)},          --  3%
       {scroll="enchant weapon I",   quantity=3+d(3)+d(2)},     --  3%
       {scroll="enchant weapon II",  quantity=3+d(3)+d(2)},     --  3%
       {scroll="enchant armour",     quantity=3+d(3)+d(2)},     --  3%
       {scroll="enchant weapon III", quantity=d(2), weight=1},  --  1%, single
       {scroll="vorpalise weapon",   quantity=d(2), weight=1},  --  1%, single
       {scroll="acquirement",        quantity=d(2), weight=1} } --  1%, single

  if not crawl.one_chance_in(3) then
    local chosen = util.random_weighted_from('weight', potions)
    item.base_type = "potion"
    item.sub_type = chosen.potion
    if chosen.quantity == nil then
      item.quantity = 8 + crawl.random2(6)
    else
      item.quantity = chosen.quantity
    end
  else
    if crawl.one_chance_in(5) then
      local chosen = util.random_weighted_from('weight', wands)
      item.base_type = "wand"
      item.sub_type = chosen.wand
      if chosen.charges == nil then
        item.plus1 = d(5)
      else
        item.plus1 = chosen.charges
      end
    else
      local chosen = util.random_weighted_from('weight', scrolls)
      item.base_type = "scroll"
      item.sub_type = chosen.scroll
      if chosen.quantity == nil then
        item.quantity = 4 + crawl.random2(4)
      else
        item.quantity = chosen.quantity
      end
    end
  end

  return item
end

function trove.portal(e)
    local d = crawl.roll_dice
    local entry_fee = 5 * math.floor(200 + d(3,200) / 3 + d(10) * d(10) * d(10))
    local a = you.absdepth()
    local lock_fee = 100 + 10 * d(a)
    local timeout_turns = crawl.random_range(1600, 3000) + 5 * (30 - a) * (30 - a)
    local dur = "n exceptionally long"
    if timeout_turns < 2000 then
        dur = " rather brief"
    elseif timeout_turns < 3000 then
        dur = " long"
    elseif timeout_turns < 5000 then
        dur = " very long"
    end
    local desc_long = [[ Once upon a time, an enterprising thief and wizard, terrified of being caught committing an act of burglary, created a system of portals leading into the secret treasure troves and chambers of the rich. Too scared to loot them himself, he instead charged an extortionate fee for entry to anyone who wanted to rifle through them.

The secrets of the gateways died with him when his fellow thieves, disgusted at his betrayal of their 'ideals', had him murdered. With his death, the now-uncontrolled portals began moving rapidly from one dimension to the next, stopping only long enough to absorb magical energy.]]
    local messager =
        timed_msg {
            visible = true,
            -- $F{xxx} will be substituted with the 'entity' property of the timed
            -- marker, or with the desc property (if entity is not set).
           messages = time_messages(timeout_turns,
                       "$F{The} hums gently. It seems happy to stay here for a" ..
                       dur .. " time.",
                       "$F{The} dims for a moment, then brightens again.",
                       "$F{The} flickers impatiently between here and not.",
                       "$F{The} flickers urgently, almost stroboscopically.")
    }

    local item = trove.get_trove_item(e, 800)

    local function stair ()
        return trove_marker  {
            amount = entry_fee,
            secondary_amount = lock_fee,
            toll_item = item,
            dur = dur,
            entity = "portal",
            toll_desc = "to enter a treasure trove",
            lock_desc = "to a nasty imp",
            desc = "portal to a secret trove of treasure",
            desc_long = desc_long,
            overview = "Trove",
            dst = "trove",
            dstorigin = "in a treasure trove",
            turns = timeout_turns,
            msg = messager,
            floor = "floor",
            disappear = "The portal fades slowly, and then, between one blink and the next, disappears completely."
        }
    end
    e.lua_marker("O", stair)
    e.kfeat("O = enter_portal_vault")
    e.colour("O = blue")
end

-- Use the following line in destination maps after all SUBSTs
-- : trove_setup_features(_G)
-- Note that the function also defines < to be the exit portal.
function trove.setup_features(e)
    e.kfeat("< = exit_portal_vault")
    e.colour("< = blue")
    e.lrockcol("blue")
    e.lfloorcol("darkgrey")
    e.lrocktile("wall_vault")
    e.lfloortile("floor_vault")
end

function trove.milestone(_G)
    crawl.mark_milestone("br.enter", "entered a treasure trove.", true)
end

-- "any scroll good_item" still gets you 'scroll of noise', 'scroll of curse weapon', etc
-- so let's limit it to the enchant/recharge scrolls, tloc scrolls, identify scrolls,
-- mapping scrolls with a low chance of silence, vulnerability or acquirement (lowest)
function trove.good_scroll (e)
    e.item([[scroll of enchant weapon i / scroll of enchant weapon ii /
             scroll of enchant weapon iii w:5 / scroll of vorpalise weapon w:3 /
             scroll of enchant armour / scroll of identify w:20 /
             scroll of magic mapping w:5 / scroll of blinking / scroll of silence w:2 /
             scroll of recharging / scroll of acquirement w:1 / scroll of teleportation w:20 /
             scroll of vulnerability w:2 / scroll of holy word w:8 / scroll of fog w:8]])
end

function trove.place_fog(e, type, strength)
   e.lua_marker("m", fog_machine { pow_max = strength, cloud_type = type,
                     delay_min = 50, delay_max = 300, size = 12,
                     start_clouds = 1 } )
end

function trove.weapon_skills (e)
  local weapon_skills = {"Short Blades", "Long Blades", "Axes", "Maces & Flails", "Polearms", "Staves"}
  local skill_total = 0
  local nonzero_skills = 0
  for _, skill in ipairs(weapon_skills) do
    skill_total = skill_total + you.skill(skill)
    if you.skill(skill) > 0 then
      nonzero_skills = nonzero_skills + 1
    end
  end
  return skill_total / nonzero_skills
end

function trove.spell_skills (e)
  local spell_skills = {"Spellcasting", "Conjurations", "Enchantments", "Summoning", "Necromancy", "Translocation", "Transmutation", "Fire Magic", "Ice Magic", "Air Magic", "Earth Magic", "Poison Magic"}
  local skill_total = 0
  local nonzero_skills = 0
  for _, skill in ipairs(spell_skills) do
    skill_total = skill_total + you.skill(skill)
    if you.skill(skill) > 0 then
      nonzero_skills = nonzero_skills + 1
    end
  end
  return skill_total / nonzero_skills
end
}}

default-depth: D:10-, Elf:1-, Vault:1-

##############################################################################
#
# Relevant entry portals.
#
##############################################################################

NAME:   enter_trove_0
TAGS:   uniq_trove no_monster_gen trowel_portal chance_trove
CHANCE: 5%
: trove.portal(_G)
MAP
O
ENDMAP

NAME:   enter_trove_1
TAGS:   uniq_trove no_monster_gen chance_trove
CHANCE: 5%
: trove.portal(_G)
COLOUR: . = blue
MAP
...
.O.
...
ENDMAP

NAME:   enter_trove_2
TAGS:   uniq_trove no_monster_gen chance_trove
CHANCE: 5%
: trove.portal(_G)
COLOUR: . = blue
COLOUR: G = blue
MAP
 @G@
@G.G@
G.O.G
@G.G@
 @G@
ENDMAP

NAME:   enter_trove_3
TAGS:   uniq_trove no_monster_gen no_wall_fixup chance_trove
CHANCE: 5%
: trove.portal(_G)
COLOUR: . = blue
COLOUR: c = blue
COLOUR: x = blue
SUBST:  x = c:20 =:6
MAP
cxxxc
x...x
x.O.x
x...x
cxxxc
ENDMAP

# Of course, not everyone is willing for you to take their treasure...
NAME:   enter_trove_5
TAGS:   uniq_trove no_monster_gen chance_trove
CHANCE: 5%
: trove.portal(_G)
COLOUR: . = blue
COLOUR: c = blue
: if you.xl() <= 7 then
# A pack of gnolls want the treasure more than you do!
KMONS:  e = gnoll
KMONS:  l = gnoll / nothing w:5
: elseif you.xl() <= 15 then
# Got drafted in from Vaults:8, while the mages try and close the portal down.
KMONS:  e = vault guard
: elseif you.xl() <= 20 then
# And this time he brought some friends...
KMONS:  e = vault guard
KMONS:  l = vault guard
: end
KFEAT:  e = .
COLOUR: e = blue
KFEAT:  l = .
COLOUR: l = blue
MAP
ccccc
c...c
c.O.c
c...c
cc+cc
cl.lc
c.e.c
cl.lc
cc+cc
  @
ENDMAP

# Someone left some gold behind for you!
NAME:   enter_trove_6
TAGS:   uniq_trove no_monster_gen no_wall_fixup chance_trove
CHANCE: 5%
: trove.portal(_G)
MARKER: X = lua: props_marker { connected_exclude="true" }
SUBST:  X = =
COLOUR: = = blue
MAP
ccccccc
c$$$$$c
c$XXX$c
c$XOX$c
c$XXX$c
c$$$$$c
ccc+ccc
   @
ENDMAP

##############################################################################
#
# The portal vaults:
#
# Most of the vaults have 16 items of loot. Usually weighted 'd', 'e', 'f', from
# good to "worse". Some vaults have more than 16 items: the hunter vault has 15,
# and the two 'nasty' vaults have 24 and 28 items respectively.
#
##############################################################################

# Reset default depth to prevent random generation of portal vaults.
default-depth:

NAME:    trove_simple
WEIGHT:  60
ORIENT:  encompass
TAGS:    trove no_item_gen no_monster_gen allow_dup
# Loot: 16 items.
ITEM:   any useful good_item
ITEM:   acquire jewellery / any useful good_item
ITEM:   acquire weapon / acquire armour / any useful good_item
: trove.setup_features(_G)
epilogue{{
trove.milestone(_G)
}}
MAP
xxxxxx
xddddx
xfeedx
xefedx
xdefdx
xx++xx
xx..xx
xx..xx
xx..xx
x....x
x.<A.x
x....x
xxxxxx
ENDMAP

NAME:    trove_garden
WEIGHT:  40
ORIENT:  encompass
TAGS:    trove no_item_gen no_monster_gen allow_dup
# Loot: 16 items, spread out a bit.
KFEAT:   x = X
COLOUR:  o = blue
#
# Plants come in two pattern: regular or random. Vegetation can be thin or thick.
# There are more plants near the river.
SUBST:   W = w .
: if crawl.coinflip() then
SUBST:   " = . 1:20
SUBST:   1 = . 1:1
SUBST:   ' = .
:else
SUBST:   1 = .
SUBST:   " = '
SUBST:   w = w 1:2
NSUBST:  . = 12:M / 12:1 / *:.
SHUFFLE: Mm
SUBST:   M = .
SUBST:   . = . 1:1
SUBST:   ' = . 1:3
:end
#
SUBST:   V=w. , v=w, _=.
SUBST:   1 : 1 2
SUBST:   2 = 1 .
SUBST:   1 : 1 2:2 3:1
#
MONS:    plant col:white
MONS:    plant col:white / plant col:blue w:6
MONS:    plant col:white / plant col:cyan w:3 / plant col:blue w:3
#
ITEM:    any useful good_item
ITEM:    any useful jewellery good_item / any useful good_item
ITEM:    any useful weapon good_item / any useful armour good_item / any useful good_item
KFEAT:   w = W
: trove.setup_features(_G)
: trove.place_fog(_G, "blue smoke", 30)
KFEAT:  m = .
epilogue{{
trove.milestone(_G)
}}
MAP
'"WwwW'"'1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.<
"'"wwW"'".1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.
."'"ww'"'1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1
1'"'ww"'".1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.
.1'"WwW"'".1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1
1."'"ww'"'1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.
.1'"'www'"'m.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1
1."'"Www"'".1.1.1.1.m.1.1.1.1.m.1.1.1.1.1.
.1."'"ww'"'1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1
1.1'"'wwW'".1ooooooooooooooo1.1.1.1.1.1.1.
.1."'"wwW''1.o_____________o.1.1.1.1.1.1.1
1.1'"'Www'm'1o_____________o1.1.1.1.1.1.1.
.1.1'"'wwW'''o__xxxx+xxxx__o.1.m.1.1.1.1.1
1.1."'"Www'''o__xddx_xedx__o1.1.1.1.1.1.1.
.1.1."'"Www''o__xefx_xdex__o.1.1.1.1.1.1.1
1.1.1."'"Ww''o__xxx=_=xxx__o1.1.1.1.1.1.1.
.1.1.1."'"ww'o__+___1___+__o.1.m.1.1.1.1.1
1.1.1.1'"'mwWo__xxx=_=xxx__o1.1.1.1.1.1.1.
.1.1.1.1'"'wwo__xdfx_xdex__o.1.1.1.1.1.1.1
1.1.1.1."'"WwoV_xdex_xdfx__o1.1.1.1.1.1.1.
.1.1.1.1.1'"'ovvxxxx+xxxx__o.1.1.1.1.1.1.1
1.1.1.1.1.1'"oVvV__________o1.1.1.1.1.1.1.
.1.1.1.1.m.1'o_vvvV________o.1.m.1.1.1.1.1
1.1.1.1.1.1.1o_vvvvvv______o1.1.1.1.1.1.1.
.1.1.1.1.1.1.o__vvvvvvv____o.1.1.1.1.1.1.1
1.1.1.1.1.1.1o__Vvv<_Avv___o1.1.1.1.1.1.1.
.1.1.1.1.1.1.o____vvvvvvv__o.1.1.1.1.1.1.1
1.1.1.1.1.1.1o________VvvvVo"'1.1.1.1.1.1.
.1.1.1.1.1.1.ooooooooooooooo'"'1.1.1.1.1.1
1.1.1.1.1.1.1.1.1.1.1."'"Www"'".1.1.1.1.1.
.1.1.1.1.1.m.1.1.1.m.1.1'"'WwwW"'".1.1.1.1
1.1.1.1.1.1.1.1.1.1.1.1.1'"'WwmW"'".1.1.1.
.1.1.1.1.1.1.1.1.1.1.1.1.1'"'wwwW"'".1.1.1
1.1.1.1.1.1.1.1.1.1.1.1.1.1."'"WwWw'"'1.1.
.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1'"'wWwW"'".1
1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."'"WwwwW"'
<1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."'"WwW"
ENDMAP

# A "library", geared towards scrolls and books (either spell or manual).
NAME:   trove_library
: if trove.spell_skills() >= trove.weapon_skills() then
WEIGHT: 30
: else
WEIGHT: 5
: end
ORIENT: encompass
TAGS:   trove no_item_gen no_monster_gen allow_dup
: trove.setup_features(_G)
: trove.good_scroll(_G)
ITEM:   acquire book
ITEM:   acquire:sif_muna book
epilogue{{
trove.milestone(_G)
}}
MAP
xxxxxxxxxxxxx
xd..e...d..dx
xx.xxx.xxx.xx
xf.dxe.dxe.dx
xx.xxx.xxx.xx
xe.fxd.fxd.ex
xx.xxx.xxx.xx
x...........x
xxxxx+++xxxxx
    x...x
    x...x
    x...x
   xx...xx
   x.....x
   x.<.A.x
   xxxxxxx
ENDMAP

# A 'jewellery shoppe' or display cabinet.
NAME:   trove_jewel_1
WEIGHT: 20
ORIENT: encompass
TAGS:   trove no_item_gen no_monster_gen allow_dup
# Loot: once again, 16 items.
ITEM:   acquire jewellery / any useful jewellery good_item / any jewellery
COLOUR: o = blue
: trove.setup_features(_G)
epilogue{{
trove.milestone(_G)
}}
MAP
xxxxxxxx
x......x
x.<..A.x
x......x
xxx++xxx
x......x
x+o..o+x
xdo..odx
xdo..odx
xdo..odx
xdo..odx
xdoooodx
xddddddx
xxxxxxxx
ENDMAP

# A simple treasure chamber.
NAME:   trove_jewel_2
WEIGHT: 20
ORIENT: encompass
TAGS:   trove no_item_gen no_monster_gen allow_dup
# Loot: once again, 16 items.
ITEM:   acquire jewellery / any useful jewellery good_item / any jewellery w:2
COLOUR: x = blue
: trove.setup_features(_G)
epilogue{{
trove.milestone(_G)
}}
MAP
xxxxxxxx
xddd+<Ax
xdddxxxx
xdddx
xdddx
xdddx
xxxxx
ENDMAP

# A 'weapon shoppe', same template as the jewellery shop.
NAME:   trove_weapon_1
: if trove.weapon_skills() >= trove.spell_skills() and trove.weapon_skills() >= you.skill("Unarmed Combat") then
WEIGHT: 15
: else
WEIGHT: 5
: end
ORIENT: encompass
TAGS:   trove no_item_gen no_monster_gen allow_dup
# Loot: once again, 16 items.
COLOUR: o = blue
ITEM:   acquire weapon / any useful weapon good_item / any weapon w:2
: trove.setup_features(_G)
MAP
xxxxxxxx
x......x
x.<..A.x
x......x
xxx++xxx
x......x
x+o..o+x
xdo..odx
xdo..odx
xdo..odx
xdo..odx
xdoooodx
xddddddx
xxxxxxxx
ENDMAP

# A simple treasure chamber.
NAME:   trove_weapon_2
: if trove.weapon_skills() >= trove.spell_skills() and trove.weapon_skills() >= you.skill("Unarmed Combat") then
WEIGHT: 15
: else
WEIGHT: 5
: end
ORIENT: encompass
TAGS:   trove no_item_gen no_monster_gen allow_dup
# Loot: once again, 16 items.
COLOUR: x = blue
ITEM:   acquire weapon / any useful weapon good_item / any weapon w:2
: trove.setup_features(_G)
epilogue{{
trove.milestone(_G)
}}
MAP
xxxxxxxx
xddd+<Ax
xdddxxxx
xdddx
xdddx
xdddx
xxxxx
ENDMAP

# An 'armour shoppe', same template as the jewellery shop.
NAME:   trove_armour_1
WEIGHT: 15
ORIENT: encompass
TAGS:   trove no_item_gen no_monster_gen allow_dup
# Loot: once again, 16 items.
COLOUR: o = blue
ITEM:   acquire armour / any useful armour good_item / any armour w:2
: trove.setup_features(_G)
epilogue{{
trove.milestone(_G)
}}
MAP
xxxxxxxx
x......x
x.<..A.x
x......x
xxx++xxx
x......x
x+o..o+x
xdo..odx
xdo..odx
xdo..odx
xdo..odx
xdoooodx
xddddddx
xxxxxxxx
ENDMAP

# A simple treasure chamber.
NAME:   trove_armour_2
WEIGHT: 15
ORIENT: encompass
TAGS:   trove no_item_gen no_monster_gen allow_dup
# Loot: once again, 16 items.
COLOUR: x = blue
ITEM:   acquire armour / any useful armour good_item / any armour w:2
: trove.setup_features(_G)
epilogue{{
trove.milestone(_G)
}}
MAP
xxxxxxxx
xddd+<Ax
xdddxxxx
xdddx
xdddx
xdddx
xxxxx
ENDMAP

# A "themed" trove.
NAME:    trove_hunter_1
WEIGHT:  5
ORIENT:  encompass
TAGS:    trove no_item_gen no_monster_gen  allow_dup
# Loot:  15 items, this time.
COLOUR:  x = blue
COLOUR:  o = blue
MONS:    storm dragon zombie
MONS:    golden dragon zombie
MONS:    dragon skeleton
ITEM:    animal skin good_item / any armour good_item
ITEM:    gold dragon hide / storm dragon hide / dragon hide / troll hide / any useful armour good_item
ITEM:    arrow good_item / dart good_item / bolt good_item / any missile good_item
ITEM:    bow good_item / crossbow good_item / any useful weapon good_item
SHUFFLE: 123
SHUFFLE: defg
: trove.setup_features(_G)
epilogue{{
trove.milestone(_G)
}}
MAP
xxxxxxx
x1x2x3x
xooooox
xdededx
xfgfgfx
xgfffgx
xxx+xxx
x.....x
x.<.A.x
x.....x
xxxxxxx
ENDMAP

# A "nasty" monsters-behind-glass map for dpeg.
NAME:   trove_nasty
ORIENT: encompass
TAGS:   trove no_item_gen no_monster_gen allow_dup no_vmirror no_rotate
WEIGHT: 2
COLOUR: x = blue
COLOUR: m = blue
COLOUR: = = blue
# Rock is actually diggable for those people driven made by hatred.
MONS:   vampire
# 24 items, just because we're feeling generous.
ITEM:   any useful good_item w:10 / any
ITEM:   any useful jewellery good_item / any useful good_item
ITEM:   acquire weapon / acquire armour / any useful good_item
: trove.setup_features(_G)
epilogue{{
trove.milestone(_G)
}}
MAP
xxxxxxxxxxxxxxxxxxxxxxxxxx
x........................x
x.xxxxxxxxxxxxxxxxxxxxxx.x
x.xedd+...............<=.x
x.xdedx.mmmmmmmmmm.xxxxxxx
x.xddex.mmm1..1mmm.=dedddx
x=xxxxx.mmmmmmmmmm.xededfx
xA.................xfffedx
xxxxxxxxxxxxxxxxxxxxxxxxxx
ENDMAP

# Another nasty vault, because dpeg asked.
NAME:   trove_treasure_island
ORIENT: encompass
TAGS:   trove no_item_gen no_monster_gen allow_dup no_vmirror no_rotate no_pool_fixup
WEIGHT: 2
COLOUR: x = blue
COLOUR: o = blue
COLOUR: = = blue
KFEAT:  1 = deep_water
KMONS:  1 = shining eye
# 28 items, 'cos this one is *nasty*. The extra items are potions of cure mutation.
ITEM:   any useful good_item / any
ITEM:   any useful jewellery good_item / any useful good_item
ITEM:   acquire weapon / acquire armour / any useful good_item
ITEM:   potion of cure mutation
: trove.setup_features(_G)
: set_border_fill_type("deep_water")
epilogue{{
trove.milestone(_G)
}}
MAP
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwww1wwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwww.wwwwwwwwwwwwww
wwwwwwwwwwww..g.wwwwwwwwwwwww
wwwwwwwwww...ge...wwwwwwwwwww
wwwwwwwwww..<dded.wwwwwwwwwww
wwwwwwwww...deedd..wwwwwwwwww
wwwwwwww....dfAfdd..wwwwwwwww
wwwwwwwww...ddefdd..wwwwwwwww
wwwwwwwwww..gddd<d.wwwwwwwwww
wwwwwwwwwww..g.dd..wwwwwwwwww
wwwwwwwwwwwww....wwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwww1ww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwww
ENDMAP
