summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-08-06 11:17:37 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:31:29 +0100
commite571f1de33b202c9299915f207fd317dad40120c (patch)
treee0ac12f22fc4c1e262e9521d46d4222dd7b9a4c2
parentcea867924ba2971124d43af07cd351b966fef3cf (diff)
downloadpax-pamir-e571f1de33b202c9299915f207fd317dad40120c.tar.gz
Use player dials as action spaces for selecting players.
For Tax, Rumor, and Other Persuasive Methods.
-rw-r--r--play.css4
-rw-r--r--play.js13
2 files changed, 16 insertions, 1 deletions
diff --git a/play.css b/play.css
index 23bafbc..74e9a19 100644
--- a/play.css
+++ b/play.css
@@ -652,6 +652,10 @@ body.shift #tooltip.focus { display: block; }
right: 0px;
}
+.player_dial.action {
+ box-shadow: 0 0 0 3px yellow;
+}
+
.player_hand_size {
position: absolute;
user-select: none;
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))