sc: separate base damage from upgrade bonus
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 20 Jun 2015 05:58:55 +0000 (07:58 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 22 Jun 2015 13:38:51 +0000 (15:38 +0200)
sc-units-bw.inc.pl
sc-units-hots.inc.pl
sc.plp

index 43d175c..4c1115d 100644 (file)
@@ -89,7 +89,8 @@ attack => [
        {
                anti => 1,
                name => "Psi Blades",
-               damage => [16, 18, 20, 22],
+               damage => 16,
+               upgrade => 2,
                cooldown => 22 / $FPS,
                range => 1,
        },
@@ -129,7 +130,8 @@ attack => [
        {
                anti => 3,
                name => "Phase Disruptor",
-               damage => [20, 22, 24, 26],
+               damage => 20,
+               upgrade => 2,
                type => 'explosive',
                cooldown => 30 / $FPS,
                range => 4,
@@ -229,7 +231,8 @@ attack => [
        {
                anti => 1,
                name => "Warp Blades",
-               damage => [40, 43, 46, 49],
+               damage => 40,
+               upgrade => 3,
                cooldown => 30 / $FPS,
                range => 1,
        },
@@ -268,7 +271,8 @@ attack => [
        {
                anti => 3,
                name => "Psionic Shockwave",
-               damage => [30, 33, 36, 39],
+               damage => 30,
+               upgrade => 3,
                cooldown => 20 / $FPS,
                splash => 1,
                range => 2,
@@ -363,13 +367,15 @@ armor => 0,
 attack => [
        {
                anti => 1,
-               damage => [8, 9, 10, 11],
+               damage => 8,
+               upgrade => 1,
                cooldown => 30 / $FPS,
                range => 4,
        },
        {
                anti => 2,
-               damage => [28, 30, 32, 34],
+               damage => 28,
+               upgrade => 2,
                type => 'explosive',
                cooldown => 22 / $FPS,
                range => 4,
@@ -415,7 +421,8 @@ armor => 1,
 attack => [
        {
                anti => 2,
-               damage => [5, 6, 7, 8],
+               damage => 5,
+               upgrade => 1,
                cooldown => 8 / $FPS,
                splash => 1,
                type => 'explosive',
@@ -492,7 +499,8 @@ special => [
                attack => [
                        {
                                anti => 3,
-                               damage => [6, 7, 8, 9],
+                               damage => 6,
+                               upgrade => 1,
                                cooldown => 43 / $FPS, # approximately 37 according to liquipedia
                                build => 20,
                                range => 0,
@@ -533,7 +541,8 @@ armor => 1,
 attack => [
        {
                anti => 3,
-               damage => [10, 11, 12, 13],
+               damage => 10,
+               upgrade => 1,
                cooldown => 45 / $FPS,
                type => 'explosive',
                range => 5,
@@ -790,7 +799,8 @@ armor => 0,
 attack => [
        {
                anti => 3,
-               damage => [6, 7, 8, 9],
+               damage => 6,
+               upgrade => 1,
                cooldown => 15 / $FPS,
                range => 4,
        },
@@ -845,7 +855,8 @@ armor => 1,
 attack => [
        {
                anti => 1,
-               damage => [16, 18, 20, 22],
+               damage => 16,
+               upgrade => 2,
                cooldown => 22 / $FPS,
                splash => 1,
                type => 'implosive',
@@ -894,7 +905,8 @@ armor => 0,
 attack => [
        {
                anti => 3,
-               damage => [10, 11, 12, 13],
+               damage => 10,
+               upgrade => 1,
                cooldown => 22 / $FPS,
                type => 'implosive',
                range => 7,
@@ -1036,7 +1048,8 @@ armor => 0,
 attack => [
        {
                anti => 1,
-               damage => [20, 22, 24, 26],
+               damage => 20,
+               upgrade => 2,
                cooldown => 30 / $FPS,
                type => 'implosive',
                range => 5,
@@ -1100,7 +1113,8 @@ armor => 1,
 attack => [
        {
                anti => 1,
-               damage => [30, 33, 36, 39],
+               damage => 30,
+               upgrade => 3,
                cooldown => 37 / $FPS,
                type => 'explosive',
                range => 7,
@@ -1119,7 +1133,8 @@ special => [
                attack => [
                        {
                                anti => 1,
-                               damage => [70, 75, 80, 85],
+                               damage => 70,
+                               upgrade => 5,
                                cooldown => 75 / $FPS,
                                splash => 1,
                                type => 'explosive',
@@ -1149,13 +1164,15 @@ armor => 1,
 attack => [
        {
                anti => 1,
-               damage => [12, 13, 14, 15],
+               damage => 12,
+               upgrade => 1,
                cooldown => 22 / $FPS,
                range => 5,
        },
        {
                anti => 2,
-               damage => [20, 24, 28, 32],
+               damage => 20,
+               upgrade => 4,
                type => 'explosive',
                cooldown => 22 / $FPS,
                range => 5,
@@ -1195,13 +1212,15 @@ armor => 0,
 attack => [
        {
                anti => 1,
-               damage => [8, 9, 10, 11],
+               damage => 8,
+               upgrade => 1,
                cooldown => 30 / $FPS,
                range => 5,
        },
        {
                anti => 2,
-               damage => [20, 22, 24, 26],
+               damage => 20,
+               upgrade => 2,
                cooldown => 22 / $FPS,
                type => 'explosive',
                range => 5,
@@ -1252,7 +1271,8 @@ armor => 3,
 attack => [
        {
                anti => 3,
-               damage => [25, 28, 31, 34],
+               damage => 25,
+               upgrade => 3,
                cooldown => 30 / $FPS,
                range => 6,
        },
@@ -1374,7 +1394,8 @@ armor => 2,
 attack => [
        {
                anti => 2,
-               damage => [6, 7, 8, 9],
+               damage => 6,
+               upgrade => 1,
                cooldown => 64 / $FPS,
                splash => 1,
                type => 'explosive',
@@ -1568,7 +1589,8 @@ armor => 0,
 attack => [
        {
                anti => 1,
-               damage => [5, 6, 7, 8],
+               damage => 5,
+               upgrade => 1,
                cooldown => 8 / $FPS,
                range => 1,
        },
@@ -1613,7 +1635,8 @@ armor => 0,
 attack => [
        {
                anti => 3,
-               damage => [10, 11, 12, 13],
+               damage => 10,
+               upgrade => 1,
                cooldown => 15 / $FPS,
                type => 'explosive',
                range => 4,
@@ -1665,7 +1688,8 @@ armor => 1,
 attack => [
        {
                anti => 1,
-               damage => [20, 22, 24, 26],
+               damage => 20,
+               upgrade => 2,
                cooldown => 37 / $FPS,
                splash => 'line',
                range => 6,
@@ -1736,7 +1760,8 @@ special => [
                attack => [
                        {
                                anti => 1,
-                               damage => [4, 5, 6, 7],
+                               damage => 4,
+                               upgrade => 1,
                                cooldown => 15 / $FPS,
                                range => 1,
                        },
@@ -1813,7 +1838,8 @@ armor => 0,
 attack => [
        {
                anti => 3,
-               damage => [9 .. 12],
+               damage => 9,
+               upgrade => 1,
                cooldown => 30 / $FPS,
                splash => 'bounce',
                range => 3,
@@ -1853,7 +1879,8 @@ armor => 2,
 attack => [
        {
                anti => 1,
-               damage => [20, 22, 24, 26],
+               damage => 20,
+               upgrade => 2,
                cooldown => 30 / $FPS,
                range => 8,
        },
@@ -1879,7 +1906,8 @@ armor => 2,
 attack => [
        {
                anti => 2,
-               damage => [25, 27, 29, 31],
+               damage => 25,
+               upgrade => 2,
                cooldown => 100 / $FPS,
                type => 'explosive',
                range => 6,
@@ -1954,7 +1982,8 @@ armor => 1,
 attack => [
        {
                anti => 1,
-               damage => [20, 23, 26, 29],
+               damage => 20,
+               upgrade => 3,
                cooldown => 15 / $FPS,
                range => 1,
        },
index 6b230d9..5d558d1 100644 (file)
@@ -90,7 +90,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Repulsor Cannon',
-                       damage => [8 .. 11],
+                       damage => 8,
+                       upgrade => 1,
                        type => 'projectile',
                        cooldown => 0.85,
                        range => 5,
@@ -150,7 +151,8 @@ use strict;
                {
                        anti => 3,
                        name => 'Purifier beams',
-                       damage => [6 .. 9],
+                       damage => 6,
+                       upgrade => 1,
                        cooldown => 2.21,
                        count => 6,
                        range => 7,
@@ -249,7 +251,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Psi blades',
-                       damage => [8 .. 11],
+                       damage => 8,
+                       upgrade => 1,
                        cooldown => 1.2,
                        count => 2,
                        range => 0,
@@ -296,7 +299,8 @@ use strict;
                {
                        anti => 3,
                        name => 'Disruption beam',
-                       damage => [6 .. 9],
+                       damage => 6,
+                       upgrade => 1,
                        cooldown => 1.0,
                        range => 5,
                },
@@ -355,7 +359,8 @@ use strict;
                {
                        anti => 3,
                        name => 'Particle disruptors',
-                       damage => [10 .. 13],
+                       damage => 10,
+                       upgrade => 1,
                        bonus => {
                                armored => 4,
                        },
@@ -449,7 +454,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Warp blade',
-                       damage => [45, 50, 55, 60],
+                       damage => 45,
+                       upgrade => 5,
                        cooldown => 1.694,
                        range => 0,
                },
@@ -488,9 +494,11 @@ use strict;
                {
                        anti => 3,
                        name => 'Psionic shockwave',
-                       damage => [25, 28, 31, 34],
+                       damage => 25,
+                       upgrade => 3,
                        bonus => {
-                               organic => [10 .. 13],
+                               organic => 10,
+                               -organic => 1,
                        },
                        splash => 1,
                        cooldown => 1.754,
@@ -522,9 +530,11 @@ use strict;
                {
                        anti => 1,
                        name => 'Phase disruptors',
-                       damage => [20, 22, 24, 26],
+                       damage => 20,
+                       upgrade => 2,
                        bonus => {
-                               armored => [30, 33, 36, 39],
+                               armored => 30,
+                               -armored => 3,
                        },
                        cooldown => 1.45,
                        range => 6,
@@ -565,7 +575,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Thermal Lances',
-                       damage => [15, 17, 19, 21],
+                       damage => 15,
+                       upgrade => 2,
                        splash => 'line',
                        cooldown => 1.65,
                        count => 2,
@@ -690,7 +701,8 @@ use strict;
                {
                        anti => 2,
                        name => 'Ion Cannons',
-                       damage => [5 .. 8],
+                       damage => 5,
+                       upgrade => 1,
                        bonus => {
                                light => 5,
                        },
@@ -750,9 +762,11 @@ use strict;
                {
                        anti => 3,
                        name => 'Prismatic beam',
-                       damage => [6 .. 9],
+                       damage => 6,
+                       upgrade => 1,
                        bonus => {
-                               armored => [4 .. 7],
+                               armored => 4,
+                               -armored => 1,
                        },
                        cooldown => 0.5,
                        range => 6, # keeps firing until range 8
@@ -770,7 +784,7 @@ use strict;
                        attack => [
                                {
                                        bonus => {
-                                               armored => 6, # total +10 .. 13
+                                               armored => 6,
                                        },
                                },
                        ],
@@ -860,9 +874,11 @@ use strict;
                {
                        anti => 2,
                        name => 'Kinetic Overload',
-                       damage => [30, 33, 36, 39],
+                       damage => 30,
+                       upgrade => 3,
                        bonus => {
-                               massive => [14, 16, 18, 20],
+                               massive => 14,
+                               -massive => 2,
                        },
                        type => 'projectile',
                        cooldown => 3.3,
@@ -871,7 +887,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Resonance Coil',
-                       damage => [30, 33, 36, 39],
+                       damage => 30,
+                       upgrade => 3,
                        type => 'projectile',
                        cooldown => 3.3,
                        range => 15,
@@ -932,7 +949,8 @@ use strict;
                                {
                                        anti => 3,
                                        name => 'Interceptor Beams',
-                                       damage => [5 .. 8],
+                                       damage => 5,
+                                       upgrade => 1,
                                        cooldown => 3.0,
                                        count => 2,
                                        range => 2,
@@ -1139,7 +1157,8 @@ use strict;
                {
                        anti => 3,
                        name => 'C-14 rifle',
-                       damage => [6 .. 9],
+                       damage => 6,
+                       upgrade => 1,
                        cooldown => 0.8608,
                        range => 5,
                },
@@ -1166,7 +1185,8 @@ use strict;
                        attack => [
                                {
                                        anti => 3,
-                                       damage => [6 .. 9],
+                                       damage => 6,
+                                       upgrade => 1,
                                        cooldown => 0.5739,
                                        range => 5,
                                },
@@ -1197,9 +1217,11 @@ use strict;
                {
                        anti => 1,
                        name => 'Punisher grenades',
-                       damage => [10 .. 13],
+                       damage => 10,
+                       upgrade => 1,
                        bonus => {
-                               armored => [10 .. 13],
+                               armored => 10,
+                               -armored => 1,
                        },
                        type => 'projectile',
                        cooldown => 1.5,
@@ -1218,9 +1240,11 @@ use strict;
                        attack => [
                                {
                                        anti => 1,
-                                       damage => [10 .. 13],
+                                       damage => 10,
+                                       upgrade => 1,
                                        bonus => {
-                                               armored => [10 .. 13],
+                                               armored => 10,
+                                               -armored => 1,
                                        },
                                        type => 'projectile',
                                        cooldown => 1.0,
@@ -1266,7 +1290,8 @@ use strict;
                {
                        anti => 1,
                        name => 'P-45 Reaper pistol',
-                       damage => [4 .. 7],
+                       damage => 4,
+                       upgrade => 1,
                        cooldown => 1.1,
                        count => 2,
                        range => 4.5,
@@ -1304,9 +1329,11 @@ use strict;
                {
                        anti => 3,
                        name => 'C-10 rifle',
-                       damage => [10 .. 13],
+                       damage => 10,
+                       upgrade => 1,
                        bonus => {
-                               light => [10 .. 13],
+                               light => 10,
+                               -light => 1,
                        },
                        cooldown => 1.5,
                        range => 6,
@@ -1371,9 +1398,11 @@ use strict;
                {
                        anti => 1,
                        name => 'Infernal flamethrower',
-                       damage => [8 .. 11],
+                       damage => 8,
+                       upgrade => 1,
                        bonus => {
-                               light => [6 .. 9],
+                               light => 6,
+                               -light => 1,
                        },
                        splash => 'line',
                        cooldown => 2.5,
@@ -1398,9 +1427,11 @@ use strict;
                        build => 110,
                        attack => [
                                {
-                                       damage => [6 .. 9],
+                                       damage => 6,
+                                       upgrade => 1,
                                        bonus => {
-                                               light => [5, 5, 5, 5], # total [11 .. 14]
+                                               light => 5,
+                                               -light => 0,
                                        },
                                },
                        ],
@@ -1429,7 +1460,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Napalm Spray',
-                       damage => [18, 20, 22, 24],
+                       damage => 18,
+                       upgrade => 2,
                        splash => 1,
                        cooldown => 2,
                        range => 2,
@@ -1454,7 +1486,8 @@ use strict;
                        attack => [
                                {
                                        bonus => {
-                                               light => [12 .. 15],
+                                               light => 12,
+                                               -light => 1,
                                        },
                                },
                        ],
@@ -1525,9 +1558,11 @@ use strict;
                {
                        anti => 1,
                        name => '90 mm twin cannon',
-                       damage => [15, 17, 19, 21],
+                       damage => 15,
+                       upgrade => 2,
                        bonus => {
-                               armored => [10 .. 13],
+                               armored => 10,
+                               -armored => 1,
                        },
                        cooldown => 1.04,
                        range => 7,
@@ -1543,9 +1578,11 @@ use strict;
                                {
                                        anti => 1,
                                        name => '120 mm shock cannon',
-                                       damage => [35, 38, 41, 44],
+                                       damage => 35,
+                                       upgrade => 3,
                                        bonus => {
-                                               armored => [15, 17, 19, 21],
+                                               armored => 15,
+                                               -armored => 2,
                                        },
                                        splash => 1,
                                        cooldown => 3,
@@ -1581,7 +1618,8 @@ use strict;
                {
                        anti => 1,
                        name => "Thor's Hammer",
-                       damage => [30, 33, 36, 39],
+                       damage => 30,
+                       upgrade => 3,
                        cooldown => 1.28,
                        range => 7,
                        count => 2,
@@ -1590,9 +1628,11 @@ use strict;
                        anti => 2,
                        name => 'Javelin Missiles',
 #                      name => 'Explosive Payload',
-                       damage => [6 .. 9],
+                       damage => 6,
+                       upgrade => 1,
                        bonus => {
-                               'light air' => [6 .. 9],
+                               light => 6,
+                               -light => 1,
                        },
                        splash => 1,
                        type => 'projectile',
@@ -1604,7 +1644,8 @@ use strict;
                        anti => 2,
                        name => 'Punisher Cannons',
 #                      name => 'High Impact Payload',
-                       damage => [24, 26, 28, 30],
+                       damage => 24,
+                       upgrade => 2,
                        cooldown => 2,
                        range => 10,
                },
@@ -1634,7 +1675,8 @@ use strict;
                {
                        anti => 2,
                        name => 'Lanzer torpedoes',
-                       damage => [10 .. 13],
+                       damage => 10,
+                       upgrade => 1,
                        bonus => {
                                armored => 4,
                        },
@@ -1655,7 +1697,8 @@ use strict;
                                {
                                        anti => 1,
                                        name => 'Twin gatling cannon',
-                                       damage => [12 .. 15],
+                                       damage => 12,
+                                       upgrade => 1,
                                        cooldown => 1,
                                        range => 6,
                                },
@@ -1735,7 +1778,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Backlash rockets',
-                       damage => [12 .. 15],
+                       damage => 12,
+                       upgrade => 1,
                        type => 'projectile',
                        cooldown => 1.25,
                        count => 2,
@@ -1932,7 +1976,8 @@ use strict;
                {
                        anti => 1,
                        name => 'ATS laser batteries',
-                       damage => [8 .. 11],
+                       damage => 8,
+                       upgrade => 1,
                        cooldown => 0.225,
                        type => 'projectile',
                        range => 6,
@@ -1940,7 +1985,8 @@ use strict;
                {
                        anti => 2,
                        name => 'ATS laser batteries',
-                       damage => [6 .. 9],
+                       damage => 6,
+                       upgrade => 1,
                        cooldown => 0.225,
                        type => 'projectile',
                        range => 6,
@@ -2030,7 +2076,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Claws',
-                       damage => [4 .. 7],
+                       damage => 4,
+                       upgrade => 1,
                        cooldown => 1.0,
                        type => 'projectile', # except if range < 3
                        range => 5,
@@ -2039,7 +2086,8 @@ use strict;
                {
                        anti => 2,
                        name => 'Acid Spines',
-                       damage => [9 .. 12],
+                       damage => 9,
+                       upgrade => 1,
                        cooldown => 1.0,
                        type => 'projectile', # except if range < 3
                        range => 7,
@@ -2309,7 +2357,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Claws',
-                       damage => [5 .. 8],
+                       damage => 5,
+                       upgrade => 1,
                        cooldown => 0.696,
                },
        ],
@@ -2361,10 +2410,13 @@ use strict;
                {
                        anti => 1,
                        name => 'Volatile Burst',
-                       damage => [20, 22, 24, 26],
+                       damage => 20,
+                       upgrade => 2,
                        bonus => {
-                               light => [15, 17, 19, 21],
-                               structure => [60, 63, 66, 69],
+                               light => 15,
+                               -light => 2,
+                               structure => 60,
+                               -structure => 3,
                        },
                        splash => 1,
                        range => 0,
@@ -2405,7 +2457,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Acid Saliva', # Claws melee
-                       damage => [16, 18, 20, 22],
+                       damage => 16,
+                       upgrade => 2,
                        cooldown => 2.0,
                },
        ],
@@ -2463,7 +2516,8 @@ use strict;
                {
                        anti => 3,
                        name => 'Needle spines', # Scythe melee
-                       damage => [12 .. 15],
+                       damage => 12,
+                       upgrade => 1,
                        type => 'projectile', # except melee
                        cooldown => 0.75,
                        range => 5,
@@ -2641,7 +2695,8 @@ use strict;
                                {
                                        anti => 1,
                                        name => 'Acid Spit',
-                                       damage => [12 .. 15],
+                                       damage => 12,
+                                       upgrade => 1,
                                        type => 'projectile',
                                        cooldown => 0.6,
                                        range => 3,
@@ -2689,7 +2744,8 @@ use strict;
                {
                        anti => 3,
                        name => 'Glaive Wurm',
-                       damage => [9 .. 12],
+                       damage => 9,
+                       upgrade => 1,
                        splash => 'bounce',
                        psionic => 1,
                        cooldown => 1.5246,
@@ -2728,9 +2784,11 @@ use strict;
                {
                        anti => 2,
                        name => 'Parasite Spores',
-                       damage => [14 .. 17],
+                       damage => 14,
+                       upgrade => 1,
                        bonus => {
-                               massive => [6 .. 9],
+                               massive => 6,
+                               -massive => 1,
                        },
                        type => 'projectile',
                        cooldown => 1.9,
@@ -2773,7 +2831,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Broodling Strike',
-                       damage => [20, 22, 24, 26],
+                       damage => 20,
+                       upgrade => 2,
                        cooldown => 2.5,
                        range => 9.5,
                },
@@ -2801,7 +2860,8 @@ use strict;
                                {
                                        anti => 1,
                                        name => 'Claws',
-                                       damage => [4 .. 7],
+                                       damage => 4,
+                                       upgrade => 1,
                                        cooldown => 0.6455,
                                        range => 0,
                                },
@@ -2891,7 +2951,8 @@ use strict;
                {
                        anti => 1,
                        name => 'Kaiser Blades',
-                       damage => [35, 38, 41, 44],
+                       damage => 35,
+                       upgrade => 3,
                        splash => 1,
                        cooldown => 0.861,
                        range => 1,
diff --git a/sc.plp b/sc.plp
index f1632ee..3a11f0c 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -126,8 +126,7 @@ sub showrange {
                my $upattack = $row->{upgraded}->{attack}->[$area];
                my $damage = $attack->{damage};
                my $maxdamage = $upattack->{damage} // $damage;
-               $damage = $damage->[0] if ref $damage;
-               $maxdamage = $maxdamage->[-1] if ref $maxdamage;
+               $maxdamage += ($upattack->{upgrade} // $attack->{upgrade}) * 3;
 
                my $out = '<td class="val hurt">';
                $out .= "<small>$attack->{count}× </small>" if $attack->{count} > 1;
@@ -135,24 +134,27 @@ sub showrange {
                        if $attack->{type} eq 'explosive';
                $out .= '<span class="unit-s" title="implosive">~</span>'
                        if $attack->{type} eq 'implosive';
+       if (my @bonus = sort grep { !/^-/ } keys %{ $attack->{bonus} }) {
                $out .= sprintf('<span class="%s" title="%s">&ge;</span>',
                        (map {
-                               $_ =~ /^light/ ? 'unit-s' :
+                               $_ eq 'light' ? 'unit-s' :
                                $_ eq 'armored' ? 'unit-l' :
                                $_ eq 'organic' ? 'unit-o' :
-                               $_ =~ /^massive/ ? 'unit-h' :
+                               $_ eq 'massive' ? 'unit-h' :
                                $_ eq 'shields' ? 'unit-shield' :
                                '',
-                       } join '_', keys %{ $attack->{bonus} }),
+                       } join '_', @bonus),
                        join(', ', map {(
                                sprintf('+%s vs %s',
-                                       (map {
-                                               ref $_ ? showrange($_->[0], $_->[-1]) : $_
-                                       } $attack->{bonus}->{$_}),
+                                       showrange(
+                                               $attack->{bonus}->{$_},
+                                               $attack->{bonus}->{$_} + $attack->{bonus}->{"-$_"} * 3,
+                                       ),
                                        $_,
                                ),
-                       )} keys %{ $attack->{bonus} }),
-               ) if $attack->{bonus};
+                       )} @bonus),
+               );
+       }
                $out .= '<span class="unit-pdd" title="projectile">•</span>'
                        if $attack->{type} eq 'projectile';
 
@@ -179,7 +181,8 @@ sub showrange {
                        $damage *= ($attack->{count} // 1) / $attack->{cooldown};
                        if (my $bonus = $upattack->{bonus} // $attack->{bonus}) {
                                $maxdamage += $_ for max(
-                                       map { ref $_ ? $_->[-1] : $_ } values %{$bonus}
+                                       map { $bonus->{$_} + $bonus->{"-$_"} * 3 }
+                                       grep { !/^-/ } keys %{$bonus}
                                );
                        }
                        $maxdamage *= ($upattack->{count} // $attack->{count} // 1)
@@ -320,7 +323,7 @@ sub showrange {
                elsif ($get{order} eq 'attack') {
                        $_->{order} = $_->{hp} / 1024 + $_->{shield} / 1008 + max(
                                map {
-                                       ((map { ref $_ ? $_->[-1] : $_ } $_->{damage})[0])
+                                       ($_->{damage} + $_->{upgrade} * 3)
                                        * ($_->{count} // 1) / ($_->{cooldown} // 1)
                                        * ($_->{splash} ? 1.01 : 1)
                                        * ($_->{type} eq 'implosive' ? .96 : 1)