diff options
author | Joël Simoneau <simoneaujoel@gmail.com> | 2024-10-25 14:15:02 -0400 |
---|---|---|
committer | Joël Simoneau <simoneaujoel@gmail.com> | 2024-10-25 14:15:02 -0400 |
commit | 0355e16c0bb38f34d9317a8ee54f03c8836c1261 (patch) | |
tree | 17b911dc7eb50ee03c10bebe86a1c53bbee95737 | |
parent | dd868f6af39224b8741384ddf05968f6545e425c (diff) | |
download | vijayanagara-0355e16c0bb38f34d9317a8ee54f03c8836c1261.tar.gz |
Conscript with tributaries
-rw-r--r-- | play.js | 10 | ||||
-rw-r--r-- | rules.js | 24 |
2 files changed, 32 insertions, 2 deletions
@@ -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 @@ -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) { |