Use setPiece in chess

This commit is contained in:
Dragon Fire
2021-03-27 11:36:59 -04:00
parent d9a11c922b
commit 6e6d3e939b
+1 -3
View File
@@ -191,9 +191,7 @@ module.exports = class ChessCommand extends Command {
const pawnMoved = gameState.pieces[choice[0]].toUpperCase() === 'P';
game.move(choice[0], choice[1]);
if (pawnMoved && choice[1].endsWith(gameState.turn === 'white' ? '8' : '1')) {
game.board.configuration.pieces[choice[1]] = gameState.turn === 'white'
? choice[2]
: choice[2].toLowerCase();
game.setPiece(choice[1], gameState.turn === 'white' ? choice[2] : choice[2].toLowerCase());
}
}
const timeTaken = new Date() - now;