summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-24 18:36:46 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-30 21:59:25 +0200
commit3f60a6b5c7141eea3be0186898597261036e74be (patch)
tree91b7a2e7b4b5be12bad42849a115d763863535e8
parent79fc402a6aca823b694c7a4d9921222e1512f7b9 (diff)
downloadfriedrich-3f60a6b5c7141eea3be0186898597261036e74be.tar.gz
limit max number of troops to 8 * generals in play
-rw-r--r--rules.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index f28c49a..2c0e69c 100644
--- a/rules.js
+++ b/rules.js
@@ -115,7 +115,12 @@ function max_power_troops(pow) {
return 3
if (game.scenario === 2 && pow === P_PRUSSIA)
return 24
- return max_power_troops_4[pow]
+ let max = max_power_troops_4[pow]
+ let n = 0
+ for (let p of all_power_generals[pow])
+ if (game.pos[p] < REMOVED)
+ n += 8
+ return Math.min(n, max)
}
const all_powers = [ 0, 1, 2, 3, 4, 5, 6 ]