change in Main Method
This commit is contained in:
parent
2de44a1b99
commit
060310aebc
|
@ -32,6 +32,10 @@ public class Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void displayWinnertext(Config.Faction winner){
|
||||||
|
textTerminal.println(winner.name() + "won the game!");
|
||||||
|
}
|
||||||
|
|
||||||
public HashMap<String, Integer> gameStart(){
|
public HashMap<String, Integer> gameStart(){
|
||||||
HashMap<String, Integer> gameStartValues = new HashMap<>();
|
HashMap<String, Integer> gameStartValues = new HashMap<>();
|
||||||
gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(2).withMaxVal(4).read("Number of players:"));
|
gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(2).withMaxVal(4).read("Number of players:"));
|
||||||
|
|
|
@ -29,9 +29,15 @@ public class Siedler {
|
||||||
parser.displayPlayerResourceStock(game.getCurruntPlayerResource());
|
parser.displayPlayerResourceStock(game.getCurruntPlayerResource());
|
||||||
switch (parser.getAction()) {
|
switch (parser.getAction()) {
|
||||||
case NEXTPLAYER:
|
case NEXTPLAYER:
|
||||||
|
Config.Faction winner = game.getWinner();
|
||||||
|
if(winner == null) {
|
||||||
game.switchToNextPlayer();
|
game.switchToNextPlayer();
|
||||||
diceThrown = false;
|
diceThrown = false;
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
parser.displayWinnertext(winner);
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
case BUILDSETTLEMENT:
|
case BUILDSETTLEMENT:
|
||||||
parser.giveCoordinatesForStructures(Config.Structure.SETTLEMENT);
|
parser.giveCoordinatesForStructures(Config.Structure.SETTLEMENT);
|
||||||
game.buildSettlement(parser.getPoint());
|
game.buildSettlement(parser.getPoint());
|
||||||
|
@ -53,18 +59,12 @@ public class Siedler {
|
||||||
break;
|
break;
|
||||||
case QUIT:
|
case QUIT:
|
||||||
running = false;
|
running = false;
|
||||||
//todo clone windows
|
//todo close window
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
parser.errorMessage();
|
parser.errorMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void throwDice(SiedlerGame game, Parser parser) {
|
private static void throwDice(SiedlerGame game, Parser parser) {
|
||||||
|
|
Loading…
Reference in New Issue