mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
add getUniqueCardsNoAlt for mobile
This commit is contained in:
@@ -56,10 +56,11 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
public final static String foilSuffix = "+";
|
public final static String foilSuffix = "+";
|
||||||
public final static char NameSetSeparator = '|';
|
public final static char NameSetSeparator = '|';
|
||||||
|
|
||||||
// need this to obtain cardReference by name+set+artindex
|
|
||||||
private final ListMultimap<String, PaperCard> allCardsByName = Multimaps.newListMultimap(new TreeMap<>(String.CASE_INSENSITIVE_ORDER), CollectionSuppliers.arrayLists());
|
|
||||||
// for deck editor only
|
// for deck editor only
|
||||||
private final ListMultimap<String, PaperCard> allCardsByNameNoAlt = Multimaps.newListMultimap(new TreeMap<>(String.CASE_INSENSITIVE_ORDER), CollectionSuppliers.arrayLists());
|
private final ListMultimap<String, PaperCard> allCardsByNameNoAlt = Multimaps.newListMultimap(new TreeMap<>(String.CASE_INSENSITIVE_ORDER), CollectionSuppliers.arrayLists());
|
||||||
|
private final Map<String, PaperCard> uniqueCardsByNameNoAlt = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
// need this to obtain cardReference by name+set+artindex
|
||||||
|
private final ListMultimap<String, PaperCard> allCardsByName = Multimaps.newListMultimap(new TreeMap<>(String.CASE_INSENSITIVE_ORDER), CollectionSuppliers.arrayLists());
|
||||||
private final Map<String, PaperCard> uniqueCardsByName = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
|
private final Map<String, PaperCard> uniqueCardsByName = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
|
||||||
private final Map<String, CardRules> rulesByName;
|
private final Map<String, CardRules> rulesByName;
|
||||||
private final Map<String, ICardFace> facesByName = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
|
private final Map<String, ICardFace> facesByName = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
|
||||||
@@ -275,9 +276,13 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
|
|
||||||
private void reIndex() {
|
private void reIndex() {
|
||||||
uniqueCardsByName.clear();
|
uniqueCardsByName.clear();
|
||||||
|
uniqueCardsByNameNoAlt.clear();
|
||||||
for (Entry<String, Collection<PaperCard>> kv : allCardsByName.asMap().entrySet()) {
|
for (Entry<String, Collection<PaperCard>> kv : allCardsByName.asMap().entrySet()) {
|
||||||
uniqueCardsByName.put(kv.getKey(), getFirstWithImage(kv.getValue()));
|
uniqueCardsByName.put(kv.getKey(), getFirstWithImage(kv.getValue()));
|
||||||
}
|
}
|
||||||
|
for (Entry<String, Collection<PaperCard>> kv : allCardsByNameNoAlt.asMap().entrySet()) {
|
||||||
|
uniqueCardsByNameNoAlt.put(kv.getKey(), getFirstWithImage(kv.getValue()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PaperCard getFirstWithImage(final Collection<PaperCard> cards) {
|
private static PaperCard getFirstWithImage(final Collection<PaperCard> cards) {
|
||||||
@@ -565,6 +570,10 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
return uniqueCardsByName.values();
|
return uniqueCardsByName.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<PaperCard> getUniqueCardsNoAlt() {
|
||||||
|
return uniqueCardsByNameNoAlt.values();
|
||||||
|
}
|
||||||
|
|
||||||
public PaperCard getUniqueByName(final String name) {
|
public PaperCard getUniqueByName(final String name) {
|
||||||
return uniqueCardsByName.get(getName(name));
|
return uniqueCardsByName.get(getName(name));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1156,7 +1156,7 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
|||||||
// fall through to below
|
// fall through to below
|
||||||
default:
|
default:
|
||||||
if (cardManager.getWantUnique()) {
|
if (cardManager.getWantUnique()) {
|
||||||
cardManager.setPool(editorType.applyCardFilter(ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getUniqueCards(), PaperCard.class), additionalFilter), true);
|
cardManager.setPool(editorType.applyCardFilter(ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getUniqueCardsNoAlt(), PaperCard.class), additionalFilter), true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cardManager.setPool(editorType.applyCardFilter(ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getAllCardsNoAlt(), PaperCard.class), additionalFilter), true);
|
cardManager.setPool(editorType.applyCardFilter(ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getAllCardsNoAlt(), PaperCard.class), additionalFilter), true);
|
||||||
|
|||||||
Reference in New Issue
Block a user