p.getHand().getCards().removeAll(p.getHand().getCards());
}
server.getGame().getPacket().cut();
int numDealer = server.getGame().getPlayers().indexOf(server.getGame().getCurrentSet().getDealer());
server.getGame().setCurrentSet(new Set(server.getGame(), server.getGame().getPlayers().get((numDealer + 1) % 4)));
server.getGame().getCurrentSet().defineStarter();
server.getGame().getCurrentSet().firstDeal(Set.THREE_CARDS);
}
connect();
}
catch(NumberFormatException e)
{
e.printStackTrace();
}
break;
case "passSet" :
//On ajoute le score global aux deux �quipes et on r�initialiste les plis
server.getGame().getT1().updatePoints();
server.getGame().getT2().updatePoints();
server.getGame().getPacket().cut();
int numDealer = server.getGame().getPlayers().indexOf(server.getGame().getCurrentSet().getDealer());
server.getGame().setCurrentSet(new Set(server.getGame(), server.getGame().getPlayers().get((numDealer + 1) % 4)));
server.getGame().getCurrentSet().defineStarter();
server.getGame().getCurrentSet().firstDeal(Set.THREE_CARDS);
break;
case "takeTrump" :
String color = XmlFeeds.xmlGetTag(data, "color");
player = Integer.parseInt(XmlFeeds.xmlGetTag(data, "numplayer"));
Card trump = server.getGame().getPacket().getCards().get(server.getGame().getPacket().getCards().size() - 1);
color = color.length() == 0 ? trump.getColor() : color;
server.getGame().getCurrentSet().setTrump(color);
server.getGame().getCurrentSet().takeTrump(server.getGame().getPlayers().get(player));
server.getGame().getCurrentSet().secondDeal();
server.getGame().getCurrentSet().alterTrumpValue();
connect();
break;
case "playCard" :
player = Integer.parseInt(XmlFeeds.xmlGetTag(data, "player"));
Player p = server.getGame().getPlayers().get(player);
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();
connect();
break;
case "initTrick" :
//Fin du pli
server.getGame().getCurrentSet().trickWin();
server.getGame().setCarpet(new Pack());
//Fin de la manche
if(server.getGame().getT1().getPoints() + server.getGame().getT2().getPoints() == 152)
{
server.getGame().getCurrentSet().result();
server.getGame().getPacket().cut();
int dealer = server.getGame().getPlayers().indexOf(server.getGame().getCurrentSet().getDealer());
server.getGame().setCurrentSet(new Set(server.getGame(), server.getGame().getPlayers().get((dealer + 1) % 4)));
server.getGame().getCurrentSet().defineStarter();
server.getGame().getCurrentSet().firstDeal(Set.THREE_CARDS);
}
//Fin de la partie