From 1362850570b63bab60a130b235e9c02abd350c7f Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 19:13:16 +0100 Subject: [PATCH] changes in mainMethod --- src/ch/zhaw/catan/Siedler.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 6c39048..f5dd522 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -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);