diff --git a/Mage.Sets/src/mage/cards/u/UreniOfTheUnwritten.java b/Mage.Sets/src/mage/cards/u/UreniOfTheUnwritten.java new file mode 100644 index 00000000000..fa56c051e20 --- /dev/null +++ b/Mage.Sets/src/mage/cards/u/UreniOfTheUnwritten.java @@ -0,0 +1,94 @@ +package mage.cards.u; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; + +import java.util.UUID; + +/** + * @author ilyagart + */ +public final class UreniOfTheUnwritten extends CardImpl { + + public UreniOfTheUnwritten(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{U}{R}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.SPIRIT); + this.subtype.add(SubType.DRAGON); + this.power = new MageInt(7); + this.toughness = new MageInt(7); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever Ureni enters or attacks, look at the top eight cards of your library. You may put a Dragon creature card from among them onto the battlefield. Put the rest on the bottom of your library in a random order. + this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new UreniOfTheUnwrittenEffect(), false)); + } + + private UreniOfTheUnwritten(final UreniOfTheUnwritten card) { + super(card); + } + + @Override + public UreniOfTheUnwritten copy() { + return new UreniOfTheUnwritten(this); + } +} + +class UreniOfTheUnwrittenEffect extends OneShotEffect { + + UreniOfTheUnwrittenEffect() { + super(Outcome.Benefit); + this.staticText = "look at the top eight cards of your library. You may put a Dragon creature card from among them onto the battlefield. Put the rest on the bottom of your library in a random order."; + } + + private UreniOfTheUnwrittenEffect(final mage.cards.u.UreniOfTheUnwrittenEffect effect) { + super(effect); + } + + @Override + public mage.cards.u.UreniOfTheUnwrittenEffect copy() { + return new mage.cards.u.UreniOfTheUnwrittenEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 8)); + if (!cards.isEmpty()) { + FilterCreatureCard filter = new FilterCreatureCard("Dragon creature cards"); + filter.add(SubType.DRAGON.getPredicate()); + TargetCard targetCard = new TargetCard(0, 1, Zone.LIBRARY, filter); + targetCard.withNotTarget(true); + controller.choose(Outcome.PutCreatureInPlay, cards, targetCard, source, game); + controller.moveCards(game.getCard(targetCard.getFirstTarget()), Zone.BATTLEFIELD, source, game); + cards.retainZone(Zone.LIBRARY, game); + controller.putCardsOnBottomOfLibrary(cards, game, source, false); + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TarkirDragonstormCommander.java b/Mage.Sets/src/mage/sets/TarkirDragonstormCommander.java index 0cae8e90d6a..8cba642f9e3 100644 --- a/Mage.Sets/src/mage/sets/TarkirDragonstormCommander.java +++ b/Mage.Sets/src/mage/sets/TarkirDragonstormCommander.java @@ -321,6 +321,7 @@ public final class TarkirDragonstormCommander extends ExpansionSet { cards.add(new SetCardInfo("Tree of Redemption", 97, Rarity.MYTHIC, mage.cards.t.TreeOfRedemption.class)); cards.add(new SetCardInfo("Twilight Drover", 136, Rarity.RARE, mage.cards.t.TwilightDrover.class)); cards.add(new SetCardInfo("Twilight Mire", 409, Rarity.RARE, mage.cards.t.TwilightMire.class)); + cards.add(new SetCardInfo("Ureni of the Unwritten", 9, Rarity.MYTHIC, mage.cards.u.UreniOfTheUnwritten.class)); cards.add(new SetCardInfo("Vanquish the Horde", 91, Rarity.RARE, mage.cards.v.VanquishTheHorde.class)); cards.add(new SetCardInfo("Vault of the Archangel", 410, Rarity.RARE, mage.cards.v.VaultOfTheArchangel.class)); cards.add(new SetCardInfo("Velomachus Lorehold", 309, Rarity.MYTHIC, mage.cards.v.VelomachusLorehold.class));