diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-03-24 18:18:26 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-05-03 18:48:16 +0200 |
commit | 538971835db430496060be2578d04022476bc05a (patch) | |
tree | 057f88ecb147b2e64bdab57216310b200e1e54a8 /rules.js | |
parent | bcd851278219b14c500bce350d174c0e40659f0e (diff) | |
download | andean-abyss-538971835db430496060be2578d04022476bc05a.tar.gz |
Don't move cubes that have already swept.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 36 |
1 files changed, 22 insertions, 14 deletions
@@ -2658,17 +2658,21 @@ function can_sweep_move(here) { let ndsc = has_capability(CAP_NDSC) for (let next of data.spaces[here].adjacent) { - if (has_piece(next, GOVT, TROOPS)) - return true - if (ndsc && has_piece(next, GOVT, POLICE)) - return true + if (!set_has(game.op.spaces, next)) { + if (has_piece(next, GOVT, TROOPS)) + return true + if (ndsc && has_piece(next, GOVT, POLICE)) + return true + } if (is_loc(next) && !has_any_guerrilla(next)) { for (let nextnext of data.spaces[next].adjacent) { if (nextnext !== here) { - if (has_piece(nextnext, GOVT, TROOPS)) - return true - if (ndsc && has_piece(next, GOVT, POLICE)) - return true + if (!set_has(game.op.spaces, nextnext)) { + if (has_piece(nextnext, GOVT, TROOPS)) + return true + if (ndsc && has_piece(next, GOVT, POLICE)) + return true + } } } } @@ -2679,15 +2683,19 @@ function can_sweep_move(here) { function gen_sweep_move(here) { // TODO: only unmoved pieces (can't move twice) for (let next of data.spaces[here].adjacent) { - if (game.op.ndsc) - gen_piece_in_space(next, GOVT, POLICE) - gen_piece_in_space(next, GOVT, TROOPS) + if (!set_has(game.op.spaces, next)) { + if (game.op.ndsc) + gen_piece_in_space(next, GOVT, POLICE) + gen_piece_in_space(next, GOVT, TROOPS) + } if (is_loc(next) && !has_any_guerrilla(next)) { for (let nextnext of data.spaces[next].adjacent) { if (nextnext !== here) { - if (game.op.ndsc) - gen_piece_in_space(nextnext, GOVT, POLICE) - gen_piece_in_space(nextnext, GOVT, TROOPS) + if (!set_has(game.op.spaces, nextnext)) { + if (game.op.ndsc) + gen_piece_in_space(nextnext, GOVT, POLICE) + gen_piece_in_space(nextnext, GOVT, TROOPS) + } } } } |