summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-09-19 23:38:39 +0200
committerTor Andersson <tor@ccxvii.net>2024-09-19 23:38:39 +0200
commit0bd1f49fc832a3a022ab2e7201a7227ad7b760e2 (patch)
tree8ef3cf6519ebf5574eed2be3bcd13ef19002c104
parentf493bce41a2d95913d28bcdf6b57cc26fb3d53bb (diff)
downloadwashingtons-war-0bd1f49fc832a3a022ab2e7201a7227ad7b760e2.tar.gz
Fix bringing on Rochambeau after being imprisoned.
-rw-r--r--rules.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/rules.js b/rules.js
index 96a4f30..d393351 100644
--- a/rules.js
+++ b/rules.js
@@ -1934,12 +1934,17 @@ states.ops_american_reinforcements_where = {
inactive: "to reinforce",
prompt() {
view.prompt = "Reinforcements: Choose a space."
- view.move = { from: AMERICAN_REINFORCEMENTS, to: AMERICAN_REINFORCEMENTS, who: game.who, carry_american: game.count }
view.selected_general = game.who
- gen_american_reinforcements_where(game.who)
+ if (game.who === ROCHAMBEAU && location_of_general(ROCHAMBEAU) === FRENCH_REINFORCEMENTS) {
+ view.move = { from: FRENCH_REINFORCEMENTS, to: FRENCH_REINFORCEMENTS, who: game.who, carry_american: 0, carry_french: 5 }
+ gen_french_reinforcements_where(game.who)
+ } else {
+ view.move = { from: AMERICAN_REINFORCEMENTS, to: AMERICAN_REINFORCEMENTS, who: game.who, carry_american: game.count }
+ gen_american_reinforcements_where(game.who)
+ }
},
space(space) {
- if (game.who === ROCHAMBEAU)
+ if (game.who === ROCHAMBEAU && location_of_general(ROCHAMBEAU) === FRENCH_REINFORCEMENTS)
place_french_reinforcements(game.who, space)
else
place_american_reinforcements(game.who, game.count, space)
@@ -1986,12 +1991,15 @@ function gen_american_reinforcements_who() {
function gen_american_reinforcements_where(general) {
for (let space of all_spaces) {
if (!has_british_cu(space) && !has_british_pc(space)) {
- if (general === ROCHAMBEAU) {
- if (is_port(space))
- gen_action_space(space)
- } else {
- gen_action_space(space)
- }
+ gen_action_space(space)
+ }
+ }
+}
+
+function gen_french_reinforcements_where(general) {
+ for (let space of all_port_spaces) {
+ if (!has_british_cu(space) && !has_british_pc(space)) {
+ gen_action_space(space)
}
}
}
@@ -4140,8 +4148,6 @@ function goto_place_rochambeau() {
if (can_place_rochambeau()) {
game.state = "place_rochambeau"
} else {
- move_general(ROCHAMBEAU, AMERICAN_REINFORCEMENTS)
- move_french_cu(FRENCH_REINFORCEMENTS, AMERICAN_REINFORCEMENTS, 5)
end_place_rochambeau()
}
}