moved handleDiceThrow7 in Player.java

This commit is contained in:
schrom01 2021-12-04 17:03:51 +01:00
parent 79a0b9175e
commit 6bd4f1dcbe
3 changed files with 17 additions and 18 deletions

View File

@ -146,4 +146,16 @@ public class Player {
return true; return true;
} }
public void handleDiceThrow7() {
int countResources = 0;
for(Config.Resource resource : resources.keySet()){
countResources += resources.get(resource);
}
if(countResources > 7){
int newCountResources = countResources / 2;
ArrayList<Config.Resource> resourceArrayList = new ArrayList<>();
//for(Resource resource : ) todo complete
}
}
} }

View File

@ -14,7 +14,7 @@ public class Siedler {
boolean diceThrown = false; boolean diceThrown = false;
while (running){ while (running){
Config.Faction currentPlayerFaction = game.getCurrentPlayerFaction(); Config.Faction currentPlayerFaction = game.getCurrentPlayerFaction();
parser.displayGameboard(game.getBoard().getTextView()); parser.displayGameboard(game.getBoard().getTextView()); //todo jedesmal ausgeben? oder nur wenn neuer Spieler oder separater Befehl?
parser.playerTurn(currentPlayerFaction); parser.playerTurn(currentPlayerFaction);
if(!diceThrown) { if(!diceThrown) {
throwDice(game, parser); throwDice(game, parser);

View File

@ -203,7 +203,9 @@ public class SiedlerGame {
*/ */
public Map<Faction, List<Resource>> throwDice(int dicethrow) { public Map<Faction, List<Resource>> throwDice(int dicethrow) {
if (dicethrow == 7) { if (dicethrow == 7) {
handleDiceThrow7(); for(Player player : allPlayers) {
player.handleDiceThrow7();
}
} else { } 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);
@ -224,21 +226,6 @@ public class SiedlerGame {
} }
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.