@@ -106,18 +106,21 @@ protected PaperToken fallbackToken(String name, CardEdition realEdition) {
106106 // Find latest token before release of original card, or earliest after that
107107 private PaperToken smartFallbackToken (String name , CardEdition realEdition ) {
108108
109+ // Try to optimistically adhere to CardArtPreference and filter out special editions other than realEdition's own type first
109110 final EnumSet <CardEdition .Type > specialEditions = EnumSet .of (CardEdition .Type .FUNNY , CardEdition .Type .ONLINE , CardEdition .Type .OTHER );
110111 specialEditions .remove (realEdition .getType ());
111112 CardDb .CardArtPreference artPreference = StaticData .instance ().getCardArtPreference ();
112113
113114 PaperToken paperToken = smartFallbackToken (name , realEdition , Predicate .<CardEdition >not (
114115 edition -> specialEditions .contains (edition .getType ())).and (artPreference ::accept ));
115- return paperToken != null ? paperToken : smartFallbackToken (name , realEdition , Predicates .falsePredicate ());
116+
117+ // Further fall back if a token still isn't found, try all editions without filtering
118+ return paperToken != null ? paperToken : smartFallbackToken (name , realEdition , Predicates .truePredicate ());
116119 }
117120
118121 private PaperToken smartFallbackToken (String name , CardEdition realEdition , Predicate <CardEdition > eligible ) {
119122 String lastMatchedKey = null ;
120- boolean reachedRealEdition = false ;
123+ boolean reachedRealEdition = false ; // This is to find the closest edition to realEdition, rather than terminate at the first (earliest) result
121124 for (CardEdition edition : this .editions .getOrderedEditions (false )) {
122125 if (edition .equals (realEdition )) {
123126 reachedRealEdition = true ;
0 commit comments