diff --git a/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java b/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java index ef7c3c5870..12c4cde6d0 100644 --- a/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java +++ b/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java @@ -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 { 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 { return new MasterTransmuter(this); } } + +class MasterTransmuterEffect extends OneShotEffect { + + 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; + } +}