From 1b3c32195d2741ac44aa35271b399c3fa2e6f2c2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 14 Dec 2023 15:12:03 +0100 Subject: Squeeze layout. --- cards.css | 22 ++++++++++++++-------- play.js | 3 +++ rules.js | 9 ++++++++- tools/gendata.js | 22 ++++++++++++++++++++-- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/cards.css b/cards.css index f5cd39b..f98f255 100644 --- a/cards.css +++ b/cards.css @@ -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 { diff --git a/play.js b/play.js index 7deb683..6f7447d 100644 --- a/play.js +++ b/play.js @@ -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) diff --git a/rules.js b/rules.js index 3565d67..63730af 100644 --- a/rules.js +++ b/rules.js @@ -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("

")) + log(line) + log("") + } if (info.rule_text) { - log(info.rule_text) + for (let line of info.rule_text.split("

")) + 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(`

`) + 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(`
`) + } else { + result.push(`
`) + } + if (c.symbol) result.push(`
${c.name}
`) else @@ -200,7 +217,7 @@ for (let c of card_records) { if (card.retire && card.reserve) result.push(`
RETIRE; RESERVE (${card.reserve.join(", ")})
`) else if (card.retire && card.pursuit) - result.push(`
RETIRE, PURSUIT)})
`) + result.push(`
RETIRE, PURSUIT
`) else if (card.retire) result.push(`
RETIRE
`) 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(`
-- cgit v1.2.3