feat: 🔥 fin du prototyyyype java

This commit is contained in:
gdamms 2021-12-01 21:19:08 +01:00
parent 7afc1b4f7c
commit d1e70947ce
3 changed files with 44 additions and 8 deletions

View file

@ -8,4 +8,9 @@ public class Description {
this.texte = texte; this.texte = texte;
this.condition = condition; this.condition = condition;
} }
@Override
public String toString() {
return this.texte;
}
} }

View file

@ -22,14 +22,14 @@ public class Interaction {
@Override @Override
public String toString() { public String toString() {
String res = ""; String res = "Interraction :";
int k = 0; int k = 0;
for (Action a : i.actions) { for (Action a : this.actions) {
if (a.visible.evaluer()) { if (a.visible.evaluer()) {
res += k + " " + a + "\n"; res += "\n" + k + " " + a;
k++; k++;
} }
} }
return super.toString(); return res;
} }
} }

View file

@ -45,6 +45,7 @@ public class Jeu {
if (p.visible.evaluer() && p.obligatoire.evaluer()) { if (p.visible.evaluer() && p.obligatoire.evaluer()) {
for (Interaction i : p.interractions) { for (Interaction i : p.interractions) {
if (i.visible.evaluer()) { if (i.visible.evaluer()) {
System.out.println(i);
boolean arreter_interraction = false; boolean arreter_interraction = false;
while (!arreter_interraction) { while (!arreter_interraction) {
List<Action> actions_choix = new ArrayList<>(); List<Action> actions_choix = new ArrayList<>();
@ -94,15 +95,29 @@ public class Jeu {
} }
if (!chemin_pris) { if (!chemin_pris) {
int k = 0;
List<Chemin> chemins_choix = new ArrayList<>(); List<Chemin> chemins_choix = new ArrayList<>();
for (Chemin c : territoire.chemins) { for (Chemin c : territoire.chemins) {
if (c.lieuIn == lieu) { if (c.lieuIn == lieu) {
if (c.visible.evaluer() && c.ouvert.evaluer()) { if (c.visible.evaluer() && c.ouvert.evaluer()) {
chemins_choix.add(c); chemins_choix.add(c);
System.out.println(c); System.out.println(k + " " + c);
k++;
} }
} }
} }
List<Personne> personnes_choix = new ArrayList<>();
for (Personne p : personnes) {
if (lieu.personnes.contains(p)) {
if (p.visible.evaluer()) {
personnes_choix.add(p);
System.out.println(p);
k++;
}
}
}
int choix = 0; int choix = 0;
try { try {
choix = Integer.parseInt(reader.readLine()); choix = Integer.parseInt(reader.readLine());
@ -111,7 +126,11 @@ public class Jeu {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
lieu = chemins_choix.get(choix).lieuOut; if (choix < chemins_choix.size()) {
lieu = chemins_choix.get(choix).lieuOut;
} else {
}
} }
} }
@ -187,26 +206,38 @@ public class Jeu {
connaissances_action_reussite.add(reussite_connaissance); connaissances_action_reussite.add(reussite_connaissance);
List<Description> action_reussite_descriptions = new ArrayList<>();
action_reussite_descriptions.add(new Description(
"Wsh jveux réussir, rwwwwwit *TOCC* NOICE",
vraie));
Action action_reussite = new Action( Action action_reussite = new Action(
vraie, vraie,
connaissances_action_reussite, connaissances_action_reussite,
new ArrayList<>(), new ArrayList<>(),
new ArrayList<>(), new ArrayList<>(),
vraie, vraie,
new ArrayList<>()); action_reussite_descriptions);
sphinx_interaction_actions.add(action_reussite); sphinx_interaction_actions.add(action_reussite);
List<Objet> objets_action_echec = new ArrayList<>(); List<Objet> objets_action_echec = new ArrayList<>();
objets_action_echec.add(tentative_objet); objets_action_echec.add(tentative_objet);
List<Description> action_echec_descriptions = new ArrayList<>();
action_echec_descriptions.add(new Description(
"Vive la défaite ! dommage (PS: JSON c B1 hein) :)",
vraie));
Action action_echec = new Action( Action action_echec = new Action(
vraie, vraie,
new ArrayList<>(), new ArrayList<>(),
new ArrayList<>(), new ArrayList<>(),
objets_action_echec, objets_action_echec,
vraie, vraie,
new ArrayList<>()); action_echec_descriptions);
sphinx_interaction_actions.add(action_echec); sphinx_interaction_actions.add(action_echec);
Interaction sphinx_interaction = new Interaction( Interaction sphinx_interaction = new Interaction(