-
Notifications
You must be signed in to change notification settings - Fork 178
/
droughtmans.lic
190 lines (164 loc) · 6.15 KB
/
droughtmans.lic
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
custom_require.call(%w[common common-items events])
class Droughtmans
def initialize
# If we're not in the maze, get us there. Otherwise, run the normal routine as though you're inside the maze.
case DRC.bput("look", /Droughtman's Maze, Grand Hall/, /Droughtman's Maze, Contestant's Box/, /The Maze/, /Obvious paths/)
when /Grand Hall/
redeem
prep
when /Contestant's Box/
prep
end
Flags.add('set-nemesis', /A booming voice echoes through the maze, "(?<nemesis>\w+) just found a golden key!"/, /a vision of (?<nemesis>\w+) holding the golden key/, /(?<nemesis>\w+) picks up a golden key./)
Flags.add('unset-nemesis', /has prevailed over Droughtman's Maze/, /As the dowsing concludes, a vision of the golden key/)
Flags.add('npc-unfrozen', /A(?<npc>.*) begins to move around again./)
Flags.add('wand-searched', /The blue wand glows softly as you begin to dowse/)
Flags.add('key-down', /As the dowsing concludes, a vision of the golden key/)
main_loop
end
def redeem
exit unless DRCI.get_item?('pass')
2.times do
DRC.bput("redeem my pass", /Once you redeem this/, /The maze spieler takes.* your pass/)
end
DRCI.stow_item?('pass') if DRCI.in_hands?('pass')
DRC.bput("ask spieler about access", /To conquer Droughtman's Maze/)
end
def prep
DRC.wait_for_script_to_complete('buff', ['droughtman'])
fput 'get wand' unless DRCI.in_hands?('wand')
2.times do
fput 'go door'
end
end
def wave(person)
return if get_key || have_key?
case DRC.bput("wave wand at #{person}", /^Roundtime/, /already frozen/, /Wave at what?/, /I do not understand/, /drops his golden key/)
when /drop his golden key/
@nemesis = nil
get_key
when /Roundtime/, /already frozen/
DRRoom.npcs.delete(person)
when /I do not understand/ # no wand, out of the maze
exit
end
end
def have_key?
DRCI.in_hands?('golden key')
end
def get_key
return if have_key?
return unless DRRoom.room_objs.include?('golden key')
DRC.release_invisibility
DRCI.get_item_unsafe('golden key')
end
def pull_rope
return if @norope
case DRC.bput("Pull rope", /A golden key falls to the floor with a loud CLANK/, # Run forest run!
/A gentle breeze begins to blow through the area/, # Tarzan rope, starting over
/A loud CLICK echoes from above/, # Nothing, hopefully dropped the key?
/A bell begins to loudly ring, echoing off the walls of the area/, # money rope, big whoop
/A cloud of sweet smelling multi-hued mist floods the area/, # laughter trap, stunned
/With the grinding sound of stone moving against stone an opening appears in the wall next to you/, # crossbow bolts
/There is a sudden flash of greenish light, and a huge electrical charge sends you flying backwards through the air/, # zap and stun, big health chunk
/I'm afraid that you can't pull that/, /What were you referring/, /I could not find/, # no rope
/A faint fizzling sound comes from the rope/, /The rope begins to expand before your very eyes/,
/The rope falls to the floor where it begins to writhe around/) # already pulled
when /a golden key/
get_key
@nemesis = nil
when /A gentle breeze/
search_wand
when /With the grinding sound/
DRC.wait_for_script_to_complete('tendme')
end
end
def search_wand
return if @injured
Flags.reset('key-down')
case DRC.bput("search wand", /^Roundtime/, /You're not in any condition to be searching around/)
when /not in any condition/
@injured = true
@norope = true
end
end
def package
DRC.bput("open my package", /You open/)
4.times do
break if /What were you/ =~ DRC.bput("get coin from my package", /You pick up/, /What were you/, /You get/)
end
fput 'look in my package'
DRCI.stow_item?('package')
exit
end
def main_loop
loop do
DRC.fix_standing
@norope = false unless Flags['key-down'] || @nemesis || Flags['set-nemesis']
@norope = false if Flags['wand-searched'] && !Flags['key-down'] && !@nemesis && !Flags['set-nemesis']
DRCI.get_item_unsafe('wand') unless DRCI.in_hands?('wand')
DRRoom.npcs << Flags['npc-unfrozen'][:npc].split.last if Flags['npc-unfrozen']
Flags.reset('npc-unfrozen')
if DRRoom.pcs.include?(@nemesis)
wave(@nemesis)
waitrt?
end
get_key
DRRoom.npcs.each { |npc| wave(npc) }
if DRCI.in_hands?('package')
package
end
if have_key?
@nemesis = nil
if DRRoom.room_objs.include?("white door")
DRC.bput("go white door", /A wall of light shimmers as you pass through/)
package
end
elsif !DRRoom.pcs.empty?
DRRoom.pcs.each do |person|
case DRC.bput("look #{person}", /(Sh|H)e is holding.*/, /I could not find/, /concealing all but.*/)
when /golden key/
wave(person)
else
if person == @nemesis
@nemesis = nil
end
end
DRRoom.pcs.delete(person)
end
elsif (lever = DRRoom.room_objs.find { |obj| obj =~ /lever/ })
fput "Pull #{lever}"
DRRoom.room_objs.delete(lever)
elsif DRRoom.room_objs.find { |obj| obj =~ /rope/ }
pull_rope
end
if Flags['set-nemesis']
@nemesis = Flags['set-nemesis'][:nemesis]
echo "New nemesis: #{@nemesis}"
Flags.reset('set-nemesis')
Flags.reset('key-down')
@norope = true
elsif Flags['unset-nemesis']
Flags.reset('unset-nemesis')
Flags.reset('wand-searched')
echo "Nemesis Removed: #{@nemesis}"
@nemesis = nil
if Flags['key-down']
@norope = true
end
end
if DRStats.thief? && !DRSpells.active_spells['Khri Sight']
fput 'Khri Sight'
end
pause 0.1
end
end
end
before_dying do
Flags.delete('set-nemesis')
Flags.delete('unset-nemesis')
Flags.delete('npc-unfrozen')
Flags.delete('wand-searched')
Flags.delete('repositioned')
end
Droughtmans.new