From: Benjamin Auder Date: Thu, 9 Jun 2022 11:14:56 +0000 (+0200) Subject: rename pieces X-Git-Url: https://git.auder.net/images/assets/js/img/pieces/current/git-logo.png?a=commitdiff_plain;h=b0cf998b1f63aa23916ab35a3d978b6972d273c5;p=xogo.git rename pieces --- diff --git a/pieces/black_king_bishop.svg b/pieces/black_king_bishop.svg deleted file mode 100644 index 508381b..0000000 --- a/pieces/black_king_bishop.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/pieces/black_king_bishop.svg b/pieces/black_king_bishop.svg new file mode 120000 index 0000000..f53a984 --- /dev/null +++ b/pieces/black_king_bishop.svg @@ -0,0 +1 @@ +red_bishop.svg \ No newline at end of file diff --git a/pieces/black_king_knight.svg b/pieces/black_king_knight.svg deleted file mode 100644 index 537dc09..0000000 --- a/pieces/black_king_knight.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/pieces/black_king_knight.svg b/pieces/black_king_knight.svg new file mode 120000 index 0000000..1c857b5 --- /dev/null +++ b/pieces/black_king_knight.svg @@ -0,0 +1 @@ +red_knight.svg \ No newline at end of file diff --git a/pieces/black_king_pawn.svg b/pieces/black_king_pawn.svg deleted file mode 100644 index 718a4a3..0000000 --- a/pieces/black_king_pawn.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/pieces/black_king_pawn.svg b/pieces/black_king_pawn.svg new file mode 120000 index 0000000..6c7fc82 --- /dev/null +++ b/pieces/black_king_pawn.svg @@ -0,0 +1 @@ +red_pawn.svg \ No newline at end of file diff --git a/pieces/black_king_queen.svg b/pieces/black_king_queen.svg deleted file mode 100644 index 52fcc2d..0000000 --- a/pieces/black_king_queen.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/pieces/black_king_queen.svg b/pieces/black_king_queen.svg new file mode 120000 index 0000000..8ce9f99 --- /dev/null +++ b/pieces/black_king_queen.svg @@ -0,0 +1 @@ +red_queen.svg \ No newline at end of file diff --git a/pieces/black_king_rook.svg b/pieces/black_king_rook.svg deleted file mode 100644 index e4051e4..0000000 --- a/pieces/black_king_rook.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/pieces/black_king_rook.svg b/pieces/black_king_rook.svg new file mode 120000 index 0000000..d2f0509 --- /dev/null +++ b/pieces/black_king_rook.svg @@ -0,0 +1 @@ +red_rook.svg \ No newline at end of file diff --git a/pieces/red_bishop.svg b/pieces/red_bishop.svg new file mode 100644 index 0000000..508381b --- /dev/null +++ b/pieces/red_bishop.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pieces/red_king.svg b/pieces/red_king.svg new file mode 100644 index 0000000..e04fcb2 --- /dev/null +++ b/pieces/red_king.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/pieces/red_knight.svg b/pieces/red_knight.svg new file mode 100644 index 0000000..537dc09 --- /dev/null +++ b/pieces/red_knight.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/red_pawn.svg b/pieces/red_pawn.svg new file mode 100644 index 0000000..718a4a3 --- /dev/null +++ b/pieces/red_pawn.svg @@ -0,0 +1,3 @@ + + + diff --git a/pieces/red_queen.svg b/pieces/red_queen.svg new file mode 100644 index 0000000..52fcc2d --- /dev/null +++ b/pieces/red_queen.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/pieces/red_rook.svg b/pieces/red_rook.svg new file mode 100644 index 0000000..e4051e4 --- /dev/null +++ b/pieces/red_rook.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pieces/white_king_bishop.svg b/pieces/white_king_bishop.svg deleted file mode 100644 index 4af5154..0000000 --- a/pieces/white_king_bishop.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/pieces/white_king_bishop.svg b/pieces/white_king_bishop.svg new file mode 120000 index 0000000..6c74d4b --- /dev/null +++ b/pieces/white_king_bishop.svg @@ -0,0 +1 @@ +yellow_bishop.svg \ No newline at end of file diff --git a/pieces/white_king_knight.svg b/pieces/white_king_knight.svg deleted file mode 100644 index 20541c8..0000000 --- a/pieces/white_king_knight.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/pieces/white_king_knight.svg b/pieces/white_king_knight.svg new file mode 120000 index 0000000..59f1715 --- /dev/null +++ b/pieces/white_king_knight.svg @@ -0,0 +1 @@ +yellow_knight.svg \ No newline at end of file diff --git a/pieces/white_king_pawn.svg b/pieces/white_king_pawn.svg deleted file mode 100644 index bc21051..0000000 --- a/pieces/white_king_pawn.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/pieces/white_king_pawn.svg b/pieces/white_king_pawn.svg new file mode 120000 index 0000000..86b8dd8 --- /dev/null +++ b/pieces/white_king_pawn.svg @@ -0,0 +1 @@ +yellow_pawn.svg \ No newline at end of file diff --git a/pieces/white_king_queen.svg b/pieces/white_king_queen.svg deleted file mode 100644 index 185be0e..0000000 --- a/pieces/white_king_queen.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/pieces/white_king_queen.svg b/pieces/white_king_queen.svg new file mode 120000 index 0000000..cfb8668 --- /dev/null +++ b/pieces/white_king_queen.svg @@ -0,0 +1 @@ +yellow_queen.svg \ No newline at end of file diff --git a/pieces/white_king_rook.svg b/pieces/white_king_rook.svg deleted file mode 100644 index 6c6528f..0000000 --- a/pieces/white_king_rook.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/pieces/white_king_rook.svg b/pieces/white_king_rook.svg new file mode 120000 index 0000000..dafd4b9 --- /dev/null +++ b/pieces/white_king_rook.svg @@ -0,0 +1 @@ +yellow_rook.svg \ No newline at end of file diff --git a/pieces/yellow_bishop.svg b/pieces/yellow_bishop.svg new file mode 100644 index 0000000..4af5154 --- /dev/null +++ b/pieces/yellow_bishop.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/yellow_king.svg b/pieces/yellow_king.svg new file mode 100644 index 0000000..9aed42c --- /dev/null +++ b/pieces/yellow_king.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/yellow_knight.svg b/pieces/yellow_knight.svg new file mode 100644 index 0000000..20541c8 --- /dev/null +++ b/pieces/yellow_knight.svg @@ -0,0 +1,4 @@ + + + + diff --git a/pieces/yellow_pawn.svg b/pieces/yellow_pawn.svg new file mode 100644 index 0000000..bc21051 --- /dev/null +++ b/pieces/yellow_pawn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/pieces/yellow_queen.svg b/pieces/yellow_queen.svg new file mode 100644 index 0000000..185be0e --- /dev/null +++ b/pieces/yellow_queen.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/pieces/yellow_rook.svg b/pieces/yellow_rook.svg new file mode 100644 index 0000000..6c6528f --- /dev/null +++ b/pieces/yellow_rook.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/variants/Chakart/class.js b/variants/Chakart/class.js index 0403624..9b62150 100644 --- a/variants/Chakart/class.js +++ b/variants/Chakart/class.js @@ -141,7 +141,7 @@ export class ChakartRules extends ChessRules { b: Array.toObject(pieces, allCapts.slice(6, 12)) }; this.reserve = { w: {}, b: {} }; //to be replaced by this.captured - this.effect = ""; + this.moveStack = []; } // For Toadette bonus @@ -186,10 +186,57 @@ export class ChakartRules extends ChessRules { // TODO: rethink from here: + +// allow pawns + // queen invisible move, king shell: special functions + +// prevent pawns from capturing invisible queen (post) +// post-process: + +//events : playPlusVisual after mouse up, playReceived (include animation) on opp move +// ==> if move.cont (banana...) self re-call playPlusVisual (rec ?) + + // Initial call: effects resolved after playing getPotentialMovesFrom([x, y]) { let moves = []; - if (this.subTurn == 1) { - moves = super.getPotentialMovesFrom([x, y]); + switch (this.getPiece(x, y)) { + case 'p': + moves = this.getPawnMovesFrom([x, y]); //apply promotions + break; + case 'q': + moves = this.getQueenMovesFrom([x, y]); + break; + case 'k', + moves = this.getKingMoves([x, y]); + break; + default: + moves = super.getPotentialMovesFrom([x, y]); + } + return moves; + } + + + + tryMoveFollowup(move) { + if (this.getColor(move.end.x, move.end.y) == 'a') { + // effect, or bonus/malus + const endType = this.getPiece(m.end.x, m.end.y); + if (endType == V.EGG) + this.applyRandomBonus(m); + else { + this.moveStack.push(m); + switch (endType) { + case V.BANANA: + this.randomRedirect( + case V.BOMB: + case V.MUSHROOM: + // aller dans direction, saut par dessus pièce adverse + // ou amie (tjours), new step si roi caval pion + } + } + } + + const finalPieces = V.PawnSpecs.promotions; const color = this.turn; const lastRank = (color == "w" ? 0 : 7); @@ -271,8 +318,8 @@ export class ChakartRules extends ChessRules { // Helper for getBasicMove(): banana/bomb effect getRandomSquare([x, y], steps) { - const validSteps = steps.filter(s => V.OnBoard(x + s[0], y + s[1])); - const step = validSteps[randInt(validSteps.length)]; + const validSteps = steps.filter(s => this.onBoard(x + s[0], y + s[1])); + const step = validSteps[Random.randInt(validSteps.length)]; return [x + step[0], y + step[1]]; } @@ -923,7 +970,8 @@ export class ChakartRules extends ChessRules { - +/// if any of my pieces was immobilized, it's not anymore. + //if play set a piece immobilized, then mark it prePlay(move) { if (move.effect == "toadette") this.reserve = this.captured;