From 2da9e82a0473de067284fbeccae1467d0650dd9e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 25 Aug 2024 16:15:36 +0200 Subject: Fix British winter attrition with 1 CU Army. --- rules.js | 26 +++++++++++++++++++------- 1 file 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" -- cgit v1.2.3