diff --git a/Mage.Sets/src/mage/cards/o/OccultEpiphany.java b/Mage.Sets/src/mage/cards/o/OccultEpiphany.java new file mode 100644 index 00000000000..ed9e8d2a8ef --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OccultEpiphany.java @@ -0,0 +1,77 @@ +package mage.cards.o; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.token.SpiritWhiteToken; +import mage.players.Player; + +import java.util.Collection; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class OccultEpiphany extends CardImpl { + + public OccultEpiphany(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}"); + + // Draw X cards, then discard X cards. Create a 1/1 white Spirit creature token with flying for each card type among cards discarded this way. + this.getSpellAbility().addEffect(new OccultEpiphanyEffect()); + } + + private OccultEpiphany(final OccultEpiphany card) { + super(card); + } + + @Override + public OccultEpiphany copy() { + return new OccultEpiphany(this); + } +} + +class OccultEpiphanyEffect extends OneShotEffect { + + OccultEpiphanyEffect() { + super(Outcome.Benefit); + staticText = "draw X cards, then discard X cards. Create a 1/1 white Spirit creature token " + + "with flying for each card type among cards discarded this way"; + } + + private OccultEpiphanyEffect(final OccultEpiphanyEffect effect) { + super(effect); + } + + @Override + public OccultEpiphanyEffect copy() { + return new OccultEpiphanyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + int xValue = source.getManaCostsToPay().getX(); + if (player == null || xValue < 1) { + return false; + } + player.drawCards(xValue, source, game); + int cardTypes = player + .discard(xValue, false, false, source, game) + .getCards(game) + .stream() + .map(card -> card.getCardType(game)) + .flatMap(Collection::stream) + .distinct() + .mapToInt(x -> 1) + .sum(); + if (cardTypes > 0) { + new SpiritWhiteToken().putOntoBattlefield(cardTypes, game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CrimsonVowCommander.java b/Mage.Sets/src/mage/sets/CrimsonVowCommander.java index dd00a796647..e8961952b40 100644 --- a/Mage.Sets/src/mage/sets/CrimsonVowCommander.java +++ b/Mage.Sets/src/mage/sets/CrimsonVowCommander.java @@ -91,6 +91,7 @@ public final class CrimsonVowCommander extends ExpansionSet { cards.add(new SetCardInfo("Necropolis Regent", 132, Rarity.MYTHIC, mage.cards.n.NecropolisRegent.class)); cards.add(new SetCardInfo("Night's Whisper", 133, Rarity.COMMON, mage.cards.n.NightsWhisper.class)); cards.add(new SetCardInfo("Nirkana Revenant", 134, Rarity.MYTHIC, mage.cards.n.NirkanaRevenant.class)); + cards.add(new SetCardInfo("Occult Epiphany", 14, Rarity.RARE, mage.cards.o.OccultEpiphany.class)); cards.add(new SetCardInfo("Oyobi, Who Split the Heavens", 95, Rarity.RARE, mage.cards.o.OyobiWhoSplitTheHeavens.class)); cards.add(new SetCardInfo("Path of Ancestry", 177, Rarity.COMMON, mage.cards.p.PathOfAncestry.class)); cards.add(new SetCardInfo("Patron of the Vein", 135, Rarity.RARE, mage.cards.p.PatronOfTheVein.class));