* Desertion - Fixed that the countered spell was wrongly moved to battlefield under owner control instad of Desertion caster control (fixed #3467).

This commit is contained in:
LevelX2 2017-06-11 09:39:57 +02:00
parent 05d90729c3
commit e7337f66b7

View file

@ -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;
}
}