* Master Transmuter - Fixed that the artifact from the hand had to be selected during casting instead correctly during resolving of Master Transmuter's activated ability.

This commit is contained in:
LevelX2 2013-06-11 00:14:48 +02:00
parent d1fa497b28
commit 786b59c923

View file

@ -29,6 +29,7 @@ package mage.sets.conflux;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
@ -37,10 +38,15 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ReturnToHandTargetCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutOntoBattlefieldTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterArtifactCard;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetControlledPermanent;
@ -61,10 +67,9 @@ public class MasterTransmuter extends CardImpl<MasterTransmuter> {
this.toughness = new MageInt(2);
// {U}, {tap}, Return an artifact you control to its owner's hand: You may put an artifact card from your hand onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutOntoBattlefieldTargetEffect(false, true), new ManaCostsImpl("{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MasterTransmuterEffect(), new ManaCostsImpl("{U}"));
ability.addCost(new TapSourceCost());
ability.addCost(new ReturnToHandTargetCost(new TargetControlledPermanent(new FilterControlledArtifactPermanent("an artifact"))));
ability.addTarget(new TargetCardInHand(new FilterArtifactCard("an artifact card from your hand")));
this.addAbility(ability);
}
@ -78,3 +83,40 @@ public class MasterTransmuter extends CardImpl<MasterTransmuter> {
return new MasterTransmuter(this);
}
}
class MasterTransmuterEffect extends OneShotEffect<MasterTransmuterEffect> {
public MasterTransmuterEffect() {
super(Outcome.Benefit);
this.staticText = "You may put an artifact card from your hand onto the battlefield";
}
public MasterTransmuterEffect(final MasterTransmuterEffect effect) {
super(effect);
}
@Override
public MasterTransmuterEffect copy() {
return new MasterTransmuterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Target target = new TargetCardInHand(new FilterArtifactCard("an artifact card from your hand"));
target.setRequired(true);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& controller.chooseUse(outcome, "Put an artifact from your hand to battlefield??", game)
&& controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.getHand().remove(card);
return card.moveToZone(Zone.BATTLEFIELD, source.getId(), game, false);
}
}
}
return false;
}
}