mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Fix so multi-color cards containing a filtered color no longer show up in catalogs
This commit is contained in:
@@ -10,6 +10,8 @@ Release Notes
|
||||
|
||||
- If hide tabs setting on, still show tabs for panes with multiple tabs -
|
||||
|
||||
- Multi-color cards containing a filtered color will no longer show up in catalogs -
|
||||
|
||||
- Select abilities using context menu -
|
||||
Instead of displaying a dialog to select abilities, you'll now get a context menu when left or right clicking cards with multiple ability choices.
|
||||
Each ability will have a keyboard shortcut of 1-9 based on order.
|
||||
|
||||
@@ -33,6 +33,7 @@ public class SFilterUtil {
|
||||
*/
|
||||
public static Predicate<PaperCard> buildColorAndTypeFilter(Map<SItemManagerUtil.StatTypes, FLabel> statLabels) {
|
||||
final List<Predicate<CardRules>> colors = new ArrayList<Predicate<CardRules>>();
|
||||
final List<Predicate<CardRules>> notColors = new ArrayList<Predicate<CardRules>>();
|
||||
final List<Predicate<CardRules>> types = new ArrayList<Predicate<CardRules>>();
|
||||
|
||||
boolean wantMulticolor = false;
|
||||
@@ -41,6 +42,7 @@ public class SFilterUtil {
|
||||
switch (s) {
|
||||
case WHITE: case BLUE: case BLACK: case RED: case GREEN: case COLORLESS:
|
||||
if (statLabels.get(s).getSelected()) { colors.add(s.predicate); }
|
||||
else { notColors.add(Predicates.not(s.predicate)); }
|
||||
break;
|
||||
case MULTICOLOR:
|
||||
wantMulticolor = statLabels.get(s).getSelected();
|
||||
@@ -58,6 +60,10 @@ public class SFilterUtil {
|
||||
throw new RuntimeException("unhandled enum value: " + s);
|
||||
}
|
||||
}
|
||||
|
||||
if (wantMulticolor && !colors.isEmpty() && !notColors.isEmpty()) {
|
||||
preExceptMulti = Predicates.and(notColors); //ensure multicolor cards with filtered colors don't show up
|
||||
}
|
||||
|
||||
Predicate<CardRules> preColors = colors.size() == 6 ? null : Predicates.or(colors);
|
||||
Predicate<CardRules> preFinal = colors.isEmpty() && wantMulticolor ?
|
||||
|
||||
Reference in New Issue
Block a user