From 6aa47f2238ea93b1c525430b814dcda1168a6ad7 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 17 Dec 2023 13:59:26 +0100 Subject: y --- play.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/play.js b/play.js index ac3ef91..c4e7a51 100644 --- a/play.js +++ b/play.js @@ -346,6 +346,11 @@ function add_hit_stick(parent) { throw Error("OUT OF CUBES ERROR") } +function get_player_color(p) { + let c = data.scenarios[view.scenario].players[p].cards[0] + return data.cards[c].wing +} + function on_update() { let p1 = 0, p2 = 1 if (player === "First") @@ -355,8 +360,8 @@ function on_update() { ui.name[p1].textContent = data.scenarios[view.scenario].players[0].name ui.name[p2].textContent = data.scenarios[view.scenario].players[1].name - let w1 = data.cards[view.front[0][0]].wing - let w2 = data.cards[view.front[1][0]].wing + let w1 = get_player_color(0) + let w2 = get_player_color(1) ui.role_panel[0].classList.add(side_color[w1]) ui.role_panel[0].classList.remove(side_color[w2]) -- cgit v1.2.3