Package belotetime.application.game

Examples of belotetime.application.game.Team


              boolean b = Boolean.parseBoolean(XmlFeeds.xmlGetTag(data, "belote"));
              if(b) server.getGame().getCurrentSet().playBelote();
             
              if(server.getGame().getCurrentSet().getBelotePlayed() == 2)
              {
                Team t = player % 2 == 0 ? server.getGame().getT1() : server.getGame().getT2();
                t.setBelote(true);
              }
             
              int numCard = Integer.parseInt(XmlFeeds.xmlGetTag(data, "card"));
              server.getGame().getCarpet().getCards().add(p.playCard(numCard));
              server.getGame().getCurrentSet().nextStarter();
View Full Code Here


          southLabel.setText(game.getPlayers().get(numPlayer).getLogin());
          westLabel.setText(game.getPlayers().get((numPlayer + 1) % 4).getLogin());
          northLabel.setText(game.getPlayers().get((numPlayer + 2) % 4).getLogin());
          eastLabel.setText(game.getPlayers().get((numPlayer + 3) % 4).getLogin());
         
          Team us = (numPlayer % 2) == 0 ? game.getT1() : game.getT2();
          Team them = (numPlayer % 2) == 1 ? game.getT1() : game.getT2();
          setScore(us.getPoints());
          setGameScore(us.getGamePoints(), them.getGamePoints());
         
          //Si l'atout n'a pas encore �t� pris
          if(game.getCurrentSet().getTrump() == null || game.getCurrentSet().getTrump().equals("null"))
          {
            showTrump(game.getPacket().getCards().get(game.getPacket().getCards().size() - 1).getImg());
           
            //Si on n'est pas le joueur qui commence
            if(!game.getCurrentSet().getTaker().getLogin().equals(game.getPlayers().get(numPlayer).getLogin()))
            {
   
            }
            //C'est au tour du joueur de d�cider s'il veut prendre l'atout ou non
            else
            {
              takeButton.setDisable(false);
              passButton.setDisable(false);
           
            if (online)
            {
              sendRedTchatMessage("Vous avez 45 secondes pour d�cider de prendre l'atout ou de passer.");
            }
             
              //Si on est au deuxi�me tour
              if(game.getCurrentSet().getTurn() == 1)
              {
                Family fam = null;
                String trump = game.getPacket().getCards().get(game.getPacket().getCards().size() - 1).getColor();
               
                switch(trump)
                {
                  case "Carreau":
                    fam = Family.DIAMONDS;
                    break;
                  case "Pique":
                    fam = Family.SPADES;
                    break;
                  case "Tr�fle":
                    fam = Family.CLUBS;
                    break;
                  case "Coeur":
                    fam = Family.HEARTS;
                    break;
                  default:
                    break;
                }
               
                otherTrumps(fam);
              }
            }
          }
          //L'atout a �t� choisi
          else
          {
            if(game.getCarpet().getCards().size() == 0) resetCenter();
           
            if((game.getPlayers().get(numPlayer).hasBelote() && game.getCurrentSet().getBelotePlayed() == 0) || game.getCurrentSet().getBelotePlayed() == 1)
              beloteCheck.setDisable(false);
            else
              beloteCheck.setDisable(true);
           
            resetCenter();
           
            Position playPos[] = new Position[4];
            playPos[numPlayer] = Position.SOUTH;
            playPos[(numPlayer+1)%4] = Position.WEST;
            playPos[(numPlayer+2)%4] = Position.NORTH;
            playPos[(numPlayer+3)%4] = Position.EAST;
           
            String starterLogin = game.getCurrentSet().getStarter().getLogin();
            int starter = 0;
            for(Player p : game.getPlayers()){
              if(p.getLogin().equals(starterLogin))
                break;
              starter++;
            }
           
            for(Card c : game.getCarpet().getCards())
            {
              playCard(playPos[(starter - game.getCarpet().getCards().size() + 4)%4], new Image(c.getImg()));
              starter++;
            }
           
            if(game.getPacket().getCards().size() > 0)
            {
              Pack packet = game.getPacket();
              setFold(new ImageView(new Image(packet.getCards().get(packet.getCards().size() - 4).getImg())),
                  new ImageView(new Image(packet.getCards().get(packet.getCards().size() - 3).getImg())),
                  new ImageView(new Image(packet.getCards().get(packet.getCards().size() - 2).getImg())),
                  new ImageView(new Image(packet.getCards().get(packet.getCards().size() - 1).getImg())));
            }
           
            setTrump(game.getCurrentSet().getTrump());
          }
        }
      }
      else
      {
        sendRedTchatMessage("Partie termin�e");
        Team us = (numPlayer % 2) == 0 ? game.getT1() : game.getT2();
        Team them = (numPlayer % 2) == 1 ? game.getT1() : game.getT2();
        setScore(us.getPoints());
        setGameScore(us.getGamePoints(), them.getGamePoints());
        resetCenter();
      }
    }
  }
