From 6a7b43f71c12b09d7b8ff7d39a28eed53cf52dff Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 22 May 2015 17:56:53 +0200 Subject: [PATCH] Some minor chnages. --- .../src/mage/sets/commander2013/Foster.java | 36 ++++++++++--------- .../newphyrexia/EleshNornGrandCenobite.java | 1 + .../sets/saviorsofkamigawa/Reverence.java | 1 - .../sets/zendikar/BloodchiefAscension.java | 6 ---- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Mage.Sets/src/mage/sets/commander2013/Foster.java b/Mage.Sets/src/mage/sets/commander2013/Foster.java index a46344f926..2c941c3baa 100644 --- a/Mage.Sets/src/mage/sets/commander2013/Foster.java +++ b/Mage.Sets/src/mage/sets/commander2013/Foster.java @@ -28,6 +28,7 @@ package mage.sets.commander2013; import java.util.UUID; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.costs.mana.GenericManaCost; @@ -55,6 +56,7 @@ import mage.players.Player; public class Foster extends CardImpl { private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature you control"); + static { filter.add(new ControllerPredicate(TargetController.YOU)); } @@ -63,7 +65,6 @@ public class Foster extends CardImpl { super(ownerId, 146, "Foster", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}"); this.expansionSetCode = "C13"; - // Whenever a creature you control dies, you may pay {1}. If you do, reveal cards from the top of your library until you reveal a creature card. Put that card into your hand and the rest into your graveyard. Ability ability = new DiesCreatureTriggeredAbility( new DoIfCostPaid(new FosterEffect(), new GenericManaCost(1)), @@ -102,28 +103,31 @@ class FosterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller == null) { + MageObject sourceObject = source.getSourceObject(game); + if (controller == null || sourceObject == null) { return false; } - Card sourceCard = game.getCard(source.getSourceId()); - if (sourceCard == null) { - return false; - } - Cards cards = new CardsImpl(Zone.PICK); + + Cards cards = new CardsImpl(); + Card cardFound = null; while (controller.getLibrary().size() > 0) { - Card card = controller.getLibrary().getFromTop(game); + Card card = controller.getLibrary().removeFromTop(game); if (card != null) { - cards.add(card); - if(filter.match(card, game)){ - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + cards.add(card); + if (filter.match(card, game)){ + cardFound = card; break; } - else{ - card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, false); - } - } + } + } + if (!cards.isEmpty()) { + controller.revealCards(sourceObject.getName(), cards, game); + if (cardFound != null) { + controller.moveCards(cardFound, Zone.LIBRARY, Zone.HAND, source, game); + cards.remove(cardFound); + } + controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); } - controller.revealCards(sourceCard.getName(), cards, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/EleshNornGrandCenobite.java b/Mage.Sets/src/mage/sets/newphyrexia/EleshNornGrandCenobite.java index 526d909a69..0bdc0bba0b 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/EleshNornGrandCenobite.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/EleshNornGrandCenobite.java @@ -46,6 +46,7 @@ import mage.constants.Zone; * @author Loki */ public class EleshNornGrandCenobite extends CardImpl { + public EleshNornGrandCenobite (UUID ownerId) { super(ownerId, 9, "Elesh Norn, Grand Cenobite", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{5}{W}{W}"); this.expansionSetCode = "NPH"; diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/Reverence.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/Reverence.java index 4e94da01ee..dae5b5ee48 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/Reverence.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/Reverence.java @@ -31,7 +31,6 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.RestrictionEffect; -import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; diff --git a/Mage.Sets/src/mage/sets/zendikar/BloodchiefAscension.java b/Mage.Sets/src/mage/sets/zendikar/BloodchiefAscension.java index ae1c0d6ea8..d57c523f80 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BloodchiefAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/BloodchiefAscension.java @@ -33,7 +33,6 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; -import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility; import mage.abilities.condition.Condition; @@ -43,15 +42,10 @@ import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; -import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.SetTargetPointer; import mage.counters.CounterType; import mage.filter.FilterCard; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.ZoneChangeEvent; -import mage.target.targetpointer.FixedTarget; /** *