foxhunt part2
This commit is contained in:
parent
29fa9c5e84
commit
86ea4f8640
|
|
@ -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 = 2, // erste 2 Fuchs-Züge
|
||||||
FoxTurn = false,
|
FoxTurn = false,
|
||||||
|
|
||||||
LeadingThrows = options.LeadingThrows,
|
LeadingThrows = options.LeadingThrows,
|
||||||
PlayerStates = playerStates,
|
PlayerStates = playerStates,
|
||||||
PlayerOrder = playerOrder,
|
PlayerOrder = playerOrder,
|
||||||
//CurrentPlayerIndex = 0,
|
//CurrentPlayerIndex = 0,
|
||||||
|
|
@ -46,6 +46,17 @@ namespace Koogle.Application.Games.FoxHunt
|
||||||
WinnerId = null,
|
WinnerId = null,
|
||||||
IsGameOver = false,
|
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)
|
public (object UpdatedModel, ThrowResult Result) ProcessThrow(object gameModel, AfterThrowState afterThrow)
|
||||||
|
|
@ -73,8 +84,16 @@ namespace Koogle.Application.Games.FoxHunt
|
||||||
var foxId = model.PlayerOrder[model.FoxIndex];
|
var foxId = model.PlayerOrder[model.FoxIndex];
|
||||||
var isFoxThrow = playerId == foxId;
|
var isFoxThrow = playerId == foxId;
|
||||||
|
|
||||||
|
if (isFoxThrow)
|
||||||
|
{
|
||||||
|
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;
|
||||||
Guid? winnerId = null;
|
Guid? winnerId = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@
|
||||||
|
|
||||||
public record FoxHuntPlayerState
|
public record FoxHuntPlayerState
|
||||||
{
|
{
|
||||||
|
public int PinCountFox { get; set; }
|
||||||
|
|
||||||
public int PinCount { get; set; }
|
public int PinCountHunters { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue