Compare commits

...

2 Commits

Author SHA1 Message Date
beo3000 433b61618d dev foxhunt 2026-01-04 22:27:24 +01:00
beo3000 86ea4f8640 foxhunt part2 2026-01-04 21:42:54 +01:00
2 changed files with 30 additions and 18 deletions

View File

@ -30,14 +30,14 @@ namespace Koogle.Application.Games.FoxHunt
id => id, id => id,
_ => new FoxHuntPlayerState()); _ => new FoxHuntPlayerState());
return new FoxHuntGameModel var model = new FoxHuntGameModel
{ {
FoxIndex = 0, // aktueller Fuchs (Index in PlayerOrder) FoxIndex = 0, // aktueller Fuchs (Index in PlayerOrder)
NonFoxIndex = 0, // Index für Nicht-Fuchs-Spieler NonFoxIndex = 0, // Index für Nicht-Fuchs-Spieler
FoxTurnsRemaining = 2, // erste 2 Fuchs-Züge FoxTurnsRemaining = options.LeadingThrows - 1, // -1 weil erster Wurf bereits aus PlayerOrder[FoxIndex]
FoxTurn = false, FoxTurn = true, // ein fuchs fängt an
LeadingThrows = options.LeadingThrows, LeadingThrows = options.LeadingThrows,
PlayerStates = playerStates, PlayerStates = playerStates,
PlayerOrder = playerOrder, PlayerOrder = playerOrder,
//CurrentPlayerIndex = 0, //CurrentPlayerIndex = 0,
@ -46,6 +46,8 @@ namespace Koogle.Application.Games.FoxHunt
WinnerId = null, WinnerId = null,
IsGameOver = false, IsGameOver = false,
}; };
return model;
} }
public (object UpdatedModel, ThrowResult Result) ProcessThrow(object gameModel, AfterThrowState afterThrow) public (object UpdatedModel, ThrowResult Result) ProcessThrow(object gameModel, AfterThrowState afterThrow)
@ -71,10 +73,17 @@ namespace Koogle.Application.Games.FoxHunt
var triggers = new List<TriggerEvent>(); var triggers = new List<TriggerEvent>();
var foxId = model.PlayerOrder[model.FoxIndex]; var foxId = model.PlayerOrder[model.FoxIndex];
var isFoxThrow = playerId == foxId;
// 5. Check GAME END if (model.FoxTurn)
{
playerStates[foxId].PinCountFox+= afterThrow.PinsKnocked;
}
else
{
playerStates[foxId].PinCountHunters+= afterThrow.PinsKnocked;
}
// 5. Check GAME END
bool isGameOver = false; bool isGameOver = false;
Guid? winnerId = null; Guid? winnerId = null;
@ -128,10 +137,12 @@ namespace Koogle.Application.Games.FoxHunt
if (model.FoxTurnsRemaining > 0) if (model.FoxTurnsRemaining > 0)
{ {
model.FoxTurnsRemaining--; model.FoxTurnsRemaining--;
model.FoxTurn = false; // danach abwechselnd model.FoxTurn = true;
return foxId; return foxId;
} }
model.FoxTurn = !model.FoxTurn; // danach abwechselnd
// 2⃣ Abwechselnd Nicht-Fuchs → Fuchs // 2⃣ Abwechselnd Nicht-Fuchs → Fuchs
if (!model.FoxTurn) if (!model.FoxTurn)
{ {
@ -143,7 +154,7 @@ namespace Koogle.Application.Games.FoxHunt
{ {
Guid next = model.PlayerOrder[model.NonFoxIndex]; Guid next = model.PlayerOrder[model.NonFoxIndex];
model.NonFoxIndex++; model.NonFoxIndex++;
model.FoxTurn = true; //model.FoxTurn = true;
return next; return next;
} }
else else
@ -151,14 +162,14 @@ namespace Koogle.Application.Games.FoxHunt
// Alle Nicht-Füchse durch → neuer Fuchs // Alle Nicht-Füchse durch → neuer Fuchs
model.FoxIndex++; model.FoxIndex++;
model.NonFoxIndex = 0; model.NonFoxIndex = 0;
model.FoxTurnsRemaining = 2; model.FoxTurnsRemaining = model.LeadingThrows - 1;
model.FoxTurn = true; model.FoxTurn = true;
return GetNextId(model); return GetNextId(model);
} }
} }
// 3⃣ Fuchs-Zug im Wechsel // 3⃣ Fuchs-Zug im Wechsel
model.FoxTurn = false; //model.FoxTurn = false;
return foxId; return foxId;
} }

View File

@ -23,16 +23,17 @@
public int FoxIndex = 0; // aktueller Fuchs (Index in PlayerOrder) public int FoxIndex { get; set; } // aktueller Fuchs (Index in PlayerOrder)
public int NonFoxIndex = 0; // Index für Nicht-Fuchs-Spieler public int NonFoxIndex { get; set; } // Index für Nicht-Fuchs-Spieler
public int FoxTurnsRemaining = 2; // erste 2 Fuchs-Züge public int FoxTurnsRemaining { get; set; } // verbleibende Fuchs-Züge
public bool FoxTurn = true; // wer ist dran public bool FoxTurn { get; set; } // true = Fuchs dran im Wechsel
} }
public record FoxHuntPlayerState public record FoxHuntPlayerState
{ {
public int PinCountFox { get; set; }
public int PinCount { get; set; } public int PinCountHunters { get; set; }
} }
} }