forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon-moonmage.lic
More file actions
210 lines (183 loc) · 7.38 KB
/
Copy pathcommon-moonmage.lic
File metadata and controls
210 lines (183 loc) · 7.38 KB
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# quiet
=begin
Documentation: https://elanthipedia.play.net/Lich_script_development#common-moonmage
=end
custom_require.call(%w[common])
module DRCMM
module_function
def observe(thing)
output = "observe #{thing} in heavens"
output = 'observe heavens' if thing.eql?('heavens')
DRC.bput(output.to_s, 'Your search for', 'You see nothing regarding the future', 'Clouds obscure', 'Roundtime', 'The following heavenly bodies are visible:', "That's a bit hard to do while inside")
end
def predict(thing)
output = "predict #{thing}"
output = 'predict state all' if thing.eql?('all')
DRC.bput(output.to_s, 'You predict that', 'You are far too', 'you lack the skill to grasp them fully', /(R|r)oundtime/i, 'You focus inwardly')
end
def study_sky
DRC.bput('study sky', 'You feel a lingering sense', 'You feel it is too soon', 'Roundtime', 'You are unable to sense additional information', 'detect any portents')
end
def get_telescope(storage)
if storage['tied']
DRC.bput("untie telescope from my #{storage['tied']}", 'You remove', 'You untie', '^What were you referring', 'Untie what', '^You are a little too busy')
elsif storage['container']
DRC.bput("get telescope in my #{storage['container']}", 'You get a', 'You are already', "That can't be picked up", 'You need a free hand to pick that up.', 'What were you referring to', 'stop practicing your Athletics')
else
DRC.bput('get my telescope', 'You get a', 'What were you referring to', 'You are already holding that.', "That can't be picked up", 'You need a free hand to pick that up.', 'stop practicing your Athletics')
end
end
def store_telescope(storage)
if storage['tied']
DRC.bput("tie telescope to my #{storage['tied']}", 'You attach', 'you tie', 'You are a little too busy')
elsif storage['container']
DRC.bput("put telescope in my #{storage['container']}", 'You put')
else
DRC.bput('stow my telescope', 'Stow what', 'You put your telescope')
end
end
def peer_telescope
DRC.bput('peer telescope',
'The pain is too much',
'You see nothing regarding the future',
"You believe you've learned all that you can about",
get_data('constellations').observe_finished_messages,
'open it',
'Your vision is too fuzzy',
'Roundtime')
end
def center_telescope(target)
DRC.bput("center telescope on #{target}",
'Center what',
'You put your eye',
'open it to make any use of it',
'The pain is too much',
"That's a bit tough to do when you can't see the sky",
"You would probably need a periscope to do that",
'Your search for',
'Your vision is too fuzzy',
'You must have both hands free')
end
def align(skill)
DRC.bput("align #{skill}", 'You focus internally')
end
def get_bones(storage)
if storage['tied']
DRC.bput("untie bones from my #{storage['container']}", 'You untie', 'You remove')
else
DRC.bput("get bones from my #{storage['container']}", 'You get')
end
end
def store_bones(storage)
if storage['tied']
DRC.bput("tie bones to my #{storage['container']}", 'You attach', 'You tie')
else
DRC.bput("put bones in my #{storage['container']}", 'You put')
end
end
def roll_bones(storage)
get_bones(storage)
DRC.bput('roll my bones', 'roundtime')
waitrt?
store_bones(storage)
end
def get_div_tool(tool)
if tool['tied']
DRC.bput("untie #{tool['name']} from my #{tool['container']}", tool['name'])
elsif tool['worn']
DRC.bput("remove my #{tool['name']}", tool['name'])
else
DRC.bput("get my #{tool['name']} from my #{tool['container']}", tool['name'], 'you get')
end
end
def store_div_tool(tool)
if tool['tied']
DRC.bput("tie #{tool['name']} to my #{tool['container']}", tool['name'])
elsif tool['worn']
DRC.bput("wear my #{tool['name']}", tool['name'])
else
DRC.bput("put #{tool['name']} in my #{tool['container']}", tool['name'], 'You put')
end
end
def use_div_tool(tool_storage)
get_div_tool(tool_storage)
{
'charts' => 'review',
'bones' => 'roll',
'mirror' => 'gaze',
'bowl' => 'gaze',
'prism' => 'raise'
}.select { |tool, _| tool_storage['name'].include?(tool) }
.each { |tool, verb| DRC.bput("#{verb} my #{tool}", 'roundtime'); waitrt? }
store_div_tool(tool_storage)
end
# There are many variants of a summoned moon weapon (blade, staff, sword, etc)
# This function checks if you're holding one then tries to wear it.
# Returns true if what is in your hands is a summoned moon weapon that becomes worn.
# Returns false if you're not holding a moon weapon, or you are but can't wear it.
# https://elanthipedia.play.net/Shape_Moonblade
def wear_moon_weapon?
moon_wear_messages = ["You're already", "You can't wear", "Wear what", "telekinetic"]
wore_it = false
if is_moon_weapon?(DRC.left_hand)
wore_it = wore_it || DRC.bput("wear #{DRC.left_hand}", *moon_wear_messages) == "telekinetic"
end
if is_moon_weapon?(DRC.right_hand)
wore_it = wore_it || DRC.bput("wear #{DRC.right_hand}", *moon_wear_messages) == "telekinetic"
end
return wore_it
end
# Drops the moon weapon in your hands, if any.
# Returns true if dropped something, false otherwise.
def drop_moon_weapon?
moon_drop_messages = ["As you open your hand", "What were you referring to"]
dropped_it = false
if is_moon_weapon?(DRC.left_hand)
dropped_it = dropped_it || DRC.bput("drop #{DRC.left_hand}", *moon_drop_messages) == "As you open your hand"
end
if is_moon_weapon?(DRC.right_hand)
dropped_it = dropped_it || DRC.bput("drop #{DRC.right_hand}", *moon_drop_messages) == "As you open your hand"
end
return dropped_it
end
# Is a moon weapon in your hands?
def holding_moon_weapon?
return is_moon_weapon?(DRC.left_hand) || is_moon_weapon?(DRC.right_hand)
end
# Try to hold a moon weapon.
# If you end up not holding a moon weapon then returns false.
def hold_moon_weapon?
return true if holding_moon_weapon?
return false if [DRC.left_hand, DRC.right_hand].compact.length >= 2
['moonblade', 'moonstaff'].each do |weapon|
glance = DRC.bput("glance my #{weapon}", "You glance at a .* #{weapon}", "I could not find")
case glance
when /You glance/
return DRC.bput("hold my #{weapon}", "You grab", "You aren't wearing", "Hold hands with whom?", "You need a free hand") == "You grab"
end
end
false
end
# Does the item appear to be a moon weapon?
def is_moon_weapon?(item)
return false unless item
!(item =~ /^((black|red-hot|blue-white) moon(blade|staff))$/i).nil?
end
def moon_used_to_summon_weapon
# Note, if you have more than one weapon summoned at a time
# then the results of this method are non-deterministic.
# For example, if you have 2+ moonblades/staffs cast on different moons.
['moonblade', 'moonstaff'].each do |weapon|
glance = DRC.bput("glance my #{weapon}", "You glance at a .* (black|red-hot|blue-white) moon(blade|staff)", "I could not find")
case glance
when /black moon/
return 'katamba'
when /red-hot moon/
return 'yavash'
when /blue-white moon/
return 'xibar'
end
end
return nil
end
end