From 41a170e23fe9daf37283313e0e2441a4ec160054 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 10 Apr 2020 19:33:11 -0400 Subject: [PATCH] Implemented Genesis Ultimatum --- .../src/mage/cards/g/GenesisUltimatum.java | 86 +++++++++++++++++++ .../src/mage/sets/IkoriaLairOfBehemoths.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GenesisUltimatum.java diff --git a/Mage.Sets/src/mage/cards/g/GenesisUltimatum.java b/Mage.Sets/src/mage/cards/g/GenesisUltimatum.java new file mode 100644 index 0000000000..79a3191219 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GenesisUltimatum.java @@ -0,0 +1,86 @@ +package mage.cards.g; + +import mage.MageItem; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileSpellEffect; +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.Zone; +import mage.filter.FilterCard; +import mage.filter.common.FilterPermanentCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInHand; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GenesisUltimatum extends CardImpl { + + public GenesisUltimatum(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}{G}{U}{U}{U}{R}{R}"); + + // Look at the top five cards of your library. Put any number of permanent cards from among them onto the battlefield and the rest into your hand. Exile Genesis Ultimatum. + this.getSpellAbility().addEffect(new GenesisUltimatumEffect()); + this.getSpellAbility().addEffect(ExileSpellEffect.getInstance()); + } + + private GenesisUltimatum(final GenesisUltimatum card) { + super(card); + } + + @Override + public GenesisUltimatum copy() { + return new GenesisUltimatum(this); + } +} + +class GenesisUltimatumEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterPermanentCard(); + + GenesisUltimatumEffect() { + super(Outcome.Benefit); + staticText = "Look at the top five cards of your library. Put any number of permanent cards " + + "from among them onto the battlefield and the rest into your hand."; + } + + private GenesisUltimatumEffect(final GenesisUltimatumEffect effect) { + super(effect); + } + + @Override + public GenesisUltimatumEffect copy() { + return new GenesisUltimatumEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards toHand = new CardsImpl(player.getLibrary().getTopCards(game, 5)); + player.lookAtCards("", toHand, game); + TargetCard targetCard = new TargetCardInHand(0, Integer.MAX_VALUE, filter); + player.choose(outcome, toHand, targetCard, game); + Cards toBattlefield = new CardsImpl(targetCard.getTargets()); + if (player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game)) { + toBattlefield + .stream() + .map(game::getPermanent) + .map(MageItem::getId) + .forEach(toHand::remove); + } + player.moveCards(toHand, Zone.HAND, source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java index 427e0781f6..a1bac6476e 100644 --- a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java +++ b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java @@ -145,6 +145,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet { cards.add(new SetCardInfo("Gemrazer", 155, Rarity.RARE, mage.cards.g.Gemrazer.class)); cards.add(new SetCardInfo("General Kudro of Drannith", 187, Rarity.MYTHIC, mage.cards.g.GeneralKudroOfDrannith.class)); cards.add(new SetCardInfo("General's Enforcer", 188, Rarity.UNCOMMON, mage.cards.g.GeneralsEnforcer.class)); + cards.add(new SetCardInfo("Genesis Ultimatum", 189, Rarity.RARE, mage.cards.g.GenesisUltimatum.class)); cards.add(new SetCardInfo("Glimmerbell", 53, Rarity.COMMON, mage.cards.g.Glimmerbell.class)); cards.add(new SetCardInfo("Gloom Pangolin", 89, Rarity.COMMON, mage.cards.g.GloomPangolin.class)); cards.add(new SetCardInfo("Glowstone Recluse", 156, Rarity.UNCOMMON, mage.cards.g.GlowstoneRecluse.class));