forked from justinszaro/WarringNations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaxwellWarrior01.java
More file actions
executable file
·53 lines (43 loc) · 1.65 KB
/
MaxwellWarrior01.java
File metadata and controls
executable file
·53 lines (43 loc) · 1.65 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
/**
* Maxwell Warrior 1 when encountered runs away because they shouldn't be in the war
*
* @author Max Schuman, Elizabeth Vicente, Tanishq Iyer, Justin Szaro
* @version 3.0
* @since 2021-04-11
*/
public class MaxwellWarrior01 extends People {
/**
* Instantiates a MaxwellWarrior01 Object and establishes its properties.
* @param nation
* @param tribe
* @param lifePoints
*/
public MaxwellWarrior01(String nation, String tribe, int lifePoints) {
super(nation, tribe, PeopleType.warrior, lifePoints, "Max's Warrior");
myDescription = "\tMax's Warrior 01";
}
/**
* attaks as normal when encountering everyone except a wizard. If encounters wizard then runs from encounter
* @param otherPerson Other Person who is involved in the encounter
* @return
*/
@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()); // I am running away because i shouldn't be in this war
}
}
return numberOfLifePoints;
}}