Fixed Genesis Hydra not allowing to cancel choosing nonland permanent

This commit is contained in:
magenoxx 2014-08-20 10:38:59 +04:00
parent 3454b2db8a
commit f28fbafd5c

View file

@ -27,7 +27,6 @@
*/ */
package mage.sets.magic2015; package mage.sets.magic2015;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
@ -55,6 +54,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import java.util.UUID;
/** /**
@ -165,14 +166,20 @@ class GenesisHydraPutOntoBattlefieldEffect extends OneShotEffect {
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND))); filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, count + 1)); filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, count + 1));
TargetCard target1 = new TargetCard(Zone.LIBRARY, filter); TargetCard target1 = new TargetCard(Zone.LIBRARY, filter);
if (cards.count(filter, controller.getId(), source.getSourceId(), game) > 0 target1.setRequired(false);
&& controller.choose(Outcome.PutCardInPlay, cards, target1, game)) { if (cards.count(filter, controller.getId(), source.getSourceId(), game) > 0) {
Card card = cards.get(target1.getFirstTarget(), game); if (controller.choose(Outcome.PutCardInPlay, cards, target1, game)) {
if (card != null) { Card card = cards.get(target1.getFirstTarget(), game);
cards.remove(card); if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); cards.remove(card);
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
}
target1.clearChosen();
} else {
game.informPlayers(controller.getName() + " didn't choose anything");
} }
target1.clearChosen(); } else {
game.informPlayers("No nonland permanent card with converted mana cost " + count + " or less to choose.");
} }
while (cards.size() > 0) { while (cards.size() > 0) {
Card card = cards.get(cards.iterator().next(), game); Card card = cards.get(cards.iterator().next(), game);