Esempio n. 1
0
        public RollState(IGameTurn turn, IDice dice)
        {
            if (turn == null)
                throw new ArgumentNullException(nameof(turn));
            if (dice == null)
                throw new ArgumentNullException(nameof(dice));

            this.turn = turn;
            this.dice = dice;
        }
Esempio n. 2
0
        public MoveRobberState(IGameTurn turn, IRobber robber)
        {
            if (turn == null)
                throw new ArgumentNullException(nameof(turn));
            if (robber == null)
                throw new ArgumentNullException(nameof(robber));

            this.turn = turn;
            this.robber = robber;
        }
Esempio n. 3
0
        public RobberStealState(IGameTurn turn, IBoard board)
        {
            if (turn == null)
                throw new ArgumentNullException(nameof(turn));
            if (board == null)
                throw new ArgumentNullException(nameof(board));
            if (board.Robber == null)
                throw new ArgumentNullException(nameof(board.Robber));
            this.turn = turn;

            //CvB todo maybe cleaner to get those values from a class that handles the actual stealing?
            var stealablePlayers = board.GetPlayers(board.Robber.CurrentTile);
            if (!stealablePlayers.Any() || stealablePlayers.All(p => p == turn.Player))
                turn.NextFlowState();
        }
Esempio n. 4
0
        public RobberDiscardState(IGameTurn turn, IEnumerable<IPlayer> players)
        {
            if (turn == null)
                throw new ArgumentNullException(nameof(turn));
            if (players == null)
                throw new ArgumentNullException(nameof(players));

            this.turn = turn;
            this.players = players;


            desiredInventorySizes = new Dictionary<IPlayer, int>();
            foreach (var player in players)
            {
                if (player.Inventory.Count() > 7)
                {
                    double inveotryCount = player.Inventory.Count();
                    int desired = Convert.ToInt32(Math.Round(inveotryCount / 2, MidpointRounding.AwayFromZero));
                    desiredInventorySizes.Add(player, desired);
                }
            }

            CheckStateChange();
        }
Esempio n. 5
0
 public MonopolyState(IGameTurn turn)
 {
     if (turn == null)
         throw new ArgumentNullException(nameof(turn));
     this.turn = turn;
 }
Esempio n. 6
0
 public RoadBuildingState(IGameTurn turn)
 {
     if (turn == null)
         throw new ArgumentNullException(nameof(turn));
     this.turn = turn;
 }
Esempio n. 7
0
 public YearOfPlentyState(IGameTurn turn)
 {
     if (turn == null)
         throw new ArgumentNullException(nameof(turn));
     this.turn = turn;
 }