From ff734bce2355949630f6fd8b47ef92a51d38679e Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 3 Dec 2021 08:48:26 +0100 Subject: [PATCH] Delected CommandWords.java added quit Method in Parser Fixed minor grammar mistakes in Siedler Game --- src/ch/zhaw/catan/CommandWords.java | 4 ---- src/ch/zhaw/catan/Parser.java | 17 ++++++++++++++--- src/ch/zhaw/catan/SiedlerGame.java | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) delete mode 100644 src/ch/zhaw/catan/CommandWords.java diff --git a/src/ch/zhaw/catan/CommandWords.java b/src/ch/zhaw/catan/CommandWords.java deleted file mode 100644 index d67b327..0000000 --- a/src/ch/zhaw/catan/CommandWords.java +++ /dev/null @@ -1,4 +0,0 @@ -package ch.zhaw.catan; - -public class CommandWords { -} diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 6421d23..1a4c6dd 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -25,15 +25,16 @@ public class Parser { textTerminal.println(gameboard); } - public void displayPlayerResourceStock(HashMap currentPlayerResource){ - textTerminal.println("You own the follwing Resources"); + public void displayPlayerInfo(HashMap currentPlayerResource, int winpoints){ + textTerminal.println("You are currently holding" + winpoints + " winpoints."); + textTerminal.println("You own the follwing resources:"); for(Config.Resource resource : currentPlayerResource.keySet()){ textTerminal.println(resource.name() + ":" + currentPlayerResource.get(resource)); } } public void displayWinnertext(Config.Faction winner){ - textTerminal.println(winner.name() + "won the game!"); + textTerminal.println(winner.name() + " won the game!"); } public HashMap gameStart(){ @@ -66,6 +67,11 @@ public class Parser { return textIO.newEnumInputReader(Command.class).read("What would you like to do?"); } + /** + * + * @param give if true ask for resource to give if false for resource to receive + * @return + */ public Config.Resource trade(boolean give) { String output = "give"; if (!give){ @@ -73,5 +79,10 @@ public class Parser { } return textIO.newEnumInputReader(Config.Resource.class).read("Which Resource would you like to " + output ); } + public void quit(){ + textTerminal.dispose(); + textIO.dispose(); + } + } diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 9559984..ff80402 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -130,7 +130,7 @@ public class SiedlerGame { return allPlayers.get(activePlayer).getSpecificResource(resource); } - public HashMap getCurruntPlayerResource() { + public HashMap getCurrentPlayerResource() { return allPlayers.get(activePlayer).getResources(); }