1##############################################################################
2# Megacathedral, for the bats on the brink of extinction. Or beyond. (due)
3
4{{
5function callback.cathedral_bats (data, triggerable, triggerer, marker, ev)
6  if triggerer.type ~= "turn" or triggerer.sub_type ~= "countdown" then
7    return
8  end
9
10  if data.bat_count > 10 then
11    return
12  end
13
14  local x, y = marker:pos()
15  local you_x, you_y = you.pos()
16
17  if (you_x == x and you_y == y) then return end
18  if dgn.mons_at(x, y) then return end
19
20  if (not dgn.create_monster(x, y,
21          "generate_awake bat name:megabat n_rpl n_spe n_des n_noc tile:mons_megabat / " ..
22          "generate_awake w:2 fire bat")) then
23    return
24  end
25
26  data.bat_count = data.bat_count + 1
27
28  if you.see_cell(x, y) then
29    crawl.mpr("A bat flies out of a crevice!")
30  end
31end
32}}
33
34NAME:   due_megacathedral
35ORIENT: float
36DEPTH:  D:8-14
37MONS:   wraith / shadow w:2
38MONS:   flayed ghost
39TAGS:   no_rotate no_vmirror no_hmirror
40NSUBST: C = 5:C / *:.
41SUBST:  X = C
42SUBST:  D = V..
43{{
44local cathedral_bats = TriggerableFunction:new {
45    func = "callback.cathedral_bats",
46    repeated = true,
47    data = {bat_count=0},
48}
49
50cathedral_bats:add_triggerer(DgnTriggerer:new {
51    type="turn",
52    delay_min=500,
53    delay_max=800
54})
55
56lua_marker('C', cathedral_bats)
57lua_marker('V', cathedral_bats)
58}}
59MAP
60             cccc.cccc
61          ccccccG.Gcccccc
62         ccc...cc+cc1..ccc
63      ccccc..C..c.c..D..ccccc
64     ccc.ccc...cc.cc...ccc.ccc
65     cc1..ccc+cc...cc+ccc...cc
66  ccccc.D.ccc.........ccc.C.ccccc
67 cccccc...+c..ccc+ccc..c+...cccccc
68 cc...cc.cc..ccc...ccc..cc.cc..1cc
69cc.....ccc..cc.......cc..ccc.....cc
70cc..C...+....+...X...+....+...D..cc
71cc.....ccc..cc.......cc..ccc.....cc
72 cc...cc.cc..ccc...ccc..cc.cc...cc
73 cccccc...+c..ccc+ccc..c+...cccccc
74  ccccc.D.ccc.........ccc.C.ccccc
75     cc1..ccc+ccG.Gcc+ccc...cc
76     ccc.ccc...cc=cc...ccc.ccc
77      ccccc..D..c.c..C..ccccc
78         ccc..1cc2cc...ccc
79          cccccc|||cccccc
80             ccccccccc
81ENDMAP
82