X-Git-Url: https://git.auder.net/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fbase_rules.js;h=752d8ee91b1dd1ecbd8d8e991cb9593994ad20eb;hb=f1e9798d91b10b7d30265305f5c26e3985669ef9;hp=890601d2d4458a0b454b228d53209bb5576ad8fe;hpb=3a2a7b5fd3c6bfd0752838094c27e1fb6172d109;p=vchess.git diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 890601d2..752d8ee9 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -73,6 +73,11 @@ export const ChessRules = class ChessRules { return V.CanFlip; } + static get IMAGE_EXTENSION() { + // All pieces should be in the SVG format + return ".svg"; + } + // Turn "wb" into "B" (for FEN) static board2fen(b) { return b[0] == "w" ? b[1].toUpperCase() : b[1]; @@ -238,9 +243,11 @@ export const ChessRules = class ChessRules { // On which squares is color under check ? (for interface) getCheckSquares(color) { - return this.isAttacked(this.kingPos[color], [V.GetOppCol(color)]) - ? [JSON.parse(JSON.stringify(this.kingPos[color]))] //need to duplicate! - : []; + return ( + this.underCheck(color) + ? [JSON.parse(JSON.stringify(this.kingPos[color]))] //need to duplicate! + : [] + ); } /////////////