-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
69 lines (68 loc) · 2.04 KB
/
Player.java
File metadata and controls
69 lines (68 loc) · 2.04 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
public class Player extends Entity {
int critRange;
boolean hasKey;
int maxHP;
char[][] playerMap = {
{'_','_','_','_','_','_','_','_','_','_','_','_','_'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'|','?','?','?','_','_','_','_','_','?','?','?','|'},
{'|','?','?','?','|','?','?','?','|','?','?','?','|'},
{'|','?','?','?','|','?','?','?','|','?','?','?','|'},
{'|','?','?','?','|','_','?','_','|','?','?','?','|'},
{'|','?','?','?','|','?','?','?','|','?','?','?','|'},
{'|','?','?','?','_','_','?','_','_','?','?','?','|'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'|','?','?','?','?','?','?','?','?','?','?','?','|'},
{'_','_','_','_','_','_','_','_','_','_','_','_','_'}
};
public Player(String n, int health, int armor, int X, int Y, int damage,int minCrit) {
super(n, health, armor, X, Y, damage);
maxHP = health;
critRange = minCrit;
hasKey = false;
}
public void die() {
if(hasKey) {
gameProtocol.world[1][4]='!';
}
HP = 0;
name = name.trim();
if(!name.trim().equals("Glass Cannon"))
name = name+"\t";
name = "Ghost of "+name+"\t";
AC = 99;
damageDiceNumber = 0;
critRange = 99;
}
public String toString() {
if(xCoord==6&&yCoord==4)
return "The "+this.name.trim()+" lives happily ever after.";
String master="";
for(int r=0;r<18;r++) {
if(r==1) {
master+="Name: "+this.name+"";
}
else if(r==2) {
master+="HP: "+this.HP+"\t\t\t\t";
}
else if(r==4) {
master+="AC: "+this.AC+"\t\t\t\t";
}
else {
master+="\t\t\t\t";
}
for(int c=0;c<13;c++) {
master+=playerMap[r][c];
}
master+="\n";
}
return master;
}
}