diff options
-rw-r--r-- | rules.js | 56 |
1 files changed, 48 insertions, 8 deletions
@@ -2,6 +2,7 @@ // 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) @@ -842,7 +843,7 @@ function place_british_reinforcements(who, count, where) { move_british_cu(BRITISH_REINFORCEMENTS, where, count) if (has_enemy_general(where)) capture_enemy_general(where) - if (game.active === P_BRITAIN && game.congress === where) + if (game.congress === where) disperse_continental_congress() } } @@ -2112,9 +2113,10 @@ function disperse_and_overrun_after_move() { let cu = game.move.carry_british + game.move.carry_american + game.move.carry_french let to = game.move.to if (cu > 0) { - if (cu >= 4 && count_enemy_cu(to) === 1 && !has_enemy_general(to)) { + if (has_enemy_general(to)) + capture_enemy_general(to) + if (cu >= 4 && count_enemy_cu(to) === 1 && !has_enemy_general(to)) overrun(to) - } if (game.active === P_BRITAIN && game.congress === to && !has_enemy_cu(to)) { disperse_continental_congress() } @@ -2414,6 +2416,8 @@ states.retreat_before_battle_roll = { move_army(game.retreat) if (has_enemy_general(to)) capture_enemy_general(to) + if (game.active === P_BRITAIN && game.congress === to) + disperse_continental_congress() delete game.retreat goto_remove_general_after_retreat_before_battle(to) } else { @@ -2476,9 +2480,9 @@ states.play_attacker_battle_card = { }, card(c) { play_battle_card(this, c) - // TODO: pause! }, card_battle_play(c) { + push_undo() play_card(c, "for +2 DRM") if (game.active === P_BRITAIN) { if (CARDS[c].event === "remove_benedict_arnold") @@ -2489,9 +2493,10 @@ states.play_attacker_battle_card = { game.combat.a_draw_after_battle = true game.combat.a_bonus += 2 } - goto_play_defender_battle_card() + game.state = "play_attacker_battle_card_confirm" }, card_battle_discard(c) { + push_undo() discard_card(c, "for +1 DRM") if (game.active === P_BRITAIN) { game.combat.b_draw_after_battle = true @@ -2500,9 +2505,25 @@ states.play_attacker_battle_card = { game.combat.a_draw_after_battle = true game.combat.a_bonus += 1 } - goto_play_defender_battle_card() + game.state = "play_attacker_battle_card_confirm" }, pass() { + clear_undo() + goto_play_defender_battle_card() + }, +} + +states.play_attacker_battle_card_confirm = { + prompt() { + let drm = (game.active === P_BRITAIN) ? game.combat.b_bonus : game.combat.a_bonus + view.prompt = `Attack: +${drm} DRM.` + if (drm > 1) + view.prompt = "Attack: Played card for +2 DRM." + else + view.prompt = "Attack: Discarded card for +1 DRM." + }, + next() { + clear_undo() goto_play_defender_battle_card() }, } @@ -2523,6 +2544,7 @@ states.play_defender_battle_card = { // TODO: pause! }, card_battle_play(c) { + push_undo() play_card(c, "for +2 DRM") if (game.active === P_BRITAIN) { if (CARDS[c].event === "remove_benedict_arnold") @@ -2533,9 +2555,10 @@ states.play_defender_battle_card = { game.combat.a_draw_after_battle = true game.combat.a_bonus += 2 } - resolve_battle() + game.state = "play_defender_battle_card_confirm" }, card_battle_discard(c) { + push_undo() discard_card(c, "for +1 DRM") if (game.active === P_BRITAIN) { game.combat.b_draw_after_battle = true @@ -2544,9 +2567,25 @@ states.play_defender_battle_card = { game.combat.a_draw_after_battle = true game.combat.a_bonus += 1 } - resolve_battle() + game.state = "play_defender_battle_card_confirm" }, pass() { + clear_undo() + resolve_battle() + }, +} + +states.play_defender_battle_card_confirm = { + prompt() { + let drm = (game.active === P_BRITAIN) ? game.combat.b_bonus : game.combat.a_bonus + if (drm > 1) + view.prompt = "Defend: Played card for +2 DRM." + else + view.prompt = "Defend: Discarded card for +1 DRM." + view.actions.next = 1 + }, + next() { + clear_undo() resolve_battle() }, } @@ -2938,6 +2977,7 @@ states.retreat_after_battle = { else retreat_american_army(game.move.to, to) + // TODO: disperse congress? if (has_enemy_general(to)) capture_enemy_general(to) |