From c09dbeb9c62930fc46ec793d4f18eda815cd8c34 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 13 Jun 2015 06:09:47 +0200 Subject: [PATCH] sc: hots attributes hash (attr) In sc2, damage vulnerabilities are a more complex combination of booleans. While no units are currently both Light and Armored, most properties do not conflict with each other, and any amount can apply regardlessly. --- sc-units-hots.inc.pl | 416 ++++++++++++++++++++++++++++--------------- sc.css | 11 ++ sc.plp | 41 +++-- 3 files changed, 311 insertions(+), 157 deletions(-) diff --git a/sc-units-hots.inc.pl b/sc-units-hots.inc.pl index fe82fba..022b69c 100644 --- a/sc-units-hots.inc.pl +++ b/sc-units-hots.inc.pl @@ -20,8 +20,10 @@ use strict; armor => 0, hp => 20, shield => 20, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, attack => { ground => { damage => 5, @@ -46,7 +48,9 @@ use strict; armor => 1, hp => 150, shield => 150, - suit => 3, # armored + attr => { + armored => 1, + }, structure => 1, attack => { ground => { @@ -74,9 +78,11 @@ use strict; armor => 1, hp => 130, shield => 60, - suit => 3, # armored - organic => 0, # mech - psionic => 1, + attr => { + armored => 1, + mech => 1, + psionic => 1, + }, attack => { ground => { damage => [8 .. 11], @@ -102,10 +108,12 @@ use strict; armor => 2, hp => 350, shield => 350, - suit => 3, # armored - organic => 0, # mech - psionic => 1, - massive => 1, + attr => { + armored => 1, + mech => 1, + psionic => 1, + massive => 1, + }, attack => { ground => { damage => [6 .. 9], @@ -133,7 +141,9 @@ use strict; armor => 1, hp => 1000, shield => 1000, - suit => 3, # armored + attr => { + armored => 1, + }, structure => 1, attack => { ground => { @@ -162,8 +172,10 @@ use strict; armor => 1, hp => 100, shield => 50, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => [8 .. 11], @@ -196,9 +208,11 @@ use strict; armor => 1, hp => 40, shield => 40, - suit => 1, # light - organic => 0, # mech - psionic => 1, + attr => { + light => 1, + mech => 1, + psionic => 1, + }, attack => { ground => { damage => [6 .. 9], @@ -226,8 +240,10 @@ use strict; armor => 1, hp => 80, shield => 80, - suit => 3, # armored - organic => 0, # mech + attr => { + armored => 1, + mech => 1, + }, attack => { ground => { damage => [10 .. 13], @@ -257,9 +273,11 @@ use strict; armor => 0, hp => 40, shield => 40, - suit => 1, # light - organic => 1, - psionic => 1, + attr => { + light => 1, + psionic => 1, + organic => 1, + }, speed => 1.875, sight => 10, }, @@ -278,9 +296,11 @@ use strict; armor => 1, hp => 40, shield => 80, - suit => 1, # light - organic => 1, - psionic => 1, + attr => { + light => 1, + organic => 1, + psionic => 1, + }, attack => { ground => { damage => [45, 50, 55, 60], @@ -307,8 +327,10 @@ use strict; armor => 0, hp => 10, shield => 350, - psionic => 1, - massive => 1, + attr => { + psionic => 1, + massive => 1, + }, attack => { ground => { damage => [25, 28, 31, 34], @@ -337,8 +359,10 @@ use strict; armor => 1, hp => 200, shield => 100, - suit => 3, # armored - organic => 0, # mech + attr => { + armored => 1, + mech => 1, + }, attack => { ground => { damage => [20, 22, 24, 26], @@ -365,9 +389,11 @@ use strict; armor => 1, hp => 200, shield => 150, - suit => 3, # armored - organic => 0, # mech - massive => 1, + attr => { + armored => 1, + mech => 1, + massive => 1, + }, attack => { ground => { damage => [15, 17, 19, 21], @@ -400,8 +426,10 @@ use strict; armor => 0, hp => 40, shield => 20, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, speed => 1.875, upgrade => [ { @@ -424,9 +452,11 @@ use strict; armor => 0, hp => 100, shield => 100, - suit => 3, # armored - organic => 0, # mech - psionic => 1, + attr => { + armored => 1, + mech => 1, + psionic => 1, + }, speed => 2.9531, upgrade => [ { @@ -449,8 +479,10 @@ use strict; armor => 0, hp => 120, shield => 60, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, attack => { air => { damage => [5 .. 8], @@ -484,8 +516,10 @@ use strict; armor => 0, hp => 150, shield => 100, - suit => 3, # armored - organic => 0, # mech + attr => { + armored => 1, + mech => 1, + }, attack => { ground => { damage => [6 .. 9], @@ -513,9 +547,11 @@ use strict; armor => 0, hp => 100, shield => 60, - suit => 1, # light - organic => 0, # mech - psionic => 1, + attr => { + light => 1, + mech => 1, + psionic => 1, + }, attack => { ground => { name => 'Pulsar Beam', @@ -544,9 +580,11 @@ use strict; armor => 2, hp => 120, shield => 60, - suit => 3, # armored - organic => 0, # mech - massive => 1, + attr => { + armored => 1, + mech => 1, + massive => 1, + }, attack => { ground => { damage => [30, 33, 36, 39], @@ -575,9 +613,11 @@ use strict; armor => 2, hp => 300, shield => 150, - suit => 3, # armored - organic => 0, # mech - massive => 1, + attr => { + armored => 1, + mech => 1, + massive => 1, + }, attack => { range => 8, }, @@ -595,8 +635,10 @@ use strict; armor => 0, hp => 40, shield => 40, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, attack => { ground => { damage => [5 .. 8], @@ -629,9 +671,11 @@ use strict; cargo => 1, armor => 0, hp => 45, - suit => 1, # light - organic => 1, - organic => 0, # mech + attr => { + light => 1, + organic => 1, + mech => 1, + }, attack => { ground => { damage => 5, @@ -654,8 +698,10 @@ use strict; size => 0.75, armor => 0, hp => 60, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, speed => 2.8, sight => 8, }, @@ -672,8 +718,10 @@ use strict; cargo => 0, armor => 0, hp => 250, - suit => 3, # armored - organic => 0, # mech + attr => { + armored => 1, + mech => 1, + }, structure => 1, attack => { air => { @@ -708,8 +756,10 @@ use strict; cargo => 0, armor => 3, hp => 1500, - suit => 3, # armored - organic => 0, # mech + attr => { + armored => 1, + mech => 1, + }, structure => 1, attack => { ground => { @@ -746,8 +796,10 @@ use strict; cargo => 1, armor => 0, hp => 45, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => [6 .. 9], @@ -795,8 +847,10 @@ use strict; cargo => 2, armor => 1, hp => 125, - suit => 3, # armored - organic => 1, + attr => { + armored => 1, + organic => 1, + }, attack => { ground => { damage => [10 .. 13], @@ -838,8 +892,10 @@ use strict; cargo => 1, armor => 0, hp => 60, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => [4 .. 7], @@ -865,8 +921,10 @@ use strict; cargo => 2, armor => 0, hp => 100, - organic => 1, - psionic => 1, + attr => { + organic => 1, + psionic => 1, + }, attack => { ground => { damage => [10 .. 13], @@ -893,8 +951,10 @@ use strict; cargo => 2, armor => 0, hp => 90, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, attack => { ground => { damage => [8 .. 11], @@ -921,9 +981,11 @@ use strict; cargo => 4, armor => 0, hp => 135, - suit => 1, # light - organic => 1, - organic => 0, # mech + attr => { + light => 1, + organic => 1, + mech => 1, + }, attack => { ground => { damage => [18, 20, 22, 24], @@ -950,8 +1012,10 @@ use strict; cargo => 2, armor => 0, hp => 90, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, attack => { ground => { damage => 125, @@ -977,8 +1041,10 @@ use strict; cargo => 4, armor => 1, hp => 160, - suit => 3, # armored - organic => 0, # mech + attr => { + armored => 1, + mech => 1, + }, attack => { ground => { damage => [15, 17, 19, 21], @@ -1023,9 +1089,11 @@ use strict; cargo => 8, armor => 1, hp => 400, - suit => 3, # armored - organic => 0, # mech - massive => 1, + attr => { + armored => 1, + mech => 1, + massive => 1, + }, attack => { ground => { damage => [30, 33, 36, 39], @@ -1069,8 +1137,10 @@ use strict; cargo => 0, armor => 0, hp => 125, - suit => 3, # armored - organic => 0, # mech + attr => { + armored => 1, + mech => 1, + }, attack => { air => { damage => [10 .. 13], @@ -1115,8 +1185,10 @@ use strict; cargo => 0, armor => 1, hp => 150, - suit => 3, # armored - organic => 0, # mech + attr => { + armored => 1, + mech => 1, + }, speed => 2.5, upgrade => [ { @@ -1138,8 +1210,10 @@ use strict; cargo => 0, armor => 0, hp => 140, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, attack => { ground => { damage => [12 .. 15], @@ -1166,8 +1240,10 @@ use strict; cargo => 0, armor => 1, hp => 140, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, speed => 2.25, sight => 11, special => [ @@ -1177,8 +1253,10 @@ use strict; cargo => 0, armor => 1, hp => 150, - suit => 3, # armored - organic => 0, # mech + attr => { + armored => 1, + mech => 1, + }, structure => 1, attack => { ground => { @@ -1205,8 +1283,10 @@ use strict; cargo => 0, armor => 0, hp => 50, - suit => 1, # light - organic => 0, # mech + attr => { + light => 1, + mech => 1, + }, structure => 1, cooldown => 0, attack => { @@ -1237,9 +1317,11 @@ use strict; cargo => 0, armor => 3, hp => 550, - suit => 3, # armored - organic => 0, # mech - massive => 1, + attr => { + armored => 1, + mech => 1, + massive => 1, + }, attack => { ground => { damage => [8 .. 11], @@ -1271,8 +1353,10 @@ use strict; cargo => 1, armor => 0, hp => 40, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => 5, @@ -1298,8 +1382,10 @@ use strict; cargo => 2, armor => 1, hp => 175, - organic => 1, - psionic => 1, + attr => { + organic => 1, + psionic => 1, + }, attack => { ground => { damage => [4 .. 7], @@ -1334,8 +1420,10 @@ use strict; cargo => -8, armor => 0, hp => 200, - suit => 3, # armored - organic => 1, + attr => { + armored => 1, + organic => 1, + }, speed => 0.586, creep => 0, sight => 11, @@ -1359,8 +1447,10 @@ use strict; cargo => 0, armor => 1, hp => 200, - suit => 3, # armored - organic => 1, + attr => { + armored => 1, + organic => 1, + }, speed => 1.875, creep => 0, sight => 11, @@ -1372,8 +1462,10 @@ use strict; cargo => 0, armor => 0, hp => 5, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, speed => 2.25, creep => 1.0, sight => 8, @@ -1396,8 +1488,10 @@ use strict; cargo => 0, armor => 10, hp => 25, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, speed => 0.5625, creep => 1.0, sight => 5, @@ -1415,8 +1509,10 @@ use strict; cargo => 0, armor => 2, hp => 300, - suit => 3, # armored - organic => 1, + attr => { + armored => 1, + organic => 1, + }, structure => 1, attack => { ground => { @@ -1444,8 +1540,10 @@ use strict; cargo => 0, armor => 1, hp => 400, - suit => 3, # armored - organic => 1, + attr => { + armored => 1, + organic => 1, + }, structure => 1, attack => { air => { @@ -1474,8 +1572,10 @@ use strict; cargo => 1, armor => 0, hp => 35, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => [5 .. 8], @@ -1515,7 +1615,9 @@ use strict; cargo => 2, armor => 0, hp => 30, - organic => 1, + attr => { + organic => 1, + }, attack => { ground => { damage => [20, 22, 24, 26], @@ -1546,8 +1648,10 @@ use strict; cargo => 2, armor => 1, hp => 145, - suit => 3, # armored - organic => 1, + attr => { + armored => 1, + organic => 1, + }, attack => { ground => { damage => [16, 18, 20, 22], @@ -1578,8 +1682,10 @@ use strict; cargo => 2, armor => 0, hp => 80, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => [12 .. 15], @@ -1618,9 +1724,11 @@ use strict; cargo => 2, armor => 0, hp => 90, - suit => 3, # armored - organic => 1, - psionic => 1, + attr => { + armored => 1, + organic => 1, + psionic => 1, + }, speed => 2.25, creep => 1.3, sight => 10, @@ -1632,8 +1740,10 @@ use strict; cargo => 0, armor => 0, hp => 50, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => 8, @@ -1662,8 +1772,10 @@ use strict; cargo => 0, armor => 1, hp => 200, - suit => 3, # armored - organic => 1, + attr => { + armored => 1, + organic => 1, + }, structure => 1, speed => 0, sight => 10, @@ -1681,8 +1793,10 @@ use strict; cargo => 4, armor => 1, hp => 160, - suit => 3, # armored - organic => 1, + attr => { + armored => 1, + organic => 1, + }, attack => { ground => { dps => [27.9, 30.2, 32.5, 34.8], @@ -1701,8 +1815,10 @@ use strict; cargo => 0, armor => 0, hp => 65, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => [12 .. 15], @@ -1732,8 +1848,10 @@ use strict; cargo => 0, armor => 0, hp => 120, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => [9 .. 12], @@ -1761,8 +1879,10 @@ use strict; cargo => 0, armor => 2, hp => 200, - suit => 3, # armored - organic => 1, + attr => { + armored => 1, + organic => 1, + }, attack => { air => { damage => [14 .. 17], @@ -1790,9 +1910,11 @@ use strict; cargo => 0, armor => 1, hp => 225, - suit => 3, # armored - organic => 1, - massive => 1, + attr => { + armored => 1, + organic => 1, + massive => 1, + }, attack => { ground => { damage => [20, 22, 24, 26], @@ -1813,8 +1935,10 @@ use strict; cargo => 0, armor => 0, hp => 30, - suit => 1, # light - organic => 1, + attr => { + light => 1, + organic => 1, + }, attack => { ground => { damage => [4 .. 7], @@ -1842,9 +1966,11 @@ use strict; cargo => 0, armor => 1, hp => 150, - suit => 3, # armored - organic => 1, - psionic => 1, + attr => { + armored => 1, + organic => 1, + psionic => 1, + }, speed => 2.9531, sight => 11, }, @@ -1861,9 +1987,11 @@ use strict; cargo => 8, armor => 1, hp => 500, - suit => 3, # armored - organic => 1, - massive => 1, + attr => { + armored => 1, + organic => 1, + massive => 1, + }, attack => { ground => { damage => [35, 38, 41, 44], diff --git a/sc.css b/sc.css index f85e7ac..b8e3981 100644 --- a/sc.css +++ b/sc.css @@ -31,8 +31,15 @@ table h2 { font-weight: normal; } +.units td.unit { + padding-right: 0; +} +.units td.unit + td.unit { + padding-left: 0; +} .unit-o {color: #C08} /* organic */ .unit-u {color: #44C} /* mechanic */ +.unit-p {color: #0A8} /* psionic */ .unit-composed { color: #C88; font-size: 70%; @@ -48,6 +55,7 @@ table h2 { content: '*'; color: #C66; } +.unit-massive, .hurt .unit-splash { position: absolute; } @@ -59,6 +67,9 @@ table h2 { .unit-splash { color: #4A0; } +.unit-massive { + color: #A76; +} .unit-detect::before { content: '!'; color: #0A8; diff --git a/sc.plp b/sc.plp index cf2155f..0534c04 100644 --- a/sc.plp +++ b/sc.plp @@ -63,7 +63,7 @@ sub coltoggle { min gas <:= coltoggle(qw'build cost') :> - <:= coltoggle(qw'size size') :> + <:= coltoggle(qw'size size') :> HP shield armor @@ -178,14 +178,20 @@ sub showval { local $_ = $row; $_->{hp} += $_->{shield} if $_->{shield}; my $suitchar = ''; - if ($_->{cargo} > 0) { + if ($_->{suit}) { + $suitchar = [qw/? s m l/]->[$_->{suit}]; + } + elsif ($_->{cargo} > 0) { $suitchar = [qw/? s m l l h h h h/]->[abs $_->{cargo}]; } elsif ($_->{size}) { $suitchar = [qw/s m l h h h/]->[$_->{size}]; } - elsif ($_->{suit}) { - $suitchar = [qw/? s m l/]->[$_->{suit}]; + elsif ($_->{attr} and $_->{attr}->{light}) { + $suitchar = 's'; + } + elsif ($_->{attr} and $_->{attr}->{armored}) { + $suitchar = 'l'; } return ( @@ -196,14 +202,22 @@ sub showval { $_->{build} || '0', ), !$suitchar ? '' : sprintf('%s', $suitchar, ucfirst $suitchar), - '' . join('', - defined $_->{unit} && $_->{unit} == .5 ? '½' : $_->{unit}, - defined $_->{organic} && sprintf( - '%s', - $_->{organic} ? 'o' : 'u', - $_->{organic} ? 'organic' : 'mechanic', - $_->{organic} ? 'o' : 'm', - ), + '' . ( + defined $_->{unit} && $_->{unit} == .5 ? '½' : $_->{unit} + ), + '' . join('', grep { $_ } + (defined $_->{organic} || $_->{attr}->{organic}) + && 'o', + (defined $_->{organic} ? !$_->{organic} : $_->{attr}->{mech}) + && 'm', + $_->{attr}->{psionic} + && 'ψ', + ), + '' . join('', grep { $_ } + $_->{attr}->{armored} + && 'A', + $_->{attr}->{light} + && 'L', ), '' . $_->{hp} // '', '' . ( @@ -218,6 +232,7 @@ sub showval { showval($_, 'sight') ), '' . showval($_, 'speed'), + $_->{attr}->{massive} && '☇', '' . showmagic($_), "\n" ); @@ -243,7 +258,7 @@ sub showval { my ($race, $cat) = ('', ''); for (@rows) { if ($grouped) { - printf '

%s

'."\n", + printf '

%s

'."\n", $race = $_->{race}, ucfirst $race unless $race eq $_->{race}; } -- 2.30.0