diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-11-16 00:55:27 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-11-23 13:54:27 +0100 |
commit | b761cfe1474a84f32acb179da9e88389e3078b07 (patch) | |
tree | 7c4f5ae7dd68c68e71c28212a498ce292b3c2e4b /rules.js | |
parent | c8d24d9b927a1fe0e4f1de623a325252a8b5743b (diff) | |
download | maria-b761cfe1474a84f32acb179da9e88389e3078b07.tar.gz |
Fix "has unmoved piece" function to check for blocked in pieces.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -2361,7 +2361,7 @@ function init_movement() { function has_unmoved_piece(pow) { for (let p of all_controlled_pieces(pow)) - if (!set_has(game.moved, p) && is_piece_on_map(p)) + if (!set_has(game.moved, p) && is_piece_on_map(p) && can_piece_move_anywhere(p)) return true return false } @@ -2375,7 +2375,7 @@ function has_moved_piece_on_flanders_map(pow) { function has_unmoved_piece_on_flanders_map(pow) { for (let p of all_power_pieces[pow]) - if (is_flanders_space(game.pos[p]) && !set_has(game.moved, p)) + if (is_flanders_space(game.pos[p]) && !set_has(game.moved, p) && can_piece_move_anywhere(p)) return true return false } @@ -2458,6 +2458,13 @@ function can_general_move_anywhere(p) { return false } +function can_piece_move_anywhere(p) { + if (is_general(p)) + return can_general_move_anywhere(p) + else + return can_train_move_anywhere(p) +} + function may_dispute_flanders_movement() { if (game.flags & F_MOVE_DISPUTE) return false |