X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FBenedict%2Fclass.js;h=5503f2f4e1f2e5a2c1dfe92be1f97538a68dcdae;hb=1080bc93379cd270e09f7d125e2cb95bda51f95f;hp=dfabddb72cc9a41efa3ef78026d78f43e8340a35;hpb=6b9320bb6e42ece7694df32f85aab4d2989f6a13;p=xogo.git diff --git a/variants/Benedict/class.js b/variants/Benedict/class.js index dfabddb..5503f2f 100644 --- a/variants/Benedict/class.js +++ b/variants/Benedict/class.js @@ -1,7 +1,6 @@ -import ChessRules from "/base_rules.js"; -import PiPo from "/utils/PiPo.js"; +import AbstractFlipRules from "/variants/_Flip/class.js"; -export default class BenedictRules extends ChessRules { +export default class BenedictRules extends AbstractFlipRules { static get Options() { return { @@ -25,14 +24,6 @@ export default class BenedictRules extends ChessRules { }; } - get hasEnpassant() { - return false; - } - - canTake() { - return false; - } - pieces(color, x, y) { if (!this.options["cleopatra"]) return super.pieces(color, x, y); @@ -82,38 +73,4 @@ export default class BenedictRules extends ChessRules { return bMoves; } - playOnBoard(move) { - super.playOnBoard(move); - this.flipColorOf(move.flips); - } - undoOnBoard(move) { - super.undoOnBoard(move); - this.flipColorOf(move.flips); - } - - flipColorOf(flips) { - for (let xy of flips) { - const newColor = C.GetOppCol(this.getColor(xy.x, xy.y)); - this.board[xy.x][xy.y] = newColor + this.board[xy.x][xy.y][1]; - } - } - - // Moves cannot flip our king's color, so all are valid - filterValid(moves) { - return moves; - } - - // A king under (regular) check flips color, and the game is over. - underCheck() { - return false; - } - - playVisual(move, r) { - super.playVisual(move, r); - move.flips.forEach(f => { - this.g_pieces[f.x][f.y].classList.toggle("white"); - this.g_pieces[f.x][f.y].classList.toggle("black"); - }); - } - };