From 5bc1036ef9d36eaf5f49b898665e92f83051b5c5 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 16 Jun 2014 21:46:22 +0200 Subject: [PATCH] * Stoneforge Mystic - Fixed that for the second effect the artifact had wrongly be selected already during activation instead of resolution. --- .../mage/sets/conflux/MasterTransmuter.java | 5 +- .../mage/sets/worldwake/StoneforgeMystic.java | 64 ++++++++++++++++--- .../PutCreatureOnBattlefieldEffect.java | 2 +- 3 files changed, 59 insertions(+), 12 deletions(-) diff --git a/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java b/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java index d42ce75ebd..829342a651 100644 --- a/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java +++ b/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java @@ -105,12 +105,11 @@ class MasterTransmuterEffect extends OneShotEffect { if (controller != null) { Target target = new TargetCardInHand(new FilterArtifactCard("an artifact card from your hand")); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) - && controller.chooseUse(outcome, "Put an artifact from your hand to battlefield??", 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); + controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); } } } diff --git a/Mage.Sets/src/mage/sets/worldwake/StoneforgeMystic.java b/Mage.Sets/src/mage/sets/worldwake/StoneforgeMystic.java index bf074a73fb..4c8cdcfd1c 100644 --- a/Mage.Sets/src/mage/sets/worldwake/StoneforgeMystic.java +++ b/Mage.Sets/src/mage/sets/worldwake/StoneforgeMystic.java @@ -28,24 +28,32 @@ package mage.sets.worldwake; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; +import java.util.UUID; import mage.MageInt; +import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.common.FilterArtifactCard; import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInLibrary; -import java.util.UUID; -import mage.abilities.effects.common.PutOntoBattlefieldTargetEffect; + /** * @@ -74,9 +82,8 @@ public class StoneforgeMystic extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), true)); // {1}{W}, {T}: You may put an Equipment card from your hand onto the battlefield. - SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutOntoBattlefieldTargetEffect(false, true), new ManaCostsImpl("{1}{W}")); + SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new StoneforgeMysticEffect(), new ManaCostsImpl("{1}{W}")); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetCardInHand(0, 1, filter)); this.addAbility(ability); } @@ -90,3 +97,44 @@ public class StoneforgeMystic extends CardImpl { } } + +class StoneforgeMysticEffect extends OneShotEffect { + + private static final FilterArtifactCard filter = new FilterArtifactCard("Equipment card"); + + static { + filter.add(new SubtypePredicate("Equipment")); + } + + public StoneforgeMysticEffect() { + super(Outcome.Benefit); + this.staticText = "You may put an Equipment card from your hand onto the battlefield"; + } + + public StoneforgeMysticEffect(final StoneforgeMysticEffect effect) { + super(effect); + } + + @Override + public StoneforgeMysticEffect copy() { + return new StoneforgeMysticEffect(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 Equipment card from your hand")); + if (target.canChoose(source.getSourceId(), source.getControllerId(), game) + && controller.chooseUse(outcome, "Put an Equipment from your hand to battlefield?", game) + && controller.chooseTarget(outcome, target, source, game)) { + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); + } + } + } + + return false; + } +} diff --git a/Mage/src/mage/abilities/effects/common/PutCreatureOnBattlefieldEffect.java b/Mage/src/mage/abilities/effects/common/PutCreatureOnBattlefieldEffect.java index a803bb770d..14f106c56b 100644 --- a/Mage/src/mage/abilities/effects/common/PutCreatureOnBattlefieldEffect.java +++ b/Mage/src/mage/abilities/effects/common/PutCreatureOnBattlefieldEffect.java @@ -42,7 +42,7 @@ public class PutCreatureOnBattlefieldEffect extends OneShotEffect { if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId()); + player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); return true; } }