# "Ice" by dk
#
# Serial vault with an ice theme

{{
function init_ice(e, force_opaque)
  e.tags('serial_ice')
  e.tags('extra')
  e.tags('mini_float')
  e.tags('no_wall_fixup')
  if not force_opaque then
    e.tags('transparent')
  end
  e.weight('2')
  if you.in_branch("Coc") then
    e.kmons('.- = simulacrum w:30 / \
                  ice fiend w:1 / blizzard demon w:5 / ice devil w:20 / \
                  ice dragon w:5 / ice dragon simulacrum w:5 / \
                  w:2000 nothing')
  elseif you.in_branch("Vaults") then
    e.kfeat('AG! = cache_of_meat')
    e.tile('x = wall_ice_block')
    e.set_feature_name("rock_wall", "ice covered rock wall")
  else
    if you.depth() > 11 then
        e.kmons('.- = simulacrum w:20 / death yak / \
                      wolf band / polar bear / ice devil w:20 / \
                      ufetubus / ice beast w:15 / w:2000 nothing')
    else
        e.kmons('.- = simulacrum w:20 / death yak w:1 / \
                      wolf  / yak / polar bear / white imp w:20 / \
                      ufetubus / ice beast w:15 / w:2000 nothing')
    end
    e.subst('G = GGb')
    e.tile('b = bedevilled_crystal_cocytus')
    e.set_feature_name('crystal_wall', 'bedevilled crystal wall')
    e.tile("x = wall_zot_cyan")
  end
  e.subst("- = --.")
  e.colour("x = white")

  e.colour(".@! = white")
  e.ftile(".xA@G! = floor_ice")
  e.kfeat("A = stone_arch")
  e.kfeat(".-! = floor")

  local cloud_type = "thin mist"
  if you.in_branch("Coc") then
    cloud_type = "freezing vapour"
  end
  e.lua_marker("!", fog_machine { cloud_type = cloud_type, pow_max = 15,
                                  delay_min = 50, delay_max = 100,
                                  size = 8, start_clouds = 1 } )
end
}}

NAME:   serial_ice
DEPTH:  D:8-, Coc
TAGS:   extra luniq_serial allow_dup nolayout_encompass
CHANCE: 1% (D), 3% (Coc)
{{
  local c = 4 + crawl.random2(3) * crawl.random2(4)
  local ice_cave = 0
  if you.in_branch("D") and you.absdepth() >= 11 and
     dgn.map_by_tag("uniq_icecv") and crawl.coinflip() then
    ice_cave = 1
  end

  hook("post_place", function()
    dgn.place_maps{tag="serial_ice", count=c}
    -- chance_icecave excludes special Vaults ice cave entries
    dgn.place_maps{tag="chance_icecave", count=ice_cave}
  end)
}}

###############################################################################

NAME:   serial_ice_a
: init_ice(_G)
MAP
-----
-...-
-.A.-
-...-
-----
ENDMAP

NAME:   serial_ice_b
TAGS:   allow_dup luniq vaults_empty
SUBST:  ! = ....!
: init_ice(_G)
MAP
-------
-.....-
-.x.x.-
-..!..-
-.x.x.-
-.....-
-------
ENDMAP

NAME:   serial_ice_c
SUBST:  ! = ....!
: init_ice(_G)
MAP
  xxxxxx
 xx....x
xx..!..xx
x.......x
xx.....xx
 xx...xx
  xxx.x-
   -----
    -@-
ENDMAP

NAME:   serial_ice_d
: init_ice(_G)
MAP
-------
--xxx--
-xx.xx-
-x...x-
-xx.xx-
--x.x--
--@@@--
ENDMAP

NAME:   serial_ice_e
SUBST:  ! = ...!
: init_ice(_G)
MAP
.-.-.-
-.-!-.
.-.-.-
-.-.-.
ENDMAP

NAME:   serial_ice_f
SUBST:  w = wwW, . = ...w
: init_ice(_G)
MAP
---------
-.......-
-..www..-
-.wwWww.-
-.wWWWw.-
-.wwWww.-
-..www..-
-.......-
---------
ENDMAP

NAME:   serial_ice_g
TAGS:   allow_dup luniq vaults_empty
NSUBST: x = . / x
SUBST:  x = .xx
SUBST:  ! = .!!
: init_ice(_G)
MAP
-------
--xxx--
-xx.xx-
-x.!.x-
-xx.xx-
--xxx--
-------
ENDMAP

NAME:   serial_ice_h
TAGS:   allow_dup luniq vaults_empty
: init_ice(_G)
MAP
-------
--...--
-.....-
-..G..-
-.....-
--...--
-------
ENDMAP

NAME:   serial_ice_i
TAGS:   luniq_serial_ice_big
SUBST:  W = wW
SUBST:  + = Ww.
: init_ice(_G)
MAP
    -------....---
  ---...wwWW++Www----
-...wW.WWW+++WWwWww--
-wwWW+........+++ww.-
-wwW....A..A....+Ww.-
-wwW+++......+++Ww..-
-....wWW+WWW+Ww....--
---....wW+WWww..--
    -----...-----
ENDMAP

NAME:   serial_ice_j
TAGS:   luniq_serial_ice_big
KPROP:  +-.AwW = no_tele_into
SUBST:  w = wwW
SUBST:  + = Ww.
# TODO: redesign this so that it can be marked transparent
: init_ice(_G, true)
MAP
     +++++.+++++
+++--+++++.+++++---
-+++wwwwwwwwwwwwww-+
-w++++++....ww...w+++
-wwwwWWWW....w...w++++
--www...w..A...www+++
-w+++.........ww.+-+
-ww++++wwwwwwww++.-+
-++++-------...+++.
ENDMAP

NAME:   serial_ice_k
TAGS:   luniq_serial_ice_big
NSUBST: W = 1:W / *=Ww
SUBST:  + = Ww.
: init_ice(_G)
MAP
             ---
          --------
       ---.++ww+..-@
      --..++..+++.--
wwwww--++www++.....-
    wwwwwwwwwWWWW++..
    --....+w+...wwWWw   ww
     --+++ww+++....-wwww
      @--+++.-------
         -----
ENDMAP

NAME:   serial_ice_l
TAGS:   luniq_serial_ice_big
SUBST:  c = xx.
SUBST:  ! = ....!
: init_ice(_G)
MAP
       w
      www
      www
      www
     wwwww
    -wwwww-
  ---wwwww---
 ---ccxxxcc---
@--....!....--@
 ---ccxxxcc---
  ---wwwww---
    -wwwww-
     wwwww
      www
      www
      www
       w
ENDMAP

NAME:   serial_ice_m
TAGS:   allow_dup luniq vaults_empty
SUBST:  + = Ww.
SUBST:  ! = .!!
: init_ice(_G)
MAP
xxxx@xxxx
xww+.+wwx
xw+...+wx
x+.....+x
@...!...@
x+.....+x
xw+...+wx
xww+.+wwx
xxxx@xxxx
ENDMAP

NAME:   serial_ice_n
NSUBST: x = 1:. / 2:x / *=xx.
: init_ice(_G)
MAP
  --@--
---------
-.......-
xxxxxxxxx
-.......-
---------
  --@--
ENDMAP

NAME:   serial_ice_o
: init_ice(_G)
MAP
     -----
   --.....--
  -.........-
 -.G..---..G.-
 -..-------..-
-.---     ---.-
---         ---
--           --
-             -
ENDMAP
