diff --git a/Mage.Sets/src/mage/cards/f/FeySteed.java b/Mage.Sets/src/mage/cards/f/FeySteed.java new file mode 100644 index 0000000000..6266d63078 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FeySteed.java @@ -0,0 +1,110 @@ +package mage.cards.f; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; + +/** + * + * @author anonymous + */ +public final class FeySteed extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent( + "another target attacking creature you control"); + + static { + filter.add(TargetController.YOU.getControllerPredicate()); + filter.add(AnotherPredicate.instance); + filter.add(AttackingPredicate.instance); + } + + public FeySteed(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[] { CardType.CREATURE }, "{2}{W}{W}"); + + this.subtype.add(SubType.ELK); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Whenever Fey Steed attacks, another target attacking creature you control + // gains indestructible until end of turn. + Ability ability = new AttacksTriggeredAbility( + new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), false); + ability.addTarget(new TargetCreaturePermanent(filter)); + this.addAbility(ability); + + // Whenever a creature or planeswalker you control becomes the target of a spell + // or ability an opponent controls, you may draw a card. + this.addAbility(new FeySteedTriggeredAbility()); + } + + private FeySteed(final FeySteed card) { + super(card); + } + + @Override + public FeySteed copy() { + return new FeySteed(this); + } +} + +class FeySteedTriggeredAbility extends TriggeredAbilityImpl { + + public FeySteedTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), true); + } + + public FeySteedTriggeredAbility(FeySteedTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.TARGETED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Player targetter = game.getPlayer(event.getPlayerId()); + if (targetter == null || !targetter.hasOpponent(this.controllerId, game)) { + return false; + } + + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); + if (permanent == null || !permanent.isControlledBy(this.getControllerId()) + || (!permanent.isCreature(game) && !permanent.isPlaneswalker(game))) { + return false; + } + return true; + } + + @Override + public String getRule() { + return "Whenever a creature or planeswalker you control becomes the target of a spell or ability an opponent controls, you may draw a card"; + } + + @Override + public FeySteedTriggeredAbility copy() { + return new FeySteedTriggeredAbility(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java b/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java index 01355433d4..9e72b29c28 100644 --- a/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java +++ b/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java @@ -96,6 +96,7 @@ public final class ForgottenRealmsCommander extends ExpansionSet { cards.add(new SetCardInfo("Explorer's Scope", 205, Rarity.COMMON, mage.cards.e.ExplorersScope.class)); cards.add(new SetCardInfo("Fellwar Stone", 206, Rarity.UNCOMMON, mage.cards.f.FellwarStone.class)); cards.add(new SetCardInfo("Fertile Ground", 158, Rarity.COMMON, mage.cards.f.FertileGround.class)); + cards.add(new SetCardInfo("Fey Steed", 5, Rarity.RARE, mage.cards.f.FeySteed.class)); cards.add(new SetCardInfo("Fiend of the Shadows", 99, Rarity.RARE, mage.cards.f.FiendOfTheShadows.class)); cards.add(new SetCardInfo("Fiendlash", 31, Rarity.RARE, mage.cards.f.Fiendlash.class)); cards.add(new SetCardInfo("Fleecemane Lion", 185, Rarity.RARE, mage.cards.f.FleecemaneLion.class));