* See the Unwritten - Fxed that the selection of creatures was not optional.

This commit is contained in:
LevelX2 2014-10-10 14:56:39 +02:00
parent 0a23fe1e8a
commit d35b168cd5

View file

@ -30,7 +30,6 @@ package mage.sets.khansoftarkir;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.condition.InvertCondition; import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.FerociousCondition; import mage.abilities.condition.common.FerociousCondition;
import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.decorator.ConditionalOneShotEffect;
@ -47,7 +46,6 @@ import mage.filter.common.FilterCreatureCard;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import mage.util.CardUtil;
@ -114,32 +112,34 @@ class SeeTheUnwrittenEffect extends OneShotEffect {
if (player != null && sourceObject != null) { if (player != null && sourceObject != null) {
Cards cards = new CardsImpl(Zone.LIBRARY); Cards cards = new CardsImpl(Zone.LIBRARY);
boolean properCardFound = false; int creatureCardsFound = 0;
int count = Math.min(player.getLibrary().size(), 8); int count = Math.min(player.getLibrary().size(), 8);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
Card card = player.getLibrary().removeFromTop(game); Card card = player.getLibrary().removeFromTop(game);
if (card != null) { if (card != null) {
cards.add(card); cards.add(card);
if (filter.match(card, source.getSourceId(), source.getControllerId(), game)) { if (filter.match(card, source.getSourceId(), source.getControllerId(), game)) {
properCardFound = true; creatureCardsFound++;
} }
} }
} }
if (!cards.isEmpty()) { if (!cards.isEmpty()) {
player.revealCards(sourceObject.getLogName(), cards, game); player.revealCards(sourceObject.getLogName(), cards, game);
TargetCard target = new TargetCard(numberOfCardsToPutIntoPlay, numberOfCardsToPutIntoPlay, Zone.LIBRARY, filter); if (creatureCardsFound > 0 && player.chooseUse(outcome, "Put creature(s) into play?", game)) {
if (properCardFound && player.choose(Outcome.PutCreatureInPlay, cards, target, game)) { int cardsToChoose = Math.min(numberOfCardsToPutIntoPlay, creatureCardsFound);
for(UUID creatureId: target.getTargets()) { TargetCard target = new TargetCard(cardsToChoose, cardsToChoose, Zone.LIBRARY, filter);
Card card = game.getCard(creatureId); if (player.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
if (card != null) { for(UUID creatureId: target.getTargets()) {
cards.remove(card); Card card = game.getCard(creatureId);
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); if (card != null) {
cards.remove(card);
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
}
} }
} }
} }
for (UUID cardId : cards) { for (UUID cardId : cards) {
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
if (card != null) { if (card != null) {