Package bluffinmuffin.poker.entities

Examples of bluffinmuffin.poker.entities.PotInfo


                m_pokerTable.getPots().clear();
                m_pokerTable.setTotalPotAmnt(0);
                m_pokerTable.setHigherBet(0);
                for (int i = 0; i < amounts.size() && amounts.get(i) > 0; ++i)
                {
                    m_pokerTable.getPots().add(new PotInfo(i, amounts.get(i)));
                    m_pokerTable.incTotalPotAmnt(amounts.get(i));
                }
                for (final PlayerInfo p : m_pokerTable.getPlayers())
                {
                    p.setMoneyBetAmnt(0);
                }
                m_gameObserver.gameBettingRoundEnded(command.getRound());
            }
           
            @Override
            public void betTurnStartedCommandReceived(BetTurnStartedCommand command)
            {
                final Card[] cards = new Card[5];
                for (int i = 0; i < 5; ++i)
                {
                    cards[i] = Card.getInstance(command.getCardsId().get(i));
                }
                m_pokerTable.setCards(cards[0], cards[1], cards[2], cards[3], cards[4]);
                m_pokerTable.setRound(command.getRound());
                if (m_pokerTable.getRound() == GameRoundType.PREFLOP)
                {
                    m_pokerTable.setNoSeatLastRaise(m_pokerTable.nextPlayingPlayer(m_pokerTable.getNoSeatBigBlind()).getNoSeat());
                }
                else
                {
                    m_pokerTable.setNoSeatLastRaise(m_pokerTable.nextPlayingPlayer(m_pokerTable.getNoSeatDealer()).getNoSeat());
                }
                m_gameObserver.gameBettingRoundStarted();
            }
           
            @Override
            public void gameEndedCommandReceived(GameEndedCommand command)
            {
                m_pokerTable.setTotalPotAmnt(0);
                m_gameObserver.gameEnded();
            }
           
            @Override
            public void gameStartedCommandReceived(GameStartedCommand command)
            {
                m_pokerTable.setNoSeatDealer(command.GetNoSeatD());
                m_pokerTable.setNoSeatSmallBlind(command.GetNoSeatSB());
                m_pokerTable.setNoSeatBigBlind(command.GetNoSeatBB());
               
                // TODO: RICK: This is nice but, si le player passe pas par tcp (direct, hooking, etc) il saura pas quoi faire lors des blinds.
                if (m_pokerTable.getNoSeatSmallBlind() == m_tablePosition)
                {
                    send(new PlayerPlayMoneyCommand(m_pokerTable.getSmallBlindAmnt()));
                }
                if (m_pokerTable.getNoSeatBigBlind() == m_tablePosition)
                {
                    send(new PlayerPlayMoneyCommand(m_pokerTable.getBigBlindAmnt()));
                }
                m_gameObserver.gameBlindsNeeded();
            }
           
            @Override
            public void holeCardsChangedCommandReceived(PlayerHoleCardsChangedCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    if (command.isPlaying())
                    {
                        p.setPlaying();
                    }
                    else
                    {
                        p.setNotPlaying();
                    }
                    final List<Integer> ids = command.getCardsId();
                    final Card gc0 = Card.getInstance(ids.get(0));
                    final Card gc1 = Card.getInstance(ids.get(1));
                    p.setCards(gc0, gc1);
                    m_gameObserver.playerHoleCardsChanged(p);
                }
            }
           
            @Override
            public void playerJoinedCommandReceived(PlayerJoinedCommand command)
            {
                final PlayerInfo p = new PlayerInfo(command.getPlayerPos(), command.getPlayerName(), command.getPlayerMoney());
                if (p != null)
                {
                    m_pokerTable.forceJoinTable(p, command.getPlayerPos());
                    m_gameObserver.playerJoined(p);
                }
            }
           
            @Override
            public void playerLeftCommandReceived(PlayerLeftCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    m_pokerTable.leaveTable(p);
                    m_gameObserver.playerLeaved(p);
                }
            }
           
            @Override
            public void playerMoneyChangedCommandReceived(PlayerMoneyChangedCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    p.setMoneySafeAmnt(command.getPlayerMoney());
                    m_gameObserver.playerMoneyChanged(p);
                }
            }
           
            @Override
            public void playerTurnBeganCommandReceived(PlayerTurnBeganCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                final PlayerInfo last = m_pokerTable.getPlayer(command.getLastPlayerNoSeat());
                if (p != null)
                {
                    m_pokerTable.setNoSeatCurrPlayer(command.getPlayerPos());
                    m_gameObserver.playerActionNeeded(p, last);
                }
            }
           
            @Override
            public void playerTurnEndedCommandReceived(PlayerTurnEndedCommand command)
            {
                if (m_pokerTable.getHigherBet() < command.getPlayerBet())
                {
                    m_pokerTable.setHigherBet(command.getPlayerBet());
                }
                m_pokerTable.setTotalPotAmnt(command.getTotalPot());
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    if (command.getActionType() == PlayerActionType.RAISED)
                    {
                        m_pokerTable.setNoSeatLastRaise(p.getNoSeat());
                    }
                    final int a = command.getActionAmount();
                    p.setMoneyBetAmnt(command.getPlayerBet());
                    p.setMoneySafeAmnt(command.getPlayerMoney());
                    if (command.isPlaying())
                    {
                        p.setPlaying();
                    }
                    else
                    {
                        p.setNotPlaying();
                    }
                    m_gameObserver.playerActionTaken(p, command.getActionType(), a);
                }
            }
           
            @Override
            public void playerWonPotCommandReceived(PlayerWonPotCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    p.setMoneySafeAmnt(command.getPlayerMoney());
                    m_gameObserver.playerWonPot(p, new PotInfo(command.getPotID(), command.getShared()), command.getShared());
                }
            }
           
            @Override
            public void tableClosedCommandReceived(TableClosedCommand command)
            {
                m_gameObserver.everythingEnded();
            }
           
            @Override
            public void tableInfoCommandReceived(TableInfoCommand command)
            {
                m_pokerTable.setTotalPotAmnt(command.getTotalPotAmount());
                m_pokerTable.setBetLimit(command.getLimit());
                final List<Integer> amounts = command.getPotsAmount();
                m_pokerTable.getPots().clear();
                for (int i = 0; i < amounts.size() && amounts.get(i) > 0; ++i)
                {
                    m_pokerTable.getPots().add(new PotInfo(i, amounts.get(i)));
                }
               
                final Card[] cards = new Card[5];
                for (int i = 0; i < 5; ++i)
                {
View Full Code Here

TOP

Related Classes of bluffinmuffin.poker.entities.PotInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.