-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlaces.java
More file actions
139 lines (113 loc) · 2.64 KB
/
Places.java
File metadata and controls
139 lines (113 loc) · 2.64 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import java.util.ArrayList;
import java.util.Scanner;
/**
*@author Tyler Lericos
*@version 1.0
*Interfaces
*Spring Semester/Freshman
*/
public class Places extends World{
/*
*
*/
Shop shop;
Tavern tavern;
String placeName;
String flavorText;
Item item;
Item key;
String itemName;
Enemy enemy = new Enemy();
Battle battle = new Battle();
Player player = new Player();
boolean isLocked;
/*
* Empty Constructor
*/
public Places() {}
/*
* Constructor with paramters
*/
public Places(String placeName, String flavorText, Item item, Player player, Enemy enemy, boolean isLocked,Item key) {
super();
this.placeName = placeName;
this.flavorText = flavorText;
this.item = item;
this.player = player;
this.enemy = enemy;
this.isLocked = isLocked;
this.key = key;
}
//Checks the place is it has an enemy or not
public void checkEnemy() {
if (this.enemy == null) {
System.out.println("There are no enemies nearby!");
}else {
System.out.println("There is a " + this.enemy.name + " nearby!");
battle.Battle(player, enemy);
}
}
//Checks if the place is locked
public void checkLock() {
if(this.isLocked ==false) {
System.out.println("Unlocked!");
}else {
System.out.println("Locked!");
if (player.inventory.contains(this.key)) {
this.isLocked =false;
}else {
System.out.println("You do not have the key!");
}
}
}
//Open lock statement
public void OpenLock(Player player, Scanner scan) {
System.out.println("Do you have the key?");
}
/*
* ===================================================
* Getters and Setters
* ===================================================
*/
public String getPlaceName() {
return placeName;
}
public void setPlaceName(String placeName) {
this.placeName = placeName;
}
public String getFlavorText() {
return flavorText;
}
public void setFlavorText(String flavorText) {
this.flavorText = flavorText;
}
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
}
public void setShop(Shop shop) {
this.shop = shop;
}
public Shop getShop() {
return shop;
}
public boolean isLocked() {
return isLocked;
}
public void setLocked(boolean isLocked) {
this.isLocked = isLocked;
}
@Override
public String toString() {
return placeName +"\n"+ flavorText +"\n";
}
public void setTavern(Tavern tavern) {
this.tavern = tavern;
}
public Tavern getTavern() {
// TODO Auto-generated method stub
return tavern;
}
}