ajout des marker et des socles aux joueurs au debut de la partie
All checks were successful
check main state / build (9.0.x) (push) Successful in 1m26s
All checks were successful
check main state / build (9.0.x) (push) Successful in 1m26s
This commit was merged in pull request #27.
This commit is contained in:
@@ -14,23 +14,42 @@ public class PrepareMatchCommand : BaseMatchCommand<PrepareMatchResult>
|
||||
|
||||
|
||||
//Gestion des assets des joueurs
|
||||
for (int i = 0; i < PlayerIDs.Count; i++)
|
||||
for (int itePlayer = 0; itePlayer < PlayerIDs.Count; itePlayer++)
|
||||
{
|
||||
match.SetPlayer(i, PlayerIDs[i]);
|
||||
//marqueurs tribaux
|
||||
int nbMarker = NbMarkerPerPlayer(PlayerIDs.Count);
|
||||
for (int t = 0; t < Match.MaxTribalMarker; t++)
|
||||
match.SetPlayer(itePlayer, PlayerIDs[itePlayer]);
|
||||
Player? player = match.GetPlayer(itePlayer);
|
||||
if (null == player)
|
||||
throw new ArgumentException($"Cannot get player {itePlayer} in PrepareMatchCommand");
|
||||
|
||||
//socles
|
||||
int nbSocle = NbSoclePerPlayer(PlayerIDs.Count);
|
||||
foreach (var socle in player.Bases)
|
||||
{
|
||||
if (t < nbMarker)
|
||||
if (nbSocle > 0)
|
||||
{
|
||||
match.AddTribalMarkerToPlayer(i);
|
||||
player.PutPieceInVisibleArea(socle);
|
||||
nbSocle--;
|
||||
}
|
||||
else
|
||||
{
|
||||
var piece = match.GetPlayerTribalTokenFromBox(i);
|
||||
match.AssignPiece(piece, PiecePosition.Urne);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//marqueurs tribaux (on ajoute 2 par joueurs et le reste dans l'urne)
|
||||
int i = 0;
|
||||
foreach (var marker in player.Markers)
|
||||
{
|
||||
if (i < 2)
|
||||
{
|
||||
player.PutPieceInVisibleArea(marker);
|
||||
}
|
||||
else
|
||||
{
|
||||
match.AssignPiece(marker, PiecePosition.Urne);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return new PrepareMatchResult()
|
||||
@@ -40,7 +59,7 @@ public class PrepareMatchCommand : BaseMatchCommand<PrepareMatchResult>
|
||||
};
|
||||
}
|
||||
|
||||
private static int NbMarkerPerPlayer(int nbTotalPlayer)
|
||||
private static int NbSoclePerPlayer(int nbTotalPlayer)
|
||||
{
|
||||
return nbTotalPlayer switch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user