X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/38fa2438908dcc08d887972a84225e80fd8bc97c..6bff32506fbf94646a25873088ff6343fccd8a95:/sc.plp?ds=sidebyside
diff --git a/sc.plp b/sc.plp
index 25c9863..06e377f 100644
--- a/sc.plp
+++ b/sc.plp
@@ -1,152 +1,53 @@
<(common.inc.plp)><:
-my $datafile = 'sc-units.inc.pl';
+my %scver = (
+ id => 'bw',
+ name => 'Brood War',
+ title => 'starcraft',
+ game => 'StarCraft',
+ major => 1,
+);
+
if ($ENV{PATH_INFO} and $ENV{PATH_INFO} eq '/2') {
- $datafile = 'sc2-units.inc.pl';
+ %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(
@@ -162,12 +63,14 @@ sub coltoggle {
<:= coltoggle(qw'build cost') :>
-
<:= coltoggle(qw'size size') :>
+
<:= coltoggle(qw'size size') :>
HP
shield
-
armor
-
ground
-
air
+
â¨
+
ground
+
dps
+
air
+
dps
range
sight
speed
@@ -175,6 +78,12 @@ sub coltoggle {
<:
sub showrange {
+ my ($min, $max) = @_;
+ $_ = int($_ + .5) for $min, $max; # round halves up
+ return $min == $max ? $min : "$min-$max";
+}
+
+sub showval {
my ($row, @elements) = @_;
my ($min, $max);
@@ -209,36 +118,42 @@ sub showrange {
$min /= 4;
}
}}
- $_ = int($_ + .5) for $min, $max; # round halves up
-
- return $min == $max ? $min : "$min-$max";
+ return showrange($min, $max);
}
sub showattack {
my ($row, $area) = @_;
- local $_ = $row->{attack}->{$area};
- if (not ref $_) {
+ my $attack = $row->{attack}->{$area};
+ if (not ref $attack) {
# reference to another area
- $area = $_;
- $_ = $row->{attack}->{$area};
+ $area = $attack;
+ $attack = $row->{attack}->{$area};
}
- return '
' unless $_;
+ return '
' unless $attack;
my $tagbase = '
';
- my $out = showrange($row, 'attack', $area, 'damage');
- $out .= '+' if $_->{splash};
- $out .= '
excludes construction of dependencies such as buildings
and +parent units
size
-
affected by Small,
- Medium,
- or Large unit damage
+
<:
+if ($scver{major} > 1) {
+ :>transports can fit 8 Small,
+ 4 Medium,
+ 2 Large,
+ or a single Huge unit<:
+} else {
+ :>affected by Small,
+ Medium, or
+ Large unit damage<:
+} :>