Some minor chnages.

This commit is contained in:
LevelX2 2015-05-22 17:56:53 +02:00
parent 38865e2495
commit 6a7b43f71c
4 changed files with 21 additions and 23 deletions

View file

@ -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;
}
}

View file

@ -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";

View file

@ -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;

View file

@ -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;
/**
*