mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Disambiguate requested print names
This commit is contained in:
@@ -888,14 +888,16 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getArtCount(String cardName, String setCode) {
|
public int getArtCount(String cardName, String setCode) {
|
||||||
|
return getArtCount(cardName, setCode, null);
|
||||||
|
}
|
||||||
|
public int getArtCount(String cardName, String setCode, String functionalVariantName) {
|
||||||
if (cardName == null || setCode == null)
|
if (cardName == null || setCode == null)
|
||||||
return 0;
|
return 0;
|
||||||
Collection<PaperCard> cardsInSet = getAllCards(cardName, new Predicate<PaperCard>() {
|
Predicate<PaperCard> predicate = card -> card.getEdition().equalsIgnoreCase(setCode);
|
||||||
@Override
|
if(functionalVariantName != null && !functionalVariantName.equals(IPaperCard.NO_FUNCTIONAL_VARIANT)) {
|
||||||
public boolean apply(PaperCard card) {
|
predicate = Predicates.and(predicate, card -> functionalVariantName.equals(card.getFunctionalVariant()));
|
||||||
return card.getEdition().equalsIgnoreCase(setCode);
|
}
|
||||||
}
|
Collection<PaperCard> cardsInSet = getAllCards(cardName, predicate);
|
||||||
});
|
|
||||||
return cardsInSet.size();
|
return cardsInSet.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1159,7 +1161,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!hasBadSetInfo) {
|
if (!hasBadSetInfo) {
|
||||||
int artCount = getArtCount(card.getName(), card.getEdition());
|
int artCount = getArtCount(card.getName(), card.getEdition(), card.getFunctionalVariant());
|
||||||
sb.append(CardDb.NameSetSeparator).append(card.getEdition());
|
sb.append(CardDb.NameSetSeparator).append(card.getEdition());
|
||||||
if (artCount >= IPaperCard.DEFAULT_ART_INDEX) {
|
if (artCount >= IPaperCard.DEFAULT_ART_INDEX) {
|
||||||
sb.append(CardDb.NameSetSeparator).append(card.getArtIndex()); // indexes start at 1 to match image file name conventions
|
sb.append(CardDb.NameSetSeparator).append(card.getArtIndex()); // indexes start at 1 to match image file name conventions
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import forge.StaticData;
|
|||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
import forge.card.CardSplitType;
|
import forge.card.CardSplitType;
|
||||||
|
import forge.item.IPaperCard;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ public class ImageUtil {
|
|||||||
final boolean hasManyPictures;
|
final boolean hasManyPictures;
|
||||||
final CardDb db = !card.isVariant() ? StaticData.instance().getCommonCards() : StaticData.instance().getVariantCards();
|
final CardDb db = !card.isVariant() ? StaticData.instance().getCommonCards() : StaticData.instance().getVariantCards();
|
||||||
if (includeSet) {
|
if (includeSet) {
|
||||||
cntPictures = db.getArtCount(card.getName(), edition);
|
cntPictures = db.getArtCount(card.getName(), edition, cp.getFunctionalVariant());
|
||||||
hasManyPictures = cntPictures > 1;
|
hasManyPictures = cntPictures > 1;
|
||||||
} else {
|
} else {
|
||||||
cntPictures = 1;
|
cntPictures = 1;
|
||||||
@@ -149,6 +150,8 @@ public class ImageUtil {
|
|||||||
}
|
}
|
||||||
} else if (CardSplitType.Split == cp.getRules().getSplitType()) {
|
} else if (CardSplitType.Split == cp.getRules().getSplitType()) {
|
||||||
return card.getMainPart().getName() + card.getOtherPart().getName();
|
return card.getMainPart().getName() + card.getOtherPart().getName();
|
||||||
|
} else if (!IPaperCard.NO_FUNCTIONAL_VARIANT.equals(cp.getFunctionalVariant())) {
|
||||||
|
return cp.getName() + " " + cp.getFunctionalVariant();
|
||||||
}
|
}
|
||||||
return cp.getName();
|
return cp.getName();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user