From 8d5a466265f5bad5d9c3741b8d7f2c1d30a9d1a4 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 31 May 2019 08:00:48 -0400 Subject: [PATCH] Implemented Geomancer's Gambit --- .../src/mage/cards/g/GeomancersGambit.java | 90 +++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons.java | 1 + 2 files changed, 91 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GeomancersGambit.java diff --git a/Mage.Sets/src/mage/cards/g/GeomancersGambit.java b/Mage.Sets/src/mage/cards/g/GeomancersGambit.java new file mode 100644 index 0000000000..3c5c47b580 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GeomancersGambit.java @@ -0,0 +1,90 @@ +package mage.cards.g; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; +import mage.target.common.TargetLandPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GeomancersGambit extends CardImpl { + + public GeomancersGambit(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}"); + + // Destroy target land. Its controller may search their library for a basic land card, put it onto the battlefield, then shuffle their library. + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addEffect(new GeomancersGambitEffect()); + this.getSpellAbility().addTarget(new TargetLandPermanent()); + + // Draw a card. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); + } + + private GeomancersGambit(final GeomancersGambit card) { + super(card); + } + + @Override + public GeomancersGambit copy() { + return new GeomancersGambit(this); + } +} + +class GeomancersGambitEffect extends OneShotEffect { + + GeomancersGambitEffect() { + super(Outcome.PutLandInPlay); + this.staticText = "Its controller may search their library " + + "for a basic land card, put it onto the battlefield, " + + "then shuffle their library"; + } + + private GeomancersGambitEffect(final GeomancersGambitEffect effect) { + super(effect); + } + + @Override + public GeomancersGambitEffect copy() { + return new GeomancersGambitEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanentOrLKIBattlefield(source.getFirstTarget()); + if (permanent == null) { + return false; + } + Player controller = game.getPlayer(permanent.getControllerId()); + if (controller == null) { + return false; + } + if (!controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", source, game)) { + return true; + } + TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND); + if (controller.searchLibrary(target, source, game)) { + Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); + if (card != null) { + controller.moveCards(card, Zone.BATTLEFIELD, source, game); + } + } + controller.shuffleLibrary(source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons.java b/Mage.Sets/src/mage/sets/ModernHorizons.java index a23cfd5ce8..92a5a7e889 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons.java @@ -85,6 +85,7 @@ public final class ModernHorizons extends ExpansionSet { cards.add(new SetCardInfo("Future Sight", 53, Rarity.RARE, mage.cards.f.FutureSight.class)); cards.add(new SetCardInfo("Generous Gift", 11, Rarity.UNCOMMON, mage.cards.g.GenerousGift.class)); cards.add(new SetCardInfo("Genesis", 166, Rarity.RARE, mage.cards.g.Genesis.class)); + cards.add(new SetCardInfo("Geomancer's Gambit", 125, Rarity.COMMON, mage.cards.g.GeomancersGambit.class)); cards.add(new SetCardInfo("Gilded Light", 12, Rarity.COMMON, mage.cards.g.GildedLight.class)); cards.add(new SetCardInfo("Giver of Runes", 13, Rarity.RARE, mage.cards.g.GiverOfRunes.class)); cards.add(new SetCardInfo("Glacial Revelation", 167, Rarity.UNCOMMON, mage.cards.g.GlacialRevelation.class));