lancer des
This commit is contained in:
@@ -5,6 +5,10 @@ public enum Contexte {
|
||||
ATTAQUER,
|
||||
VOLER_EQUIP,
|
||||
EFFET_NEGATIF_SUR_AUTRES,
|
||||
EFFET_POSITIF_SUR_AUTRES, ACTIVER_EFFET_LIEU, EFFET_BOB
|
||||
EFFET_POSITIF_SUR_AUTRES,
|
||||
ACTIVER_EFFET_LIEU,
|
||||
EFFET_BOB,
|
||||
LANCER_DES_4,
|
||||
LANCER_DES_6
|
||||
|
||||
}
|
||||
|
||||
@@ -166,7 +166,37 @@ public class GestionnaireJeu {
|
||||
});
|
||||
|
||||
this.waitPlateau();
|
||||
}
|
||||
}
|
||||
|
||||
public int jouerDes(Joueur joueur, Contexte c) {
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
pc.afficherLancerDes(joueur, c);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
this.waitPlateau();
|
||||
|
||||
final FutureTask<Integer> query = new FutureTask<Integer>(new Callable<Integer>() {
|
||||
@Override
|
||||
public Integer call() throws Exception {
|
||||
return pc.getChoixLancerDes(joueur);
|
||||
}
|
||||
});
|
||||
|
||||
Platform.runLater(query);
|
||||
|
||||
try {
|
||||
return query.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Joueur choisirJoueur(Joueur joueur, List<Joueur> joueurs, Contexte contexte) {
|
||||
|
||||
|
||||
@@ -246,6 +246,10 @@ public class Joueur {
|
||||
return this.plateau.choisir(this, activerEffetLieu);
|
||||
}
|
||||
|
||||
public int lancerDes(Contexte typeLancer) {
|
||||
return this.plateau.lancerDes(this, typeLancer);
|
||||
}
|
||||
|
||||
public Object choisir(List<?> list,Class cls) {
|
||||
return this.plateau.choisir(this,list, cls);
|
||||
}
|
||||
|
||||
@@ -266,8 +266,9 @@ public class Plateau extends Thread{
|
||||
|
||||
System.out.println(joueurs.size());
|
||||
Joueur currentJoueur = this.joueurs.get(i % nbJoueurs);
|
||||
currentJoueur.choisir(joueurs, Joueur.class);
|
||||
int lancer = currentJoueur.lancerDes(Contexte.LANCER_DES_4);
|
||||
System.out.println("\n\n\n\n\n");
|
||||
System.out.println(lancer);
|
||||
System.out.println("Au tour de "+currentJoueur.getNom());
|
||||
System.out.println("Lancement des dés.");
|
||||
deplacer(currentJoueur);
|
||||
@@ -477,4 +478,8 @@ public class Plateau extends Thread{
|
||||
gj.retirerEquipement(joueur,e);
|
||||
|
||||
}
|
||||
|
||||
public int lancerDes(Joueur joueur, Contexte typeLancer) {
|
||||
return gj.jouerDes(joueur, typeLancer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user