diff options
Diffstat (limited to 'src/esieequest/model/Game.java')
-rw-r--r-- | src/esieequest/model/Game.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/esieequest/model/Game.java b/src/esieequest/model/Game.java index 59b4a32..c9d7933 100644 --- a/src/esieequest/model/Game.java +++ b/src/esieequest/model/Game.java | |||
@@ -1,6 +1,7 @@ | |||
1 | package esieequest.model; | 1 | package esieequest.model; |
2 | 2 | ||
3 | import java.util.HashMap; | 3 | import java.util.HashMap; |
4 | import java.util.Set; | ||
4 | 5 | ||
5 | /** | 6 | /** |
6 | * | 7 | * |
@@ -166,7 +167,8 @@ public class Game { | |||
166 | } | 167 | } |
167 | 168 | ||
168 | private void createItems() { | 169 | private void createItems() { |
169 | this.rooms.get("Cafeteria").setItem(new Item("Banana", 12)); | 170 | this.rooms.get("Cafeteria").addItem("Banana", new Item("A yellow banana", 12)); |
171 | this.rooms.get("Cafeteria").addItem("Orange", new Item("An orange orange", 15)); | ||
170 | } | 172 | } |
171 | 173 | ||
172 | public void setRunning(boolean state) { | 174 | public void setRunning(boolean state) { |
@@ -197,6 +199,14 @@ public class Game { | |||
197 | return this.currentRoom.getImageName(); | 199 | return this.currentRoom.getImageName(); |
198 | } | 200 | } |
199 | 201 | ||
202 | public String getItemDescription(String itemName) { | ||
203 | return this.currentRoom.getItem(itemName).getDescription(); | ||
204 | } | ||
205 | |||
206 | public Set<String> getItemList() { | ||
207 | return this.currentRoom.getItemList(); | ||
208 | } | ||
209 | |||
200 | public String getEatMessage() { | 210 | public String getEatMessage() { |
201 | return "oNommNommNomm..."; | 211 | return "oNommNommNomm..."; |
202 | } | 212 | } |
@@ -217,12 +227,12 @@ public class Game { | |||
217 | return "There is no exit."; | 227 | return "There is no exit."; |
218 | } | 228 | } |
219 | 229 | ||
220 | public String getItemDescription() { | 230 | public String getCommandListPrefix() { |
221 | if (this.currentRoom.getItem() != null) { | 231 | return "Available commands:"; |
222 | return "This room contain : " + this.currentRoom.getItem().getDescription(); | 232 | } |
223 | } else { | 233 | |
224 | return ""; | 234 | public String getItemListPrefix() { |
225 | } | 235 | return "This room contains:"; |
226 | } | 236 | } |
227 | 237 | ||
228 | } | 238 | } |