summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-16 00:55:27 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-23 13:54:27 +0100
commitb761cfe1474a84f32acb179da9e88389e3078b07 (patch)
tree7c4f5ae7dd68c68e71c28212a498ce292b3c2e4b /rules.js
parentc8d24d9b927a1fe0e4f1de623a325252a8b5743b (diff)
downloadmaria-b761cfe1474a84f32acb179da9e88389e3078b07.tar.gz
Fix "has unmoved piece" function to check for blocked in pieces.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/rules.js b/rules.js
index 2623f02..7cb23f7 100644
--- a/rules.js
+++ b/rules.js
@@ -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