+ (map { $_ && " ($_)" } join ', ',
+ #TODO: apply upgrades
+ $_->{range} ? "range $_->{range}" : (),
+ $_->{cost} ? showcost($_, $row) :
+ $_->{cooldown} ? "cooldown $_->{cooldown}s" : (),
+ ),
+ ),
+ sprintf($_->{build} ? '(%s)' : '%s', $_->{abbr}),
+ } grep { defined $_->{abbr} } @{$specials};
+ }
+
+ sub showunitcols {
+ my ($row) = @_;
+ local $_ = $row;
+ $_->{hp} += $_->{shield} if $_->{shield};
+
+ return (
+ '<td class="val min">' . ($_->{min} // ''),
+ '<td class="val gas">' . ($_->{gas} || ''),
+ !defined $_->{build} ? '<td>' : sprintf('<td class="val time">%s%.0f',
+ !!$_->{base} && '<span class="unit-composed">+</span>',
+ $_->{build} || '0',
+ ),
+ sprintf('<td class="unit unit-%s" title="%4$s%3$s">%s',
+ $_-> {cargo} < 0 ? ('supply', T => 'transport') :
+ $_->{upgraded}->{cargo} < 0 ? ('supply magic-opt', T => 'optional transport') :
+ $_->{attr}->{flying} ? ('air', F => 'flying') :
+ $_->{attr}->{structure} ? ('x', B => 'building') :
+ (
+ [qw( x s m l l h h h h )]->[ $_->{cargo} ],
+ $_->{cargo} || '-',
+ $_->{cargo} ? 'transportable' : 'untransportable',
+ ),
+ defined $_->{size} && sprintf('⌀%.1f ', $_->{size}),
+ ),
+ sprintf('<td class="val unit%s">%s',
+ defined $_->{pop} && $_->{pop} < 0 && ' unit-supply',
+ defined $_->{pop} && $_->{pop} == .5 ? '½' : $_->{pop},
+ ),
+ '<td class="unit unit-type">' . join('', grep { $_ }
+ (defined $_->{organic} ? !$_->{organic} : $_->{attr}->{mech})
+ && '<span class="unit-u" title="mechanic">m</span>',
+ ($_->{organic} || $_->{attr}->{organic})
+ && '<span class="unit-o" title="organic">o</span>',
+ $_->{attr}->{psionic}
+ && '<span class="unit-p" title="psionic">ψ</span>',
+ ),
+ '<td class="unit unit-attr">' . join('', grep { $_ }
+ $_->{attr}->{armored}
+ && '<span class="unit unit-l" title="armored">A</span>',
+ $_->{attr}->{light}
+ && '<span class="unit unit-s" title="light">L</span>',
+ $_->{suit} && sprintf(
+ '<span class="unit unit-%s" title="%3$s">%s</span>',
+ map { @{$_} } [
+ [qw( x ? unknown )],
+ [qw( s S small )],
+ [qw( m M medium )],
+ [qw( l L large )],
+ ]->[ $_->{suit} ],