Attempting to get the errata to work with sealed leagues

This commit is contained in:
Christian 'ketura' McCarty
2023-01-05 00:30:05 -06:00
parent a19d060938
commit f305d0418a
3 changed files with 8 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ public interface LotroFormat {
public String applyErrata(String bpID);
public String findBaseCard(String bpID);
public List<String> findBaseCards(String bpID);
public SitesBlock getSiteBlock();

View File

@@ -485,8 +485,8 @@ public class DefaultLotroFormat implements LotroFormat {
}
@Override
public String findBaseCard(String bpID) {
return _library.getBaseBlueprintId(bpID);
public List<String> findBaseCards(String bpID) {
return _errataCardMap.values().stream().filter(x-> x.equals(bpID)).toList();
}
private String validateDeckStructure(LotroDeck deck) {

View File

@@ -689,10 +689,13 @@ public class HallServer extends AbstractServer {
Map<String, Integer> deckCardCounts = CollectionUtils.getTotalCardCountForDeck(lotroDeck);
for (Map.Entry<String, Integer> cardCount : deckCardCounts.entrySet()) {
final int collectionCount = collection.getItemCount(cardCount.getKey()) +
collection.getItemCount(format.findBaseCard(cardCount.getKey())) +
int collectionCount = collection.getItemCount(cardCount.getKey()) +
collection.getItemCount(format.applyErrata(cardCount.getKey()));
for(String id : format.findBaseCards(cardCount.getKey())) {
collectionCount += collection.getItemCount(id);
}
if (collectionCount < cardCount.getValue()) {
String cardName = null;
try {