From d67f1e61b09c086cc194e8428ea3b6facd36837b Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 18 Apr 2023 20:44:02 -0400 Subject: [PATCH] [ONE] Implement Contagious Vorrac --- .../src/mage/cards/c/ContagiousVorrac.java | 85 +++++++++++++++++++ .../src/mage/sets/PhyrexiaAllWillBeOne.java | 1 + 2 files changed, 86 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/ContagiousVorrac.java diff --git a/Mage.Sets/src/mage/cards/c/ContagiousVorrac.java b/Mage.Sets/src/mage/cards/c/ContagiousVorrac.java new file mode 100644 index 00000000000..cf7bd376774 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ContagiousVorrac.java @@ -0,0 +1,85 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.ProliferateEffect; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ContagiousVorrac extends CardImpl { + + public ContagiousVorrac(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); + + this.subtype.add(SubType.PHYREXIAN); + this.subtype.add(SubType.BOAR); + this.subtype.add(SubType.BEAST); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Contagious Vorrac enters the battlefield, look at the top four cards of your library. You may reveal a land card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. If you didn't put a card into your hand this way, proliferate. + this.addAbility(new EntersBattlefieldTriggeredAbility(new ContagiousVorracEffect())); + } + + private ContagiousVorrac(final ContagiousVorrac card) { + super(card); + } + + @Override + public ContagiousVorrac copy() { + return new ContagiousVorrac(this); + } +} + +class ContagiousVorracEffect extends OneShotEffect { + + ContagiousVorracEffect() { + super(Outcome.Benefit); + staticText = "look at the top four cards of your library. You may reveal a land card from among them " + + "and put it into your hand. Put the rest on the bottom of your library in a random order. " + + "If you didn't put a card into your hand this way, proliferate"; + } + + private ContagiousVorracEffect(final ContagiousVorracEffect effect) { + super(effect); + } + + @Override + public ContagiousVorracEffect copy() { + return new ContagiousVorracEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 4)); + TargetCard target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_LAND); + player.choose(Outcome.DrawCard, cards, target, game); + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + player.revealCards(source, new CardsImpl(card), game); + player.moveCards(card, Zone.HAND, source, game); + } + cards.retainZone(Zone.LIBRARY, game); + player.putCardsOnBottomOfLibrary(card, game, source, false); + return card == null || new ProliferateEffect().apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java index 3dad8c6339c..8edf45e3bd6 100644 --- a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java +++ b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java @@ -60,6 +60,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet { cards.add(new SetCardInfo("Chittering Skitterling", 87, Rarity.UNCOMMON, mage.cards.c.ChitteringSkitterling.class)); cards.add(new SetCardInfo("Chrome Prowler", 45, Rarity.COMMON, mage.cards.c.ChromeProwler.class)); cards.add(new SetCardInfo("Compleat Devotion", 7, Rarity.COMMON, mage.cards.c.CompleatDevotion.class)); + cards.add(new SetCardInfo("Contagious Vorrac", 164, Rarity.COMMON, mage.cards.c.ContagiousVorrac.class)); cards.add(new SetCardInfo("Copper Longlegs", 165, Rarity.COMMON, mage.cards.c.CopperLonglegs.class)); cards.add(new SetCardInfo("Copperline Gorge", 249, Rarity.RARE, mage.cards.c.CopperlineGorge.class)); cards.add(new SetCardInfo("Crawling Chorus", 8, Rarity.COMMON, mage.cards.c.CrawlingChorus.class));