mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
add verify checks for Double Faced Cards having abilities on main card
* add booleans to card scanner, restricting to checking cards by name and set. Reduces duplication of verify checks across sets.
This commit is contained in:
parent
69e20b1061
commit
b32a786236
3 changed files with 32 additions and 9 deletions
|
|
@ -3,10 +3,7 @@ package mage.cards.repository;
|
|||
import mage.cards.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
|
|
@ -83,17 +80,28 @@ public final class CardScanner {
|
|||
}
|
||||
|
||||
public static List<Card> getAllCards() {
|
||||
return getAllCards(true);
|
||||
return getAllCards(true, true, true);
|
||||
}
|
||||
|
||||
public static List<Card> getAllCards(boolean ignoreCustomSets) {
|
||||
public static List<Card> getAllCards(boolean ignoreCustomSets, boolean uniqueByName, boolean uniqueBySet) {
|
||||
Set<String> uniqueCardNames = new HashSet<>();
|
||||
Collection<ExpansionSet> sets = Sets.getInstance().values();
|
||||
List<Card> cards = new ArrayList<>();
|
||||
for (ExpansionSet set : sets) {
|
||||
if (ignoreCustomSets && set.getSetType().isCustomSet()) {
|
||||
continue;
|
||||
}
|
||||
if (uniqueBySet) {
|
||||
uniqueCardNames.clear();
|
||||
}
|
||||
for (ExpansionSet.SetCardInfo setInfo : set.getSetCardInfo()) {
|
||||
if (uniqueByName) {
|
||||
String cardName = setInfo.getName();
|
||||
if (uniqueCardNames.contains(cardName)) {
|
||||
continue;
|
||||
}
|
||||
uniqueCardNames.add(cardName);
|
||||
}
|
||||
cards.add(CardImpl.createCard(setInfo.getCardClass(), new CardSetInfo(setInfo.getName(), set.getCode(),
|
||||
setInfo.getCardNumber(), setInfo.getRarity(), setInfo.getGraphicInfo())));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue