From: Benjamin Auder Date: Wed, 15 Apr 2020 16:36:54 +0000 (+0200) Subject: Monochrome: show first turn indication X-Git-Url: https://git.auder.net/variants/current/css/doc/pieces/cb.svg?a=commitdiff_plain;h=5246b49d18b711fb26ee27919ab392be24b80fba;p=vchess.git Monochrome: show first turn indication --- diff --git a/client/src/base_rules.js b/client/src/base_rules.js index a0e64bd6..53001f63 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -80,6 +80,11 @@ export const ChessRules = class ChessRules { return V.ShowMoves; } + // Used for Monochrome variant (TODO: harmonize: !canFlip ==> showFirstTurn) + get showFirstTurn() { + return false; + } + // Some variants always show the same orientation static get CanFlip() { return true; diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index 8a053765..62fae753 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -105,7 +105,7 @@ export default { return this.st.tr[ (this.vr.turn == 'w' ? "White" : "Black") + " to move"]; } - // Cannot flip: racing king or circular chess + // Cannot flip (racing king or circular chess), or Monochrome return ( this.vr.movesCount == 0 && this.game.mycolor == "w" ? this.st.tr["It's your turn!"] @@ -128,7 +128,12 @@ export default { showTurn: function() { return ( this.game.score == '*' && - !!this.vr && (this.vr.showMoves != "all" || !this.vr.canFlip) + !!this.vr && + ( + this.vr.showMoves != "all" || + !this.vr.canFlip || + this.vr.showFirstTurn + ) ); }, canAnalyze: function() { diff --git a/client/src/variants/Monochrome.js b/client/src/variants/Monochrome.js index 72647752..5bd2ce00 100644 --- a/client/src/variants/Monochrome.js +++ b/client/src/variants/Monochrome.js @@ -6,6 +6,10 @@ export class MonochromeRules extends ChessRules { return false; } + get showFirstTurn() { + return true; + } + static IsGoodPosition(position) { if (position.length == 0) return false; const rows = position.split("/");