patch test

This commit is contained in:
marc barbier
2020-12-13 13:27:05 +01:00
parent 7f4362cf33
commit 6b9fade19d
10 changed files with 49 additions and 46 deletions
+12 -9
View File
@@ -1,7 +1,6 @@
package game;
import java.io.IOException;
import java.net.Socket;
import game.cards.Card;
import game.cards.CardRegistery;
@@ -9,8 +8,6 @@ import game.deck.Deck;
import game.deck.DeckRegistery;
public class Joueur {
private Socket connection;
private ComsJoueur coms;
private Deck deck;
private Hand hand;
@@ -19,9 +16,8 @@ public class Joueur {
private int mana;
public Joueur(Socket connectionJoueur) throws IOException {
connection=connectionJoueur;
coms = new ComsJoueur(connection);
public Joueur(ComsJoueur connectionJoueur) throws IOException {
coms=connectionJoueur;
pV =20;
}
@@ -75,13 +71,17 @@ public class Joueur {
//debut de l'écoude des action client
while(phaseActive)
{
String command = (String) coms.recieve();
String command;
command = (String) coms.recieve();
System.out.println("GOT COMMAND :"+command);
if(command != null)
{
switch (command) {
case Command.PING:
coms.send(Command.PONG);
System.out.println("pong");
break;
case Command.PASS_TURN:
@@ -91,6 +91,9 @@ public class Joueur {
case Command.PUT_CARD:
putCard(adversaire,board);
break;
case "time out":
System.exit(0);
break;
default:
coms.send(Command.POPUP);
@@ -162,8 +165,8 @@ public class Joueur {
}
public Socket getConnection() {
return connection;
public ComsJoueur getComs() {
return coms;
}
public void setPV(int pV) {