From e7337f66b76a1a968a77bafdd470ebe497f6d209 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 11 Jun 2017 09:39:57 +0200 Subject: [PATCH] * Desertion - Fixed that the countered spell was wrongly moved to battlefield under owner control instad of Desertion caster control (fixed #3467). --- Mage.Sets/src/mage/cards/d/Desertion.java | 25 +++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/Desertion.java b/Mage.Sets/src/mage/cards/d/Desertion.java index 2ad97057f8..85799b277d 100644 --- a/Mage.Sets/src/mage/cards/d/Desertion.java +++ b/Mage.Sets/src/mage/cards/d/Desertion.java @@ -27,21 +27,20 @@ */ package mage.cards.d; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Zone; -import mage.constants.ZoneDetail; import mage.game.Game; import mage.game.stack.Spell; import mage.players.Player; import mage.target.TargetSpell; -import java.util.UUID; - /** * * @author Quercitron @@ -49,7 +48,7 @@ import java.util.UUID; public class Desertion extends CardImpl { public Desertion(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}{U}"); // Counter target spell. If an artifact or creature spell is countered this way, put that card onto the battlefield under your control instead of into its owner's graveyard. this.getSpellAbility().addEffect(new DesertionEffect()); @@ -70,7 +69,7 @@ class DesertionEffect extends OneShotEffect { public DesertionEffect() { super(Outcome.Detriment); - this.staticText = "Counter target spell. If an artifact or creature spell is countered this way, put that card onto the battlefield under your control instead of into its owner's graveyard."; + this.staticText = "Counter target spell. If an artifact or creature spell is countered this way, put that card onto the battlefield under your control instead of into its owner's graveyard"; } public DesertionEffect(final DesertionEffect effect) { @@ -86,18 +85,18 @@ class DesertionEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Spell targetSpell = game.getStack().getSpell(targetPointer.getFirst(game, source)); - if (targetSpell != null) { - //targetPointer.getFirst(game, source) + Spell targetSpell = game.getStack().getSpell(getTargetPointer().getFirst(game, source)); + if (targetSpell != null) { + if (game.getStack().counter(targetSpell.getId(), source.getSourceId(), game)) { + game.applyEffects(); if (targetSpell.isArtifact() || targetSpell.isCreature()) { - return game.getStack().counter(targetSpell.getId(), source.getSourceId(), game, Zone.BATTLEFIELD, false, ZoneDetail.NONE); - } else { - return game.getStack().counter(targetSpell.getId(), source.getSourceId(), game); + Card card = game.getCard(targetSpell.getSourceId()); + controller.moveCards(card, Zone.BATTLEFIELD, source, game); } - + } } + return true; } return false; } - }