forked from katylikeskats/Old-Polytopia-Game
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
51 lines (43 loc) · 1.36 KB
/
Player.java
File metadata and controls
51 lines (43 loc) · 1.36 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
import java.util.ArrayList;
import java.util.Iterator; //When does the iterator reset to start
public class Player {
String tribe;
int currency;
ArrayList<String> technology;
ArrayList<City> cities = new ArrayList<City>();
Iterator<City> itr = cities.iterator();
boolean[][] mask;
Interactions handler;
Player(String tribe, Space[][] map){
this.tribe = tribe;
mask = new boolean[map.length][map.length];
handler = new Interactions(map);
}
public void addCity(int r, int c) {
cities.add(new City(r, c, false));
}
public void removeCity(City desiredCity) {
City city;
while (itr.hasNext()) {
city = itr.next();
if ((desiredCity.getR() == city.getR()) && (desiredCity.getC() == city.getC())) {
cities.remove(city);
}
}
}
public void turnCurrencyIncrease() { //Calculate star increase for a given turn (at a given moment)
int currencyIncrease = 0;
City city;
while (itr.hasNext()) {
city = itr.next();
if (city.isCapital()) {
currencyIncrease += (city.getLevel() + 1);
} else {
currencyIncrease += city.getLevel();
}
}
currency += currencyIncrease;
}
public void turn() {
}
}