diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/esieequest/Game.java | 230 |
1 files changed, 117 insertions, 113 deletions
diff --git a/src/esieequest/Game.java b/src/esieequest/Game.java index cae7559..43db8f7 100644 --- a/src/esieequest/Game.java +++ b/src/esieequest/Game.java | |||
@@ -1,5 +1,7 @@ | |||
1 | package esieequest; | 1 | package esieequest; |
2 | 2 | ||
3 | import java.util.HashMap; | ||
4 | |||
3 | /** | 5 | /** |
4 | * The game engine. | 6 | * The game engine. |
5 | * | 7 | * |
@@ -13,6 +15,7 @@ package esieequest; | |||
13 | * @version February 2014 | 15 | * @version February 2014 |
14 | */ | 16 | */ |
15 | public class Game { | 17 | public class Game { |
18 | private HashMap<String, Room> aRooms; | ||
16 | private Room aCurrentRoom; | 19 | private Room aCurrentRoom; |
17 | private Parser aParser; | 20 | private Parser aParser; |
18 | 21 | ||
@@ -20,6 +23,7 @@ public class Game { | |||
20 | * Create the game and initialize its internal map. | 23 | * Create the game and initialize its internal map. |
21 | */ | 24 | */ |
22 | public Game() { | 25 | public Game() { |
26 | this.aRooms = new HashMap<String, Room>(); | ||
23 | this.createRooms(); | 27 | this.createRooms(); |
24 | this.aParser = new Parser(); | 28 | this.aParser = new Parser(); |
25 | this.play(); | 29 | this.play(); |
@@ -44,134 +48,134 @@ public class Game { | |||
44 | */ | 48 | */ |
45 | private void createRooms() { | 49 | private void createRooms() { |
46 | // create rooms | 50 | // create rooms |
47 | Room vAmphitheaterSeat = new Room("in the amphitheater"); | 51 | this.aRooms.put("AmphitheaterSeat", new Room("in the amphitheater")); |
48 | Room vAmphitheaterStage = new Room("on the amphitheater stage"); | 52 | this.aRooms.put("AmphitheaterStage", new Room("on the amphitheater stage")); |
49 | 53 | ||
50 | Room vCafeteriaStreet = new Room("in the main corridor, in front of the cafeteria"); | 54 | this.aRooms.put("CafeteriaStreet", new Room("in the main corridor, in front of the cafeteria")); |
51 | Room vCafeteria = new Room("at the cafeteria"); | 55 | this.aRooms.put("Cafeteria", new Room("at the cafeteria")); |
52 | 56 | ||
53 | Room vEsieespaceStreet = new Room("in the main corridor, in front of the ESIEEspace HQ"); | 57 | this.aRooms.put("EsieespaceStreet", new Room("in the main corridor, in front of the ESIEEspace HQ")); |
54 | Room vEsieespaceFront = new Room("in front of the ESIEEspace HQ"); | 58 | this.aRooms.put("EsieespaceFront", new Room("in front of the ESIEEspace HQ")); |
55 | Room vEsieespaceEntrance = new Room("at the ESIEEspace HQ entrance"); | 59 | this.aRooms.put("EsieespaceEntrance", new Room("at the ESIEEspace HQ entrance")); |
56 | Room vEsieespace = new Room("in the ESIEEspace HQ"); | 60 | this.aRooms.put("Esieespace", new Room("in the ESIEEspace HQ")); |
57 | 61 | ||
58 | Room vClubnixStreet = new Room("in the main corridor, in front of the Club*Nix"); | 62 | this.aRooms.put("ClubnixStreet", new Room("in the main corridor, in front of the Club*Nix")); |
59 | Room vClubnixFront = new Room("in front of the Club*Nix"); | 63 | this.aRooms.put("ClubnixFront", new Room("in front of the Club*Nix")); |
60 | Room vClubnixEntrance = new Room("at the Club*Nix entrance"); | 64 | this.aRooms.put("ClubnixEntrance", new Room("at the Club*Nix entrance")); |
61 | Room vClubnix = new Room("in the Club*Nix"); | 65 | this.aRooms.put("Clubnix", new Room("in the Club*Nix")); |
62 | 66 | ||
63 | Room vEntranceStreet = new Room("in the main corridor, at the reception"); | 67 | this.aRooms.put("EntranceStreet", new Room("in the main corridor, at the reception")); |
64 | Room vEntranceStairs = new Room("on the main entrance stairs"); | 68 | this.aRooms.put("EntranceStairs", new Room("on the main entrance stairs")); |
65 | Room vEntranceRoundabout = new Room("on the roundabout"); | 69 | this.aRooms.put("EntranceRoundabout", new Room("on the roundabout")); |
66 | 70 | ||
67 | Room vWingStreet = new Room("in font of wing #3"); | 71 | this.aRooms.put("WingStreet", new Room("in font of wing #3")); |
68 | Room vWingCorridorOne = new Room("in the corridor in wing #3, on the ground floor"); | 72 | this.aRooms.put("WingCorridorOne", new Room("in the corridor in wing #3, on the ground floor")); |
69 | Room vWingStairsOne = new Room("in the stairwell on the ground floor"); | 73 | this.aRooms.put("WingStairsOne", new Room("in the stairwell on the ground floor")); |
70 | Room vWingStairsTwo = new Room("in the stairwell on the first floor"); | 74 | this.aRooms.put("WingStairsTwo", new Room("in the stairwell on the first floor")); |
71 | Room vWingCorridorTwo = new Room("in the corridor in wind #3, on the first floor"); | 75 | this.aRooms.put("WingCorridorTwo", new Room("in the corridor in wind #3, on the first floor")); |
72 | Room vWingCorridorTwoOffice = new Room("in front of the office #3254"); | 76 | this.aRooms.put("WingCorridorTwoOffice", new Room("in front of the office #3254")); |
73 | Room vWingOffice = new Room("in the office #3254"); | 77 | this.aRooms.put("WingOffice", new Room("in the office #3254")); |
74 | 78 | ||
75 | Room vOffscriptEat = new Room("somewhere implementing hunger"); | 79 | this.aRooms.put("OffscriptEat", new Room("somewhere implementing hunger")); |
76 | Room vOffscriptEatPantry = new Room("in the pantry"); | 80 | this.aRooms.put("OffscriptEatPantry", new Room("in the pantry")); |
77 | Room vOffscriptTake = new Room("somewhere implementing weight"); | 81 | this.aRooms.put("OffscriptTake", new Room("somewhere implementing weight")); |
78 | Room vOffscriptTakeStorageroom = new Room("in a storage room"); | 82 | this.aRooms.put("OffscriptTakeStorageroom", new Room("in a storage room")); |
79 | Room vOffscriptTimeout = new Room("somewhere implementing time"); | 83 | this.aRooms.put("OffscriptTimeout", new Room("somewhere implementing time")); |
80 | Room vOffscriptTimeoutCountdownroom = new Room("in a dangerous room"); | 84 | this.aRooms.put("OffscriptTimeoutCountdownroom", new Room("in a dangerous room")); |
81 | Room vOffscriptTrapdoor = new Room("somewhere implementing a trap"); | 85 | this.aRooms.put("OffscriptTrapdoor", new Room("somewhere implementing a trap")); |
82 | Room vOffscriptTrapdoorDeadend = new Room("trapped"); | 86 | this.aRooms.put("OffscriptTrapdoorDeadend", new Room("trapped")); |
83 | Room vOffscriptBeamer = new Room("somewhere implementing teleportation"); | 87 | this.aRooms.put("OffscriptBeamer", new Room("somewhere implementing teleportation")); |
84 | Room vOffscriptBeamerAnchor = new Room("on a checkpoint"); | 88 | this.aRooms.put("OffscriptBeamerAnchor", new Room("on a checkpoint")); |
85 | Room vOffscriptLock = new Room("somewhere implementing a doorlock"); | 89 | this.aRooms.put("OffscriptLock", new Room("somewhere implementing a doorlock")); |
86 | Room vOffscriptLockLockedroom = new Room("in a locked room that is not anymore"); | 90 | this.aRooms.put("OffscriptLockLockedroom", new Room("in a locked room that is not anymore")); |
87 | Room vOffscriptAlea = new Room("somewhere implementing alea"); | 91 | this.aRooms.put("OffscriptAlea", new Room("somewhere implementing alea")); |
88 | Room vOffscriptAleaRoomrandomizer = new Room("in a weird room that will transport you somewhere else"); | 92 | this.aRooms.put("OffscriptAleaRoomrandomizer", new Room("in a weird room that will transport you somewhere else")); |
89 | Room vOffscriptMovingcharacter = new Room("somewhere implementing a moving character"); | 93 | this.aRooms.put("OffscriptMovingcharacter", new Room("somewhere implementing a moving character")); |
90 | Room vOffscriptMovingcharacterMo = new Room("in M-O's room"); | 94 | this.aRooms.put("OffscriptMovingcharacterMo", new Room("in M-O's room")); |
91 | 95 | ||
92 | // connect rooms (N, W, S, E) | 96 | // connect rooms |
93 | vAmphitheaterSeat.setExit("north", vAmphitheaterStage); | 97 | this.aRooms.get("AmphitheaterSeat").setExit("north", this.aRooms.get("AmphitheaterStage")); |
94 | vAmphitheaterStage.setExit("west", vCafeteria); | 98 | this.aRooms.get("AmphitheaterStage").setExit("west", this.aRooms.get("Cafeteria")); |
95 | 99 | ||
96 | vCafeteriaStreet.setExit("south", vCafeteria); | 100 | this.aRooms.get("CafeteriaStreet").setExit("south", this.aRooms.get("Cafeteria")); |
97 | vCafeteriaStreet.setExit("east", vEsieespaceStreet); | 101 | this.aRooms.get("CafeteriaStreet").setExit("east", this.aRooms.get("EsieespaceStreet")); |
98 | vCafeteria.setExit("north", vCafeteriaStreet); | 102 | this.aRooms.get("Cafeteria").setExit("north", this.aRooms.get("CafeteriaStreet")); |
99 | vCafeteria.setExit("east", vAmphitheaterStage); | 103 | this.aRooms.get("Cafeteria").setExit("east", this.aRooms.get("AmphitheaterStage")); |
100 | 104 | ||
101 | vEsieespaceStreet.setExit("west", vCafeteria); | 105 | this.aRooms.get("EsieespaceStreet").setExit("west", this.aRooms.get("Cafeteria")); |
102 | vEsieespaceStreet.setExit("south", vEsieespaceFront); | 106 | this.aRooms.get("EsieespaceStreet").setExit("south", this.aRooms.get("EsieespaceFront")); |
103 | vEsieespaceStreet.setExit("east", vEntranceStreet); | 107 | this.aRooms.get("EsieespaceStreet").setExit("east", this.aRooms.get("EntranceStreet")); |
104 | vEsieespaceFront.setExit("north", vEsieespaceStreet); | 108 | this.aRooms.get("EsieespaceFront").setExit("north", this.aRooms.get("EsieespaceStreet")); |
105 | vEsieespaceFront.setExit("east", vEsieespaceEntrance); | 109 | this.aRooms.get("EsieespaceFront").setExit("east", this.aRooms.get("EsieespaceEntrance")); |
106 | vEsieespaceEntrance.setExit("north", vEsieespace); | 110 | this.aRooms.get("EsieespaceEntrance").setExit("north", this.aRooms.get("Esieespace")); |
107 | vEsieespaceEntrance.setExit("west", vEsieespaceFront); | 111 | this.aRooms.get("EsieespaceEntrance").setExit("west", this.aRooms.get("EsieespaceFront")); |
108 | vEsieespace.setExit("south", vEsieespaceEntrance); | 112 | this.aRooms.get("Esieespace").setExit("south", this.aRooms.get("EsieespaceEntrance")); |
109 | 113 | ||
110 | vClubnixStreet.setExit("west", vWingStreet); | 114 | this.aRooms.get("ClubnixStreet").setExit("west", this.aRooms.get("WingStreet")); |
111 | vClubnixStreet.setExit("south", vClubnixFront); | 115 | this.aRooms.get("ClubnixStreet").setExit("south", this.aRooms.get("ClubnixFront")); |
112 | vClubnixFront.setExit("north", vClubnixStreet); | 116 | this.aRooms.get("ClubnixFront").setExit("north", this.aRooms.get("ClubnixStreet")); |
113 | vClubnixFront.setExit("east", vClubnixEntrance); | 117 | this.aRooms.get("ClubnixFront").setExit("east", this.aRooms.get("ClubnixEntrance")); |
114 | vClubnixEntrance.setExit("north", vClubnix); | 118 | this.aRooms.get("ClubnixEntrance").setExit("north", this.aRooms.get("Clubnix")); |
115 | vClubnixEntrance.setExit("west", vClubnixFront); | 119 | this.aRooms.get("ClubnixEntrance").setExit("west", this.aRooms.get("ClubnixFront")); |
116 | vClubnix.setExit("south", vClubnixEntrance); | 120 | this.aRooms.get("Clubnix").setExit("south", this.aRooms.get("ClubnixEntrance")); |
117 | 121 | ||
118 | vEntranceStreet.setExit("west", vEsieespaceStreet); | 122 | this.aRooms.get("EntranceStreet").setExit("west", this.aRooms.get("EsieespaceStreet")); |
119 | vEntranceStreet.setExit("south", vEntranceStairs); | 123 | this.aRooms.get("EntranceStreet").setExit("south", this.aRooms.get("EntranceStairs")); |
120 | vEntranceStreet.setExit("east", vWingStreet); | 124 | this.aRooms.get("EntranceStreet").setExit("east", this.aRooms.get("WingStreet")); |
121 | vEntranceStairs.setExit("north", vEntranceStreet); | 125 | this.aRooms.get("EntranceStairs").setExit("north", this.aRooms.get("EntranceStreet")); |
122 | vEntranceStairs.setExit("south", vEntranceRoundabout); | 126 | this.aRooms.get("EntranceStairs").setExit("south", this.aRooms.get("EntranceRoundabout")); |
123 | vEntranceRoundabout.setExit("north", vEntranceStairs); | 127 | this.aRooms.get("EntranceRoundabout").setExit("north", this.aRooms.get("EntranceStairs")); |
124 | 128 | ||
125 | vWingStreet.setExit("north", vWingCorridorOne); | 129 | this.aRooms.get("WingStreet").setExit("north", this.aRooms.get("WingCorridorOne")); |
126 | vWingStreet.setExit("west", vEntranceStreet); | 130 | this.aRooms.get("WingStreet").setExit("west", this.aRooms.get("EntranceStreet")); |
127 | vWingStreet.setExit("east", vClubnixStreet); | 131 | this.aRooms.get("WingStreet").setExit("east", this.aRooms.get("ClubnixStreet")); |
128 | vWingCorridorOne.setExit("west", vWingStairsOne); | 132 | this.aRooms.get("WingCorridorOne").setExit("west", this.aRooms.get("WingStairsOne")); |
129 | vWingCorridorOne.setExit("south", vWingStreet); | 133 | this.aRooms.get("WingCorridorOne").setExit("south", this.aRooms.get("WingStreet")); |
130 | vWingCorridorOne.setExit("east", vOffscriptEat); | 134 | this.aRooms.get("WingCorridorOne").setExit("east", this.aRooms.get("OffscriptEat")); |
131 | vWingStairsOne.setExit("south", vWingStairsTwo); | 135 | this.aRooms.get("WingStairsOne").setExit("south", this.aRooms.get("WingStairsTwo")); |
132 | vWingStairsOne.setExit("up", vWingStairsTwo); |