mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Mayael the Anuma - Fixed that the selected card was moved to hand instead correctly to the battlefield.
This commit is contained in:
parent
fbb9cd7908
commit
df728473c7
3 changed files with 76 additions and 34 deletions
|
@ -48,7 +48,7 @@ import mage.filter.predicate.mageobject.PowerPredicate;
|
||||||
*/
|
*/
|
||||||
public class MayaelTheAnima extends CardImpl<MayaelTheAnima> {
|
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 {
|
static {
|
||||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||||
filter.add(new PowerPredicate(ComparisonType.GreaterThan, 4));
|
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.
|
// 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.
|
// Put the rest on the bottom of your library in any order.
|
||||||
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
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}"));
|
new ManaCostsImpl("{3}{R}{G}{W}"));
|
||||||
ability.addCost(new TapSourceCost());
|
ability.addCost(new TapSourceCost());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
|
@ -31,8 +31,6 @@ package mage.abilities.effects.common;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
@ -40,6 +38,8 @@ import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
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);
|
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) {
|
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);
|
super(Outcome.DrawCard, numberOfCards, mayShuffleAfter, targetZoneLookedCards, putOnTop);
|
||||||
this.numberToPick = numberToPick;
|
this.numberToPick = numberToPick;
|
||||||
this.filter = pickFilter;
|
this.filter = pickFilter;
|
||||||
this.revealPickedCards = reveal;
|
this.revealPickedCards = reveal;
|
||||||
|
this.targetPickedCards = targetZonePickedCards;
|
||||||
this.upTo = upTo;
|
this.upTo = upTo;
|
||||||
|
this.optional = optional;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LookLibraryAndPickControllerEffect(final LookLibraryAndPickControllerEffect effect) {
|
public LookLibraryAndPickControllerEffect(final LookLibraryAndPickControllerEffect effect) {
|
||||||
|
@ -91,6 +102,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
||||||
this.revealPickedCards = effect.revealPickedCards;
|
this.revealPickedCards = effect.revealPickedCards;
|
||||||
this.targetPickedCards = effect.targetPickedCards;
|
this.targetPickedCards = effect.targetPickedCards;
|
||||||
this.upTo = effect.upTo;
|
this.upTo = effect.upTo;
|
||||||
|
this.optional = effect.optional;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,16 +121,9 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
||||||
protected void actionWithSelectedCards(Cards cards, Game game, Ability source, String windowName) {
|
protected void actionWithSelectedCards(Cards cards, Game game, Ability source, String windowName) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null && foundCardsToPick > 0) {
|
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();
|
FilterCard pickFilter = filter.copy();
|
||||||
// Set the pick message
|
pickFilter.setMessage(getPickText());
|
||||||
StringBuilder sb = new StringBuilder(filter.getMessage()).append(" to ");
|
|
||||||
if (revealPickedCards) {
|
|
||||||
sb.append("reveal and ");
|
|
||||||
}
|
|
||||||
sb.append("put into your hand");
|
|
||||||
|
|
||||||
pickFilter.setMessage(sb.toString());
|
|
||||||
TargetCard target = new TargetCard((upTo ? 0:numberToPick.calculate(game, source)),numberToPick.calculate(game, source), Zone.PICK, pickFilter);
|
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)) {
|
if (player.choose(Outcome.DrawCard, cards, target, game)) {
|
||||||
Cards reveal = new CardsImpl();
|
Cards reveal = new CardsImpl();
|
||||||
|
@ -126,7 +131,11 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
||||||
Card card = cards.get(cardId, game);
|
Card card = cards.get(cardId, game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
cards.remove(card);
|
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) {
|
if (revealPickedCards) {
|
||||||
reveal.add(card);
|
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
|
@Override
|
||||||
public String getText(Mode mode) {
|
public String getText(Mode mode) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (numberToPick.calculate(null, null) > 0) {
|
if (numberToPick.calculate(null, null) > 0) {
|
||||||
if (revealPickedCards) {
|
|
||||||
sb.append(". You may reveal ");
|
if (revealPickedCards) {
|
||||||
sb.append(filter.getMessage()).append(" from among them and put it into your ");
|
sb.append(". You may reveal ");
|
||||||
} else {
|
sb.append(filter.getMessage()).append(" from among them and put it into your ");
|
||||||
sb.append(". Put one of them into your ");
|
} else {
|
||||||
}
|
if (targetPickedCards.equals(Zone.BATTLEFIELD)) {
|
||||||
sb.append(targetPickedCards.toString().toLowerCase());
|
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) {
|
if (targetZoneLookedCards == Zone.LIBRARY) {
|
||||||
sb.append(". Put the rest ");
|
sb.append(". Put the rest ");
|
||||||
if (putOnTop) {
|
if (putOnTop) {
|
||||||
|
|
|
@ -43,6 +43,7 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -230,20 +231,8 @@ public class LookLibraryControllerEffect extends OneShotEffect<LookLibraryContro
|
||||||
case 1:
|
case 1:
|
||||||
sb.append("card ");
|
sb.append("card ");
|
||||||
break;
|
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:
|
default:
|
||||||
sb.append(numberLook);
|
sb.append(CardUtil.numberToText(numberLook));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (numberLook != 1) {
|
if (numberLook != 1) {
|
||||||
|
|
Loading…
Reference in a new issue