summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-12 17:29:58 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit2b50d84d843bf2c1bff54393aa4421543d8134d9 (patch)
treebadbecaa71fdf4aab2a060fa296c20fa4378ac5c
parent6195f24fc7abb0453356464a1f923a699e89da00 (diff)
downloadtable-battles-2b50d84d843bf2c1bff54393aa4421543d8134d9.tar.gz
symbols
-rw-r--r--cards.css11
-rw-r--r--play.html13
-rw-r--r--play.js15
-rw-r--r--tools/gendata.js8
4 files changed, 31 insertions, 16 deletions
diff --git a/cards.css b/cards.css
index 1920573..2c79bbb 100644
--- a/cards.css
+++ b/cards.css
@@ -26,12 +26,20 @@
border-top: 1px solid black;
border-bottom: 1px solid black;
margin: 10px 0 12px 0;
- padding: 5px 30px 5px 0;
+ padding: 5px 20px 5px 0;
text-align: center;
font-size: 16px;
line-height: 16px;
}
+.flip .name {
+ padding: 5px 0 5px 20px;
+}
+
+.name.with_symbol {
+ padding: 5px 0;
+}
+
.name.red { background-color: #e32223; color: white; }
.name.pink { background-color: #f49899; color: black; }
.name.blue { background-color: #2482e4; color: white; }
@@ -66,6 +74,7 @@
width: 45px;
height: 63px;
background-size: contain;
+ z-index: 1;
filter: drop-shadow( 0 0 2px linen );
}
diff --git a/play.html b/play.html
index beca89f..444b3ae 100644
--- a/play.html
+++ b/play.html
@@ -172,10 +172,6 @@ main {
flex-direction: row-reverse;
}
-.flip .card, .flip .card > div {
- transform: rotate(180deg);
-}
-
.card {
box-shadow: 1px 2px 8px #0008;
}
@@ -184,9 +180,12 @@ main {
box-shadow: -1px -2px 8px #0008;
}
-.flip .card .strength {
- left: 6px;
- right: unset;
+.flip .card, .flip .card > div {
+ transform: rotate(180deg);
+}
+
+.flip .card > div.link {
+ transform: none;
}
.table_separator {
diff --git a/play.js b/play.js
index 32093f3..6b3cd81 100644
--- a/play.js
+++ b/play.js
@@ -139,7 +139,15 @@ function create_formation_card(id) {
register_action(e, "card", id)
- append_div(e, "name " + wing_name[card.wing], card.name)
+ if (card.infantry || card.cavalry)
+ append_div(e, "name with_symbol " + wing_name[card.wing], card.name)
+ else
+ append_div(e, "name " + wing_name[card.wing], card.name)
+
+ if (card.infantry)
+ append_div(e, "symbol infantry")
+ if (card.cavalry)
+ append_div(e, "symbol cavalry")
if (card.special === 1)
append_div(e, "strength", "I")
@@ -150,11 +158,6 @@ function create_formation_card(id) {
else
append_div(e, "strength", card.strength)
- if (card.infantry)
- append_div(e, "symbol infantry")
- if (card.cavalry)
- append_div(e, "symbol cavalry")
-
if (card.link) {
if (set_has(card.link, id - 1))
append_div(e, "link left")
diff --git a/tools/gendata.js b/tools/gendata.js
index 07f58c0..98e4f20 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -73,7 +73,10 @@ for (let c of card_records) {
card.actions = []
result.push(`<div class="formation card">`)
- result.push(`<div class="name ${c.wing}">${c.name}</div>`)
+ if (c.symbol)
+ result.push(`<div class="name with_symbol ${c.wing}">${c.name}</div>`)
+ else
+ result.push(`<div class="name ${c.wing}">${c.name}</div>`)
if (c.symbol === "inf") {
card.infantry = 1
@@ -352,7 +355,8 @@ for (let s of scenario_records) {
{ name: s.player1, cards: parse_cards(s.cards1), morale: parseInt(s.morale1), tactical: parseInt(s.tactical1) },
{ name: s.player2, cards: parse_cards(s.cards2), morale: parseInt(s.morale2), tactical: parseInt(s.tactical2) },
],
- rule: s.rule || undefined
+ rule: s.rule || undefined,
+ rule_text: s.rule_text || undefined,
})
result.push(`
<div id="scenario_${s.number}" class="scenario card">