X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAtomic2.js;fp=client%2Fsrc%2Fvariants%2FAtomic2.js;h=0000000000000000000000000000000000000000;hb=10cceb25109739fa39b9b968be2707dee1d25a07;hp=54ffb17a35eb5415f5612bd6114c2d6b1c2b92e3;hpb=8b148817f3542c4af5fe9ec175b2f3833429346d;p=vchess.git diff --git a/client/src/variants/Atomic2.js b/client/src/variants/Atomic2.js deleted file mode 100644 index 54ffb17a..00000000 --- a/client/src/variants/Atomic2.js +++ /dev/null @@ -1,62 +0,0 @@ -import { ChessRules, Move, PiPo } from "@/base_rules"; -import { Atomic1Rules } from "@/variants/Atomic1"; - -export class Atomic2Rules extends Atomic1Rules { - - getPotentialMovesFrom([x, y]) { - if (this.movesCount == 0) { - if ([1, 6].includes(x)) { - const c = this.getColor(x, y); - return [ - new Move({ - appear: [], - vanish: [ - new PiPo({ x: x, y: y, p: V.PAWN, c: c }) - ], - start: { x: x, y: y }, - end: { x: x, y: y } - }) - ]; - } - return []; - } - return super.getPotentialMovesFrom([x, y]); - } - - hoverHighlight([x, y]) { - return this.movesCount == 0 && [1, 6].includes(x); - } - - canIplay(side, [x, y]) { - if (this.movesCount == 0) - return (this.turn == side && this.getPiece(x, y) == V.PAWN); - return super.canIplay(side, [x, y]); - } - - doClick(square) { - if (this.movesCount >= 1) return null; - const [x, y] = [square[0], square[1]]; - if (![1, 6].includes(x)) return null; - return new Move({ - appear: [], - vanish: [ - new PiPo({ - x: x, - y: y, - c: this.getColor(x, y), - p: V.PAWN - }) - ], - start: { x: x, y: y }, - end: { x: x, y: y } - }); - } - - getNotation(move) { - if (move.appear.length == 0 && move.vanish.length == 1) - // First move in game - return V.CoordsToSquare(move.start) + "X"; - return super.getNotation(move); - } - -};