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,8 +25,9 @@ public class Parser {
textTerminal.println(gameboard); textTerminal.println(gameboard);
} }
public void displayPlayerResourceStock(HashMap<Config.Resource, Integer> currentPlayerResource){ public void displayPlayerInfo(HashMap<Config.Resource, Integer> currentPlayerResource, int winpoints){
textTerminal.println("You own the follwing Resources"); textTerminal.println("You are currently holding" + winpoints + " winpoints.");
textTerminal.println("You own the follwing resources:");
for(Config.Resource resource : currentPlayerResource.keySet()){ for(Config.Resource resource : currentPlayerResource.keySet()){
textTerminal.println(resource.name() + ":" + currentPlayerResource.get(resource)); textTerminal.println(resource.name() + ":" + currentPlayerResource.get(resource));
} }
@ -66,6 +67,11 @@ public class Parser {
return textIO.newEnumInputReader(Command.class).read("What would you like to do?"); 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) { public Config.Resource trade(boolean give) {
String output = "give"; String output = "give";
if (!give){ if (!give){
@ -73,5 +79,10 @@ public class Parser {
} }
return textIO.newEnumInputReader(Config.Resource.class).read("Which Resource would you like to " + output ); 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); return allPlayers.get(activePlayer).getSpecificResource(resource);
} }
public HashMap<Resource, Integer> getCurruntPlayerResource() { public HashMap<Resource, Integer> getCurrentPlayerResource() {
return allPlayers.get(activePlayer).getResources(); return allPlayers.get(activePlayer).getResources();
} }