summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-22 21:42:24 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-30 21:59:25 +0200
commit96940d0b1a16a83cd89b9f347bd728ac0f1e36c6 (patch)
tree8ad83455c38c44674a3ecd153574b18ac06248c9 /rules.js
parentdd9270cb08ecd342ac8b78cda7dbe2946bf5b797 (diff)
downloadfriedrich-96940d0b1a16a83cd89b9f347bd728ac0f1e36c6.tar.gz
show drawn cards separately (and discard for france)
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js58
1 files changed, 49 insertions, 9 deletions
diff --git a/rules.js b/rules.js
index 6d8f147..eaffc3a 100644
--- a/rules.js
+++ b/rules.js
@@ -363,14 +363,16 @@ function is_protected_from_reconquest(s) {
/* STATE */
-function turn_power_draw(pow) {
+function turn_power_draw() {
let n = 0
- if (game.scenario === 1 && pow === P_PRUSSIA) {
- n = 2
+ if (game.scenario === 1 && game.power === P_PRUSSIA) {
+ if (set_has(game.fate, FC_LORD_BUTE) || set_has(game.fate, FC_POEMS))
+ return 1
+ return 2
}
- switch (pow) {
+ switch (game.power) {
case P_PRUSSIA:
n = 7
if (set_has(game.fate, FC_LORD_BUTE))
@@ -785,16 +787,54 @@ function draw_next_tc() {
}
function goto_tactical_cards() {
- let pow = game.power
- let n = turn_power_draw(pow)
+ let n = turn_power_draw()
log("Draw " + n + " TC.")
+ game.draw = []
for (let i = 0; i < n; ++i)
- set_add(game.hand[pow], draw_next_tc())
+ set_add(game.draw, draw_next_tc())
+
+ game.state = "tactical_cards"
+}
+
+function should_power_discard_tc() {
+ if (game.power === P_FRANCE)
+ return true
+ if (game.scenario === 1 && game.power === P_PRUSSIA)
+ return true
+ return false
+}
+
+states.tactical_cards = {
+ prompt() {
+ view.draw = game.draw
+ if (should_power_discard_tc()) {
+ prompt("Drew " + game.draw.length + " TCs. Discard one of them.")
+ for (let c of game.draw)
+ gen_action_card(c)
+ } else {
+ prompt("Drew " + game.draw.length + " TCs.")
+ view.actions.end_cards = 1
+ }
+ },
+ card(c) {
+ push_undo()
+ set_delete(game.draw, c)
+ end_tactical_cards()
+ },
+ end_cards() {
+ end_tactical_cards()
+ },
+}
+
+function end_tactical_cards() {
+ for (let c of game.draw)
+ set_add(game.hand[game.power], c)
+ delete game.draw
// MARIA: supply is before movement
-
+
goto_movement()
}
@@ -2200,7 +2240,7 @@ exports.setup = function (seed, scenario, options) {
active: "Frederick",
power: P_PRUSSIA,
- turn: 5,
+ turn: 0,
step: 0,
clock: null,
fate: [],