summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-01-08 13:49:08 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit7111623b8bff1d8f616e56dca131d65b0d7761ea (patch)
tree4bdaf234c54da079cc88248cf6509fc36018947b /play.js
parentba60397ac0ae4b12d1b731f2b74fab4f1ddbf188 (diff)
downloadtable-battles-7111623b8bff1d8f616e56dca131d65b0d7761ea.tar.gz
Use 1-3 in data (and map to 1/2/3 in display).
Diffstat (limited to 'play.js')
-rw-r--r--play.js18
1 files changed, 17 insertions, 1 deletions
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("-", "&thinsp;&ndash;&thinsp;")
+ dice_text = dice_text.replaceAll("/", "&hairsp;/&hairsp;")
+ dice_text = dice_text.replace("(", "(&thinsp;")
+ dice_text = dice_text.replace(")", "&thinsp;)")
if (card.morale === 2)
append_div(e, "star", '&#x2605;')
- append_div(e, "dice_area", card.dice)
+ append_div(e, "dice_area", dice_text)
}
function create_action(a, ix) {