diff options
author | jbion <joffrey.bion@amadeus.com> | 2016-12-21 12:36:30 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2016-12-21 12:36:30 +0100 |
commit | 6ea510e94ee51b221bac4ffe494c0307fc6e1064 (patch) | |
tree | a957b49b9514f1c252699f6a929cc85417377fe0 /src/main/java/org | |
parent | Add test for NumericEffectSerializer (diff) | |
download | seven-wonders-6ea510e94ee51b221bac4ffe494c0307fc6e1064.tar.gz seven-wonders-6ea510e94ee51b221bac4ffe494c0307fc6e1064.tar.bz2 seven-wonders-6ea510e94ee51b221bac4ffe494c0307fc6e1064.zip |
Add test for Decks
Diffstat (limited to 'src/main/java/org')
3 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/Decks.java b/src/main/java/org/luxons/sevenwonders/game/Decks.java index abc8e817..5ecc3000 100644 --- a/src/main/java/org/luxons/sevenwonders/game/Decks.java +++ b/src/main/java/org/luxons/sevenwonders/game/Decks.java @@ -39,6 +39,9 @@ public class Decks { } private void validateNbCards(List<Card> deck, int nbPlayers) { + if (nbPlayers == 0) { + throw new IllegalArgumentException("Cannot deal cards between 0 players"); + } if (deck.size() % nbPlayers != 0) { throw new IllegalArgumentException( String.format("Cannot deal %d cards evenly between %d players", deck.size(), nbPlayers)); 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 cc2275a2..fe160857 100644 --- a/src/main/java/org/luxons/sevenwonders/game/cards/Card.java +++ b/src/main/java/org/luxons/sevenwonders/game/cards/Card.java @@ -13,20 +13,23 @@ public class Card { private final Requirements requirements; - private final String chainParent; - private final List<Effect> effects; + private final String chainParent; + private final List<String> chainChildren; - public Card(String name, Color color, Requirements requirements, String chainParent, List<Effect> effects, - List<String> chainChildren) { + private final String image; + + public Card(String name, Color color, Requirements requirements, List<Effect> effects, String chainParent, + List<String> chainChildren, String image) { this.name = name; this.color = color; this.requirements = requirements; this.chainParent = chainParent; this.effects = effects; this.chainChildren = chainChildren; + this.image = image; } public String getName() { diff --git a/src/main/java/org/luxons/sevenwonders/game/data/definitions/CardDefinition.java b/src/main/java/org/luxons/sevenwonders/game/data/definitions/CardDefinition.java index f46e4b4f..48853899 100644 --- a/src/main/java/org/luxons/sevenwonders/game/data/definitions/CardDefinition.java +++ b/src/main/java/org/luxons/sevenwonders/game/data/definitions/CardDefinition.java @@ -14,10 +14,10 @@ public class CardDefinition implements Definition<Card> { private Color color; - private EffectsDefinition effect; - private Requirements requirements; + private EffectsDefinition effect; + private String chainParent; private List<String> chainChildren; @@ -28,7 +28,7 @@ public class CardDefinition implements Definition<Card> { @Override public Card create(Settings settings) { - return new Card(name, color, requirements, chainParent, effect.create(settings), chainChildren); + return new Card(name, color, requirements, effect.create(settings), chainParent, chainChildren, image); } public String getName() { |