From 0b686d7436dbdb50f0bf8547f845af6bc334a9e4 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 11 Jun 2015 01:29:28 +0200 Subject: [PATCH] sc: reference shared attacks in data --- sc-units.inc.pl | 63 +++++++++---------------------------------------- sc.plp | 9 ++++++- 2 files changed, 19 insertions(+), 53 deletions(-) diff --git a/sc-units.inc.pl b/sc-units.inc.pl index de7a97b..b32e5ef 100644 --- a/sc-units.inc.pl +++ b/sc-units.inc.pl @@ -52,10 +52,7 @@ attack => { damage => 20, dps => 27, }, - air => { - damage => 20, - dps => 27, - }, + air => 'ground', range => 7, }, sight => 11, @@ -126,11 +123,7 @@ attack => { dps => [20, 22, 24, 26], type => 'explosive', }, - air => { - damage => [20, 22, 24, 26], - dps => [20, 22, 24, 26], - type => 'explosive', - }, + air => 'ground', range => 4, }, sight => 8, @@ -263,11 +256,7 @@ attack => { dps => [45, undef, undef, 59], splash => 1, }, - air => { - damage => [30, 33, 36, 39], - dps => [45, undef, undef, 59], - splash => 1, - }, + air => 'ground', range => 2, }, sight => 8, @@ -452,13 +441,7 @@ attack => { build => 12.7*$FM, max => 4, }, - air => { - damage => [6, 7, 8, 9], - dps => [17, undef, undef, 49], - min => 25, - build => 12.7*$FM, - max => 4, - }, + air => 'ground', range => 8, }, sight => 11, @@ -490,11 +473,7 @@ attack => { dps => [7, undef, undef, 9], type => 'explosive', }, - air => { - damage => [10, 11, 12, 13], - dps => [7, undef, undef, 9], - type => 'explosive', - }, + air => 'ground', range => 5, }, sight => 9, @@ -725,10 +704,7 @@ attack => { damage => [6, 7, 8, 9], dps => [12, undef, undef, 18], }, - air => { - damage => [6, 7, 8, 9], - dps => [12, undef, undef, 18], - }, + air => 'ground', range => 4, }, sight => 7, @@ -750,9 +726,7 @@ special => [ ground => { dps => [24, undef, undef, 36], }, - air => { - dps => [24, undef, undef, 36], - }, + air => 'ground', }, duration => undef, #XXX }, @@ -817,11 +791,7 @@ attack => { dps => [14, undef, undef, 18], type => 'implosive', }, - air => { - damage => [10, 11, 12, 13], - dps => [14, undef, undef, 18], - type => 'implosive', - }, + air => 'ground', range => 7, }, sight => 9, @@ -1090,10 +1060,7 @@ attack => { damage => [25, 28, 31, 34], dps => [25, 28, 31, 34], }, - air => { - damage => [25, 28, 31, 34], - dps => [25, 28, 31, 34], - }, + air => 'ground', range => 6, }, sight => 11, @@ -1417,11 +1384,7 @@ attack => { dps => [20, 22, 24, 26], type => 'explosive', }, - air => { - damage => [10, 11, 12, 13], - dps => [20, 22, 24, 26], - type => 'explosive', - }, + air => 'ground', range => 4, }, sight => 6, @@ -1606,11 +1569,7 @@ attack => { dps => [9, 10, 11, 12], splash => 1, }, - air => { - damage => [9, 10, 11, 12], - dps => [9, 10, 11, 12], - splash => 1, - }, + air => 'ground', range => 3, }, sight => 7, diff --git a/sc.plp b/sc.plp index 6b08c94..d6ccaf6 100644 --- 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 '' unless $_; -- 2.30.0