From cd4d00e31a10c370caaf6faf05d108cd93880d44 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 6 May 2014 08:18:55 +0200 Subject: [PATCH] * Goblin Welder - Fixed that the artifact came into play for the owner of the artifact instead of the controller of Goblin Welder. --- .../mage/sets/urzaslegacy/GoblinWelder.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/GoblinWelder.java b/Mage.Sets/src/mage/sets/urzaslegacy/GoblinWelder.java index fdb7cffb2d8..1dafd798642 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/GoblinWelder.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/GoblinWelder.java @@ -28,9 +28,6 @@ package mage.sets.urzaslegacy; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.Mode; @@ -39,7 +36,9 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.OneShotEffect; 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.common.FilterArtifactCard; import mage.filter.common.FilterArtifactPermanent; @@ -81,27 +80,34 @@ public class GoblinWelder extends CardImpl { return new GoblinWelder(this); } + public class GoblinWelderEffect extends OneShotEffect { public GoblinWelderEffect() { super(Outcome.PutCardInPlay); + staticText = "Choose target artifact a player controls and target artifact card in that player's graveyard. If both targets are still legal as this ability resolves, that player simultaneously sacrifices the artifact and returns the artifact card to the battlefield"; } + public GoblinWelderEffect(final GoblinWelderEffect effect) { super(effect); } @Override public boolean apply(Game game, Ability source) { - Permanent artifact = game.getPermanent(source.getTargets().get(0).getFirstTarget()); + Permanent artifact = game.getPermanent(getTargetPointer().getFirst(game, source)); Card card = game.getCard(source.getTargets().get(1).getFirstTarget()); Player controller = game.getPlayer(source.getControllerId()); - if (artifact != null && card != null && controller != null) { + if (artifact != null && card != null && controller != null) { Zone currentZone = game.getState().getZone(card.getId()); - if(artifact.getCardType().contains(CardType.ARTIFACT) && card.getCardType().contains(CardType.ARTIFACT) && currentZone == Zone.GRAVEYARD && card.getOwnerId().equals(artifact.getControllerId())) - { - boolean sacrifice = artifact.sacrifice(source.getSourceId(), game); - boolean putOnBF = controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId()); + Player owner = game.getPlayer(card.getOwnerId()); + if (owner != null + && artifact.getCardType().contains(CardType.ARTIFACT) + && card.getCardType().contains(CardType.ARTIFACT) + && currentZone == Zone.GRAVEYARD + && card.getOwnerId().equals(artifact.getControllerId())) { + boolean sacrifice = artifact.sacrifice(source.getSourceId(), game); + boolean putOnBF = owner.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId()); if (sacrifice || putOnBF) { return true; } @@ -115,10 +121,6 @@ public class GoblinWelder extends CardImpl { return new GoblinWelderEffect(this); } - @Override - public String getText(Mode mode) { - return "Choose " + mode.getTargets().get(0).getTargetName() + " and " + mode.getTargets().get(1).getTargetName() + ". If both targets are still legal as this ability resolves, that player simultaneously sacrifices the artifact and returns the artifact card to the battlefield"; - } } class GoblinWelderTarget extends TargetCardInGraveyard {