X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FFusion.js;h=2eb8b2da3db51f0dda3ef63042ab4f0046b7c25d;hb=58327965b8edcc3d1617058283a5111edde1c39b;hp=2ead9ad7ceccaa428449b7f6cb3fd6ab27c591ce;hpb=e023d74715d327ebd7623079cb778b0def0a1464;p=vchess.git diff --git a/client/src/variants/Fusion.js b/client/src/variants/Fusion.js index 2ead9ad7..2eb8b2da 100644 --- a/client/src/variants/Fusion.js +++ b/client/src/variants/Fusion.js @@ -399,16 +399,17 @@ export class FusionRules extends ChessRules { postPlay(move) { const c = V.GetOppCol(this.turn); - const piece = move.appear[0].p; - if ([V.KING, V.KN, V.KB, V.KR].includes(piece)) - this.kingPos[c] = [move.appear[0].x, move.appear[0].y]; - this.updateCastleFlags(move, piece); + move.kingMove = ( + [V.KING, V.KN, V.KB, V.KR].includes(move.appear[0].p) && + [V.KING, V.KN, V.KB, V.KR].includes(move.vanish[0].p) + ); + if (move.kingMove) this.kingPos[c] = [move.appear[0].x, move.appear[0].y]; + this.updateCastleFlags(move, move.appear[0].p); } postUndo(move) { const c = this.getColor(move.start.x, move.start.y); - if ([V.KING, V.KN, V.KB, V.KR].includes(move.appear[0].p)) - this.kingPos[c] = [move.start.x, move.start.y]; + if (!!move.kingMove) this.kingPos[c] = [move.start.x, move.start.y]; } static get VALUES() { @@ -419,6 +420,10 @@ export class FusionRules extends ChessRules { ); } + static get SEARCH_DEPTH() { + return 2; + } + getNotation(move) { if (move.appear.length == 2 && move.vanish.length == 1) { // Fission (because no capture in this case)