Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
		
						commit
						09cb993b65
					
				| 
						 | 
					@ -0,0 +1,11 @@
 | 
				
			||||||
 | 
					<component name="ProjectCodeStyleConfiguration">
 | 
				
			||||||
 | 
					  <code_scheme name="Project" version="173">
 | 
				
			||||||
 | 
					    <JavaCodeStyleSettings>
 | 
				
			||||||
 | 
					      <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
 | 
				
			||||||
 | 
					      <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
 | 
				
			||||||
 | 
					      <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
 | 
				
			||||||
 | 
					        <value />
 | 
				
			||||||
 | 
					      </option>
 | 
				
			||||||
 | 
					    </JavaCodeStyleSettings>
 | 
				
			||||||
 | 
					  </code_scheme>
 | 
				
			||||||
 | 
					</component>
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,9 @@
 | 
				
			||||||
package ch.zhaw.catan;
 | 
					package ch.zhaw.catan;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
					 * This enum is used to define the Commandwords.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 | 
					 * @author Leonardo Brandenberger
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public enum Command {
 | 
					public enum Command {
 | 
				
			||||||
    NEXT_PLAYER("next player"), BUILD_SETTLEMENT("build settlement"), BUILD_CITY("build city"),
 | 
					    NEXT_PLAYER("next player"), BUILD_SETTLEMENT("build settlement"), BUILD_CITY("build city"),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,24 +2,50 @@ package ch.zhaw.catan;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ch.zhaw.hexboard.Label;
 | 
					import ch.zhaw.hexboard.Label;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Field Class stores Land and Label in Corresponding Field.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author Roman Schenk
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class Field {
 | 
					public class Field {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final Config.Land land;
 | 
					    private final Config.Land land;
 | 
				
			||||||
    private final Label label;
 | 
					    private final Label label;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Constructs field object that stores land and label object in Field.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param land  that will be stored in Field
 | 
				
			||||||
 | 
					     * @param label that will be stored in Field
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public Field(Config.Land land, Label label) {
 | 
					    public Field(Config.Land land, Label label) {
 | 
				
			||||||
        this.land = land;
 | 
					        this.land = land;
 | 
				
			||||||
        this.label = label;
 | 
					        this.label = label;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Returns the Resource type of the field.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return Config.Resource of the field
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public Config.Resource getResource() {
 | 
					    public Config.Resource getResource() {
 | 
				
			||||||
        return land.getResource();
 | 
					        return land.getResource();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Return the Land type of the field.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return Config.Land of the field
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public Config.Land getLand() {
 | 
					    public Config.Land getLand() {
 | 
				
			||||||
        return land;
 | 
					        return land;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Return the label of the field.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return Label of the field
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public Label getLabel() {
 | 
					    public Label getLabel() {
 | 
				
			||||||
        return label;
 | 
					        return label;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,7 @@ public class Parser {
 | 
				
			||||||
    public HashMap<String, Integer> gameStart() {
 | 
					    public HashMap<String, Integer> gameStart() {
 | 
				
			||||||
        HashMap<String, Integer> gameStartValues = new HashMap<>();
 | 
					        HashMap<String, Integer> gameStartValues = new HashMap<>();
 | 
				
			||||||
        gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(Config.MIN_NUMBER_OF_PLAYERS).withMaxVal(4).read("Number of players:"));
 | 
					        gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(Config.MIN_NUMBER_OF_PLAYERS).withMaxVal(4).read("Number of players:"));
 | 
				
			||||||
        gameStartValues.put("NumberOfWinPoints", textIO.newIntInputReader().withMinVal(5).withMaxVal(15).read("Winpoints needed for Victory:"));
 | 
					        gameStartValues.put("NumberOfWinPoints", textIO.newIntInputReader().withMinVal(3).read("Winpoints needed for Victory:"));
 | 
				
			||||||
        return gameStartValues;
 | 
					        return gameStartValues;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,7 +102,7 @@ public class Parser {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Outputs which player currently is at turn
 | 
					     * Outputs which player currently is at turn.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param faction the faction which turn it is
 | 
					     * @param faction the faction which turn it is
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -134,6 +134,7 @@ public class Parser {
 | 
				
			||||||
     * @param give if true ask for resource to give if false for resource to receive
 | 
					     * @param give if true ask for resource to give if false for resource to receive
 | 
				
			||||||
     * @return Config.Resource the resource the player would like to give or receive
 | 
					     * @return Config.Resource the resource the player would like to give or receive
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Config.Resource trade(boolean give) {
 | 
					    public Config.Resource trade(boolean give) {
 | 
				
			||||||
        String output = "give";
 | 
					        String output = "give";
 | 
				
			||||||
        if (!give) {
 | 
					        if (!give) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,11 +2,12 @@ package ch.zhaw.catan;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
//TODO Java Doc
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This class is here in order to maintain the resources of the players, the amount of structures that they can build,
 | 
					 * This class is here in order to maintain the resources of the players, the amount of structures that they can build,
 | 
				
			||||||
 * control to see if a player has enough to build a new structure and to add them into a faction.
 | 
					 * control to see if a player has enough to build a new structure and to add them into a faction.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author Leonardo Brandenberger, Roman Schrom, Andrin Fassbind, Stefan Amador
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class Player {
 | 
					public class Player {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,7 +113,6 @@ public class Player {
 | 
				
			||||||
     * @param list the list that shows how many resources are required.
 | 
					     * @param list the list that shows how many resources are required.
 | 
				
			||||||
     * @return true if the player has enough resources to build and return false if he doesn't.
 | 
					     * @return true if the player has enough resources to build and return false if he doesn't.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    //returns true if player has enough resources else false
 | 
					 | 
				
			||||||
    private boolean checkResourceToBuild(List<Config.Resource> list) {
 | 
					    private boolean checkResourceToBuild(List<Config.Resource> list) {
 | 
				
			||||||
        HashMap<Config.Resource, Integer> costs = new HashMap<>();
 | 
					        HashMap<Config.Resource, Integer> costs = new HashMap<>();
 | 
				
			||||||
        for (Config.Resource resource : list) {
 | 
					        for (Config.Resource resource : list) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue