File: cave1.lua

package info (click to toggle)
kq 0.99.cvs20070319-1.1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 8,344 kB
  • ctags: 2,870
  • sloc: ansic: 26,328; sh: 3,737; makefile: 203; perl: 100
file content (114 lines) | stat: -rw-r--r-- 2,758 bytes parent folder | download
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114


-- cave1 - "Underground tunnel from Ekla to Randen"

--
function autoexec()
  if (get_treasure(2) == 0) then
    if (get_progress(1) < 2) then
      set_progress(1, 0)
    end
  end
  -- PH added refresh here to get rid of DarkImp
  refresh()
end
function entity_handler(en)
  return
end
function postexec()
  return
end
function refresh()
  -- Pot in SW corner
  if (get_treasure(1) == 1) then
    set_zone("treasure1", 0)
  end
  -- Treasure chest on W
  if (get_treasure(2) == 1) then
    set_mtile("treasure2", 41)
    set_zone("treasure2", 41)
  end
  -- Dark Imp boss in SE corner
  if (get_progress(2) == 1) then
    set_ftile("imp", 0)
    set_zone("imp", 7)
    set_obs("imp", 0)
  end
  -- Dying man in NE corner
  if (get_progress(3) == 1 or get_progress(2) == 1) then
    set_btile("dead", 25)
    set_zone("dead", 0)
    set_obs("dead", 0)
  end
  -- Portal in SW corner
  if (get_progress(38) == 1) then
    set_ftile("portal", 217)
  end
end
function zone_handler(zn)
  if (zn == 0) then
    if (get_progress(38) == 0) then
      combat(6)
    end
  elseif (zn == 1) then
    change_map("town1", "stairway")
  elseif (zn == 2) then
    change_map("town2", "stairway")
  elseif (zn == 4) then
    chest(1, 103, 1)
    refresh()
  elseif (zn == 5) then
    chest(2, 126, 1)
    refresh()
  elseif (zn == 6) then
    if (get_progress(1) < 2) then
      bubble(200, "These stairs are blocked!")
    else
      change_map("guild", "cave1")
    end
  elseif (zn == 7) then
    -- This is simply a monster-free zone
  elseif (zn == 8) then
    if (get_progress(1) == 0) then
      bubble(200, "Hmm... this wall looks odd.")
      set_progress(1, 1)
    end
  elseif (zn == 9) then
    warp("warp_w", 8)
  elseif (zn == 10) then
    warp("warp_e", 8)
  elseif (zn == 11) then
    if (get_progress(3) == 0) then
      bubble(255, "... don't go any further. A strange creature has... blocked the path. It just appeared there out of nowhere.")
      set_progress(3, 1)
    else
      bubble(200, "He's dead.")
    end
  elseif (zn == 12) then
    if (get_progress(2) == 0) then
      set_run(0)
      combat(7)
      set_run(1)
      set_progress(2, 1)
      refresh()
    end
  elseif (zn == 13) then
    if (get_progress(38) == 0) then
      if (get_progress(37) == 1) then
        bubble(200, "Hmmm... I guess if I just touch it with the rod...")
        do_fadeout(4)
        set_progress(38, 1)
        set_progress(113, 1)
        refresh()
        drawmap()
        screen_dump()
        do_fadein(4)
        bubble(200, "Whoa! The rod melted the portal shut!")
      else
        bubble(200, "Hmmm... this is very old and has several deep cracks in it.")
      end
    else
      bubble(200, "I wonder where this came from?")
    end
  end
end