X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FMagnetic.js;h=dc228ce1ad2c431df7e7829f858c977e1f82254a;hb=7e8a7ea1cb66adb4a987badfb0a3c2f99a21bd0a;hp=ee9fe28a6287635fa416a02914717b22cef3b0d8;hpb=bb688df52df0713aba7b2c1c068614544f5ae96d;p=vchess.git diff --git a/client/src/variants/Magnetic.js b/client/src/variants/Magnetic.js index ee9fe28a..dc228ce1 100644 --- a/client/src/variants/Magnetic.js +++ b/client/src/variants/Magnetic.js @@ -1,6 +1,7 @@ import { ChessRules, PiPo } from "@/base_rules"; export class MagneticRules extends ChessRules { + static get HasEnpassant() { return false; } @@ -116,7 +117,8 @@ export class MagneticRules extends ChessRules { cmove.appear[i].p = piece; moves.push(cmove); } - // Swap appear[i] and appear[0] for moves presentation (TODO: this is awkward) + // Swap appear[i] and appear[0] for moves presentation + // (TODO: this is awkward) moves.forEach(m => { let tmp = m.appear[0]; m.appear[0] = m.appear[i]; @@ -169,7 +171,8 @@ export class MagneticRules extends ChessRules { psq.x == oppFirstRank && this.castleFlags[oppCol].includes(psq.y) ) { - this.castleFlags[oppCol][psq.y == this.castleFlags[oppCol][0] ? 0 : 1] = 8; + const flagIdx = (psq.y == this.castleFlags[oppCol][0] ? 0 : 1); + this.castleFlags[oppCol][flagIdx] = 8; } }); } @@ -208,4 +211,5 @@ export class MagneticRules extends ChessRules { static get SEARCH_DEPTH() { return 2; } + };