updated javaodoc SiedlerGame
updated constructor SiedlerGame
This commit is contained in:
parent
faca966394
commit
0ea44905e2
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -8,10 +8,8 @@ package ch.zhaw.catan;
|
|||
public enum Command {
|
||||
NEXT_PLAYER("next player"), BUILD_SETTLEMENT("build settlement"), BUILD_CITY("build city"),
|
||||
BUILD_ROAD("build road"), TRADE_WITH_BANK("trade with bank"), QUIT("quit");
|
||||
|
||||
private final String commandWord;
|
||||
|
||||
|
||||
Command(String commandWord) {
|
||||
this.commandWord = commandWord;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,11 @@ import java.util.List;
|
|||
*/
|
||||
public class Player {
|
||||
|
||||
/**
|
||||
* faction: The faction of the player
|
||||
* resources: The resources the player owns
|
||||
* structureToUse: The structures a player can build.
|
||||
*/
|
||||
private final Config.Faction faction;
|
||||
private final HashMap<Config.Resource, Integer> resources;
|
||||
private final HashMap<Config.Structure, Integer> structureToUse;
|
||||
|
|
|
@ -5,12 +5,11 @@ import ch.zhaw.hexboard.HexBoardTextView;
|
|||
|
||||
/**
|
||||
* This Class extends the Class HexBoardTextView
|
||||
*
|
||||
*/
|
||||
public class SiedlerBoardTextView extends HexBoardTextView<Land, Settlement, Road, String> {
|
||||
|
||||
public SiedlerBoardTextView(SiedlerBoard board) {
|
||||
super(board);
|
||||
}
|
||||
public SiedlerBoardTextView(SiedlerBoard board) {
|
||||
super(board);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,9 +32,6 @@ public class SiedlerGame {
|
|||
* or players is not between two and four
|
||||
*/
|
||||
public SiedlerGame(int winPoints, int numberOfPlayers) {
|
||||
if (winPoints < 3 || numberOfPlayers < Config.MIN_NUMBER_OF_PLAYERS || numberOfPlayers > 4) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
bank = new Bank();
|
||||
board = new SiedlerBoard();
|
||||
board.createFixGameField();
|
||||
|
@ -75,8 +72,8 @@ public class SiedlerGame {
|
|||
/**
|
||||
* This methode is used to add resources to the player.
|
||||
*
|
||||
* @param player the active Player
|
||||
* @param resource the resource to add
|
||||
* @param player the active Player
|
||||
* @param resource the resource to add
|
||||
* @param numberToAdd the quantity of resources to add
|
||||
* @return true if resource has been added else false
|
||||
*/
|
||||
|
@ -91,8 +88,8 @@ public class SiedlerGame {
|
|||
/**
|
||||
* This methode is used to subtract resources from Player
|
||||
*
|
||||
* @param player the active player
|
||||
* @param resource the resource to subtract
|
||||
* @param player the active player
|
||||
* @param resource the resource to subtract
|
||||
* @param numberToSubtract the quantity of resource to subtract
|
||||
* @return true if resource has been subtracted
|
||||
*/
|
||||
|
@ -154,6 +151,11 @@ public class SiedlerGame {
|
|||
return allPlayers.get(activePlayer).getSpecificResource(resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resources of the current player.
|
||||
*
|
||||
* @return a hashmap with all resources the player has. Key: Resource name Value: number of resources
|
||||
*/
|
||||
public HashMap<Config.Resource, Integer> getCurrentPlayerResource() {
|
||||
return allPlayers.get(activePlayer).getResources();
|
||||
}
|
||||
|
|
|
@ -311,6 +311,8 @@ public class SiedlerGameTest {
|
|||
game.placeInitialRoad(secondRoad.first, secondRoad.second);
|
||||
}
|
||||
|
||||
System.out.println(game.getBoard().getTextView());
|
||||
|
||||
return game;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue