X-Git-Url: https://git.auder.net/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FOtage.js;h=6c2b1ec0e43cc9ceb6694506428ef15e9991dacc;hb=1328e7dd5a73fd4a4eee85d5b86aea73b9a74f9f;hp=3e35767af8c618e4c603e827259400b1212ede22;hpb=f3f8470750e91ac7b5bf57a4e01c5791c54b65fb;p=vchess.git diff --git a/client/src/variants/Otage.js b/client/src/variants/Otage.js index 3e35767a..6c2b1ec0 100644 --- a/client/src/variants/Otage.js +++ b/client/src/variants/Otage.js @@ -646,11 +646,19 @@ export class OtageRules extends ChessRules { if (!m.end.released) return true; // Check for repetitions: V.PlayOnBoard(this.board, m); - const newState = { piece: m.end.released, position: this.getBaseFen() }; + const newState = { + piece: m.end.released, + square: { x: m.end.x, y: m.end.y }, + position: this.getBaseFen() + }; const repet = this.repetitions.some(r => { return ( r.piece == newState.piece && + ( + r.square.x == newState.square.x && + r.square.y == newState.square.y + ) && r.position == newState.position ); }); @@ -724,6 +732,7 @@ export class OtageRules extends ChessRules { this.repetitions.push( { piece: move.end.released, + square: { x: move.end.x, y: move.end.y }, position: this.getBaseFen() } ); @@ -739,7 +748,7 @@ export class OtageRules extends ChessRules { this.turn = V.GetOppCol(this.turn); this.movesCount--; } - if (!!move.end.releasd) this.repetitions.pop(); + if (!!move.end.released) this.repetitions.pop(); this.postUndo(move); }