fixed Niv-Mizzet Reborn not allowing any selections (fixes #5713)

This commit is contained in:
Evan Kranzler 2019-04-13 20:28:52 -04:00
parent 1baf044402
commit 3301cc3b78

View file

@ -91,11 +91,19 @@ class NivMizzetRebornEffect extends OneShotEffect {
String otherColors = ""; String otherColors = "";
for (char c : "WUBRG".toCharArray()) { for (char c : "WUBRG".toCharArray()) {
if (color1.charAt(0) == c || color2.charAt(0) == c) { if (color1.charAt(0) == c || color2.charAt(0) == c) {
otherColors += c; continue;
} }
otherColors += c;
} }
return otherColors; return otherColors;
} }
private boolean isInCards(Cards cards, Game game) {
FilterCard filter = new FilterCard(getDescription());
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));
}
} }
NivMizzetRebornEffect() { NivMizzetRebornEffect() {
@ -127,6 +135,9 @@ class NivMizzetRebornEffect extends OneShotEffect {
} }
player.revealCards(source, cards, game); player.revealCards(source, cards, game);
for (Guild guild : Guild.values()) { for (Guild guild : Guild.values()) {
if (!guild.isInCards(cards, game)) {
continue;
}
TargetCard target = guild.getTarget(); TargetCard target = guild.getTarget();
if (player.choose(outcome, cards, target, game)) { if (player.choose(outcome, cards, target, game)) {
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());