From 1d45aca5c1a9213a5c2ec5f29bb07650d1e2f341 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Wed, 16 Apr 2014 16:14:27 +0200 Subject: Modify map to create an off-script sub-quest --- src/esieequest/controller/Performer.java | 2 +- 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 { weight += this.game.getPlayer().getCurrentRoom().getItems().getItemWeight(itemName); final int maxWeight = this.game.getPlayer().getMaxCarryWeight(); - if (weight >= maxWeight) { + if (weight > maxWeight) { this.echo("Maximum inventory weight reached. Cannot pick up item."); return; } 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 { this.createRoom("WingOffice", "in the office #3254"); // off-script rooms - this.createRoom("OffscriptItems", "somewhere implementing weight"); - this.createRoom("OffscriptItemsStorageroom", "in a storage room"); + this.createRoom("Secret corridor 1", "in a secret corridor"); + this.createRoom("Secret corridor 2", "at the end of a secret corridor"); + this.createRoom("Storage room", "in a storage room"); + this.createRoom("Secret lab", "in a secret lab"); + this.createRoom("Dead-end", "in a dead end"); + this.createRoom("Locked room", "in a locked room"); - this.createRoom("OffscriptTeleportation", "somewhere implementing teleportation"); - this.createRoom("OffscriptTeleportationBeamerroom", "on a checkpoint"); - - this.createRoom("OffscriptTrap", "somewhere implementing a trap"); - this.createRoom("OffscriptTrapDeadend", "in a dead end"); - - this.createRoom("OffscriptLock", "somewhere implementing a lock"); - this.createRoom("OffscriptLockLockedroom", "in a locked room"); - - this.createRoom("OffscriptAlea", "somewhere implementing alea"); - - this.createRoom("OffscriptMovingcharacter", "somewhere implementing a moving character"); - this.createRoom("OffscriptMovingcharacterSumobotroom", "in the Chirac-101's room"); } /** @@ -180,55 +171,37 @@ public class Game { this.setRoomExit("WingCorridorTwoOffice", "south", "WingCorridorTwo"); this.setRoomExit("WingCorridorTwoOffice", "east", "WingOffice"); this.setRoomExit("WingOffice", "west", "WingCorridorTwoOffice"); + this.rooms.get("WingCorridorOne").addExit("east", new HiddenDoor(this.rooms.get("Secret corridor 1"))); + + this.setRoomExit("Secret corridor 1", "west", "WingCorridorOne"); + this.setRoomExit("Secret corridor 1", "east", "Secret corridor 2"); + this.setRoomExit("Secret corridor 2", "west", "Secret corridor 1"); + + this.setRoomExit("Secret corridor 1", "north", "Storage room"); + this.setRoomExit("Storage room", "south", "Secret corridor 1"); + this.setRoomExit("Secret corridor 1", "south", "Secret lab"); + this.setRoomExit("Secret lab", "north", "Secret corridor 1"); - this.rooms.get("WingCorridorOne").addExit("east", new HiddenDoor(this.rooms.get("OffscriptItems"))); - // this.rooms.get("WingCorridorOne").addExit("east", new - // TrapDoor(this.rooms.get("OffscriptItems"))); - - this.setRoomExit("OffscriptItems", "north", "OffscriptItemsStorageroom"); - this.setRoomExit("OffscriptItems", "east", "OffscriptTeleportation"); - this.setRoomExit("OffscriptItemsStorageroom", "south", "OffscriptItems"); - this.setRoomExit("OffscriptTeleportation", "north", "OffscriptTeleportationBeamerroom"); - this.setRoomExit("OffscriptTeleportation", "west", "OffscriptItems"); - this.setRoomExit("OffscriptTeleportation", "east", "OffscriptTrap"); - this.setRoomExit("OffscriptTeleportationBeamerroom", "south", "OffscriptTeleportation"); - // this.setRoomExit("OffscriptTrap", "north", "OffscriptTrapDeadend"); - this.rooms.get("OffscriptTrap").addExit("north", new TrapDoor(this.rooms.get("OffscriptTrapDeadend"))); - this.setRoomExit("OffscriptTrap", "west", "OffscriptTeleportation"); - this.setRoomExit("OffscriptTrap", "east", "OffscriptLock"); - // this.setRoomExit("OffscriptTrapDeadend", "south", "OffscriptTrap"); - // this.setRoomExit("OffscriptLock", "north", "OffscriptLockedroom"); - this.rooms.get("OffscriptLock").addExit("north", new LockedDoor(this.rooms.get("OffscriptLockLockedroom"))); - this.setRoomExit("OffscriptLock", "west", "OffscriptTrap"); - this.setRoomExit("OffscriptLock", "east", "OffscriptAlea"); - // this.setRoomExit("OffscriptLockedroom", "south", "OffscriptLock"); - this.rooms.get("OffscriptLockLockedroom").addExit("south", new LockedDoor(this.rooms.get("OffscriptLock"))); - // this.setRoomExit("OffscriptAlea", "north", - // "OffscriptAleaRandomizingroom"); - this.rooms.get("OffscriptAlea").addExit("north", new TransporterDoor(new HashSet(this.rooms.values()))); - this.setRoomExit("OffscriptAlea", "west", "OffscriptTeleportation"); - this.setRoomExit("OffscriptAlea", "east", "OffscriptMovingcharacter"); - this.setRoomExit("OffscriptMovingcharacter", "north", "OffscriptMovingcharacterSumobotroom"); - this.setRoomExit("OffscriptMovingcharacter", "west", "OffscriptAlea"); - this.setRoomExit("OffscriptMovingcharacterSumobotroom", "south", "OffscriptMovingcharacter"); + this.rooms.get("Secret corridor 2").addExit("north", new TrapDoor(this.rooms.get("Dead-end"))); + this.rooms.get("Secret corridor 2").addExit("south", new LockedDoor(this.rooms.get("Locked room"))); + this.rooms.get("Locked room").addExit("north", new LockedDoor(this.rooms.get("Secret corridor 2"))); + this.rooms.get("Secret corridor 2").addExit("east", new TransporterDoor(new HashSet(this.rooms.values()))); } /** * Creates and adds items into rooms. */ private void createItems() { - this.rooms.get("OffscriptItemsStorageroom").getItems().putItem("Weighted Storage Cube", new Item("A Weighted Storage Cube.", 5, true)); - this.rooms.get("OffscriptItemsStorageroom").getItems().putItem("Edgeless Safety Cube", new Item("An Edgeless Safety Cube.", 5, true)); - this.rooms.get("OffscriptItemsStorageroom").getItems().putItem("Portable Black-hole", new Item("A portable black-hole that has a negative mass.", -10, true)); + this.rooms.get("Storage room").getItems().putItem("Weighted Storage Cube", new Item("A Weighted Storage Cube.", 5, true)); + this.rooms.get("Storage room").getItems().putItem("Edgeless Safety Cube", new Item("An Edgeless Safety Cube.", 5, true)); + this.rooms.get("Storage room").getItems().putItem("Portable Black-hole", new Item("A portable black-hole that has a negative mass.", -10, false)); - this.rooms.get("OffscriptTeleportationBeamerroom").getItems().putItem("Portable Quantum Tunneling Device", new Beamer("Basically a teleporter.")); + this.rooms.get("Secret lab").getItems().putItem("Portable Quantum Tunneling Device", new Beamer("Basically a teleporter.")); final KeyCard keyCard = new KeyCard("A KeyCard that opens a locked door."); - final LockedDoor lockedDoorLock = (LockedDoor) this.rooms.get("OffscriptLock").getExit("north"); - lockedDoorLock.setKey(keyCard); - final LockedDoor lockedDoorLockedRoom = (LockedDoor) this.rooms.get("OffscriptLockLockedroom").getExit("south"); - lockedDoorLockedRoom.setKey(keyCard); - this.rooms.get("OffscriptLock").getItems().putItem("KeyCard", keyCard); + ((LockedDoor) this.rooms.get("Secret corridor 2").getExit("south")).setKey(keyCard); + ((LockedDoor) this.rooms.get("Locked room").getExit("north")).setKey(keyCard); + this.rooms.get("Dead-end").getItems().putItem("KeyCard", keyCard); } /** -- cgit v1.2.3