/
TownFive.java
55 lines (48 loc) · 1.34 KB
/
TownFive.java
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// BEGENEN: Health Center, Wealth Shop, [Training Area], Pub
import cs1.Keyboard;
public class TownFive extends Town {
Character chara;
Inventory inventory;
public TownFive(Character ch, Inventory invent){
chara = ch;
inventory = invent;
}
public void play(){
System.out.println("You enter the town of REPLETE. Few residents are around, but hopefully you can get on your way.");
System.out.println("You should probably explore the TAVERN");
prompt();
}
public void prompt(){
String prompt = "Choose your action:\n1 - Explore the town\n2 - Check your inventory\n3 - Go to the tavern\n4 - Go to the pub\n5 - Go to the next zone";
System.out.println(prompt);
String input = Keyboard.readString();
if (input.equals("1")){
System.out.println("Under development");
prompt();
}
else if (input.equals("2")){
System.out.println("You ruffle through your bag.");
inventory.prompt(chara);
prompt();
}
else if (input.equals("3")){
System.out.println("Under development");
prompt();
}
else if (input.equals("4")){
System.out.println("Under development");
prompt();
}
else if (input.equals("5")){
exit();
}
else {
System.out.println("Try again");
prompt();
}
}
public void exit(){
Prologue ending = new Prologue(chara);
ending.play();
}
}