diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-15 15:52:21 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 096d811c5835c0d97dd687a68465e6d68adac675 (patch) | |
tree | 6a62bba001d0fb7d8ded650b20c9971ac5932d8d /tools | |
parent | 0659b78aa31e23c8feb6d4ff57a1cd349021b28f (diff) | |
download | table-battles-096d811c5835c0d97dd687a68465e6d68adac675.tar.gz |
Rocoux. Improved layout.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gendata.js | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/tools/gendata.js b/tools/gendata.js index 4f091b5..101a88e 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -29,7 +29,7 @@ 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" ] +const SQUEEZE_MARGINS = [ "91B", "239B", "274B", "291A", "69B" ] var cards = [ ] var card_index = {} @@ -113,16 +113,14 @@ for (let c of card_records) { card.actions = [] let squeeze = 0 - if (c.action1_effect && c.action2_effect && (c.rule_text || c.lore_text)) - squeeze |= 1 + if (c.action1_effect && c.action2_effect && (c.rule_text_2 || c.lore_text)) + squeeze = 1 else if (SQUEEZE_BOXES.includes(c.number)) - squeeze |= 1 - if (SQUEEZE_MARGINS.includes(c.number)) - squeeze |= 2 + squeeze = 1 - if (squeeze) { - card.squeeze = squeeze - result.push(`<div class="formation card squeeze${squeeze}">`) + if (SQUEEZE_MARGINS.includes(c.number)) { + card.squeeze = 1 + result.push(`<div class="formation card squeeze">`) } else { result.push(`<div class="formation card">`) } @@ -164,17 +162,19 @@ for (let c of card_records) { result.push(`<div class="dice_area">${c.dice}</div>`) } - function make_action(type, requirement, target, effect, rule_text) { + function make_action(type, requirement, target, effect, rule_text, short) { let a = { type } if (requirement) a.requirement = requirement if (target) a.target = target if (effect) a.effect = effect if (rule_text) a.rule_text = rule_text + if (short) a.short = 1 return a } if (c.action1_type) { - card.actions.push(make_action(c.action1_type, c.action1_req, c.action1_target, c.action1_effect, c.action1_rule_text)) + let short = c.action1_effect && (c.rule_text_1 || squeeze) + card.actions.push(make_action(c.action1_type, c.action1_req, c.action1_target, c.action1_effect, c.action1_rule_text, short)) result.push(`<div class="action_row">`) if (/Screen|Absorb|Counterattack/.test(c.action1_type)) result.push(`<div class="action_type reaction">${c.action1_type}</div>`) @@ -183,18 +183,22 @@ for (let c of card_records) { result.push(`<div class="action_requirement">${c.action1_req}</div>`) result.push(`<div class="action_target">${c.action1_target}</div>`) if (c.action1_effect) { - if (c.action1_rule_text) + if (c.rule_text_1 || squeeze) result.push(`<div class="action_effect short">${c.action1_effect}</div>`) else result.push(`<div class="action_effect">${c.action1_effect}</div>`) } result.push(`</div>`) - if (c.action1_rule_text) - result.push(`<div class="action_rule">${c.action1_rule_text}</div>`) + } + + if (c.rule_text_1) { + card.rule_text_1 = c.rule_text_1 + result.push(`<div class="rule_text">${c.rule_text_1}</div>`) } if (c.action2_type || c.action2_effect) { - card.actions.push(make_action(c.action2_type, c.action2_req, c.action2_target, c.action2_effect, c.action2_rule_text)) + let short = c.action2_effect && (c.rule_text_2 || squeeze) + card.actions.push(make_action(c.action2_type, c.action2_req, c.action2_target, c.action2_effect, c.action2_rule_text, short)) result.push(`<div class="action_row">`) if (/Screen|Absorb|Counterattack/.test(c.action2_type)) result.push(`<div class="action_type reaction">${c.action2_type}</div>`) @@ -203,14 +207,22 @@ for (let c of card_records) { result.push(`<div class="action_requirement">${c.action2_req}</div>`) result.push(`<div class="action_target">${c.action2_target}</div>`) if (c.action2_effect) { - if (c.action2_rule_text) + if (c.rule_text_2 || squeeze) result.push(`<div class="action_effect short">${c.action2_effect}</div>`) else result.push(`<div class="action_effect">${c.action2_effect}</div>`) } result.push(`</div>`) - if (c.action2_rule_text) - result.push(`<div class="rule_text">${c.action2_rule_text}</div>`) + } + + if (c.rule_text_2) { + card.rule_text_2 = c.rule_text_2 + result.push(`<div class="rule_text">${c.rule_text_2}</div>`) + } + + if (c.lore_text) { + card.lore_text = c.lore_text + result.push(`<div class="lore_text">${c.lore_text}</div>`) } if (c.rule) { @@ -225,16 +237,6 @@ for (let c of card_records) { } } - if (c.rule_text) { - card.rule_text = c.rule_text - result.push(`<div class="rule_text">${c.rule_text}</div>`) - } - - if (c.lore_text) { - card.lore_text = c.lore_text - result.push(`<div class="lore_text">${c.lore_text}</div>`) - } - if (c.reserve) { if (c.reserve === "RETIRE, Ward") { card.retire = 1 |