inform players about on-move conditional premoves

This commit is contained in:
Thibault Duplessis 2015-12-08 01:45:30 +07:00
parent a01c8a745d
commit ffb4252109
3 changed files with 13 additions and 10 deletions

View file

@ -79,10 +79,6 @@ function userAnalysable(data) {
return playable(data) && (!data.clock || !isPlayerPlaying(data));
}
function forecastable(data) {
return playable(data) && data.correspondence && !hasAi(data) && !isPlayerTurn(data);
}
function isCorrespondence(data) {
return data.game.speed === 'correspondence';
}
@ -122,7 +118,6 @@ module.exports = {
nbMoves: nbMoves,
setOnGame: setOnGame,
setIsGone: setIsGone,
forecastable: forecastable,
isCorrespondence: isCorrespondence,
isSwitchable: function(data) {
return !hasAi(data) && (data.simul || isCorrespondence(data));

View file

@ -326,15 +326,19 @@ module.exports = function(opts) {
}.bind(this), 500);
}.bind(this);
var forecastable = function(d) {
return game.playable(d) && d.correspondence && !d.opponent.ai;
}
this.forecastInfo = function() {
return game.forecastable(this.data) &&
return forecastable(this.data) &&
!this.replaying() &&
this.data.game.turns > 1 &&
lichess.once('forecast-info-seen5');
lichess.once('forecast-info-seen6');
}.bind(this);
var onChange = function() {
opts.onChange && setTimeout(partial(opts.onChange,this.data), 200);
opts.onChange && setTimeout(partial(opts.onChange, this.data), 200);
}.bind(this);
this.trans = lichess.trans(opts.i18n);

View file

@ -109,8 +109,12 @@ function analyseButton(ctrl) {
ctrl.data.forecastCount
]),
showInfo ? m('div.forecast-info.info.none', [
m('strong.title.text[data-icon=]', 'New feature'),
m('span.content', 'Use the analysis board to create conditional premoves!')
m('strong.title.text[data-icon=]', 'Speed up your game!'),
m('span.content', [
'Use the analysis board to create conditional premoves.',
m('br'),
'Now available on your turn!'
])
]) : null
];
}