summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2016-12-10 11:23:58 +0100
committerJoffrey BION <joffrey.bion@gmail.com>2016-12-10 11:23:58 +0100
commit83d30bfd16d313d06545d1dfe60c78d250bdb7ca (patch)
tree141b113e5de784b29be66b0fdcb42cc43949aad2 /src
parentSimplify numeric effects creation (diff)
downloadseven-wonders-83d30bfd16d313d06545d1dfe60c78d250bdb7ca.tar.gz
seven-wonders-83d30bfd16d313d06545d1dfe60c78d250bdb7ca.tar.bz2
seven-wonders-83d30bfd16d313d06545d1dfe60c78d250bdb7ca.zip
Add multiple card colors support for BonusPerBoardElement
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/boards/Board.java4
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java12
2 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/boards/Board.java b/src/main/java/org/luxons/sevenwonders/game/boards/Board.java
index c327ed72..b405a566 100644
--- a/src/main/java/org/luxons/sevenwonders/game/boards/Board.java
+++ b/src/main/java/org/luxons/sevenwonders/game/boards/Board.java
@@ -49,8 +49,8 @@ public class Board {
playedCards.add(card);
}
- public int getNbCardsOfColor(Color color) {
- return (int) playedCards.stream().filter(c -> c.getColor() == color).count();
+ public int getNbCardsOfColor(List<Color> colorFilter) {
+ return (int) playedCards.stream().filter(c -> colorFilter.contains(c.getColor())).count();
}
public Production getProduction() {
diff --git a/src/main/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java b/src/main/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java
index f876328c..57b83054 100644
--- a/src/main/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java
+++ b/src/main/java/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.java
@@ -17,7 +17,7 @@ public class BonusPerBoardElement implements Effect {
private BoardElementType type;
// only relevant if type=CARD
- private Color color;
+ private List<Color> colors;
public List<RelativePlayerPosition> getBoards() {
return boards;
@@ -51,12 +51,12 @@ public class BonusPerBoardElement implements Effect {
this.type = type;
}
- public Color getColor() {
- return color;
+ public List<Color> getColors() {
+ return colors;
}
- public void setColor(Color color) {
- this.color = color;
+ public void setColors(List<Color> colors) {
+ this.colors = colors;
}
@Override
@@ -87,7 +87,7 @@ public class BonusPerBoardElement implements Effect {
private int computeNbOfMatchingElementsIn(Board board) {
switch (type) {
case CARD:
- return board.getNbCardsOfColor(color);
+ return board.getNbCardsOfColor(colors);
case WONDER_LEVEL:
return board.getWonderLevel();
case DEFEAT_TOKEN:
bgstack15