From 4d7e744187aba6d3f04f484a3b30838eb9913616 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 7 Oct 2016 17:56:16 +0200 Subject: [PATCH] [SWS] Fixed some problems. --- Mage.Sets/src/mage/cards/r/Regression.java | 4 ++-- Mage.Sets/src/mage/cards/s/ShaakHerd.java | 12 ++++++++++-- .../common/ShuffleIntoLibraryTargetEffect.java | 8 +++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/r/Regression.java b/Mage.Sets/src/mage/cards/r/Regression.java index 1e0b953ec4..fe7fdeeea3 100644 --- a/Mage.Sets/src/mage/cards/r/Regression.java +++ b/Mage.Sets/src/mage/cards/r/Regression.java @@ -50,11 +50,11 @@ public class Regression extends CardImpl { } public Regression(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}"); // Choose target artifact or enchantment. Its owner shuffles it into his or her library. this.getSpellAbility().addEffect(new ShuffleIntoLibraryTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(1, 1, filter, true)); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); } public Regression(final Regression card) { diff --git a/Mage.Sets/src/mage/cards/s/ShaakHerd.java b/Mage.Sets/src/mage/cards/s/ShaakHerd.java index 04725f252a..c70e669541 100644 --- a/Mage.Sets/src/mage/cards/s/ShaakHerd.java +++ b/Mage.Sets/src/mage/cards/s/ShaakHerd.java @@ -35,6 +35,8 @@ import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.AnotherCardPredicate; import mage.target.common.TargetCardInYourGraveyard; /** @@ -43,15 +45,21 @@ import mage.target.common.TargetCardInYourGraveyard; */ public class ShaakHerd extends CardImpl { + private final static FilterCard filter = new FilterCard("another target creature card"); + + static { + filter.add(new AnotherCardPredicate()); + } + public ShaakHerd(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); this.subtype.add("Beast"); this.power = new MageInt(2); this.toughness = new MageInt(2); // When Shaak Herd dies, you may return another target creature card from your graveyard to your hand. Ability ability = new DiesTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect(), true); - ability.addTarget(new TargetCardInYourGraveyard()); + ability.addTarget(new TargetCardInYourGraveyard(filter)); this.addAbility(ability); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryTargetEffect.java index 263991d020..542ad7497f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryTargetEffect.java @@ -12,6 +12,7 @@ import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.players.Player; /** * @@ -40,11 +41,12 @@ public class ShuffleIntoLibraryTargetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); - if (permanent != null) { - if (permanent.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true)) { + Player controller = game.getPlayer(source.getControllerId()); + if (permanent != null && controller != null) { + if (controller.moveCards(permanent, Zone.LIBRARY, source, game)) { game.getPlayer(permanent.getOwnerId()).shuffleLibrary(source, game); - return true; } + return true; } return false; }