summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-08-25 16:15:36 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-25 16:15:36 +0200
commit2da9e82a0473de067284fbeccae1467d0650dd9e (patch)
tree316c8c305811cbcd1cc7fa2fed27a883490e76b1
parent0dc9801e65ab8d6ca8ea076567c51a4975d65b52 (diff)
downloadwashingtons-war-2da9e82a0473de067284fbeccae1467d0650dd9e.tar.gz
Fix British winter attrition with 1 CU Army.
-rw-r--r--rules.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/rules.js b/rules.js
index 604dd5a..f2c4d0a 100644
--- a/rules.js
+++ b/rules.js
@@ -3823,13 +3823,28 @@ function has_american_winter_attrition(s) {
if (n_american > 0)
return true
- // French suffer attrition only at WQ
+ // French suffer attrition only outside WQ
if (n_french > 0 && !is_winter_quarter_space(s))
return true
return false
}
+function has_british_winter_attrition(s) {
+ let wq = is_winter_quarter_space(s)
+ let n_british = count_british_cu(s)
+
+ // EXCEPT: Single CU in a space with General.
+ if (n_british === 1 && has_british_general(s))
+ return false
+
+ // British suffer attrition only outside WQ
+ if (n_british > 0 && !is_winter_quarter_space(s))
+ return true
+
+ return false
+}
+
function goto_american_winter_attrition() {
game.active = P_AMERICA
game.attrition = []
@@ -3852,12 +3867,9 @@ function end_american_winter_attrition() {
function goto_british_winter_attrition() {
game.active = P_BRITAIN
game.attrition = []
- for (let space of all_spaces) {
- let wq = is_winter_quarter_space(space)
- let n_british = count_british_cu(space)
- if (n_british > 0 && !wq)
- game.attrition.push(space)
- }
+ for (let s of all_spaces)
+ if (has_british_winter_attrition(s))
+ game.attrition.push(s)
if (game.attrition.length > 0) {
log("=b Winter Attrition")
game.state = "british_winter_attrition"