getCard(str,bool) now returns planes or schemes properly

This commit is contained in:
Maxmtg
2013-02-11 17:37:01 +00:00
parent ad4cb22853
commit 749d0f08a5

View File

@@ -397,7 +397,12 @@ public final class CardDb {
// Find card with maximal set index
result = Aggregates.itemWithMax(namedCards, CardPrinted.FN_GET_EDITION_INDEX);
if (null == result) {
throw new NoSuchElementException(String.format("Card '%s' not found in our database.", name));
// 2nd chance: look in planes, schemes and so on
final Iterable<CardPrinted> namedNonTraditionals = Iterables.filter(this.allNonTraditionalCardsFlat, predicate);
result = Aggregates.itemWithMax(namedNonTraditionals, CardPrinted.FN_GET_EDITION_INDEX);
if ( null == result ) // sure thing, throw exception
throw new NoSuchElementException(String.format("Card '%s' not found in our database.", name));
}
}