Only highlight checked king

This commit is contained in:
Dragon Fire
2021-02-07 18:23:19 -05:00
parent e91d028336
commit 436bef6efb
+1 -1
View File
@@ -274,7 +274,7 @@ module.exports = class ChessCommand extends Command {
const parsed = this.pickImage(piece);
const img = this.images[parsed.color][parsed.name];
const { x, y, width, height } = centerImagePart(img, 62, 62, w, h);
if ((gameState.check || gameState.checkMate) && piece.toUpperCase() === 'K') {
if ((gameState.check || gameState.checkMate) && piece === gameState.turn === 'white' ? 'K' : 'k') {
ctx.fillStyle = 'red';
ctx.globalAlpha = 0.5;
ctx.fillRect(w, h, 62, 62);