- // NOTE: getBasicMove, ajouter les bonus à vanish array
- // + déterminer leur effet (si cavalier) ou case (si banane ou bombe)
- // (L'effet doit être caché au joueur : devrait être OK)
- }
-
- getSlideNJumpMpves(sq, steps, oneStep) {
- // Saut possible par dessus bonus ou champis mais pas bananes ou bombes
-//==> redefinir isAttackedBySlide et getPotentialSlide...
- }
-
- getPotentialPawnMoves(sq) {
- //Toad: pion
- // laisse sur sa case de départ un champi turbo permettant à Peach et cavalier et autres pions d'aller
- // un dep plus loin (evt 2 cases si pion saut initial), et aux pièces arrivant sur cette case de sauter par
- // dessus une pièce immédiatement adjacente dans leur trajectoire (en atterissant juste derrière).
- }
-
- // Coups en 2 temps (si pose possible)
- getPotentialRookMoves(sq) {
- //Donkey : tour
- // pose une banane (optionnel) sur une case adjacente (diagonale) à celle d'arrivée
- // Si une pièce arrive sur la peau de banane, alors elle effectue un déplacement
- // aléatoire d'une (2?) case (vertical ou horizontal) depuis sa position finale.
- }
-
- // Coups en 2 temps (si pose)
- getPotentialBishopMoves([x, y]) {
- //Wario: fou
- // pose une bombe (optionnel) sur une case orthogonalement adjacente à la case d'arrivée
- // Si une pièce arrive sur une bombe, alors elle effectue un déplacement diagonal
- // aléatoire d'une (2?) case depuis sa position finale (juste une case si impossible).
- }
-
- getPotentialKnightMoves([x, y]) {
- //Yoshi: cavalier
- // laisse sur sa case de départ un bonus aléatoire
- // (NOTE: certains bonus pourraient ne pas être applicables ==> pion bloqué par exemple)
- // - i) roi boo(*E*) : échange avec n'importe quelle pièce (choix du joueur, type et/ou couleur différents)
- // - i*) koopa(*B*) : ramène sur la case initiale
- // - ii) toadette(*R*) : permet de poser une pièce capturée sur le plateau
- // (n'importe où sauf 8eme rangée pour les pions)
- // - ii*) chomp(*W*) : mange la pièce ; si c'est Peach, c'est perdu
- // - iii) daisy(*T*) : permet de rejouer un coup avec la même pièce --> cumulable si ensuite coup sur bonus Daisy.
- // - iii*) bowser(*M*) : immobilise la pièce (marquée jaune/rouge), qui ne pourra pas jouer au tour suivant
- // - iv) luigi(*L*) : fait changer de camp une pièce adverse (aléatoire) (sauf le roi)
- // - iv*) waluigi(*D*) : fait changer de camp une de nos pièces (aléatoire, sauf le roi)
- // --> i, ii, iii en deux temps (subTurn 1 & 2)
- }
-
- getPotentialQueenMoves(sq) {
- //Mario: dame
- // pouvoir "fantôme" : peut effectuer une fois dans la partie un coup non-capturant invisible (=> choix à chaque coup, getPPpath(m) teste m.nvisible...)
- //wg bg ghost once in the game the queen can make an invisible move --> printed as "?"
- }
-
- getPotentialKingMoves(sq) {
- //Peach: roi
- // Carapace rouge (disons ^^) jouable une seule fois dans la partie,
- // au lieu de se déplacer. Capture un ennemi au choix parmi les plus proches,
- // à condition qu'ils soient visibles (suivant les directions de déplacement d'une dame).
- // Profite des accélérateurs posés par les pions (+ 1 case : obligatoire).
- }
-
- isAttackedBySlideNJump() {
- // TODO:
- }
-
- atLeastOneMove() {
- // TODO: check that
- return true;
+ // Apply mushroom, bomb or banana effect (hidden to the player).
+ // Determine egg effect, too, and apply its first part if possible.
+ // add egg + add mushroom for pawns.
+ let move = super.getBasicMove([x1, y1], [x2, y2]);
+ // TODO
+ return move;
+ // Infer move type based on its effects (used to decide subTurn 1 --> 2)
+ // --> impossible étant donné juste first part (egg --> effect?)
+ // => stocker l'effet (i, ii ou iii) dans le coup directement,
+ // Pas terrible, mais y'aura pas 36 variantes comme ça. Disons end.effect == null, 0, 1, 2 ou 3
+ // 0 => tour ou fou, pose potentielle.
+ // If queen can be invisible, add move same start + end but final type changes
+ }
+
+ getPotentialKingMoves([x, y]) {
+ let moves = super.getPotentialKingMoves([x, y]);
+ // TODO: if flags allows it, add 'remote shell captures'
+ return moves;
+ }
+
+ getSlideNJumpMoves([x, y], steps, oneStep) {
+ let moves = [];
+ outerLoop: for (let step of steps) {
+ let i = x + step[0];
+ let j = y + step[1];
+ while (
+ V.OnBoard(i, j) &&
+ (
+ this.board[i][j] == V.EMPTY ||
+ (
+ this.getColor(i, j) == 'a' &&
+ [V.EGG, V.MUSHROOM].includes(this.getPiece(i, j))
+ )
+ )
+ ) {
+ moves.push(this.getBasicMove([x, y], [i, j]));
+ if (oneStep) continue outerLoop;
+ i += step[0];
+ j += step[1];
+ }
+ if (V.OnBoard(i, j) && this.canTake([x, y], [i, j]))
+ moves.push(this.getBasicMove([x, y], [i, j]));
+ }
+ return moves;