sc: indicate specials cost and availability
[sheet.git] / sc.plp
diff --git a/sc.plp b/sc.plp
index 76974c94ee8f7351faaaeb1d8e76ceb83ffd0954..b14e04f49a303dfb518bb7b8bf5f6492681e37f4 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -250,18 +250,21 @@ sub showrange {
                                join('',
                                        $_->{name},
                                        $_->{desc} ? ": $_->{desc}" : '',
-                                       $_->{range} ? sprintf(' (%s)', join ', ',
-                                               "range $_->{range}",
-#                                              "cost $_->{cost}",
+                                       $_->{range} || $_->{cost} ? sprintf(' (%s)', join ', ',
+                                               $_->{range} ? "range $_->{range}" : (),
+                                               $_->{cost} ? sprintf('cost %.0f%%',
+                                                       100 * $_->{cost} / $row->{energy}
+                                               ) : (),
                                        ) : '',
                                ),
-                               $_->{abbr},
-               } @$specials;
+                               sprintf($_->{build} ? '(%s)' : '%s', $_->{abbr}),
+               } grep { defined $_->{abbr} } @{$specials};
        }
 
        sub showunitcols {
                my ($row) = @_;
                local $_ = $row;
+               $_->{hp} += $_->{shield} if $_->{shield};
                my $suitchar = '';
                if ($_->{suit}) {
                        $suitchar = [qw/? s m l/]->[$_->{suit}];
@@ -325,7 +328,6 @@ sub showrange {
                printf '<tbody id="%s"><tr class="race"><th colspan="18"><h2>%s</h2>'."\n", $race, ucfirst $race
                        if $grouped and $race ne $_->{race};
                $_->{cat} = $_->{race} if not $grouped;
-               $_->{hp} += $_->{shield};
                print(
                        '<tr>',
                        sprintf('<t%s class="cat">%s', $cat ne $_->{cat} ? ('h', $cat = $_->{cat}) : ('d', '&nbsp;')),