aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/esieequest/model/Game.java15
-rw-r--r--src/esieequest/model/Text.java10
-rw-r--r--src/esieequest/model/characters/Athanase.java38
-rw-r--r--src/esieequest/model/characters/Character.java4
-rw-r--r--src/esieequest/model/items/Item.java8
-rw-r--r--src/esieequest/model/items/Note.java34
-rw-r--r--src/esieequest/model/items/Transponder.java25
7 files changed, 130 insertions, 4 deletions
diff --git a/src/esieequest/model/Game.java b/src/esieequest/model/Game.java
index bdcc698..9b572e7 100644
--- a/src/esieequest/model/Game.java
+++ b/src/esieequest/model/Game.java
@@ -158,6 +158,8 @@ public class Game implements SerialisableObject {
158 * Adds Item-s in the map. 158 * Adds Item-s in the map.
159 */ 159 */
160 public void addItems() { 160 public void addItems() {
161
162 // secret corridor
161 this.i(Room.STORAGE_ROOM, Direction.WEST, Item.STORAGE_CUBE); 163 this.i(Room.STORAGE_ROOM, Direction.WEST, Item.STORAGE_CUBE);
162 this.i(Room.STORAGE_ROOM, Direction.EAST, Item.SAFETY_CUBE); 164 this.i(Room.STORAGE_ROOM, Direction.EAST, Item.SAFETY_CUBE);
163 this.i(Room.STORAGE_ROOM, Direction.NORTH, Item.BLACK_HOLE); 165 this.i(Room.STORAGE_ROOM, Direction.NORTH, Item.BLACK_HOLE);
@@ -165,6 +167,13 @@ public class Game implements SerialisableObject {
165 this.i(Room.SECRET_LAB, Direction.SOUTH, Item.BEAMER); 167 this.i(Room.SECRET_LAB, Direction.SOUTH, Item.BEAMER);
166 168
167 this.i(Room.DEAD_END, Direction.NORTH, Item.KEYCARD); 169 this.i(Room.DEAD_END, Direction.NORTH, Item.KEYCARD);
170
171 // scenario
172 this.i(Room.AMPHITHEATER_STAGE, Direction.SOUTH, Item.NOTE);
173 this.i(Room.CAFETERIA, Direction.WEST, Item.BANANA);
174 this.i(Room.ESIEESPACE, Direction.NORTH, Item.TRANSPONDER);
175 this.i(Room.CLUBNIX, Direction.NORTH, Item.DISK);
176
168 } 177 }
169 178
170 /** 179 /**
@@ -185,7 +194,13 @@ public class Game implements SerialisableObject {
185 * Adds Character-s to the map. 194 * Adds Character-s to the map.
186 */ 195 */
187 public void addCharacters() { 196 public void addCharacters() {
197
198 // secret corridor
188 this.c(Room.LOCKED_ROOM, Direction.SOUTH, Character.SUMOBOT); 199 this.c(Room.LOCKED_ROOM, Direction.SOUTH, Character.SUMOBOT);
200
201 // scenario
202 this.c(Room.WING_OFFICE, Direction.EAST, Character.ATHANASE);
203
189 } 204 }
190 205
191 /** 206 /**
diff --git a/src/esieequest/model/Text.java b/src/esieequest/model/Text.java
index d46b4b1..84253b3 100644
--- a/src/esieequest/model/Text.java
+++ b/src/esieequest/model/Text.java
@@ -20,11 +20,15 @@ public enum Text {
20 NO_DOOR("There is no door."), 20 NO_DOOR("There is no door."),
21 DOOR_LOCKED("This door is locked."), 21 DOOR_LOCKED("This door is locked."),
22 INVENTORY_FULL("Cannot pick up item: the maximum inventory weight has been reached."), 22 INVENTORY_FULL("Cannot pick up item: the maximum inventory weight has been reached."),
23 ROOM_INVENTORY_FULL("Cannot drop this item here: the room is full."), 23 INVENTORY_EMPTY("Your inventory is empty."),
24 24
25 BEAMER_ROOM_MEMORISED("The coordinates of the current location have been memorised: "), 25 BEAMER_ROOM_MEMORISED("The coordinates of the current location have been memorised: "),
26 BEAMER_TELEPORTED("Zap! You have reached your destination. The device's memory has been cleared."), 26 BEAMER_TELEPORTED("Zap! You have reached your destination. The device's memory has been cleared."),
27 27
28 // objects
29 NOTE_PREFIX("It is written: "),
30 NOTE_ATHANASE("In case of logical trouble: find Athanase, office #3254."),
31
28 // lists 32 // lists
29 HELP_PREFIX("Available commands: "), 33 HELP_PREFIX("Available commands: "),
30 HELP_SUFFIX("."), 34 HELP_SUFFIX("."),
@@ -52,9 +56,7 @@ public enum Text {
52 56
53 INVENTORY_WEIGHT_PREFIX("Total inventory weight: "), 57 INVENTORY_WEIGHT_PREFIX("Total inventory weight: "),
54 INVENTORY_WEIGHT_SUFFIX("."), 58 INVENTORY_WEIGHT_SUFFIX("."),
55 59
56 INVENTORY_EMPTY("Your inventory is empty."),
57
58 // formatting 60 // formatting
59 LIST_SEPARATOR(", "), 61 LIST_SEPARATOR(", "),
60 NEW_LINE("\n"), 62 NEW_LINE("\n"),
diff --git a/src/esieequest/model/characters/Athanase.java b/src/esieequest/model/characters/Athanase.java
new file mode 100644
index 0000000..b4527c8
--- /dev/null
+++ b/src/esieequest/model/characters/Athanase.java
@@ -0,0 +1,38 @@
1package esieequest.model.characters;
2
3import net.pacien.util.CleanJSONObject;
4
5import org.json.simple.JSONObject;
6
7/**
8 * Athanase the mathgorilla.
9 *
10 * @author Pacien TRAN-GIRARD
11 */
12public class Athanase extends SimpleCharacter {
13
14 /**
15 * Creates Athanase.
16 */
17 public Athanase() {
18 super("Athanase");
19 }
20
21 @Override
22 public String talk() {
23 // TODO: require items
24 return "Who are you? Where did Leila go? I'm so hungry...";
25 }
26
27 @Override
28 public JSONObject serialise() {
29 // TODO: save state (received items)
30 return new CleanJSONObject();
31 }
32
33 @Override
34 public void deserialise(final JSONObject o) {
35 return;
36 }
37
38}
diff --git a/src/esieequest/model/characters/Character.java b/src/esieequest/model/characters/Character.java
index 9af68b0..c46c5bf 100644
--- a/src/esieequest/model/characters/Character.java
+++ b/src/esieequest/model/characters/Character.java
@@ -12,8 +12,12 @@ public enum Character implements SerialisableObject {
12 12
13 // @formatter:off 13 // @formatter:off
14 14
15 // secret corridor
15 SUMOBOT(new Sumobot(Room.LOCKED_ROOM, Direction.SOUTH)), 16 SUMOBOT(new Sumobot(Room.LOCKED_ROOM, Direction.SOUTH)),
16 17
18 // scenario
19 ATHANASE(new Athanase());
20
17 ; 21 ;
18 22
19 // @formatter:on 23 // @formatter:on
diff --git a/src/esieequest/model/items/Item.java b/src/esieequest/model/items/Item.java
index be70c2e..a3c4f8f 100644
--- a/src/esieequest/model/items/Item.java
+++ b/src/esieequest/model/items/Item.java
@@ -8,12 +8,14 @@ import org.json.simple.JSONObject;
8import esieequest.controller.utils.EnumUtils; 8import esieequest.controller.utils.EnumUtils;
9import esieequest.controller.utils.SerialisableObject; 9import esieequest.controller.utils.SerialisableObject;
10import esieequest.model.Game; 10import esieequest.model.Game;
11import esieequest.model.Text;
11import esieequest.view.Viewable; 12import esieequest.view.Viewable;
12 13
13public enum Item implements Mappable<String>, SerialisableObject { 14public enum Item implements Mappable<String>, SerialisableObject {
14 15
15 // @formatter:off 16 // @formatter:off
16 17
18 // secret corridor
17 STORAGE_CUBE(new SimpleItem("Weighted Storage Cube", 5, true)), 19 STORAGE_CUBE(new SimpleItem("Weighted Storage Cube", 5, true)),
18 SAFETY_CUBE(new SimpleItem("Edgeless Safety Cube", 5, true)), 20 SAFETY_CUBE(new SimpleItem("Edgeless Safety Cube", 5, true)),
19 BLACK_HOLE(new SimpleItem("Portable black-hole", -10, false)), 21 BLACK_HOLE(new SimpleItem("Portable black-hole", -10, false)),
@@ -22,6 +24,12 @@ public enum Item implements Mappable<String>, SerialisableObject {
22 24
23 BEAMER(new Beamer("Beamer")), 25 BEAMER(new Beamer("Beamer")),
24 26
27 // scenario
28 NOTE(new Note("Note", Text.NOTE_ATHANASE.getText())),
29 BANANA(new SimpleItem("Banana", 0, false)),
30 TRANSPONDER(new Transponder()),
31 DISK(new SimpleItem("Bootloader disk", 0, false)),
32
25 ; 33 ;
26 34
27 // @formatter:on 35 // @formatter:on
diff --git a/src/esieequest/model/items/Note.java b/src/esieequest/model/items/Note.java
new file mode 100644
index 0000000..aac5cea
--- /dev/null
+++ b/src/esieequest/model/items/Note.java
@@ -0,0 +1,34 @@
1package esieequest.model.items;
2
3import esieequest.model.Game;
4import esieequest.model.Text;
5import esieequest.view.Viewable;
6
7/**
8 * A note.
9 *
10 * @author Pacien TRAN-GIRARD
11 */
12public class Note extends SimpleItem {
13
14 private final String text;
15
16 /**
17 * Creates a note with a name and a text.
18 *
19 * @param name
20 * the name
21 * @param text
22 * the content of the note
23 */
24 public Note(final String name, final String text) {
25 super(name, 0, false);
26 this.text = text;
27 }
28
29 @Override
30 public void use(final Game game, final Viewable view) {
31 view.echo(Text.NOTE_PREFIX.getText() + this.text);
32 }
33
34}
diff --git a/src/esieequest/model/items/Transponder.java b/src/esieequest/model/items/Transponder.java
new file mode 100644
index 0000000..7ed7ecc
--- /dev/null
+++ b/src/esieequest/model/items/Transponder.java
@@ -0,0 +1,25 @@
1package esieequest.model.items;
2
3import esieequest.model.Game;
4import esieequest.view.Viewable;
5