Delected CommandWords.java

added quit Method in Parser
Fixed minor grammar mistakes in Siedler Game
This commit is contained in:
Leonardo Brandenberger 2021-12-03 08:48:26 +01:00
parent 57649df6ba
commit ff734bce23
3 changed files with 15 additions and 8 deletions

View File

@ -1,4 +0,0 @@
package ch.zhaw.catan;
public class CommandWords {
}

View File

@ -25,15 +25,16 @@ public class Parser {
textTerminal.println(gameboard);
}
public void displayPlayerResourceStock(HashMap<Config.Resource, Integer> currentPlayerResource){
textTerminal.println("You own the follwing Resources");
public void displayPlayerInfo(HashMap<Config.Resource, Integer> 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<String, Integer> 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();
}
}

View File

@ -130,7 +130,7 @@ public class SiedlerGame {
return allPlayers.get(activePlayer).getSpecificResource(resource);
}
public HashMap<Resource, Integer> getCurruntPlayerResource() {
public HashMap<Resource, Integer> getCurrentPlayerResource() {
return allPlayers.get(activePlayer).getResources();
}