Adding more info to deck validation.

This commit is contained in:
marcins78@gmail.com
2011-09-27 23:22:27 +00:00
parent 100b9b4bc0
commit 3e8aa27784

View File

@@ -95,16 +95,16 @@ public abstract class DefaultLotroFormat implements LotroFormat {
LotroCardBlueprint cardBlueprint = _library.getLotroCardBlueprint(blueprintId);
increateCount(cardCountByName, cardBlueprint.getName());
}
for (int count : cardCountByName.values()) {
if (count > _maximumSameName)
throw new DeckInvalidException("Deck contains more of the same card than allowed");
for (Map.Entry<String, Integer> count : cardCountByName.entrySet()) {
if (count.getValue() > _maximumSameName)
throw new DeckInvalidException("Deck contains more of the same card than allowed: " + count.getKey());
}
// Restricted cards
for (String name : _restrictedCard) {
Integer count = cardCountByName.get(name);
if (count != null && count > 1)
throw new DeckInvalidException("Deck contains more than one copy of a restricted card");
throw new DeckInvalidException("Deck contains more than one copy of a restricted card: " + name);
}
} catch (IllegalArgumentException exp) {