Double takeback when you offer on your move

Resolves #2414.
pull/6134/head
Thomas Daniels 2020-03-07 18:14:16 +00:00
parent ecebf7d79c
commit 077d4a3abc
1 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package lila.round
import chess.Color
import lila.common.Bus
import lila.game.{ Event, Game, GameRepo, Pov, Progress, Rewind, UciMemo }
import lila.pref.{ Pref, PrefApi }
@ -19,8 +20,9 @@ final private class Takebacker(
situation: TakebackSituation
)(pov: Pov)(implicit proxy: GameProxy): Fu[(Events, TakebackSituation)] = IfAllowed(pov.game) {
pov match {
case Pov(game, _) if pov.opponent.isProposingTakeback => {
if (pov.opponent.proposeTakebackAt == pov.game.turns) single(game)
case Pov(game, color) if pov.opponent.isProposingTakeback => {
if (pov.opponent.proposeTakebackAt == pov.game.turns && color == Color
.fromPly(pov.opponent.proposeTakebackAt)) single(game)
else double(game)
} dmap (_ -> situation.reset)
case Pov(game, _) if pov.game.playableByAi => single(game) dmap (_ -> situation)