diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SurgeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SurgeTest.java index 171781717c0..a636fe4d5bc 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SurgeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SurgeTest.java @@ -70,17 +70,26 @@ public class SurgeTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Crush of Tentacles"); // {4}{U}{U} addCard(Zone.HAND, playerA, "Lightning Bolt"); addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); + + // Put a token onto the battlefield that's a copy of target creature you control. + // Flashback {5}{U}{U}(You may cast this card from your graveyard for its flashback cost. Then exile it.) + addCard(Zone.HAND, playerB, "Cackling Counterpart"); + addCard(Zone.BATTLEFIELD, playerB, "Island", 3); addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Cackling Counterpart", "Silvercoat Lion"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Crush of Tentacles with surge"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); assertGraveyardCount(playerA, "Lightning Bolt", 1); + assertGraveyardCount(playerB, "Cackling Counterpart", 1); assertGraveyardCount(playerA, "Crush of Tentacles", 1); assertPermanentCount(playerA, "Octopus", 1); + assertPermanentCount(playerB, "Silvercoat Lion", 0); assertHandCount(playerA, "Silvercoat Lion", 1); assertHandCount(playerB, "Silvercoat Lion", 1); assertPermanentCount(playerA, 7); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandFromBattlefieldAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandFromBattlefieldAllEffect.java index 67977bfa6d2..403295e818d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandFromBattlefieldAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandFromBattlefieldAllEffect.java @@ -27,10 +27,11 @@ */ package mage.abilities.effects.common; +import java.util.HashSet; +import java.util.Set; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.cards.Cards; -import mage.cards.CardsImpl; +import mage.cards.Card; import mage.constants.Outcome; import mage.constants.Zone; import mage.filter.FilterPermanent; @@ -61,11 +62,11 @@ public class ReturnToHandFromBattlefieldAllEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Cards cardsToHand = new CardsImpl(); + Set permanentsToHand = new HashSet<>(); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - cardsToHand.add(permanent); + permanentsToHand.add(permanent); } - controller.moveCards(cardsToHand, Zone.HAND, source, game); + controller.moveCards(permanentsToHand, Zone.HAND, source, game); return true; } return false;