mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
fix bugs in minimal set calculation.
added that column to itemmanager
This commit is contained in:
@@ -214,15 +214,15 @@ public final class CardDb implements ICardDatabase {
|
||||
List<PaperCard> cards = this.allCardsByName.get(cardName);
|
||||
|
||||
int sz = cards.size();
|
||||
if( fromSet == SetPreference.Earliest ) {
|
||||
if( fromSet == SetPreference.Latest ) {
|
||||
for(int i = 0 ; i < sz ; i++)
|
||||
if( printedBefore == null || editions.get(cards.get(i).getEdition()).getDate().after(printedBefore) )
|
||||
return cards.get(i);
|
||||
return null;
|
||||
} else if( fromSet == SetPreference.Latest || fromSet == null || fromSet == SetPreference.Random ) {
|
||||
} else if( fromSet == SetPreference.Earliest || fromSet == null || fromSet == SetPreference.Random ) {
|
||||
for(int i = sz - 1 ; i >= 0 ; i--)
|
||||
if( printedBefore == null || editions.get(cards.get(i).getEdition()).getDate().after(printedBefore) ) {
|
||||
if( fromSet == SetPreference.Latest )
|
||||
if( fromSet == SetPreference.Earliest )
|
||||
return cards.get(i);
|
||||
return cards.get(MyRandom.getRandom().nextInt(i+1));
|
||||
}
|
||||
|
||||
@@ -420,12 +420,15 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
minEditions.add(cp.getEdition());
|
||||
}
|
||||
|
||||
CardEdition earliestOne = null;
|
||||
for(CardEdition ed : getOrderedEditions()) {
|
||||
if( minEditions.contains(ed.getCode()) )
|
||||
earliestOne = ed;
|
||||
if( minEditions.contains(ed.getCode()) && ( ed.getType() == Type.CORE || ed.getType() == Type.EXPANSION ) )
|
||||
return ed;
|
||||
}
|
||||
return earliestOne;
|
||||
for(CardEdition ed : getOrderedEditions()) {
|
||||
if(minEditions.contains(ed.getCode()))
|
||||
return ed;
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
public static class Predicates {
|
||||
|
||||
Reference in New Issue
Block a user