From 86ea4f86403ab8e71b4279d2d6db17356683f3ac Mon Sep 17 00:00:00 2001 From: beo3000 Date: Sun, 4 Jan 2026 21:42:54 +0100 Subject: [PATCH] foxhunt part2 --- .../Games/FoxHunt/FoxHuntGameLogicService.cs | 35 ++++++++++++++----- .../Games/FoxHunt/FoxHuntGameModel.cs | 3 +- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/Koogle.Application/Games/FoxHunt/FoxHuntGameLogicService.cs b/src/Koogle.Application/Games/FoxHunt/FoxHuntGameLogicService.cs index 1156dd9..36166a4 100644 --- a/src/Koogle.Application/Games/FoxHunt/FoxHuntGameLogicService.cs +++ b/src/Koogle.Application/Games/FoxHunt/FoxHuntGameLogicService.cs @@ -30,14 +30,14 @@ namespace Koogle.Application.Games.FoxHunt id => id, _ => new FoxHuntPlayerState()); - return new FoxHuntGameModel + var model = new FoxHuntGameModel { - FoxIndex = 0, // aktueller Fuchs (Index in PlayerOrder) - NonFoxIndex = 0, // Index für Nicht-Fuchs-Spieler - FoxTurnsRemaining = 2, // erste 2 Fuchs-Züge - FoxTurn = false, + FoxIndex = 0, // aktueller Fuchs (Index in PlayerOrder) + NonFoxIndex = 0, // Index für Nicht-Fuchs-Spieler + FoxTurnsRemaining = 2, // erste 2 Fuchs-Züge + FoxTurn = false, - LeadingThrows = options.LeadingThrows, + LeadingThrows = options.LeadingThrows, PlayerStates = playerStates, PlayerOrder = playerOrder, //CurrentPlayerIndex = 0, @@ -46,6 +46,17 @@ namespace Koogle.Application.Games.FoxHunt WinnerId = null, IsGameOver = false, }; + + var next = GetNextId(model); + + var res = model with + { + FoxIndex = model.FoxIndex, + FoxTurn = model.FoxTurn, + FoxTurnsRemaining = model.FoxTurnsRemaining, + NonFoxIndex = model.NonFoxIndex + }; + return res; } public (object UpdatedModel, ThrowResult Result) ProcessThrow(object gameModel, AfterThrowState afterThrow) @@ -72,9 +83,17 @@ namespace Koogle.Application.Games.FoxHunt var foxId = model.PlayerOrder[model.FoxIndex]; var isFoxThrow = playerId == foxId; - - // 5. Check GAME END + if (isFoxThrow) + { + playerStates[foxId].PinCountFox+= afterThrow.PinsKnocked; + } + else + { + playerStates[foxId].PinCountHunters+= afterThrow.PinsKnocked; + } + + // 5. Check GAME END bool isGameOver = false; Guid? winnerId = null; diff --git a/src/Koogle.Application/Games/FoxHunt/FoxHuntGameModel.cs b/src/Koogle.Application/Games/FoxHunt/FoxHuntGameModel.cs index 6b36ead..87fe35a 100644 --- a/src/Koogle.Application/Games/FoxHunt/FoxHuntGameModel.cs +++ b/src/Koogle.Application/Games/FoxHunt/FoxHuntGameModel.cs @@ -32,7 +32,8 @@ public record FoxHuntPlayerState { + public int PinCountFox { get; set; } - public int PinCount { get; set; } + public int PinCountHunters { get; set; } } }