import { ChessRules } from "@/base_rules";
export class ChakartRules extends ChessRules {
- // 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)
- //
- // Saut possible par dessus bonus ou champis mais pas bananes ou bombes
-//==> redefinir isAttackedBySlide et getPotentialSlide...
-
-// keep track of captured pieces: comme Grand; pieces can get back to board with toadette bonus.
-// --> pour ce bonus, passer "capture" temporairement en "reserve" pour permettre de jouer le coup.
+ static get CorrConfirm() {
+ // Because of bonus effects
+ return false;
+ }
- // "pièces" supplémentaires : bananes, bombes, champis, bonus --> + couleur ?
- // (Semble mieux sans couleur => couleur spéciale indiquant que c'est pas jouable)
- // (Attention: pas jouables cf. getPotentialMoves...)
+ static get CanAnalyze() {
+ return false;
+ }
hoverHighlight(x, y) {
- // TODO: exact squares
- return this.subTurn == 2; //&& this.firstMove.donkey or wario or bonus roi boo
+ if (
+ this.firstMove.appear.length == 0 ||
+ this.firstMove.vanish.length == 0 ||
+ this.board[x][y] != V.EMPTY
+ ) {
+ return false;
+ }
+ const deltaX = Math.abs(this.firstMove.end.x - x);
+ const deltaY = Math.abs(this.firstMove.end.y - y);
+ return (
+ this.subTurn == 2 &&
+ // Condition: rook or bishop move, may capture, but no bonus move
+ [V.ROOK, V.BISHOP].includes(this.firstMove.vanish[0].p) &&
+ (
+ this.firstMove.vanish.length == 1 ||
+ ['w', 'b'].includes(this.firstMove.vanish[1].c)
+ ) &&
+ (
+ this.firstMove.vanish[0].p == V.ROOK && deltaX == 1 && deltaY == 1 ||
+ this.firstMove.vanish[0].p == V.BISHOP && deltaX + deltaY == 1
+ )
+ );
}
static get IMMOBILIZE_CODE() {
return 'i';
}
+ // Fictive color 'a', bomb banana mushroom egg
+ static get BOMB() {
+ // Doesn't collide with bishop because color 'a'
+ return 'b';
+ }
+ static get BANANA() {
+ return 'n';
+ }
+ static get EGG() {
+ return 'e';
+ }
+ static get MUSHROOM() {
+ return 'm';
+ }
+
+ static get PIECES() {
+ return (
+ ChessRules.PIECES.concat(
+ Object.keys(V.IMMOBILIZE_DECODE)).concat(
+ [V.BANANA, V.BOMB, V.EGG, V.MUSHROOM, V.INVISIBLE_QUEEN])
+ );
+ }
+
getPpath(b) {
let prefix = "";
if (
+ b[0] == 'a' ||
b[1] == V.INVISIBLE_QUEEN ||
Object.keys(V.IMMOBILIZE_DECODE).includes(b[1])
) {
setFlags(fenflags) {
super.setFlags(fenflags); //castleFlags
this.powerFlags = {
- w: [...Array(2)], //king can send red shell? Queen can be invisible?
+ w: [...Array(2)], //king can send shell? Queen can be invisible?
b: [...Array(2)]
};
const flags = fenflags.substr(4); //skip first 4 letters, for castle
getCapturedFen() {
let counts = [...Array(10).fill(0)];
let i = 0;
- for (let p of [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN, V.PAWN])
+ for (let p of [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN, V.PAWN]) {
counts[i] = this.captured["w"][p];
counts[5 + i] = this.captured["b"][p];
i++;
return fen;
}
+ addBonusYoshi() {
+ // TODO
+// --> pour bonus toadette, passer "capture" temporairement en "reserve" pour permettre de jouer le coup.
+ }
+
getPotentialMovesFrom([x, y]) {
+ // TODO: si banane ou bombe ou... alors return [] ?
// TODO: bananes et bombes limitent les déplacements (agissent comme un mur "capturable")
// bananes jaunes et rouges ?! (agissant sur une seule couleur ?) --> mauvaise idée.
if (this.subTurn == 2) {
// TODO: un-immobilize my immobilized piece at the end of this turn, if any
}
+ getBasicMove([x1, y1], [x2, y2]) {
+ // 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
// Profite des accélérateurs posés par les pions (+ 1 case : obligatoire).
}
+ isAttackedBySlideNJump() {
+ // TODO:
+ }
+
atLeastOneMove() {
// TODO: check that
return true;
}
+ getAllPotentialMoves() {
+ // (Attention: objets pas jouables cf. getPotentialMoves...)
+ }
+
play(move) {
// TODO: subTurn passe à 2 si arrivée sur bonus cavalier
// potentiellement pose (tour, fou) ou si choix (reconnaître i (ok), ii (ok) et iii (si coup normal + pas immobilisé) ?)
}
doClick(square) {
- // A click to promote a piece on subTurn 2 would trigger this.
- // For now it would then return [NaN, NaN] because surrounding squares
- // have no IDs in the promotion modal. TODO: improve this?
if (isNaN(square[0])) return null;
- // If subTurn == 2:
+ // TODO: If subTurn == 2:
// if square is empty && firstMove is compatible,
- // complete the move (banana or bomb).
+ // complete the move (banana or bomb or piece exchange).
// if square not empty, just complete with empty move
const Lf = this.firstMove.length;
if (this.subTurn == 2) {
getNotation(move) {
// invisibility used? --> move notation Q??
-
}
};