forked from rabinovichr/Project02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGandalf.java
31 lines (25 loc) · 913 Bytes
/
Gandalf.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
package Project02;
public class Gandalf extends People{
Gandalf(String nation, String tribe, int lifePoints)
{
super(nation, tribe, PeopleType.SpecialEncounter, lifePoints);
myDescription = "\tGandalf";
}
public int encounterStrategy(People otherPerson) {
if (otherPerson.getNation() != this.getNation()) // if the otherPerson isn't another special encounter
{
if (otherPerson.getType().equals(PeopleType.wizard)) // if otherPerson is a wizard, heal
{
return -20;
}
else if (otherPerson.getType().equals(PeopleType.warrior)) // if otherPerson is a warrior, attack
{
return 15;
}
else // if otherPerson == healer, ignore
{
}
}
return 0; // if otherPerson is another special encounter, do nothing
}
}