my ($min, $max) = @_;
return '' if not defined $min;
$_ &&= int($_ + .5) for $min, $max; # round halves up
- return $min || '-' if not defined $max or $min == $max;
+ return $min || '-' if !$max or $min == $max;
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}),
+ sprintf('cost %s%%', join '-',
+ map { $_ && sprintf '%.0f', 100 * $row->{cost} / $_ } grep { defined $_ }
+ $unit->{energy},
+ $unit->{upgraded}->{energy},
+ $unit->{capacity},
+ $unit->{upgraded}->{capacity},
+ ),
+ !defined $row->{maint} ? () : sprintf('+%s%%/s', join '-',
+ map { sprintf '%.1f', 100 * $row->{maint} / $_ } grep $_,
+ $unit->{capacity},
+ $unit->{upgraded}->{capacity},
+ ),
);
}
<dd><span class="magic-perma">passive</span> abilities are always enabled
<dd>hover for description
<dd>range is maximum range required to activate
- <dd>cost is percentage of total energy lost
+ <dd>cost is energy loss percentage on spawn and when fully charged
</dl>
<p>