diff --git a/.idea/misc.xml b/.idea/misc.xml index c3dfb30..b573818 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java index 63490f3..965f7fd 100644 --- a/src/ch/zhaw/catan/Player.java +++ b/src/ch/zhaw/catan/Player.java @@ -1,6 +1,6 @@ package ch.zhaw.catan; -import java.util.ArrayList; +import java.util.HashMap; /** * New Class PLayer @@ -11,10 +11,51 @@ public class Player { private String name; private Config.Faction faction; - private Config.Resource resource; + private HashMap resources; + private int roadsToUse; + private int settlementsToUse; public Player (String name, Config.Faction faction){ - this.name = new name(" "); + //Datenfelder + this.name = name; + this.faction = faction; + roadsToUse = Config.Structure.ROAD.getStockPerPlayer(); + settlementsToUse = Config.Structure.SETTLEMENT.getStockPerPlayer(); + //Ressourcen initialisiern + resources = new HashMap<>(); + for(Config.Resource resource : Config.Resource.values()) { + resources.put(resource,0); + } } + + /** + * This method returns all the resources the player has at the moment + * @return HashMap + */ + public HashMap getResources() { + return resources; + } + + + public boolean buildRoad() { + if (roadsToUse > 0) { + roadsToUse--; + return true; + } + return false; + + } + + + public boolean buildSettlement() { + if (settlementsToUse > 0) { + settlementsToUse--; + return true; + } + return false; + } + + + } diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 9c3ea12..7610db4 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -16,5 +16,7 @@ public class Siedler { TextTerminal textTerminal = textIO.getTextTerminal(); textTerminal.println(game.getBoard().getTextView()); + + } } diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 695b23a..b76c075 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -24,7 +24,9 @@ public class SiedlerGame { static final int FOUR_TO_ONE_TRADE_OFFER = 4; static final int FOUR_TO_ONE_TRADE_WANT = 1; - SiedlerBoard board; + private SiedlerBoard board; + private Player[] allPlayers; + private int winPoints; /** * Constructs a SiedlerGame game state object. @@ -38,6 +40,8 @@ public class SiedlerGame { public SiedlerGame(int winPoints, int numberOfPlayers) { board = new SiedlerBoard(); board.createFixGamefield(); + allPlayers = new Player[numberOfPlayers]; + this.winPoints = winPoints; } /** @@ -69,6 +73,9 @@ public class SiedlerGame { */ public List getPlayerFactions() { // TODO: Implement + Faction[] factions = new Faction[allPlayers.length]; + + return Collections.emptyList(); }