Package xunome.game

Examples of xunome.game.Player


                MultiPlayer game = manager.getGame();
                if (ppos == game.getLocalPlayerPos()) {

                    break;
                }
                Player player = game.getAtualPlayer();
                //It tests if player made a move but doesn't have a card.
                //Player's gotten a card then played it
                if (player.checkHaveCard(game.getAtualColor(),
                     game.getTable().getUpCard()) == Player.NONE) {

                    game.penalize(player, 1);
                }
                int card = data.charAt(1);
                int color = data.charAt(3);
                try {

                   
                    player.setAtual(card);
                    Card getCard = player.getCard(card);
                    //It tests if the player called uno
                    if (player.getNumberOfCards() == 2) {

                        if (data.charAt(4) == 1) {

                            game.penalize(player, 3);
                        } else {
View Full Code Here


            return;
        }
       
        if(bgame.getAtualPlayer().getMasterPos() == bgame.getLocalPlayerPos()) {
           
            Player p = bgame.getLocalPlayer();
           
            //When player press '5', it tests if the player doesn't have a valid card.
            if(keyP == GameCanvas.KEY_NUM5) {

                if(p.checkHaveCard(bgame.getAtualColor(), bgame.getTable()
                                    .getUpCard()) == Player.NONE) {

                    p.addCard(bgame.getTable().getCard(false));
                    this.refresh();
                } else {

                    new Jogada(bgame);
                    addCheatBuffer(keyP);
                    return;
                }

                if(p.checkHaveCard(bgame.getAtualColor(), bgame.getTable()
                                   .getUpCard()) == Player.NONE) {

                    if (bgame instanceof MultiPlayer) {

                        //#ifdef DEBUG
                        System.out.println("KEY5 Next");
                        //#endif
                        ((MultiPlayer) bgame).nextPlayerRemote();
                    } else {

                        //#ifdef DEBUG
                        System.out.println("KEY Base");
                        //#endif
                        bgame.nextPlayer();
                    }
                    refresh();
                }

                return;
            }

            try {
               
                if (keyP == KEY_NUM4) {

                    p.moveLeft();
                    refresh();
                    return;
                } else if (keyP == KEY_NUM6) {

                    p.moveRight();
                    refresh();
                    return;
                }
            } catch (InvalidMove im) {}
       
View Full Code Here

    //Select card
    int yMax = getHeight();
    int yMin = yMax - 68;

    Player localPlayer = bgame.getLocalPlayer();
    Player atualPlayer = bgame.getAtualPlayer();
    int numberOfCards = localPlayer.getNumberOfCards();
    int maxCards = numberOfCards;

    if (numberOfCards > 15) {

        maxCards = 15;
    }

    int xMin = (int)(120 - (maxCards + 1) / 2.0 * 15);
    int xMax = xMin + (maxCards + 1) * 15;


    if (((x <= xMax) && (x >= xMin)) && ((y <= yMax) && (y >= yMin))) {

        boolean tryMove = false;

            for (int atual = xMin; atual <= xMax; atual += 15) {

                int atualCard = localPlayer.getAtualCardP();
                int diff = 0;

                if ((atualCard >= numberOfCards - 3) && (numberOfCards > 15)) {

                    diff = (numberOfCards - 15);
                }

                if (((atual - xMin) / 15 + diff) == (numberOfCards - 1)) {

                    if ((atual <= x) && (x <= (atual + 30))) {

                        //Verify if selected card is the card clicked
                        if (localPlayer.getAtualCardP() == numberOfCards -1) {

                            tryMove = (atualPlayer.isLocalPlayer());
                        } else {

                            //Just select the card
                            localPlayer.setAtual(numberOfCards - 1);
                        }

                        break;
                    }

                } else if ((atual <= x) && (x <= (atual + 15))) {

                    int atualPos = (atual - xMin) / 15;
                    int selectCard = atualPos;

                    if (numberOfCards > 15) {

                        int mod = 0;

                        if (atualCard > 12) {

                            if (atualCard < numberOfCards - 2) {

                                mod = (atualCard - 12);
                            } else {

                                mod = numberOfCards - 15;
                            }
                        }

                        selectCard = atualPos + mod;
                    }

                    //Tests if selected card is the card clicked
                    if (localPlayer.getAtualCardP() == selectCard) {

                        tryMove = (atualPlayer.isLocalPlayer());
                    } else {

                        //Just select the card
                        localPlayer.setAtual(selectCard);
                    }
View Full Code Here

TOP

Related Classes of xunome.game.Player

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.