diff --git a/src/Koogle.Application/Games/Shit/ShitGameLogicService.cs b/src/Koogle.Application/Games/Shit/ShitGameLogicService.cs index b726816..3cb5f4a 100644 --- a/src/Koogle.Application/Games/Shit/ShitGameLogicService.cs +++ b/src/Koogle.Application/Games/Shit/ShitGameLogicService.cs @@ -84,19 +84,19 @@ public class ShitGameLogicService : IGameLogicService // Pins are collected - player can choose to continue or pass // If continuing, pins are added to collected and subtracted from player var currentPoints = model.PlayerPoints.GetValueOrDefault(playerId, model.StartNumber); - var newPoints = currentPoints - pinsKnocked; + var newPoints = currentPoints - model.CollectedPoints - pinsKnocked; // Clamp to 0 minimum if (newPoints < 0) newPoints = 0; - var updatedPoints = new Dictionary(model.PlayerPoints) - { - [playerId] = newPoints - }; + //var updatedPoints = new Dictionary(model.PlayerPoints) + //{ + // [playerId] = newPoints + //}; model = model with { - PlayerPoints = updatedPoints, + //PlayerPoints = updatedPoints, CollectedPoints = model.CollectedPoints + pinsKnocked }; @@ -144,6 +144,20 @@ public class ShitGameLogicService : IGameLogicService { var model = CastModel(gameModel); + var currentPoints = model.PlayerPoints.GetValueOrDefault(currentPlayerId, model.StartNumber); + var newPoints = currentPoints - model.CollectedPoints; + + var updatedPoints = new Dictionary(model.PlayerPoints) + { + [currentPlayerId] = newPoints + }; + + model = model with + { + PlayerPoints = updatedPoints, + CollectedPoints = 0 + }; + if (model.IsGameOver) { return (model, new ThrowResult diff --git a/src/Koogle.Web/Components/Game/Shit/ShitBoard.razor b/src/Koogle.Web/Components/Game/Shit/ShitBoard.razor index 640408c..62b9e56 100644 --- a/src/Koogle.Web/Components/Game/Shit/ShitBoard.razor +++ b/src/Koogle.Web/Components/Game/Shit/ShitBoard.razor @@ -98,7 +98,9 @@ @if (context.IsCurrentPlayer && !_model.IsGameOver) { - + @context.PlayerName @@ -134,6 +136,9 @@ Am Zug + + Verwerfen: @(context.Points + _model.CollectedPoints) + Passen: @(context.Points - _model.CollectedPoints) }