forked from rabinovichr/Project02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PerezWarrior2.java
32 lines (28 loc) · 885 Bytes
/
PerezWarrior2.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
package Project02;
public class PerezWarrior2 extends People
{
PerezWarrior2(String nation, String tribe, int lifePoints)
{
super(nation, tribe, PeopleType.warrior, lifePoints);
myDescription = "\tPerez Warrior 2";
}
/**
*
* @param otherPerson
* Reference to opponent
* @return
* Attacks for more damage when enemy is has more life points
*/
public int encounterStrategy(People otherPerson)
{
int lifePoints = 0;
if(!this.getNation().equals(otherPerson.getNation())) // not from the same nation, else do nothing
{
if (otherPerson.getLifePoints() > this.getLifePoints()) // if enemy has more life points
lifePoints = this.getLifePoints() / 4;
else
lifePoints = this.getLifePoints() / 5;
}
return lifePoints;
}
}