From 7f4ebbd2b9c9808bb18756bb03f82ce08c1b28df Mon Sep 17 00:00:00 2001 From: Ari Mourao Date: Sun, 10 Nov 2024 15:05:30 -0300 Subject: [PATCH] fixes black incorrectly starting with increment time --- src/components/boards/BoardGame.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/boards/BoardGame.tsx b/src/components/boards/BoardGame.tsx index 60388ad7..8347a54b 100644 --- a/src/components/boards/BoardGame.tsx +++ b/src/components/boards/BoardGame.tsx @@ -569,7 +569,13 @@ function BoardGame() { } if (pos?.turn === "white" && blackTime !== null) { setBlackTime( - (prev) => prev! + (players.black.timeControl?.increment ?? 0), + (prev) => { + if (pos?.fullmoves === 1) { + return prev!; + } + + return prev! + (players.black.timeControl?.increment ?? 0); + } ); } setIntervalId(intervalId);