summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js63
1 files changed, 38 insertions, 25 deletions
diff --git a/rules.js b/rules.js
index 8ec72f9..8d23dfd 100644
--- a/rules.js
+++ b/rules.js
@@ -4,6 +4,8 @@
/* TODO
+TODO: face-up / face-down TCs in display - use "placed" and "saved" arrays or implicit with "game.trump"?
+
show who controls which power in player list
set-aside victory marker areas
@@ -3319,6 +3321,16 @@ function goto_politics() {
game.placed = [ 0, 0, 0, 0 ]
game.stage = 0
+ game.save_saxony = game.saxony
+
+ // 25.1 Return face-down TCs to the players
+ for (let pow of all_major_powers) {
+ for (let c of game.saved[pow])
+ set_add(game.hand[pow], c)
+ game.saved[pow] = []
+ }
+
+ // 25.2 Reveal 2 Political Cards
log("Reveal")
while (game.political.length < 2) {
let pc = game.pol_deck.pop()
@@ -3329,8 +3341,7 @@ function goto_politics() {
game.political.push(pc)
}
- game.save_saxony = game.saxony
-
+ // 25.3 Determine the political trump suit
if (game.winner_power >= 0) {
set_active_to_power(game.winner_power)
game.state = "determine_trump_suit"
@@ -3363,6 +3374,8 @@ states.determine_trump_suit = {
}
}
+// 25.4 Place TCs on the political display
+
function goto_place_tc_on_display() {
set_active_to_power(POWER_FROM_POLITICAL_STAGE[game.stage])
game.state = "place_tc_on_display"
@@ -3408,21 +3421,22 @@ function end_place_tc_on_display() {
goto_place_tc_on_display()
}
+// 25.5 Determine order of influence
+
function goto_determine_order_of_influence() {
+
log_br()
log("Influence")
- // Turn cards face-up and return bluff cards
+ // Turn cards face-up and turn bluff cards face down again
for (let pow of POWER_FROM_POLITICAL_STAGE) {
let c = game.placed[pow]
if (c > 0) {
- if (is_reserve(c) || to_suit(c) === game.trump) {
+ if (is_trump_card(c))
log(">" + format_card(c) + " " + power_name[pow])
- set_add(game.saved[pow], c)
- } else {
+ else
log(">" + format_card(c) + " " + power_name[pow] + " (bluff)")
- set_add(game.hand[pow], c)
- }
+ set_add(game.saved[pow], c)
}
}
delete game.placed
@@ -3437,7 +3451,7 @@ function count_influence(pow) {
for (let c of game.saved[pow])
if (is_reserve(c))
n += 16
- else
+ else if (to_suit(c) === game.trump)
n += to_value(c)
return n
}
@@ -3457,6 +3471,8 @@ function most_influence() {
return p_most
}
+// 25.6 Select Political Cards
+
function goto_select_political_card() {
if (game.political.length > 0) {
let pow = most_influence()
@@ -3484,7 +3500,10 @@ states.select_political_card = {
political(pc) {
push_undo()
log(power_name[game.power] + " chose C" + pc + ".")
- game.saved[game.power] = []
+
+ // face-up TCs to discard
+ game.saved[game.power] = game.saved[game.power].filter(c => !is_trump_card(c))
+
game.pc = pc
game.pcx = -1
game.state = "political_card_discard_or_execute"
@@ -3517,14 +3536,8 @@ states.political_card_discard_or_execute = {
function end_politics() {
delete game.political
- // did not take a turn; take cards back into hand
- for (let pow of all_major_powers) {
- if (!(game.stage & (1 << pow))) {
- for (let c of game.saved[pow])
- set_add(game.hand[pow], c)
- game.saved[pow] = []
- }
- }
+ // flip TCs on display face down
+ game.trump = -1
goto_adjust_political_tracks()
}
@@ -4184,14 +4197,14 @@ function mask_placed(player) {
return view_placed
}
+function is_trump_card(c) {
+ return (game.trump >= 0) && (is_reserve(c) || to_suit(c) === game.trump)
+}
+
function mask_saved(player) {
let view_saved = []
- for (let pow of all_major_powers) {
- if (player_from_power(pow) === player)
- view_saved[pow] = game.saved[pow]
- else
- view_saved[pow] = game.saved[pow].map(c => c & ~127)
- }
+ for (let pow of all_major_powers)
+ view_saved[pow] = game.saved[pow].map(c => is_trump_card(c) ? c : c & ~127)
return view_saved
}
@@ -4231,7 +4244,7 @@ exports.view = function (state, player) {
discard: total_discard_list(),
pol_deck: mask_pol_deck(),
- saved: game.saved,
+ saved: mask_saved(),
power: game.power,
retro: game.retro,