mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 22:32:52 +02:00
Fix
This commit is contained in:
@@ -65,7 +65,7 @@ module.exports = class ChessCommand extends Command {
|
|||||||
const user = game.exportJson().turn === 'black' ? opponent : msg.author;
|
const user = game.exportJson().turn === 'black' ? opponent : msg.author;
|
||||||
const gameState = game.exportJson();
|
const gameState = game.exportJson();
|
||||||
if (user.bot) {
|
if (user.bot) {
|
||||||
prevGameState = gameState;
|
prevGameState = game.exportJson();
|
||||||
game.aiMove(3);
|
game.aiMove(3);
|
||||||
} else {
|
} else {
|
||||||
await msg.say(stripIndents`
|
await msg.say(stripIndents`
|
||||||
@@ -132,7 +132,6 @@ module.exports = class ChessCommand extends Command {
|
|||||||
for (let i = 0; i < 64; i++) {
|
for (let i = 0; i < 64; i++) {
|
||||||
const piece = gameState.pieces[`${cols[col]}${row}`];
|
const piece = gameState.pieces[`${cols[col]}${row}`];
|
||||||
const prevGamePiece = prevGameState ? prevGameState.pieces[`${cols[col]}${row}`] : null;
|
const prevGamePiece = prevGameState ? prevGameState.pieces[`${cols[col]}${row}`] : null;
|
||||||
console.log(prevGamePiece === piece);
|
|
||||||
if (piece) {
|
if (piece) {
|
||||||
const parsed = this.pickImage(piece);
|
const parsed = this.pickImage(piece);
|
||||||
if (prevGameState && !prevGamePiece) {
|
if (prevGameState && !prevGamePiece) {
|
||||||
@@ -140,8 +139,7 @@ module.exports = class ChessCommand extends Command {
|
|||||||
} else {
|
} else {
|
||||||
ctx.drawImage(this.images[parsed.color][parsed.name], w, h, 52, 52);
|
ctx.drawImage(this.images[parsed.color][parsed.name], w, h, 52, 52);
|
||||||
}
|
}
|
||||||
}
|
} else if (prevGameState && prevGamePiece) {
|
||||||
if (prevGameState && !piece && prevGamePiece) {
|
|
||||||
ctx.fillStyle = 'green';
|
ctx.fillStyle = 'green';
|
||||||
ctx.globalAlpha = 0.5;
|
ctx.globalAlpha = 0.5;
|
||||||
ctx.fillRect(w, h, 52, 52);
|
ctx.fillRect(w, h, 52, 52);
|
||||||
|
|||||||
Reference in New Issue
Block a user