mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Fix so Pack and Multicolor filter buttons work correctly when only they are toggled off
This commit is contained in:
@@ -54,7 +54,12 @@ public class CardCMCFilter extends StatTypeFilter<PaperCard> {
|
||||
}
|
||||
|
||||
if (cmcs.size() == buttonMap.size()) {
|
||||
return Predicates.alwaysTrue();
|
||||
return new Predicate<PaperCard>() { //use custom return true delegate to validate the item is a card
|
||||
@Override
|
||||
public boolean apply(PaperCard card) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
return Predicates.compose(Predicates.or(cmcs), PaperCard.FN_GET_RULES);
|
||||
}
|
||||
|
||||
@@ -78,8 +78,11 @@ public class CardColorFilter extends StatTypeFilter<PaperCard> {
|
||||
preFinal = CardRulesPredicates.canCastWithAvailable(colors);
|
||||
}
|
||||
}
|
||||
else if (colors != MagicColor.ALL_COLORS) {
|
||||
preFinal = Predicates.and(CardRulesPredicates.canCastWithAvailable(colors), Predicates.not(Presets.IS_MULTICOLOR));
|
||||
else {
|
||||
preFinal = Predicates.not(Presets.IS_MULTICOLOR);
|
||||
if (colors != MagicColor.ALL_COLORS) {
|
||||
preFinal = Predicates.and(CardRulesPredicates.canCastWithAvailable(colors), preFinal);
|
||||
}
|
||||
}
|
||||
if (!wantColorless) {
|
||||
if (colors != 0 && colors != MagicColor.ALL_COLORS) {
|
||||
@@ -91,7 +94,12 @@ public class CardColorFilter extends StatTypeFilter<PaperCard> {
|
||||
}
|
||||
|
||||
if (preFinal == null) {
|
||||
return Predicates.alwaysTrue();
|
||||
return new Predicate<PaperCard>() { //use custom return true delegate to validate the item is a card
|
||||
@Override
|
||||
public boolean apply(PaperCard card) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
return Predicates.compose(preFinal, PaperCard.FN_GET_RULES);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package forge.gui.toolbox.itemmanager.filters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -53,7 +54,12 @@ public class CardTypeFilter extends StatTypeFilter<PaperCard> {
|
||||
}
|
||||
|
||||
if (types.size() == buttonMap.size()) {
|
||||
return Predicates.alwaysTrue();
|
||||
return new Predicate<PaperCard>() { //use custom return true delegate to validate the item is a card
|
||||
@Override
|
||||
public boolean apply(PaperCard card) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
return Predicates.compose(Predicates.or(types), PaperCard.FN_GET_RULES);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user