View Full Code Here

                addCard(pos[(game.getPlayers().indexOf(p) - numPlayer + 3) % 4], "res\\cartes\\carte_inconnue.png");
              }
            }
          }
         
          Team us = (numPlayer % 2) == 0 ? game.getT1() : game.getT2();
          Team them = (numPlayer % 2) == 1 ? game.getT1() : game.getT2();
          setScore(us.getPoints());
          setGameScore(us.getGamePoints(), them.getGamePoints());
         
          //Si l'atout n'a pas encore �t� pris
          if(game.getCurrentSet().getTrump() == null || game.getCurrentSet().getTrump().equals("null"))
          {
            showTrump(game.getPacket().getCards().get(game.getPacket().getCards().size() - 1).getImg());
           
            //Si on n'est pas le joueur qui commence
            if(!game.getCurrentSet().getTaker().getLogin().equals(game.getPlayers().get(numPlayer).getLogin()))
            {
   
            }
            //C'est au tour du joueur de d�cider s'il veut prendre l'atout ou non
            else
            {
              takeButton.setDisable(false);
              passButton.setDisable(false);
           
            if (online)
            {
              sendRedTchatMessage("Vous avez 45 secondes pour d�cider de prendre l'atout ou de passer.");
            }
             
              //Si on est au deuxi�me tour
              if(game.getCurrentSet().getTurn() == 1)
              {
                Family fam = null;
                String trump = game.getPacket().getCards().get(game.getPacket().getCards().size() - 1).getColor();
               
                switch(trump)
                {
                  case "Carreau":
                    fam = Family.DIAMONDS;
                    break;
                  case "Pique":
                    fam = Family.SPADES;
                    break;
                  case "Tr�fle":
                    fam = Family.CLUBS;
                    break;
                  case "Coeur":
                    fam = Family.HEARTS;
                    break;
                  default:
                    break;
                }
               
                otherTrumps(fam);
              }
            }
          }
          //L'atout a �t� choisi
          else
          {
            if(game.getCarpet().getCards().size() == 0) resetCenter();
           
            if((game.getPlayers().get(numPlayer).hasBelote() && game.getCurrentSet().getBelotePlayed() == 0) || game.getCurrentSet().getBelotePlayed() == 1)
              beloteCheck.setDisable(false);
            else
              beloteCheck.setDisable(true);
           
            resetCenter();
           
            Position playPos[] = new Position[4];
            playPos[numPlayer] = Position.SOUTH;
            playPos[(numPlayer+1)%4] = Position.WEST;
            playPos[(numPlayer+2)%4] = Position.NORTH;
            playPos[(numPlayer+3)%4] = Position.EAST;
           
            String starterLogin = game.getCurrentSet().getStarter().getLogin();
            int starter = 0;
            for(Player p : game.getPlayers()){
              if(p.getLogin().equals(starterLogin))
                break;
              starter++;
            }
           
            for(Card c : game.getCarpet().getCards())
            {
              playCard(playPos[(starter - game.getCarpet().getCards().size() + 4)%4], new Image(c.getImg()));
              starter++;
            }
           
            if(game.getPacket().getCards().size() > 0)
            {
              Pack packet = game.getPacket();
              setFold(new ImageView(new Image(packet.getCards().get(packet.getCards().size() - 4).getImg())),
                  new ImageView(new Image(packet.getCards().get(packet.getCards().size() - 3).getImg())),
                  new ImageView(new Image(packet.getCards().get(packet.getCards().size() - 2).getImg())),
                  new ImageView(new Image(packet.getCards().get(packet.getCards().size() - 1).getImg())));
            }
           
            setTrump(game.getCurrentSet().getTrump());
          }
        }
      }
      else
      {
        sendRedTchatMessage("Partie termin�e");
        Team us = (numPlayer % 2) == 0 ? game.getT1() : game.getT2();
        Team them = (numPlayer % 2) == 1 ? game.getT1() : game.getT2();
        //Team winner = us.getGamePoints() > them.getGamePoints() ? us : them;
        //winner.getGamePoints(); //Les points du vainqueur
        //controller.execute("addNbPoints", new Object[] {winner.getP1().getLogin(), winner.getGamePoints()});
        //controller.execute("addNbPoints", new Object[] {winner.getP2().getLogin(), winner.getGamePoints()});
        setScore(us.getPoints());
        setGameScore(us.getGamePoints(), them.getGamePoints());
        resetCenter();
      }
    }
  }
View Full Code Here

TOP

Related Classes of belotetime.application.game.Team

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.