diff options
author | Pacien TRAN-GIRARD | 2014-04-16 16:14:27 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-04-16 16:14:27 +0200 |
commit | 1d45aca5c1a9213a5c2ec5f29bb07650d1e2f341 (patch) | |
tree | 4496e3cbb09aa5c625c3e2a3b5fca02d8fe1eeec | |
parent | c5a7663453f6d67c2f4aa88a0e9756b6f24997d5 (diff) | |
download | esieequest-1d45aca5c1a9213a5c2ec5f29bb07650d1e2f341.tar.gz |
Modify map to create an off-script sub-quest
-rw-r--r-- | src/esieequest/controller/Performer.java | 2 | ||||
-rw-r--r-- | src/esieequest/model/Game.java | 81 |
2 files changed, 28 insertions, 55 deletions
diff --git a/src/esieequest/controller/Performer.java b/src/esieequest/controller/Performer.java index eb1cf9a..59a3973 100644 --- a/src/esieequest/controller/Performer.java +++ b/src/esieequest/controller/Performer.java | |||
@@ -180,7 +180,7 @@ class Performer { | |||
180 | weight += this.game.getPlayer().getCurrentRoom().getItems().getItemWeight(itemName); | 180 | weight += this.game.getPlayer().getCurrentRoom().getItems().getItemWeight(itemName); |
181 | final int maxWeight = this.game.getPlayer().getMaxCarryWeight(); | 181 | final int maxWeight = this.game.getPlayer().getMaxCarryWeight(); |
182 | 182 | ||
183 | if (weight >= maxWeight) { | 183 | if (weight > maxWeight) { |
184 | this.echo("Maximum inventory weight reached. Cannot pick up item."); | 184 | this.echo("Maximum inventory weight reached. Cannot pick up item."); |
185 | return; | 185 | return; |
186 | } | 186 | } |
diff --git a/src/esieequest/model/Game.java b/src/esieequest/model/Game.java index 68dc1c2..e5e3b56 100644 --- a/src/esieequest/model/Game.java +++ b/src/esieequest/model/Game.java | |||
@@ -94,22 +94,13 @@ public class Game { | |||
94 | this.createRoom("WingOffice", "in the office #3254"); | 94 | this.createRoom("WingOffice", "in the office #3254"); |
95 | 95 | ||
96 | // off-script rooms | 96 | // off-script rooms |
97 | this.createRoom("OffscriptItems", "somewhere implementing weight"); | 97 | this.createRoom("Secret corridor 1", "in a secret corridor"); |
98 | this.createRoom("OffscriptItemsStorageroom", "in a storage room"); | 98 | this.createRoom("Secret corridor 2", "at the end of a secret corridor"); |
99 | this.createRoom("Storage room", "in a storage room"); | ||
100 | this.createRoom("Secret lab", "in a secret lab"); | ||
101 | this.createRoom("Dead-end", "in a dead end"); | ||
102 | this.createRoom("Locked room", "in a locked room"); | ||
99 | 103 | ||
100 | this.createRoom("OffscriptTeleportation", "somewhere implementing teleportation"); | ||
101 | this.createRoom("OffscriptTeleportationBeamerroom", "on a checkpoint"); | ||
102 | |||
103 | this.createRoom("OffscriptTrap", "somewhere implementing a trap"); | ||
104 | this.createRoom("OffscriptTrapDeadend", "in a dead end"); | ||
105 | |||
106 | this.createRoom("OffscriptLock", "somewhere implementing a lock"); | ||
107 | this.createRoom("OffscriptLockLockedroom", "in a locked room"); | ||
108 | |||
109 | this.createRoom("OffscriptAlea", "somewhere implementing alea"); | ||
110 | |||
111 | this.createRoom("OffscriptMovingcharacter", "somewhere implementing a moving character"); | ||
112 | this.createRoom("OffscriptMovingcharacterSumobotroom", "in the Chirac-101's room"); | ||
113 | } | 104 | } |
114 | 105 | ||
115 | /** | 106 | /** |
@@ -180,55 +171,37 @@ public class Game { | |||
180 | this.setRoomExit("WingCorridorTwoOffice", "south", "WingCorridorTwo"); | 171 | this.setRoomExit("WingCorridorTwoOffice", "south", "WingCorridorTwo"); |
181 | this.setRoomExit("WingCorridorTwoOffice", "east", "WingOffice"); | 172 | this.setRoomExit("WingCorridorTwoOffice", "east", "WingOffice"); |
182 | this.setRoomExit("WingOffice", "west", "WingCorridorTwoOffice"); | 173 | this.setRoomExit("WingOffice", "west", "WingCorridorTwoOffice"); |
174 | this.rooms.get("WingCorridorOne").addExit("east", new HiddenDoor(this.rooms.get("Secret corridor 1"))); | ||
175 | |||
176 | this.setRoomExit("Secret corridor 1", "west", "WingCorridorOne"); | ||
177 | this.setRoomExit("Secret corridor 1", "east", "Secret corridor 2"); | ||
178 | this.setRoomExit("Secret corridor 2", "west", "Secret corridor 1"); | ||
179 | |||
180 | this.setRoomExit("Secret corridor 1", "north", "Storage room"); | ||
181 | this.setRoomExit("Storage room", "south", "Secret corridor 1"); | ||
182 | this.setRoomExit("Secret corridor 1", "south", "Secret lab"); | ||
183 | this.setRoomExit("Secret lab", "north", "Secret corridor 1"); | ||
183 | 184 | ||
184 | this.rooms.get("WingCorridorOne").addExit("east", new HiddenDoor(this.rooms.get("OffscriptItems"))); | 185 | this.rooms.get("Secret corridor 2").addExit("north", new TrapDoor(this.rooms.get("Dead-end"))); |
185 | // this.rooms.get("WingCorridorOne").addExit("east", new | 186 | this.rooms.get("Secret corridor 2").addExit("south", new LockedDoor(this.rooms.get("Locked room"))); |
186 | // TrapDoor(this.rooms.get("OffscriptItems"))); | 187 | this.rooms.get("Locked room").addExit("north", new LockedDoor(this.rooms.get("Secret corridor 2"))); |
187 | 188 | this.rooms.get("Secret corridor 2").addExit("east", new TransporterDoor(new HashSet<Room>(this.rooms.values()))); | |
188 | this.setRoomExit("OffscriptItems", "north", "OffscriptItemsStorageroom"); | ||
189 | this.setRoomExit("OffscriptItems", "east", "OffscriptTeleportation"); | ||
190 | this.setRoomExit("OffscriptItemsStorageroom", "south", "OffscriptItems"); | ||
191 | this.setRoomExit("OffscriptTeleportation", "north", "OffscriptTeleportationBeamerroom"); | ||
192 | this.setRoomExit("OffscriptTeleportation", "west", "OffscriptItems"); | ||
193 | this.setRoomExit("OffscriptTeleportation", "east", "OffscriptTrap"); | ||
194 | this.setRoomExit("OffscriptTeleportationBeamerroom", "south", "OffscriptTeleportation"); | ||
195 | // this.setRoomExit("OffscriptTrap", "north", "OffscriptTrapDeadend"); | ||
196 | this.rooms.get("OffscriptTrap").addExit("north", new TrapDoor(this.rooms.get("OffscriptTrapDeadend"))); | ||
197 | this.setRoomExit("OffscriptTrap", "west", "OffscriptTeleportation"); | ||
198 | this.setRoomExit("OffscriptTrap", "east", "OffscriptLock"); | ||
199 | // this.setRoomExit("OffscriptTrapDeadend", "south", "OffscriptTrap"); | ||
200 | // this.setRoomExit("OffscriptLock", "north", "OffscriptLockedroom"); | ||
201 | this.rooms.get("OffscriptLock").addExit("north", new LockedDoor(this.rooms.get("OffscriptLockLockedroom"))); | ||
202 | this.setRoomExit("OffscriptLock", "west", "OffscriptTrap"); | ||
203 | this.setRoomExit("OffscriptLock", "east", "OffscriptAlea"); | ||
204 | // this.setRoomExit("OffscriptLockedroom", "south", "OffscriptLock"); | ||
205 | this.rooms.get("OffscriptLockLockedroom").addExit("south", new LockedDoor(this.rooms.get("OffscriptLock"))); | ||
206 | // this.setRoomExit("OffscriptAlea", "north", | ||
207 | // "OffscriptAleaRandomizingroom"); | ||
208 | this.rooms.get("OffscriptAlea").addExit("north", new TransporterDoor(new HashSet<Room>(this.rooms.values()))); | ||
209 | this.setRoomExit("OffscriptAlea", "west", "OffscriptTeleportation"); | ||
210 | this.setRoomExit("OffscriptAlea", "east", "OffscriptMovingcharacter"); | ||
211 | this.setRoomExit("OffscriptMovingcharacter", "north", "OffscriptMovingcharacterSumobotroom"); | ||
212 | this.setRoomExit("OffscriptMovingcharacter", "west", "OffscriptAlea"); | ||
213 | this.setRoomExit("OffscriptMovingcharacterSumobotroom", "south", "OffscriptMovingcharacter"); | ||
214 | } | 189 | } |
215 | 190 | ||
216 | /** | 191 | /** |
217 | * Creates and adds items into rooms. | 192 | * Creates and adds items into rooms. |
218 | */ | 193 | */ |
219 | private void createItems() { | 194 | private void createItems() { |
220 | this.rooms.get("OffscriptItemsStorageroom").getItems().putItem("Weighted Storage Cube", new Item("A Weighted Storage Cube.", 5, true)); | 195 | this.rooms.get("Storage room").getItems().putItem("Weighted Storage Cube", new Item("A Weighted Storage Cube.", 5, true)); |
221 | this.rooms.get("OffscriptItemsStorageroom").getItems().putItem("Edgeless Safety Cube", new Item("An Edgeless Safety Cube.", 5, true)); | 196 | this.rooms.get("Storage room").getItems().putItem("Edgeless Safety Cube", new Item("An Edgeless Safety Cube.", 5, true)); |
222 | this.rooms.get("OffscriptItemsStorageroom").getItems().putItem("Portable Black-hole", new Item("A portable black-hole that has a negative mass.", -10, true)); | 197 | this.rooms.get("Storage room").getItems().putItem("Portable Black-hole", new Item("A portable black-hole that has a negative mass.", -10, false)); |
223 | 198 | ||
224 | this.rooms.get("OffscriptTeleportationBeamerroom").getItems().putItem("Portable Quantum Tunneling Device", new Beamer("Basically a teleporter.")); | 199 | this.rooms.get("Secret lab").getItems().putItem("Portable Quantum Tunneling Device", new Beamer("Basically a teleporter.")); |
225 | 200 | ||
226 | final KeyCard keyCard = new KeyCard("A KeyCard that opens a locked door."); | 201 | final KeyCard keyCard = new KeyCard("A KeyCard that opens a locked door."); |
227 | final LockedDoor lockedDoorLock = (LockedDoor) this.rooms.get("OffscriptLock").getExit("north"); | 202 | ((LockedDoor) this.rooms.get("Secret corridor 2").getExit("south")).setKey(keyCard); |
228 | lockedDoorLock.setKey(keyCard); | 203 | ((LockedDoor) this.rooms.get("Locked room").getExit("north")).setKey(keyCard); |
229 | final LockedDoor lockedDoorLockedRoom = (LockedDoor) this.rooms.get("OffscriptLockLockedroom").getExit("south"); | 204 | this.rooms.get("Dead-end").getItems().putItem("KeyCard", keyCard); |
230 | lockedDoorLockedRoom.setKey(keyCard); | ||
231 | this.rooms.get("OffscriptLock").getItems().putItem("KeyCard", keyCard); | ||
232 | } | 205 | } |
233 | 206 | ||
234 | /** | 207 | /** |