forked from justinszaro/WarringNations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElizabethWarrior.java
More file actions
58 lines (48 loc) · 2.13 KB
/
ElizabethWarrior.java
File metadata and controls
58 lines (48 loc) · 2.13 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 Elizabeth Warrior is a warrior, that will fight an opponent warrior , heal their members, run from wizards and steal health from healers
* @author Max Schuman, Elizabeth Vicente, Tanishq Iyer, Justin Szaro
* @version 3.0
* @since 2021-04-11
*/
public class ElizabethWarrior extends People {
public ElizabethWarrior(String nation, String tribe, int lifePoints) {
super(nation, tribe, PeopleType.warrior, lifePoints, "Elizabeth's Warrior");
myDescription = "\tElizabeth Warrior";
}
/*** If we are from the same nation check our tribe and I have more life ponts than them, return a negative value
* If we are from different nations
* Encounter Wizard- Run Away
* Encounter Warrior- Fight depending on who has more lifepoints
* Encounter Healer- Take all their health*/
@Override
public int encounterStrategy(People otherPerson) {
int numberOfLifePoints = 0;
if(this.getNation().equals(otherPerson.getNation())){
if(this.getLifePoints() > otherPerson.getLifePoints()) {
if (otherPerson.getTribe().equals(this.getTribe())) {
numberOfLifePoints = -(this.getLifePoints()/2 - otherPerson.getLifePoints()-2);
}
else{
numberOfLifePoints = -(this.getLifePoints()/3 - otherPerson.getLifePoints()/2);
}
}
}
else{
if(otherPerson.getType() == PeopleType.wizard){
numberOfLifePoints = -(this.getLifePoints());
}
else if(otherPerson.getType() == PeopleType.warrior) {
if(otherPerson.getLifePoints() > this.getLifePoints()){
numberOfLifePoints = this.getLifePoints() - otherPerson.getLifePoints();
}
else{
numberOfLifePoints = this.getLifePoints() - 5 + otherPerson.getLifePoints()/4;
}
}
else if(otherPerson.getType() == PeopleType.cleric){
numberOfLifePoints = this.getLifePoints();
}
}
return numberOfLifePoints;
}
}