Mayael the Anuma - Fixed that the selected card was moved to hand instead correctly to the battlefield.

This commit is contained in:
LevelX2 2013-09-21 17:50:39 +02:00
parent fbb9cd7908
commit df728473c7
3 changed files with 76 additions and 34 deletions

View file

@ -48,7 +48,7 @@ import mage.filter.predicate.mageobject.PowerPredicate;
*/
public class MayaelTheAnima extends CardImpl<MayaelTheAnima> {
private static final FilterCreatureCard filter = new FilterCreatureCard("a creature card with power 5 or greater to put onto the battlefield");
private static final FilterCreatureCard filter = new FilterCreatureCard("a creature card with power 5 or greater");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new PowerPredicate(ComparisonType.GreaterThan, 4));
@ -71,7 +71,7 @@ public class MayaelTheAnima extends CardImpl<MayaelTheAnima> {
// You may put a creature card with power 5 or greater from among them onto the battlefield.
// Put the rest on the bottom of your library in any order.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new LookLibraryAndPickControllerEffect(5,1, filter,false),
new LookLibraryAndPickControllerEffect(5,1, filter,false, false, Zone.BATTLEFIELD, true),
new ManaCostsImpl("{3}{R}{G}{W}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -31,8 +31,6 @@ package mage.abilities.effects.common;
import java.util.List;
import java.util.UUID;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
@ -40,6 +38,8 @@ import mage.abilities.dynamicvalue.common.StaticValue;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
@ -76,12 +76,23 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
this(new StaticValue(numberOfCards), false, new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false, true, upTo);
}
public LookLibraryAndPickControllerEffect(int numberOfCards, int numberToPick, FilterCard pickFilter, boolean reveal, boolean upTo, Zone targetZonePickedCards, boolean optional) {
this(new StaticValue(numberOfCards), false, new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false, reveal, upTo, targetZonePickedCards, optional);
}
public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal, boolean upTo) {
this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, targetZoneLookedCards, putOnTop, reveal, upTo, Zone.HAND, false);
}
public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal, boolean upTo, Zone targetZonePickedCards, boolean optional) {
super(Outcome.DrawCard, numberOfCards, mayShuffleAfter, targetZoneLookedCards, putOnTop);
this.numberToPick = numberToPick;
this.filter = pickFilter;
this.revealPickedCards = reveal;
this.targetPickedCards = targetZonePickedCards;
this.upTo = upTo;
this.optional = optional;
}
public LookLibraryAndPickControllerEffect(final LookLibraryAndPickControllerEffect effect) {
@ -91,6 +102,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
this.revealPickedCards = effect.revealPickedCards;
this.targetPickedCards = effect.targetPickedCards;
this.upTo = effect.upTo;
this.optional = effect.optional;
}
@Override
@ -109,16 +121,9 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
protected void actionWithSelectedCards(Cards cards, Game game, Ability source, String windowName) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && foundCardsToPick > 0) {
if (!optional || player.chooseUse(Outcome.DrawCard, "Do you wish to reveal "+filter.getMessage()+" and put it into your hand?", game)) {
if (!optional || player.chooseUse(Outcome.DrawCard, getMayText(), game)) {
FilterCard pickFilter = filter.copy();
// Set the pick message
StringBuilder sb = new StringBuilder(filter.getMessage()).append(" to ");
if (revealPickedCards) {
sb.append("reveal and ");
}
sb.append("put into your hand");
pickFilter.setMessage(sb.toString());
pickFilter.setMessage(getPickText());
TargetCard target = new TargetCard((upTo ? 0:numberToPick.calculate(game, source)),numberToPick.calculate(game, source), Zone.PICK, pickFilter);
if (player.choose(Outcome.DrawCard, cards, target, game)) {
Cards reveal = new CardsImpl();
@ -126,7 +131,11 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
Card card = cards.get(cardId, game);
if (card != null) {
cards.remove(card);
card.moveToZone(targetPickedCards, source.getId(), game, false);
if (targetZoneLookedCards.equals(Zone.BATTLEFIELD)) {
card.putOntoBattlefield(game, Zone.PICK, source.getSourceId(), source.getControllerId());
} else {
card.moveToZone(targetPickedCards, source.getId(), game, false);
}
if (revealPickedCards) {
reveal.add(card);
}
@ -142,17 +151,61 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
}
private String getMayText() {
StringBuilder sb = new StringBuilder("Do you wish to ");
switch(targetPickedCards) {
case HAND:
if (revealPickedCards) {
sb.append("reveal ").append(filter.getMessage()).append(" and put into your hand");
} else {
sb.append("put ").append(filter.getMessage()).append(" into your hand");
}
break;
case BATTLEFIELD:
sb.append("put ").append(filter.getMessage()).append(" onto the battlefield");
break;
}
return sb.append("?").toString();
}
private String getPickText() {
StringBuilder sb = new StringBuilder(filter.getMessage()).append(" to ");
switch(targetPickedCards) {
case HAND:
if (revealPickedCards) {
sb.append("reveal and put into your hand");
} else {
sb.append("put into your hand");
}
break;
case BATTLEFIELD:
sb.append("put onto the battlefield");
break;
}
return sb.toString();
}
@Override
public String getText(Mode mode) {
StringBuilder sb = new StringBuilder();
if (numberToPick.calculate(null, null) > 0) {
if (revealPickedCards) {
sb.append(". You may reveal ");
sb.append(filter.getMessage()).append(" from among them and put it into your ");
} else {
sb.append(". Put one of them into your ");
}
sb.append(targetPickedCards.toString().toLowerCase());
if (revealPickedCards) {
sb.append(". You may reveal ");
sb.append(filter.getMessage()).append(" from among them and put it into your ");
} else {
if (targetPickedCards.equals(Zone.BATTLEFIELD)) {
sb.append(". You ");
if (optional) {
sb.append("may ");
}
sb.append("put ").append(filter.getMessage()).append(" from among them onto the ");
} else {
sb.append(". Put one of them into your ");
}
}
sb.append(targetPickedCards.toString().toLowerCase());
if (targetZoneLookedCards == Zone.LIBRARY) {
sb.append(". Put the rest ");
if (putOnTop) {

View file

@ -43,6 +43,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.util.CardUtil;
/**
*
@ -230,20 +231,8 @@ public class LookLibraryControllerEffect extends OneShotEffect<LookLibraryContro
case 1:
sb.append("card ");
break;
case 2:
sb.append("two");
break;
case 3:
sb.append("three");
break;
case 4:
sb.append("four");
break;
case 5:
sb.append("five");
break;
default:
sb.append(numberLook);
sb.append(CardUtil.numberToText(numberLook));
break;
}
if (numberLook != 1) {