- Format X-list and R-list now enforces also Sites, Ring and Ring-bearer.

This commit is contained in:
marcins78@gmail.com
2012-08-09 15:20:44 +00:00
parent 4891cc34d3
commit 70172b0ce5
2 changed files with 16 additions and 7 deletions

View File

@@ -207,12 +207,14 @@ public class DefaultLotroFormat implements LotroFormat {
// Card count in deck and Ring-bearer
Map<String, Integer> cardCountByName = new HashMap<String, Integer>();
Map<String, Integer> cardCountByBaseBlueprintId = new HashMap<String, Integer>();
cardCountByName.put(ringBearer.getName(), 1);
for (String blueprintId : deck.getAdventureCards()) {
LotroCardBlueprint cardBlueprint = _library.getLotroCardBlueprint(blueprintId);
increateCount(cardCountByName, cardBlueprint.getName());
increateCount(cardCountByBaseBlueprintId, _library.getBaseBlueprintId(blueprintId));
}
processCardCounts(deck.getRing(), cardCountByName, cardCountByBaseBlueprintId);
processCardCounts(deck.getRingBearer(), cardCountByName, cardCountByBaseBlueprintId);
for (String blueprintId : deck.getAdventureCards())
processCardCounts(blueprintId, cardCountByName, cardCountByBaseBlueprintId);
for (String blueprintId : deck.getSites())
processCardCounts(blueprintId, cardCountByName, cardCountByBaseBlueprintId);
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());
@@ -237,7 +239,13 @@ public class DefaultLotroFormat implements LotroFormat {
}
}
private void increateCount(Map<String, Integer> counts, String name) {
private void processCardCounts(String blueprintId, Map<String, Integer> cardCountByName, Map<String, Integer> cardCountByBaseBlueprintId) {
LotroCardBlueprint cardBlueprint = _library.getLotroCardBlueprint(blueprintId);
increaseCount(cardCountByName, cardBlueprint.getName());
increaseCount(cardCountByBaseBlueprintId, _library.getBaseBlueprintId(blueprintId));
}
private void increaseCount(Map<String, Integer> counts, String name) {
Integer count = counts.get(name);
if (count == null) {
counts.put(name, 1);

View File

@@ -2,6 +2,7 @@
<b>9 Aug. 2012</b>
- "That Is No Orc Horn" is now allowing to heal a companion and liberate a site, rather than one of the effects.
- "Aragorn's Bow, Ranger's Longbow" now correctly can wound minions that have their strength based off number of threats.
- Format X-list and R-list now enforces also Sites, Ring and Ring-bearer.
<b>1 Aug. 2012</b>
- "Gorbag's Sword" now gives the option to put the possession on top of the deck to the owner of the card.