|
|
@ -57,8 +57,8 @@ namespace Model.Games
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// the group of dice used for this game
|
|
|
|
/// the group of dice used for this game
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public IEnumerable<AbstractDie<AbstractDieFace<object>>> Dice => dice;
|
|
|
|
public IEnumerable<AbstractDie<object>> Dice => dice;
|
|
|
|
private readonly IEnumerable<AbstractDie<AbstractDieFace<object>>> dice;
|
|
|
|
private readonly IEnumerable<AbstractDie<object>> dice;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// constructs a Game with its own history of Turns.
|
|
|
|
/// constructs a Game with its own history of Turns.
|
|
|
@ -68,7 +68,7 @@ namespace Model.Games
|
|
|
|
/// <param name="turns">the turns that have been done so far</param>
|
|
|
|
/// <param name="turns">the turns that have been done so far</param>
|
|
|
|
/// <param name="playerManager">the game's player manager, doing CRUD on players and switching whose turn it is</param>
|
|
|
|
/// <param name="playerManager">the game's player manager, doing CRUD on players and switching whose turn it is</param>
|
|
|
|
/// <param name="favGroup">the group of dice used for this game</param>
|
|
|
|
/// <param name="favGroup">the group of dice used for this game</param>
|
|
|
|
public Game(string name, IManager<Player> playerManager, IEnumerable<AbstractDie<AbstractDieFace<object>>> dice, IEnumerable<Turn> turns)
|
|
|
|
public Game(string name, IManager<Player> playerManager, IEnumerable<AbstractDie<object>> dice, IEnumerable<Turn> turns)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Name = name;
|
|
|
|
Name = name;
|
|
|
|
PlayerManager = playerManager;
|
|
|
|
PlayerManager = playerManager;
|
|
|
@ -83,7 +83,7 @@ namespace Model.Games
|
|
|
|
/// <param name="name">the name of the game 😎</param>
|
|
|
|
/// <param name="name">the name of the game 😎</param>
|
|
|
|
/// <param name="playerManager">the game's player manager, doing CRUD on players and switching whose turn it is</param>
|
|
|
|
/// <param name="playerManager">the game's player manager, doing CRUD on players and switching whose turn it is</param>
|
|
|
|
/// <param name="favGroup">the group of dice used for this game</param>
|
|
|
|
/// <param name="favGroup">the group of dice used for this game</param>
|
|
|
|
public Game(string name, IManager<Player> playerManager, IEnumerable<AbstractDie<AbstractDieFace<object>>> dice)
|
|
|
|
public Game(string name, IManager<Player> playerManager, IEnumerable<AbstractDie<object>> dice)
|
|
|
|
: this(name, playerManager, dice, null)
|
|
|
|
: this(name, playerManager, dice, null)
|
|
|
|
{ }
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
@ -161,10 +161,10 @@ namespace Model.Games
|
|
|
|
/// throws all the Dice in FavGroup and returns a list of their Faces
|
|
|
|
/// throws all the Dice in FavGroup and returns a list of their Faces
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>list of AbstractDieFaces after a throw</returns>
|
|
|
|
/// <returns>list of AbstractDieFaces after a throw</returns>
|
|
|
|
private Dictionary<AbstractDie<AbstractDieFace<object>>, AbstractDieFace<object>> ThrowAll()
|
|
|
|
private Dictionary<AbstractDie<object>, AbstractDieFace<object>> ThrowAll()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Dictionary<AbstractDie<AbstractDieFace<object>>, AbstractDieFace<object>> faces = new();
|
|
|
|
Dictionary<AbstractDie<object>, AbstractDieFace<object>> faces = new();
|
|
|
|
foreach (AbstractDie<AbstractDieFace<object>> die in dice)
|
|
|
|
foreach (AbstractDie<object> die in dice)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
faces.Add(die, die.GetRandomFace());
|
|
|
|
faces.Add(die, die.GetRandomFace());
|
|
|
|
}
|
|
|
|
}
|
|
|
|