diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-05-23 23:51:56 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-05-23 23:51:56 +0200 |
commit | d1576a9002e4a72f315c2bfa38ee8145465fbc41 (patch) | |
tree | 77885afadda6ffd84bb35610a742e2b4df4f2c6f /rules.js | |
parent | b9ee0791e0834adbf8347ea198c4c0d580c7cf38 (diff) | |
download | washingtons-war-d1576a9002e4a72f315c2bfa38ee8145465fbc41.tar.gz |
place rochambeauold
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 49 |
1 files changed, 46 insertions, 3 deletions
@@ -3349,12 +3349,55 @@ states.place_french_navy_trigger = { place_navy: function (zone) { logp("placed French Navy.") game.french_navy = zone - game.active = game.save_active - delete game.save_active - end_strategy_card() + goto_place_rochambeau() + }, +} + +function can_place_rochambeau() { + for (let space in SPACES) + if (is_port(space)) + if (!has_british_cu(space) && !has_british_pc(space)) + return true + return false +} + +function goto_place_rochambeau() { + if (can_place_rochambeau()) { + game.state = "place_rochambeau" + } else { + move_general(ROCHAMBEAU, AMERICAN_REINFORCEMENTS) + move_cu(FRENCH, FRENCH_REINFORCEMENTS, AMERICAN_REINFORCEMENTS, 5) + end_place_rochambeau() + } +} + +states.place_rochambeau = { + prompt: function (current) { + view.prompt = "Place Rochambeau in a port." + let can_place = false + for (let space in SPACES) { + if (is_port(space)) { + if (!has_british_cu(space) && !has_british_pc(space)) { + gen_action("place_reinforcements", space) + can_place = true + } + } + } + }, + place_reinforcements: function (space) { + logp("placed Rochambeau .") + move_general(ROCHAMBEAU, space) + move_cu(FRENCH, FRENCH_REINFORCEMENTS, space, 5) + end_place_rochambeau() }, } +function end_place_rochambeau() { + game.active = game.save_active + delete game.save_active + end_strategy_card() +} + states.place_french_navy = { prompt: function (current) { view.prompt = "Place the French Navy in a blockade zone." |