diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-01-08 13:49:08 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 7111623b8bff1d8f616e56dca131d65b0d7761ea (patch) | |
tree | 4bdaf234c54da079cc88248cf6509fc36018947b /tools/gendata.js | |
parent | ba60397ac0ae4b12d1b731f2b74fab4f1ddbf188 (diff) | |
download | table-battles-7111623b8bff1d8f616e56dca131d65b0d7761ea.tar.gz |
Use 1-3 in data (and map to 1/2/3 in display).
Diffstat (limited to 'tools/gendata.js')
-rw-r--r-- | tools/gendata.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tools/gendata.js b/tools/gendata.js index bc7c996..cb938e1 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -12,6 +12,17 @@ const WING_ICON = [ "\u2666", "\u2665", "\u2663", "\u2660" ] const SQUEEZE_BOXES = [ "82A", "128A", "136B" , "274B", "291A" ] const SQUEEZE_MARGINS = [ "91B", "239B", "274B", "291A", "69B" ] +const dice_text_map = { + "1-3": "1/2/3", + "2-4": "2/3/4", + "3-5": "3/4/5", + "4-6": "4/5/6", + "(1-3)": "(1/2/3)", + "(2-4)": "(2/3/4)", + "(3-5)": "(3/4/5)", + "(4-6)": "(4/5/6)", +} + var cards = [ ] var card_index = {} var cards_show = [ ] @@ -42,6 +53,7 @@ function get_html_effect(effect) { effect = effect.replace(" If reduced to", "<br>If reduced to") effect = effect.replace(" Take dice", "<br>Take dice") effect = effect.replace(" (See", "<br>(See") + effect = effect.replace(" You CHOOSE", "<br>You CHOOSE") return effect } @@ -224,9 +236,14 @@ for (let c of card_records) { } if (c.dice) { + let dice_text = dice_text_map[c.dice] || c.dice + dice_text = dice_text.replaceAll("-", " − ") + dice_text = dice_text.replaceAll("/", " / ") + dice_text = dice_text.replace("(", "( ") + dice_text = dice_text.replace(")", " )") if (card.morale === 2) html.push(`<div class="star">★</div>`) - html.push(`<div class="dice_area">${c.dice}</div>`) + html.push(`<div class="dice_area">${dice_text}</div>`) } function make_action(type, requirement, target, effect, rule_text, short) { @@ -545,13 +562,13 @@ for (let s of scenario_records) { </div> <div class="scenario_player"> <div class="scenario_player_name">${s.player1}</div> -<div class="scenario_line">Cards ${s.cards1}</div> +<div class="scenario_line">Cards ${s.cards1.replace(",",", ").replaceAll("-"," – ")}</div> <div class="scenario_line">Morale: ${s.morale1}</div> <div class="scenario_line">${s.tactical1 ? "Tactical Victory: " + s.tactical1 : ""}</div> </div> <div class="scenario_player"> <div class="scenario_player_name">${s.player2}</div> -<div class="scenario_line">Cards ${s.cards2}</div> +<div class="scenario_line">Cards ${s.cards2.replace(",",", ").replaceAll("-"," – ")}</div> <div class="scenario_line">Morale: ${s.morale2}</div> <div class="scenario_line">${s.name !== "Fleurus" && s.tactical2 ? "Tactical Victory: " + s.tactical2 : ""}</div> </div> |