From 433b61618d9a77f96c6d5871e1d6c73214cb63f9 Mon Sep 17 00:00:00 2001 From: beo3000 Date: Sun, 4 Jan 2026 22:27:24 +0100 Subject: [PATCH] dev foxhunt --- .../Games/FoxHunt/FoxHuntGameLogicService.cs | 28 +++++++------------ .../Games/FoxHunt/FoxHuntGameModel.cs | 8 +++--- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/Koogle.Application/Games/FoxHunt/FoxHuntGameLogicService.cs b/src/Koogle.Application/Games/FoxHunt/FoxHuntGameLogicService.cs index 36166a4..f5569b7 100644 --- a/src/Koogle.Application/Games/FoxHunt/FoxHuntGameLogicService.cs +++ b/src/Koogle.Application/Games/FoxHunt/FoxHuntGameLogicService.cs @@ -34,8 +34,8 @@ namespace Koogle.Application.Games.FoxHunt { FoxIndex = 0, // aktueller Fuchs (Index in PlayerOrder) NonFoxIndex = 0, // Index für Nicht-Fuchs-Spieler - FoxTurnsRemaining = 2, // erste 2 Fuchs-Züge - FoxTurn = false, + FoxTurnsRemaining = options.LeadingThrows - 1, // -1 weil erster Wurf bereits aus PlayerOrder[FoxIndex] + FoxTurn = true, // ein fuchs fängt an LeadingThrows = options.LeadingThrows, PlayerStates = playerStates, @@ -47,16 +47,7 @@ namespace Koogle.Application.Games.FoxHunt IsGameOver = false, }; - var next = GetNextId(model); - - var res = model with - { - FoxIndex = model.FoxIndex, - FoxTurn = model.FoxTurn, - FoxTurnsRemaining = model.FoxTurnsRemaining, - NonFoxIndex = model.NonFoxIndex - }; - return res; + return model; } public (object UpdatedModel, ThrowResult Result) ProcessThrow(object gameModel, AfterThrowState afterThrow) @@ -82,9 +73,8 @@ namespace Koogle.Application.Games.FoxHunt var triggers = new List(); var foxId = model.PlayerOrder[model.FoxIndex]; - var isFoxThrow = playerId == foxId; - if (isFoxThrow) + if (model.FoxTurn) { playerStates[foxId].PinCountFox+= afterThrow.PinsKnocked; } @@ -147,10 +137,12 @@ namespace Koogle.Application.Games.FoxHunt if (model.FoxTurnsRemaining > 0) { model.FoxTurnsRemaining--; - model.FoxTurn = false; // danach abwechselnd + model.FoxTurn = true; return foxId; } + model.FoxTurn = !model.FoxTurn; // danach abwechselnd + // 2️⃣ Abwechselnd Nicht-Fuchs → Fuchs if (!model.FoxTurn) { @@ -162,7 +154,7 @@ namespace Koogle.Application.Games.FoxHunt { Guid next = model.PlayerOrder[model.NonFoxIndex]; model.NonFoxIndex++; - model.FoxTurn = true; + //model.FoxTurn = true; return next; } else @@ -170,14 +162,14 @@ namespace Koogle.Application.Games.FoxHunt // Alle Nicht-Füchse durch → neuer Fuchs model.FoxIndex++; model.NonFoxIndex = 0; - model.FoxTurnsRemaining = 2; + model.FoxTurnsRemaining = model.LeadingThrows - 1; model.FoxTurn = true; return GetNextId(model); } } // 3️⃣ Fuchs-Zug im Wechsel - model.FoxTurn = false; + //model.FoxTurn = false; return foxId; } diff --git a/src/Koogle.Application/Games/FoxHunt/FoxHuntGameModel.cs b/src/Koogle.Application/Games/FoxHunt/FoxHuntGameModel.cs index 87fe35a..378993d 100644 --- a/src/Koogle.Application/Games/FoxHunt/FoxHuntGameModel.cs +++ b/src/Koogle.Application/Games/FoxHunt/FoxHuntGameModel.cs @@ -23,10 +23,10 @@ - public int FoxIndex = 0; // aktueller Fuchs (Index in PlayerOrder) - public int NonFoxIndex = 0; // Index für Nicht-Fuchs-Spieler - public int FoxTurnsRemaining = 2; // erste 2 Fuchs-Züge - public bool FoxTurn = true; // wer ist dran + public int FoxIndex { get; set; } // aktueller Fuchs (Index in PlayerOrder) + public int NonFoxIndex { get; set; } // Index für Nicht-Fuchs-Spieler + public int FoxTurnsRemaining { get; set; } // verbleibende Fuchs-Züge + public bool FoxTurn { get; set; } // true = Fuchs dran im Wechsel }