-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCell.java
More file actions
78 lines (47 loc) · 1.38 KB
/
Cell.java
File metadata and controls
78 lines (47 loc) · 1.38 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
//this is cell class which define each cell in the board.
public abstract class Cell {
/*Whether Hero is occupied*/
private boolean isHeroOccupied;
private boolean isMonsterOccupied;
private String type;
private char letter;
private String currentInfo;
private String heroInfo = " ";
private String monsterInfo = " ";
public Cell(){
}
public void printCell() {
System.out.println(" " + letter + " - " + letter + " - " + letter + " ");
System.out.println("| " + currentInfo + " |");
System.out.println(" " + letter + " - " + letter + " - " + letter + " ");
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public char getLetter() {
return letter;
}
public void setLetter(char letter) {
this.letter = letter;
}
public String getCurrentInfo() {
return currentInfo;
}
public void setCurrentInfo(String currentInfo) {
this.currentInfo = currentInfo;
}
public void HeroLeave(){
isHeroOccupied = false;
heroInfo = " ";
this.currentInfo = heroInfo + " " + monsterInfo;
}
public boolean isHeroOccupied() {
return currentInfo.contains("H");
}
public boolean isMonsterOccupied() {
return isMonsterOccupied;
}
}