X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FMagnetic.js;h=9fc4180de84297e4b63f954cfd6d16af461118d7;hp=ee9fe28a6287635fa416a02914717b22cef3b0d8;hb=2c5d7b20742b802d9c47916915c1114bcfc9a9c3;hpb=9edfb7146fdc4dd08914b2a117d2852e705353aa diff --git a/client/src/variants/Magnetic.js b/client/src/variants/Magnetic.js index ee9fe28a..9fc4180d 100644 --- a/client/src/variants/Magnetic.js +++ b/client/src/variants/Magnetic.js @@ -116,7 +116,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 +170,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; } }); }