changes in mainMethod

This commit is contained in:
schrom01 2021-12-02 19:13:16 +01:00
parent 0c63540616
commit 1362850570
1 changed files with 10 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import org.beryx.textio.TextIoFactory;
import org.beryx.textio.TextTerminal;
import java.util.HashMap;
import java.util.Random;
import static ch.zhaw.catan.Command.*;
import static ch.zhaw.catan.Command.QUIT;
@ -17,13 +18,22 @@ public class Siedler {
Parser parser = new Parser();
SiedlerGame game = foundingPhase(parser);
boolean running = true;
boolean diceThrown = false;
while (running){
parser.displayGameboard(game.getBoard().getTextView());
parser.playerTurn(game.getCurrentPlayerFaction());
if(!diceThrown) {
Random random = new Random();
int thrownDices = random.nextInt(6) + random.nextInt(6);
parser.thrownDices(thrownDices);
//todo resourcen auszahlen
diceThrown = true;
}
parser.displayPlayerResourceStock(game.getCurruntPlayerResource());
switch (parser.getAction()) {
case NEXTPLAYER:
game.switchToNextPlayer();
diceThrown = false;
break;
case BUILDSETTLEMENT:
parser.giveCoordinatesForStructures(Config.Structure.SETTLEMENT);