-
- getBasicMove([sx, sy], [ex, ey], tr) {
- const L = this.lastMoveEnd.length;
- const piece = (L >= 1 ? this.lastMoveEnd[L-1].p : null);
- if (
- this.board[ex][ey] == "" ||
- this.getColor(ex, ey) == C.GetOppTurn(this.turn)
- ) {
- if (piece && !tr)
- tr = {c: this.turn, p: piece};
- let mv = super.getBasicMove([sx, sy], [ex, ey], tr);
- if (piece)
- mv.vanish.pop(); //end of a chain: initial piece remains
- return mv;
- }
- // (Self)Capture: initial, or inside a chain
- const initPiece = (piece || this.getPiece(sx, sy)),
- destPiece = this.getPiece(ex, ey);
- let mv = new Move({
- start: {x: sx, y: sy},
- end: {x: ex, y: ey},
- appear: [
- new PiPo({
- x: ex,
- y: ey,
- c: this.turn,
- p: (!!tr ? tr.p : initPiece)
- })
- ],
- vanish: [
- new PiPo({
- x: ex,
- y: ey,
- c: this.turn,
- p: destPiece
- })
- ]
- });
- if (!piece) {
- // Initial capture
- mv.vanish.unshift(
- new PiPo({
- x: sx,
- y: sy,
- c: this.turn,
- p: initPiece
- })
- );
- }
- mv.chained = destPiece; //easier (no need to detect it)
-// mv.drag = {c: this.turn, p: initPiece}; //TODO: doesn't work
- return mv;
+ static get S_PIECES() {
+ return ['s', 'u', 'o', 'c', 't'];