summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js38
1 files changed, 28 insertions, 10 deletions
diff --git a/play.js b/play.js
index da79aa6..27dade3 100644
--- a/play.js
+++ b/play.js
@@ -23,7 +23,7 @@ const DICE = {
// === SYNC with rules.js ===
const LEGION_COUNT = 33
-const BARBARIAN_COUNT = 53
+const BARBARIAN_COUNT = [ 36, 46, 56 ]
const CARD_M1 = [ 0, 11 ]
const CARD_S1 = [ 12, 23 ]
@@ -119,8 +119,8 @@ const UNAVAILABLE = 22
const ARMY = 23
-const first_barbarian = [ 0, 10, 20, 31, 43 ]
-const last_barbarian = [ 9, 19, 30, 42, 52 ]
+const first_barbarian = [ 3, 13, 23, 34, 46 ]
+const last_barbarian = [ 12, 22, 33, 45, 55 ]
const first_governor = [ 0, 6, 12, 18 ]
const first_general = [ 0, 6, 12, 18 ]
@@ -596,6 +596,12 @@ let ui = {
played: document.getElementById("played"),
market: document.getElementById("market"),
pieces: document.getElementById("pieces"),
+ player_info: [
+ document.querySelector("#role_Red .role_vp"),
+ document.querySelector("#role_Blue .role_vp"),
+ document.querySelector("#role_Yellow .role_vp"),
+ document.querySelector("#role_Green .role_vp"),
+ ],
legacy: [
document.getElementById("red_legacy"),
document.getElementById("blue_legacy"),
@@ -924,6 +930,13 @@ function layout_barbarian_dice(black, white, tribe) {
function on_update() {
let player_count = view.legacy.length
+ for (let p = 0; p < player_count; ++p) {
+ let t = view.legacy[p] + " (" + view.emperor_turns[p] + ")"
+ if (p === view.first)
+ t = "\u2756 " + t
+ ui.player_info[p].textContent = t
+ }
+
ui.body.classList.toggle("p2", player_count === 2)
ui.body.classList.toggle("p3", player_count === 3)
ui.body.classList.toggle("p4", player_count === 4)
@@ -1041,9 +1054,9 @@ function on_update() {
ui.legions[i].classList.toggle("reduced", false)
}
- for (let id = 0; id < BARBARIAN_COUNT; ++id) {
+ for (let id = 3; id < BARBARIAN_COUNT[player_count-2]; ++id) {
let loc = get_barbarian_location(id)
- if (loc === UNAVAILABLE)
+ if (loc === AVAILABLE)
hide(ui.barbarians[id])
else
show(ui.barbarians[id])
@@ -1052,6 +1065,8 @@ function on_update() {
else
ui.barbarians[id].classList.toggle("inactive", false)
}
+ for (let id = BARBARIAN_COUNT[player_count-2]; id < 56; ++id)
+ hide(ui.barbarians[id])
stack_count.fill(0)
@@ -1083,13 +1098,13 @@ function on_update() {
for (let id of [ CNIVA, ARDASHIR, SHAPUR ]) {
let loc = get_barbarian_location(id)
- if (loc !== UNAVAILABLE)
+ if (loc !== AVAILABLE)
layout_stack(-1, [ ui.barbarians[id] ], loc, false, 8, 8)
}
for (let id = 0; id < 3; ++id) {
let loc = get_rival_emperor_location(id)
- if (loc === UNAVAILABLE)
+ if (loc === AVAILABLE)
hide(ui.rival_emperors[id])
else {
show(ui.rival_emperors[id])
@@ -1307,8 +1322,11 @@ function on_update() {
action_button("recruit_general", "Recruit General")
action_button("recruit_governor", "Recruit Governor")
+ action_button("play_all", "Play All")
+
action_button("end_actions", "End Actions")
+ action_button("continue", "Continue")
action_button("save", "Save")
action_button("pass", "Pass")
action_button("done", "Done")
@@ -1336,7 +1354,7 @@ function on_log(text) {
text = text.replace(/</g, "&lt;")
text = text.replace(/>/g, "&gt;")
- text = text.replace(/S(\d+)/g, sub_region_name)
+ text = text.replace(/%(\d+)/g, sub_region_name)
text = text.replace(/\b[BW]\d\b/g, sub_dice_image)
if (text.match(/^.turn/)) {
@@ -1364,9 +1382,9 @@ function on_log(text) {
text = text.substring(4)
p.className = "h1"
}
- else if (text.match(/^\.h4/)) {
+ else if (text.match(/^\.h2/)) {
text = text.substring(4)
- p.className = "h3"
+ p.className = "h2"
}
else if (text.match(/^\.h3/)) {
text = text.substring(4)