Skip to content

Commit 33b26e7

Browse files
committed
Prefer Core, Expansions or Reprints for Tokens
1 parent 842ce5b commit 33b26e7

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

forge-core/src/main/java/forge/token/TokenDb.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,23 @@ protected PaperToken fallbackToken(String name, CardEdition realEdition) {
103103

104104
// Find latest token before release of original card, or earliest after that
105105
private PaperToken smartFallbackToken(String name, CardEdition realEdition) {
106+
PaperToken coreExpansionReprintToken = smartFallbackToken(name, realEdition, true);
107+
return coreExpansionReprintToken != null ? coreExpansionReprintToken : smartFallbackToken(name, realEdition, false);
108+
}
109+
110+
private PaperToken smartFallbackToken(String name, CardEdition realEdition, boolean onlyCoreExpansionOrReprint) {
106111
String latestFound = null;
107112
boolean pastRealEdition = false;
113+
final EnumSet<CardEdition.Type> coreExpansionOrReprint = EnumSet.of(CardEdition.Type.CORE, CardEdition.Type.EXPANSION);
114+
coreExpansionOrReprint.addAll(CardEdition.Type.REPRINT_SET_TYPES);
108115
for (CardEdition edition : this.editions.getOrderedEditions(false)) {
109116
if (edition.equals(realEdition)) {
110117
pastRealEdition = true;
111118
}
119+
if (onlyCoreExpansionOrReprint && !coreExpansionOrReprint.contains(edition.getType())) {
120+
// Core, Expansion and Reprint sets are more likely to have available token images
121+
continue;
122+
}
112123
String fullName = String.format("%s_%s", name, edition.getCode().toLowerCase());
113124
if (loadTokenFromSet(edition, name)) {
114125
latestFound = fullName;

0 commit comments

Comments
 (0)