print "<p>Unit properties as seen or measured in $scver{name}\n$patch.\n</p>\n\n";
+for my $unit (@{$units}) {
+ for my $upgrade (@{ $unit->{upgrade} // $unit->{update} // [] }) {
+ while (my ($col, $increase) = each %{$upgrade}) {
+ defined $unit->{$col} or next;
+
+ if (ref $increase eq 'ARRAY') {
+ for my $incrow (0 .. $#{$increase}) {
+ while (my ($inccol, $subinc) = each %{ $increase->[$incrow] }) {
+ $unit->{upgraded}->{$col}->[$incrow]->{$inccol}
+ //= ref $unit->{$col}->[$incrow]->{$inccol}
+ ? $unit->{$col}->[$incrow]->{$inccol}->[-1]
+ : $unit->{$col}->[$incrow]->{$inccol};
+ $unit->{upgraded}->{$col}->[$incrow]->{$inccol}
+ += ref $subinc ? $subinc->[-1] : $subinc;
+ }
+ }
+ }
+ elsif ($increase =~ /^-?[0-9.]+/) {
+ $unit->{upgraded}->{$col} //= $unit->{$col};
+ $unit->{upgraded}->{$col} += $increase;
+ }
+ }
+ }
+}
+
sub coltoggle {
my ($name, $id) = @_;
return sprintf(
}
defined $min or return '';
- if ($row->{upgrade}) {
- for (@{ $row->{upgrade} }) {
- my $increase = $_ or next;
+ if (my $increase = $row->{upgraded}) {
$increase = ref $increase eq 'HASH' ? $increase->{$_}
: ref $increase eq 'ARRAY' && $increase->[$_] or last for @elements;
- $increase = $increase->[-1] if ref $increase eq 'ARRAY';
- $max += $increase if $increase;
- }
+ $max = $increase if $increase;
}
if ($elements[0] eq 'attack' and $elements[2] eq 'dps') {{