dev foxhunt

This commit is contained in:
beo3000 2026-01-04 22:27:24 +01:00
parent 86ea4f8640
commit 433b61618d
2 changed files with 14 additions and 22 deletions

View File

@ -34,8 +34,8 @@ namespace Koogle.Application.Games.FoxHunt
{ {
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,
@ -47,16 +47,7 @@ namespace Koogle.Application.Games.FoxHunt
IsGameOver = false, IsGameOver = false,
}; };
var next = GetNextId(model); return 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) public (object UpdatedModel, ThrowResult Result) ProcessThrow(object gameModel, AfterThrowState afterThrow)
@ -82,9 +73,8 @@ 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;
if (isFoxThrow) if (model.FoxTurn)
{ {
playerStates[foxId].PinCountFox+= afterThrow.PinsKnocked; playerStates[foxId].PinCountFox+= afterThrow.PinsKnocked;
} }
@ -147,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)
{ {
@ -162,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
@ -170,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,10 +23,10 @@
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
} }