mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
update hasLegalCardsPredicate when deckconformance is turned off
- fixes #3271
This commit is contained in:
@@ -482,10 +482,12 @@ public enum DeckFormat {
|
||||
};
|
||||
}
|
||||
|
||||
public Predicate<Deck> hasLegalCardsPredicate() {
|
||||
public Predicate<Deck> hasLegalCardsPredicate(boolean enforceDeckLegality) {
|
||||
return new Predicate<Deck>() {
|
||||
@Override
|
||||
public boolean apply(Deck deck) {
|
||||
if (!enforceDeckLegality)
|
||||
return true;
|
||||
if (cardPoolFilter != null) {
|
||||
for (final Entry<PaperCard, Integer> cp : deck.getAllCardsInASinglePool()) {
|
||||
if (!cardPoolFilter.apply(cp.getKey().getRules())) {
|
||||
|
||||
@@ -473,9 +473,9 @@ public class DeckProxy implements InventoryItem {
|
||||
public static Iterable<DeckProxy> getAllTinyLeadersDecks(Predicate<Deck> filter) {
|
||||
final List<DeckProxy> result = new ArrayList<>();
|
||||
if (filter == null) {
|
||||
filter = DeckFormat.TinyLeaders.hasLegalCardsPredicate();
|
||||
filter = DeckFormat.TinyLeaders.hasLegalCardsPredicate(FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY));
|
||||
} else {
|
||||
filter = Predicates.and(DeckFormat.TinyLeaders.hasLegalCardsPredicate(), filter);
|
||||
filter = Predicates.and(DeckFormat.TinyLeaders.hasLegalCardsPredicate(FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)), filter);
|
||||
}
|
||||
addDecksRecursivelly("Tiny Leaders", GameType.TinyLeaders, result, "", FModel.getDecks().getTinyLeaders(), filter);
|
||||
return result;
|
||||
@@ -487,9 +487,9 @@ public class DeckProxy implements InventoryItem {
|
||||
public static Iterable<DeckProxy> getAllBrawlDecks(Predicate<Deck> filter) {
|
||||
final List<DeckProxy> result = new ArrayList<>();
|
||||
if (filter == null) {
|
||||
filter = DeckFormat.Brawl.hasLegalCardsPredicate();
|
||||
filter = DeckFormat.Brawl.hasLegalCardsPredicate(FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY));
|
||||
} else {
|
||||
filter = Predicates.and(DeckFormat.Brawl.hasLegalCardsPredicate(), filter);
|
||||
filter = Predicates.and(DeckFormat.Brawl.hasLegalCardsPredicate(FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)), filter);
|
||||
}
|
||||
addDecksRecursivelly("Brawl", GameType.Brawl, result, "", FModel.getDecks().getBrawl(), filter);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user