-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMinion.java
More file actions
24 lines (20 loc) · 742 Bytes
/
Minion.java
File metadata and controls
24 lines (20 loc) · 742 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
import java.util.Random;
public class Minion extends Character implements Monster{
public Minion(String name){
super(name, 5, 5, 5, 5);
}
public void strike(Character enemy){
this.increaseEP(3);
if(!enemy.isAlive()){
this.increaseEP(4);
}
if(enemy instanceof Student){
((Student)enemy).increaseKP(3);
}
Random random = new Random();
int randomNumber = random.nextInt(100);
if (randomNumber < 75) { SyntaxError(enemy); }
if (randomNumber >=75 && randomNumber < 90) { NullPointerException(); }
if (randomNumber >= 90) { ArrayIndexOutOfBoundException(enemy); }
}
}