common: global Data() to parse perl code includes
[sheet.git] / sc.plp
1 <(common.inc.plp)><:
2 use List::Util qw(max sum);
3
4 my %scvers = (
5         bw => {
6                 name => 'Brood War',
7                 title => 'starcraft',
8                 game => 'StarCraft BW',
9                 major => 1,
10         },
11         hots => {
12                 name => 'Heart of the Swarm',
13                 title => 'starcraft2 hots',
14                 game => 'StarCraft II HotS',
15                 major => 2,
16         },
17         lotv => {
18                 name => 'Legacy of the Void',
19                 title => 'starcraft2 lotv',
20                 game => 'StarCraft II LotV',
21                 major => 2,
22         },
23         index => 'bw',
24         1     => 'bw',
25         2     => 'lotv',
26 );
27
28 my $requestver = $scvers{$Request ||= 'index'}
29         or Html(), Abort("Requested version <q>$Request</q> not available", '404 request not found');
30
31 if (ref $requestver ne 'HASH') {
32         $header{Location} = "/sc/$requestver";
33         Abort("Canonical URL for $Request is at $requestver", '302 subpage alias');
34 }
35
36 my %scver = %{$requestver};
37 my $datafile = "sc-units-$Request";
38
39 Html({
40         title => "$scver{title} unit cheat sheet",
41         version => '1.3',
42         description => [
43                 "Reference of $scver{game} unit properties,"
44                 . " comparing various statistics of all the units in $scver{name}"
45                 . ' including costs, damage, defense, speed, ranges, and abilities.',
46         ],
47         keywords => [
48                 qw'
49                 starcraft game unit statistics stats comparison table sheet cheat
50                 reference software attributes properties patch attribute multiplayer
51                 ',
52                 $scver{major} < 2 ? qw' bw broodwar brood war ' :
53                 qw' starcraft2 lotv hots wol ',
54         ],
55         stylesheet => [qw( light dark )],
56         raw => '<link rel="stylesheet" type="text/css" media="all" href="/sc.css?1.2">',
57         data => ["$datafile.inc.pl"],
58 });
59
60 say "<h1>$scver{game} units</h1>\n";
61
62 my $units = Data($datafile);
63 my $patch = shift @{$units}
64         or Abort("Cannot open unit data: metadata not found", 501);
65
66 say "<p>Unit properties as seen or measured in $scver{name}\n$patch.";
67 say "Also see the $_ tables." for join(' and ',
68         (showlink('StarCraft 2: LotV', '/sc/lotv'))    x ($Request ne 'lotv'),
69         (showlink(             'HotS', '/sc/hots'))    x ($Request ne 'hots'),
70         (showlink('original SC: Brood War', '/sc/bw')) x ($Request ne 'bw'),
71 );
72 say "</p>\n";
73
74 sub addupgrade {
75         my ($ref, $increase, $org) = @_;
76         if (ref $increase eq 'HASH') {
77                 addupgrade(\${$ref}->{$_}, $increase->{$_}, $org->{$_}) for keys %{$increase};
78         }
79         elsif (ref $increase eq 'ARRAY') {
80                 addupgrade(\${$ref}->[$_], $increase->[$_], $org->[$_]) for 0 .. $#{$increase};
81         }
82         ${$ref} //= $org;
83         ${$ref} += $increase if $increase =~ /^-?[0-9.]+/;
84 }
85
86 for my $unit (@{$units}) {
87         for my $upgrade (@{ $unit->{upgrade} }) {
88                 while (my ($col, $increase) = each %{$upgrade}) {
89                         defined $unit->{$col} or next;
90                         addupgrade(\$unit->{upgraded}->{$col}, $increase, $unit->{$col});
91                 }
92         }
93         for my $special (@{ $unit->{special} }) {
94                 for my $upgrade (@{ $special->{upgrade} }) {
95                         while (my ($col, $increase) = each %{$upgrade}) {
96                                 defined $special->{$col} or next;
97                                 addupgrade(\$special->{upgraded}->{$col}, $increase, $special->{$col});
98                         }
99                 }
100         }
101 }
102
103 sub coltoggle {
104         my ($name, $id, $nolink) = @_;
105         return "$name ▼" if defined $get{order} ? $get{order} eq $id : !$id;
106         return $name if $nolink;
107         return showlink($name, '?'.($id && "order=$id"));
108 }
109 :><table class="units">
110 <thead><tr>
111         <th><:= coltoggle(exists $get{order} ? 'race' : 'source' => '') :></th>
112         <th class="unit-name"><:= coltoggle(name => 'name') :></th>
113         <th class="val unit-min" title=minerals><:= coltoggle(cost => 'cost') :></th>
114         <th class="val unit-gas">gas</th>
115         <th class="val time"><:= coltoggle(build => 'build') :></th>
116         <th class="unit" colspan="2"><:= coltoggle(qw'size size') :></th>
117         <th class="unit unit-attr" colspan="2">attr</th>
118         <th class="val unit-hp"><:= coltoggle(HP => 'hp') :></th>
119         <th class="val unit-shield">shield</th>
120         <th class="val unit-armor" title="armor">⛨</th>
121         <th class="val hurt"><:= coltoggle(attack => 'attack') :></th>
122         <th class="hurt hurtrel">dps</th>
123         <th class="val unit-range" colspan=3>range</th>
124         <th class="val unit-sight">sight</th>
125         <th class="val unit-speed"><:= coltoggle(speed => 'speed') :></th>
126         <th class="unit-magic">specials</th>
127 </tr></thead>
128 <:
129 sub showrange {
130         my ($min, $max) = @_;
131         return '' if not defined $min;
132         return $min || '-' if !$max or $min == $max;
133         return "$min-$max";
134 }
135
136 sub showrangeint {
137         $_ &&= int($_ + .5) for @_;  # round halves up
138         return showrange(@_);
139 }
140
141         sub showcost {
142                 my ($row, $unit) = @_;
143                 return join(' ',
144                         sprintf('cost %s%%', join '-',
145                                 map { $_ && sprintf '%.0f', 100 * $row->{cost} / $_ } grep { defined $_ }
146                                 $unit->{energy},
147                                 $unit->{upgraded}->{energy},
148                                 $unit->{capacity},
149                                 $unit->{upgraded}->{capacity},
150                         ),
151                         !defined $row->{maint} ? () : sprintf('+%s%%/s', join '-',
152                                 map { sprintf '%.1f', 100 * $row->{maint} / $_ } grep $_,
153                                 $unit->{capacity},
154                                 $unit->{upgraded}->{capacity},
155                         ),
156                 );
157         }
158
159         sub showattack {
160                 my ($row, $area) = @_;
161                 my $attack = $row->{attack}->[$area]
162                         or return '<td colspan=5 class="hurt">';
163
164                 my $upattack = $row->{upgraded}->{attack}->[$area];
165                 my $damage = $attack->{damage};
166                 my $maxdamage = $upattack->{damage} // $damage;
167                 $maxdamage += ($upattack->{upgrade} // $attack->{upgrade}) * 3;
168
169                 my $out = '<td class="val hurt">';
170                 $out .= sprintf '<span title="%s">¤</span> ', showcost($attack, $row)
171                         if $attack->{cost};
172                 $out .= sprintf('<small>%s× </small>',
173                         showrangeint($attack->{count}, $upattack->{count}),
174                 ) if $attack->{count} > 1;
175                 $out .= '<span class="unit-l" title="explosive">*</span>'
176                         if $attack->{type} eq 'explosive';
177                 $out .= '<span class="unit-s" title="implosive">~</span>'
178                         if $attack->{type} eq 'implosive';
179         if (my @bonus = sort grep { !/^-/ } keys %{ $attack->{bonus} }) {
180                 $out .= sprintf('<span class="%s" title="%s">&ge;</span>',
181                         (map {
182                                 $_ eq 'light' ? 'unit-s' :
183                                 $_ eq 'armored' ? 'unit-l' :
184                                 $_ eq 'organic' ? 'unit-o' :
185                                 $_ eq 'massive' ? 'unit-h' :
186                                 $_ eq 'shields' ? 'unit-shield' :
187                                 '',
188                         } join '_', @bonus),
189                         join(', ', map {(
190                                 sprintf('+%s vs %s',
191                                         showrangeint(
192                                                 $attack->{bonus}->{$_},
193                                                 ($upattack->{bonus} // $attack->{bonus})->{$_}
194                                                         + ($upattack->{bonus} // $attack->{bonus})->{"-$_"} * 3,
195                                         ),
196                                         $_,
197                                 ),
198                         )} @bonus),
199                 );
200         }
201                 $out .= '<span class="unit-pdd" title="projectile">•</span>'
202                         if $attack->{type} eq 'projectile';
203
204                 $out .= sprintf '<span title="%s">', $attack->{name} if $attack->{name};
205                 $out .= showrangeint($damage, $maxdamage);
206                 $out .= '</span>' if $attack->{name};
207                 $out .= sprintf('<span class="unit-splash" title="%s">%s</span>',
208                         $attack->{splash} eq 'line' ? ('linear', '+') : ('splash', '⁜')
209                 ) if $attack->{splash};
210
211                 $out .= '<td class="val hurt hurtrel">';
212                 if ($attack->{dps}) {
213                         # precalculated dps, do not touch
214                         $out .= showrangeint($attack->{dps}->[0],
215                                 $upattack->{dps}->[-1] // $attack->{dps}->[-1]
216                         );
217                 }
218                 elsif ($attack->{cooldown}) {
219                         if (my $type = $attack->{type}) {
220                                 if ($type eq 'explosive') {
221                                         $damage /= 2;
222                                 }
223                                 elsif ($type eq 'implosive') {
224                                         $damage /= 4;
225                                 }
226                         }
227                         $damage *= ($attack->{count} // 1) / $attack->{cooldown};
228                         if (my $bonus = $upattack->{bonus} // $attack->{bonus}) {
229                                 $maxdamage += $_ for max(
230                                         map { $bonus->{$_} + $bonus->{"-$_"} * 3 }
231                                         grep { !/^-/ } keys %{$bonus}
232                                 );
233                         }
234                         $maxdamage *= ($upattack->{count} // $attack->{count} // 1)
235                                     / ($upattack->{cooldown} // $attack->{cooldown});
236                         $out .= showrangeint($damage, $maxdamage);
237                 }
238
239                 $out .= '<td class="unit hurt-g">' . '▽' x !!($attack->{anti} & 1);
240                 $out .= '<td class="unit hurt-a">' . '△' x !!($attack->{anti} & 2);
241
242                 $out .= '<td class="val unit-range">' .
243                         showrangeint($attack->{range}, $upattack->{range});
244
245                 return $out;
246         }
247
248         sub showmagic {
249                 my ($row) = @_;
250                 my $specials = $row->{special} or return '';
251                 return join ' ', map {
252                         sprintf '<span%s title="%s">%s</span>',
253                                 $_->{duration} < 0 && ' class="magic-perma"',
254                                 join('',
255                                         $_->{name},
256                                         $_->{desc} ? ": $_->{desc}" : '',
257                                         (map { $_ && " ($_)" } join ', ',
258                                                 #TODO: apply upgrades
259                                                 $_->{range} ? "range $_->{range}" : (),
260                                                 $_->{cost} ? showcost($_, $row) :
261                                                 $_->{cooldown} ? "cooldown $_->{cooldown}s" : (),
262                                         ),
263                                 ),
264                                 sprintf($_->{build} ? '(%s)' : '%s', $_->{abbr}),
265                 } grep { defined $_->{abbr} } @{$specials};
266         }
267
268         sub showunitcols {
269                 my ($row) = @_;
270                 local $_ = $row;
271                 $_->{hp} += $_->{shield} if $_->{shield};
272
273                 return (
274                         '<td class="val unit-min">' . ($_->{min} // ''),
275                         '<td class="val unit-gas">' . ($_->{gas} || ''),
276                         defined $_->{transform} ? sprintf('<td class="val time">%.0f',
277                                 $_->{transform},
278                         ) :
279                         !defined $_->{build} ? '<td>' : sprintf('<td class="val time"%s>%s%.0f',
280                                 defined $_->{warp} && qq(title="$_->{build} without warpgate"),
281                                 !!$_->{base} && sprintf(
282                                         '<span class="unit-composed" title="%s">+</span>',
283                                         'from '.join('+', @{ $_->{base} }),
284                                 ),
285                                 $_->{warp} // $_->{build} || '0',
286                         ),
287                         sprintf('<td class="unit unit-%s" title="%4$s%3$s">%s',
288                                 $_->            {cargo} < 0 ? ('supply',           T => 'transport') :
289                                 $_->{upgraded}->{cargo} < 0 ? ('supply magic-opt', T => 'optional transport') :
290                                 $_->            {attr}->{flying} ? ('air',           F => 'flying') :
291                                 $_->{upgraded}->{attr}->{flying} ? ('air magic-opt', F => 'potentially flying') :
292                                 $_->{attr}->{structure} ? ('x',   B => 'building') :
293                                 (
294                                         [qw( x s m l l h h h h )]->[ $_->{cargo} ],
295                                         $_->{cargo} || '-',
296                                         $_->{cargo} ? 'transportable' : 'untransportable',
297                                 ),
298                                 defined $_->{size} && sprintf('⌀%.1f ', $_->{size}),
299                         ),
300                         sprintf('<td class="val unit unit-pop%s">%s',
301                                 defined $_->{pop} && $_->{pop} < 0 && ' unit-supply',
302                                 defined $_->{pop} && $_->{pop} == .5 ? '½' : $_->{pop},
303                         ),
304                         '<td class="unit unit-type">' . join('', grep { $_ }
305                                 (defined $_->{organic} ? !$_->{organic} : $_->{attr}->{mech})
306                                         && '<span class="unit-u" title="mechanic">m</span>',
307                                 ($_->{organic} || $_->{attr}->{organic})
308                                         && '<span class="unit-o" title="organic">o</span>',
309                                 $_->{attr}->{psionic}
310                                         && '<span class="unit-p" title="psionic">ψ</span>',
311                         ),
312                         '<td class="unit unit-attr">' . join('', grep { $_ }
313                                 $_->{attr}->{armored}
314                                         && '<span class="unit unit-l" title="armored">A</span>',
315                                 $_->{attr}->{light}
316                                         && '<span class="unit unit-s" title="light">L</span>',
317                                 $_->{suit} && sprintf(
318                                         '<span class="unit unit-%s" title="%3$s">%s</span>',
319                                         map { @{$_} } [
320                                                 [qw( x ? unknown )],
321                                                 [qw( s S small )],
322                                                 [qw( m M medium )],
323                                                 [qw( l L large )],
324                                         ]->[ $_->{suit} ],
325                                 ),
326                                 $_->{attr}->{massive}
327                                         && '<span class="unit-massive" title="massive">⚓</span>',
328                         ),
329                         $_->{hp} < 0 ? '<td class="val unit-hp" title="invulnerable">∞' :
330                         '<td class="val unit-hp">' . showrangeint($_->{hp}, $_->{upgraded}->{hp}),
331                         $_->{shield} ? sprintf('<td class="val unit-shield">%.0f%%<td',
332                                 100 * $_->{shield} / $_->{hp}
333                         ) : '<td colspan=2',
334                         ' class="val unit-armor">' .
335                                 showrangeint($_->{armor}, $_->{upgraded}->{armor}),
336                         showattack($_, 0),
337                         '<td class="val unit-sight">' . sprintf(
338                                 $_->{detect} ? '<strong class="unit-detect">%s</strong>' : '%s',
339                                 showrangeint($_->{sight}, $_->{upgraded}->{sight})
340                         ),
341                         sprintf('<td class="val unit-speed"%2$s>%s',
342                                 showrange(
343                                         map { $_ && sprintf '%.1f', $_ }
344                                         $_->{speed}, $_->{upgraded}->{speed}
345                                 ),
346                                 defined $_->{creep} && sprintf(' title="%s on creep"',
347                                         $_->{creep} == 1 ? 'same' : showrange(
348                                                 map { $_ && sprintf '%.1f', $_ }
349                                                 $_->{speed} * $_->{creep},
350                                                 $_->{upgraded}->{speed} && $_->{upgraded}->{speed} *
351                                                         ($_->{upgraded}->{creep} // $_->{creep}),
352                                         ),
353                                 ),
354                         ),
355                         $_->{attr}->{jump}
356                                 && qq'<span class="unit unit-jump" title="$_->{attr}->{jump}">↕</span>',
357                         '<td class="unit-magic">' . showmagic($_),
358                         !$_->{attack}->[1] ? () : (
359                                 '<tr><th class="cat" colspan="2"><td colspan=10>', showattack($_, 1), '<td colspan=3>'
360                         ),
361                         !$_->{attack}->[2] ? () : (
362                                 '<tr><th class="cat" colspan="2"><td colspan=10>', showattack($_, 2), '<td colspan=3>'
363                         ),
364                         "\n"
365                 );
366         }
367
368         my @rows = @{$units};
369         my $grouped = 1;  # race headers
370         if (exists $get{order}) {
371                 $grouped = 0;
372                 $get{order} ||= '';
373                 if ($get{order} eq 'name') {
374                         @rows = sort {$a->{name} cmp $b->{name}} @rows;
375                 }
376                 elsif ($get{order} eq 'cost') {
377                         $_->{order} = (
378                                 $_->{gas}*1.5 + $_->{min} + $_->{pop}/8 + $_->{build}/256/8
379                         ) for @rows;
380                 }
381                 elsif ($get{order} eq 'build') {
382                         my %unittime = map { ($_->{name} => $_->{warp} // $_->{build}) } @rows;
383                         $unittime{Templar} = $unittime{'High Templar'};
384                         $_->{order} = (
385                                 ($_->{warp} // $_->{build})
386                                 + ($_->{gas}*1.5 + $_->{min} + $_->{pop}/8)/1024
387                                 + ($_->{base} ? ($unittime{$_->{base}->[0]} // 100) + 1 : 0)
388                         ) for @rows;
389                 }
390                 elsif ($get{order} eq 'size') {
391                         $_->{order} = (
392                                 $_->{pop}*16 + ($_->{size} // $_->{suit}) + $_->{cargo}/8
393                                 + $_->{hp}/512 + $_->{min}/8192
394                         ) for @rows;
395                 }
396                 elsif ($get{order} eq 'hp') {
397                         $_->{order} = (
398                                 $_->{hp}*1.01 + $_->{armor} + $_->{shield} + $_->{size}/1024,
399                         ) for @rows;
400                 }
401                 elsif ($get{order} eq 'attack') {
402                         $_->{order} = $_->{hp} / 1024 + $_->{shield} / 1008 + max(
403                                 map {
404                                         ($_->{dps} ? $_->{dps}->[-1] :
405                                                 ($_->{damage} + $_->{upgrade} * 3)
406                                                 * ($_->{count} // 1) / ($_->{cooldown} // 1)
407                                         )
408                                         * ($_->{splash} ? 1.01 : 1)
409                                         * ($_->{type} eq 'implosive' ? .96 : 1)
410                                         * ($_->{type} eq 'explosive' ? .98 : 1)
411                                 } @{ $_->{attack} }
412                         ) for @rows;
413                 }
414                 elsif ($get{order} eq 'speed') {
415                         $_->{order} = (
416                                 ($_->{upgraded}->{speed} // $_->{speed}*1.01)
417                                 + $_->{sight}/1024 + $_->{detect}/2048
418                         ) for @rows;
419                 }
420                 @rows = sort {$a->{order} <=> $b->{order}} @rows if exists $rows[0]->{order};
421         }
422
423         my ($race, $cat) = ('', '');
424         for (@rows) {
425                 if ($grouped) {
426                         say sprintf '<tbody id="%s"><tr class="race"><th colspan="20"><h2>%s</h2>',
427                                 $race = $_->{race}, ucfirst $race
428                                         unless $race eq $_->{race};
429                 }
430                 else {
431                         $_->{cat} = $_->{race};
432                 }
433
434                 print(
435                         '<tr>',
436                         '<th class="cat">', $cat ne $_->{cat} && ($cat = $_->{cat}),
437                         '<td>', $_->{name},
438                         showunitcols($_),
439                 );
440
441                 for my $subrow (@{ $_->{special} }) {
442                         $subrow->{alt} or next;
443                         print(
444                                 '<tr class="alt"><th class="cat"><td>', $subrow->{alt},
445                                 showunitcols($subrow),
446                         );
447                 }
448         }
449 :>
450 </table>
451
452 <div class="legend">
453 <h2>Legend</h2>
454
455 <dl>
456 <dt>cost
457         <dd><span class="unit-min">minerals</span> and
458                 <span class="unit-gas">gas</span> required to create one unit
459         <dd>includes total expenses if based on existing units
460 <dt>build
461         <dd>relative time needed to create at least one unit
462         <dd>excludes construction of dependencies such as buildings
463                 and <span class="unit-composed">+</span>parent units
464 <dt>size
465         <dd><span class="unit unit-supply">T</span>ransports can fit upto
466                 8 non-<span class="unit unit-air">F</span>lying cargo units
467         <dd>number of command points taken while alive
468         <dd><:
469 if ($scver{major} > 1) {
470                 :>received damage depends on
471                 <span class="unit unit-o">o</span>rganic,
472                 <span class="unit unit-u">m</span>echanic,
473                 <span class="unit unit-p">ψ</span>(ps)ionic,
474                 <span class="unit unit-s">L</span>ight, and
475                 <span class="unit unit-l">A</span>rmored
476                 attributes
477         <dd>massive <span class="unit-massive">⚓</span> units
478                 cannot be lifted or slowed and can break force fields<:
479 } else {
480                 :>abilities may hit only <span class="unit unit-o">o</span>rganic
481                 or <span class="unit unit-u">m</span>echanic targets
482         <dd>affected by <span class="unit unit-s">S</span>mall,
483                 <span class="unit unit-m">M</span>edium, or
484                 <span class="unit unit-l">L</span>arge damage<:
485 } :>
486 <dt>HP
487         <dd>total number of hitpoints (including shields)
488         <dd>everything zerg (except for eggs) regenerates one point every
489                 <:= $scver{major} == 1 ? '4½' : '3.7' :> seconds
490 <dt>shield
491         <dd>percentage of HP in shields
492         <dd><:
493 if ($scver{major} > 1) {
494                 :>shields always take full damage, irrelevant of unit size
495         <dd><:
496 }
497                 :>does not take armor bonuses,
498                 but upgrades can decrease damage to any shield hit by upto 3
499         <dd><:
500 if ($scver{major} > 1) {
501                 :>after 10 seconds out of combat, 2 points are recharged per game second<:
502 } else {
503                 :>recharges one point every 2½ seconds<:
504 } :>
505 <dt>armor
506         <dd>base unit armor
507         <dd>can be increased by upto 3 at various facilities
508         <dd>each point decreases damage per hit by one, upto a minimum of ½
509         <dd>reduction applies to initial damage, before size penalties
510                 <small>(so a plasma hit of 12 to 4 armor large deals 2 damage, not ½)</small>
511 <dt>attack
512         <dd>damage per single hit
513         <dd>some weapons fire multiple × times, multiplying armor penalties
514         <dd>splash damage hits all objects nearby <span class="unit-splash">⁜</span>
515                 or in a straight line <span class="unit-splash">+</span>.
516         <dd><:
517 if ($scver{major} > 1) {
518                 :>does not include <span>&ge;</span>bonus damage
519                 dealt to susceptible unit types
520         <dd><span class="unit-pdd">•</span>projectile shots are negated by
521                 Point Defense Drones<:
522 } else {
523                 :><span class="unit-l">*</span>explosive damage does only
524                 50% damage to <span class="unit unit-s">S</span>mall units,
525                 75% to <span class="unit unit-m">M</span>edium,
526                 100% to <span class="unit unit-l">L</span>arge
527         <dd><span class="unit-s">~</span>concussive/plasma damage does
528                 25% to <span class="unit unit-l">L</span>arge,
529                 50% <span class="unit unit-m">M</span>edium,
530                 100% to <span class="unit unit-s">S</span>mall units<:
531 } :>
532         <dd><span class="hurtrel">dps</span> indicates relative total amount of damage
533                 done in 1 second of <:= $scver{major} > 1 ? '<em>Normal</em> in-game time' :
534                 'time on <em>Fast</em> game speed' :>
535         <dd>targets <span class="hurt-g">▽</span>&nbsp;ground
536                 and/or  <span class="hurt-a">△</span>&nbsp;air
537 <dt>range
538         <dd>maximum hex distance a weapon can fire (note Sieged Tank also has a minimum)
539 <dt>sight
540         <dd>range in which the unit detects other units
541         <dd><strong class="unit-detect">emphasis</strong> indicates ability to detect cloaked units
542 <dt>speed
543         <dd>top movement speed in hex per second
544         <dd>acceleration and deceleration ignored
545 <dt>specials
546         <dd>parentheses () indicate that it needs to be researched first
547         <dd><span class="magic-perma">passive</span> abilities are always enabled
548         <dd>hover for description
549         <dd>range is maximum distance allowed to activate
550         <dd>cost describes energy loss percentage on spawn and when fully charged
551 </dl>
552
553 <p>
554 When two values are given (1-2), the second value indicates the attribute
555 after all possible upgrades.
556 </p>
557
558 </div>
559