summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js10
-rw-r--r--rules.js24
2 files changed, 32 insertions, 2 deletions
diff --git a/play.js b/play.js
index a0f037b..f3e654b 100644
--- a/play.js
+++ b/play.js
@@ -924,10 +924,20 @@ function on_update() {
layout_pieces(items, xy[0], xy[1], discs, VE)
}
+ // Action highlighting
if (s <= S_VE_AVAILABLE) {
ui.spaces[s].classList.toggle("action", is_action("space", s))
ui.spaces[s].classList.toggle("selected", view.where === s)
}
+
+ // Control
+ view.tributary &= ~(1 << 12)
+ if (s < S_DELHI) {
+ if (view.tributary & (1<<s))
+ ui.control[s].className = "token tributary"
+ else
+ ui.control[s].className = "hide"
+ }
}
items.length = 0
diff --git a/rules.js b/rules.js
index b905027..b7b4dfb 100644
--- a/rules.js
+++ b/rules.js
@@ -98,6 +98,7 @@ exports.view = function (state, role) {
deck: [ this_card, deck_size, game.of_gods_and_kings ],
cylinder: game.cylinder,
pieces: game.pieces,
+ tributary: game.tributary,
}
if (game.result) {
@@ -452,9 +453,9 @@ states.conscript = {
prompt() {
view.prompt = "Conscript: Select Tributaries, Qasbah or Dehli to place troops."
- if (can_select_cmd_space(1)) {
+ if (can_select_cmd_space(1) && can_conscript()) {
for (let s = first_space; s <= last_space; ++s) {
- if (!is_selected_cmd_space(s))
+ if (!is_selected_cmd_space(s) && can_conscript_in_space(s))
gen_action_space(s)
}
}
@@ -528,6 +529,11 @@ function can_conscript() {
return true
}
+function can_conscript_in_space(s) {
+ if (s === S_DELHI || has_piece(s, DS, DISC) || is_tributary(s))
+ return true
+}
+
function conscript_count() {
if (game.op.where === S_DELHI)
return 5
@@ -555,6 +561,20 @@ function end_command() {
resume_event_card()
}
+/* TOKENS */
+
+function add_tributary(s) {
+ game.tributary |= (1 << s)
+}
+
+function is_tributary(s) {
+ return game.tributary & (1 << s)
+}
+
+function remove_tributary(s) {
+ game.tributary &= ~(1 << s)
+}
+
/* MISC SPACE + PIECE QUERIES */
function has_piece(s, faction, type) {