sc: separate shield and hp values in data
[sheet.git] / sc.plp
diff --git a/sc.plp b/sc.plp
index 873c75b6964c71a95ec178e9c507ceacd92dcac2..9a9a12a2e8af7ac4ff7e9e0e14382ac077404bcd 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -269,6 +269,7 @@ sub showrange {
                printf '<tbody id="%s"><tr class="race"><th colspan="18"><h2>%s</h2>'."\n", $race, ucfirst $race
                        if $grouped and $race ne $_->{race};
                $_->{cat} = $_->{race} if not $grouped;
+               $_->{hp} += $_->{shield};
                my $suitchar = [qw/? s m l/]->[$_->{suit}];
                print(
                        '<tr>',
@@ -291,7 +292,9 @@ sub showrange {
                                ),
                        ),
                        '<td class="val unit-hp">' . $_->{hp},
-                       '<td class="val unit-shield">' . ($_->{shield} ? $_->{shield}.'%' : '&nbsp;'),
+                       '<td class="val unit-shield">' . (
+                               $_->{shield} ? sprintf('%.0f%%', 100 * $_->{shield} / $_->{hp}) : '&nbsp;'
+                       ),
                        '<td class="val unit-armor">' . showrange($_, 'armor'),
                        showattack($_, 'ground'),
                        showattack($_, 'air'),