diff --git a/src/Objets/ObjetAvecBonusForce.java b/src/Objets/ObjetAvecBonusForce.java index 12e2692..7d6a22e 100644 --- a/src/Objets/ObjetAvecBonusForce.java +++ b/src/Objets/ObjetAvecBonusForce.java @@ -2,9 +2,9 @@ package Objets; public class ObjetAvecBonusForce extends ObjetAbstrait { - - protected ObjetAvecBonusForce(String name, double lifePoint, - double strength, double speed) { + + public ObjetAvecBonusForce(String name, double lifePoint, + double strength, double speed) { super(name, lifePoint, strength, speed); // TODO Auto-generated constructor stub } diff --git a/src/Objets/ObjetAvecBonusPV.java b/src/Objets/ObjetAvecBonusPV.java index 9b60712..8fb1557 100644 --- a/src/Objets/ObjetAvecBonusPV.java +++ b/src/Objets/ObjetAvecBonusPV.java @@ -2,8 +2,8 @@ package Objets; public class ObjetAvecBonusPV extends ObjetAbstrait { - protected ObjetAvecBonusPV(String name, double lifePoint, double strength, - double speed) { + public ObjetAvecBonusPV(String name, double lifePoint, double strength, + double speed) { super(name, lifePoint, strength, speed); // TODO Auto-generated constructor stub } diff --git a/src/Objets/ObjetAvecBonusVitesse.java b/src/Objets/ObjetAvecBonusVitesse.java index 1298158..8e6837c 100644 --- a/src/Objets/ObjetAvecBonusVitesse.java +++ b/src/Objets/ObjetAvecBonusVitesse.java @@ -2,8 +2,8 @@ package Objets; public class ObjetAvecBonusVitesse extends ObjetAbstrait { - protected ObjetAvecBonusVitesse(String name, double lifePoint, - double strength, double speed) { + public ObjetAvecBonusVitesse(String name, double lifePoint, + double strength, double speed) { super(name, lifePoint, strength, speed); // TODO Auto-generated constructor stub } diff --git a/src/SimulationJeu.java b/src/SimulationJeu.java index 709648f..587aa84 100644 --- a/src/SimulationJeu.java +++ b/src/SimulationJeu.java @@ -1,6 +1,9 @@ import Cases.CaseAbstraite; import Fabriques.Scenario.FabriqueScenarioAbstraite; import Objets.ObjetAbstrait; +import Objets.ObjetAvecBonusForce; +import Objets.ObjetAvecBonusPV; +import Objets.ObjetAvecBonusVitesse; import Observateur.Organisation; import Person.Personnage; import utils.InterfaceConsole; @@ -52,6 +55,7 @@ public class SimulationJeu { p.Execution(t); recupererInformations(); } + placerDesObjets(); afficheTous(); // bloquer le tour jusqu'a toucher une touche du clavier. Scanner s = new Scanner(System.in); @@ -60,6 +64,21 @@ public class SimulationJeu { } + private void placerDesObjets() { + if (new Random().nextInt(2) == 1) { + if (new Random().nextInt(3) == 1) { + placementObjet(new ObjetAvecBonusPV("Toto", 10, 10, 10)); + } + if (new Random().nextInt(3) == 2) { + placementObjet(new ObjetAvecBonusVitesse("Toto", 10, 10, 10)); + + } + if (new Random().nextInt(3) == 3) { + placementObjet(new ObjetAvecBonusForce("tptp", 10, 10, 10)); + } + } + } + private void placement() { Random rand = new Random(); for (Personnage p : personnages) { @@ -70,6 +89,14 @@ public class SimulationJeu { } } + private void placementObjet(ObjetAbstrait o) { + Random rand = new Random(); + int x = rand.nextInt(plateau.length); + int y = rand.nextInt(plateau[x].length); + o.setCaseCourante(plateau[x][y]); + plateau[x][y].setObjetOccupant(o); + } + // Todo Save private void enregistrerSimulation(String NomFichier) { // Todo diff --git a/src/utils/InterfaceConsole.java b/src/utils/InterfaceConsole.java index 8862f1d..65dc542 100644 --- a/src/utils/InterfaceConsole.java +++ b/src/utils/InterfaceConsole.java @@ -12,8 +12,9 @@ public class InterfaceConsole { public void afficherPlateau() { for (CaseAbstraite[] aPlateau : plateau) { for (CaseAbstraite anAPlateau : aPlateau) { - if (anAPlateau.getOccupant() != null) { - System.out.print(anAPlateau.getOccupant().getNom().charAt(0) + " | "); + if (anAPlateau.getOccupant() != null || anAPlateau.getObjetOccupant() != null) { + char occ = ((anAPlateau.getOccupant() != null) ? anAPlateau.getOccupant().getNom().charAt(0) : anAPlateau.getObjetOccupant().getNom().charAt(0)); + System.out.print(occ + " | "); } else { System.out.print(" " + anAPlateau.affichageSpecial() + " | "); }