diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-07-27 19:56:26 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-08-21 00:28:20 +0200 |
commit | 08a6dd93a3d475a9f9f666fe00505131e1bd231e (patch) | |
tree | 657eb83c67875a66bc304ff420fd164d398088e7 | |
parent | 96e41fa9fa0e6cf564e85d93f768de26e9c32a17 (diff) | |
download | washingtons-war-08a6dd93a3d475a9f9f666fe00505131e1bd231e.tar.gz |
capture washington during movement
-rw-r--r-- | rules.js | 63 |
1 files changed, 47 insertions, 16 deletions
@@ -1,15 +1,17 @@ "use strict" -// TODO: capture washington // TODO: draw after battle - delay until end of campaign // TODO: more manual steps (events) /* washington's capture - winning general with no CU on enemy PC (no undo anyway) + at end of activation - retreat after battle (no undo anyway) - + at end of activation - place reinforcements (no player shift) + at end of activation - move (no player shift) + immediately */ /* DATA */ @@ -806,7 +808,7 @@ function capture_washington() { } console.log("CAPTURE WASHINGTON!!!") - game.captured_washington = 1 + game.washington_captured = 1 } function capture_british_general(where) { @@ -1478,8 +1480,7 @@ function end_strategy_card() { return false } - if (game.captured_washington) { - delete game.captured_washington + if (game.washington_captured) { goto_george_washington_captured() return false } @@ -2228,6 +2229,9 @@ function resume_moving() { // TODO: auto-end move or require manually stopping at final space? if (game.move.count === 0) end_move(false) + else + if (game.washington_captured) + goto_george_washington_captured_during_move() } function end_move(stop) { @@ -2484,8 +2488,6 @@ function can_retreat_before_battle_to(to) { return false if (has_friendly_cu(to)) return false - if (is_lone && has_friendly_general(to)) - return false return true } @@ -3181,7 +3183,7 @@ function end_battle() { if (game.combat.british_losses >= 3) lose_regular_advantage() - // TODO: delay until end of campaign + // TODO: delay until end of campaign (at end of player's impulse) if (game.combat.b_draw_after_battle) set_add(game.b_hand, deal_card()) if (game.combat.a_draw_after_battle) @@ -3692,11 +3694,28 @@ function end_declaration_of_independence() { end_strategy_card() } +function do_event(c) { + let card = CARDS[c] + if (card.event in events) + events[card.event](c, card) + else + throw new Error("Event not implemented yet: " + card.event) +} + +/* GEORGE WASHINGTON CAPTURED */ + function goto_george_washington_captured() { game.state = "george_washington_captured" game.save = game.active game.active = P_BRITAIN game.count = 5 + delete game.washington_captured +} + +function goto_george_washington_captured_during_move() { + game.state = "george_washington_captured_during_move" + game.count = 5 + delete game.washington_captured } states.george_washington_captured = { @@ -3719,20 +3738,32 @@ states.george_washington_captured = { }, } +states.george_washington_captured_during_move = { + prompt() { + view.prompt = "George Washington is captured! Remove American PC markers. " + game.count + " left." + for (let space of all_spaces) + if (has_american_pc(space) && has_no_american_unit(space)) + gen_action_space(space) + view.actions.pass = 1 + }, + space(where) { + push_undo() + remove_pc(where) + if (--game.count === 0) + game.state = "ops_general_move" + }, + pass() { + push_undo() + game.state = "ops_general_move" + }, +} + function end_george_washington_captured() { game.active = game.save delete game.save end_strategy_card() } -function do_event(c) { - let card = CARDS[c] - if (card.event in events) - events[card.event](c, card) - else - throw new Error("Event not implemented yet: " + card.event) -} - /* WINTER ATTRITION PHASE */ function apply_single_winter_attrition(remove_cu, space) { |