-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAIStudent.java
More file actions
31 lines (26 loc) · 890 Bytes
/
AIStudent.java
File metadata and controls
31 lines (26 loc) · 890 Bytes
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
public class AIStudent extends Student implements Triggerable{
public AIStudent(String name) {
super(name, 6, 7, 7, 5, 3);
}
public void machineLearning(Character enemy) throws Exception {
this.specialAttack();
int damageAmount = 2 * (100 * this.getAttack()) / (100 + enemy.getDefence());
enemy.decreaseHP(damageAmount);
if(!enemy.isAlive()){
this.increaseEP(4);
}
}
public void naturalLanguageProcessing() throws Exception {
this.specialAttack();
this.increaseHP(this.getDefence());
}
@Override
public void triggerSpecialAttack(Character enemy) throws Exception {
if(this.getHP() < this.getMaxHP()/2){
this.naturalLanguageProcessing();
}
else{
this.machineLearning(enemy);
}
}
}