foxhunt part2

This commit is contained in:
beo3000 2026-01-04 21:42:54 +01:00
parent 29fa9c5e84
commit 86ea4f8640
2 changed files with 29 additions and 9 deletions

View File

@ -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;

View File

@ -32,7 +32,8 @@
public record FoxHuntPlayerState
{
public int PinCountFox { get; set; }
public int PinCount { get; set; }
public int PinCountHunters { get; set; }
}
}