-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreature.java
108 lines (83 loc) · 2.46 KB
/
Creature.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
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
public class Creature extends Entity {
int unconscious;
int airCapacity;
int currentAir;
double blood;
double poison;
int speed;
boolean canMove;
boolean canAttack;
public Creature(int x_position, int y_position, boolean alive, char graphic, String name, String charColor, String bgColor, int unconscious, int airCapacity, double blood, double poison, int speed, boolean canMove, boolean canAttack) {
super(x_position, y_position, alive, graphic, name, charColor, bgColor);
this.unconscious = unconscious;
this.airCapacity = airCapacity;
this.currentAir = airCapacity;
this.blood = blood;
this.poison = poison;
this.speed = speed;
this.canMove = canMove;
this.canAttack = canAttack;
}
public int getUnconscious() {
return unconscious;
}
public void setUnconscious(int unconscious) {
this.unconscious = unconscious;
}
public int getAirCapacity() {
return airCapacity;
}
public void setAirCapacity(int airCapacity) {
this.airCapacity = airCapacity;
}
public double getBlood() {
return blood;
}
public void setBlood(double blood) {
this.blood = blood;
}
public double getPoison() {
return poison;
}
public void setPoison(double poison) {
this.poison = poison;
}
public int getSpeed() {
return speed;
}
public void setSpeed(int speed) {
this.speed = speed;
}
public boolean isCanMove() {
return canMove;
}
public void setCanMove(boolean canMove) {
this.canMove = canMove;
}
public boolean isCanAttack() {
return canAttack;
}
public void setCanAttack(boolean canAttack) {
this.canAttack = canAttack;
}
public void wakingTick(int num){
this.unconscious -= num;
}
public void breathingTick(int num){
this.currentAir -= num;
}
public void bloodLoss(double doubleNum){
this.blood -= doubleNum;
}
public void poisonLoss(double doubleNum){
this.poison -= doubleNum;
}
public boolean move(int x, int y){
if ((int) Math.sqrt((x^2) + (y^2)) <= speed){
this.x_position += x;
this.y_position += y;
return true;
}
return false;
}
}