- Little fixes

This commit is contained in:
Jeff 2013-07-13 16:42:06 -05:00
parent 60d81ffb37
commit 7f281868b0
2 changed files with 25 additions and 4 deletions

View file

@ -33,7 +33,7 @@ import mage.abilities.Ability;
import mage.abilities.TriggeredAbility; import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.CardsInControllerGraveCondition; import mage.abilities.condition.Condition;
import mage.abilities.condition.common.InvertCondition; import mage.abilities.condition.common.InvertCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
@ -43,9 +43,12 @@ import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -85,7 +88,7 @@ public class ShadowbornDemon extends CardImpl<ShadowbornDemon> {
triggeredAbility.addTarget(target); triggeredAbility.addTarget(target);
this.addAbility(new ConditionalTriggeredAbility( this.addAbility(new ConditionalTriggeredAbility(
triggeredAbility, triggeredAbility,
new InvertCondition(new CardsInControllerGraveCondition(6)), new InvertCondition(new CreatureCardsInControllerGraveCondition(6)),
"At the beginning of your upkeep, if there are fewer than six creature cards in your graveyard, sacrifice a creature")); "At the beginning of your upkeep, if there are fewer than six creature cards in your graveyard, sacrifice a creature"));
} }
@ -99,3 +102,21 @@ public class ShadowbornDemon extends CardImpl<ShadowbornDemon> {
return new ShadowbornDemon(this); return new ShadowbornDemon(this);
} }
} }
class CreatureCardsInControllerGraveCondition implements Condition {
private int value;
public CreatureCardsInControllerGraveCondition(int value) {
this.value = value;
}
@Override
public boolean apply(Game game, Ability source) {
Player p = game.getPlayer(source.getControllerId());
if (p != null && p.getGraveyard().count(new FilterCreatureCard(), game) >= value)
{
return true;
}
return false;
}
}

View file

@ -35,7 +35,7 @@ import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.filter.common.FilterLandPermanent; import mage.filter.common.FilterControlledLandPermanent;
import mage.game.permanent.token.SaprolingToken; import mage.game.permanent.token.SaprolingToken;
/** /**
@ -55,7 +55,7 @@ public class Sporemound extends CardImpl<Sporemound> {
// Whenever a land enters the battlefield under your control, put a 1/1 green Saproling creature token onto the battlefield. // Whenever a land enters the battlefield under your control, put a 1/1 green Saproling creature token onto the battlefield.
Effect effect = new CreateTokenEffect(new SaprolingToken()); Effect effect = new CreateTokenEffect(new SaprolingToken());
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(effect, new FilterLandPermanent("a land"))); this.addAbility(new EntersBattlefieldControlledTriggeredAbility(effect, new FilterControlledLandPermanent("a land you control")));
} }
public Sporemound(final Sporemound card) { public Sporemound(final Sporemound card) {