mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
fixed Niv-Mizzet Reborn allowing players to select cards that aren't exactly two colors
This commit is contained in:
parent
79f8391fef
commit
9ad7c4c83d
1 changed files with 12 additions and 7 deletions
|
@ -75,11 +75,18 @@ class NivMizzetRebornEffect extends OneShotEffect {
|
||||||
this.color2 = color2;
|
this.color2 = color2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TargetCard getTarget() {
|
private FilterCard makeFilter() {
|
||||||
FilterCard filter = new FilterCard(getDescription());
|
FilterCard filter = new FilterCard(getDescription());
|
||||||
filter.add(new ColorPredicate(new ObjectColor(color1 + color2)));
|
filter.add(new ColorPredicate(new ObjectColor(color1)));
|
||||||
filter.add(Predicates.not(new ColorPredicate(new ObjectColor(getOtherColors()))));
|
filter.add(new ColorPredicate(new ObjectColor(color2)));
|
||||||
return new TargetCardInLibrary(filter);
|
for (char c : getOtherColors().toCharArray()) {
|
||||||
|
filter.add(Predicates.not(new ColorPredicate(new ObjectColor("" + c))));
|
||||||
|
}
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TargetCard getTarget() {
|
||||||
|
return new TargetCardInLibrary(makeFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDescription() {
|
private String getDescription() {
|
||||||
|
@ -99,9 +106,7 @@ class NivMizzetRebornEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInCards(Cards cards, Game game) {
|
private boolean isInCards(Cards cards, Game game) {
|
||||||
FilterCard filter = new FilterCard(getDescription());
|
FilterCard filter = makeFilter();
|
||||||
filter.add(new ColorPredicate(new ObjectColor(color1 + color2)));
|
|
||||||
filter.add(Predicates.not(new ColorPredicate(new ObjectColor(getOtherColors()))));
|
|
||||||
return cards.getCards(game).stream().anyMatch(card -> filter.match(card, game));
|
return cards.getCards(game).stream().anyMatch(card -> filter.match(card, game));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue