File: bridge2.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 (136 lines) | stat: -rw-r--r-- 3,703 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
-- bridge2 - "On Brayden river Randen and Andra, complete"

-- /*
-- {
-- Which globals should we have for the (incomplete) bridge?
--
-- P_FIGHTONBRIDGE
--   (0)..(4) [Not calculated]: when this is <=4, we will not use bridge2
--   (5) Slept at the inn, bridge is pretty close to being done
--   (6) [Not calculated]: when this is >= 6, we will not even enter the map
--
-- P_LOSERONBRIDGE
--   (0) Have not spoken to man who forgot his sword
--   (1) Spoke to him after defeating the monsters
--
-- P_ASLEEPONBRIDGE
--   (0) Have not spoken to man sleeping on bridge
--   (1) Man is asleep again
-- }
-- */


function autoexec()
  refresh()
end


function entity_handler(en)
  if (en == 0) then
    bubble(en, "There have been no further threats. Thank you.")

  elseif (en == 1) then
    if (get_progress(P_LOSERONBRIDGE) == 0) then
      bubble(en, "It's a good thing you helped us out with that monster!")
      bubble(HERO1, "Oh, it was nothing...")
      bubble(en, "No, really! I don't have a sword!")
      wait(50)
      bubble(en, "I probably shouldn't have told you that.")
      set_progress(P_LOSERONBRIDGE, 1)
    elseif (get_progress(P_LOSERONBRIDGE) == 1) then
      bubble(HERO1, "So what happened to your sword?")
      bubble(en, "...")
      wait(50)
      bubble(en, "My dog ate it.")
      set_progress(P_LOSERONBRIDGE, 2)
    elseif (get_progress(P_LOSERONBRIDGE) == 2) then
      bubble(en, "Hey, look! I found a board with a nail in it!")
      thought(HERO1, "Oh, good grief!")
      bubble(en, "Fear my wrath! Hi-yah!")
    end

  elseif (en == 2) then
    bubble(en, "Just a few more planks and this will be finished!")

  elseif (en == 3) then
    bubble(en, "I... zzz... can't stay awak... zzz...")

  elseif (en == 4) then
    bubble(en, "*YAWN!* That other guy's yawning is contagious!")

  elseif (en == 5) then
    bubble(en, "My breaks are too short. I could really use another one.")

  elseif (en == 6) then
    bubble(en, "I've planted flowers underneath the bridge.")

  elseif (en == 7) then
    bubble(en, "I'm an architect. I'm building these pillars to reinforce the bridge.")

  elseif (en == 8) then
    if (get_progress(P_BANGTHUMB) == 0) then
      bubble(en, "Yes, wha...")
      msg("WHAM!", 255, 0)
      bubble(en, "Yow!! My thumb! I banged my thumb!")
      if (get_ent_tilex(HERO1) > get_ent_tilex(en)) then
        set_ent_facing(en, FACE_RIGHT)
      elseif (get_ent_tiley(HERO1) > get_ent_tiley(en)) then
        set_ent_facing(en, FACE_DOWN)
      end
      bubble(en, "I hope that you're satisfied!")
    else
      bubble(en, "Owww, my poor thumb...")
    end

  elseif (en == 9) then
    bubble(en, "Some moron rode a wagon over here with STONE RIMS! I'd like to find the no-good, lousy...")

  end
end


function postexec()
  return
end


function refresh()
  showch("treasure1", 8)
  showch("treasure2", 90)
end


-- Show the status of a treasures
function showch(which_marker, which_chest)
  -- Set tiles if -1 passed in as 'which_chest' or if chest already opened
  if (get_treasure(which_chest) == 1) then
    set_zone(which_marker, 0)
  end
  if (which_marker == "treasure1") then
    set_obs(which_marker, 0)
  end
  if (which_marker == "treasure2") then
    set_ftile(which_marker, 0)
  end
end


function zone_handler(zn)
  if (zn == 1) then
    change_map("main", "bridge", -1, 0)

  elseif (zn == 2) then
    -- // TT: This is still here incase the player didn't get it on the first
    -- //     (incomplete) bridge.  They can only get it once.
    chest(8, I_OSEED, 2)
    refresh()

  elseif (zn == 3) then
    chest(90, I_REGENERATOR, 1)
    refresh()

  elseif (zn == 4) then
    change_map("main", "bridge", 1, 0)

  end
end