1##############################################################################
2# Variation on classic trog_book - this time he's caught a real live wizard.
3# (mumra)
4
5{{
6
7function callback.trog_wizard_convert_wizard(data, triggerable,
8                                          triggerer, marker, ev)
9  if data.turns ~= you.turns() then
10    data.tc = data.tc + 1
11    data.turns = you.turns()
12  end
13
14-- Allow slightly longer than trog_book for the situation to sink in
15-- since there's nothing to apport
16  if data.tc < 5 then
17    return
18  end
19
20  if data.triggered == true then
21    return
22  end
23
24  local m = dgn.find_marker_positions_by_prop("slave_name", "trog_wizard")[1]
25  if m ~= nil then
26    local _x, _y = m:xy()
27
28    -- Only burn the wizard when you see both the altar and the wizard.
29    if not you.see_cell(_x, _y) then
30      return
31    end
32
33    dgn.place_cloud(_x, _y, "flame", 15)
34    local mons = dgn.mons_at(_x, _y)
35    if mons and mons.base_name == "wizard" then
36        crawl.god_speaks("Trog", "Flames erupt from the bowels of the wizard! "
37                              .. "Trog roars with satisfaction!")
38    else
39        crawl.god_speaks("Trog", "Flames erupt from the wizard's "
40                              .. (mons and "" or "empty ")
41                              .. "cell! "
42                              .. "Trog roars with frustration!")
43    end
44    data.triggered = true
45  end
46end
47
48}}
49
50
51NAME:   trog_wizard
52TAGS:   temple_overflow_1 temple_overflow_trog generate_awake
53TAGS:   no_item_gen no_monster_gen no_trap_gen
54KFEAT:  _ = altar_trog
55{{
56local tm = TriggerableFunction:new{func="callback.trog_wizard_convert_wizard",
57  repeated=true, data={turns=you.turns(), tc=0, triggered=false} }
58tm:add_triggerer(DgnTriggerer:new{type="player_los"})
59lua_marker('#', tm)
60}}
61FTILE:  .#_ = FLOOR_PEBBLE_BROWN
62FTILE:  1 = FLOOR_PEBBLE_DARKGRAY
63COLOUR: . = brown
64COLOUR: 1 = darkgray
65KFEAT:  1 = .
66# A terrified wizard whose spells have been taken away
67# (he refused to convert)
68MARKER: 1 = lua:portal_desc {slave_name="trog_wizard"}
69KMONS:  1 = wizard perm_ench:mute spells:. dbname:captured_wizard ; nothing
70KPROP:  1 = no_tele_into
71KFEAT:  # = iron_grate
72MAP
73ccccccccc
74c.......c
75c.ccc...ccc
76c.c1#._....@
77c.ccc...ccc
78c.......c
79ccccccccc
80ENDMAP
81