forked from SkylerLutz/adventure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoomExcavatable.java
More file actions
31 lines (28 loc) · 838 Bytes
/
Copy pathRoomExcavatable.java
File metadata and controls
31 lines (28 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.HashMap;
import java.util.LinkedList;
public class RoomExcavatable extends Room {
public RoomExcavatable(String description, String shortDescription, String digMessage) {
super(description, shortDescription);
this.digMessage = digMessage;
this.wasDugUp = false;
this.revealableItems = new LinkedList<Item>();
}
public void setRevealableItems(LinkedList<Item> items) {
if(items != null) {
this.revealableItems = items;
}
}
public void dig() {
if(this.player.hasItem(Item.getInstance("shovel"))) {
System.out.println(digMessage);
this.wasDugUp = true;
this.items.addAll(this.revealableItems);
}
else {
System.out.println("You do not have an item you can use to dig.");
}
}
protected String digMessage;
protected boolean wasDugUp;
protected LinkedList<Item> revealableItems;
}