sc: reference shared attacks in data
[sheet.git] / sc.plp
diff --git a/sc.plp b/sc.plp
index 6b08c9477acb304665a865dc57178ca2f95d5013..d6ccaf62e8f72e3c0f8797726aa75ad2e1099e53 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -193,7 +193,9 @@ sub showrange {
        }
 
        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;
+               my $attack = $row->{ $elements[0] }->{ $elements[1] };
+               ref $attack or $attack = $row->{ $elements[0] }->{$attack}; # follow
+               my $type = $attack->{type} or next;
                if ($type eq 'explosive') {
                        $min /= 2;
                }
@@ -209,6 +211,11 @@ sub showrange {
        sub showattack {
                my ($row, $area) = @_;
                local $_ = $row->{attack}->{$area};
+               if (not ref $_) {
+                       # reference to another area
+                       $area = $_;
+                       $_ = $row->{attack}->{$area};
+               }
 
                return '<td colspan="2" class="hurt">' unless $_;