X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=base_rules.js;fp=base_rules.js;h=699b1d814305237d9c6bffb70bee07d0ada503f9;hp=0f950a240bb4b478d671d02ec9bb0dfe531ff00b;hb=8f87962339f2bcaeb4c2716d0588a63449a68bde;hpb=c08a5e745db2b631bedf981d1ba685b312c7e3b5 diff --git a/base_rules.js b/base_rules.js index 0f950a2..699b1d8 100644 --- a/base_rules.js +++ b/base_rules.js @@ -1686,10 +1686,6 @@ export default class ChessRules { getPotentialMovesOf(piece, [x, y]) { const color = this.getColor(x, y); const stepSpec = this.getStepSpec(color, x, y, piece); - - // TODO: pawns, coregal -console.log(stepSpec); - let squares = []; if (stepSpec.attack) { squares = this.findDestSquares( @@ -2254,7 +2250,7 @@ console.log(stepSpec); } // Update castling flags if start or arrive from/at rook/king locations move.appear.concat(move.vanish).forEach(psq => { - if ((!!king && psq.p == king) || this.isKing(0, 0, psq.p)) + if ((king && psq.p == king) || (!king && this.isKing(0, 0, psq.p))) castleFlags[psq.c] = [this.size.y, this.size.y]; // NOTE: not "else if" because king can capture enemy rook... let c = "";