mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Filter by foil status (#8358)
This commit is contained in:
@@ -50,6 +50,13 @@ public abstract class PaperCardPredicates {
|
|||||||
return new PredicateNames(what);
|
return new PredicateNames(what);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters on a card foil status
|
||||||
|
*/
|
||||||
|
public static Predicate<PaperCard> isFoil(final boolean isFoil) {
|
||||||
|
return new PredicateFoil(isFoil);
|
||||||
|
}
|
||||||
|
|
||||||
private static final class PredicatePrintedWithRarity implements Predicate<PaperCard> {
|
private static final class PredicatePrintedWithRarity implements Predicate<PaperCard> {
|
||||||
private final CardRarity matchingRarity;
|
private final CardRarity matchingRarity;
|
||||||
|
|
||||||
@@ -93,6 +100,17 @@ public abstract class PaperCardPredicates {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final class PredicateFoil implements Predicate<PaperCard> {
|
||||||
|
private final boolean operand;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean test(final PaperCard card) { return card.isFoil() == operand; }
|
||||||
|
|
||||||
|
private PredicateFoil(final boolean isFoil) {
|
||||||
|
this.operand = isFoil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final class PredicateRarity implements Predicate<PaperCard> {
|
private static final class PredicateRarity implements Predicate<PaperCard> {
|
||||||
private final CardRarity operand;
|
private final CardRarity operand;
|
||||||
|
|
||||||
|
|||||||
@@ -408,6 +408,20 @@ public abstract class AdvancedSearchParser {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "is":
|
||||||
|
if (opUsed.equals(":")) {
|
||||||
|
switch(valueStr) {
|
||||||
|
case "foil":
|
||||||
|
predicate = PaperCardPredicates.isFoil(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "nonfoil":
|
||||||
|
predicate = PaperCardPredicates.isFoil(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (predicate == null) {
|
if (predicate == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user