Compare commits

..

No commits in common. "433b61618d9a77f96c6d5871e1d6c73214cb63f9" and "29fa9c5e84dae0df83ce4c4dda17913efd675149" have entirely different histories.

2 changed files with 18 additions and 30 deletions

View File

@ -30,12 +30,12 @@ namespace Koogle.Application.Games.FoxHunt
id => id, id => id,
_ => new FoxHuntPlayerState()); _ => new FoxHuntPlayerState());
var model = new FoxHuntGameModel return 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 = options.LeadingThrows - 1, // -1 weil erster Wurf bereits aus PlayerOrder[FoxIndex] FoxTurnsRemaining = 2, // erste 2 Fuchs-Züge
FoxTurn = true, // ein fuchs fängt an FoxTurn = false,
LeadingThrows = options.LeadingThrows, LeadingThrows = options.LeadingThrows,
PlayerStates = playerStates, PlayerStates = playerStates,
@ -46,8 +46,6 @@ 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)
@ -73,15 +71,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 (model.FoxTurn)
{
playerStates[foxId].PinCountFox+= afterThrow.PinsKnocked;
}
else
{
playerStates[foxId].PinCountHunters+= afterThrow.PinsKnocked;
}
// 5. Check GAME END // 5. Check GAME END
bool isGameOver = false; bool isGameOver = false;
@ -137,12 +128,10 @@ namespace Koogle.Application.Games.FoxHunt
if (model.FoxTurnsRemaining > 0) if (model.FoxTurnsRemaining > 0)
{ {
model.FoxTurnsRemaining--; model.FoxTurnsRemaining--;
model.FoxTurn = true; model.FoxTurn = false; // danach abwechselnd
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)
{ {
@ -154,7 +143,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
@ -162,14 +151,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 = model.LeadingThrows - 1; model.FoxTurnsRemaining = 2;
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,17 +23,16 @@
public int FoxIndex { get; set; } // aktueller Fuchs (Index in PlayerOrder) public int FoxIndex = 0; // aktueller Fuchs (Index in PlayerOrder)
public int NonFoxIndex { get; set; } // Index für Nicht-Fuchs-Spieler public int NonFoxIndex = 0; // Index für Nicht-Fuchs-Spieler
public int FoxTurnsRemaining { get; set; } // verbleibende Fuchs-Züge public int FoxTurnsRemaining = 2; // erste 2 Fuchs-Züge
public bool FoxTurn { get; set; } // true = Fuchs dran im Wechsel public bool FoxTurn = true; // wer ist dran
} }
public record FoxHuntPlayerState public record FoxHuntPlayerState
{ {
public int PinCountFox { get; set; }
public int PinCountHunters { get; set; } public int PinCount { get; set; }
} }
} }