forked from rabinovichr/Project02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToybergWizard2.java
43 lines (35 loc) · 1.23 KB
/
ToybergWizard2.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
43
package Project02;
import Project02.PeopleType;
public class ToybergWizard2 extends Project02.People {
/**
* Attacks on healers are based on enemy's health.
* Attacks on warriors are based on this wizard's health.
* Attacks on wizards are based on enemy's max health.
*
* Can steal health from enemies
*
* Has no benefits to meeting a player of same nation or tribe
*
*/
ToybergWizard2(String nation, String tribe, int lifePoints) {
super(nation, tribe, PeopleType.wizard, lifePoints);
myDescription = "\tToyberg Wizard";
}
public int encounterStrategy(Project02.People otherPerson) {
int lifePoints = 0;
if (this.getNation() != otherPerson.getNation()){
if(otherPerson.getType() == PeopleType.healer){
lifePoints = otherPerson.getLifePoints();
modifyLifePoints(lifePoints / 5);
}
else if(otherPerson.getType() == PeopleType.warrior){
lifePoints = this.getLifePoints();
modifyLifePoints(lifePoints / 10);
}
else{
lifePoints = otherPerson.MAX_LIFEPOINTS / 5;
}
}
return lifePoints;
}
}