forked from justinszaro/WarringNations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustinWarrior1.java
More file actions
58 lines (55 loc) · 1.78 KB
/
JustinWarrior1.java
File metadata and controls
58 lines (55 loc) · 1.78 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* The Justin Warrior 1 gives a lifepoint to members of its own nation. If the opponent is of another nation, the
* warrior will use as many lifepoints as it has or the same number of opponents lifepoints if its health is less.
*
* @author Max Schuman, Elizabeth Vicente, Tanishq Iyer, Justin Szaro
* @version 3.0
* @since 2021-04-11
*/
public class JustinWarrior1 extends People
{
/**
* Instantiates a JustinWarrior1 Object and establishes its properties.
* @param nation the nations name
* @param tribe the tribes name
* @param lifePoints the number of lifepoints
*/
JustinWarrior1(String nation, String tribe, int lifePoints)
{
super(nation, tribe, PeopleType.warrior, lifePoints, "Justin's Warrior");
myDescription = "\tJustin Warrior";
}
/**
* Returns the number of lifepoints to be used in the encounter.
* @param otherPerson Other Person who is involved in the encounter
* @return lifepoints number of lifepoints to be used in the encounter.
*/
public int encounterStrategy(People otherPerson)
{
int lifePoints = 0;
if(this.getNation().equals(otherPerson.getNation()))
{
if(otherPerson.getLifePoints() < this.getLifePoints())
{
if(otherPerson.getTribe().equals(this.getTribe()))
{
lifePoints = -1;
}
}
}
else
{
int points;
points = this.getLifePoints() - otherPerson.getLifePoints();
if (points > 0)
{
lifePoints = otherPerson.getLifePoints();
}
else
{
lifePoints = this.getLifePoints();
}
}
return lifePoints;
}
}