forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common-arcana.lic
176 lines (141 loc) · 5.85 KB
/
common-arcana.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
# quiet
=begin
Documentation: https://elanthipedia.play.net/Lich_script_development#common-arcana
=end
custom_require.call(%w(common common-travel events spellmonitor))
module DRCA
module_function
def infuse_om(harness, amount)
return unless amount
success = ['having reached its full capacity', 'a sense of fullness', 'Something in the area is interfering with your attempt to harness']
failure = ['as if it hungers for more', 'Your infusion fails completely', 'You don\'t have enough harnessed mana to infuse that much', 'You have no harnessed']
loop do
pause 5 while mana <= amount
harness_mana(amount) if harness
break if success.include?(DRC.bput("infuse om #{amount}", success, failure))
pause 0.5
waitrt?
end
end
def harness_mana(amount)
DRC.bput("harness #{amount}", 'You tap into', 'Strain though you may')
pause 0.5
waitrt?
end
def activate_khri?(kneel, ability)
return false if DRSpells.active_spells[ability]
DRCT.retreat if kneel
DRC.bput('kneel', 'You kneel', 'You are already', 'You rise') if kneel && !kneeling?
result = DRC.bput(ability, get_data('spells').khri_preps)
waitrt?
DRC.fix_standing
['Your body is willing', 'You have not recovered'].include?(result)
end
def prepare?(abbrev, mana, symbiosis = false, command = 'prepare')
return false unless abbrev
DRC.bput('prep symb', 'You recall the exact details of the', 'But you\'ve already prepared') if symbiosis
case DRC.bput("#{command} #{abbrev} #{mana}", get_data('spells').prep_messages)
when 'Your desire to prepare this offensive spell suddenly slips away'
pause 1
return prepare?(abbrev, mana, symbiosis, command)
when 'Something in the area interferes with your spell preparations'
DRC.bput('rel symb', 'You release the', 'But you haven\'t') if symbiosis
return false
end
true
end
def buff(spell, settings)
prepare?(spell['abbrev'], spell['mana'], spell['symbiosis'])
find_charge_invoke_stow(settings.cambrinth, settings.stored_cambrinth, settings.cambrinth_cap, settings.dedicated_camb_use, spell['cambrinth'])
waitcastrt?
cast?(spell['cast'], spell['symbiosis'], spell['before'], spell['after'])
end
def ritual(spell)
DRCT.retreat
DRC.bput('stance set 100 0 80', 'Setting your')
prepare?(spell['abbrev'], spell['mana'], spell['symbiosis'])
find_focus(spell['focus'], spell['worn_focus'])
invoke(spell['focus'], nil)
stow_focus(spell['focus'], spell['worn_focus'])
waitcastrt?
cast?(spell['cast'], spell['symbiosis'], spell['before'], spell['after'])
end
def cast?(cast_command = 'cast', symbiosis = false, before = [], after = [])
before.each { |action| DRC.bput(action['message'], action['matches']) }
Flags.add('spell-fail', 'Currently lacking the skill to complete the pattern', 'backfires')
Flags.add('cyclic-too-recent', 'The mental strain of initiating a cyclic spell so recently prevents you from formulating the spell pattern')
case DRC.bput(cast_command || 'cast', get_data('spells').cast_messages)
when /^Your target pattern dissipates/, /^You can't cast that at yourself/, /^You need to specify a body part to consume/
fput('release spell')
end
waitrt?
if Flags['cyclic-too-recent']
pause 1
return cast?(cast_command, symbiosis, [], after)
end
after.each { |action| DRC.bput(action['message'], action['matches']) }
if symbiosis && Flags['spell-fail']
bput('release symbiosis', 'You release', 'But you haven\'t prepared')
end
!Flags['spell-fail']
end
def find_charge_invoke_stow(cambrinth, stored_cambrinth, cambrinth_cap, dedicated_camb_use, charges)
return unless charges
find_cambrinth(cambrinth, stored_cambrinth, cambrinth_cap)
charge_and_invoke(cambrinth, dedicated_camb_use, charges)
stow_cambrinth(cambrinth, stored_cambrinth, cambrinth_cap)
end
def find_focus(focus, worn)
if worn
DRC.bput("remove my #{focus}", 'You remove', 'You slide', 'You sling', 'You take')
else
DRC.bput("get my #{focus}", 'You get')
end
end
def stow_focus(focus, worn)
if worn
DRC.bput("wear my #{focus}", 'You attach', 'You slide', 'You are already wearing', 'You hang', 'You sling', 'You put', 'You place')
else
DRC.bput("stow my #{focus}", 'You put')
end
end
def find_cambrinth(cambrinth, stored_cambrinth, cambrinth_cap)
if stored_cambrinth
DRC.bput("get my #{cambrinth}", 'You get')
elsif DRSkill.getrank('Arcana').to_i < cambrinth_cap * 2 + 100
DRC.bput("remove my #{cambrinth}", 'You remove', 'You slide', 'You sling', 'You take')
end
end
def stow_cambrinth(cambrinth, stored_cambrinth, cambrinth_cap)
if stored_cambrinth
DRC.bput("stow my #{cambrinth}", 'You put')
elsif DRSkill.getrank('Arcana').to_i < cambrinth_cap * 2 + 100
DRC.bput("wear my #{cambrinth}", 'You attach', 'You slide', 'You are already wearing', 'You hang', 'You sling', 'You put', 'You place')
end
end
def charge_and_invoke(cambrinth, dedicated_camb_use, charges)
charges.each do |mana|
break unless charge?(cambrinth, mana)
end
invoke(cambrinth, dedicated_camb_use)
end
def invoke(cambrinth, dedicated_camb_use)
DRC.bput("invoke my #{cambrinth} #{dedicated_camb_use}", get_data('spells').invoke_messages)
pause
waitrt?
end
def charge?(cambrinth, mana)
result = DRC.bput("charge my #{cambrinth} #{mana}", get_data('spells').charge_messages)
pause
waitrt?
result == 'absorbs all of the energy'
end
def release_cyclics
get_data('spells')
.spell_data
.select { |_name, properties| properties['cyclic'] }
.select { |name, _properties| DRSpells.active_spells.keys.include?(name) }
.map { |_name, properties| properties['abbrev'] }
.each { |abbrev| fput("release #{abbrev}") }
end
end