projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Empire Chess
[vchess.git]
/
client
/
src
/
variants
/
Pocketknight.js
diff --git
a/client/src/variants/Pocketknight.js
b/client/src/variants/Pocketknight.js
index
8756ab9
..
41dbb72
100644
(file)
--- a/
client/src/variants/Pocketknight.js
+++ b/
client/src/variants/Pocketknight.js
@@
-3,7
+3,7
@@
import { randInt } from "@/utils/alea";
export class PocketknightRules extends ChessRules {
export class PocketknightRules extends ChessRules {
- hoverHighlight(
x, y
) {
+ hoverHighlight(
[x, y]
) {
// Testing move validity results in an infinite update loop.
// TODO: find a way to test validity anyway.
return (this.subTurn == 2 && this.board[x][y] == V.EMPTY);
// Testing move validity results in an infinite update loop.
// TODO: find a way to test validity anyway.
return (this.subTurn == 2 && this.board[x][y] == V.EMPTY);
@@
-45,6
+45,12
@@
export class PocketknightRules extends ChessRules {
);
}
);
}
+ canIplay(side, [x, y]) {
+ if (this.subTurn == 1) return super.canIplay(side, [x, y]);
+ // subturn == 2, drop the knight:
+ return side == this.turn && this.board[x][y] == V.EMPTY;
+ }
+
getPotentialMovesFrom([x, y]) {
if (this.subTurn == 1) {
let moves = super.getPotentialMovesFrom([x, y]);
getPotentialMovesFrom([x, y]) {
if (this.subTurn == 1) {
let moves = super.getPotentialMovesFrom([x, y]);