From e6d8c13dccf780a2f2c140c84e60435759e126d1 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 15 Jan 2022 21:06:26 +0100 Subject: Courier Intercepted! --- rules.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/rules.js b/rules.js index 9df39cb..d62cd54 100644 --- a/rules.js +++ b/rules.js @@ -365,6 +365,7 @@ const SOUTHERN_COLONIAL_MILITIAS = find_space("Southern Colonial Militias"); const first_amphib_card = 17; const last_amphib_card = 20; +const SURRENDER = 6; const LOUISBOURG_SQUADRONS = 21; function has_amphibious_arrow(space) { @@ -1761,6 +1762,8 @@ function play_card(card) { log(`${game.active} plays ${card_name(card)}.`); remove_from_array(player.hand, card); game.cards.current = card; + if (card === SURRENDER) + game.events.surrender = 1; if (cards[card].special === 'remove') game.cards.removed.push(card); else @@ -1771,6 +1774,8 @@ function discard_card(card, reason) { log(`${game.active} discards ${card_name(card)}${reason}.`); remove_from_array(player.hand, card); game.cards.current = card; + if (card === SURRENDER) + game.events.surrender = 1; if (cards[card].special === 'remove') game.cards.removed.push(card); else @@ -3920,6 +3925,26 @@ states.governor_vaudreuil_interferes = { }, } +events.courier_intercepted = { + can_play() { + return enemy_player.hand.length > 0; + }, + play() { + let roll = roll_d6(); + log("Roll " + roll + "."); + if (roll >= 3) { + let i = random(enemy_player.hand.length); + let c = enemy_player.hand[i]; + enemy_player.hand.splice(i, 1); + player.hand.push(c); + log(`Steals ${card_name(c)}.`); + } else { + log("No effect."); + } + end_action_phase(); + }, +} + function is_card_removed(card) { return game.cards.removed.includes(card); } -- cgit v1.2.3