summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dat/des/altar/trog_burn_book.des
blob: 691a99eef7088c718f2fc719e41d41ea82161bc1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Trog burns a book at his altar.
#
# He only does so if both the altar and the book are in sight of the player.
# This should give sneaky players an opportunity to apport the book, but
# only if they spot the vault in time.

{{
function callback.trog_book_convert_book(data, triggerable,
                                          triggerer, marker, ev)
  if data.turns ~= you.turns() then
    data.tc = data.tc + 1
    data.turns = you.turns()
  end

  if data.tc < 3 then
    return
  end

  if data.triggered == true then
    return
  end

  local m = dgn.find_marker_positions_by_prop("slave_name", "trog_book")[1]
  if m ~= nil then
    local _x, _y = m:xy()

    if not you.see_cell(_x, _y) then
      return
    end

    for book in iter.stash_iterator(_x, _y) do
      if string.find(book.name(), 'book') then
        book.destroy()
        dgn.place_cloud(_x, _y, "flame", 15)
        crawl.god_speaks("Trog", "The spellbook bursts into flames! "
                              .. "Trog roars with delight!")
      end
    end
    data.triggered = true
  end
end
}}


NAME:   trog_book
TAGS:   uniq_altar_trog temple_overflow_trog
DEPTH:  D:2-10, Orc
KFEAT:  _ = altar_trog
{{
local tm = TriggerableFunction:new{func="callback.trog_book_convert_book",
  repeated=true, data={turns=you.turns(), tc=0, triggered=false} }
tm:add_triggerer(DgnTriggerer:new{type="player_los"})
lua_marker('_', tm)
}}
MARKER: b = lua:portal_desc {slave_name="trog_book"}
KFEAT:  b = .
KITEM:  b = randbook title:Retrieval spells:apportation numspells:1
MAP
xxxxxxx
x.....xxx
x._.b....@
x.....xxx
xxxxxxx
ENDMAP