diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 797acea..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ch/zhaw/catan/Bank.java b/src/ch/zhaw/catan/Bank.java
index 0eedb95..2bb84d7 100644
--- a/src/ch/zhaw/catan/Bank.java
+++ b/src/ch/zhaw/catan/Bank.java
@@ -1,5 +1,6 @@
package ch.zhaw.catan;
+import java.util.List;
import java.util.Map;
public class Bank {
@@ -10,6 +11,12 @@ public class Bank {
}
+ public void storeResourceToBank(List resourceToGive) {
+ for (Config.Resource resource : resourceToGive) {
+ resources.put(resource,resources.get(resource)+1);
+ }
+ }
+
public boolean getResourceFromBank(Config.Resource resource,int numberOfResources) {
if(resources.get(resource) >= numberOfResources) {
Integer newResourceNumber = resources.get(resource) - numberOfResources;
diff --git a/src/ch/zhaw/catan/Dummy.java b/src/ch/zhaw/catan/Dummy.java
index e9eb5db..ca1bbe2 100644
--- a/src/ch/zhaw/catan/Dummy.java
+++ b/src/ch/zhaw/catan/Dummy.java
@@ -18,7 +18,6 @@ public class Dummy {
private void run() {
TextIO textIO = TextIoFactory.getTextIO();
TextTerminal> textTerminal = textIO.getTextTerminal();
-
SiedlerBoard board = new SiedlerBoard();
board.addField(new Point(2, 2), Land.FOREST);
board.setCorner(new Point(3, 3), new Settlement(Config.Faction.RED));
diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java
index a02c74d..4ce4675 100644
--- a/src/ch/zhaw/catan/SiedlerGame.java
+++ b/src/ch/zhaw/catan/SiedlerGame.java
@@ -192,23 +192,25 @@ public class SiedlerGame {
* @return true, if the placement was successful
*/
public boolean buildSettlement(Point position) {
- //1. Check if Edge
+ //1. Check if Corner
if (!board.hasCorner(position)) {
// TODO: Error message
return false;
}
- //2. Check if Edge is empty
+ //2. Check if Corner is empty
if (board.getCorner(position) != null) {
// TODO: Error message
return false;
}
- //3. Can Player build road
+ //3. Can Player build Settlement
if (!allPlayers.get(activePlayer).buildSettlement()) {
// TODO: Error message
return false;
}
//4. Insert Road to map
board.setCorner(position, new Settlement(allPlayers.get(activePlayer).getFaction()));
+ //5. Give Resoure to bank
+ bank.storeResourceToBank(Config.Structure.SETTLEMENT.getCosts());
return true;
}
@@ -262,6 +264,8 @@ public class SiedlerGame {
}
//4. Insert Road to map
board.setEdge(roadStart, roadEnd, new Road(allPlayers.get(activePlayer).getFaction()));
+ //5. Give Resource to bank
+ bank.storeResourceToBank(Config.Structure.ROAD.getCosts());
return true;
}