forked from rpherbig/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
healme.lic
199 lines (169 loc) · 6.63 KB
/
healme.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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#healme
=end
# ***BEGIN USER CONFIG***
UserVars.healme_debug ||= false # turn on echos in the script
# ***END USER CONFIG***
custom_require.call(%w[common common-arcana common-healing events])
class HealMe
include DRC
include DRCA
include DRCH
def initialize
@deadly_wounds = %w[SKIN HEAD NECK CHEST ABDOMEN BACK]
@settings = get_settings
arg_definitions = [
[
{ name: 'bleeders', regex: /^[\w\s,]+$/i, variable: true, optional: true, description: 'comma separated list of bleeders to keep. "right arm, chest, back"' }
]
]
args = parse_args(arg_definitions)
@using_waggle = false
heal_self(args.bleeders)
end
def severity(wounds)
wounds.map { |wound| wound['level'] }.inject(&:+)
end
def spam_heal(base, camb)
loop do
unless DRSpells.active_spells['Heal']
pause 1 while mana < 25
prepare?('heal', base)
charge_and_invoke(@settings.cambrinth, @settings.dedicated_camb_use, camb, @settings.cambrinth_invoke_exact_amount) unless camb.empty?
waitcastrt?
cast?
pause 0.5
end
case bput('perceive health self', '...no injuries to speak of', 'Roundtime')
when '...no injuries to speak of'
break
else
pause 1
end
pause 21
end
end
def cast_spell(spell, preps, part, internal = false)
pause 1 while mana < 25
prepare?(spell, preps.first)
charge_and_invoke(@settings.cambrinth, @settings.dedicated_camb_use, preps[1..-1], @settings.cambrinth_invoke_exact_amount) unless preps[1..-1].empty?
waitcastrt?
Flags.reset('hm-partial-heal')
cast?("cast #{part} #{internal ? 'internal' : ''}")
pause 0.5
echo "partial: #{Flags['hm-partial-heal']}" if UserVars.healme_debug
Flags['hm-partial-heal']
end
def heal_wound(spells, part, internal)
if @using_waggle
spells['Heal Wounds']['cast'] = "cast #{part}"
spells['Heal Wounds']['cast'] = "cast #{part} internal" if internal
check_discern(spells['Heal Wounds'], @settings) if spells['Heal Wounds']['use_auto_mana']
loop do
Flags.reset('hm-partial-heal')
DRCA.cast_spell(spells['Heal Wounds'], @settings, true)
echo "partial: #{Flags['hm-partial-heal']}" if UserVars.healme_debug
break if !Flags['hm-partial-heal']
end
else
pause 0.5 while cast_spell('HW', @settings.empath_healing['HW'], part, internal)
end
end
def heal_scar(spells, part)
if @using_waggle
spells['Heal Scars']['cast'] = "cast #{part}"
check_discern(spells['Heal Scars'], @settings) if spells['Heal Scars']['use_auto_mana']
loop do
Flags.reset('hm-partial-heal')
DRCA.cast_spell(spells['Heal Scars'], @settings, true)
echo "partial: #{Flags['hm-partial-heal']}" if UserVars.healme_debug
break if !Flags['hm-partial-heal']
end
else
pause 0.5 while cast_spell('HS', @settings.empath_healing['HS'], part)
end
end
def heal_wounds(spells, wounds, skip_parts)
echo "healing: #{wounds}" if UserVars.healme_debug
return if skip_parts.include?(wounds.first['part']) && wounds.size == 1
if wounds.count { |wound| wound['type'] == 'Fresh' } > 0
heal_wound(spells, wounds.first['part'], skip_parts.include?(wounds.first['part']))
end
heal_scar(spells, wounds.first['part'])
end
def cure_disease(spells, health)
return unless health['diseased']
return unless spells['Cure Disease']
Flags.add('hm-disease', 'You feel completely cured of all disease', 'you don.t seem to be so afflicted')
loop do
if Flags['hm-disease']
Flags.delete('hm-disease')
return
else
unless DRSpells.active_spells['Cure Disease']
DRCA.cast_spell(spells['Cure Disease'], @settings, true)
end
end
end
end
def flush_poisons(spells, health)
return unless health['poisoned']
return unless spells['Flush Poisons']
Flags.add('hm-poison', '^A sudden wave of heat washes over you as your spell attempts to flush poison from your body but finds no toxins', '^A sudden wave of heat washes over you as your spell flushes all poison from your body')
loop do
if Flags['hm-poison']
Flags.delete('hm-poison')
return
else
unless DRSpells.active_spells['Flush Poisons']
DRCA.cast_spell(spells['Flush Poisons'], @settings, true)
end
end
end
end
def heal_self(skip_parts)
return unless DRStats.empath?
Flags.delete('hm-partial-heal')
Flags.add('hm-partial-heal',
'appear very slightly improved\.',
'appear slightly improved\.',
'appear better\.',
'appear greatly improved\.',
'appear almost completely healed\.',
'but it is ineffective\.',
'appear somewhat better\.',
'appear considerably better\.')
wounds = check_perc_health
return if wounds.empty?
spells = if @settings.waggle_sets['healing']
@using_waggle = true
@settings.waggle_sets['healing']
else
@settings.empath_healing
end
find_cambrinth(@settings.cambrinth, @settings.stored_cambrinth, @settings.cambrinth_cap)
health = check_health
cure_disease(spells, health)
flush_poisons(spells, health)
DRCA.cast_spell(spells['Regenerate'], @settings) if spells['Regenerate'] && !DRSpells.active_spells.include?('Regenerate')
if spells['Heal'] && @using_waggle && skip_parts.nil?
spam_heal(@settings.waggle_sets['healing']['Heal']['mana'], @settings.waggle_sets['healing']['Heal']['cambrinth'])
elsif @settings.empath_healing['HEAL'] && skip_parts.nil?
spam_heal(@settings.empath_healing['HEAL'].first, @settings.empath_healing['HEAL'][1..-1])
else
skip_parts = skip_parts.split(',').map(&:upcase).map(&:strip)
echo("skip: #{skip_parts}") if UserVars.healme_debug
echo("wounds: #{wounds}") if UserVars.healme_debug
echo("dw: #{@deadly_wounds}") if UserVars.healme_debug
danger_wounds = wounds.select { |part, _| @deadly_wounds.include?(part) }.sort_by { |_, val| severity(val) }.reverse
echo("bad wounds: #{danger_wounds}") if UserVars.healme_debug
danger_wounds.each do |(part, _)|
heal_wounds(spells, wounds[part], skip_parts)
wounds.delete(part)
end
wounds.sort_by { |_, val| severity(val) }.reverse_each { |_, wound| heal_wounds(spells, wound, skip_parts) }
end
stow_cambrinth(@settings.cambrinth, @settings.stored_cambrinth, @settings.cambrinth_cap)
end
end
HealMe.new