X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FMagnetic.js;h=9fc4180de84297e4b63f954cfd6d16af461118d7;hb=2c5d7b20742b802d9c47916915c1114bcfc9a9c3;hp=a59ce41198806f2b4125c39edd2b2fc90579037f;hpb=3a2a7b5fd3c6bfd0752838094c27e1fb6172d109;p=vchess.git diff --git a/client/src/variants/Magnetic.js b/client/src/variants/Magnetic.js index a59ce411..9fc4180d 100644 --- a/client/src/variants/Magnetic.js +++ b/client/src/variants/Magnetic.js @@ -1,6 +1,6 @@ import { ChessRules, PiPo } from "@/base_rules"; -export const VariantRules = class MagneticRules extends ChessRules { +export class MagneticRules extends ChessRules { static get HasEnpassant() { return false; } @@ -116,7 +116,8 @@ export const VariantRules = 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 +170,8 @@ export const VariantRules = 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; } }); } @@ -196,7 +198,7 @@ export const VariantRules = class MagneticRules extends ChessRules { // King disappeared return color == "w" ? "0-1" : "1-0"; if (this.atLeastOneMove()) - // game not over + // Game not over return "*"; return "1/2"; //no moves but kings still there }