[VOC] Implemented Occult Epiphany

This commit is contained in:
Evan Kranzler 2021-11-09 22:55:14 -05:00
parent c56f933db1
commit 6c273bbabe
2 changed files with 78 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));