X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FAtomic.js;h=bf860df656ced49f47ee3d526bab2f9560e917b0;hb=4b5fe3061829e184f9ad86a13d831eda22d95343;hp=b7c7504dde9880f3f814c4fd7d39f7d462e39a94;hpb=1d184b4c016a645228251ce984d4c980e60420b0;p=vchess.git diff --git a/public/javascripts/variants/Atomic.js b/public/javascripts/variants/Atomic.js index b7c7504d..bf860df6 100644 --- a/public/javascripts/variants/Atomic.js +++ b/public/javascripts/variants/Atomic.js @@ -131,6 +131,19 @@ class AtomicRules extends ChessRules return res; } + getCheckSquares(move, c) + { + const saveKingPos = this.kingPos[c]; //king might explode + this.play(move); + let res = [ ]; + if (this.kingPos[c][0] < 0) + res = [saveKingPos]; + else if (this.isAttacked(this.kingPos[c], this.getOppCol(c))) + res = [ this.kingPos[c] ] + this.undo(move); + return res; + } + checkGameEnd(color) { const kp = this.kingPos[color];