From e91d02833602ba8c2f7ee039aaf3c67e16c08db7 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 7 Feb 2021 18:20:09 -0500 Subject: [PATCH] Highlight king red when in check --- commands/games-mp/chess.js | 8 +++++++- package.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/commands/games-mp/chess.js b/commands/games-mp/chess.js index d64663f9..44a490ba 100644 --- a/commands/games-mp/chess.js +++ b/commands/games-mp/chess.js @@ -274,7 +274,13 @@ 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 (prevPieces && (!prevGamePiece || piece !== prevGamePiece)) { + if ((gameState.check || gameState.checkMate) && piece.toUpperCase() === 'K') { + ctx.fillStyle = 'red'; + ctx.globalAlpha = 0.5; + ctx.fillRect(w, h, 62, 62); + ctx.globalAlpha = 1; + ctx.drawImage(img, x, y, width, height); + } else if (prevPieces && (!prevGamePiece || piece !== prevGamePiece)) { ctx.fillStyle = 'yellow'; ctx.globalAlpha = 0.5; ctx.fillRect(w, h, 62, 62); diff --git a/package.json b/package.json index c34d9db5..5f06f4e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "128.5.1", + "version": "128.5.2", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {