summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2016-12-22 14:47:04 +0100
committerjbion <joffrey.bion@amadeus.com>2016-12-22 14:47:04 +0100
commit66bec3838bb82cf3109de9a5a688603f84dee528 (patch)
treeb1a441b3b331b14ff62d676ab293ca0ceb5877c4 /src/main
parentAdd HandCard doc (diff)
downloadseven-wonders-66bec3838bb82cf3109de9a5a688603f84dee528.tar.gz
seven-wonders-66bec3838bb82cf3109de9a5a688603f84dee528.tar.bz2
seven-wonders-66bec3838bb82cf3109de9a5a688603f84dee528.zip
Add BoughtResources representation
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java2
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/Game.java1
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/api/BoughtResources.java27
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/api/Move.java (renamed from src/main/java/org/luxons/sevenwonders/game/Move.java)25
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/api/MoveType.java (renamed from src/main/java/org/luxons/sevenwonders/game/MoveType.java)2
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/api/Table.java1
6 files changed, 41 insertions, 17 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java b/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java
index 8fd809a0..66ab8691 100644
--- a/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java
+++ b/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java
@@ -1,6 +1,6 @@
package org.luxons.sevenwonders.actions;
-import org.luxons.sevenwonders.game.Move;
+import org.luxons.sevenwonders.game.api.Move;
public class PrepareCardAction {
diff --git a/src/main/java/org/luxons/sevenwonders/game/Game.java b/src/main/java/org/luxons/sevenwonders/game/Game.java
index 9023a80f..dd98f421 100644
--- a/src/main/java/org/luxons/sevenwonders/game/Game.java
+++ b/src/main/java/org/luxons/sevenwonders/game/Game.java
@@ -7,6 +7,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
+import org.luxons.sevenwonders.game.api.Move;
import org.luxons.sevenwonders.game.api.PlayerTurnInfo;
import org.luxons.sevenwonders.game.api.Table;
import org.luxons.sevenwonders.game.boards.Board;
diff --git a/src/main/java/org/luxons/sevenwonders/game/api/BoughtResources.java b/src/main/java/org/luxons/sevenwonders/game/api/BoughtResources.java
new file mode 100644
index 00000000..01277cab
--- /dev/null
+++ b/src/main/java/org/luxons/sevenwonders/game/api/BoughtResources.java
@@ -0,0 +1,27 @@
+package org.luxons.sevenwonders.game.api;
+
+import org.luxons.sevenwonders.game.boards.Provider;
+import org.luxons.sevenwonders.game.resources.Resources;
+
+public class BoughtResources {
+
+ private Provider provider;
+
+ private Resources resources;
+
+ public Provider getProvider() {
+ return provider;
+ }
+
+ public void setProvider(Provider provider) {
+ this.provider = provider;
+ }
+
+ public Resources getResources() {
+ return resources;
+ }
+
+ public void setResources(Resources resources) {
+ this.resources = resources;
+ }
+}
diff --git a/src/main/java/org/luxons/sevenwonders/game/Move.java b/src/main/java/org/luxons/sevenwonders/game/api/Move.java
index f1fa97aa..223f6615 100644
--- a/src/main/java/org/luxons/sevenwonders/game/Move.java
+++ b/src/main/java/org/luxons/sevenwonders/game/api/Move.java
@@ -1,10 +1,7 @@
-package org.luxons.sevenwonders.game;
+package org.luxons.sevenwonders.game.api;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.luxons.sevenwonders.game.api.Table;
-import org.luxons.sevenwonders.game.resources.Resources;
+import java.util.ArrayList;
+import java.util.List;
public class Move {
@@ -12,9 +9,9 @@ public class Move {
private String cardName;
- private MoveType moveType;
+ private MoveType type;
- private Map<Integer, Resources> boughtResources = new HashMap<>();
+ private List<BoughtResources> boughtResources = new ArrayList<>();
public int getPlayerIndex() {
return playerIndex;
@@ -33,23 +30,23 @@ public class Move {
}
public MoveType getType() {
- return moveType;
+ return type;
}
- public void setMoveType(MoveType moveType) {
- this.moveType = moveType;
+ public void setType(MoveType type) {
+ this.type = type;
}
- public Map<Integer, Resources> getBoughtResources() {
+ public List<BoughtResources> getBoughtResources() {
return boughtResources;
}
- public void setBoughtResources(Map<Integer, Resources> boughtResources) {
+ public void setBoughtResources(List<BoughtResources> boughtResources) {
this.boughtResources = boughtResources;
}
public boolean isValid(Table table) {
- if (moveType == MoveType.DISCARD) {
+ if (type == MoveType.DISCARD) {
return true;
}
// TODO create a version of the Move class with actual card data?
diff --git a/src/main/java/org/luxons/sevenwonders/game/MoveType.java b/src/main/java/org/luxons/sevenwonders/game/api/MoveType.java
index b24d673c..66f2331a 100644
--- a/src/main/java/org/luxons/sevenwonders/game/MoveType.java
+++ b/src/main/java/org/luxons/sevenwonders/game/api/MoveType.java
@@ -1,4 +1,4 @@
-package org.luxons.sevenwonders.game;
+package org.luxons.sevenwonders.game.api;
public enum MoveType {
PLAY, UPGRADE_WONDER, DISCARD
diff --git a/src/main/java/org/luxons/sevenwonders/game/api/Table.java b/src/main/java/org/luxons/sevenwonders/game/api/Table.java
index 7603f532..2ef27a2a 100644
--- a/src/main/java/org/luxons/sevenwonders/game/api/Table.java
+++ b/src/main/java/org/luxons/sevenwonders/game/api/Table.java
@@ -2,7 +2,6 @@ package org.luxons.sevenwonders.game.api;
import java.util.List;
-import org.luxons.sevenwonders.game.Move;
import org.luxons.sevenwonders.game.boards.Board;
import org.luxons.sevenwonders.game.boards.RelativeBoardPosition;
import org.luxons.sevenwonders.game.cards.Card;
bgstack15