summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-17 13:59:26 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit6aa47f2238ea93b1c525430b814dcda1168a6ad7 (patch)
tree961f99c8d49aeae26e488b61cb4db48966f50afb
parent9751557b2aabdb3f6550c6f39dee466c834964a1 (diff)
downloadtable-battles-6aa47f2238ea93b1c525430b814dcda1168a6ad7.tar.gz
y
-rw-r--r--play.js9
1 files 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])