X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/8d5262c3baedda02484404f792101aa61702af93..8f02cfee34ce655998ce67264e35a091c7d5491d:/sc.plp?ds=inline
diff --git a/sc.plp b/sc.plp
index 0c584a7..2217dc6 100644
--- a/sc.plp
+++ b/sc.plp
@@ -1,135 +1,79 @@
<(common.inc.plp)><:
+use List::Util qw(max);
+
+my %scver = (
+ id => 'bw',
+ name => 'Brood War',
+ title => 'starcraft',
+ game => 'StarCraft',
+ major => 1,
+);
+
+if ($ENV{PATH_INFO} and $ENV{PATH_INFO} eq '/2') {
+ %scver = (
+ id => 'hots',
+ name => 'Heart of the Swarm',
+ title => 'starcraft2',
+ game => 'StarCraft II',
+ major => 2,
+ );
+}
+my $datafile = "sc-units-$scver{id}.inc.pl";
Html({
- title => 'starcraft unit cheat sheet',
- version => 'v1.0',
+ title => "$scver{title} unit cheat sheet",
+ version => 'v1.1',
description => [
- 'Reference of StarCraft unit properties,'
- . ' comparing various statistics of all the units in Brood War'
+ "Reference of $scver{game} unit properties,"
+ . " comparing various statistics of all the units in $scver{name}"
. ' including costs, damage, defense, speed, ranges, and abilities.',
],
- keywords => [qw'
+ keywords => [
+ qw'
starcraft game unit statistics stats comparison table sheet cheat
reference software attributes properties
- '],
+ ',
+ $scver{major} < 2 ? qw' bw broodwar brood war ' : qw' starcraft2 hots ',
+ ],
stylesheet => [qw'light'],
+ raw => '',
+ data => [$datafile],
});
-:>
-
StarCraft units
+print "
$scver{game} units
\n\n";
-
-Unit properties as seen or measured in Brood War
-versionâ¥1.08.
-
+my $units = do $datafile;
+die "Cannot open unit data: $_\n" for $@ || $! || ();
+my $patch = shift @{$units}
+ or die "Cannot open unit data: metadata not found\n";
-
+}
-<:
sub coltoggle {
my ($name, $id) = @_;
return sprintf(
@@ -142,15 +86,15 @@ sub coltoggle {
<:= coltoggle('name', '') :>
-
-
+
+
<:= coltoggle(qw'build cost') :>
-
<:= coltoggle(qw'size size') :>
+
<:= coltoggle(qw'size size') :>
HP
shield
-
armor
-
ground
-
air
+
â¨
+
attack
+
dps
range
sight
speed
@@ -158,152 +102,229 @@ sub coltoggle {
<:
sub showrange {
- my ($row, @elements) = @_;
- my ($min, $max);
-
- my $value = $row;
- $value = ref $value eq 'HASH' && $value->{$_} or last for @elements;
- if (ref $value eq 'ARRAY') {
- $min = $value->[0];
- $max = $value->[-1];
- }
- else {
- $min = $max = $value;
- }
- defined $min or return '';
-
- if ($row->{upgrade}) {
- for (@{ $row->{upgrade} }) {
- my $increase = $_ or next;
- $increase = ref $increase eq 'HASH' && $increase->{$_} or last for @elements;
- $increase = $increase->[-1] if ref $increase eq 'ARRAY';
- $max += $increase if $increase;
- }
- }
-
- if ($elements[0] eq 'attack' and $elements[1] ne 'range' and $elements[2] eq 'cmp') {{
- my $type = $row->{$elements[0]}->{$elements[1]}->{type} or next;
- if ($type eq 'explosive') {
- $min /= 2;
- }
- elsif ($type eq 'implosive') {
- $min /= 4;
- }
- $min = int($min + .5); # round halves up
- }}
-
- return $min == $max ? $min : "$min-$max";
+ my ($min, $max) = @_;
+ return '' if not defined $min;
+ $_ &&= int($_ + .5) for $min, $max; # round halves up
+ return $min if not defined $max or $min == $max;
+ return "$min-$max";
}
sub showattack {
my ($row, $area) = @_;
- local $_ = $row->{attack}->{$area};
+ my $attack = $row->{attack}->[$area]
+ or return '
';
+
+ my $out = '';
+ $out .= '
' . 'â½' x !!($attack->{anti} & 1);
+ $out .= '
' . 'â³' x !!($attack->{anti} & 2);
+ $out .= '
';
- return '
' unless $_;
+ my $upattack = $row->{upgraded}->{attack}->[$area];
+ my $damage = $attack->{damage};
+ my $maxdamage = $upattack->{damage} // $damage;
+ $damage = $damage->[0] if ref $damage;
+ $maxdamage = $maxdamage->[-1] if ref $maxdamage;
- my $tagbase = '
'."\n", $race, ucfirst $race
- if $grouped and $race ne $_->{race};
- $_->{cat} = $_->{race} if not $grouped;
- my $sizechar = [qw/? s m l/]->[$_->{size}];
+ if ($grouped) {
+ printf '
each point decreases damage per hit by one, upto a minimum of ½
-
reduction applies to initial damage, before size penalties (so a large plasma hit of 12 to 4 armor deals 2 damage, not ½)
-
ground/air
-
damage done per single attack against ground/air units
-
2nd column indicates relative amount of damage done in
- a certain
- amount of time
-
splash damage+ hits nearby objects as well
-
explosive damage does only
+
reduction applies to initial damage, before size penalties
+ (so a plasma hit of 12 to 4 armor large deals 2 damage, not ½)
+
attack
+
targets â½ ground
+ and/or â³ air
+
damage given per single hit
+
dps indicates relative amount of damage
+ done in 1 second of in-game time
+
splash damage hits all objects nearby +
+ or in a straight line Ã.
+
<:
+if ($scver{major} > 1) {
+ :>does not include ≥bonus damage
+ dealt to susceptible unit types<:
+} else {
+ :>*explosive damage does only
50% damage to small units, 75% to medium, 100% to large
-
concussive/plasma damage does
- 25% to large, 50% medium, 100% to small units
+
~concussive/plasma damage does
+ 25% to large, 50% medium, 100% to small units<:
+} :>
sight
range in which the unit detects other units
emphasis indicates ability to detect cloaked units
@@ -353,7 +407,7 @@ sub showrange {
speed
relative speed of movement (when in full motion, startup speed ignored)
specials
-
special abilities
+
special abilities are usually casted manually, but some are always active
parentheses () indicate that it needs to be researched first