From 0c635406169d7ae0b590d2dd16c357eb805a0a75 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 19:05:14 +0100 Subject: [PATCH] changes in mainMethod added Method displayPlayerResourceStock to Parser --- src/ch/zhaw/catan/Parser.java | 7 +++++++ src/ch/zhaw/catan/Siedler.java | 4 ++-- src/ch/zhaw/catan/SiedlerGame.java | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index eb15669..933532d 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -25,6 +25,13 @@ public class Parser { textTerminal.println(gameboard); } + public void displayPlayerResourceStock(HashMap curruntPlayerResource){ + textTerminal.println("You own the follwing Resources"); + for(Config.Resource resource : curruntPlayerResource.keySet()){ + textTerminal.println(resource.name() + ":" + curruntPlayerResource.get(resource)); + } + } + public HashMap gameStart(){ HashMap gameStartValues = new HashMap<>(); gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(2).withMaxVal(4).read("Number of players:")); diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 7f21096..6c39048 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -16,11 +16,11 @@ public class Siedler { //Spiel erstellen Parser parser = new Parser(); SiedlerGame game = foundingPhase(parser); - boolean running = true; while (running){ + parser.displayGameboard(game.getBoard().getTextView()); parser.playerTurn(game.getCurrentPlayerFaction()); - + parser.displayPlayerResourceStock(game.getCurruntPlayerResource()); switch (parser.getAction()) { case NEXTPLAYER: game.switchToNextPlayer(); diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 23dbe75..9559984 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -130,6 +130,10 @@ public class SiedlerGame { return allPlayers.get(activePlayer).getSpecificResource(resource); } + public HashMap getCurruntPlayerResource() { + return allPlayers.get(activePlayer).getResources(); + } + /** * Places a settlement in the founder's phase (phase II) of the game. *