-
Notifications
You must be signed in to change notification settings - Fork 8
/
rcast.lic
162 lines (149 loc) · 5.06 KB
/
rcast.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
=begin
Cast spells with rapid-fire.
https://github.com/matt-lowe/lich-scripts
tillmen@lichproject.org
=end
prep = proc { |spell|
if (checkprep != 'None') and (checkprep != spell.name)
dothistimeout 'release', 5, /^You feel the magic of your spell rush away from you\.$|^You don't have a prepared spell to release!$/
end
unless checkprep == spell.name
begin
waitcastrt?
prepare_result = dothistimeout "prepare #{spell.num}", 5, /^You already have a spell readied! You must RELEASE it if you wish to prepare another!$|^You can't think clearly enough to prepare a spell!$|^Your spell is ready\.( [Spell is stored])?$/
if prepare_result == 'You already have a spell readied! You must RELEASE it if you wish to prepare another!'
dothistimeout 'release', 5, /^You feel the magic of your spell rush away from you\.$|^You don't have a prepared spell to release!$/
elsif (prepare_result == "You can't think clearly enough to prepare a spell!") or prepare_result.nil?
exit
end
end until prepare_result =~ /^Your spell is ready\.( [Spell is stored])?$/
end
}
#
# find out what we're casting and what we're casting it at
#
if script.vars[1] =~ /^[0-9]+$/
unless spell = Spell[script.vars[1].to_i]
echo 'unknown spell'
exit
end
if [ 901, 903, 904, 905, 906, 907, 908, 910, 505, 510, 518 ].include?(spell.num)
change_stance = true
else
change_stance = false
end
target = nil
target_list = nil
if spell.type =~ /attack/
if script.vars[2].nil?
target = 'target'
elsif script.vars[2] == 'room'
npcs = GameObj.npcs
npcs.delete_if { |npc| npc.status =~ /dead/ }
exit if npcs.nil? or npcs.empty?
target_list = npcs.collect { |npc| "##{npc.id}" }
elsif script.vars[2] == 'players'
pcs = GameObj.pcs
pcs.delete_if { |npc| npc.status =~ /dead/ }
exit if pcs.nil? or pcs.empty?
target_list = pcs.collect { |npc| "##{npc.id}" }
else
target = script.vars[2..-1].join(' ')
end
else
if script.vars[2].nil?
exit
elsif script.vars[2] == 'room'
target_list = GameObj.pcs
target_list.delete_if { |pc| pc.status =~ /dead/ or pc.name =~ /Wizricky|Earthdiver|Hinonshu|Raelee|Barundar|Lalan|Edgeleaf|Rimalon|Zyphon|Andaryel|Missoni|Rtune/ }
exit if target_list.nil? or target_list.empty?
target_list = target_list.collect { |pc| pc.noun }
elsif script.vars[2] == 'group'
target_list = Array.new
fput 'group'
line = get until line =~ /([A-Z][a-z]+) is the leader of your group/
target_list.push($1)
while (line = get) and name = /([A-Z][a-z]+) is also a member of your group/.match(line).captures.first
target_list.push($1)
end
target_list.delete_if { |name| name =~ /Wizricky|Earthdiver|Hinonshu|Raelee|Barundar|Lalan|Edgeleaf|Rimalon|Zyphon|Andaryel|Missoni|Rtune/ }
exit if target_list.nil? or target_list.empty?
else
target_list = script.vars[2..-1]
end
end
else
echo
echo "Usage: ;rcast <spell> <target> [target2] [target3] ..."
echo ' or'
echo 'Usage: ;rcast <spell> room (casts at every player in the room)'
echo ' or'
echo 'Usage: ;rcast <spell> group (casts at every player in your group)'
echo
echo ' If a target is more than one word, enclose it in quotes.'
echo
exit
end
#
# Cast rapid fire if it's not already up
#
until checkspell(515)
Spell[515].cast
sleep 1
waitcastrt?
end
#
# check mana
#
unless checkmana(eval(spell.cost))
echo 'Not enough mana.'
exit
end
prep.call(spell)
#
# change stance
#
if change_stance and (checkstance != 'offensive')
stance_result = dothistimeout 'stance offensive', 2, /^You are now in an offensive stance\.$/
if stance_result == nil
fput 'stance guarded'
exit
end
end
if target
#
# cast at one target until it's dead
#
loop {
break unless checkmana((eval(spell.cost).to_f*1.25).ceil)
cast_result = dothistimeout "cast #{target}", 2, /^Cast Roundtime 3 Seconds\.$|^Cast at what\?$|^\[Spell Hindrance|^A little bit late for that don't you think\?$|goes still\.$|crumbles into a pile of rubble\.$|and dies\.$|lying still\.$|goes still\.$|shudders, then topples to the ground\.$|topples to the ground motionless\.$|^The body twitches slightly in response\.$|^But it is dead!$/
if cast_result =~ /^\[Spell Hindrance/
break unless checkmana((eval(spell.cost).to_f*1.25).ceil)
prep.call(spell)
elsif cast_result != 'Cast Roundtime 3 Seconds.'
break
end
}
else
#
# cast once at a lot of targets
#
for target in target_list
break unless checkmana((eval(spell.cost).to_f*1.25).ceil)
loop {
cast_result = dothistimeout 'cast ' + target, 2, /^Cast Roundtime 3 Seconds\.$|^Cast at what\?$|^\[Spell Hindrance|^d100 == 1 FUMBLE!$/
if cast_result =~ /^\[Spell Hindrance/
break unless checkmana((eval(spell.cost).to_f*1.25).ceil)
prep.call(spell)
elsif cast_result != 'd100 == 1 FUMBLE!'
break
end
}
end
end
if change_stance
dothistimeout 'stance guarded', 3, /^You are now in a guarded stance\.$|^You are unable to change your stance\.$/
end
unless (checkprep == 'None') #or checkspell(515)
dothistimeout 'release', 5, /^You feel the magic of your spell rush away from you\.$|^You don't have a prepared spell to release!$/
end