- if (move.start.x == firstRank && [V.KING, V.QUEEN].includes(piece)) {
- if (this.castleFlags[c][1] == move.start.y)
- this.castleFlags[c][1] = 8;
- else if (this.castleFlags[c][2] == move.start.y)
- this.castleFlags[c][2] = 8;
- // Else: the flag is already turned off
+ if (move.start.x == firstRank) {
+ if (piece == V.KING || (!twoKings && piece == V.QUEEN)) {
+ if (this.castleFlags[c][1] == move.start.y)
+ this.castleFlags[c][1] = 8;
+ else if (this.castleFlags[c][2] == move.start.y)
+ this.castleFlags[c][2] = 8;
+ // Else: the flag is already turned off
+ }