Ajout LieuZJ
This commit is contained in:
@@ -43,7 +43,7 @@ public class GestionnaireJeu {
|
||||
plateau.start();
|
||||
}
|
||||
|
||||
public Joueur choisirParmisTous(Joueur joueur, List<Joueur> joueurs) {
|
||||
public Joueur choisirParmisListe(Joueur joueur, List<Joueur> joueurs) {
|
||||
return joueurs.get(0);
|
||||
|
||||
}
|
||||
@@ -51,16 +51,24 @@ public class GestionnaireJeu {
|
||||
public Effet choisirEffet(Joueur joueur, Effet[] effets) {
|
||||
return effets[0];
|
||||
}
|
||||
|
||||
public Joueur choisirAdjacents(Joueur joueur, List<Joueur> joueurs) {
|
||||
return joueurs.get(0);
|
||||
}
|
||||
|
||||
|
||||
public void deplacer(Joueur currentJoueur) {
|
||||
|
||||
Platform.runLater(() -> {
|
||||
pc.deplacer(currentJoueur);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public void afficherLieu(Joueur currentJoueur) {
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
pc.afficherLieu(currentJoueur);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
this.waitPlateau();
|
||||
}
|
||||
|
||||
public void updateVieJoueur(Joueur joueur, int damage) {
|
||||
@@ -71,6 +79,7 @@ public class GestionnaireJeu {
|
||||
}
|
||||
|
||||
public boolean choisir(Joueur joueur) {
|
||||
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
pc.afficherChoisir(joueur);
|
||||
@@ -93,7 +102,6 @@ public class GestionnaireJeu {
|
||||
try {
|
||||
return query.get().booleanValue();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -166,6 +174,8 @@ public class GestionnaireJeu {
|
||||
public RessourceLoader getRessourceLoader() {
|
||||
return this.ressourceLoader;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -134,10 +134,8 @@ public class Joueur {
|
||||
j2.gestionnaireEquipements.retirer(equipement);
|
||||
this.gestionnaireEquipements.ajouter(equipement); }
|
||||
|
||||
public Object choisir(List<?> list) {
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void attaquer(Joueur j2, int attaqueDice) {
|
||||
|
||||
int blessure = evaluerImmunite(j2)*(this.evaluerAttaque(j2) + attaqueDice);
|
||||
@@ -170,22 +168,6 @@ public class Joueur {
|
||||
public Plateau getPlateau() {
|
||||
return this.plateau;
|
||||
}
|
||||
|
||||
public boolean choisir() {
|
||||
return this.plateau.choisir(this);
|
||||
}
|
||||
|
||||
public Joueur choisirAdjacents() {
|
||||
return this.plateau.choisirAdjacents(this);
|
||||
}
|
||||
|
||||
public Effet choisir(Effet[] effets) {
|
||||
return this.plateau.choisirEffet(this,effets);
|
||||
}
|
||||
|
||||
public Joueur choisiParmisTous() {
|
||||
return this.plateau.choisirParmisTous(this);
|
||||
}
|
||||
|
||||
public boolean getRevele() {
|
||||
return this.revele;
|
||||
@@ -220,8 +202,6 @@ public class Joueur {
|
||||
cl.ajouterJoueur(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public CarteLieu getCarteLieu() {
|
||||
return this.carteLieu;
|
||||
}
|
||||
@@ -255,5 +235,23 @@ public class Joueur {
|
||||
|
||||
return !joueurs.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean choisir() {
|
||||
return this.plateau.choisir(this);
|
||||
}
|
||||
|
||||
public Object choisir(List<?> list) {
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
public Joueur choisirAdjacents() {
|
||||
return this.plateau.choisirAdjacents(this);
|
||||
}
|
||||
|
||||
public Joueur choisiParmisTous() {
|
||||
return this.plateau.choisirParmisTous(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -269,10 +269,11 @@ public class Plateau extends Thread{
|
||||
System.out.println("Au tour de "+currentJoueur.getNom());
|
||||
System.out.println("Lancement des dés.");
|
||||
deplacer(currentJoueur);
|
||||
System.out.println("OUI");
|
||||
if(isPartieTerminee()) break;
|
||||
System.out.println("Vous êtes désormais sur le lieu "+currentJoueur.getCarteLieu().getNom());
|
||||
System.out.println("Voulez vous activer l'effet du lieu ?");
|
||||
gj.afficherLieu(currentJoueur);
|
||||
|
||||
if(currentJoueur.choisir()) {
|
||||
System.out.println("Vous activez l'effet du lieu.");
|
||||
System.out.println("Vous avez "+currentJoueur.getStat(Joueur.PLAYER_HP)+" pv");
|
||||
@@ -286,7 +287,8 @@ public class Plateau extends Thread{
|
||||
System.out.println("Souhaitez vous attaquer quelqu'un ?");
|
||||
if(currentJoueur.choisir()){
|
||||
if(currentJoueur.hasOpponents()) {
|
||||
Joueur cible = currentJoueur.choisirAdjacents();
|
||||
List<Joueur> adjacents = currentJoueur.getJoueursAdjacents();
|
||||
Joueur cible = (Joueur) currentJoueur.choisir(adjacents);
|
||||
attaquer(currentJoueur,cible);
|
||||
if(isPartieTerminee()) break;
|
||||
}else {
|
||||
@@ -439,9 +441,9 @@ public class Plateau extends Thread{
|
||||
joueurs.remove(joueur);
|
||||
joueurs.addAll(cl.getJoueursAdjacents());
|
||||
|
||||
return gj.choisirAdjacents(joueur, joueurs);
|
||||
return gj.choisirParmisListe(joueur, joueurs);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Effet choisirEffet(Joueur joueur, Effet[] effets) {
|
||||
return gj.choisirEffet(joueur,effets);
|
||||
@@ -449,7 +451,7 @@ public class Plateau extends Thread{
|
||||
|
||||
public Joueur choisirParmisTous(Joueur joueur) {
|
||||
List<Joueur> joueurs = this.getJoueurs();
|
||||
return gj.choisirParmisTous(joueur,joueurs);
|
||||
return gj.choisirParmisListe(joueur,joueurs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user