added a removeRiddler() method.
This commit is contained in:
@@ -2,8 +2,8 @@ Room name: Circle Room
|
||||
Room Description: You are in a circular room. The windows to the east are covered with boards that<br>let in just enough light to see. You spot a man in a tailored suit moving some crates around.
|
||||
Locked: false
|
||||
Boarded: false
|
||||
Items:Lockpick,Milk
|
||||
Riddler: "Hello there. My name is Kevin and I am Sir Pellatt's butler. I understand that my master<comma><br>Sir Pellatt has wrongfully imprisoned you. If you answer my riddle<comma> I can give you something to<br>help you with your escape - nothing comes for free you know!", "What goes moo?", "Cows", ShavingCream
|
||||
Items: Lightbulb,Candlestick
|
||||
Riddler: "Hello there. My name is Kevin and I am Sir Pellatt's butler. I understand that my master<comma><br>Sir Pellatt has wrongfully imprisoned you. If you answer my riddle<comma> I can give you something to<br>help you with your escape - nothing comes for free you know!", "What goes moo?", "Cows", Lockpick
|
||||
Exit Rooms: W-Apple Hallway
|
||||
|
||||
Room name: Apple Hallway
|
||||
|
||||
@@ -385,7 +385,7 @@ class Game {
|
||||
if(player.addToInventory(prize)) {
|
||||
player.addToInventory(prize);
|
||||
System.out.println("A " + prizeName + " has been added to your inventory.");
|
||||
currentRoom.riddler = null;
|
||||
currentRoom.removeRiddler();
|
||||
System.out.println("I've got to go find Mr. Pellatt now. Good luck with your escape!");
|
||||
}else {
|
||||
System.out.println("Sorry, you can't carry any more ");
|
||||
@@ -543,6 +543,7 @@ class Game {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// implementations of user commands:
|
||||
/**
|
||||
* Print out some help information. Here we print some stupid, cryptic
|
||||
|
||||
@@ -27,7 +27,7 @@ class Room {
|
||||
private String description;
|
||||
private HashMap<String, Room> exits; // stores exits of this room.
|
||||
private ArrayList<Item> items;
|
||||
Riddler riddler; //needs to altered outside of the class so that riddler can be set to null.
|
||||
private Riddler riddler; //needs to altered outside of the class so that riddler can be set to null.
|
||||
private boolean locked; // Otherwise you can repeatedly solve the riddle and get unlimited items
|
||||
private boolean boarded;
|
||||
|
||||
@@ -240,4 +240,9 @@ class Room {
|
||||
return riddler;
|
||||
}
|
||||
|
||||
public void removeRiddler() {
|
||||
riddler = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user