diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2016-12-10 11:34:38 +0100 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2016-12-10 11:34:38 +0100 |
commit | 690a04bcb8d2adf727faf1aa23acd6540bcb0b0f (patch) | |
tree | 8f84c0304bb94a89ba226b74301e435bc4597397 /src | |
parent | Add multiple card colors support for BonusPerBoardElement (diff) | |
download | seven-wonders-690a04bcb8d2adf727faf1aa23acd6540bcb0b0f.tar.gz seven-wonders-690a04bcb8d2adf727faf1aa23acd6540bcb0b0f.tar.bz2 seven-wonders-690a04bcb8d2adf727faf1aa23acd6540bcb0b0f.zip |
Add multiple effects support for cards
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/luxons/sevenwonders/game/cards/Card.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/cards/Card.java b/src/main/java/org/luxons/sevenwonders/game/cards/Card.java index 111275be..5c79ac32 100644 --- a/src/main/java/org/luxons/sevenwonders/game/cards/Card.java +++ b/src/main/java/org/luxons/sevenwonders/game/cards/Card.java @@ -1,5 +1,7 @@ package org.luxons.sevenwonders.game.cards; +import java.util.List; + import org.luxons.sevenwonders.game.boards.Board; import org.luxons.sevenwonders.game.effects.Effect; @@ -11,13 +13,13 @@ public class Card { private final Requirements requirements; - private final Effect effect; + private final List<Effect> effects; - public Card(String name, Color color, Requirements requirements, Effect effect) { + public Card(String name, Color color, Requirements requirements, List<Effect> effects) { this.name = name; this.color = color; this.requirements = requirements; - this.effect = effect; + this.effects = effects; } public String getName() { @@ -32,19 +34,19 @@ public class Card { return requirements; } - public Effect getEffect() { - return effect; + public List<Effect> getEffects() { + return effects; } public void play(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard) { board.addCard(this); requirements.pay(board); - effect.apply(board, leftNeighbourBoard, rightNeighbourBoard); + effects.forEach(e -> e.apply(board, leftNeighbourBoard, rightNeighbourBoard)); } @Override public String toString() { - return "Card{" + "name='" + name + '\'' + ", color=" + color + ", requirements=" + requirements + ", effect=" - + effect + '}'; + return "Card{" + "name='" + name + '\'' + ", color=" + color + ", requirements=" + requirements + ", effects=" + + effects + '}'; } } |