forked from External/mage
Refactor card ratings, fixed rare error exception "comparison method violates its general contract" (different ratings in same card);
This commit is contained in:
parent
8d6c6cb765
commit
7eba755666
22 changed files with 185 additions and 110 deletions
|
|
@ -4,6 +4,7 @@ import mage.cards.*;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -70,4 +71,23 @@ public final class CardScanner {
|
|||
}
|
||||
CardRepository.instance.saveCards(cardsToAdd, CardRepository.instance.getContentVersionConstant());
|
||||
}
|
||||
|
||||
public static List<Card> getAllCards() {
|
||||
return getAllCards(true);
|
||||
}
|
||||
|
||||
public static List<Card> getAllCards(boolean ignoreCustomSets) {
|
||||
Collection<ExpansionSet> sets = Sets.getInstance().values();
|
||||
List<Card> cards = new ArrayList<>();
|
||||
for (ExpansionSet set : sets) {
|
||||
if (ignoreCustomSets && set.isCustomSet()) {
|
||||
continue;
|
||||
}
|
||||
for (ExpansionSet.SetCardInfo setInfo : set.getSetCardInfo()) {
|
||||
cards.add(CardImpl.createCard(setInfo.getCardClass(), new CardSetInfo(setInfo.getName(), set.getCode(),
|
||||
setInfo.getCardNumber(), setInfo.getRarity(), setInfo.getGraphicInfo())));
|
||||
}
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue