forked from rpherbig/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common-healing.lic
258 lines (246 loc) · 10.7 KB
/
common-healing.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# quiet
=begin
Documentation: https://elanthipedia.play.net/Lich_script_development#common-healing
=end
custom_require.call(%w[common])
$wound_map = {
'insignificant' => 1,
'negligible' => 2,
'minor' => 3,
'more than minor' => 4,
'harmful' => 5,
'very harmful' => 6,
'damaging' => 7,
'very damaging' => 8,
'severe' => 9,
'very severe' => 10,
'devastating' => 11,
'very devastating' => 12,
'useless' => 13
}
$all_parasites = [
/(?:small|large) (?:black|red) blood mite/,
/red sand leech/,
/albino forest leech/,
/(?:green|red) blood worm/,
/Retch maggot/
]
re_part = /(?<part>(?:left|right)?\s?(?:\w+))/
$severity_to_text = {
1 => [
/minor abrasions to the #{re_part}/,
/a few nearly invisible scars along the #{re_part}/
],
2 => [
/some tiny scars (?:across|along) the #{re_part}/,
/(?:light|tiny) scratches to the #{re_part}/
],
3 => [
/a bruised (?<part>head)/,
/(?<skin>a small skin rash)/,
/(?<skin>loss of skin tone)/,
/(?<skin>some minor twitching)/,
/(?<skin>slight difficulty moving your fingers and toes)/,
/cuts and bruises about the #{re_part}/,
/minor scar\w+ (?:about|along|across) the #{re_part}/,
/minor swelling and bruising (?:around|in) the #{re_part}/,
/occasional twitch\w* (?:on|in) the #{re_part}/,
/a black and blue #{re_part}/
],
4 => [
/a deeply bruised (?<part>head)/,
/(?<skin>a large skin rash)/,
/(?<skin>minor skin discoloration)/,
/(?<skin>some severe twitching)/,
/(?<skin>slight numbness in your arms and legs)/,
/deep cuts (?:about|across) the #{re_part}/,
/severe scarring (?:across|along|about) the #{re_part}/,
/a severely swollen and\s?(?:deeply)? bruised #{re_part}/,
/(?:occasional|constant) twitch\w* (?:on|in) the #{re_part}/,
/a bruised and swollen (?<part>(?:right|left) (?:eye))/
],
5 => [
/some deep slashes and cuts about the (?<part>head)/,
/severe scarring and ugly gashes about the #{re_part}/,
/major swelling and bruising around the (?<part>head)/,
/an occasional twitch on the fore(?<part>head)/,
/a bruised,* swollen and bleeding #{re_part}/,
/deeply scarred gashes across the #{re_part}/,
/a severely swollen, bruised and crossed #{re_part}/,
/a constant twitching in the #{re_part}/,
/deep slashes across the #{re_part}/,
/a severely swollen and deeply bruised #{re_part}/,
/a severely swollen and bruised #{re_part}/,
/a constant twitching in the (?<part>chest) area and difficulty breathing/,
/(?<abdomen>a somewhat emaciated look)/,
/a constant twitching in the #{re_part} and difficulty moving in general/,
/(?<skin>a body rash)/,
/severe (?<part>skin) discoloration/,
/(?<skin>difficulty controlling actions)/,
/(?<skin>numbness in your fingers and toes)/
],
6 => [
/(?<head>a cracked skull with deep slashes)/,
/missing chunks out of the (?<part>head)/,
/a ghastly bloated (?<part>head) with bleeding from the ears/,
/a confused look with sporadic twitching of the fore(?<part>head)/,
/a bruised, swollen and slashed #{re_part}/,
/a punctured and shriveled #{re_part}/,
/a severely swollen,* bruised and cloudy #{re_part}/,
/a clouded #{re_part}/,
/gaping holes in the #{re_part}/,
/a broken #{re_part} with gaping holes/,
/severe scarring and ugly gashes about the #{re_part}/,
/severe scarring and chunks of flesh missing from the #{re_part}/,
/a severely swollen and deeply bruised #{re_part} with odd protrusions under the skin/,
/a severely swollen and deeply bruised (?<part>chest) area with odd protrusions under the skin/,
/a partially paralyzed #{re_part}/,
/a painful #{re_part} and difficulty moving without pain/,
/a painful (?<part>chest) area and difficulty getting a breath without pain/,
/a severely bloated and discolored #{re_part} with strange round lumps under the skin/,
/(?<abdomen>a definite greenish pallor and emaciated look)/,
/(?<skin>a painful,* inflamed body rash)/,
/(?<skin>a painful,* enflamed body rash)/,
/some shriveled and oddly folded (?<part>skin)/,
/(?<skin>partial paralysis of the entire body)/,
/(?<skin>numbness in your arms and legs)/
],
7 => [
/(?<head>a crushed skull with horrendous wounds)/,
/a mangled and malformed (?<part>head)/,
/a ghastly bloated (?<part>head) with bleeding from the ears/,
/a confused look with sporadic twitching of the fore(?<part>head)/,
/a bruised,* swollen and shattered #{re_part}/,
/a painfully mangled and malformed #{re_part} in a shattered eye socket/,
/a severely swollen,* bruised and blind #{re_part}/,
/severely scarred,* mangled and malformed #{re_part}/,
/a completely clouded #{re_part}/,
/a shattered #{re_part} with gaping wounds/,
/shattered (?<part>chest) area with gaping wounds/,
/a severely swollen and deeply bruised #{re_part} with bones protruding out from the skin/,
/a severely swollen and deeply bruised #{re_part} with ribs or vertebrae protruding out from the skin/,
/a severely paralyzed #{re_part}/,
/a severely painful #{re_part} with significant problems moving/,
/a severely painful (?<part>chest) area with significant problems breathing/,
/#{re_part} deeply gouged with gaping wounds/,
/a severely bloated and discolored #{re_part} with strange round lumps under the skin/,
/(?<abdomen>a severely yellow pallor and a look of starvation)/,
/a shattered #{re_part} with gaping wounds/,
/boils and sores around the (?<part>skin)/,
/severely stiff and shriveled (?<part>skin) that seems to be peeling off the body/,
/(?<skin>severe paralysis of the entire body)/,
/(?<skin>general numbness all over)/
],
8 => [
/pulpy stump for a (?<part>head)/,
/a stump for a (?<part>head)/,
/an ugly stump for a #{re_part}/,
/a grotesquely bloated (?<part>head) with bleeding from the eyes and ears/,
/(?<head>a blank stare)/,
/a pulpy cavity for a #{re_part}/,
/an empty #{re_part} socket overgrown with bits of odd shaped flesh/,
/a severely swollen,* bruised and blind #{re_part}/,
/a blind #{re_part}/,
/a completely useless #{re_part} with nearly all flesh and bone torn away/,
/a completely destroyed #{re_part} with nearly all flesh and bone torn away revealing a gaping hole/,
/an ugly flesh stump for a #{re_part}/,
/an ugly flesh stump for a #{re_part} with little left to support the head/,
/a severely swollen and shattered #{re_part} which appears completely useless/,
/a severely swollen and shattered #{re_part} which appears useless to hold up the head/,
/a completely paralyzed #{re_part}/,
/a mostly non-existent #{re_part} filled with ugly chunks of scarred flesh/,
/a severely swollen (?<part>chest) area with a shattered rib cage/,
/an extremely painful #{re_part} while gasping for breath in short shallow bursts/,
/a severely bloated and discolored #{re_part} which appears oddly rearranged/,
/(?<abdomen>a death pallor and extreme loss of weight)/,
/a severely swollen #{re_part} with a shattered spinal cord/,
/an extremely painful and bizarrely twisted #{re_part} making it nearly impossible to move/,
/open and bleeding sores all over the (?<part>skin)/,
/severe (?<part>skin) loss exposing bone and internal organs/,
/(?<skin>complete paralysis of the entire body)/,
/(?<skin>general numbness all over and have difficulty thinking)/
]
}
$comma_detector = /(?<=swollen|bruised|scarred|painful),(?=\s(?:swollen|bruised|mangled|inflamed))/
module DRCH
module_function
def check_health
all_parasites_re = Regexp.union($all_parasites)
wounds_line = nil
parasites_line = nil
diseased = false
poisoned = false
DRC.bput('health', 'You have')
pause 0.5
data = reget(50).reverse
data.each do |line|
case line
when /^You have (?!no significant injuries)(?!.* lodged into your)(?!.* infection)(?!.* poison(?:ed)?)(?!.* #{all_parasites_re})/
wounds_line = line
when /^Your body feels\b.*(?:strength|battered|beat up|bad shape|death's door|dead)/
break
when /^You have a dormant infection/, /^Your wounds are infected/, /^Your body is covered in open oozing sores/
diseased = true
when /^You have .* poison(?:ed)?/
poisoned = true
when /^You have a .* on your/, all_parasites_re
parasites_line = line
end
end
wounds = Hash.new { |h, k| h[k] = [] }
if wounds_line
wounds_line.gsub!($comma_detector, '') # Remove commas from individual wounds
part = nil
wounds_line.split(',').each do |wound|
$severity_to_text.each do |severity_level, match_text|
next unless wound =~ Regexp.union(match_text)
part = Regexp.last_match.names.find { |x| Regexp.last_match[x.to_sym] }
part = Regexp.last_match[:part] if part == 'part'
wounds[severity_level] << part
end
end
end
parasites = Hash.new { |h, k| h[k] = [] }
if parasites_line
parasites_line.split(',').each do |parasite|
parasite =~ all_parasites_re
parasite_name = Regexp.last_match.to_s
parasite =~ /on your (?<part>(?:left|right)?\s?(?:\w+))/
location = Regexp.last_match[:part].to_s
parasites[parasite_name] << location
end
end
{ 'wounds' => wounds, 'poisoned' => poisoned, 'diseased' => diseased, 'parasites' => parasites }
end
def check_perc_health
return unless DRStats.empath?
DRC.bput('perc heal self', 'Roundtime')
data = reget 100
data = data.reverse.take_while { |item| item != "Your injuries include...\r" }.reverse
wounds = {}
part = nil
data.each do |line|
if line =~ /Wounds to the (.+):/
part = Regexp.last_match(1)
wounds[part] = []
end
wounds[part] += [{ 'part' => part, 'location' => Regexp.last_match(2), 'type' => Regexp.last_match(1), 'level' => $wound_map[Regexp.last_match(3)] }] if line =~ /(\w+) (\w+):.*\-\- (.*)\r/
end
waitrt?
wounds
end
def bind_wound(part, person = 'my')
snap = [DRC.left_hand, DRC.right_hand]
if /You \w+ remove/ =~ DRC.bput("tend #{person} #{part}", 'You work carefully at tending', 'That area has already been tended to', 'That area is not bleeding', 'You fumble', 'too injured for you to do that', 'You \w+ remove')
DRC.bput("drop my #{DRC.left_hand}", 'You drop', 'What were you') if DRC.left_hand != snap.first
DRC.bput("drop my #{DRC.right_hand}", 'You drop', 'What were you') if DRC.right_hand != snap.last
bind_wound(part, person)
end
waitrt?
end
def unwrap_wound(part)
DRC.bput("unwrap my #{part}", 'You unwrap your bandages') # Are there other messages?
pause 5
bind_wound(part)
end
end