Mise en place des MatchCommand
All checks were successful
check main state / build (9.0.x) (push) Successful in 1m28s

Ajout des données dynamiques au match
This commit was merged in pull request #21.
This commit is contained in:
2025-04-02 23:14:59 +02:00
committed by mcmuzzle
parent 4a4446ea48
commit 80b3d71104
8 changed files with 365 additions and 3 deletions

View File

@@ -0,0 +1,13 @@
namespace Giants.Core.Commands;
public abstract class BaseMatchCommand<T> : BaseCommand<T> where T : BaseCommandResult
{
public required Match InputMatch { get; init; }
protected abstract T LocalMatchExecute(Match match);
protected override T LocalExecute()
{
return LocalMatchExecute(InputMatch.Clone());
}
}

View File

@@ -0,0 +1,41 @@
using System.Security.Claims;
using System.Security.Cryptography.X509Certificates;
namespace Giants.Core.Commands;
public class PrepareMatchCommand : BaseMatchCommand<PrepareMatchResult>
{
public required int NbPlayer { get; init; }
protected override PrepareMatchResult LocalMatchExecute(Match match)
{
if (NbPlayer < 3 || NbPlayer > 5)
return new PrepareMatchResult();
//Gestion des assets des joueurs
for (int i = 0; i < NbPlayer; i++)
{
//marqueurs tribaux
int nbMarker = NbMarkerPerPlayer(NbPlayer);
for (int t = 0; t < nbMarker; t++)
{
}
}
return new PrepareMatchResult();
}
private int NbMarkerPerPlayer(int nbTotalPlayer)
{
return nbTotalPlayer switch
{
3 => 7,
4 => 6,
5 => 5,
_ => throw new Exception("Wrong player count for NbMarkerPerPlayer")
};
}
}
public class PrepareMatchResult : BaseCommandResult { }