forked from rabinovichr/Project02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ToybergWizard.java
42 lines (37 loc) · 1.32 KB
/
ToybergWizard.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
package Project02;
public class ToybergWizard extends Project02.People {
ToybergWizard(String nation, String tribe, int lifePoints) {
super(nation, tribe, Project02.PeopleType.wizard, lifePoints);
myDescription = "\tToyberg Wizard";
}
/**
* This wizard has offensive abilities as well as healing abilities
* Can very effectively heal warriors or wizards
*
* Will not fight a warrior if the warrior has greater health
*
*/
public int encounterStrategy(Project02.People otherPerson) {
int lifePoints = 0;
if (this.getNation() != otherPerson.getNation()){
if (otherPerson.getLifePoints() < this.getLifePoints()){
if (otherPerson.getType() == Project02.PeopleType.warrior){ // run away
lifePoints = -this.getLifePoints();
}
else{ // attack a wizard or healer
lifePoints = this.getLifePoints();
}
}
}
else
{
if(otherPerson.getType().equals(Project02.PeopleType.wizard) || otherPerson.getType().equals(Project02.PeopleType.warrior)){
lifePoints = -this.MAX_LIFEPOINTS;
}
else{
lifePoints = 0;
}
}
return lifePoints;
}
}