Fix so multi-color cards containing a filtered color no longer show up in catalogs

This commit is contained in:
drdev
2013-11-29 06:52:51 +00:00
parent 7e37495b49
commit 1a8fe19c88
2 changed files with 8 additions and 0 deletions

View File

@@ -10,6 +10,8 @@ Release Notes
- If hide tabs setting on, still show tabs for panes with multiple tabs - - 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 - - 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. 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. Each ability will have a keyboard shortcut of 1-9 based on order.

View File

@@ -33,6 +33,7 @@ public class SFilterUtil {
*/ */
public static Predicate<PaperCard> buildColorAndTypeFilter(Map<SItemManagerUtil.StatTypes, FLabel> statLabels) { public static Predicate<PaperCard> buildColorAndTypeFilter(Map<SItemManagerUtil.StatTypes, FLabel> statLabels) {
final List<Predicate<CardRules>> colors = new ArrayList<Predicate<CardRules>>(); 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>>(); final List<Predicate<CardRules>> types = new ArrayList<Predicate<CardRules>>();
boolean wantMulticolor = false; boolean wantMulticolor = false;
@@ -41,6 +42,7 @@ public class SFilterUtil {
switch (s) { switch (s) {
case WHITE: case BLUE: case BLACK: case RED: case GREEN: case COLORLESS: case WHITE: case BLUE: case BLACK: case RED: case GREEN: case COLORLESS:
if (statLabels.get(s).getSelected()) { colors.add(s.predicate); } if (statLabels.get(s).getSelected()) { colors.add(s.predicate); }
else { notColors.add(Predicates.not(s.predicate)); }
break; break;
case MULTICOLOR: case MULTICOLOR:
wantMulticolor = statLabels.get(s).getSelected(); wantMulticolor = statLabels.get(s).getSelected();
@@ -59,6 +61,10 @@ public class SFilterUtil {
} }
} }
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> preColors = colors.size() == 6 ? null : Predicates.or(colors);
Predicate<CardRules> preFinal = colors.isEmpty() && wantMulticolor ? Predicate<CardRules> preFinal = colors.isEmpty() && wantMulticolor ?
CardRulesPredicates.Presets.IS_MULTICOLOR : optimizedAnd(preExceptMulti, preColors); CardRulesPredicates.Presets.IS_MULTICOLOR : optimizedAnd(preExceptMulti, preColors);