-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTavern.java
More file actions
55 lines (51 loc) · 1.24 KB
/
Tavern.java
File metadata and controls
55 lines (51 loc) · 1.24 KB
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
import java.util.*;
/**
*@author Tyler Lericos
*@version 1.0
*Interfaces
*Spring Semester/Freshman
*/
public class Tavern extends Village{
String tavernName;
int cost;
/*
* Tavern Constructor
*/
public Tavern(String name, int cost) {
super();
this.tavernName = name;
this.cost = cost;
// TODO Auto-generated constructor stub
}
/*
* Rest method for restoring players health and taking their gold
*/
public void Rest(Player player, Scanner scan) {
System.out.println("Would you like to rest to regain health?");
System.out.println("1. Yes\n2. No");
int choice = scan.nextInt();
if (choice == 1) {
player.setHealth(100);
player.gold = player.gold - cost;
System.out.println("You are fully healed and rested!");
System.out.println("-" +cost);
}
else if (choice == 2) {
System.out.println("You avoid the tavern!");
}
else if (choice != 1|| choice !=2) {
System.out.println("Invalid Option");
}
}
/*
* =======================================
* Getters and Setters
* =======================================
*/
public String getTavernName() {
return tavernName;
}
public void setTavernName(String name) {
this.tavernName = name;
}
}