sc: improve hots unit size fallback order
[sheet.git] / sc.plp
diff --git a/sc.plp b/sc.plp
index e5a5b44b6a6af851496a74fa528230a00f6a531c..2217dc67d09b634cb84d6ffb377c0fd76d64c466 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -47,7 +47,12 @@ die "Cannot open unit data: $_\n" for $@ || $! || ();
 my $patch = shift @{$units}
        or die "Cannot open unit data: metadata not found\n";
 
-print "<p>Unit properties as seen or measured in $scver{name}\n$patch.\n</p>\n\n";
+print "<p>Unit properties as seen or measured in $scver{name}\n$patch.\n";
+print "Also see the $_ table.\n" for join(', ',
+       ('<a href="/sc/2">StarCraft 2: HotS</a>')    x ($scver{major} < 2),
+       ('<a href="/sc">original SC: Brood War</a>') x ($scver{major} > 1),
+);
+print "</p>\n\n";
 
 sub addupgrade {
        my ($ref, $increase) = @_;
@@ -131,6 +136,7 @@ sub showrange {
                                $_ eq 'armored' ? 'unit-l' :
                                $_ eq 'organic' ? 'unit-o' :
                                $_ =~ /^massive/ ? 'unit-h' :
+                               $_ eq 'shields' ? 'unit-shield' :
                                '',
                        } join '_', keys %{ $attack->{bonus} }),
                        join(', ', map {(
@@ -279,10 +285,15 @@ sub showrange {
                $grouped = 0;
                $get{order} ||= '';
                if ($get{order} eq 'size') {
-                       $_->{order} = $_->{unit}*8 + $_->{suit} + $_->{hp}/512 + $_->{min}/8192 for @$units;
+                       $_->{order} = (
+                               $_->{unit}*16 + ($_->{size} // $_->{suit}) + $_->{cargo}/8
+                               + $_->{hp}/512 + $_->{min}/8192
+                       ) for @$units;
                }
                elsif ($get{order} eq 'cost') {
-                       $_->{order} = $_->{gas}*1.5 + $_->{min} + $_->{unit}/8 + $_->{build}/256/8 for @$units;
+                       $_->{order} = (
+                               $_->{gas}*1.5 + $_->{min} + $_->{unit}/8 + $_->{build}/256/8
+                       ) for @$units;
                }
                else {
                        $units->[$_]->{order} = $_ for 0 .. $#$units;