Highlight king red when in check

This commit is contained in:
Dragon Fire
2021-02-07 18:20:09 -05:00
parent 98db73bc1f
commit e91d028336
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -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);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "128.5.1",
"version": "128.5.2",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {