From 383b05534cf0f6942a98365531dd7b579d9eaa5d Mon Sep 17 00:00:00 2001 From: spjspj Date: Wed, 16 Mar 2016 01:05:24 +1100 Subject: [PATCH] spjspj - Change to '{this}'. Also add checks for if in graveyard of owner and whether it can return to the battlefield --- .../sets/darksteel/ScreamsFromWithin.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/sets/darksteel/ScreamsFromWithin.java b/Mage.Sets/src/mage/sets/darksteel/ScreamsFromWithin.java index 7533efcdbe..bd126e45a8 100644 --- a/Mage.Sets/src/mage/sets/darksteel/ScreamsFromWithin.java +++ b/Mage.Sets/src/mage/sets/darksteel/ScreamsFromWithin.java @@ -42,8 +42,11 @@ import mage.cards.Card; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.players.Player; +import mage.target.Target; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -86,7 +89,7 @@ class ScreamsFromWithinEffect extends OneShotEffect { public ScreamsFromWithinEffect() { super(Outcome.PutCardInPlay); - staticText = "return Screams from Within from your graveyard to the battlefield"; + staticText = "return {this} from your graveyard to the battlefield"; } public ScreamsFromWithinEffect(final ScreamsFromWithinEffect effect) { @@ -95,10 +98,16 @@ class ScreamsFromWithinEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Card sourceEnchantmentCard = game.getCard(source.getSourceId()); + Card aura = game.getCard(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); - if (sourceEnchantmentCard != null && player != null) { - return player.moveCards(sourceEnchantmentCard, Zone.BATTLEFIELD, source, game); + if (aura != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD && player != null && player.getGraveyard().contains(source.getSourceId())) { + for (Permanent creaturePermanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game)) { + for (Target target : aura.getSpellAbility().getTargets()) { + if (target.canTarget(creaturePermanent.getId(), game)) { + return player.moveCards(aura, Zone.BATTLEFIELD, source, game); + } + } + } } return false; } @@ -107,4 +116,4 @@ class ScreamsFromWithinEffect extends OneShotEffect { public ScreamsFromWithinEffect copy() { return new ScreamsFromWithinEffect(this); } -} \ No newline at end of file +}