mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Highlight king red when in check
This commit is contained in:
@@ -274,7 +274,13 @@ module.exports = class ChessCommand extends Command {
|
|||||||
const parsed = this.pickImage(piece);
|
const parsed = this.pickImage(piece);
|
||||||
const img = this.images[parsed.color][parsed.name];
|
const img = this.images[parsed.color][parsed.name];
|
||||||
const { x, y, width, height } = centerImagePart(img, 62, 62, w, h);
|
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.fillStyle = 'yellow';
|
||||||
ctx.globalAlpha = 0.5;
|
ctx.globalAlpha = 0.5;
|
||||||
ctx.fillRect(w, h, 62, 62);
|
ctx.fillRect(w, h, 62, 62);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "128.5.1",
|
"version": "128.5.2",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user