From 4232520a701ebcedfa2034f03bda0699b8e99828 Mon Sep 17 00:00:00 2001 From: myersn024 Date: Mon, 9 Mar 2015 09:07:29 -0500 Subject: [PATCH 1/2] Implemented ManaSeverance.java --- .../src/mage/sets/tempest/ManaSeverance.java | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/tempest/ManaSeverance.java diff --git a/Mage.Sets/src/mage/sets/tempest/ManaSeverance.java b/Mage.Sets/src/mage/sets/tempest/ManaSeverance.java new file mode 100644 index 00000000000..57bc71c2550 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/ManaSeverance.java @@ -0,0 +1,85 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.sets.tempest; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.SearchEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterLandCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; +import mage.util.CardUtil; + +/** + * + * @author nick.myers + */ +public class ManaSeverance extends CardImpl { + + public ManaSeverance(UUID ownerId) { + super(ownerId, 73, "Mana Severance", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{1}{U}"); + this.expansionSetCode = "TMP"; + + // Search your library for any number of land cards and remove the from the game. + // Shuffle your library afterwards. + this.getSpellAbility().addEffect(new ManaSeveranceEffect()); + } + + public ManaSeverance(final ManaSeverance card) { + super(card); + } + + @Override + public ManaSeverance copy() { + return new ManaSeverance(this); + } + +} + +class ManaSeveranceEffect extends SearchEffect { + + public ManaSeveranceEffect() { + super(new TargetCardInLibrary(0, Integer.MAX_VALUE, new FilterLandCard()), Outcome.Exile); + this.staticText = "Search your library for any number of land cards and remove them from the game. Shuffle your library afterwards."; + } + + public ManaSeveranceEffect(final ManaSeveranceEffect effect) { + super(effect); + } + + @Override + public ManaSeveranceEffect copy() { + return new ManaSeveranceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player you = game.getPlayer(source.getControllerId()); + if (you != null) { + if (you.searchLibrary(target, game)) { + UUID exileZone = CardUtil.getCardExileZoneId(game, source); + if (target.getTargets().size() > 0) { + for (UUID cardId : target.getTargets()) { + Card card = you.getLibrary().getCard(cardId, game); + if (card != null) { + card.moveToExile(exileZone, "Mana Severance", source.getSourceId(), game); + } + } + } + } + you.shuffleLibrary(game); + return true; + + } + return false; + } +} From a6f0cd02af1fd469c064c8acf12a678d29e71c05 Mon Sep 17 00:00:00 2001 From: nickmyers Date: Mon, 9 Mar 2015 18:17:11 -0500 Subject: [PATCH 2/2] Made changes to ManaSeverance.java based on suggestions --- .../src/mage/sets/tempest/ManaSeverance.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Mage.Sets/src/mage/sets/tempest/ManaSeverance.java b/Mage.Sets/src/mage/sets/tempest/ManaSeverance.java index 57bc71c2550..8b48c5bf77c 100644 --- a/Mage.Sets/src/mage/sets/tempest/ManaSeverance.java +++ b/Mage.Sets/src/mage/sets/tempest/ManaSeverance.java @@ -13,11 +13,11 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterLandCard; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInLibrary; -import mage.util.CardUtil; /** * @@ -29,7 +29,7 @@ public class ManaSeverance extends CardImpl { super(ownerId, 73, "Mana Severance", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{1}{U}"); this.expansionSetCode = "TMP"; - // Search your library for any number of land cards and remove the from the game. + // Search your library for any number of land cards and remove them from the game. // Shuffle your library afterwards. this.getSpellAbility().addEffect(new ManaSeveranceEffect()); } @@ -63,20 +63,19 @@ class ManaSeveranceEffect extends SearchEffect { @Override public boolean apply(Game game, Ability source) { - Player you = game.getPlayer(source.getControllerId()); - if (you != null) { - if (you.searchLibrary(target, game)) { - UUID exileZone = CardUtil.getCardExileZoneId(game, source); + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (controller.searchLibrary(target, game)) { if (target.getTargets().size() > 0) { for (UUID cardId : target.getTargets()) { - Card card = you.getLibrary().getCard(cardId, game); + Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { - card.moveToExile(exileZone, "Mana Severance", source.getSourceId(), game); + controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY); } } } } - you.shuffleLibrary(game); + controller.shuffleLibrary(game); return true; }