ajout des la base des batiments
All checks were successful
dotnet package / build (8.0.x) (push) Successful in 2m54s
All checks were successful
dotnet package / build (8.0.x) (push) Successful in 2m54s
This commit was merged in pull request #6.
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
using LittleTown.Core.Enums;
|
||||
|
||||
namespace LittleTown.Core;
|
||||
|
||||
/// <summary> Represente une batiment qui peut etre placé sur le plateau </summary>
|
||||
public class Building
|
||||
{
|
||||
/// <summary> le nom du batiment (attention, c'est une clé de conversion) </summary>
|
||||
public string Name { get; init; }
|
||||
public required string Name { get; init; }
|
||||
|
||||
/// <summary> Le cout a payer pour construire ce batiment </summary>
|
||||
public IReadOnlyDictionary<ResourceType, int> Price { get; init; } = new Dictionary<ResourceType, int>();
|
||||
|
||||
/// <summary> Indique si ce batiment fait parti du jeu de batiment pour joueur débutant </summary>
|
||||
public bool BeginnerBuilding { get; init; }
|
||||
}
|
||||
@@ -14,5 +14,7 @@ public enum ResourceType
|
||||
/// <summary> Poisson, présente sur le plateau, peut être utilisé comme nourriture </summary>
|
||||
Fish,
|
||||
///<summary> Blé, non présente sur le plateau, peut être utilisé comme nourriture </summary>
|
||||
Cereal
|
||||
Cereal,
|
||||
///<summary> Piece, représente une piece de monnaie</summary>
|
||||
Piece
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
using LittleTown.Core.Ports;
|
||||
|
||||
namespace LittleTown.Core;
|
||||
|
||||
/// <summary>
|
||||
@@ -7,14 +9,22 @@ public class Match
|
||||
{
|
||||
private const int _minPlayerCount = 2;
|
||||
private const int _maxPlayerCount = 4;
|
||||
private readonly Board _board;
|
||||
private ICollection<Building> _buildings;
|
||||
|
||||
/// <summary>
|
||||
/// Constructeur d'une nouvelle partie avec un nombre de joueurs données en parametres
|
||||
/// </summary>
|
||||
/// <param name="nbPlayer"></param>
|
||||
public Match(int nbPlayer)
|
||||
/// <param name="staticData">un objet permettant de récupérer les données statiques du jeu</param>
|
||||
public Match(int nbPlayer, IStaticDataGetter staticData)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(staticData);
|
||||
ArgumentOutOfRangeException.ThrowIfLessThan(nbPlayer, _minPlayerCount);
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThan(nbPlayer, _maxPlayerCount);
|
||||
|
||||
_board = staticData.GetBoard(1);
|
||||
|
||||
_buildings = staticData.GetBuildings();
|
||||
}
|
||||
}
|
||||
@@ -12,5 +12,5 @@ public interface IStaticDataGetter
|
||||
|
||||
/// <summary> Recupérer la liste des batiments et leurs données statiques </summary>
|
||||
/// <returns></returns>
|
||||
public List<Building> GetBuildings();
|
||||
public ICollection<Building> GetBuildings();
|
||||
}
|
||||
Reference in New Issue
Block a user