forked from rabinovichr/Project02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SmilonsWizard2.java
39 lines (34 loc) · 1.32 KB
/
SmilonsWizard2.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
package Project02;
public class SmilonsWizard2 extends Project02.People {
SmilonsWizard2(String nation, String tribe, int lifePoints) {
super(nation, tribe, PeopleType.warrior, lifePoints);
myDescription = "\tSmilons Wizard2";
}
public int encounterStrategy(People otherPerson) {
int lifePoints = 0;
if (this.getNation() == otherPerson.getNation()) {
if (otherPerson.getLifePoints() < this.getLifePoints()) {
if (otherPerson.getTribe() == this.getTribe()) {
lifePoints = -((this.getLifePoints() - otherPerson.getLifePoints()) / 2);
} else {
lifePoints = -((this.getLifePoints() - otherPerson.getLifePoints()) / 4);
}
}
} else
//Tribe1 wizard is very aggressive
{
if (this.getTribe().equals("Tribe1")) {
lifePoints = this.getLifePoints();
}
//Tribe2 wizard is more conservative with life points contributed
else if (this.getTribe().equals("Tribe2")) {
lifePoints = this.getLifePoints()/2;
} else
//Tribe3 wizard will be very conservative
{
lifePoints = this.getLifePoints()/4;
}
}
return lifePoints;
}
}