From 0bd1f49fc832a3a022ab2e7201a7227ad7b760e2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 19 Sep 2024 23:38:39 +0200 Subject: Fix bringing on Rochambeau after being imprisoned. --- rules.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'rules.js') 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() } } -- cgit v1.2.3