diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/esieequest/model/Game.java | 3 | ||||
-rw-r--r-- | src/esieequest/model/map/HiddenDoor.java | 14 | ||||
-rw-r--r-- | src/esieequest/model/map/Room.java | 9 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/esieequest/model/Game.java b/src/esieequest/model/Game.java index 0ff4b92..8de81b2 100644 --- a/src/esieequest/model/Game.java +++ b/src/esieequest/model/Game.java | |||
@@ -7,6 +7,7 @@ import esieequest.model.items.Beamer; | |||
7 | import esieequest.model.items.Item; | 7 | import esieequest.model.items.Item; |
8 | import esieequest.model.items.KeyCard; | 8 | import esieequest.model.items.KeyCard; |
9 | import esieequest.model.map.Door; | 9 | import esieequest.model.map.Door; |
10 | import esieequest.model.map.HiddenDoor; | ||
10 | import esieequest.model.map.LockedDoor; | 11 | import esieequest.model.map.LockedDoor; |
11 | import esieequest.model.map.Room; | 12 | import esieequest.model.map.Room; |
12 | import esieequest.model.map.TrapDoor; | 13 | import esieequest.model.map.TrapDoor; |
@@ -179,7 +180,7 @@ public class Game { | |||
179 | this.setRoomExit("WingCorridorTwoOffice", "east", "WingOffice"); | 180 | this.setRoomExit("WingCorridorTwoOffice", "east", "WingOffice"); |
180 | this.setRoomExit("WingOffice", "west", "WingCorridorTwoOffice"); | 181 | this.setRoomExit("WingOffice", "west", "WingCorridorTwoOffice"); |
181 | 182 | ||
182 | this.rooms.get("WingCorridorOne").addExit("east", new Door(this.rooms.get("OffscriptItems"))); | 183 | this.rooms.get("WingCorridorOne").addExit("east", new HiddenDoor(this.rooms.get("OffscriptItems"))); |
183 | // this.rooms.get("WingCorridorOne").addExit("east", new | 184 | // this.rooms.get("WingCorridorOne").addExit("east", new |
184 | // TrapDoor(this.rooms.get("OffscriptItems"))); | 185 | // TrapDoor(this.rooms.get("OffscriptItems"))); |
185 | 186 | ||
diff --git a/src/esieequest/model/map/HiddenDoor.java b/src/esieequest/model/map/HiddenDoor.java new file mode 100644 index 0000000..243e09d --- /dev/null +++ b/src/esieequest/model/map/HiddenDoor.java | |||
@@ -0,0 +1,14 @@ | |||
1 | package esieequest.model.map; | ||
2 | |||
3 | /** | ||
4 | * A hidden door that is not shown. | ||
5 | * | ||
6 | * @author Pacien TRAN-GIRARD | ||
7 | */ | ||
8 | public class HiddenDoor extends Door { | ||
9 | |||
10 | public HiddenDoor(final Room destination) { | ||
11 | super(destination); | ||
12 | } | ||
13 | |||
14 | } | ||
diff --git a/src/esieequest/model/map/Room.java b/src/esieequest/model/map/Room.java index b39413d..421e781 100644 --- a/src/esieequest/model/map/Room.java +++ b/src/esieequest/model/map/Room.java | |||
@@ -1,6 +1,7 @@ | |||
1 | package esieequest.model.map; | 1 | package esieequest.model.map; |
2 | 2 | ||
3 | import java.util.HashMap; | 3 | import java.util.HashMap; |
4 | import java.util.HashSet; | ||
4 | 5 | ||
5 | import esieequest.controller.Utils; | 6 | import esieequest.controller.Utils; |
6 | import esieequest.model.items.Inventory; | 7 | import esieequest.model.items.Inventory; |
@@ -84,7 +85,13 @@ public class Room { | |||
84 | * @return the list of the available exits | 85 | * @return the list of the available exits |
85 | */ | 86 | */ |
86 | private String listExits() { | 87 | private String listExits() { |
87 | return Utils.list(this.exits.keySet(), "Available exits:", "This room has no exit."); | 88 | final HashSet<String> exits = new HashSet<String>(); |
89 | for (final String exit : this.exits.keySet()) { | ||
90 | if (this.exits.get(exit).getClass() != HiddenDoor.class) { | ||
91 | exits.add(exit); | ||
92 | } | ||
93 | } | ||
94 | return Utils.list(exits, "Available exits:", "This room has no exit."); | ||
88 | } | 95 | } |
89 | 96 | ||
90 | /** | 97 | /** |