-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathshield-size.lic
215 lines (192 loc) · 7.3 KB
/
shield-size.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
=begin
This script calculates how much defense you get from your
shield and dodge training with each size of shield in each
stance against melee and ranged attacks.
;shield-size help
author: Tillmen ([email protected])
game: Gemstone
tags: data
version: 0.1
=end
shield_modifier_melee = {
'small' => 0.85,
'medium' => 1.0,
'large' => 1.15,
'tower' => 1.3,
}
shield_modifier_ranged = {
'small' => 1.2,
'medium' => 1.5,
'large' => 1.8,
'tower' => 2.1,
}
shield_stance_modifier = {
'offensive' => 0.5,
'advance' => 0.6,
'forward' => 0.7,
'neutral' => 0.8,
'guarded' => 0.9,
'defensive' => 1.0
}
shield_bonus_penalty_ranged = {
'small' => -8,
'medium' => 0,
'large' => 8,
'tower' => 16,
}
dodge_shield_penalty = {
'small' => 0,
'medium' => 0,
'large' => 5,
'tower' => 10,
}
dodge_shield_factor = {
'small' => 0.78,
'medium' => 0.7,
'large' => 0.62,
'tower' => 0.54,
}
dodge_stance_modifier = {
'offensive' => 0.75,
'advance' => 0.8,
'forward' => 0.85,
'neutral' => 0.9,
'guarded' => 0.95,
'defensive' => 1.0
}
asg_name = [ nil, 'normal clothing', 'robes', nil, nil, 'light leather', 'full leather', 'reinforced leather', 'double leather', 'leather breastplate', 'cuirbouilli leather', 'studded leather', 'brigandine armor', 'chain mail', 'double chain', 'augmented chain', 'chain hauberk', 'metal breastplate', 'augmented breastplate', 'half plate', 'full plate' ]
dodge_armor_hindrance = [ nil, 1.00, 1.00, nil, nil, 1.00, 1.00, 0.98, 0.97, 0.97, 0.96, 0.95, 0.94, 0.94, 0.93, 0.92, 0.91, 0.90, 0.88, 0.85, 0.83 ]
guess_asg = proc {
if GameObj.inv.any? { |obj| obj.name =~ /full plate/ }
20
elsif GameObj.inv.any? { |obj| obj.name =~ /half plate/ }
19
elsif GameObj.inv.any? { |obj| obj.name =~ /augmented breastplate/ }
18
elsif GameObj.inv.any? { |obj| obj.name =~ /metal breastplate/ }
17
elsif GameObj.inv.any? { |obj| obj.name =~ /chain hauberk/ }
16
elsif GameObj.inv.any? { |obj| obj.name =~ /augmented chain/ }
15
elsif GameObj.inv.any? { |obj| obj.name =~ /double chain/ }
14
elsif GameObj.inv.any? { |obj| obj.name =~ /chain mail/ }
13
elsif GameObj.inv.any? { |obj| obj.name =~ /brigandine/ }
12
elsif GameObj.inv.any? { |obj| obj.name =~ /studded leather/ }
11
elsif GameObj.inv.any? { |obj| obj.name =~ /cuirbouilli leather/ }
10
elsif GameObj.inv.any? { |obj| obj.name =~ /leather breastplate/ }
9
elsif GameObj.inv.any? { |obj| obj.name =~ /double leather/ }
8
elsif GameObj.inv.any? { |obj| obj.name =~ /reinforced leather/ }
7
elsif GameObj.inv.any? { |obj| obj.name =~ /full leather/ }
6
elsif GameObj.inv.any? { |obj| obj.name =~ /light leather/ }
5
elsif GameObj.inv.any? { |obj| obj.name =~ /robes/ }
2
else
echo "Probably failed to guess your armor.. try #{$clean_lich_char}#{script.name} asg=# "
1
end
}
shield_ranks = dodge_ranks = str_bonus = dex_bonus = int_bonus = agi_bonus = asg = enchant = nil
for var in script.vars[1..-1]
if var =~ /^shield(?:\-)?(?:use)?(?:\-)?(?:ranks)?=([0-9]+)$/i
shield_ranks = $1.to_i
elsif var =~ /^dodge?(?:ing)?(?:\-)?(?:ranks)?=([0-9]+)$/i
dodge_ranks = $1.to_i
elsif var =~ /^str(?:ength)?(?:\-)?(?:bonus)?=([0-9]+)$/i
str_bonus = $1.to_i
elsif var =~ /^dex(?:terity)?(?:\-)?(?:bonus)?=([0-9]+)$/i
dex_bonus = $1.to_i
elsif var =~ /^int(?:uition)?(?:\-)?(?:bonus)?=([0-9]+)$/i
int_bonus = $1.to_i
elsif var =~ /^agi(?:lity)?(?:\-)?(?:bonus)?=([0-9]+)$/i
agi_bonus = $1.to_i
elsif var =~ /^(?:asg|armor)=([0-9]+)$/i
asg = $1.to_i
elsif var =~ /^enchant(?:\-)?(?:bonus)?=([0-9]+)$/i
enchant = $1.to_i
else
output = "\n"
output.concat "Usage:\n\n"
output.concat " #{$clean_lich_char}#{script.name}\n"
output.concat " This will use your current skills and stats and asg (good chance the asg will be wrong) and display defence info for each shield size and stance against melee and ranged attacks.\n\n"
output.concat " #{$clean_lich_char}#{script.name} shield=<ranks> dodge=<ranks> str=<bonus> dex=<bonus> int=<bonus> agi=<bonus> asg=<number> enchant=<bonus>\n"
output.concat " You can provide any or all of the above values.\n\n"
respond output
exit
end
end
shield_ranks ||= Skills.shielduse
dodge_ranks ||= Skills.dodging
str_bonus ||= Stats.str[1]
dex_bonus ||= Stats.dex[1]
int_bonus ||= Stats.int[1]
agi_bonus ||= Stats.agi[1]
enchant ||= 0
if asg.nil?
guessed_asg = true
asg = guess_asg.call
else
guessed_asg = false
end
output = "\nUsing: strength bonus: #{str_bonus}, dexterity bonus: #{dex_bonus}, shield use ranks: #{shield_ranks}, agility bonus: #{agi_bonus}, intuition bonus: #{int_bonus}, dodge ranks: #{dodge_ranks}, shield enchant bonus: #{enchant}, armor#{' (guessed)' if guessed_asg}: #{asg_name[asg]} (asg #{asg})\n\n"
shield_base_value = shield_ranks + (str_bonus/4) + (dex_bonus/4)
dodge_base_value = dodge_ranks + agi_bonus + (int_bonus/4)
output.concat " - melee -\n\n"
if $frontend == 'stormfront'
output.concat "<output class=\"mono\">\n"
end
output.concat " offensive advance forward neutral guarded defensive\n"
output.concat " none "
for stance in [ 'offensive', 'advance', 'forward', 'neutral', 'guarded', 'defensive' ]
dodge_ds_melee = ((dodge_base_value * dodge_armor_hindrance[asg]).floor * dodge_stance_modifier[stance]).floor
output.concat dodge_ds_melee.to_s.ljust(14)
end
output.concat "\n"
for shield_size in [ 'small', 'medium', 'large', 'tower' ]
output.concat "#{shield_size.rjust(6)} "
for stance in [ 'offensive', 'advance', 'forward', 'neutral', 'guarded', 'defensive' ]
shield_ds_melee = (((shield_base_value * shield_modifier_melee[shield_size]).floor * shield_stance_modifier[stance]).floor / 1.5).floor + 20 + enchant
dodge_ds_melee = ((((dodge_base_value * dodge_armor_hindrance[asg]).floor * dodge_shield_factor[shield_size]).floor - dodge_shield_penalty[shield_size]) * dodge_stance_modifier[stance]).floor
str = "#{shield_ds_melee + dodge_ds_melee} (#{shield_ds_melee}+#{dodge_ds_melee})"
output.concat str.ljust(14)
end
output.concat "\n"
end
output.concat "\n"
output.concat " - ranged -\n\n"
output.concat " offensive advance forward neutral guarded defensive\n"
output.concat " none "
for stance in [ 'offensive', 'advance', 'forward', 'neutral', 'guarded', 'defensive' ]
dodge_ds_ranged = (((dodge_base_value * dodge_armor_hindrance[asg]).floor * dodge_stance_modifier[stance]).floor * 1.5).ceil
output.concat dodge_ds_ranged.to_s.ljust(14)
end
output.concat "\n"
for shield_size in [ 'small', 'medium', 'large', 'tower' ]
output.concat "#{shield_size.rjust(6)} "
for stance in [ 'offensive', 'advance', 'forward', 'neutral', 'guarded', 'defensive' ]
shield_ds_ranged = ((((shield_base_value * shield_modifier_ranged[shield_size]).floor + shield_bonus_penalty_ranged[shield_size]) * shield_stance_modifier[stance]).floor / 1.5).floor + 20 + enchant
dodge_ds_ranged = ((((dodge_base_value * dodge_armor_hindrance[asg]).floor * dodge_shield_factor[shield_size]).floor * dodge_stance_modifier[stance]).floor * 1.5).ceil
str = "#{shield_ds_ranged + dodge_ds_ranged} (#{shield_ds_ranged}+#{dodge_ds_ranged})"
output.concat str.ljust(14)
end
output.concat "\n"
end
output.concat "\n"
if $frontend == 'stormfront'
output.concat "<output class=\"\">\n"
end
if $frontend == 'stormfront'
puts output
else
respond output
end