diff --git a/Mage.Sets/src/mage/cards/f/FeldonRonomExcavator.java b/Mage.Sets/src/mage/cards/f/FeldonRonomExcavator.java new file mode 100644 index 00000000000..7b451fd4f50 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FeldonRonomExcavator.java @@ -0,0 +1,99 @@ +package mage.cards.f; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.CantBlockAbility; +import mage.abilities.common.DealtDamageToSourceTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.*; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInExile; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FeldonRonomExcavator extends CardImpl { + + public FeldonRonomExcavator(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ARTIFICER); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // Feldon, Ronom Excavator can't block. + this.addAbility(new CantBlockAbility()); + + // Whenever Feldon is dealt damage, exile that many cards from the top of your library. Choose one of them. Until the end of your next turn, you may play that card. + this.addAbility(new DealtDamageToSourceTriggeredAbility(new FeldonRonomExcavatorEffect(), false)); + } + + private FeldonRonomExcavator(final FeldonRonomExcavator card) { + super(card); + } + + @Override + public FeldonRonomExcavator copy() { + return new FeldonRonomExcavator(this); + } +} + +class FeldonRonomExcavatorEffect extends OneShotEffect { + + FeldonRonomExcavatorEffect() { + super(Outcome.Benefit); + staticText = "exile that many cards from the top of your library. " + + "Choose one of them. Until the end of your next turn, you may play that card"; + } + + private FeldonRonomExcavatorEffect(final FeldonRonomExcavatorEffect effect) { + super(effect); + } + + @Override + public FeldonRonomExcavatorEffect copy() { + return new FeldonRonomExcavatorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + int damage = (Integer) getValue("damage"); + if (player == null || damage < 1) { + return false; + } + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, damage)); + player.moveCards(cards, Zone.EXILED, source, game); + cards.retainZone(Zone.EXILED, game); + Card card; + switch (cards.size()) { + case 0: + return false; + case 1: + card = cards.getRandom(game); + break; + default: + TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD); + target.setNotTarget(true); + player.choose(outcome, cards, target, game); + card = game.getCard(target.getFirstTarget()); + } + if (card != null) { + CardUtil.makeCardPlayable(game, source, card, Duration.UntilEndOfYourNextTurn, false); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index 39cbfd691cb..a71eed18392 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -25,6 +25,7 @@ public final class TheBrothersWar extends ExpansionSet { cards.add(new SetCardInfo("Battlefield Forge", 257, Rarity.RARE, mage.cards.b.BattlefieldForge.class)); cards.add(new SetCardInfo("Blast Zone", 258, Rarity.RARE, mage.cards.b.BlastZone.class)); cards.add(new SetCardInfo("Brushland", 259, Rarity.RARE, mage.cards.b.Brushland.class)); + cards.add(new SetCardInfo("Feldon, Ronom Excavator", 135, Rarity.RARE, mage.cards.f.FeldonRonomExcavator.class)); cards.add(new SetCardInfo("Forest", 286, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Hurkyl, Master Wizard", 51, Rarity.RARE, mage.cards.h.HurkylMasterWizard.class)); cards.add(new SetCardInfo("Island", 280, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));