diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-14 15:12:03 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 1b3c32195d2741ac44aa35271b399c3fa2e6f2c2 (patch) | |
tree | 97a1c6b24aa2cdae40b1a872ae689e3e7fe98153 | |
parent | 55eae227cb5eb04d03814137ebe6f6a13a93c92c (diff) | |
download | table-battles-1b3c32195d2741ac44aa35271b399c3fa2e6f2c2.tar.gz |
Squeeze layout.
-rw-r--r-- | cards.css | 22 | ||||
-rw-r--r-- | play.js | 3 | ||||
-rw-r--r-- | rules.js | 9 | ||||
-rw-r--r-- | tools/gendata.js | 22 |
4 files changed, 45 insertions, 11 deletions
@@ -36,11 +36,6 @@ padding: 5px 0 5px 20px; } -.flip .dice_area .star { - float: left; - margin: 0 -48px 0 0; -} - .name.with_symbol { padding: 5px 0; } @@ -83,6 +78,10 @@ filter: drop-shadow( 0 0 2px linen ); } +.flip .symbol { + top: -4px; +} + .blue + .infantry { background-image: url(images/infantry1.png); } .blue + .cavalry { background-image: url(images/cavalry1.png); } .dkblue + .infantry { background-image: url(images/infantry1.png); } @@ -207,7 +206,7 @@ line-height: 12px; bottom: 0px; left: 0px; - padding: 8px 0; + padding: 7px 0; width: 240px; text-align: center; } @@ -230,7 +229,7 @@ line-height: 12px; bottom: 0px; right: 0px; - padding: 8px 8px; + padding: 6px 8px; } .extra { @@ -240,7 +239,7 @@ line-height: 12px; bottom: 0px; left: 0px; - padding: 8px 8px; + padding: 6px 8px; } /* SCENARIO CARD */ @@ -272,6 +271,13 @@ .scenario_line { padding-left: 24px; } +/* SQUEEZE CARDS WITH TOO MUCH INFO */ + +.squeeze1 .action_effect { min-height: 18px; } +.squeeze2 .action_row { margin: 12px 0 0 0 } +.squeeze3 .action_effect { min-height: 18px; } +.squeeze3 .action_row { margin: 6px 0 0 0 } + /* PRINT STYLE */ @media print { @@ -145,6 +145,9 @@ function create_formation_card(id) { let card = data.cards[id] let e = create_div("card formation " + wing_name[card.wing]) + if (card.squeeze) + e.classList.add("squeeze" + card.squeeze) + register_action(e, "card", id) if (card.infantry || card.cavalry) @@ -397,8 +397,14 @@ exports.setup = function (seed, scenario, options) { log(".h1 " + info.name) log(".h2 " + info.date) log("") + if (info.lore_text) { + for (let line of info.lore_text.split("<p>")) + log(line) + log("") + } if (info.rule_text) { - log(info.rule_text) + for (let line of info.rule_text.split("<p>")) + log(line) log("") } @@ -1578,6 +1584,7 @@ function require_two_pairs(c) { function check_cube_requirement(c, req) { switch (req) { case "3 cubes": + case "Three Cubes": return get_cubes(c) >= 3 case "Two Cubes": return get_cubes(c) >= 2 diff --git a/tools/gendata.js b/tools/gendata.js index d96d46e..1df67b1 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -24,6 +24,9 @@ h1{color: white} const WING = { red: 0, pink: 1, blue: 2, dkblue: 3 } const WING_ICON = [ "\u2666", "\u2665", "\u2663", "\u2660" ] +const SQUEEZE_BOXES = [ "82A", "128A", "136B" , "274B", "291A" ] +const SQUEEZE_MARGINS = [ "91B", "239B", "274B", "291A", "69B", "82A" ] + var cards = [ ] var card_index = {} var cards_show = [ ] @@ -83,7 +86,21 @@ for (let c of card_records) { card.dice = c.dice card.actions = [] - result.push(`<div class="formation card">`) + let squeeze = 0 + if (c.action1_effect && c.action2_effect && (c.rule_text || c.lore_text)) + squeeze |= 1 + else if (SQUEEZE_BOXES.includes(c.number)) + squeeze |= 1 + if (SQUEEZE_MARGINS.includes(c.number)) + squeeze |= 2 + + if (squeeze) { + card.squeeze = squeeze + result.push(`<div class="formation card squeeze${squeeze}">`) + } else { + result.push(`<div class="formation card">`) + } + if (c.symbol) result.push(`<div class="name with_symbol ${c.wing}">${c.name}</div>`) else @@ -200,7 +217,7 @@ for (let c of card_records) { if (card.retire && card.reserve) result.push(`<div class="reserve">RETIRE; RESERVE (${card.reserve.join(", ")})</div>`) else if (card.retire && card.pursuit) - result.push(`<div class="reserve">RETIRE, PURSUIT)})</div>`) + result.push(`<div class="reserve">RETIRE, PURSUIT</div>`) else if (card.retire) result.push(`<div class="reserve">RETIRE</div>`) else if (card.pursuit) @@ -376,6 +393,7 @@ for (let s of scenario_records) { ], rule: s.rule || undefined, rule_text: s.rule_text || undefined, + lore_text: s.lore_text || undefined, }) result.push(` <div id="scenario_${s.number}" class="scenario card"> |