From 3f20ec17a61dc421bc65d92df032e22e1475d714 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Sun, 2 Jun 2024 18:46:03 +0200 Subject: [PATCH] implement [MH3] Territory Culler --- .../src/mage/cards/t/TerritoryCuller.java | 97 +++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons3.java | 1 + 2 files changed, 98 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TerritoryCuller.java diff --git a/Mage.Sets/src/mage/cards/t/TerritoryCuller.java b/Mage.Sets/src/mage/cards/t/TerritoryCuller.java new file mode 100644 index 00000000000..289c54d29d3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TerritoryCuller.java @@ -0,0 +1,97 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.LandfallAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.DevoidAbility; +import mage.abilities.keyword.ReachAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.PutCards; +import mage.constants.SubType; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class TerritoryCuller extends CardImpl { + + public TerritoryCuller(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}"); + + this.subtype.add(SubType.ELDRAZI); + this.power = new MageInt(7); + this.toughness = new MageInt(5); + + // Devoid + this.addAbility(new DevoidAbility(this.color)); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // Landfall -- Whenever a land enters the battlefield under your control, look at the top card of your library. If it's a creature card, you may reveal it and put it into your hand. If you don't put the card into your hand, you may put it into your graveyard. + this.addAbility(new LandfallAbility(new TerritoryCullerEffect())); + } + + private TerritoryCuller(final TerritoryCuller card) { + super(card); + } + + @Override + public TerritoryCuller copy() { + return new TerritoryCuller(this); + } +} + +class TerritoryCullerEffect extends OneShotEffect { + + TerritoryCullerEffect() { + super(Outcome.DrawCard); + this.staticText = "look at the top card of your library. If it's a creature card, you may reveal it and put it into your hand. " + + "If you don't put the card into your hand, you may put it into your graveyard"; + } + + private TerritoryCullerEffect(final TerritoryCullerEffect effect) { + super(effect); + } + + @Override + public TerritoryCullerEffect copy() { + return new TerritoryCullerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Card card = controller.getLibrary().getFromTop(game); + if (card == null) { + return false; + } + controller.lookAtCards(source, "", new CardsImpl(card), game); + if (card.isCreature(game)) { + String message = "Put " + card.getName() + " " + PutCards.HAND.getMessage(false, false); + if (controller.chooseUse(outcome, message, source, game)) { + controller.revealCards(source, new CardsImpl(card), game); + if (PutCards.HAND.moveCard(controller, card, source, game, "")) { + return true; + } + } + } + String message = "Put " + card.getName() + " " + PutCards.GRAVEYARD.getMessage(false, false); + if (controller.chooseUse(Outcome.Discard, message, source, game)) { + PutCards.GRAVEYARD.moveCard(controller, card, source, game, ""); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons3.java b/Mage.Sets/src/mage/sets/ModernHorizons3.java index bee341ca849..243bc4a3fc5 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons3.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons3.java @@ -264,6 +264,7 @@ public final class ModernHorizons3 extends ExpansionSet { cards.add(new SetCardInfo("Tamiyo, Seasoned Scholar", 242, Rarity.MYTHIC, mage.cards.t.TamiyoSeasonedScholar.class)); cards.add(new SetCardInfo("Temperamental Oozewagg", 172, Rarity.COMMON, mage.cards.t.TemperamentalOozewagg.class)); cards.add(new SetCardInfo("Tempest Harvester", 73, Rarity.COMMON, mage.cards.t.TempestHarvester.class)); + cards.add(new SetCardInfo("Territory Culler", 173, Rarity.UNCOMMON, mage.cards.t.TerritoryCuller.class)); cards.add(new SetCardInfo("The Necrobloom", 194, Rarity.RARE, mage.cards.t.TheNecrobloom.class)); cards.add(new SetCardInfo("Thraben Charm", 45, Rarity.COMMON, mage.cards.t.ThrabenCharm.class)); cards.add(new SetCardInfo("Thriving Skyclaw", 141, Rarity.COMMON, mage.cards.t.ThrivingSkyclaw.class));