-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudentTeam.java
40 lines (37 loc) · 1.65 KB
/
StudentTeam.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
public class StudentTeam extends Team{
public StudentTeam(String name) {
super(name);
}
@Override
public void move(Character member, Team enemyTeam) throws Exception {
if(member instanceof Student){
//we should have only members that are Students
Student student = (Student)member;
if(student.canUseSpecialAttack()){
if(student instanceof AIStudent){
Character weakestEnemy = enemyTeam.getAliveMemberByLeastHP();
((AIStudent)student).triggerSpecialAttack(weakestEnemy);
}
else if(student instanceof CSStudent){
Character weakestFriend = member.getTeam().getAliveMemberByLeastHP();
if(weakestFriend.getHP() < weakestFriend.getMaxHP()/3){
((CSStudent)student).triggerSpecialAttack(weakestFriend);
}
else{
Character strongestFriend = member.getTeam().getAliveMemberByHighestAttack();
((CSStudent)student).triggerSpecialAttack(strongestFriend);
}
}
else if(student instanceof CyberStudent){
((CyberStudent)student).triggerSpecialAttack(enemyTeam);
}
else if(student instanceof SEStudent){
Character weakestEnemy = enemyTeam.getAliveMemberByLeastHP();
((SEStudent)student).triggerSpecialAttack(weakestEnemy);
}
}
}
else{
}
}
}