* Clutch of Currents - Fixed wrong target handling.

This commit is contained in:
LevelX2 2016-01-12 15:38:44 +01:00
parent 5582db0332
commit 52d8fce569
5 changed files with 39 additions and 7 deletions

View file

@ -46,7 +46,7 @@ public class ClutchOfCurrents extends CardImpl {
this.expansionSetCode = "BFZ";
// Return target creature to its owner's hand.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(true, false));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
// Awaken 3{4}{U}

View file

@ -47,7 +47,7 @@ public class ChurningEddy extends CardImpl {
this.expansionSetCode = "TOR";
// Return target creature and target land to their owners' hands.
Effect effect = new ReturnToHandTargetEffect();
Effect effect = new ReturnToHandTargetEffect(true, true);
effect.setText("Return target creature and target land to their owners' hands");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetCreaturePermanent());

View file

@ -32,7 +32,6 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;

View file

@ -29,6 +29,7 @@ package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.filter.Filter;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -120,4 +121,31 @@ public class AwakenTest extends CardTestPlayerBase {
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
}
/**
* Awakened Clutch of Currents returned the targeted land (for awaken) to my
* hand in addition to the targeted creature.
*/
@Test
public void testClutchOfCurrents() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
// Return target creature to its owner's hand.
// Awaken 3{4}{U}
addCard(Zone.HAND, playerA, "Clutch of Currents", 1); // {U}
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Clutch of Currents with awaken", "Silvercoat Lion");
addTarget(playerA, "Island");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Clutch of Currents", 1);
assertHandCount(playerB, "Silvercoat Lion", 1);
assertPermanentCount(playerA, "Island", 5);
assertPowerToughness(playerA, "Island", 3, 3, Filter.ComparisonScope.Any);
}
}

View file

@ -40,7 +40,6 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.targetpointer.FirstTargetPointer;
import mage.util.CardUtil;
/**
@ -49,19 +48,26 @@ import mage.util.CardUtil;
public class ReturnToHandTargetEffect extends OneShotEffect {
boolean withName;
protected boolean multitargetHandling;
public ReturnToHandTargetEffect() {
this(true);
}
public ReturnToHandTargetEffect(boolean withName) {
this(withName, false);
}
public ReturnToHandTargetEffect(boolean withName, boolean multitargetHandling) {
super(Outcome.ReturnToHand);
this.withName = withName;
this.multitargetHandling = multitargetHandling;
}
public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) {
super(effect);
this.withName = effect.withName;
this.multitargetHandling = effect.multitargetHandling;
}
@Override
@ -76,7 +82,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
return false;
}
Set<Card> cards = new LinkedHashSet<>();
if (source.getTargets().size() > 1 && targetPointer instanceof FirstTargetPointer) {
if (multitargetHandling) {
for (Target target : source.getTargets()) {
for (UUID targetId : target.getTargets()) {
MageObject mageObject = game.getObject(targetId);
@ -85,8 +91,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
}
}
}
}
else {
} else {
for (UUID targetId : targetPointer.getTargets(game, source)) {
MageObject mageObject = game.getObject(targetId);
if (mageObject != null) {