LesSyms4/src/SimulationJeu.java

65 lines
1.8 KiB
Java
Raw Normal View History

2014-10-03 13:34:03 +00:00
import Comportements.ComportementCombat;
import Comportements.ComportementEmmetreSon;
2014-10-03 15:20:49 +00:00
import Person.*;
2014-10-03 13:34:03 +00:00
import java.util.ArrayList;
public class SimulationJeu {
ArrayList<Personnage> liste;
2014-10-03 15:20:49 +00:00
Organisation o;
2014-10-03 13:34:03 +00:00
public SimulationJeu() {
liste = new ArrayList<Personnage>();
}
public String afficheTous() {
StringBuilder result = new StringBuilder();
for(Personnage p: liste) {
result.append(p.getNom());
result.append(System.getProperty("line.separator"));
}
return result.toString();
}
public void changerComportementCombat(Personnage p, ComportementCombat c){
p.setComportementCombat(c);
}
public void changerComportementEmmetreSon(Personnage p, ComportementEmmetreSon c){
p.setComportementEmmetreSon(c);
}
public void creationPersonnages() {
2014-10-03 15:20:49 +00:00
this.o = new Organisation();
2014-10-03 13:34:03 +00:00
Princesse p = new Princesse("Fiona");
2014-10-03 15:20:49 +00:00
Chevalier z = new Chevalier(o, "Zodiac");
Fantasssin f = new Fantasssin(o, "Fantastic");
2014-10-03 13:34:03 +00:00
liste.add(p);
liste.add(z);
liste.add(f);
}
public String emmetreUnSonTous() {
StringBuilder result = new StringBuilder();
for (Personnage p: liste) {
result.append(p.EmmetreSon());
result.append(System.getProperty("line.separator"));
}
return result.toString();
}
public String lancerCombar() {
StringBuilder result = new StringBuilder();
for (Personnage p: liste) {
result.append(p.Combattre());
result.append(System.getProperty("line.separator"));
}
return result.toString();
}
2014-10-03 15:20:49 +00:00
public void changerEtat(eMode etat) {
this.o.setModeFonctionnement(etat);
}
2014-10-03 13:34:03 +00:00
}