{{
function callback.grunt_ashenzari_visionary_reveal(data,triggerable,triggerer,marker,ev)
    if data.trig then
        return
    end
    data.trig = true
    crawl.god_speaks("Ashenzari", "Ashenzari says, \"See what I see, mortal...\"")
    for slave in iter.slave_iterator("revealing_wall", 1) do
        dgn.terrain_changed(slave.x, slave.y, "clear_stone_wall", false, false, false)
    end
    local msg = ""
    if #data.branches > 0 then
      msg = " of"
      for i, name in ipairs(data.branches) do
        if i == 1 then
        elseif i == #data.branches then
          msg = msg .. " and"
        else
          msg = msg .. ","
        end
        msg = msg .. " the " .. name
      end
      crawl.take_note("Saw a vision" .. msg .. ".")
    end
    crawl.god_speaks("Ashenzari", "You have a sudden vision" .. msg .. "!")
end
}}

NAME: grunt_ashenzari_visionary
DEPTH: D:2-12
TAGS: temple_overflow_ashenzari uniq_altar_ashenzari no_trap_gen no_monster_gen
SHUFFLE: ef
# The branches should be in reverse order here so we don't select the
# same branch twice.
: local branches = {}
: if crawl.game_started() and dgn.br_exists("Swamp") then
:   table.insert(branches, "Swamp")
SUBVAULT: e : grunt_ashenzari_visionary_swamp
: elseif crawl.game_started() and dgn.br_exists("Shoals") then
:   table.insert(branches, "Shoals")
SUBVAULT: e : grunt_ashenzari_visionary_shoals
: elseif crawl.game_started() and dgn.br_exists("Spider") then
:   table.insert(branches, "Spider Nest")
SUBVAULT: e : grunt_ashenzari_visionary_spider
: elseif crawl.game_started() and dgn.br_exists("Snake") then
:   table.insert(branches, "Snake Pit")
SUBVAULT: e : grunt_ashenzari_visionary_snake
: else
SUBVAULT: e : grunt_ashenzari_visionary
: end
: if crawl.game_started() and dgn.br_exists("Snake") then
:   table.insert(branches, "Snake Pit")
SUBVAULT: f : grunt_ashenzari_visionary_snake
: elseif crawl.game_started() and dgn.br_exists("Spider") then
:   table.insert(branches, "Spider Nest")
SUBVAULT: f : grunt_ashenzari_visionary_spider
: elseif crawl.game_started() and dgn.br_exists("Shoals") then
:   table.insert(branches, "Shoals")
SUBVAULT: f : grunt_ashenzari_visionary_shoals
: elseif crawl.game_started() and dgn.br_exists("Swamp") then
:   table.insert(branches, "Swamp")
SUBVAULT: f : grunt_ashenzari_visionary_swamp
: else
SUBVAULT: f : grunt_ashenzari_visionary
: end
{{

lua_marker(":", Triggerable.synchronized_markers(
    function_at_spot("callback.grunt_ashenzari_visionary_reveal",
                     { trig = false, branches = branches },
                     true, { only_at_slave = true, listen_to_slaves = true })))
lua_marker('d', props_marker {revealing_wall=1})
}}
KFEAT: d = stone_wall
KFEAT: _ = altar_ashenzari
MAP
ccccc.@.ccccc
ceeed...dfffc
ceeed...dfffc
ceeed...dfffc
ceeed...dfffc
ceeed:::dfffc
ceeed:::dfffc
ceeed:::dfffc
ceeed:_:dfffc
ceeed:::dfffc
ceeed:::dfffc
ceeed:::dfffc
ceeed...dfffc
ceeed...dfffc
ceeed...dfffc
ceeed...dfffc
ccccc.@.ccccc
ENDMAP

NAME: grunt_ashenzari_visionary_trees
TAGS: grunt_ashenzari_visionary no_trap_gen no_monster_gen
MONS: butterfly
FTILE:  . = floor_grass_dirt_mix
SUBST:  . = ....t1
COLOUR: . = green / brown
KPROP:  . = no_tele_into
MAP
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
ENDMAP

NAME: grunt_ashenzari_visionary_swamp
TAGS: grunt_ashenzari_visionary_swamp no_trap_gen no_monster_gen
KFEAT: H = w
MARKER: H = lua:fog_machine { cloud_type = "thin mist", pow_min = 3, \
                              pow_max = 10, delay = 10, start_clouds = 1, \
                              size_min = 1, size_max = 3, walk_dist = 2 }
# Monsters specified here to omit aquatic placements.
MONS: plant w:150 / fungus w:99 / raven w:20 / giant frog w:30 / \
      giant amoeba w:20 / giant slug w:10 / giant newt w:10 / \
      swamp drake w:80 / alligator band w:150 / water moccasin w:75
SUBST: w = wwwWWt1
FTILE: 1 = floor_swamp
KPROP: wW = no_tele_into
MAP
www
www
wHw
www
www
www
www
wHw
www
www
www
www
wHw
www
www
ENDMAP

NAME: grunt_ashenzari_visionary_lava
TAGS: grunt_ashenzari_visionary no_trap_gen no_monster_gen
KFEAT: H = l
MARKER: H = lua:fog_machine { cloud_type = "black smoke", pow_min = 3, \
                              pow_max = 10, delay = 10, start_clouds = 1, \
                              size_min = 1, size_max = 3, walk_dist = 2 }
MAP
lll
lll
lHl
lll
lll
lll
lll
lHl
lll
lll
lll
lll
lHl
lll
lll
ENDMAP

NAME: grunt_ashenzari_visionary_spider
TAGS: grunt_ashenzari_visionary_spider no_trap_gen no_monster_gen
# Monsters specified here to avoid escaping rock worms.
MONS: giant cockroach w:15 / giant mite w:15 / scorpion w:35 / spider w:40 / \
      giant centipede w:15 / worm w:20 / \
      yellow wasp w:15 / redback w:55 / trapdoor spider w:75 / \
      goliath beetle w:20
SUBST:  . = ....x1
COLOUR: 1. = brown
COLOUR: x = yellow
FTILE:  1. = floor_spider
RTILE:  x = wall_spider
KPROP:  1. = no_tele_into
MAP
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
ENDMAP

NAME: grunt_ashenzari_visionary_snake
TAGS: grunt_ashenzari_visionary_snake no_trap_gen no_monster_gen
MONS: place:Snake:1 spells:none
SUBST:  . = ....x1
COLOUR: 1. = lightgreen
COLOUR: x = yellow
FTILE:  1. = floor_snake_a / floor_snake_c / floor_snake_d
RTILE:  x = wall_snake
KPROP:  1. = no_tele_into
MAP
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
ENDMAP

NAME: grunt_ashenzari_visionary_shoals
TAGS: grunt_ashenzari_visionary_shoals no_trap_gen no_monster_gen
# Monsters specified here to omit aquatic placements.
MONS: bat w:35 / merfolk w:90 / mermaid w:40 / hippogriff w:35 / \
      centaur w:20 / sea snake w:40
SUBST:  w = wwww.1
COLOUR: 1. = brown
FTILE:  1. = floor_sand
KPROP:  1w. = no_tele_into
MAP
www
www
w.w
www
www
www
www
w.w
www
www
www
www
w.w
www
www
ENDMAP
