forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
healme.lic
119 lines (93 loc) · 3.65 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
=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)
heal_self(args.bleeders)
end
def severity(wounds)
wounds.map { |wound| wound['level'] }.inject(&:+)
end
def spam_heal(base, camb)
Flags.add('hm-heal-done', 'Your body is completely healed')
until Flags['hm-heal-done']
pause 1 while mana < 25
prepare?('heal', base)
charge_and_invoke(@settings.cambrinth, @settings.dedicated_camb_use, camb) unless camb.empty?
waitcastrt?
cast?
pause 0.5
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]) 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(part, internal)
pause 0.5 while cast_spell('HW', @settings.empath_healing['HW'], part, internal)
end
def heal_scar(part)
pause 0.5 while cast_spell('HS', @settings.empath_healing['HS'], part)
end
def heal_wounds(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(wounds.first['part'], skip_parts.include?(wounds.first['part']))
end
heal_scar(wounds.first['part'])
end
def heal_self(skip_parts)
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\.')
find_cambrinth(@settings.cambrinth, @settings.stored_cambrinth, @settings.cambrinth_cap)
if @settings.empath_healing['HEAL'] && skip_parts.nil?
spam_heal(@settings.empath_healing['HEAL'].first, @settings.empath_healing['HEAL'][1..-1])
else
wounds = check_perc_health
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(wounds[part], skip_parts)
wounds.delete(part)
end
wounds.sort_by { |_, val| severity(val) }.reverse_each { |_, wound| heal_wounds(wound, skip_parts) }
end
stow_cambrinth(@settings.cambrinth, @settings.stored_cambrinth, @settings.cambrinth_cap)
end
end
HealMe.new