From b761cfe1474a84f32acb179da9e88389e3078b07 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 16 Nov 2024 00:55:27 +0100 Subject: Fix "has unmoved piece" function to check for blocked in pieces. --- rules.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'rules.js') 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 -- cgit v1.2.3