summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-07-10 23:53:10 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-21 00:28:20 +0200
commitdbf4c2f576af9d2d8c168a26433b56bb10e3bc8f (patch)
tree078719223e9b554e58ad5c32c85ae76d3e56f37b
parent93af4411e518c72ec9decef6295c5b31931927b6 (diff)
downloadwashingtons-war-dbf4c2f576af9d2d8c168a26433b56bb10e3bc8f.tar.gz
fixes
-rw-r--r--rules.js56
1 files changed, 48 insertions, 8 deletions
diff --git a/rules.js b/rules.js
index ac0bd39..94416c9 100644
--- a/rules.js
+++ b/rules.js
@@ -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)