summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-25 16:03:38 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-30 21:59:25 +0200
commit3983fc1e2f8535f032c37f7fec2e950322d5ab39 (patch)
tree62aaac1d17143e219d61b4a91aa6556301d74809 /rules.js
parentb01409b167ab50ef8283ce99ec8c821b6634266e (diff)
downloadfriedrich-3983fc1e2f8535f032c37f7fec2e950322d5ab39.tar.gz
fix flipping other power's stacks oos
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 6eacb09..d40d3d5 100644
--- a/rules.js
+++ b/rules.js
@@ -3089,9 +3089,11 @@ function austria_may_flip_any_one_prussian_general_or_stack_in_austria_or_saxony
set_active_to_power(P_AUSTRIA)
game.selected = []
- for (let p of all_power_generals[P_PRUSSIA])
- if (!is_out_of_supply(p) && (set_has(data.country.Austria, p) || set_has(data.country.Saxony, p)))
+ for (let p of all_power_generals[P_PRUSSIA]) {
+ let s = game.pos[p]
+ if (!is_out_of_supply(p) && (set_has(data.country.Austria, s) || set_has(data.country.Saxony, s)))
game.selected.push(p)
+ }
if (game.selected.length > 0) {
game.state = "flip_any_one_prussian_general_or_stack_in_austria_or_saxony"
@@ -3244,8 +3246,9 @@ states.flip_any_one_prussian_general_or_stack_in_austria_or_saxony = {
}
function flip_stack_out_of_supply(p) {
- for (let x of all_power_generals[game.power]) {
- if (game.pos[x] === game.pos[p]) {
+ let s = game.pos[p]
+ for (let x of all_generals) {
+ if (game.pos[x] === s) {
log("P" + x + " out of supply")
set_out_of_supply(x)
set_delete(game.selected, x)