From 70172b0ce559fbc386f2625fecb1a09dd7c91db6 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Thu, 9 Aug 2012 15:20:44 +0000 Subject: [PATCH] - Format X-list and R-list now enforces also Sites, Ring and Ring-bearer. --- .../game/formats/DefaultLotroFormat.java | 22 +++++++++++++------ .../src/main/webapp/includes/changeLog.html | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java index 9f17a04e5..ed9545f3f 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java @@ -207,12 +207,14 @@ public class DefaultLotroFormat implements LotroFormat { // Card count in deck and Ring-bearer Map cardCountByName = new HashMap(); Map cardCountByBaseBlueprintId = new HashMap(); - 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 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 counts, String name) { + private void processCardCounts(String blueprintId, Map cardCountByName, Map cardCountByBaseBlueprintId) { + LotroCardBlueprint cardBlueprint = _library.getLotroCardBlueprint(blueprintId); + increaseCount(cardCountByName, cardBlueprint.getName()); + increaseCount(cardCountByBaseBlueprintId, _library.getBaseBlueprintId(blueprintId)); + } + + private void increaseCount(Map counts, String name) { Integer count = counts.get(name); if (count == null) { counts.put(name, 1); diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html index d65b82b5a..92eebd69b 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html @@ -2,6 +2,7 @@ 9 Aug. 2012 - "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. 1 Aug. 2012 - "Gorbag's Sword" now gives the option to put the possession on top of the deck to the owner of the card.