added Method handleDiceThrow7 in SiedlerGame

This commit is contained in:
schrom01 2021-12-04 13:20:09 +01:00
parent 7129435fea
commit f6865451a6
1 changed files with 32 additions and 11 deletions

View File

@ -198,6 +198,10 @@ public class SiedlerGame {
* @return the resource cards added to the stock of the different players
*/
public Map<Faction, List<Resource>> throwDice(int dicethrow) {
if (dicethrow == 7) {
handleDiceThrow7();
return null;
} else {
Map<Faction, List<Resource>> returnMap = new HashMap<>();
List<Point> diceValueFields = board.getFieldsForDiceValue(dicethrow);
for (Player player : allPlayers) {
@ -212,6 +216,23 @@ public class SiedlerGame {
}
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.
@ -431,7 +452,7 @@ public class SiedlerGame {
}
}
if(getLongestRoadFaction() == getCurrentPlayerFaction()){
winPoints = winPoints + 2;
winPoints += 2;
}
return winPoints;
}