summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cards.css3
-rw-r--r--play.js18
-rw-r--r--rules.js11
-rw-r--r--tools/gendata.js23
4 files changed, 40 insertions, 15 deletions
diff --git a/cards.css b/cards.css
index b7506d3..27f0a22 100644
--- a/cards.css
+++ b/cards.css
@@ -129,10 +129,13 @@
line-height: 24px;
text-align: center;
margin: 12px 0;
+ font-variant-numeric: tabular-nums;
}
+/*
.dice_area::before { content: " ~ " }
.dice_area::after { content: " ~ " }
+*/
.star {
position: absolute;
diff --git a/play.js b/play.js
index 22e7da3..23468a3 100644
--- a/play.js
+++ b/play.js
@@ -2,6 +2,17 @@
/* global data, view, send_action, action_button, player */
+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)",
+}
+
const wing_name = [ "red", "pink", "blue", "dkblue" ]
const side_color = [ "red", "red", "blue", "blue" ]
const reactions = [ "Screen", "Counterattack", "Absorb" ]
@@ -199,9 +210,14 @@ function create_formation_card(id, tip=false) {
}
if (card.dice) {
+ let dice_text = dice_text_map[card.dice] || card.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)
append_div(e, "star", '★')
- append_div(e, "dice_area", card.dice)
+ append_div(e, "dice_area", dice_text)
}
function create_action(a, ix) {
diff --git a/rules.js b/rules.js
index dbca499..93e8a80 100644
--- a/rules.js
+++ b/rules.js
@@ -991,12 +991,10 @@ const place_dice_check = {
"Any": (c) => check_range(c, 1, 6),
"1/2": (c) => check_range(c, 1, 2),
"1-3": (c) => check_range(c, 1, 3),
- "1/2/3": (c) => check_range(c, 1, 3),
"1-4": (c) => check_range(c, 1, 4),
"1-5": (c) => check_range(c, 1, 5),
"2/3": (c) => check_range(c, 2, 2),
"2-4": (c) => check_range(c, 2, 4),
- "2/3/4": (c) => check_range(c, 2, 4),
"2-5": (c) => check_range(c, 2, 5),
"2-6": (c) => check_range(c, 2, 6),
"3/4": (c) => check_range(c, 3, 4),
@@ -1004,7 +1002,6 @@ const place_dice_check = {
"3-6": (c) => check_range(c, 3, 6),
"4/5": (c) => check_range(c, 4, 5),
"4-6": (c) => check_range(c, 4, 6),
- "4/5/6": (c) => check_range(c, 4, 6),
"5/6": (c) => check_range(c, 5, 6),
"(1/2)": (c) => check_range(c, 1, 2),
"(1-3)": (c) => check_range(c, 1, 3),
@@ -1044,21 +1041,17 @@ const place_dice_gen = {
"Any": (c) => gen_range(c, 1, 6),
"1/2": (c) => gen_range(c, 1, 2),
"1-3": (c) => gen_range(c, 1, 3),
- "1/2/3": (c) => gen_range(c, 1, 3),
"1-4": (c) => gen_range(c, 1, 4),
"1-5": (c) => gen_range(c, 1, 5),
"2/3": (c) => gen_range(c, 2, 2),
"2-4": (c) => gen_range(c, 2, 4),
- "2/3/4": (c) => gen_range(c, 2, 4),
"2-5": (c) => gen_range(c, 2, 5),
"2-6": (c) => gen_range(c, 2, 6),
"3/4": (c) => gen_range(c, 3, 4),
"3-5": (c) => gen_range(c, 3, 5),
- "3/4/5": (c) => gen_range(c, 3, 5),
"3-6": (c) => gen_range(c, 3, 6),
"4/5": (c) => gen_range(c, 4, 5),
"4-6": (c) => gen_range(c, 4, 6),
- "4/5/6": (c) => gen_range(c, 4, 6),
"5/6": (c) => gen_range(c, 5, 6),
"(1/2)": (c) => gen_range(c, 1, 2),
"(1-3)": (c) => gen_range(c, 1, 3),
@@ -1098,21 +1091,17 @@ const place_dice_take = {
"Any": (c, d) => take_single(c, d),
"1/2": (c, d) => take_single(c, d),
"1-3": (c, d) => take_single(c, d),
- "1/2/3": (c, d) => take_single(c, d),
"1-4": (c, d) => take_single(c, d),
"1-5": (c, d) => take_single(c, d),
"2/3": (c, d) => take_single(c, d),
"2-4": (c, d) => take_single(c, d),
- "2/3/4": (c, d) => take_single(c, d),
"2-5": (c, d) => take_single(c, d),
"2-6": (c, d) => take_single(c, d),
"3/4": (c, d) => take_single(c, d),
"3-5": (c, d) => take_single(c, d),
- "3/4/5": (c, d) => take_single(c, d),
"3-6": (c, d) => take_single(c, d),
"4/5": (c, d) => take_single(c, d),
"4-6": (c, d) => take_single(c, d),
- "4/5/6": (c, d) => take_single(c, d),
"5/6": (c, d) => take_single(c, d),
"(1/2)": (c, d) => take_single(c, d),
"(1-3)": (c, d) => take_single(c, d),
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("-", "&thinsp;&minus;&thinsp;")
+ dice_text = dice_text.replaceAll("/", "&hairsp;/&hairsp;")
+ dice_text = dice_text.replace("(", "(&thinsp;")
+ dice_text = dice_text.replace(")", "&thinsp;)")
if (card.morale === 2)
html.push(`<div class="star">&#x2605;</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("-","&hairsp;&ndash;&hairsp;")}</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("-","&hairsp;&ndash;&hairsp;")}</div>
<div class="scenario_line">Morale: ${s.morale2}</div>
<div class="scenario_line">${s.name !== "Fleurus" && s.tactical2 ? "Tactical Victory: " + s.tactical2 : ""}</div>
</div>