added Method handleDiceThrow7 in SiedlerGame
This commit is contained in:
parent
7129435fea
commit
f6865451a6
|
@ -198,21 +198,42 @@ 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) {
|
||||||
Map<Faction,List<Resource>> returnMap= new HashMap<>();
|
if (dicethrow == 7) {
|
||||||
List<Point> diceValueFields = board.getFieldsForDiceValue(dicethrow);
|
handleDiceThrow7();
|
||||||
for (Player player : allPlayers) {
|
return null;
|
||||||
returnMap.put(player.getFaction(), new ArrayList());
|
} else {
|
||||||
for (Point field : diceValueFields) {
|
Map<Faction, List<Resource>> returnMap = new HashMap<>();
|
||||||
List<Resource> resources= board.getResourcesforFaction(field,player.getFaction());
|
List<Point> diceValueFields = board.getFieldsForDiceValue(dicethrow);
|
||||||
for (Config.Resource resource : resources){
|
for (Player player : allPlayers) {
|
||||||
returnMap.get(player.getFaction()).add(resource);
|
returnMap.put(player.getFaction(), new ArrayList());
|
||||||
player.addResource(resource,1);
|
for (Point field : diceValueFields) {
|
||||||
|
List<Resource> resources = board.getResourcesforFaction(field, player.getFaction());
|
||||||
|
for (Config.Resource resource : resources) {
|
||||||
|
returnMap.get(player.getFaction()).add(resource);
|
||||||
|
player.addResource(resource, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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