changed some things
This commit is contained in:
@@ -59,6 +59,9 @@ class Game {
|
||||
// Read the Description
|
||||
String roomDescription = roomScanner.nextLine();
|
||||
room.setDescription(roomDescription.split(": ")[1].replaceAll("<br>", "\n").trim());
|
||||
//Read room description after riddler is removed.
|
||||
String newRoomDescription = roomScanner.nextLine();
|
||||
room.setNewRoomDescription(newRoomDescription.split(": ")[1].replaceAll("<br>", "\n").trim());
|
||||
// Read the locked state
|
||||
boolean locked = Boolean.parseBoolean(roomScanner.nextLine().split(": ")[1].replaceAll("<br>", "\n").trim());
|
||||
room.setLocked(locked);
|
||||
@@ -464,6 +467,8 @@ class Game {
|
||||
} else {
|
||||
System.out.println("Sorry, you can't carry any more, but a " + prize + " has been added to your room.");
|
||||
currentRoom.addItem(prize);
|
||||
System.out.println("I've got to go find Mr. Pellatt now. Good luck with your escape!");
|
||||
currentRoom.removeRiddler();
|
||||
}
|
||||
} else {
|
||||
System.out.println("Sorry, that isn't the answer. Think about it, then try again.");
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.bayviewglen.zork.Items.*;
|
||||
class Room {
|
||||
private String roomName;
|
||||
private String description;
|
||||
private String newRoomDescription;
|
||||
private HashMap<String, Room> exits; // stores exits of this room.
|
||||
private ArrayList<Item> items;
|
||||
private Riddler riddler; //needs to altered outside of the class so that riddler can be set to null.
|
||||
@@ -263,5 +264,10 @@ class Room {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setNewRoomDescription(String newRoomDesc) {
|
||||
this.newRoomDescription = newRoomDesc;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user