browser: replace remaining smart-match operator
[sheet.git] / sc-units-lotv.inc.pl
1 use utf8;
2 use strict;
3
4 my $V = v5.0.13;
5 my $RT = 1.4;  # real-time speed factor to faster
6
7 my $hots = do 'sc-units-hots.inc.pl' or die $!;
8 my %unit;
9 for my $row (@{$hots}) {
10         ref $row eq 'HASH' or next;
11         for ($row, @{ $row->{special} }, @{ $row->{upgrade} }) {
12                 $_ *= $RT for $_->{speed} // ();
13                 $_ /= $RT for $_->{build} // (), $_->{transform} // (), $_->{warp} // (), $_->{cooldown} // ();
14                 $_->{cooldown} and $_->{cooldown} /= $RT for @{ $_->{attack} // [] };
15         }
16         $unit{ lc $row->{name} =~ tr/ /_/r } = $row;
17 }
18
19 [
20 sprintf('patch %vd', $V),
21
22 # protoss
23
24 $unit{probe},
25
26 $unit{photon_cannon},
27
28 {
29         %{ $unit{mothership} },
30         pop => $V ge v5.0.12 ? 6 : 8,
31         min => $V ge v5.0.12 ? 300 : 400,
32         gas => $V ge v5.0.12 ? 300 : 400,
33         build => $V ge v5.0.12 ? 79 : 114,
34         size => $V ge v5.0.12 ? 2.475 : 2.75,
35         hp => $V ge v5.0.12 ? 250 : 350,
36         shield => $V ge v5.0.12 ? 250 : 350,
37         speed => $V ge v5.0.12 ? 2.83 : 2.62, # rotation speed also increased
38         energy => $V ge v5.0.12 ? 0 : 50,
39         special => [
40                 {
41                         %{ $unit{mothership}->{special}->[0] }, # cf
42                         $V lt v5.0.12 ? () : (
43                                 cooldown => 50,
44                                 duration => 20,
45                                 desc => $unit{mothership}->{special}->[0]->{desc} . ' for 20s',
46                         ),
47                 },
48                 {
49                         %{ $unit{mothership}->{special}->[1] }, # mr
50                         cost => $V ge v5.0.12 ? 0 : 100,
51                         cooldown => $V ge v5.0.12 ? 89 : 0,
52                         radius => $V ge v5.0.12 ? 5 : 6.5,
53                 },
54                 {
55                         %{ $unit{mothership}->{special}->[2] }, # tw
56                         desc => $V lt v4.11.0 ? 'create a temporal field which slows ground units by 50%' :
57                                 $V lt v5.0.12 ? 'create a temporal field which slows ground and air units by 50%' :
58                                                 'create a temporal field which slows ground and air units by 40%',
59                         cost => $V ge v5.0.12 ? 0 : 100,
60                         cooldown => $V ge v5.0.12 ? 60 : 0,
61                         radius => $V ge v5.0.12 ? 3.75 : 4,
62                         delay => $V ge v5.0.12 ? .71 : 1.79,
63                 },
64         ],
65 },
66
67 {
68         %{ $unit{nexus} },
69         attack => [],
70         energy => 50,
71         capacity => 200,
72         special => [
73                 $unit{nexus}->{special}->[0], # chrono boost
74                 {
75                         name => $V lt v4.7.1 ? 'Mass Recall' : 'Strategic Recall',
76                         abbr => 'sr',
77                         desc => 'recalls units owned by the player in the target area to the Nexus',
78                         cost => 50,
79                         cooldown => $V lt v4.7.1 || $V ge v4.10.1 ? 130 : 85,
80                         radius => $V lt v4.7.1 ? 6.5 : 2.5,
81                         duration => 3.6, # +.7 warp in
82                 },
83                 $V lt v4.12.0 ? () : {
84                         name => 'Battery Overcharge',
85                         abbr => 'bo',
86                         desc => sprintf(
87                                 'increase target Shield Battery restoration rate by %d%% and function without consuming energy for 14s',
88                                 $V ge v5.0.11 ? 50 : 100,
89                         ),
90                         cost => 50,
91                         duration => 14,
92                         cooldown => 60, # shared by all nexuses
93                         range => 8, # within any friendly nexus
94                 },
95         ],
96 },
97
98 {
99         %{ $unit{zealot} },
100         special => [
101                 {
102                         name => 'Charge',
103                         abbr => 'ch',
104                         desc => 'on attack, increases movement speed to 8.47 for 2.5s and deals 8 damage on hit',
105                         min => 100, # changed in 3.14.0
106                         gas => 100,
107                         build => 100,
108                         speed => .5,
109                         range => 4,
110                         duration => 2.5,
111                         cooldown => 7,
112                 },
113         ],
114         upgrade => [
115                 {
116                         name => 'Charge',
117                         speed => $V lt v4.11.0 ? .98 : 1.57,
118                 },
119         ],
120 },
121
122 {
123         %{ $unit{sentry} },
124         build => $V ge v5.0.11 ? 22.9 : 26.4,
125         speed => $V ge v5.0.11 ? 3.5 : 3.15,
126         attr => {
127                 %{ $unit{sentry}->{attr} },
128                 light => $V ge v5.0.13 ? 0 : 1,
129         },
130         attack => [
131                 {
132                         %{ $unit{sentry}->{attack}->[0] }, # beam
133                         bonus => {
134                                 $V ge v5.0.13 ? (shields => 4) : (),
135                         },
136                 },
137         ],
138         special => [
139                 $unit{sentry}->{special}->[0], # ff
140                 {
141                         %{ $unit{sentry}->{special}->[1] }, # gs
142                         radius => $V lt v4.7.1 ? 4 : 4.5,
143                         duration => $V ge v5.0.12 ? 12.86 : 10.71,
144                 },
145                 {
146                         %{ $unit{sentry}->{special}->[2] }, # hl
147                         cost => $V lt v4.7.1 ? 100 : 75,
148                 },
149         ],
150 },
151
152 {
153         %{ $unit{stalker} },
154         attack => [
155                 {
156                         %{ $unit{stalker}->{attack}->[0] }, # particle disruptors
157                         damage => 13,
158                         bonus => {
159                                 armored => 5,
160                                 -armored => 1,
161                         },
162                         cooldown => 1.34,
163                 },
164         ],
165 },
166
167 {
168         race => 'protoss',
169         cat => 'gateway',
170         name => 'Adept',
171         pop => 2,
172         min => 100,
173         gas => 25,
174         build => $V lt v4.8.2 ? 27 : 30,
175         warp => 20,
176         size => 1,
177         cargo => 2,
178         armor => 1,
179         hp => 70,
180         shield => 70,
181         attr => {
182                 light => 1,
183                 organic => 1,
184         },
185         attack => [
186                 {
187                         anti => 1,
188                         name => undef, #TODO
189                         damage => 10,
190                         upgrade => 1,
191                         bonus => {
192                                 light => 12,
193                                 -light => 1,
194                         },
195                         type => 'projectile', #XXX: assumption
196                         cooldown => 1.61,
197                         range => 4,
198                 },
199         ],
200         speed => 3.5,
201         sight => 9,
202         special => [
203                 {
204                         name => 'Psionic Transfer',
205                         abbr => 'pt',
206                         desc => 'project shade, teleport after 7s',
207                         cooldown => 11,
208
209                         alt => 'Shade',
210                         build => 0,
211                         size => 0,
212                         cargo => 0,
213                         hp => -1,
214                         attack => [], #TODO: indicate diff from parent
215                         speed => 5, #XXX: faster than 3.5
216                         range => 7, #XXX: calculate from speed
217                         sight => 4,
218                 },
219         ],
220         upgrade => [
221                 {
222                         name => 'Resonating Glaives',
223                         min => 100,
224                         gas => 100,
225                         build => 100,
226                         attack => [
227                                 {
228                                         cooldown => $V lt v4.11.0 || $V ge v4.11.3 ? -.5 : -.6, # +45%/60%
229                                 },
230                         ],
231                 },
232         ],
233 },
234
235 {
236         %{ $unit{high_templar} },
237         speed => $V ge v5.0.11 ? 2.82 : 2.63,
238         attack => [
239                 {
240                         anti => 1,
241                         name => '?', #XXX
242                         damage => 4,
243                         upgrade => 1,
244                         cooldown => 1.25,
245                         range => 6,
246                 },
247         ],
248         special => [
249                 {
250                         $unit{high_templar}->{special}->[0], # fb
251                         range => $V lt v4.12.0 ? 9 : 10,
252                 },
253                 $unit{high_templar}->{special}->[1], # ps
254         ],
255 },
256
257 {
258         %{ $unit{dark_templar} },
259         special => [
260                 $unit{dark_templar}->{special}->[0], # cl
261                 {
262                         name => 'Shadow Stride',
263                         abbr => 'bl',
264                         desc => sprintf('teleport to visible location, %.2fs attack delay afterwards', $V ge v5.0.11 ? .71 : .75),
265                         min => 100,
266                         gas => 100,
267                         build => $V lt v4.7.1 ? 121 : 100,
268                         range => 8,
269                         cooldown => $V lt v4.7.1 ? 21 : 14,
270                 },
271         ],
272 },
273
274 $unit{archon},
275
276 {
277         %{ $unit{observer} },
278         build => $V ge v5.0.13 ? 17.9 : 21.4,
279         shield => $V ge v5.0.13 ? 30 : 20,
280         speed => $V ge v5.0.11 ? 2.82 : $V lt v4.8.2 || $V ge v4.11.0 ? 2.63 : 3.01,
281         size => $V ge v5.0.13 ? 1 : $V ge v5.0.11 ? 1.1 : 1,
282         special => [
283                 $unit{observer}->{special}->[0], # cloak
284                 {
285                         name => 'Surveillance Mode',
286                         abbr => 'sm',
287                         desc => 'gain 25% vision while immobilized',
288                         speed => 0,
289                         sight => 2.75, # +25%
290                         transform => .54,
291                 },
292         ],
293 },
294
295 {
296         %{ $unit{warp_prism} },
297         hp => 80,
298         min => $V lt v4.10.1 ? 200 : 250,
299         range => $V lt v4.10.1 ? 6 : 5, # pickup
300         upgrade => [
301                 {
302                         %{ $unit{warp_prism}->{special}->[0] }, # gravitic drive
303                         speed => 1.23,
304                 },
305         ],
306 },
307
308 {
309         %{ $unit{immortal} },
310         min => $V ge v4.8.2 ? 275 : 250,
311         special => [
312                 {
313                         name => 'Barrier',
314                         abbr => 'br',
315                         desc => 'block initial damage, then absorb up to 100 damage for 2s',
316                         duration => 2,
317                         cooldown => $V ge v3.8.0 ? 32 : 43,
318                 },
319         ],
320 },
321
322 {
323         %{ $unit{colossus} },
324         attack => [
325                 {
326                         %{ $unit{colossus}->{attack}->[0] }, # thermal lances
327                         damage => 10,
328                         upgrade => 1,
329                         bonus => {
330                                 light => 5,
331                                 -light => 1,
332                         },
333 #                       cooldown => 1.18, #XXX
334                 },
335         ],
336 },
337
338 {
339         race => 'protoss',
340         cat => 'robotic',
341         name => 'Disruptor',
342         pop => $V ge v5.0.12 ? 4 : 3,
343         min => 150,
344         gas => 150,
345         build => 36,
346         size => $V ge v5.0.12 ? 1.25 : 1, # much larger model
347         cargo => 4,
348         armor => 1,
349         hp => 100,
350         shield => 100,
351         attr => {
352                 armored => 1,
353                 mech => 1,
354         },
355         attack => [
356                 {
357                         anti => 1,
358                         name => 'Purification Nova',
359                         damage => 145,
360                         bonus => {
361                                 shields => 55,
362                         },
363                         type => 'trans', #TODO: indicate
364                         splash => $V ge v5.0.11 ? 1.375 : 1.5,
365                         cooldown => 14.3,
366                         range => 13, # 2s
367                 },
368         ],
369         speed => 3.15,
370         sight => 9,
371 },
372
373 $unit{phoenix},
374
375 {
376         %{ $unit{void_ray} },
377         min => $V lt v5.0.9 && $V ge v5.0.2 ? 200 : 250,
378         speed => $V lt v5.0.2 ? 3.5 : 3.85,
379         build => $V lt v5.0.9 && $V ge v5.0.2 ? 37 : 43,
380         upgrade => [
381                 {
382                         name => 'Flux Vanes',
383                         min => 100,
384                         gas => 100,
385                         build => 57,
386                         speed => $V lt v5.0.2 ? 1.15 : .798,
387                 },
388         ],
389 },
390
391 {
392         %{ $unit{oracle} },
393         build => 37,
394         attr => {
395                 $V lt v4.8.2 ? 'light' : 'armored' => 1,
396                 mech => 1,
397                 psionic => 1,
398                 flying => 1,
399         },
400         attack => [
401                 {
402                         %{ $unit{oracle}->{attack}->[0] }, # pulsar beam
403                         bonus => {
404                                 light => 7,
405                         },
406                 },
407         ],
408         special => [
409                 {
410                         name => 'Revelation',
411                         abbr => 'rv',
412                         desc => 'hit enemy units and buildings are revealed for Â½ minute',
413                         cost => $V lt v4.12.0 ? 50 : 25,
414                         range => 9,
415                         cooldown => $V lt v4.12.0 ? 2 : 10,
416                         duration => $V lt v4.12.0 ? 30 : $V lt v5.0.2 ? 15 : 20,
417                         radius => 6,
418                         detect => 1,
419                 },
420                 {
421                         name => 'Stasis Ward',
422                         abbr => 'sw',
423                         desc => 'places ward for 170s',
424                         cost => 50,
425                         range => 6,
426                         build => 3.58,
427                         duration => 170,
428                         alt => 'Stasis Ward',
429                         hp => 30,
430                         shield => 30,
431                         armor => 0,
432                         attr => {
433                                 light => 1,
434                                 structure => 1,
435                         },
436                         sight => $V ge v5.0.12 ? 7 : 4,
437                         speed => 0,
438                         special => [
439                                 {
440                                         name => 'Permanent Cloak',
441                                         abbr => 'cl',
442                                         desc => 'cloaked at all times',
443                                         duration => -1,
444                                 },
445                                 {
446                                         name => 'Stasis Trap',
447                                         abbr => 'st',
448                                         desc => 'triggered by nearby ground units, trapping them for 21½s',
449                                 },
450                         ],
451                 },
452         ],
453 },
454
455 {
456         %{ $unit{tempest} },
457         hp => $V lt v4.7.1 ? 300 : $V lt v4.11.0 ? 150 : 200,
458         shield => $V lt v4.7.1 ? 150 : $V lt v4.11.0 ? 125 : 100,
459         min => $V lt v4.7.1 ? 300 : 250,
460         gas => $V lt v4.7.1 ? 200 : 175,
461         pop => $V lt v4.7.1 ? 6 : 5,
462         speed => $V lt v4.7.1 ? 2.63 : $V lt v4.8.2 ? 3.5 : 3.15,
463         # acceleration increased in v5.0.12
464         size => $V ge v5.0.12 ? 2.25 : 2.5,
465         attack => [
466                 {
467                         %{ $unit{tempest}->{attack}->[0] }, # kinetic overload
468                         bonus => {
469                                 massive => 22,
470                                 -massive => 2,
471                         },
472                         range => $V lt v4.11.0 ? 15 : 14,
473                 },
474                 {
475                         %{ $unit{tempest}->{attack}->[1] }, # resonance coil
476                         bonus => {
477                                 structure => 0,
478                         },
479                         damage => 40,
480                         upgrade => 4,
481                 },
482         ],
483         upgrade => [
484                 $V lt v5.0.2 ? () : {
485                         name => 'Tectonic Destabilizers',
486                         attack => [
487                                 {},
488                                 {
489                                         bonus => {
490                                                 structure => 40,
491                                         },
492                                 },
493                         ],
494                         min => 150,
495                         gas => 150,
496                         build => 100,
497                 },
498         ],
499 },
500
501 {
502         %{ $unit{carrier} },
503         hp => $V lt v4.7.1 ? 250 : 300,
504         build => $V lt v4.7.1 ? 86 : 64,
505         special => [
506                 {
507                         %{ $unit{carrier}->{special}->[0] }, # interceptor
508                         min => 5,
509                         build => $V lt v4.7.1 ? 6 : $V lt v4.10.1 ? 11 : 9,
510                 },
511         ],
512         $V lt v4.7.1 ? () : (upgrade => []), # remove Graviton Catapult
513 },
514
515 # terran
516
517 $unit{scv},
518 $unit{mule},
519 $unit{missile_turret},
520 $unit{planetary_fortress},
521
522 $unit{marine},
523
524 {
525         %{ $unit{marauder} },
526         attack => [
527                 {
528                         %{ $unit{marauder}->{attack}->[0] }, # punisher grenades
529                         count => $V lt v4.3.0 ? 2 : 1,
530                         damage => $V lt v4.3.0 ? 5 : 10,
531                         upgrade => 1,
532                         bonus => {
533                                 armored => $V lt v4.3.0 ? 5 : 10,
534                                 -armored => $V lt v4.3.0 ? 0 : 1,
535                         },
536                 },
537         ],
538 },
539
540 {
541         %{ $unit{reaper} },
542         build => 32,
543 },
544
545 {
546         %{ $unit{ghost} },
547         min => 150,
548         gas => 125,
549         speed => 3.94,
550         special => [
551                 {
552                         # replaces Sniper Round
553                         name => 'Steady Targeting',
554                         abbr => 'st',
555                         desc => ($V ge v5.0.12 ? '130 damage (+40 psionic)' : '170 damage') .
556                                 ' ignoring armor to a biological unit after 1.43s without damage',
557                         cost => 50,
558                         range => 10, # kept until 14
559                         duration => 1.43,
560                 },
561                 {
562                         %{ $unit{ghost}->{special}->[1] }, # emp round
563                         radius => $V ge v5.0.12 || $V lt v4.10.1 ? 1.5 : $V lt v5.0.11 ? 2 : 1.75,
564                 },
565                 $unit{ghost}->{special}->[2], # cloak
566                 $unit{ghost}->{special}->[3], # tac nuke strike
567         ],
568         upgrade => [
569                 $V ge v5.0.11 || $V lt v4.10.1 ? () : {
570                         name => 'Enhanced Shockwaves',
571                         min => 150,
572                         gas => 150,
573                         build => 79,
574                         special => [
575                                 {},
576                                 { radius => .5 }, # emp
577                                 {},
578                                 {},
579                         ],
580                 },
581         ],
582 },
583
584 {
585         %{ $unit{hellion} },
586         attack => [
587                 {
588                         %{ $unit{hellion}->{attack}->[0] }, # infernal flamethrower
589                         bonus => {
590                                 light => 5,
591                                 -light => 0,
592                         },
593                 },
594         ],
595         #TODO smart servos
596 },
597
598 {
599         %{ $unit{hellbat} },
600         special => [
601                 $unit{hellbat}->{special}->[0], # Hellion Mode
602                 {
603                         name => 'Smart Servos',
604                         min => 100,
605                         gas => 100,
606                         build => 79,
607                         transform => -1.43, # halve #TODO: alter special duration?
608                 },
609         ],
610         upgrade => [
611                 {
612                         %{ $unit{hellbat}->{upgrade}->[0] }, # Pre-Igniter
613                         attack => [
614                                 {
615                                         bonus => {
616                                                 light => 12,
617                                                 -light => $V ge v5.0.12 ? 0 : 1,
618                                         },
619                                 },
620                         ],
621                 },
622         ],
623 },
624
625 {
626         %{ $unit{widow_mine} },
627         build => 21,
628         attack => [
629                 {
630                         %{ $unit{widow_mine}->{attack}->[0] }, # Sentinel Missiles
631                         splash => $V ge v5.0.13 ? 1.5 : 1.75, # radius
632                         bonus => {
633                                 shields => 25,
634                         },
635                         transform => $V lt v5.0.9 ? .71 : 1.07,
636                 },
637         ],
638         upgrade => [
639                 {
640                         %{ $unit{widow_mine}->{upgrade}->[0] }, # drilling claws
641                         desc => 'halves burrow/unburrow time from upto 2½/1 to 1½/½ seconds' .
642                                 ($V ge v5.0.13 && ', and cloaks while reloading'),
643                 },
644         ],
645 },
646
647 {
648         %{ $unit{siege_tank} },
649         hp => 175,
650         special => [
651                 {
652                         %{ $unit{siege_tank}->{special}->[0] }, # siege mode
653                         attack => [
654                                 {
655                                         %{ $unit{siege_tank}->{special}->[0]->{attack}->[0] }, # shock cannon
656                                         damage => 40,
657                                         upgrade => 4,
658                                         bonus => {
659                                                 armored => 30,
660                                                 -armored => 1,
661                                         },
662                                         cooldown => 2.14,
663                                 },
664                         ],
665                 },
666         ],
667 },
668
669 {
670         race => 'terran',
671         cat => 'factory',
672         name => 'Cyclone',
673         pop => 3,
674         min => $V ge v5.0.12 ? 125 : 150,
675         gas => $V ge v5.0.12 ? 50 : 100,
676         build => 32,
677         size => 1.5,
678         cargo => $V ge v5.0.12 ? 2 : 3,
679         armor => $V ge v5.0.12 ? 0 : 1,
680         hp => $V ge v5.0.13 ? 130 : $V ge v5.0.12 ? 110 : $V ge v4.7.1 ? 120 : 180,
681         attr => {
682                 armored => 1,
683                 mech => 1,
684         },
685         attack => [
686                 {
687                         anti => 1,
688                         name => $V lt v4.7.1 ? 'Tornado Blaster' : 'Typhoon Missile Pod',
689                         damage => $V ge v5.0.12 ? 11 : $V ge v4.7.1 ? 18 : 3,
690                         upgrade => $V lt v4.7.1 ? 1 : 2,
691                         bonus => $V ge v4.7.1 ? {} : {
692                                 armored => $V ge v5.0.12 ? 0 : 2,
693                                 -armored => 0,
694                                 mech => $V ge v5.0.12 ? 3 : 0,
695                         },
696                         cooldown => $V ge v5.0.13 ? .58 : $V ge v5.0.12 ? .481 : $V ge v4.7.1 ? .71 : .1,
697                         range => $V ge v5.0.12 || $V lt v4.7.1 ? 6 : 5,
698                 },
699         ],
700         speed => $V ge v5.0.12 ? 3.94 : $V ge v4.7.1 ? 4.73 : 4.13,
701         sight => 11,
702         special => [
703                 {
704                         name => 'Lock On',
705                         abbr => 'lo',
706                         desc => (
707                                 $V ge v5.0.12 ? 'attack single target while within 9 range' :
708                                 $V ge v5.0.11 ? 'deal 400 damage (600 after upgrade) over 14 seconds' :
709                                 $V ge v4.7.1 ? 'deal 400 damage (double to armored after upgrade) over 14 seconds' :
710                                 'target air for 160 damage ignoring armor while visible and within 15 range'
711                         ),
712                         range => $V lt v5.0.12 ? 7 : 6,
713                         duration => $V lt v5.0.12 ? 14.3 : 0,
714                         cooldown => $V ge v5.0.13 ? 2.86 : $V ge v5.0.12 ? 0 : 4,
715                 },
716                 $V ge v4.7.1 ? () : {
717                         name => 'Rapid Fire Launchers',
718                         abbr => 'rf',
719                         desc => 'rapid first 12 Lock On shots',
720                         min => 75,
721                         gas => 75,
722                         build => 79,
723                 },
724         ],
725         upgrade => [
726                 $V ge v5.0.12 || $V lt v4.7.1 ? () : {
727                         name => 'Mag-Field Accelerator',
728                         min => 100,
729                         gas => 100,
730                         build => $V lt v4.8.2 ? 79 : 100,
731                         desc => 'increases lock-on damage by '.($V ge v5.0.11 ? '50%' : '100% vs armored'),
732                 },
733                 $V lt v5.0.12 ? () : {
734                         name => 'Hurricane Engines',
735                         speed => .79,
736                         min => 100,
737                         gas => 100,
738                         build => 100,
739                 },
740         ],
741 },
742
743 {
744         %{ $unit{thor} },
745         armor => $V ge v3.14.0 && $V lt v4.7.1 ? 2 : 1,
746         attack => [
747                 $unit{thor}->{attack}->[0], # thor's hammer
748                 $unit{thor}->{attack}->[1], # javelin missiles
749                 {
750                         %{ $unit{thor}->{attack}->[2] }, # punisher cannons
751                         name => 'High Impact Payload',
752                         damage => $V lt v4.7.1 ? 35 : $V lt v4.11.0 ? 40 : 25,
753                         upgrade => 3,
754                         bonus => {
755                                 $V lt v4.7.1 ? 'armored' : 'massive' => $V lt v4.11.0 ? 15 : 10,
756                                 $V lt v4.7.1 ? '-armored' : '-massive' => 2,
757                         },
758                         cooldown => $V lt v4.7.1 ? 2.14 : $V lt v4.11.0 ? 1.71 : .9,
759                         range => $V lt v4.8.2 ? 10 : 11,
760                 },
761         ],
762         #TODO smart servos
763 },
764
765 {
766         %{ $unit{viking} },
767         hp => $V lt v4.3.0 ? 125 : 135,
768 },
769
770 {
771         %{ $unit{medivac} },
772         special => [
773                 $unit{medivac}->{special}->[0], # heal
774                 {
775                         %{ $unit{medivac}->{special}->[1] }, # ignite afterburners
776                         desc => 'boost speed and accelleration to 4.25 for 8s',
777                         speed => 5.94,
778                         duration => $V lt v4.7.1 ? 6.43 : 4.29,
779                         cooldown => $V lt v4.11.0 ? 20 : 14,
780                         -cooldown => 9,
781                 },
782         ],
783         upgrade => [
784                 $V ge v5.0.12 ? {
785                         name => 'Caduceus Reactor',
786                         desc => 'double energy regeneration rate',
787                         min => 100,
788                         gas => 100,
789                         build => 53.57,
790                 } : {
791                         name => 'Rapid Reignition System',
792                         min => 100,
793                         gas => 100,
794                         build => 57,
795                         speed => .63,
796                 },
797         ],
798 },
799
800 {
801         race => 'terran',
802         cat => 'starport',
803         name => 'Liberator',
804
805         pop => 3,
806         min => 150,
807         gas => $V ge v5.0.11 ? 125 : 150,
808         build => 43,
809         size => 1.5,
810         armor => 0,
811         hp => 180,
812         attr => {
813                 armored => 1,
814                 mech => 1,
815                 flying => 1,
816         },
817         attack => [
818                 {
819                         anti => 2,
820                         name => 'Lexington Rockets',
821                         damage => 5,
822                         upgrade => 1,
823                         type => 'projectile',
824                         cooldown => 1.29,
825                         count => 2,
826                         range => 5,
827                 },
828         ],
829         special => [
830                 {
831                         name => 'Defender Mode',
832                         abbr => 'dm',
833                         transform => 2.88, # 1.46s to revert
834                         alt => 'Defender Liberator',
835                         attack => [
836                                 {
837                                         anti => 1,
838                                         name => 'Concord Cannon',
839                                         desc => 'within 5 diameter circle',
840                                         damage => 75,
841                                         upgrade => 5,
842                                         cooldown => 1.14,
843                                         range => 10,
844                                 },
845                         ],
846                         speed => 0,
847                         sight => 15, # only targeted area
848                         upgrade => [
849                                 {
850                                         name => 'Advanced Ballistics',
851                                         min => 150,
852                                         gas => 150,
853                                         build => 79,
854                                         attack => [
855                                                 {
856                                                         range => $V ge v5.0.13 ? 2 : $V ge v4.11.0 ? 3 : 4,
857                                                 },
858                                         ],
859                                         sight => 4,
860                                 },
861                         ],
862                 },
863         ],
864         speed => 4.72,
865         sight => 10,
866 },
867
868 {
869         %{ $unit{banshee} },
870         speed => 3.85,
871         upgrade => [
872                 {
873                         name => 'Hyperflight Rotors',
874                         speed => 1.4,
875                         min => $V ge v5.0.11 ? 125 : $V ge v4.7.1 ? 150 : 200,
876                         gas => $V ge v5.0.11 ? 125 : $V ge v4.7.1 ? 150 : 200,
877                         build => $V ge v5.0.11 ? 100 : 121.4,
878                 },
879         ],
880 },
881
882 {
883         %{ $unit{raven} },
884         gas => $V ge v5.0.11 ? 150 : 200,
885         build => $V ge v5.0.11 ? 34.3 : 42.9,
886         speed => $V lt v4.11.0 ? 3.85 : 4.13,
887         upgrade => $V ge v5.0.11 ? [] : $unit{raven}->{upgrade}, # corvid reactor
888         special => [
889                 {
890                         %{ $unit{raven}->{special}->[0] }, # auto-turret
891                         attack => [
892                                 {
893                                         anti => 3,
894                                         name => '12 mm Gauss Cannon',
895                                         damage => 18,
896                                         cooldown => .57,
897                                         range => 6,
898                                 },
899                         ],
900                         hp => $V ge v5.0.11 ? 100 : 150,
901                         armor => $V ge v5.0.11 ? 0 : 1,
902                         range => $V lt v4.3.0 ? 1 : 2,
903                         duration => $V ge v5.0.11 ? 7.9 : 10,
904                         upgrade => [
905                                 $unit{raven}->{special}->[0]->{upgrade}->[0], # hi-sec auto tracking
906                                 $unit{raven}->{special}->[0]->{upgrade}->[1], # structure armor
907                                 # no more durable materials
908                         ],
909                 },
910                 {
911                         name => 'Interference Matrix',
912                         abbr => 'im',
913                         desc => 'disable target mech or psionic unit rendering it unable to attack or cast',
914                         $V lt v5.0.12 ? () : (
915                                 min => 50,
916                                 gas => 50,
917                                 build => 57.14,
918                         ),
919                         cost => $V lt v4.11.0 ? 50 : 75,
920                         range => 9,
921                         duration => $V lt v4.11.0 ? 7.9 : 11,
922                 },
923                 {
924                         name => 'Anti-Armor Missile',
925                         abbr => 'aa',
926                         desc => sprintf('launches missile %s reduce armor by %d',
927                                 $V lt v4.7.1 ? 'to do splash damage and' : 'to',
928                                 $V ge v5.0.11 ? 2 : 3,
929                         ),
930                         range => 10,
931                         size => 2.88,
932                         attack => [
933                                 {
934                                         damage => $V lt v4.3.0 ? 30 : $V lt v4.7.1 ? 15 : 0,
935                                         splash => 1,
936                                 },
937                         ],
938                         cost => 75,
939                         duration => 21,
940                 },
941         ],
942 },
943
944 {
945         %{ $unit{battlecruiser} },
946         attack => [
947                 $unit{battlecruiser}->{attack}->[0], # ats laser
948                 {
949                         %{ $unit{battlecruiser}->{attack}->[1] }, # ata laser
950                         damage => $V lt v4.7.1 ? 6 : 5,
951                 },
952         ],
953         special => [
954                 {
955                         name => 'Tactical Jump',
956                         abbr => 'tj',
957                         desc => 'warps to the target location after 5s (invulnerable after 1s)',
958                         duration => 4,
959                         cooldown => 71,
960                 },
961                 {
962                         %{ $unit{battlecruiser}->{special}->[0] }, # yc
963                         desc => '240 damage to a single target',
964                         attack => [
965                                 {
966                                         damage => 240,
967                                 },
968                         ],
969                         cost => undef,
970                         cooldown => 71,
971                 },
972         ],
973         upgrade => [],
974 },
975
976 # zerg
977
978 $unit{drone},
979
980 {
981         %{ $unit{queen} },
982         attack => [
983                 $unit{queen}->{attack}->[0], # claws
984                 {
985                         %{ $unit{queen}->{attack}->[1] }, # acid spines
986                         range => $V lt v4.12.0 ? 8 : 7,
987                 },
988         ],
989         range => 8,
990 },
991
992 {
993         %{ $unit{overlord} },
994         speed => .9023, # changed in 4.0.0
995         # deceleration speed increased in v5.0.12
996         upgrade => [
997                 {
998                         %{ $unit{overlord}->{upgrade}->[0] }, # carapace
999                         speed => ($V ge v5.0.12 ? 2.83 : 2.63)-.9023,
1000                 },
1001                 # ventral sacs became an individual mutation
1002         ],
1003 },
1004
1005 {
1006         race => 'zerg',
1007         cat => 'base',
1008         req => 'lair',
1009         name => 'Transporterlord',
1010         base => ['Overlord'],
1011         pop => -9,
1012         min => 100+25,
1013         gas => 25,
1014         build => 15,
1015         size => 0,
1016         cargo => -8,
1017         armor => 0,
1018         hp => 200,
1019         attr => {
1020                 armored => 1,
1021                 organic => 1,
1022                 flying => 1,
1023         },
1024         speed => $V ge v5.0.13 ? 1.28 : $V ge v5.0.12 ? 1.099 : .9023,
1025         sight => 11,
1026         special => $unit{overlord}->{special}, # generate creep
1027         upgrade => [
1028                 {
1029                         %{ $unit{overlord}->{upgrade}->[0] }, # carapace
1030                         speed => $V ge v5.0.13 ? 3-1.28 : $V ge v5.0.12 ? 2.83-1.099 : 2.63-.9023,
1031                 },
1032         ],
1033 },
1034
1035 {
1036         %{ $unit{overseer} },
1037         special => [
1038                 {
1039                         name => 'Oversight Mode',
1040                         abbr => 'om',
1041                         desc => 'gain 25% vision while immobilized',
1042                         speed => 0,
1043                         sight => 11 * 1.25,
1044                         transform => .54,
1045                 },
1046                 @{ $unit{overseer}->{special} }, # changeling, contaminate
1047         ],
1048 },
1049
1050 $unit{larva},
1051 $unit{spine_crawler},
1052
1053 {
1054         %{ $unit{spore_crawler} },
1055         attack => [
1056                 {
1057                         %{ $unit{spore_crawler}->{attack}->[0] }, # seeker spores
1058                         bonus => {
1059                                 organic => 15,
1060                         },
1061                 },
1062         ],
1063         speed => (1.5),
1064         creep => 2.6,
1065 },
1066
1067 $unit{zergling},
1068
1069 {
1070         %{ $unit{baneling} },
1071         min => 25,
1072         attack => [
1073                 {
1074                         %{ $unit{baneling}->{attack}->[0] }, # volatile burst
1075                         damage => $V lt v4.12.0 ? 20 : $V lt v5.0.2 ? 18 : 15,
1076                         bonus => {
1077                                 light => $V lt v4.12.0 ? 15 : $V lt v5.0.2 ? 17 : 20,
1078                                 -light => $V ge v5.0.12 ? 0 : 2,
1079                                 structure => 80,
1080                                 -structure => 5,
1081                         },
1082                         splash => 1,
1083                         range => 0,
1084                 },
1085         ],
1086         upgrade => [
1087                 {
1088                         %{ $unit{baneling}->{upgrade}->[0] }, # centrifugal hooks
1089                         $V ge v5.0.12 ? (
1090                                 min => 100,
1091                                 gas => 100,
1092                                 build => 71,
1093                         ) : (
1094                                 hp => 5,
1095                         ),
1096                 },
1097         ],
1098 },
1099
1100 {
1101         %{ $unit{roach} },
1102         special => [
1103                 {
1104                         %{ $unit{roach}->{special}->[0] }, # rapid regeneration
1105                         desc => 'regenerates health at 7 HP/s while burrowed',
1106                 },
1107                 {
1108                         %{ $unit{roach}->{special}->[1] }, # tunneling claws
1109                         min => $V lt v4.7.1 ? 150 : 100,
1110                         gas => $V lt v4.7.1 ? 150 : 100,
1111                         build => 79,
1112                         desc => 'move while burrowed at speed of 2.8',
1113                 },
1114         ],
1115 },
1116
1117 {
1118         race => 'zerg',
1119         cat => 'hatchery',
1120         name => 'Ravager',
1121         base => ['Roach'],
1122         pop => 3,
1123         min => 25,
1124         gas => 75,
1125         build => $V ge v5.0.11 ? 12.14 : 8.57+.36, # added max random
1126         size => 1.5,
1127         cargo => 4,
1128         armor => 1,
1129         hp => 120,
1130         attr => {
1131                 organic => 1,
1132         },
1133         attack => [
1134                 {
1135                         anti => 1,
1136                         name => '?',
1137                         damage => 16,
1138                         upgrade => 2,
1139                         type => 'projectile',
1140                         cooldown => 1.14,
1141                         range => 6,
1142                 },
1143         ],
1144         speed => 3.85,
1145         creep => 1.3,
1146         sight => 9,
1147 },
1148
1149 {
1150         %{ $unit{hydralisk} },
1151         hp => 90,
1152         upgrade => [
1153                 {
1154                         %{ $unit{hydralisk}->{upgrade}->[0] }, # grooved spines
1155                         min => $V ge v5.0.12 ? 75 : 100,
1156                         gas => $V ge v5.0.12 ? 75 : 100,
1157                         build => $V ge v5.0.12 ? 50 : 71,
1158                         attack => [
1159                                 {
1160                                         range => 2,
1161                                 },
1162                         ],
1163                 },
1164                 {
1165                         %{ $unit{hydralisk}->{upgrade}->[1] }, # muscular augments
1166                         build => $V ge v5.0.12 ? 64 : 71,
1167                 },
1168         ],
1169 },
1170
1171 {
1172         race => 'zerg',
1173         cat => 'lair',
1174         name => 'Lurker',
1175         base => ['Hydralisk'],
1176         pop => 3,
1177         min => 50,
1178         gas => 100,
1179         build => 18,
1180         cargo => 4,
1181         armor => 1,
1182         hp => 200,
1183         attr => {
1184                 armored => 1,
1185                 organic => 1,
1186         },
1187         attack => [
1188                 {
1189                         anti => 1,
1190                         name => 'Spines',
1191                         damage => 20,
1192                         upgrade => 2,
1193                         splash => 'line',
1194                         cooldown => 1.43,
1195                         range => $V lt v4.11.0 ? 9 : 8,
1196                         bonus => {
1197                                 armored => 10,
1198                                 -armored => 1,
1199                         },
1200                 },
1201         ],
1202         transform => 2.0,
1203         upgrade => [
1204                 $V lt v4.11.0 ? () : {
1205                         name => 'Seismic Spines',
1206                         attack => [
1207                                 {
1208                                         range => 2,
1209                                 },
1210                         ],
1211                         req => 'Hive',
1212                         min => 150,
1213                         gas => 150,
1214                         build => 57,
1215                 },
1216                 {
1217                         name => 'Adaptive Talons',
1218                         desc => $V ge v5.0.12 ? 'halves burrow time from 2 seconds to 1' :
1219                                 'halves burrow time and increases movement speed',
1220                         speed => $V ge v5.0.12 ? 0 : .413,
1221                         transform => $V lt v5.0.9 ? .71 : 1.07,
1222                         min => $V ge v5.0.12 ? 100 : 150,
1223                         gas => $V ge v5.0.12 ? 100 : 150,
1224                         build => 57,
1225                 },
1226         ],
1227         speed => 4.13,
1228         creep => 1.3,
1229         sight => 10,
1230 },
1231
1232 {
1233         %{ $unit{infestor} },
1234         energy => $V ge v5.0.12 ? 75 : 50,
1235         special => [
1236                 {
1237                         %{ $unit{infestor}->{special}->[0] }, # neural parasite
1238                         range => $V lt v4.11.0 ? 9 : 8,
1239                 },
1240                 {
1241                         %{ $unit{infestor}->{special}->[1] }, # fungal growth
1242                         desc => 'for 4 seconds, immobilize enemy units in target area and deal '.($V lt v5.0.12 ? 30 : 25).' damage',
1243                         range => $V ge v5.0.13 || $V lt v5.0.12 ? 10 : 9,
1244                 },
1245                 {
1246                         name => 'Microbial Shroud',
1247                         abbr => 'ms',
1248                         desc => 'reduce damage from air by 50% to ground units in target area',
1249                         cost => $V lt v4.11.3 ? 100 : 75,
1250                         min => $V lt v4.11.3 ? 150 : undef,
1251                         gas => $V lt v4.11.3 ? 150 : undef,
1252                         build => $V lt v4.11.3 ? 79 : undef,
1253                         req => $V lt v4.11.3 ? 'Hive' : undef,
1254                         range => 9,
1255                         duration => 11,
1256                         radius => $V lt v4.11.3 ? 3 : 3.5,
1257                 },
1258                 $V ge v4.11.0 ? () : {
1259                         %{ $unit{infestor}->{special}->[2] }, # infested terran
1260                         attack => [
1261                                 {
1262                                         %{ $unit{infestor}->{special}->[2]->{attack}->[0] }, # rockets
1263                                         cooldown => $V lt v4.10.1 ? .95 : 1.14,
1264                                 },
1265                         ],
1266                 },
1267         ],
1268         upgrade => [
1269                 $V lt v5.0.12 ? $unit{infestor}->{upgrade}->[0] : (), # Pathogen Glands
1270         ],
1271 },
1272
1273 {
1274         % {$unit{nydus_worm} },
1275         min => $V lt v4.7.1 ? 100 : $V lt v4.11.0 ? 50 : 75, # Nydus Network costs 150/150
1276         gas => $V lt v4.7.1 ? 100 : $V lt v4.11.0 ? 50 : 75,
1277         cooldown => $V lt v4.11.0 ? 0 : 14, # Summon Nydus Worm
1278 },
1279
1280 {
1281         %{ $unit{swarm_host} },
1282         gas => 75,
1283         special => [
1284                 {
1285                         %{ $unit{swarm_host}->{special}->[0] }, # locust
1286                         hp => 50,
1287                         upgrade => [], # no flying
1288                 },
1289         ],
1290         upgrade => [],
1291 },
1292
1293 $unit{mutalisk},
1294 $unit{corruptor},
1295
1296 {
1297         %{ $unit{brood_lord} },
1298         speed => $V ge v5.0.12 ? 2.62 : $V ge v5.0.11 ? 2.24 : 1.97,
1299         special => [
1300                 {
1301                         %{ $unit{brood_lord}->{special}->[0] }, # broodling
1302                         attack => [
1303                                 {
1304                                         %{ $unit{brood_lord}->{special}->[0]->{attack}->[0] }, # claws
1305                                         cooldown => $V ge v5.0.12 ? .57 : .46,
1306                                 },
1307                         ],
1308                         hp => $V ge v5.0.12 ? 20 : 30,
1309                         speed => $V ge v5.0.12 ? 4.13 : 5.37,
1310                 },
1311                 $unit{brood_lord}->{special}->[1], # fz
1312         ],
1313 },
1314
1315 {
1316         %{ $unit{viper} },
1317         special => [
1318                 $unit{viper}->{special}->[0], # bc
1319                 $unit{viper}->{special}->[1], # ad
1320                 {
1321                         %{ $unit{viper}->{special}->[2] }, # consume
1322                         desc => 'leaches '.($V ge v5.0.12 ? 150 : 200).' life of friendly building over 20s to gain 50 energy',
1323                 },
1324         ],
1325 },
1326
1327 {
1328         %{ $unit{ultralisk} },
1329         min => $V ge v5.0.12 ? 275 : 300,
1330         armor => 2,
1331         size => $V ge v5.0.11 ? 1.75 : 2,
1332         upgrade => [
1333                 $unit{ultralisk}->{upgrade}->[0], # chitinous plating
1334                 {
1335                         name => 'Anabolic Synthesis',
1336                         min => 150,
1337                         gas => 150,
1338                         build => 42.85,
1339                         speed => $V lt v4.8.2 ? .41 : .82,
1340                         creep => -.215, # reverse speed increase
1341                 },
1342         ],
1343 },
1344
1345 ]