* Replaced some wrong card movement handling.

This commit is contained in:
LevelX2 2018-04-26 17:30:44 +02:00
parent 798196c765
commit 90e9a21aa5
4 changed files with 47 additions and 49 deletions

View file

@ -37,10 +37,10 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -54,7 +54,7 @@ import mage.util.CardUtil;
public class SummonersEgg extends CardImpl {
public SummonersEgg(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{4}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
this.subtype.add(SubType.CONSTRUCT);
this.power = new MageInt(0);
this.toughness = new MageInt(4);
@ -90,9 +90,9 @@ class SummonersEggImprintEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null) {
if (controller != null && sourcePermanent != null) {
if (!controller.getHand().isEmpty()) {
TargetCard target = new TargetCard(Zone.HAND, new FilterCard());
TargetCard target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& controller.choose(Outcome.Benefit, controller.getHand(), target, game)) {
Card card = controller.getHand().get(target.getFirstTarget(), game);
@ -100,11 +100,8 @@ class SummonersEggImprintEffect extends OneShotEffect {
card.setFaceDown(true, game);
controller.moveCardsToExile(card, source, game, false, source.getSourceId(), sourcePermanent.getIdName() + " (Imprint)");
card.setFaceDown(true, game);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.imprint(card.getId(), game);
permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card]"), game);
}
sourcePermanent.imprint(card.getId(), game);
sourcePermanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card]"), game);
}
}
}
@ -150,7 +147,7 @@ class SummonersEggPutOntoBattlefieldEffect extends OneShotEffect {
//If it's a creature card,
if (imprintedCard.isCreature()) {
//put it onto the battlefield under your control
imprintedCard.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), source.getControllerId());
controller.moveCards(imprintedCard, Zone.BATTLEFIELD, source, game);
}
}
}

View file

@ -35,7 +35,6 @@ import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -142,24 +141,13 @@ class SynodSanctumEffect2 extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
if (exileId == null) {
return false;
ExileZone exileZone = game.getExile().getExileZone(exileId);
if (exileZone == null) {
return true;
}
ExileZone exile = game.getExile().getExileZone(exileId);
if (exile == null) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
boolean allReturned = true;
if (controller != null && sourceObject != null) {
for (Card card : exile.getCards(game)) {
if (!card.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), controller.getId())) {
allReturned = false;
}
}
return allReturned;
if (controller != null) {
return controller.moveCards(exileZone, Zone.BATTLEFIELD, source, game);
}
return false;
}

View file

@ -28,6 +28,7 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -48,8 +49,7 @@ import mage.target.common.TargetOpponent;
public class TeleminPerformance extends CardImpl {
public TeleminPerformance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}{U}");
// Target opponent reveals cards from the top of their library until he or she reveals a creature card. That player puts all noncreature cards revealed this way into their graveyard, then you put the creature card onto the battlefield under your control.
this.getSpellAbility().addEffect(new TeleminPerformanceEffect());
@ -85,28 +85,36 @@ class TeleminPerformanceEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card creature = null;
Player opponent = game.getPlayer(source.getFirstTarget());
CardsImpl cards = new CardsImpl();
boolean creatureFound = false;
while (opponent.getLibrary().hasCards() && !creatureFound) {
Card card = opponent.getLibrary().removeFromTop(game);
if (card != null) {
if (card.isCreature()) {
creature = card;
creatureFound = true;
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
if (opponent != null) {
Card creature = null;
CardsImpl cards = new CardsImpl();
boolean creatureFound = false;
while (opponent.getLibrary().hasCards() && !creatureFound) {
Card card = opponent.getLibrary().removeFromTop(game);
if (card != null) {
if (card.isCreature()) {
creature = card;
creatureFound = true;
}
if (!creatureFound) {
cards.add(card);
}
}
}
if (!creatureFound) {
cards.add(card);
if (!cards.isEmpty()) {
opponent.revealCards(sourceObject.getIdName(), cards, game);
opponent.moveCards(cards, Zone.GRAVEYARD, source, game);
}
game.applyEffects();
if (creature != null) {
controller.moveCards(creature, Zone.BATTLEFIELD, source, game);
}
}
}
if (!cards.isEmpty()) {
opponent.revealCards("Telemin Performance", cards, game);
opponent.moveCards(cards, Zone.GRAVEYARD, source, game);
}
if (creature != null) {
return creature.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
return true;
}
return false;
}

View file

@ -41,6 +41,11 @@ public final class StaticFilters {
static {
FILTER_ENCHANTMENT_PERMANENT.setLockedFilter(true);
}
public static final FilterCard FILTER_CARD = new FilterCard("card");
static {
FILTER_CARD.setLockedFilter(true);
}
public static final FilterCard FILTER_CARD_CARDS = new FilterCard("cards");