aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-04-16 01:02:22 +0200
committerPacien TRAN-GIRARD2014-04-16 01:02:22 +0200
commit20c9b8b28655f0e81e05ef854e605e809b396977 (patch)
treeb5e997bbed7a6023d75040a2089ff1c1acdf0519
parent72334d8f1ac5310b82923401170f6099d24f9f6c (diff)
downloadesieequest-20c9b8b28655f0e81e05ef854e605e809b396977.tar.gz
Implement HiddenDoor
-rw-r--r--src/esieequest/model/Game.java3
-rw-r--r--src/esieequest/model/map/HiddenDoor.java14
-rw-r--r--src/esieequest/model/map/Room.java9
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;
7import esieequest.model.items.Item; 7import esieequest.model.items.Item;
8import esieequest.model.items.KeyCard; 8import esieequest.model.items.KeyCard;
9import esieequest.model.map.Door; 9import esieequest.model.map.Door;
10import esieequest.model.map.HiddenDoor;
10import esieequest.model.map.LockedDoor; 11import esieequest.model.map.LockedDoor;
11import esieequest.model.map.Room; 12import esieequest.model.map.Room;
12import esieequest.model.map.TrapDoor; 13import 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 @@
1package esieequest.model.map;
2
3/**
4 * A hidden door that is not shown.
5 *
6 * @author Pacien TRAN-GIRARD
7 */
8public 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 @@
1package esieequest.model.map; 1package esieequest.model.map;
2 2
3import java.util.HashMap; 3import java.util.HashMap;
4import java.util.HashSet;
4 5
5import esieequest.controller.Utils; 6import esieequest.controller.Utils;
6import esieequest.model.items.Inventory; 7import 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 /**