made changing descriptions and added a spicy new riddle

This commit is contained in:
Luca Carnegie
2019-06-01 00:46:40 -04:00
parent 3787f4b1f2
commit cd76933723
3 changed files with 8 additions and 7 deletions

View File

@@ -61,7 +61,7 @@ class Game {
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());
room.setNewRoomDescription(newRoomDescription.substring(newRoomDescription.indexOf(":") + 1,newRoomDescription.length()).replaceAll("<br>", "\n").trim());
// Read the locked state
boolean locked = Boolean.parseBoolean(roomScanner.nextLine().split(": ")[1].replaceAll("<br>", "\n").trim());
room.setLocked(locked);

View File

@@ -25,7 +25,7 @@ import com.bayviewglen.zork.Items.*;
class Room {
private String roomName;
private String description;
private String newRoomDescription;
private String newDescription;
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.
@@ -254,6 +254,7 @@ class Room {
public void removeRiddler() {
riddler = null;
this.description = newDescription;
}
@@ -266,7 +267,7 @@ class Room {
}
public void setNewRoomDescription(String newRoomDesc) {
this.newRoomDescription = newRoomDesc;
this.newDescription = newRoomDesc;
}