added Method handleDiceThrow7 in SiedlerGame
This commit is contained in:
parent
7129435fea
commit
f6865451a6
|
@ -198,6 +198,10 @@ public class SiedlerGame {
|
||||||
* @return the resource cards added to the stock of the different players
|
* @return the resource cards added to the stock of the different players
|
||||||
*/
|
*/
|
||||||
public Map<Faction, List<Resource>> throwDice(int dicethrow) {
|
public Map<Faction, List<Resource>> throwDice(int dicethrow) {
|
||||||
|
if (dicethrow == 7) {
|
||||||
|
handleDiceThrow7();
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
Map<Faction, List<Resource>> returnMap = new HashMap<>();
|
Map<Faction, List<Resource>> returnMap = new HashMap<>();
|
||||||
List<Point> diceValueFields = board.getFieldsForDiceValue(dicethrow);
|
List<Point> diceValueFields = board.getFieldsForDiceValue(dicethrow);
|
||||||
for (Player player : allPlayers) {
|
for (Player player : allPlayers) {
|
||||||
|
@ -212,6 +216,23 @@ public class SiedlerGame {
|
||||||
}
|
}
|
||||||
return returnMap;
|
return returnMap;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleDiceThrow7() {
|
||||||
|
for(Player player : allPlayers) {
|
||||||
|
HashMap<Resource, Integer> resources = player.getResources();
|
||||||
|
int countResources = 0;
|
||||||
|
for(Resource resource : resources.keySet()){
|
||||||
|
countResources += resources.get(resource);
|
||||||
|
}
|
||||||
|
if(countResources > 7){
|
||||||
|
int newCountResources = countResources / 2;
|
||||||
|
ArrayList<Resource> resourceArrayList = new ArrayList<>();
|
||||||
|
//for(Resource resource : ) todo complete
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a settlement at the specified position on the board.
|
* Builds a settlement at the specified position on the board.
|
||||||
|
@ -431,7 +452,7 @@ public class SiedlerGame {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(getLongestRoadFaction() == getCurrentPlayerFaction()){
|
if(getLongestRoadFaction() == getCurrentPlayerFaction()){
|
||||||
winPoints = winPoints + 2;
|
winPoints += 2;
|
||||||
}
|
}
|
||||||
return winPoints;
|
return winPoints;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue