summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-23 23:57:04 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-21 00:28:20 +0200
commit684a69dac7dac44c948f5cf86899b749c87068ca (patch)
treef85cba210478443450a87dee3af1cf6a6b98775e
parent447f30551abb5b21740d22d453bc20837c5f7983 (diff)
downloadwashingtons-war-684a69dac7dac44c948f5cf86899b749c87068ca.tar.gz
place rochambeau
# Conflicts: # rules.js
-rw-r--r--rules.js49
1 files changed, 46 insertions, 3 deletions
diff --git a/rules.js b/rules.js
index e470b8c..39f5e6f 100644
--- a/rules.js
+++ b/rules.js
@@ -3300,12 +3300,55 @@ states.place_french_navy_trigger = {
place_navy(zone) {
logp("placed French Navy.")
game.french_navy = zone
- game.active = game.save
- delete game.save
- 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() {
+ 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(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
+ delete game.save
+ end_strategy_card()
+}
+
states.place_french_navy = {
prompt() {
view.prompt = "Place the French Navy in a blockade zone."