diff --git a/Mage.Sets/src/mage/sets/worldwake/RoilingTerrain.java b/Mage.Sets/src/mage/sets/worldwake/RoilingTerrain.java index 6a709b65662..d60e58b151a 100644 --- a/Mage.Sets/src/mage/sets/worldwake/RoilingTerrain.java +++ b/Mage.Sets/src/mage/sets/worldwake/RoilingTerrain.java @@ -28,15 +28,13 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; -import mage.filter.FilterCard; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.constants.Rarity; +import mage.filter.common.FilterLandCard; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -52,7 +50,6 @@ public class RoilingTerrain extends CardImpl { super(ownerId, 88, "Roiling Terrain", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{R}{R}"); this.expansionSetCode = "WWK"; - // Destroy target land, then Roiling Terrain deals damage to that land's controller equal to the number of land cards in that player's graveyard. this.getSpellAbility().addEffect(new RoilingTerrainEffect()); this.getSpellAbility().addTarget(new TargetLandPermanent()); @@ -69,12 +66,6 @@ public class RoilingTerrain extends CardImpl { } class RoilingTerrainEffect extends OneShotEffect { - - private static final FilterCard filter = new FilterCard("lands in graveyard"); - - static { - filter.add(new CardTypePredicate(CardType.LAND)); - } public RoilingTerrainEffect() { super(Outcome.Sacrifice); @@ -92,14 +83,16 @@ class RoilingTerrainEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent targetedLand = game.getPermanent(source.getFirstTarget()); + Permanent targetedLand = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetedLand != null) { - Player controller = game.getPlayer(targetedLand.getControllerId()); - targetedLand.destroy(id, game, true); - int landsInGraveyard = controller.getGraveyard().count(filter, game); - controller.damage(landsInGraveyard, id, game, false, true); + targetedLand.destroy(source.getSourceId(), game, true); + Player targetController = game.getPlayer(targetedLand.getControllerId()); + if (targetController != null) { + int landsInGraveyard = targetController.getGraveyard().count(new FilterLandCard(), game); + targetController.damage(landsInGraveyard, source.getSourceId(), game, false, true); + } return true; } return false; } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java index 037de63e93d..1770b99e8cd 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java @@ -94,9 +94,12 @@ public class SoulbondKeywordTest extends CardTestPlayerBase { @Test public void testChangeControllerForSoulbondCreature() { addCard(Zone.BATTLEFIELD, playerA, "Elite Vanguard"); + // Soulbond (You may pair this creature with another unpaired creature when either enters the battlefield. They remain paired for as long as you control both of them.) + // As long as Trusted Forcemage is paired with another creature, each of those creatures gets +1/+1. addCard(Zone.HAND, playerA, "Trusted Forcemage"); addCard(Zone.BATTLEFIELD, playerA, "Forest", 3); + // Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn. (It can attack and Tap this turn.) addCard(Zone.HAND, playerB, "Act of Treason"); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3); @@ -121,8 +124,10 @@ public class SoulbondKeywordTest extends CardTestPlayerBase { */ @Test public void testChangeControllerForAnotherCreature() { - addCard(Zone.BATTLEFIELD, playerA, "Elite Vanguard"); - addCard(Zone.HAND, playerA, "Trusted Forcemage"); + addCard(Zone.BATTLEFIELD, playerA, "Elite Vanguard"); // 2,1 + // Soulbond (You may pair this creature with another unpaired creature when either enters the battlefield. They remain paired for as long as you control both of them.) + // As long as Trusted Forcemage is paired with another creature, each of those creatures gets +1/+1. + addCard(Zone.HAND, playerA, "Trusted Forcemage"); // 2/2 addCard(Zone.BATTLEFIELD, playerA, "Forest", 3); addCard(Zone.HAND, playerB, "Act of Treason");