summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js69
1 files changed, 26 insertions, 43 deletions
diff --git a/play.js b/play.js
index fbc92d4..ed1cc7f 100644
--- a/play.js
+++ b/play.js
@@ -750,53 +750,33 @@ function layout_available_bases(list, x0, y0, cols, rows, dx, dy) {
}
}
-function layout_sop() {
- let i, x, y, z
+let sop_xy = [
+ [876, 1445, 0, 13], // ELIGIBLE
+ [876, 1307, 11, 0], // SOP_LIMITED_COMMAND
+ [1032, 1385, 0, 0], // SOP_COMMAND_DECREE
+ [1032, 1505, 0, 0], // SOP_EVENT_OR_COMMAND
+ [877, 1583, 11, 0], // SOP_PASS
+ [1190, 1445, 0, 13], // INELIGIBLE
+]
- // Eligible
- x = 1164 - 22
- y = 480
- z = 1
+function layout_sop() {
+ let i, z
+ let n_sop, offset
let order = data.card_order[view.deck[0]]
- for (let faction of order) {
- if (view.cylinder[faction] === ELIGIBLE) {
- place_piece(ui.cylinder[faction], x, y, z)
- y += 40
- z += 1
- }
- }
-
- // Ineligible
- x = 1510 - 22
- y = 480
- z = 1
- for (let faction = 0; faction < 4; ++faction) {
- if (view.cylinder[faction] === INELIGIBLE) {
- place_piece(ui.cylinder[faction], x, y, z)
- y += 40
- z += 1
- }
- }
- // Pass
- x = 1164 - 22 - 24
- y = 688 - 28
- z = 1
- i = 0
- for (let faction = 0; faction < 4; ++faction) {
- if (view.cylinder[faction] === SOP_PASS) {
- place_piece(ui.cylinder[faction], x, y, z)
- x += 48
- z += 1
- if (++i === 2) { x -= 72; y += 28 }
+ for (let [sop, [x, y, dx, dy]] of sop_xy.entries()) {
+ n_sop = view.cylinder.filter(v => v === sop).length
+ i = 0
+ z = 1
+ for (let faction of order) {
+ if (view.cylinder[faction] === sop) {
+ offset = n_sop === 1 ? 0 : (-1 + i * (2/(n_sop - 1))) * n_sop
+ place_piece(ui.cylinder[faction], x + dx * offset, y + dy * offset, z)
+ i += 1
+ z += 1
+ }
}
}
-
- for (let [i, x, y] of sop_xy) {
- for (let faction = 0; faction < 4; ++faction)
- if (view.cylinder[faction] === i)
- place_piece(ui.cylinder[faction], x, y)
- }
}
function layout_score_cell(list, x, y, dx, dy) {
@@ -950,9 +930,12 @@ function on_update() {
}
+ layout_sop()
+
+ action_button("pass", "Pass")
+
return
- layout_sop()
layout_available(GOVT, TROOPS, 114, 248)
layout_available(GOVT, POLICE, 114, 448)