-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
59 lines (48 loc) · 1.44 KB
/
Student.java
File metadata and controls
59 lines (48 loc) · 1.44 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
public class Student extends Character{
private int maxKP = 0;
private int currentKP = 0;
public Student(String name, int baseHP, int baseAtk, int baseDef, int baseSpd, int maxKP){
super(name, baseHP, baseAtk, baseDef, baseSpd);
this.maxKP = maxKP;
}
public int getMaxKP(){
//return (int)Math.round(this.maxKP*Math.pow(level, 1.2));
return maxKP;
}
public void increaseKP(int amount){
currentKP += amount;
}
public void resetKP(){
currentKP = 0;
}
public void javaProgramming(Character enemy){
this.increaseEP(3);
this.increaseKP(1);
int damageAmount = (100 * this.getAttack()) / (100 + enemy.getDefence());
enemy.decreaseHP(damageAmount);
enemy.increaseEP(2);
if(enemy instanceof Student){
((Student)enemy).increaseKP(3);
}
if(enemy.getHP() == 0 ){
this.increaseEP(4);
}
}
public void selfStudy(){
this.increaseHP(2);
this.increaseEP(6);
this.increaseKP(2);
}
protected void specialAttack() throws Exception {
if(currentKP >= maxKP){
this.increaseEP(4);
this.resetKP();
}
else{
throw new Exception("");
}
}
public boolean canUseSpecialAttack(){
return currentKP >= maxKP;
}
}