* Some changed to card moving (not finished)

This commit is contained in:
LevelX2 2015-10-15 08:32:58 +02:00 committed by AlumiuN
parent f801477ab5
commit 7cee34be54
15 changed files with 202 additions and 104 deletions

View file

@ -46,6 +46,7 @@ import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
@ -141,7 +142,7 @@ class InfiniteReflectionEntersBattlefieldEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
return permanent != null && permanent.getControllerId().equals(source.getControllerId())
&& permanent.getCardType().contains(CardType.CREATURE)
&& !(permanent instanceof PermanentToken);
@ -149,7 +150,7 @@ class InfiniteReflectionEntersBattlefieldEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
MageObject toCopyToObject = game.getObject(event.getTargetId());
MageObject toCopyToObject = ((EntersTheBattlefieldEvent) event).getTarget();
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && toCopyToObject != null && sourcePermanent.getAttachedTo() != null) {
Permanent toCopyFromPermanent = game.getPermanent(sourcePermanent.getAttachedTo());

View file

@ -53,7 +53,6 @@ import mage.target.common.TargetCardInLibrary;
/**
* @author duncant
*/
public class ScionOfTheUrDragon extends CardImpl {
public ScionOfTheUrDragon(UUID ownerId) {
@ -84,6 +83,7 @@ public class ScionOfTheUrDragon extends CardImpl {
}
class ScionOfTheUrDragonEffect extends SearchEffect {
private static final FilterCard filter = new FilterPermanentCard("Dragon permanent card");
static {
@ -92,7 +92,7 @@ class ScionOfTheUrDragonEffect extends SearchEffect {
public ScionOfTheUrDragonEffect() {
super(new TargetCardInLibrary(filter), Outcome.Copy);
staticText = "Search your library for a Dragon permanent card and put it into your graveyard. If you do, Scion of the Ur-Dragon becomes a copy of that card until end of turn. Then shuffle your library.";
staticText = "Search your library for a Dragon permanent card and put it into your graveyard. If you do, {this} becomes a copy of that card until end of turn. Then shuffle your library.";
}
ScionOfTheUrDragonEffect(final ScionOfTheUrDragonEffect effect) {

View file

@ -0,0 +1,69 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.copy;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class InfiniteReflectionTest extends CardTestPlayerBase {
/**
*
*/
@Test
public void testCopyAsEnters() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 9);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
// addCard(Zone.BATTLEFIELD, playerA, "Birds of Paradise", 1);
// addCard(Zone.HAND, playerA, "Nantuko Husk", 1);// {2}{B}
addCard(Zone.GRAVEYARD, playerA, "Pillarfield Ox", 1);
// Put target creature card from a graveyard onto the battlefield under your control. You lose life equal to its converted mana cost.
addCard(Zone.HAND, playerA, "Reanimate", 1); // {B}
// Enchant creature
// When Infinite Reflection enters the battlefield attached to a creature, each other nontoken creature you control becomes a copy of that creature.
// Nontoken creatures you control enter the battlefield as a copy of enchanted creature.
addCard(Zone.HAND, playerA, "Infinite Reflection", 1); // {5}{U}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Infinite Reflection", "Silvercoat Lion");
// castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nantuko Husk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate", "Pillarfield Ox");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Silvercoat Lion", 2);
}
}

View file

@ -60,7 +60,6 @@ public class VesuvaTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerB, "Glimmerpost", 1);
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Glimmerpost");
playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Glimmerpost");
playLand(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Vesuva");
@ -92,14 +91,15 @@ public class VesuvaTest extends CardTestPlayerBase {
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Dark Depths", 1);
assertPermanentCount(playerB, "Dark Depths", 1);
assertPermanentCount(playerA, "Vesuva", 0);
assertPermanentCount(playerA, "Dark Depths", 1);
Permanent darkDepth = getPermanent("Dark Depths", playerA);
if (darkDepth != null) {
Assert.assertEquals(darkDepth.getCounters().getCount("ice"), 10);
Assert.assertEquals(10, darkDepth.getCounters().getCount("ice"));
}
assertTappedCount("Dark Depths", true, 1);
}
}

View file

@ -1970,6 +1970,11 @@ public class TestPlayer implements Player {
return computerPlayer.scry(value, source, game);
}
@Override
public boolean moveCards(Card card, Zone toZone, Ability source, Game game, boolean tapped, boolean faceDown, boolean byOwner, ArrayList<UUID> appliedEffects) {
return computerPlayer.moveCards(card, toZone, source, game, tapped, faceDown, byOwner, appliedEffects);
}
@Override
public boolean moveCards(Set<Card> cards, Zone toZone, Ability source, Game game, boolean tapped, boolean faceDown, boolean byOwner, ArrayList<UUID> appliedEffects) {
return computerPlayer.moveCards(cards, toZone, source, game, tapped, faceDown, byOwner, appliedEffects);

View file

@ -39,11 +39,11 @@ import mage.constants.Zone;
public class AsEntersBattlefieldAbility extends StaticAbility {
public AsEntersBattlefieldAbility(Effect effect) {
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect));
super(Zone.ALL, new EntersBattlefieldEffect(effect));
}
public AsEntersBattlefieldAbility(Effect effect, String text) {
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect, text));
super(Zone.ALL, new EntersBattlefieldEffect(effect, text));
}
public AsEntersBattlefieldAbility(AsEntersBattlefieldAbility ability) {
@ -62,7 +62,6 @@ public class AsEntersBattlefieldAbility extends StaticAbility {
super.addEffect(effect);
}
@Override
public AsEntersBattlefieldAbility copy() {
return new AsEntersBattlefieldAbility(this);

View file

@ -876,7 +876,9 @@ public class ContinuousEffects implements Serializable {
}
}
// Must be called here for some effects to be able to work correctly
// TODO: add info which effects need that call
// For example: Vesuva copying a Dark Depth (VesuvaTest:testDarkDepth)
// This call should be removed if possible as replacement effects of EntersTheBattlefield events
// do no longer work correctly because the entering permanents are not yet on the battlefield (before they were).
game.applyEffects();
} while (true);
return caught;

View file

@ -34,6 +34,7 @@ import mage.abilities.condition.Condition;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
@ -51,6 +52,7 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl {
protected Condition condition;
protected boolean optional;
public static final String ENTERING_PERMANENT = "enteringPermanent";
public static final String SOURCE_CAST_SPELL_ABILITY = "sourceCastSpellAbility";
public EntersBattlefieldEffect(Effect baseEffect) {
@ -112,7 +114,7 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl {
if (controller == null || object == null) {
return false;
}
if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append("?").toString(), source, game)) {
if (!controller.chooseUse(outcome, "Use effect of " + object.getLogName() + "?", source, game)) {
return false;
}
}
@ -131,6 +133,8 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl {
if (spell != null) {
effect.setValue(SOURCE_CAST_SPELL_ABILITY, spell.getSpellAbility());
}
// Because the permanent is not on the battlefield yet, it has to be taken from the event
effect.setValue(ENTERING_PERMANENT, ((EntersTheBattlefieldEvent) event).getTarget());
effect.apply(game, source);
}
}

View file

@ -25,10 +25,10 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.OneShotEffect;
import mage.choices.ChoiceColor;
import mage.constants.Outcome;
@ -56,6 +56,9 @@ public class ChooseColorEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null) {
permanent = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
}
if (controller != null && permanent != null) {
ChoiceColor choice = new ChoiceColor();
while (!choice.isChosen()) {
@ -65,7 +68,7 @@ public class ChooseColorEffect extends OneShotEffect {
}
}
if (!game.isSimulation()) {
game.informPlayers(permanent.getLogName()+": "+controller.getLogName()+" has chosen "+choice.getChoice());
game.informPlayers(permanent.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
}
game.getState().setValue(source.getSourceId() + "_color", choice.getColor());
permanent.addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game);

View file

@ -25,10 +25,8 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import java.util.UUID;
import mage.MageObject;
import mage.MageObjectReference;
@ -56,39 +54,42 @@ public class CopyEffect extends ContinuousEffectImpl {
/**
* Object we copy from
*/
private MageObject target;
private MageObject copyFromObject;
private UUID sourceId;
private UUID copyToObjectId;
private ApplyToPermanent applier;
public CopyEffect(MageObject target, UUID sourceId) {
this(Duration.Custom, target, sourceId);
public CopyEffect(MageObject copyFromObject, UUID copyToObjectId) {
this(Duration.Custom, copyFromObject, copyToObjectId);
}
public CopyEffect(Duration duration, MageObject target, UUID sourceId) {
public CopyEffect(Duration duration, MageObject copyFromObject, UUID copyToObjectId) {
super(duration, Layer.CopyEffects_1, SubLayer.NA, Outcome.BecomeCreature);
this.target = target;
this.sourceId = sourceId;
this.copyFromObject = copyFromObject;
this.copyToObjectId = copyToObjectId;
}
public CopyEffect(final CopyEffect effect) {
super(effect);
this.target = effect.target.copy();
this.sourceId = effect.sourceId;
this.copyFromObject = effect.copyFromObject.copy();
this.copyToObjectId = effect.copyToObjectId;
this.applier = effect.applier;
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (!(target instanceof Permanent) && (target instanceof Card)) {
this.target = new PermanentCard((Card)target, source.getControllerId(), game);
if (!(copyFromObject instanceof Permanent) && (copyFromObject instanceof Card)) {
this.copyFromObject = new PermanentCard((Card) copyFromObject, source.getControllerId(), game);
}
affectedObjectList.add(new MageObjectReference(getSourceId(), game));
}
@Override
public boolean apply(Game game, Ability source) {
if (affectedObjectList.isEmpty()) {
affectedObjectList.add(new MageObjectReference(getSourceId(), game));
}
Permanent permanent = affectedObjectList.get(0).getPermanent(game);
if (permanent == null) {
permanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD, source.getSourceObjectZoneChangeCounter());
@ -99,31 +100,31 @@ public class CopyEffect extends ContinuousEffectImpl {
}
}
permanent.setCopy(true);
permanent.setName(target.getName());
permanent.getColor(game).setColor(target.getColor(game));
permanent.setName(copyFromObject.getName());
permanent.getColor(game).setColor(copyFromObject.getColor(game));
permanent.getManaCost().clear();
permanent.getManaCost().add(target.getManaCost());
permanent.getManaCost().add(copyFromObject.getManaCost());
permanent.getCardType().clear();
for (CardType type: target.getCardType()) {
for (CardType type : copyFromObject.getCardType()) {
permanent.getCardType().add(type);
}
permanent.getSubtype().clear();
for (String type: target.getSubtype()) {
for (String type : copyFromObject.getSubtype()) {
permanent.getSubtype().add(type);
}
permanent.getSupertype().clear();
for (String type: target.getSupertype()) {
for (String type : copyFromObject.getSupertype()) {
permanent.getSupertype().add(type);
}
permanent.removeAllAbilities(source.getSourceId(), game);
for (Ability ability: target.getAbilities()) {
for (Ability ability : copyFromObject.getAbilities()) {
permanent.addAbility(ability, getSourceId(), game, false); // no new Id so consumed replacement effects are known while new continuousEffects.apply happen.
}
permanent.getPower().setValue(target.getPower().getValue());
permanent.getToughness().setValue(target.getToughness().getValue());
if (target instanceof Permanent) {
Permanent targetPermanent = (Permanent) target;
permanent.getPower().setValue(copyFromObject.getPower().getValue());
permanent.getToughness().setValue(copyFromObject.getToughness().getValue());
if (copyFromObject instanceof Permanent) {
Permanent targetPermanent = (Permanent) copyFromObject;
permanent.setTransformed(targetPermanent.isTransformed());
permanent.setSecondCardFace(targetPermanent.getSecondCardFace());
permanent.setFlipCard(targetPermanent.isFlipCard());
@ -131,12 +132,12 @@ public class CopyEffect extends ContinuousEffectImpl {
}
// to get the image of the copied permanent copy number und expansionCode
if (target instanceof PermanentCard) {
permanent.setCardNumber(((PermanentCard) target).getCard().getCardNumber());
permanent.setExpansionSetCode(((PermanentCard) target).getCard().getExpansionSetCode());
} else if (target instanceof PermanentToken || target instanceof Card) {
permanent.setCardNumber(((Card) target).getCardNumber());
permanent.setExpansionSetCode(((Card) target).getExpansionSetCode());
if (copyFromObject instanceof PermanentCard) {
permanent.setCardNumber(((PermanentCard) copyFromObject).getCard().getCardNumber());
permanent.setExpansionSetCode(((PermanentCard) copyFromObject).getCard().getExpansionSetCode());
} else if (copyFromObject instanceof PermanentToken || copyFromObject instanceof Card) {
permanent.setCardNumber(((Card) copyFromObject).getCardNumber());
permanent.setExpansionSetCode(((Card) copyFromObject).getExpansionSetCode());
}
return true;
}
@ -147,15 +148,15 @@ public class CopyEffect extends ContinuousEffectImpl {
}
public MageObject getTarget() {
return target;
return copyFromObject;
}
public void setTarget(MageObject target) {
this.target = target;
this.copyFromObject = target;
}
public UUID getSourceId() {
return sourceId;
return copyToObjectId;
}
public ApplyToPermanent getApplier() {

View file

@ -73,7 +73,7 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
Card card = game.getCard(targetId);
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId(), tapped);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, tapped, false, false, null);
}
}
return true;

View file

@ -25,15 +25,15 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common.counter;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.counters.Counter;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -67,7 +67,8 @@ public class AddCountersSourceEffect extends OneShotEffect {
* @param counter
* @param amount this amount will be added to the counter instances
* @param informPlayers
* @param putOnCard - counters have to be put on a card instead of a permanent
* @param putOnCard - counters have to be put on a card instead of a
* permanent
*/
public AddCountersSourceEffect(Counter counter, DynamicValue amount, boolean informPlayers, boolean putOnCard) {
super(Outcome.Benefit);
@ -106,7 +107,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
if (informPlayers && !game.isSimulation()) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(new StringBuilder(player.getLogName()).append(" puts ").append(newCounter.getCount()).append(" ").append(newCounter.getName().toLowerCase()).append(" counter on ").append(card.getLogName()).toString());
game.informPlayers(player.getLogName() + " puts " + newCounter.getCount() + " " + newCounter.getName().toLowerCase() + " counter on " + card.getLogName());
}
}
}
@ -114,6 +115,9 @@ public class AddCountersSourceEffect extends OneShotEffect {
}
} else {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null) {
permanent = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
}
if (permanent != null) {
if (counter != null) {
Counter newCounter = counter.copy();
@ -129,7 +133,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
int amountAdded = permanent.getCounters().getCount(newCounter.getName()) - before;
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(player.getLogName()+" puts "+amountAdded+" "+newCounter.getName().toLowerCase()+" counter on "+permanent.getLogName());
game.informPlayers(player.getLogName() + " puts " + amountAdded + " " + newCounter.getName().toLowerCase() + " counter on " + permanent.getLogName());
}
}
}
@ -165,5 +169,4 @@ public class AddCountersSourceEffect extends OneShotEffect {
return new AddCountersSourceEffect(this);
}
}

View file

@ -167,6 +167,10 @@ public class Spell extends StackObjImpl implements Card {
@Override
public boolean resolve(Game game) {
boolean result;
Player controller = game.getPlayer(getControllerId());
if (controller == null) {
return false;
}
if (this.getCardType().contains(CardType.INSTANT) || this.getCardType().contains(CardType.SORCERY)) {
int index = 0;
result = false;
@ -261,6 +265,7 @@ public class Spell extends StackObjImpl implements Card {
}
} else {
updateOptionalCosts(0);
// return controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null);
result = card.putOntoBattlefield(game, Zone.STACK, ability.getSourceId(), controllerId, false, faceDown);
return result;
}

View file

@ -635,6 +635,8 @@ public interface Player extends MageItem, Copyable<Player> {
boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game);
boolean moveCards(Card card, Zone toZone, Ability source, Game game, boolean tapped, boolean faceDown, boolean byOwner, ArrayList<UUID> appliedEffects);
/**
*
* @param cards
@ -646,6 +648,7 @@ public interface Player extends MageItem, Copyable<Player> {
* @param byOwner the card is moved (or put onto battlefield) by the owner
* of the card and if target zone is battlefield controlls the permanent
* (instead of the controller of the source)
* @param appliedEffects
* @return
*/
boolean moveCards(Set<Card> cards, Zone toZone, Ability source, Game game, boolean tapped, boolean faceDown, boolean byOwner, ArrayList<UUID> appliedEffects);

View file

@ -1022,7 +1022,7 @@ public abstract class PlayerImpl implements Player, Serializable {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LAND_PLAYED, card.getId(), card.getId(), playerId));
game.fireInformEvent(getLogName() + " plays " + card.getLogName());
// game.removeBookmark(bookmark);
resetStoredBookmark(game);
resetStoredBookmark(game); // prevent undo after playing a land
return true;
}
// putOntoBattlefield retured false if putOntoBattlefield was replaced by replacement effect (e.g. Kjeldorian Outpost).
@ -2998,22 +2998,6 @@ public abstract class PlayerImpl implements Player, Serializable {
successfulMovedCards = moveCardsToGraveyardWithInfo(cards, source, game, fromZone);
break;
case HAND:
for (Card card : cards) {
fromZone = game.getState().getZone(card.getId());
// if (fromZone == Zone.STACK) {
// // If a spell is returned to its owner's hand, it's removed from the stack and thus will not resolve
// Spell spell = game.getStack().getSpell(card.getId());
// if (spell != null) {
// game.getStack().remove(spell);
// }
// }
boolean hideCard = fromZone.equals(Zone.LIBRARY)
|| (card.isFaceDown(game) && !fromZone.equals(Zone.STACK) && !fromZone.equals(Zone.BATTLEFIELD));
if (moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, !hideCard)) {
successfulMovedCards.add(card);
}
}
break;
case BATTLEFIELD:
return moveCards(cards, toZone, source, game, false, false, false, null);
case LIBRARY:
@ -3032,6 +3016,15 @@ public abstract class PlayerImpl implements Player, Serializable {
return successfulMovedCards.size() > 0;
}
@Override
public boolean moveCards(Card card, Zone toZone, Ability source, Game game, boolean tapped, boolean faceDown, boolean byOwner, ArrayList<UUID> appliedEffects) {
Set<Card> cardList = new HashSet<>();
if (card != null) {
cardList.add(card);
}
return moveCards(cardList, toZone, source, game, tapped, faceDown, byOwner, appliedEffects);
}
@Override
public boolean moveCards(Set<Card> cards, Zone toZone, Ability source, Game game, boolean tapped, boolean faceDown, boolean byOwner, ArrayList<UUID> appliedEffects) {
if (cards.isEmpty()) {
@ -3070,7 +3063,6 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
game.setScopeRelevant(false);
game.applyEffects();
for (Permanent permanent : permanentsEntered) {
fromZone = game.getState().getZone(permanent.getId());
if (((Card) permanent).removeFromZone(game, fromZone, source.getSourceId())) {
@ -3086,6 +3078,17 @@ public abstract class PlayerImpl implements Player, Serializable {
game.addSimultaneousEvent(new ZoneChangeEvent(permanent, permanent.getControllerId(), fromZone, Zone.BATTLEFIELD));
}
}
game.applyEffects();
break;
case HAND:
for (Card card : cards) {
fromZone = game.getState().getZone(card.getId());
boolean hideCard = fromZone.equals(Zone.LIBRARY)
|| (card.isFaceDown(game) && !fromZone.equals(Zone.STACK) && !fromZone.equals(Zone.BATTLEFIELD));
if (moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, !hideCard)) {
successfulMovedCards.add(card);
}
}
break;
default:
throw new UnsupportedOperationException("to Zone not supported yet");