From e571f1de33b202c9299915f207fd317dad40120c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 6 Aug 2022 11:17:37 +0200 Subject: Use player dials as action spaces for selecting players. For Tax, Rumor, and Other Persuasive Methods. --- play.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'play.js') diff --git a/play.js b/play.js index 107b699..7de586f 100644 --- a/play.js +++ b/play.js @@ -208,6 +208,12 @@ function is_card_action(action, card) { return false } +function is_player_action(p) { + if (view.actions && view.actions["player_" + p]) + return true + return false +} + function is_place_gift_action(i) { if (view.actions && view.actions.place_gift && view.actions.place_gift.includes(i)) return true @@ -645,7 +651,10 @@ function on_update() { ui.player[p].role.className = "role " + view.players[p].loyalty; ui.player[p].role.classList.toggle("active", p === player_index[view.active]) - ui.player[p].dial.className = "player_dial " + view.players[p].loyalty + " p" + p + let a = "" + if (is_player_action(p)) + a = " action" + ui.player[p].dial.className = "player_dial " + view.players[p].loyalty + " p" + p + a ui.player[p].role_loy_icon.className = "role_loyalty_icon " + view.players[p].loyalty ui.player[p].role_loy_text.textContent = count_influence_points(p) @@ -811,6 +820,8 @@ function build_ui() { for (let p = 0; p < 5; ++p) { ui.player[p] = build_player_ui(p) + ui.player[p].dial.addEventListener("click", () => send_action('player_' + p)) + ui.player[p].hand_size.addEventListener("click", () => toggle_hand(p)) -- cgit v1.2.3