예제 #1
0
        public GameChangeResult Execute()
        {
            if (!_doubt.HasBet || !IsUserAllowed)
            {
                throw new TableGamesException("Invalid action. Match is only available when less than five dices.");
            }
            ;

            if (_doubt.Quantity == _doubt.ActualQuantity)
            {
                _doubt.Winners.Add(_doubt.Table.ActivePlayer);
                _doubt.SetPlayerDicesQty(_doubt.Table.ActivePlayer, 1);
            }
            else
            {
                _doubt.SetPlayerDicesQty(_doubt.Table.ActivePlayer, -1);
            }

            _doubt.PlayerCups.ForEach(pc => pc.ExposeDices());

            var gameEndResult = _doubt.End(this);

            return(gameEndResult);
        }
예제 #2
0
        public GameChangeResult Execute()
        {
            if (!_doubt.HasBet)
            {
                throw new TableGamesException("Invalid action. There is no bet.");
            }
            ;

            if (_doubt.Quantity > _doubt.ActualQuantity)
            {
                _doubt.Winners.Add(_doubt.Table.ActivePlayer);
                _doubt.SetPlayerDicesQty(_doubt.Table.GetPreviousPlayer(_doubt.Table.ActivePlayer), -1);
            }
            else
            {
                _doubt.SetPlayerDicesQty(_doubt.Table.ActivePlayer, -1);
            }

            _doubt.PlayerCups.ForEach(pc => pc.ExposeDices());

            var gameEndResult = _doubt.End(this);

            return(gameEndResult);
        }