diff --git a/runtime-workspace/fr.n7.game.examples/enigmeLibre.game b/runtime-workspace/fr.n7.game.examples/enigmeLibre.game
new file mode 100644
index 0000000..15fb4f3
--- /dev/null
+++ b/runtime-workspace/fr.n7.game.examples/enigmeLibre.game
@@ -0,0 +1,158 @@
+Objets:
+ - tentative:
+ taille: 1
+ visible: true
+ descriptions:
+ - Description1:
+ texte: "permet repondre une question du sphinx"
+ condition: true
+
+Transformations:
+
+Connaissances:
+ - Reussite:
+ visible: true
+ descriptions:
+ - Description1:
+ texte: "Permet de se casser de la"
+ condition: true
+
+Explorateur:
+ taille: 3
+ connaissances:
+ objets:
+ - tentative
+ - tentative
+ - tentative
+
+Personnes:
+ - Sphinx:
+ visible: ! Reussite && tentative > 0
+ obligatoire: false
+ interactions:
+ - Parler:
+ visible: true
+ connaissances:
+ objets_recus:
+ objets_conso:
+ actions:
+ - Reponse_1:
+ visible: true
+ fin_interaction: true
+ connaissances:
+ - Reussite
+ objets_recus:
+ objets_conso:
+ descriptions:
+ - Description1:
+ texte: "la bonne reponse"
+ condition: true
+
+ - Reponse_2:
+ visible: true
+ fin_interaction: true
+ connaissances:
+ objets_recus:
+ objets_conso:
+ - tentative
+ descriptions:
+ - Description1:
+ texte: "la mauvaise reponse"
+ condition: true
+ - Combattre:
+ visible: true
+ connaissances:
+ objets_recus:
+ objets_conso:
+ actions:
+ - Action_1:
+ visible: true
+ fin_interaction: true
+ connaissances:
+ - Reussite
+ objets_recus:
+ objets_conso:
+ descriptions:
+ - Description1:
+ texte: "la bonne reponse"
+ condition: true
+
+ - Action_2:
+ visible: true
+ fin_interaction: true
+ connaissances:
+ objets_recus:
+ objets_conso:
+ - tentative
+ descriptions:
+ - Description1:
+ texte: "la mauvaise reponse"
+ condition: true
+
+Territoire:
+ Lieux:
+ - Enigme:
+ deposable: true
+ depart: true
+ fin: false
+ personnes:
+ - Sphinx
+ descriptions:
+ - Description1:
+ texte: "lieu de depart"
+ condition: true
+ objets:
+ connaissances:
+
+ - Succes:
+ deposable: false
+ depart: false
+ fin: true
+ personnes:
+ descriptions:
+ - Description1:
+ texte: "lieu succes"
+ condition: true
+ objets:
+ connaissances:
+
+ - Echec:
+ deposable: false
+ depart: false
+ fin: true
+ personnes:
+ descriptions:
+ - Description1:
+ texte: "lieu echec"
+ condition: true
+ objets:
+ connaissances:
+
+ Chemins:
+ - Win:
+ lieu_in: Enigme
+ lieu_out: Succes
+ ouvert: true
+ visible: Reussite
+ obligatoire: false
+ connaissances:
+ objets_recus:
+ objets_conso:
+ descriptions:
+ - Description1:
+ texte: "Le chemin de la victoire !"
+ condition: true
+
+ - Loose:
+ lieu_in: Enigme
+ lieu_out: Echec
+ ouvert: true
+ visible: tentative == 0
+ obligatoire: false
+ connaissances:
+ objets_recus:
+ objets_conso:
+ descriptions:
+ - Description1:
+ texte: "Le chemin de la loose !"
+ condition: true
diff --git a/runtime-workspace/fr.n7.game.examples/src-gen/Chemin.java b/runtime-workspace/fr.n7.game.examples/src-gen/Chemin.java
index 9702699..1b960dc 100644
--- a/runtime-workspace/fr.n7.game.examples/src-gen/Chemin.java
+++ b/runtime-workspace/fr.n7.game.examples/src-gen/Chemin.java
@@ -45,4 +45,19 @@ public class Chemin {
}
return "No desc";
}
+
+ public Lieu emprunter() {
+ for (Objet o : this.objetsRecus) {
+ Jeu.explorateur.objets.add(o);
+ }
+ for (Objet o : this.objetsConso) {
+ Jeu.explorateur.objets.remove(o);
+ }
+ for (Connaissance c : this.connaissancesRecus) {
+ if (!Jeu.explorateur.connaissances.contains(c)) {
+ Jeu.explorateur.connaissances.add(c);
+ }
+ }
+ return this.lieuOut;
+ }
}
diff --git a/runtime-workspace/fr.n7.game.examples/src-gen/Explorateur.java b/runtime-workspace/fr.n7.game.examples/src-gen/Explorateur.java
index 7a58a88..b4679a8 100644
--- a/runtime-workspace/fr.n7.game.examples/src-gen/Explorateur.java
+++ b/runtime-workspace/fr.n7.game.examples/src-gen/Explorateur.java
@@ -16,16 +16,7 @@ public class Explorateur {
@Override
public String toString() {
- String txt = "Objets :\n";
- for (Objet c : this.objets) {
- txt += c + " ";
- }
- txt += "\n\nConnaissances :\n";
- for (Connaissance c : this.connaissances) {
- txt += c + " ";
- }
- txt += "\n===================================================";
- return txt;
+ return "\tObjets : " + this.objets + "\n\tConnaissances : " + this.connaissances;
}
}
diff --git a/runtime-workspace/fr.n7.game.examples/src-gen/Interaction.java b/runtime-workspace/fr.n7.game.examples/src-gen/Interaction.java
index 4e059f9..af17beb 100644
--- a/runtime-workspace/fr.n7.game.examples/src-gen/Interaction.java
+++ b/runtime-workspace/fr.n7.game.examples/src-gen/Interaction.java
@@ -25,9 +25,20 @@ public class Interaction {
}
void interragir(BufferedReader reader, Lieu lieu) {
- boolean arreter_interraction = false;
- while (!arreter_interraction) {
+ for (Objet o : this.objetsRecus) {
+ Jeu.explorateur.objets.add(o);
+ }
+ for (Objet o : this.objetsConso) {
+ Jeu.explorateur.objets.remove(o);
+ }
+ for (Connaissance c : this.connaissances) {
+ if (!Jeu.explorateur.connaissances.contains(c)) {
+ Jeu.explorateur.connaissances.add(c);
+ }
+ }
+
+ while (true) {
System.out.println(this);
System.out.print("\nChoix : ");
@@ -37,21 +48,20 @@ public class Interaction {
actions_choix.add(a);
}
}
+
int choix = 0;
Action a = null;
try {
choix = Integer.parseInt(reader.readLine());
a = actions_choix.get(choix);
- } catch (NumberFormatException e) {
+ } catch (Exception e) {
continue;
- } catch (IndexOutOfBoundsException e) {
- continue;
- } catch (IOException e) {
- e.printStackTrace();
}
+
a.actionner();
- arreter_interraction = a.finInterraction.evaluer();
+ if (a.finInterraction.evaluer())
+ break;
}
}
diff --git a/runtime-workspace/fr.n7.game.examples/src-gen/Jeu.java b/runtime-workspace/fr.n7.game.examples/src-gen/Jeu.java
index c2a5fe3..70d5170 100644
--- a/runtime-workspace/fr.n7.game.examples/src-gen/Jeu.java
+++ b/runtime-workspace/fr.n7.game.examples/src-gen/Jeu.java
@@ -12,6 +12,9 @@ public class Jeu {
List