git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sc: colourise negative supply values (providers)
[sheet.git]
/
sc.plp
diff --git
a/sc.plp
b/sc.plp
index 3a11f0ce4ad2cf8406f02758220e73a728314427..09ae989cc26ea4b03dc1cf0bb9c62be3a07926a3 100644
(file)
--- a/
sc.plp
+++ b/
sc.plp
@@
-129,7
+129,9
@@
sub showrange {
$maxdamage += ($upattack->{upgrade} // $attack->{upgrade}) * 3;
my $out = '<td class="val hurt">';
$maxdamage += ($upattack->{upgrade} // $attack->{upgrade}) * 3;
my $out = '<td class="val hurt">';
- $out .= "<small>$attack->{count}× </small>" if $attack->{count} > 1;
+ $out .= sprintf('<small>%s× </small>',
+ showrange($attack->{count}, $upattack->{count}),
+ ) if $attack->{count} > 1;
$out .= '<span class="unit-l" title="explosive">*</span>'
if $attack->{type} eq 'explosive';
$out .= '<span class="unit-s" title="implosive">~</span>'
$out .= '<span class="unit-l" title="explosive">*</span>'
if $attack->{type} eq 'explosive';
$out .= '<span class="unit-s" title="implosive">~</span>'
@@
-167,7
+169,10
@@
sub showrange {
$out .= '<td class="val hurt hurtrel">';
if ($attack->{dps}) {
$out .= '<td class="val hurt hurtrel">';
if ($attack->{dps}) {
- $out .= showrange($attack->{dps}->[0], $attack->{dps}->[-1]);
+ # precalculated dps, do not touch
+ $out .= showrange($attack->{dps}->[0],
+ $upattack->{dps}->[-1] // $attack->{dps}->[-1]
+ );
}
elsif ($attack->{cooldown}) {
if (my $type = $attack->{type}) {
}
elsif ($attack->{cooldown}) {
if (my $type = $attack->{type}) {
@@
-260,8
+265,9
@@
sub showrange {
$_->{attr}->{massive}
&& '<span class="unit-massive" title="massive">⚓</span>',
),
$_->{attr}->{massive}
&& '<span class="unit-massive" title="massive">⚓</span>',
),
- '<td class="val unit">' . (
- defined $_->{unit} && $_->{unit} == .5 ? '½' : $_->{unit}
+ 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})
),
'<td class="unit unit-type">' . join('', grep { $_ }
(defined $_->{organic} ? !$_->{organic} : $_->{attr}->{mech})
@@
-311,13
+317,13
@@
sub showrange {
$get{order} ||= '';
if ($get{order} eq 'size') {
$_->{order} = (
$get{order} ||= '';
if ($get{order} eq 'size') {
$_->{order} = (
- $_->{
unit
}*16 + ($_->{size} // $_->{suit}) + $_->{cargo}/8
+ $_->{
pop
}*16 + ($_->{size} // $_->{suit}) + $_->{cargo}/8
+ $_->{hp}/512 + $_->{min}/8192
) for @$units;
}
elsif ($get{order} eq 'cost') {
$_->{order} = (
+ $_->{hp}/512 + $_->{min}/8192
) for @$units;
}
elsif ($get{order} eq 'cost') {
$_->{order} = (
- $_->{gas}*1.5 + $_->{min} + $_->{
unit
}/8 + $_->{build}/256/8
+ $_->{gas}*1.5 + $_->{min} + $_->{
pop
}/8 + $_->{build}/256/8
) for @$units;
}
elsif ($get{order} eq 'attack') {
) for @$units;
}
elsif ($get{order} eq 'attack') {