summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-14 13:26:28 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commite60469e361a3ea034f12aa495a364aa7af4c192e (patch)
treefc19e358a96fc2101f5d236b9d888bfea861b508 /rules.js
parent69d1cdece310f734d06bb2f99ebf393f836178f3 (diff)
downloadtable-battles-e60469e361a3ea034f12aa495a364aa7af4c192e.tar.gz
Ramillies.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js52
1 files changed, 50 insertions, 2 deletions
diff --git a/rules.js b/rules.js
index 18612cf..57ea7cb 100644
--- a/rules.js
+++ b/rules.js
@@ -306,6 +306,10 @@ const S41_CUTTS_COLUMN = find_card(41, "Cutt's Column")
const S41_BLENHEIM_CARD = find_card(41, "Blenheim")
const S41_PRINCE_EUGENE = find_card(41, "Prince Eugene")
+const S42_RAMILLIES = find_scenario(42)
+const S42_MARLBOROUGH = find_card(42, "Marlborough")
+const S42_DUTCH_GUARDS = find_card(42, "Dutch Guards")
+
// === SETUP ===
exports.setup = function (seed, scenario, options) {
@@ -1698,6 +1702,13 @@ function can_take_any_action() {
}
}
+ if (game.scenario === S42_RAMILLIES) {
+ if (player_index() === 0) {
+ if (has_any_dice_on_card(S42_MARLBOROUGH))
+ return true
+ }
+ }
+
return false
}
@@ -1821,6 +1832,14 @@ states.action = {
gen_action_card(S41_PRINCE_EUGENE)
}
}
+
+ if (game.scenario === S42_RAMILLIES) {
+ if (player_index() === 0) {
+ if (has_any_dice_on_card(S42_MARLBOROUGH))
+ gen_action_card(S42_MARLBOROUGH)
+ }
+ }
+
},
retire(c) {
push_undo()
@@ -1850,16 +1869,27 @@ states.action = {
},
card(c) {
push_undo()
+
+ game.selected = c
+
if (game.scenario === S40_CHIARI) {
- game.selected = c
game.state = "s40_cassines"
+ return
}
+
if (game.scenario === S41_BLENHEIM_SCENARIO) {
- game.selected = S41_PRINCE_EUGENE
game.target2 = -1
game.self = Math.min(get_sticks(S41_PRINCE_EUGENE), count_dice_on_card(S41_PRINCE_EUGENE))
game.state = "s41_prince_eugene"
+ return
+ }
+
+ if (game.scenario === S42_RAMILLIES) {
+ game.state = "s42_marlborough"
+ return
}
+
+ throw new Error("missing rule for special action: " + card_name(c))
}
}
@@ -1916,6 +1946,24 @@ states.s41_prince_eugene = {
},
}
+states.s42_marlborough = {
+ prompt() {
+ view.prompt = "Marlborough: Move 4 sticks to any red or pink card except the Dutch Guards."
+ for (let c of game.front[0])
+ if (c !== S42_MARLBOROUGH && c !== S42_DUTCH_GUARDS)
+ gen_action_card(c)
+ },
+ card(c) {
+ log(game.selected + " moved 4 sticks to " + c)
+ set_sticks(c, get_sticks(c) + 4)
+ set_sticks(S42_MARLBOROUGH, get_sticks(S42_MARLBOROUGH) - 4)
+ pay_for_action(S42_MARLBOROUGH)
+ if (get_sticks(S42_MARLBOROUGH) === 0)
+ remove_card(S42_MARLBOROUGH)
+ end_action_phase()
+ },
+}
+
function goto_null(c) {
log("Fizzled " + card_number(c))
pay_for_action(c)