diff options
-rw-r--r-- | play.js | 2 | ||||
-rw-r--r-- | rules.js | 44 |
2 files changed, 28 insertions, 18 deletions
@@ -832,7 +832,7 @@ function on_log(text) { ) p.className = "n" - if (text.startsWith("Moved G")) + if (text.startsWith("Moved G") || text.startsWith("Landing Party")) p.className = "m" text = text.replace(/&/g, "&") @@ -957,7 +957,7 @@ function goto_committees_of_correspondence() { log("=a Committes of Correspondence") game.active = P_AMERICA game.state = "committees_of_correspondence" - game.colonies = filter_place_american_pc_in_colony(THE_13_COLONIES) + game.colonies = THE_13_COLONIES.slice() } states.committees_of_correspondence = { @@ -1823,6 +1823,7 @@ states.landing_party = { gen_landing_party() }, space(where) { + log("Landing Party.") clear_flag(F_LANDING_PARTY) if (has_american_pc()) flip_pc(where) @@ -1908,11 +1909,22 @@ states.remove_general_after_intercept = { gen_remove_general(game.move.to) }, general(g) { - // TODO: allow undo before proceeding to battle cards? + push_undo() if (game.active === P_BRITAIN) move_general(g, BRITISH_REINFORCEMENTS) else move_general(g, AMERICAN_REINFORCEMENTS) + game.state = "remove_general_after_intercept_confirm" + }, +} + +states.remove_general_after_intercept_confirm = { + prompt() { + view.prompt = "Intercept done." + view.actions.next = 1 + }, + next() { + clear_undo() end_intercept() }, } @@ -1992,13 +2004,7 @@ function goto_ops_general_move(g, marblehead) { else pickup_max_american_cu(game.move) - /* - let cu = game.move.carry_american + game.move.carry_french + game.move.carry_british - if (cu > 0) - log(`Moved G${g} with ${cu} CU\nfrom S${where}`) - else - */ - log(`Moved G${g}\nfrom S${where}`) + log(`Moved G${g}\nfrom S${where}`) } function format_move_prompt() { @@ -2172,7 +2178,6 @@ function resume_moving() { game.state = "ops_general_move" - // TODO: auto-end move or require manually stopping at final space? if (game.move.count === 0) end_move(false) else @@ -2402,8 +2407,6 @@ function goto_start_battle() { attacker: game.active, a_bonus: 0, b_bonus: 0, - b_draw_after_battle: false, - a_draw_after_battle: false, british_losses: 0, } @@ -2643,8 +2646,11 @@ states.play_attacker_battle_card_confirm = { function goto_play_defender_battle_card() { game.state = "play_defender_battle_card" game.active = ENEMY[game.combat.attacker] + /* + // TODO - skip or not (opponent doesn't know he's been attacked) if (active_hand().length === 0) resolve_battle() + */ } states.play_defender_battle_card = { @@ -2655,7 +2661,6 @@ states.play_defender_battle_card = { }, card(c) { play_battle_card(this, c) - // TODO: pause! }, card_battle_play(c) { push_undo() @@ -3088,7 +3093,7 @@ states.retreat_after_battle = { else retreat_american_army(game.move.to, to) - // TODO: disperse congress with end_battle? + // TODO: disperse congress with end_battle? (is this code redundant?) if (game.active === P_BRITAIN && game.congress === to) disperse_continental_congress() if (has_enemy_general(to)) @@ -3131,6 +3136,7 @@ function end_battle() { if (game.active === P_BRITAIN && game.congress === game.move.to) disperse_continental_congress() + // TODO: lose regulars manual if (game.combat.british_losses >= 3) lose_regular_advantage() @@ -3153,7 +3159,6 @@ events.campaign = function (c, card) { } events.the_war_ends = function (c, card) { - set_delete(active_hand(), c) game.war_ends = c end_strategy_card() } @@ -3171,7 +3176,7 @@ function remove_random_card(hand) { if (hand.length > 0) { let i = random(hand.length) let c = hand[i] - log("Opponent discarded C" + c + ".") + log(ENEMY[game.active] + " discarded C" + c + ".") discard_card_from_hand(hand, c) if (CARDS[c].type === "mandatory-event") do_event(c) @@ -3425,13 +3430,14 @@ states.place_american_pc = { } events.place_american_pc_in = function (c, card) { - game.where = filter_place_american_pc_in_colony(card.where) + game.where = card.where game.state = "place_american_pc_in" } states.place_american_pc_in = { prompt() { view.prompt = "Place American PC markers in " + game.where.join(", ") + ". " + game.count + " left." + view.actions.pass = 1 gen_place_american_pc_in_colony(game.where) }, space(where) { @@ -3441,6 +3447,10 @@ states.place_american_pc_in = { end_strategy_card() } }, + pass() { + delete game.where + end_strategy_card() + }, } events.lord_sandwich_coastal_raids = function (c, card) { |