示例#1
0
 private void unsetBonusBelottePlayers()
 {
     foreach (Player player in _players)
     {
         player.setBelotte(false);
     }
     _rebelotteTeam = Player.teamColor.NO_COLOR;
 }
示例#2
0
 private int findTeamMate(Player.teamColor team, int id)
 {
     foreach (Player player in _players)
     {
         if (player.getTeamColor() == team && player.getId() != id)
         {
             return(player.getId());
         }
     }
     return(-1);
 }
示例#3
0
 public Game(Server server)
 {
     _players   = new List <Player>();
     _gameDeck  = new Deck();
     _tableDeck = new Deck();
     _plisDeck  = new Deck();
     _rules     = new Rules(_plisDeck, _players, server);
     initCartMap();
     initPointsMap();
     _maxAnnounce   = 0;
     _server        = server;
     _rebelotteTeam = Player.teamColor.NO_COLOR;
 }
示例#4
0
        private Cart checkRebelotte(Player player)
        {
            Cart cartChoosen;

            if (!(rebelottePossible(player, player.getDeck().getAtout())))
            {
                return(null);
            }
            if ((cartChoosen = getCartBelotteRebelotte(player, "REBELOTTE")) == null)
            {
                return(checkRebelotte(player));
            }
            _rebelotteTeam = player.getTeamColor();
            return(cartChoosen);
        }
示例#5
0
        private String doAnnouncement()
        {
            bool isFinish  = false;
            bool firstTime = true;

            _bestAnnoncer = _players[Macro.INDEX_FIRST_PLAYER];
            while (!(isFinish))
            {
                _announceDefied = false;
                foreach (Player player in _players)
                {
                    if ((player != _bestAnnoncer) || (firstTime))
                    {
                        if (_maxAnnounce != 0)
                        {
                            _server.sendToAllClients("\nLa meilleure annonce provient du joueur " +
                                                     _bestAnnoncer.getId() + ". Elle est de " + _maxAnnounce + ' ' + _colorAnnounce);
                        }
                        _server.sendToClient("\nCombien annoncez-vous ? [" + Macro.PASS + " ou nombre + COEUR/TREFLE/PIQUE/CARREAU]\n",
                                             player.getId(), true);
                        while (playerProposeAnnonce(player))
                        {
                            ;
                        }
                        if (_maxAnnounce == Macro.MAX_ANNOUNCE)
                        {
                            return(_colorAnnounce);
                        }
                    }
                    else
                    {
                        _server.sendToAllClients("\nLe joueur " + player.getId() +
                                                 " a remporté l'annonce. Elle est de " + _maxAnnounce + ' ' + _colorAnnounce + '\n');
                        _server.sendToClient("Bravo, vous avez remporté l'annonce.\n", player.getId(), false);
                        _teamBestAnnonce = player.getTeamColor();
                        return(_colorAnnounce);
                    }
                    firstTime = false;
                }
                if (!(_announceDefied))
                {
                    isFinish = true;
                }
                Thread.Sleep(Macro.UTIME_TO_WAIT);
            }
            return(Macro.STRING_EMPTY);
        }
示例#6
0
        private void setPointToTeams()
        {
            int i = 0;
            int cartWithMaxPoint        = 0;
            int indexPlayerWithBestCart = 0;
            int addition = 0;

            foreach (Cart cart in _plisDeck.getAllCarts())
            {
                if ((_plisDeck.getAllCarts()[Macro.INDEX_FIRST_CART].getColor() != cart.getAtout() &&
                     cart.getPointsCart() > cartWithMaxPoint &&
                     cart.getColor() == _plisDeck.getAllCarts()[Macro.INDEX_FIRST_CART].getColor()) ||
                    (_plisDeck.getAllCarts()[Macro.INDEX_FIRST_CART].getColor() != cart.getAtout() &&
                     cart.getPointsCart() > cartWithMaxPoint && cart.getColor() == cart.getAtout()) ||
                    (_plisDeck.getAllCarts()[Macro.INDEX_FIRST_CART].getColor() == cart.getAtout() &&
                     cart.getPointsCart() > cartWithMaxPoint && cart.getColor() == cart.getAtout()))
                {
                    cartWithMaxPoint        = cart.getPointsCart();
                    indexPlayerWithBestCart = i;
                }
                addition += cart.getPointsCart();
                i++;
            }
            if ((getPlayerByIndex(indexPlayerWithBestCart).getId() == (Macro.INDEX_FIRST_PLAYER + 1)) ||
                (getPlayerByIndex(indexPlayerWithBestCart).getId() == (Macro.INDEX_THIRD_PLAYER + 1)))
            {
                _teamsPointsMap[Player.teamColor.BLEUE] = _teamsPointsMap[Player.teamColor.BLEUE] + addition;
                _server.sendToAllClients("\nL'équipe " + Player.teamColor.BLEUE + " a remporté le plis.\n");
                _dixDeDer = Player.teamColor.BLEUE;
            }
            else
            {
                _teamsPointsMap[Player.teamColor.ROUGE] = _teamsPointsMap[Player.teamColor.ROUGE] + addition;
                _server.sendToAllClients("\nL'équipe " + Player.teamColor.ROUGE + " a remporté le plis.\n");
                _dixDeDer = Player.teamColor.ROUGE;
            }
            reSetOrderPlayer(getPlayerByIndex(indexPlayerWithBestCart));
            System.Console.Write('\n');
        }