Fix failing auto play due to dusk pool tile offset.

This commit is contained in:
yukirij 2024-09-05 23:16:12 -07:00
parent 523b1c30a5
commit 5d0315482f

View File

@ -1269,7 +1269,7 @@ const INTERFACE = {
},
auto_play() {
if(INTERFACE_DATA.auto_mode !== (GAME_DATA.turn & 1) && !GAME_DATA.state.checkmate) { return; }
if(INTERFACE_DATA.auto_mode !== (GAME_DATA.turn & 1) || GAME_DATA.state.checkmate) { return; }
function state_score(state, player) {
let score = 0;
@ -1416,6 +1416,12 @@ const INTERFACE = {
let result = determine_play(GAME_DATA, GAME_DATA.turn & 1, 1);
if(result !== null) {
// Add 7 to tile to indicate Dusk player pool.
if(result.play.source == 1 && (GAME_DATA.turn & 1) === 1) {
result.play.from += 7;
}
INTERFACE.process(result.play);
} else {
console.log("warn: autoplay move was null.");