Fixed foils, tengwar, and masterworks of errata'd cards causing the PC auto-errata to fail. Foil cards now preserve their foil status during auto-errata-conversion.
This commit is contained in:
@@ -465,23 +465,29 @@ public class DefaultLotroFormat implements LotroFormat {
|
||||
LotroDeck deckWithErrata = new LotroDeck(deck.getDeckName());
|
||||
deckWithErrata.setTargetFormat(deck.getTargetFormat());
|
||||
if (deck.getRingBearer() != null) {
|
||||
deckWithErrata.setRingBearer(_errataCardMap.getOrDefault(deck.getRingBearer(), deck.getRingBearer()));
|
||||
deckWithErrata.setRingBearer(applyErrata(deck.getRingBearer()));
|
||||
}
|
||||
if (deck.getRing() != null) {
|
||||
deckWithErrata.setRing(_errataCardMap.getOrDefault(deck.getRing(), deck.getRing()));
|
||||
deckWithErrata.setRing(applyErrata(deck.getRing()));
|
||||
}
|
||||
for (String card : deck.getAdventureCards()) {
|
||||
deckWithErrata.addCard(_errataCardMap.getOrDefault(card, card));
|
||||
deckWithErrata.addCard(applyErrata(card));
|
||||
}
|
||||
for (String site : deck.getSites()) {
|
||||
deckWithErrata.addSite(_errataCardMap.getOrDefault(site, site));
|
||||
deckWithErrata.addSite(applyErrata(site));
|
||||
}
|
||||
return deckWithErrata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String applyErrata(String bpID) {
|
||||
return _errataCardMap.getOrDefault(bpID, bpID);
|
||||
public String applyErrata(String original) {
|
||||
var base = _library.getBaseBlueprintId(original);
|
||||
var errata = _errataCardMap.getOrDefault(base, base);
|
||||
if (original.endsWith("*") && !errata.endsWith("*")) {
|
||||
errata += "*";
|
||||
}
|
||||
|
||||
return errata;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -671,14 +671,31 @@ public class HallServer extends AbstractServer {
|
||||
int count = cardCount.getValue();
|
||||
|
||||
int owned = ownedCollection.getItemCount(blueprintId);
|
||||
//Since the cards we are validating may be automatic errata IDs, we check and see
|
||||
// if the base version of the errata ID is owned in foil, and count that if so.
|
||||
if(blueprintId.endsWith("*")) {
|
||||
var ids = format.findBaseCards(_library.getBaseBlueprintId(blueprintId));
|
||||
if(ids.size() == 1) {
|
||||
owned += ownedCollection.getItemCount(ids.stream().findFirst() + "*");
|
||||
}
|
||||
}
|
||||
int fromOwned = Math.min(owned, count);
|
||||
|
||||
int set = Integer.parseInt(blueprintId.split("_")[0]);
|
||||
|
||||
for (int i = 0; i < fromOwned; i++)
|
||||
filteredSpecialCardsDeck.addCard(blueprintId);
|
||||
if (count - fromOwned > 0) {
|
||||
String baseBlueprintId = _library.getBaseBlueprintId(blueprintId);
|
||||
for (int i = 0; i < (count - fromOwned); i++)
|
||||
filteredSpecialCardsDeck.addCard(baseBlueprintId);
|
||||
for (int i = 0; i < (count - fromOwned); i++) {
|
||||
//hacking in foil support for errata foils
|
||||
if(set > 19 && blueprintId.endsWith("*")) {
|
||||
filteredSpecialCardsDeck.addCard(blueprintId);
|
||||
}
|
||||
else {
|
||||
filteredSpecialCardsDeck.addCard(baseBlueprintId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user