-
Notifications
You must be signed in to change notification settings - Fork 1
/
Player.java
136 lines (128 loc) · 3.36 KB
/
Player.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
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
/**
* Class Player - is the class that keeps track of the users that are
* playing the game, their name, the country they chose to play as,
* the index of said country, and the number of moves they can make.
*
* @author Anurag, Aishwarya, Caroline, Serena
* @version June 5, 2018
*/
public class Player
{
private String myName;//stores the name of the player
private String countryName;// name of the country that the user plays as
private int countryIndex;// the index of their country in Map class's europe array
private int movementPoints;// tracks their moves, and in cohesion with gui allows turns to be taken
/**
* Constructor for objects of class Person - initializes the name of the player,
* the name of the country, and the index of the country
*
* @param name - a String that represents the user's name
* @param cName - a String that represents the user's country's name
* @param cIndex - an int that represents the index of user's country on Map class's europe arraylist
*
* author - Aishwarya
*/
public Player(String name, String cName, int cIndex)
{
myName = name;
countryName = cName;
countryIndex = cIndex;
movementPoints = 2;
}
/**
* <b>Summary: </b> a method that returns the user's name
*
* @param none
* @return myName user's name
*
* Author - Aishwarya
*/
public String getName()
{
return myName;
}
/**
* <b>Summary: </b> a method that returns the user's country's name
*
* @param none
* @return countryName user's country's name
*
* Author - Aishwarya
*/
public String getCountryName()
{
return countryName;
}
/**
* <b>Summary: </b> a method that returns the user's country's index
* on Map class's europe arraylist
*
* @param none
* @return countryIndex the user's country's index on arraylist europe
*
* Author - Aishwarya
*/
public int getCountryIndex()
{
return countryIndex;
}
/**
* <b>Summary: </b> a method that sets the number of movementpoints or
* turns the user has
*
* @param none
* @return none
*
* Author - Anurag
*/
public void startTurn()
{
movementPoints = 2;
}
/**
* <b>Summary: </b> a method that returns a boolean of
* whether the user has turns or not
*
* @param none
* @return true if movementPoints is greater than or equal to 0
*
* Author - Anurag
*/
public boolean hasMoreTurns()
{
if(movementPoints >= 0)
{
return true;
}
else
{
return false;
}
}
/**
* <b>Summary: </b> a method that removes movementPoints after
* user makes a move
*
* @param none
* @return none
*
* Author - Anurag
*/
public void makeMove()
{
movementPoints--;
}
/**
* <b>Summary: </b> a method that returns the user's number of movement
* points.
*
* @param none
* @return movementPoints the user's movementpoints
*
* Author - Anurag
*/
public int getMovementPoints()
{
return movementPoints;
}
}