}
}
- if ($elements[0] eq 'attack' and $elements[1] ne 'range' and $elements[2] eq 'cmp') {{
+ if ($elements[0] eq 'attack' and $elements[1] ne 'range' and $elements[2] eq 'dps') {{
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
}}
+ $_ = int($_ + .5) for $min, $max; # round halves up
return $min == $max ? $min : "$min-$max";
}
my $out = showrange($row, 'attack', $area, 'damage');
$out .= '<span class="unit-splash">+</span>' if $_->{splash};
- $out .= '<td class="val hurt hurtrel">' . showrange($row, 'attack', $area, 'cmp');
+ $out .= '<td class="val hurt hurtrel">' . showrange($row, 'attack', $area, 'dps');
return $tagbase . $out;
}
if (exists $get{order}) {
$get{order} ||= '';
if ($get{order} eq 'size') {
- $_->{order} = $_->{unit}*8 + $_->{size} + $_->{hp}/512 + $_->{min}/8192 for @$units;
+ $_->{order} = $_->{unit}*8 + $_->{suit} + $_->{hp}/512 + $_->{min}/8192 for @$units;
}
elsif ($get{order} eq 'cost') {
$_->{order} = $_->{gas}*1.5 + $_->{min} + $_->{unit}/8 + $_->{build}/256/8 for @$units;
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;
- my $sizechar = [qw/? s m l/]->[$_->{size}];
+ $_->{hp} += $_->{shield};
+ my $suitchar = [qw/? s m l/]->[$_->{suit}];
print(
'<tr>',
sprintf('<t%s class="cat">%s', $cat ne $_->{cat} ? ('h', $cat = $_->{cat}) : ('d', ' ')),
!!$_->{base} && '<span class="unit-composed">+</span>',
$_->{build} || '0',
),
- sprintf('<td class="unit unit-%s">%s', $sizechar, ucfirst $sizechar),
+ sprintf('<td class="unit unit-%s">%s', $suitchar, ucfirst $suitchar),
'<td class="val unit">' . join('',
$_->{unit} ? $_->{unit} == .5 ? '½' : $_->{unit} : ' ',
defined $_->{organic} && sprintf(
),
),
'<td class="val unit-hp">' . $_->{hp},
- '<td class="val unit-shield">' . ($_->{shield} ? $_->{shield}.'%' : ' '),
+ '<td class="val unit-shield">' . (
+ $_->{shield} ? sprintf('%.0f%%', 100 * $_->{shield} / $_->{hp}) : ' '
+ ),
'<td class="val unit-armor">' . showrange($_, 'armor'),
showattack($_, 'ground'),
showattack($_, 'air'),