From 3685cb289931aa3656698517e117fae32f4d1f9d Mon Sep 17 00:00:00 2001 From: Noah Gleason Date: Sun, 1 Jul 2018 19:31:28 -0400 Subject: [PATCH] Implement Vigean Intuition --- .../src/mage/cards/v/VigeanIntuition.java | 124 ++++++++++++++++++ Mage.Sets/src/mage/sets/Dissension.java | 1 + 2 files changed, 125 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/v/VigeanIntuition.java diff --git a/Mage.Sets/src/mage/cards/v/VigeanIntuition.java b/Mage.Sets/src/mage/cards/v/VigeanIntuition.java new file mode 100644 index 0000000000..29f91842a7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/VigeanIntuition.java @@ -0,0 +1,124 @@ +package mage.cards.v; + +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.UUID; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.*; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.token.SaprolingToken; +import mage.players.Library; +import mage.players.Player; + +/** + * + * @author noahg + */ +public final class VigeanIntuition extends CardImpl { + + public VigeanIntuition(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}{U}"); + + + // Choose a card type, then reveal the top four cards of your library. Put all cards of the chosen type revealed this way into your hand and the rest into your graveyard. + this.getSpellAbility().addEffect(new VigeanIntuitionEffect()); + } + + public VigeanIntuition(final VigeanIntuition card) { + super(card); + } + + @Override + public VigeanIntuition copy() { + return new VigeanIntuition(this); + } +} + +class VigeanIntuitionEffect extends OneShotEffect { + + private static final Set choice = new LinkedHashSet<>(); + + static { + choice.add(CardType.ARTIFACT.toString()); + choice.add(CardType.CREATURE.toString()); + choice.add(CardType.ENCHANTMENT.toString()); + choice.add(CardType.INSTANT.toString()); + choice.add(CardType.LAND.toString()); + choice.add(CardType.PLANESWALKER.toString()); + choice.add(CardType.SORCERY.toString()); + choice.add(CardType.TRIBAL.toString()); + } + + public VigeanIntuitionEffect() { + super(Outcome.Benefit); + staticText = "Choose a card type, then reveal the top four cards of your library. Put all cards of the chosen type revealed this way into your hand and the rest into your graveyard"; + } + + public VigeanIntuitionEffect(final VigeanIntuitionEffect effect) { + super(effect); + } + + @Override + public VigeanIntuitionEffect copy() { + return new VigeanIntuitionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + MageObject sourceObject = game.getObject(source.getSourceId()); + Player player = game.getPlayer(source.getControllerId()); + Library library = player.getLibrary(); + if (player != null && sourceObject != null && library != null) { + Choice choiceImpl = new ChoiceImpl(); + choiceImpl.setChoices(choice); + if (player.choose(Outcome.Neutral, choiceImpl, game)) { + CardType type = null; + String choosenType = choiceImpl.getChoice(); + + if (choosenType.equals(CardType.ARTIFACT.toString())) { + type = CardType.ARTIFACT; + } else if (choosenType.equals(CardType.LAND.toString())) { + type = CardType.LAND; + } else if (choosenType.equals(CardType.CREATURE.toString())) { + type = CardType.CREATURE; + } else if (choosenType.equals(CardType.ENCHANTMENT.toString())) { + type = CardType.ENCHANTMENT; + } else if (choosenType.equals(CardType.INSTANT.toString())) { + type = CardType.INSTANT; + } else if (choosenType.equals(CardType.SORCERY.toString())) { + type = CardType.SORCERY; + } else if (choosenType.equals(CardType.PLANESWALKER.toString())) { + type = CardType.PLANESWALKER; + } else if (choosenType.equals(CardType.TRIBAL.toString())) { + type = CardType.TRIBAL; + } + + if (type != null) { + Set top = library.getTopCards(game, 4); + player.revealCards(source, new CardsImpl(top), game); + Cards putInHand = new CardsImpl(); + Cards putInGraveyard = new CardsImpl(); + for (Card card : top) { + if (card != null && card.getCardType().contains(type)) { + putInHand.add(card); + } else { + putInGraveyard.add(card); + } + } + player.moveCards(putInHand, Zone.HAND, source, game); + player.moveCards(putInGraveyard, Zone.GRAVEYARD, source, game); + return true; + } + } + } + return false; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Dissension.java b/Mage.Sets/src/mage/sets/Dissension.java index 7a258b0b16..f4f885d4fc 100644 --- a/Mage.Sets/src/mage/sets/Dissension.java +++ b/Mage.Sets/src/mage/sets/Dissension.java @@ -189,6 +189,7 @@ public final class Dissension extends ExpansionSet { cards.add(new SetCardInfo("Vesper Ghoul", 57, Rarity.COMMON, mage.cards.v.VesperGhoul.class)); cards.add(new SetCardInfo("Vigean Graftmage", 35, Rarity.UNCOMMON, mage.cards.v.VigeanGraftmage.class)); cards.add(new SetCardInfo("Vigean Hydropon", 135, Rarity.COMMON, mage.cards.v.VigeanHydropon.class)); + cards.add(new SetCardInfo("Vigean Intuition", 136, Rarity.UNCOMMON, mage.cards.v.VigeanIntuition.class)); cards.add(new SetCardInfo("Vision Skeins", 36, Rarity.COMMON, mage.cards.v.VisionSkeins.class)); cards.add(new SetCardInfo("Voidslime", 137, Rarity.RARE, mage.cards.v.Voidslime.class)); cards.add(new SetCardInfo("Wakestone Gargoyle", 21, Rarity.RARE, mage.cards.w.WakestoneGargoyle.class));