-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPeople.java
More file actions
executable file
·158 lines (142 loc) · 4.24 KB
/
People.java
File metadata and controls
executable file
·158 lines (142 loc) · 4.24 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package Project01;
import Project01.PeopleType;
/**
* People class:
* This class is for:
* - assigning and tracking the information of a person
* (see Tribe class for example of it being used)
* (their nation's name, tribe name, their description, and current life point value)
* - tracking if a person is still alive
*
* the description comes from PeopleType, and is what class they are (Warrior, Healer, Wizard)
*
* Note that individual people are not named. The variable for it exists, but is never implemented.
*
* "encounterStrategy" has yet to be implemented, but has a description of what it should be doing.
*
*/
public class People
{
/**
* Variable for personName exists, but is never used
*/
private String personName;
private String myNation;
private String myTribe;
private PeopleType me;
private String myDescription;
private int myLifePoints;
/**
* Gets the details of a person (nation and tribe names, descriptions, and life points)
*
* @param nation
* Stores the name of the nation
* @param tribe
* Stores the name of the tribe
* @param person
* Stores a single person
* @param lifePoints
* the person's current life point value
*
* myDescription uses the description value for person under the PeopleType class
* (Warrior, Healer, Wizard)
*/
public People(String nation, String tribe, PeopleType person, int lifePoints)
{
myNation = nation;
myTribe = tribe;
me = person;
myDescription = me.getDescription();
myLifePoints = lifePoints;
}
/**
*
* @return
* gets the person's class from PeopleType (Warrior, Healer, etc.)
*/
public PeopleType getType()
{
return me;
}
/**
*
* @return
* gets the tribe name
*/
public String getTribe()
{
return myTribe;
}
/**
*
* @return
* gets the nation name
*/
public String getNation()
{
return myNation;
}
/**
*
* @return
* checks if the person's current life point value is greater then 0
*/
public Boolean isPersonAlive()
{
return (myLifePoints > 0);
}
/**
*
* @return
* gets current life point value
*/
public int getLifePoints()
{
return myLifePoints;
}
/**
* @param otherPerson
* - not yet implemented
* - Describes priorities on what should be occurring
* - Groups come from a single tribe
* - Groups can capture other groups, with lower life point values
* - Captured opponents are less efficient (attack and heal for lower values)
* - If they other person is from the same nation, then healers will heal normally
*/
public void encounterStrategy(People otherPerson)
{
if(myNation == otherPerson.getNation())
{
// There will be an ugly confrontation
// Groups attack groups. Group can be an individual or several individuals from any set of tribes
// if a group has enough lifePoints it can capture its opponent and make it part of the group.
// Captured opponents do not fight or heal very well. The healers can heal people from same nation
// normally.
}
else
{
// there will be a peaceful confrontation
// warriors - warrior ignore each other if different tribes increase life points
// healer - healer ignore each other
// healer - warrior - healer can heal warrior. Heals warrior from same tribe better
}
}
/**
* @param points
* reduces a nation's current amount of life points by the value in the parameter
*/
public void reduceLifePoints(int points)
{
myLifePoints = myLifePoints - points;
}
/**
* @return
* returns an overall profile of nation, including the nation name, the tribes, people, a description,
* and the amount of life points left. Sort of like a "current status" for the nation.
*/
public String toString()
{
String result = new String( myNation + "\t" + myTribe + "\t" + me + "\t" + myDescription + "\t" + myLifePoints);
return result;
}
}