summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js41
1 files changed, 33 insertions, 8 deletions
diff --git a/rules.js b/rules.js
index 1450e9d..5ee586f 100644
--- a/rules.js
+++ b/rules.js
@@ -3208,7 +3208,7 @@ function elector_majority() {
let elector_france = 0
let elector_pragmatic = 0
for (let i = 0; i < 8; i += 2) {
- if (view.elector[i+1] === P_FRANCE)
+ if (game.elector[i+1] === P_FRANCE)
elector_france ++
else
elector_pragmatic ++
@@ -3384,7 +3384,7 @@ function goto_determine_order_of_influence() {
log(">" + format_card(c) + " " + power_name[pow])
set_add(game.saved[pow], c)
} else {
- log(">" + format_card(c) + " " + power_name[pow] + "(bluff)")
+ log(">" + format_card(c) + " " + power_name[pow] + " (bluff)")
set_add(game.hand[pow], c)
}
}
@@ -3443,7 +3443,7 @@ states.select_political_card = {
for (let pc of game.political)
if (set_has(political_cards[pc].powers, game.power))
gen_action_political(pc)
- view.actions.pass = 1
+ view.actions.save = 1
},
political(pc) {
push_undo()
@@ -3451,14 +3451,32 @@ states.select_political_card = {
game.saved[game.power] = []
game.pc = pc
game.pcx = -1
- next_execute_political_card()
+ game.state = "political_card_discard_or_execute"
},
- pass() {
+ save() {
log(power_name[game.power] + " saved its TC.")
goto_select_political_card()
},
}
+states.political_card_discard_or_execute = {
+ inactive: "select a political card",
+ prompt() {
+ prompt(`Execute or discard "${political_cards[game.pc].title}".`)
+ view.actions.execute = 1
+ view.actions.discard = 1
+ },
+ execute() {
+ push_undo()
+ next_execute_political_card()
+ },
+ discard() {
+ push_undo()
+ log("Discarded with no effect.")
+ end_execute_political_card()
+ },
+}
+
function end_politics() {
delete game.political
@@ -3466,7 +3484,7 @@ function end_politics() {
for (let pow of all_major_powers) {
if (!(game.stage & (1 << pow))) {
for (let c of game.saved[pow])
- set_add(game.hand, c)
+ set_add(game.hand[pow], c)
game.saved[pow] = []
}
}
@@ -3544,6 +3562,7 @@ states.political_card_done = {
inactive: "execute political card",
prompt() {
prompt("Political card done.")
+ view.pc = game.pc
view.actions.end_political_card = 1
},
end_political_card() {
@@ -3576,8 +3595,10 @@ states.political_shift = {
push_undo()
let info = event_shift[current_political_effect()]
game[info.track] += n
- game[info.track] = Math.max(1, Math.min(TRACK_SIZE[info.track], game[info.track]))
- log("Shifted " + TRACK_NAME[info.track] + " to " + game[info.track] + ".")
+ if (n < 0)
+ log("Shift " + TRACK_NAME[info.track] + " " + (-n) + " left.")
+ else
+ log("Shift " + TRACK_NAME[info.track] + " " + (n) + " right.")
next_execute_political_card()
},
pass() {
@@ -3686,6 +3707,10 @@ function goto_france_minus_tc_this_turn() {
/* POLITICAL TRACKS */
function goto_adjust_political_tracks() {
+ // clamp final values to track
+ game.saxony = Math.max(1, Math.min(5, game.saxony))
+ game.russia = Math.max(1, Math.min(9, game.russia))
+ game.italy = Math.max(1, Math.min(9, game.italy))
// TODO: handle expeditionary corps
// TODO: handle victory points (italy)
// TODO: handle saxony alliance