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,
_ => 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 = options.LeadingThrows - 1, // -1 weil erster Wurf bereits aus PlayerOrder[FoxIndex]
FoxTurn = true, // ein fuchs fängt an
LeadingThrows = options.LeadingThrows,
LeadingThrows = options.LeadingThrows,
PlayerStates = playerStates,
PlayerOrder = playerOrder,
//CurrentPlayerIndex = 0,
@ -46,6 +46,8 @@ namespace Koogle.Application.Games.FoxHunt
WinnerId = null,
IsGameOver = false,
};
return model;
}
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 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;
Guid? winnerId = null;
@ -128,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)
{
@ -143,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
@ -151,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;
}

View File

@ -23,16 +23,17 @@
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
}
public record FoxHuntPlayerState
{
public int PinCountFox { get; set; }
public int PinCount { get; set; }
public int PinCountHunters { get; set; }
}
}