summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-25 18:59:33 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-25 18:59:35 +0100
commitf6ff8ae9365d20e2ccd196dc615a6015343db037 (patch)
treeaf2c38c21213af0c093726237654daeecfab3b86 /play.js
parent1be86f71d647500814842a092f6c224891456a9c (diff)
downloadtable-battles-f6ff8ae9365d20e2ccd196dc615a6015343db037.tar.gz
local re-ordering of cards in display
Diffstat (limited to 'play.js')
-rw-r--r--play.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/play.js b/play.js
index ae2cc20..341e394 100644
--- a/play.js
+++ b/play.js
@@ -13,6 +13,19 @@ const dice_text_map = {
"(4-6)": "(4/5/6)",
}
+function remap_card(c) {
+ if (!view.reserve[0].includes(c) && !view.reserve[1].includes(c)) {
+ let card = data.cards[c]
+ if (Array.isArray(card.reserve) && card.reserve.length === 1)
+ return card.reserve[0]
+ }
+ return c
+}
+
+function remap_card_cmp(a, b) {
+ return remap_card(a) - remap_card(b)
+}
+
const wing_name = [ "red", "pink", "blue", "dkblue" ]
const side_color = [ "red", "red", "blue", "blue" ]
const reactions = [ "Screen", "Counterattack", "Absorb" ]
@@ -289,6 +302,7 @@ function create_formation_card(id, tip=false) {
}
function fill_card_row(parent, list) {
+ list = list.slice().sort(remap_card_cmp)
parent.replaceChildren()
for (let id of list) {
let n, x