Ajout des cartes lieux en provenance de la bdd

This commit is contained in:
Paul Gross
2020-05-08 16:08:56 +02:00
parent 78f251d5f1
commit d6fe0f0d80
15 changed files with 212 additions and 72 deletions

View File

@@ -8,6 +8,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import carte.CarteLieu;
import database.RessourceLoader;
import effet.Effet;
import ihm.controller.PlateauController;
@@ -70,12 +71,10 @@ public class GestionnaireJeu {
}
public boolean choisir(Joueur joueur) {
Platform.runLater(() -> {
try {
try {
pc.afficherChoisir(joueur);
} catch (IOException e) {
e.printStackTrace();
}
});
@@ -133,8 +132,8 @@ public class GestionnaireJeu {
for(Joueur j : mapJoueurs.values()) {
joueurs.add(j);
}
plateau = new Plateau(joueurs);
//plateau = new Plateau(joueurs,ressourceLoader.getCartes());
//plateau = new Plateau(joueurs);
plateau = new Plateau(joueurs,ressourceLoader.getCartes());
}
@@ -160,6 +159,13 @@ public class GestionnaireJeu {
this.ressourceLoader = rl;
}
public List<CarteLieu> getCartesLieux() {
return plateau.getLieux();
}
public RessourceLoader getRessourceLoader() {
return this.ressourceLoader;
}

View File

@@ -134,8 +134,8 @@ public class Joueur {
j2.gestionnaireEquipements.retirer(equipement);
this.gestionnaireEquipements.ajouter(equipement); }
public Object choisir(List<?> equipements) {
return null;
public Object choisir(List<?> list) {
return list.get(0);
}
public void attaquer(Joueur j2, int attaqueDice) {

View File

@@ -27,4 +27,10 @@ public class Pioche {
public CartePiochable piocher() {
return cartesPiochables.pop();
}
public Stack<CartePiochable> getStack() {
return cartesPiochables;
}
}

View File

@@ -148,7 +148,8 @@ public class Plateau extends Thread{
List<CartePiochable> lumiere = RessourceLoader.getCartesType(CartePiochable.Type.LUMIERE, cartes);
List<CartePiochable> tenebre = RessourceLoader.getCartesType(CartePiochable.Type.TENEBRE, cartes);
List<CartePiochable> vision = RessourceLoader.getCartesType(CartePiochable.Type.VISION, cartes);
System.out.println("VISION "+vision);
Map<CartePiochable.Type, List<CartePiochable>> map = new HashMap<CartePiochable.Type, List<CartePiochable>>();
map.put(CartePiochable.Type.LUMIERE,lumiere);
map.put(CartePiochable.Type.TENEBRE,tenebre);
@@ -160,6 +161,8 @@ public class Plateau extends Thread{
if(x instanceof CarteLieuType) {
CarteLieuType clt = (CarteLieuType)x;
System.out.println(clt.getType());
System.out.println("Oui "+ map.get(clt.getType()));
clt.setPioche(new Pioche(map.get(clt.getType())));
}
@@ -173,7 +176,8 @@ public class Plateau extends Thread{
clm.setPioches(lp);
}
});
List<CartePersonnage> personnages = RessourceLoader.getCartesPersonnages(cartes);
@@ -264,6 +268,7 @@ 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 ?");
@@ -318,14 +323,12 @@ public class Plateau extends Thread{
for(CarteLieu cl : lieux) {
if(cl.coordinatesContains(roll) && currentJoueur.getCarteLieu() != cl){
currentJoueur.deplacer(cl);
attributed = true;
break;
}
}
}
gj.deplacer(currentJoueur);
}
@@ -338,7 +341,6 @@ public class Plateau extends Thread{
System.out.println(joueur2.getNom()+" a "+joueur2.getStat(Joueur.PLAYER_HP)+" pv");
joueur1.attaquer(joueur2,attaque);
System.out.println(joueur2.getNom()+" passe à "+joueur2.getStat(Joueur.PLAYER_HP)+" pv");
}
}