summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-07-27 17:54:42 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-21 00:28:20 +0200
commit7a66c1d6f19d7c535726717bfb5c120064d44e24 (patch)
tree7828f6cebb40d8179e5afd175caa3904d4182b1c
parent0513bcc2d851d74521b9dabd8809fc333e9d0b84 (diff)
downloadwashingtons-war-7a66c1d6f19d7c535726717bfb5c120064d44e24.tar.gz
retreat and move tweaks
-rw-r--r--rules.js35
1 files changed, 26 insertions, 9 deletions
diff --git a/rules.js b/rules.js
index 5a3cd7c..ea0992d 100644
--- a/rules.js
+++ b/rules.js
@@ -1472,6 +1472,11 @@ function end_strategy_card() {
game.state = "end_strategy_card"
}
+function end_strategy_card_after_move() {
+ end_strategy_card()
+ next_strategy_card()
+}
+
states.end_strategy_card = {
prompt() {
view.prompt = "Card play done."
@@ -1980,8 +1985,7 @@ states.remove_general_after_retreat = {
move_general(g, BRITISH_REINFORCEMENTS)
else
move_general(g, AMERICAN_REINFORCEMENTS)
- end_battle()
- next_strategy_card() // NOTE: skip pause at end of movement
+ game.state = "retreat_after_battle_confirm"
},
}
@@ -2147,7 +2151,7 @@ states.ops_general_move = {
},
stop() {
push_undo()
- end_move()
+ end_move(true)
},
}
@@ -2196,10 +2200,10 @@ function resume_moving() {
// TODO: auto-end move or require manually stopping at final space?
if (game.move.count === 0)
- end_move()
+ end_move(false)
}
-function end_move() {
+function end_move(stop) {
let where = location_of_general(game.move.who)
if (has_general_moved(game.move.who)) {
mark_moved_british_cu(where, game.move.carry_british)
@@ -2211,8 +2215,11 @@ function end_move() {
if (count_friendly_generals(where) > 1)
goto_remove_general(where)
- else
+ else {
end_strategy_card()
+ if (stop)
+ next_strategy_card()
+ }
}
function path_type(from, to) {
@@ -3094,10 +3101,9 @@ states.retreat_after_battle = {
if (count_friendly_generals(to) > 1)
goto_remove_general_after_retreat(to)
else
- end_battle()
+ game.state = "retreat_after_battle_confirm"
},
surrender() {
- push_undo()
logp("surrendered")
if (game.active === P_BRITAIN)
surrender_british_army(game.move.to)
@@ -3107,6 +3113,17 @@ states.retreat_after_battle = {
},
}
+states.retreat_after_battle_confirm = {
+ prompt() {
+ view.prompt = "Retreat after battle: Done."
+ view.actions.next = 1
+ },
+ next() {
+ clear_undo()
+ end_battle()
+ },
+}
+
/* END BATTLE */
function end_battle() {
@@ -3126,7 +3143,7 @@ function end_battle() {
delete game.combat
- end_move()
+ end_move(true)
}
/* EVENTS */