return "$min-$max";
}
+ sub showcost {
+ my ($row, $unit) = @_;
+ return join(' ',
+ sprintf('cost %.0f%%', 100 * $row->{cost} / $unit->{energy}),
+ !defined $row->{maint} ? () :
+ sprintf('+%.1f%%/s', 100 * $row->{maint} / $unit->{energy}),
+ );
+ }
+
sub showattack {
my ($row, $area) = @_;
my $attack = $row->{attack}->[$area]
(map { $_ && " ($_)" } join ', ',
#TODO: apply upgrades
$_->{range} ? "range $_->{range}" : (),
- $_->{cost} ? sprintf('cost %.0f%%%s',
- 100 * $_->{cost} / $row->{energy},
- defined $_->{maint} && sprintf('+%.1f%%/s',
- 100 * $_->{maint} / $row->{energy},
- ),
- ) :
+ $_->{cost} ? showcost($_, $row) :
$_->{cooldown} ? "cooldown $_->{cooldown}s" : (),
),
),