From d6373f1887af64b092d55fa07d70ad383721405b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 13 Dec 2023 21:53:31 +0100 Subject: Montrose. --- rules.js | 52 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 16 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index ce8f1b4..16f1e22 100644 --- a/rules.js +++ b/rules.js @@ -278,6 +278,13 @@ const S31_LONDON_TRAINED_BANDS = find_card(31, "London Trained Bands") const S32_NEWBURY_2ND = find_scenario(32) const S32_MANCHESTER = find_card(32, "Manchester") +const S34_TIPPERMUIR = find_scenario(34) +const S34_MONTROSE = find_card(34, "Montrose") + +const S35_AULDEARN = find_scenario(35) +const S35_MONTROSE = find_card(35, "Montrose") +const S35_GORDON = find_card(35, "Gordon") + // === SETUP === exports.setup = function (seed, scenario, options) { @@ -1482,7 +1489,7 @@ function is_mandatory_reaction(c, a) { ) } -function can_take_action(c, a) { +function can_take_action(c, a, ix) { if (a.type === "Attack") { if (find_target_of_attack(c, a) < 0) return false @@ -1511,6 +1518,16 @@ function can_take_action(c, a) { } } + if (game.scenario === S35_AULDEARN) { + if (c === S35_MONTROSE) { + // May only perform the second action after having previously performed the first. + if (ix === 1) { + if (is_card_in_reserve(S35_GORDON)) + return false + } + } + } + if (a.type === "Bombard" || a.type === "Attack" || a.type === "Command") { if (data.cards[c].special) return check_cube_requirement(c, a.requirement) @@ -1620,7 +1637,7 @@ states.action = { if (has_dice || has_cube) { if (data.cards[c].actions.length >= 1) { if (is_action(c, data.cards[c].actions[0])) { - if (can_take_action(c, data.cards[c].actions[0])) + if (can_take_action(c, data.cards[c].actions[0], 0)) gen_action_action1(c) else if (has_dice) gen_action_fizzle1(c) @@ -1628,7 +1645,7 @@ states.action = { } if (data.cards[c].actions.length >= 2) { if (is_action(c, data.cards[c].actions[1])) { - if (can_take_action(c, data.cards[c].actions[1])) + if (can_take_action(c, data.cards[c].actions[1], 1)) gen_action_action2(c) else if (has_dice) gen_action_fizzle2(c) @@ -1723,21 +1740,18 @@ function find_first_target_of_command(c, a) { } for (let t of a.target_list) { - if (set_has(game.reserve[0], t)) - return t - if (set_has(game.reserve[1], t)) + if (is_card_in_reserve(t)) return t } + return -1 } function find_all_targets_of_command(a) { let list = [] - for (let c of a.target_list) { - if (set_has(game.reserve[0], c)) - list.push(c) - if (set_has(game.reserve[1], c)) - list.push(c) + for (let t of a.target_list) { + if (is_card_in_reserve(t)) + list.push(t) } return list } @@ -1878,12 +1892,18 @@ function update_attack1() { if (game.scenario === S32_NEWBURY_2ND) { if (game.selected !== S32_MANCHESTER) { - if (has_any_dice_on_card(S32_MANCHESTER)) { - // if dice on Manchester, all other friendly attack +1 - let w = data.cards[game.selected].wing - if (w === BLUE || w === DKBLUE) + // if dice on Manchester, all other friendly attack +1 + if (data.cards[game.selected].wing === BLUE || data.cards[game.selected].wing === DKBLUE) + if (has_any_dice_on_card(S32_MANCHESTER)) + game.hits += 1 + } + } + + if (game.scenario === S34_TIPPERMUIR) { + // if dice on Montrose, all Pink attack +1 + if (data.cards[game.selected].wing === PINK) { + if (has_any_dice_on_card(S34_MONTROSE)) game.hits += 1 - } } } -- cgit v1.2.3