From e984d2a9016da3bdf5f22db629ed29f9c89a4fc9 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 5 Apr 2023 09:57:39 -0400 Subject: [PATCH] [MOM] Implement Overgrown Pest --- Mage.Sets/src/mage/cards/o/OvergrownPest.java | 52 +++++++++++++++++++ .../src/mage/sets/MarchOfTheMachine.java | 1 + .../card/DoubleFacedCardPredicate.java | 23 ++++++++ 3 files changed, 76 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/o/OvergrownPest.java create mode 100644 Mage/src/main/java/mage/filter/predicate/card/DoubleFacedCardPredicate.java diff --git a/Mage.Sets/src/mage/cards/o/OvergrownPest.java b/Mage.Sets/src/mage/cards/o/OvergrownPest.java new file mode 100644 index 0000000000..8bea34610b --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OvergrownPest.java @@ -0,0 +1,52 @@ +package mage.cards.o; + +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.PutCards; +import mage.constants.SubType; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.card.DoubleFacedCardPredicate; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class OvergrownPest extends CardImpl { + + private static final FilterCard filter = new FilterCard("a land or double-faced card"); + + static { + filter.add(Predicates.or( + CardType.LAND.getPredicate(), + DoubleFacedCardPredicate.instance + )); + } + + public OvergrownPest(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); + + this.subtype.add(SubType.PEST); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Overgrown Pest enters the battlefield, look at the top five cards of your library. You may reveal a land or double-faced card from among them and put that card into your hand. Put the rest on the bottom of your library in a random order. + this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect( + 5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM + ))); + } + + private OvergrownPest(final OvergrownPest card) { + super(card); + } + + @Override + public OvergrownPest copy() { + return new OvergrownPest(this); + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java index c5b98cfa26..a42a168fb5 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java @@ -98,6 +98,7 @@ public final class MarchOfTheMachine extends ExpansionSet { cards.add(new SetCardInfo("Norn's Inquisitor", 29, Rarity.UNCOMMON, mage.cards.n.NornsInquisitor.class)); cards.add(new SetCardInfo("Omen Hawker", 70, Rarity.UNCOMMON, mage.cards.o.OmenHawker.class)); cards.add(new SetCardInfo("Oracle of Tragedy", 71, Rarity.UNCOMMON, mage.cards.o.OracleOfTragedy.class)); + cards.add(new SetCardInfo("Overgrown Pest", 197, Rarity.COMMON, mage.cards.o.OvergrownPest.class)); cards.add(new SetCardInfo("Ozolith, the Shattered Spire", 198, Rarity.RARE, mage.cards.o.OzolithTheShatteredSpire.class)); cards.add(new SetCardInfo("Phyrexian Awakening", 30, Rarity.UNCOMMON, mage.cards.p.PhyrexianAwakening.class)); cards.add(new SetCardInfo("Phyrexian Gargantua", 121, Rarity.UNCOMMON, mage.cards.p.PhyrexianGargantua.class)); diff --git a/Mage/src/main/java/mage/filter/predicate/card/DoubleFacedCardPredicate.java b/Mage/src/main/java/mage/filter/predicate/card/DoubleFacedCardPredicate.java new file mode 100644 index 0000000000..ffaeb61c91 --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/card/DoubleFacedCardPredicate.java @@ -0,0 +1,23 @@ +package mage.filter.predicate.card; + +import mage.cards.Card; +import mage.cards.ModalDoubleFacesCard; +import mage.filter.predicate.Predicate; +import mage.game.Game; + +/** + * @author TheElk801 + */ +public enum DoubleFacedCardPredicate implements Predicate { + instance; + + @Override + public boolean apply(Card input, Game game) { + return input instanceof ModalDoubleFacesCard || input.getSecondCardFace() != null; + } + + @Override + public String toString() { + return "Double-Faced"; + } +}