From 9a1ce53c9eac0811193abe103d7164b587795f25 Mon Sep 17 00:00:00 2001 From: Noah Gleason Date: Sat, 23 Jun 2018 20:06:47 -0400 Subject: [PATCH] Implement Prophecy, not showing up --- Mage.Sets/src/mage/cards/p/Prophecy.java | 86 ++++++++++++++++++++++++ Mage.Sets/src/mage/sets/Homelands.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/Prophecy.java diff --git a/Mage.Sets/src/mage/cards/p/Prophecy.java b/Mage.Sets/src/mage/cards/p/Prophecy.java new file mode 100644 index 0000000000..d58d65ab3c --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/Prophecy.java @@ -0,0 +1,86 @@ +package mage.cards.p; + +import java.util.UUID; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +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.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author noahg + */ +public final class Prophecy extends CardImpl { + + public Prophecy(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}"); + + + // Reveal the top card of target opponent's library. If it's a land, you gain 1 life. Then that player shuffles his or her library. + this.spellAbility.addEffect(new ProphecyEffect()); + + // Draw a card at the beginning of the next turn's upkeep. + this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(1)), false)); + } + + public Prophecy(final Prophecy card) { + super(card); + } + + @Override + public Prophecy copy() { + return new Prophecy(this); + } +} + +class ProphecyEffect extends OneShotEffect { + + public ProphecyEffect() { + super(Outcome.GainLife); + this.staticText = "Reveal the top card of target opponent's library. If it's a land, you gain 1 life. Then that player shuffles his or her library"; + } + + public ProphecyEffect(final ProphecyEffect effect) { + super(effect); + } + + @Override + public ProphecyEffect copy() { + return new ProphecyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(source.getFirstTarget()); + MageObject sourceObject = game.getObject(source.getSourceId()); + if (sourceObject == null || targetPlayer == null) { + return false; + } + if (targetPlayer.getLibrary().hasCards()) { + CardsImpl cards = new CardsImpl(); + Card card = targetPlayer.getLibrary().getFromTop(game); + if (card == null) { + return false; + } + cards.add(card); + targetPlayer.revealCards(sourceObject.getName(), cards, game); + if (card.isLand()) { + targetPlayer.gainLife(1, game, source.getSourceId()); + } + targetPlayer.shuffleLibrary(source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Homelands.java b/Mage.Sets/src/mage/sets/Homelands.java index 4502fe8dbd..7d519d6df0 100644 --- a/Mage.Sets/src/mage/sets/Homelands.java +++ b/Mage.Sets/src/mage/sets/Homelands.java @@ -131,6 +131,7 @@ public final class Homelands extends ExpansionSet { cards.add(new SetCardInfo("Mystic Decree", 34, Rarity.RARE, mage.cards.m.MysticDecree.class)); cards.add(new SetCardInfo("Narwhal", 35, Rarity.RARE, mage.cards.n.Narwhal.class)); cards.add(new SetCardInfo("Primal Order", 92, Rarity.RARE, mage.cards.p.PrimalOrder.class)); + cards.add(new SetCardInfo("Prophecy", 11, Rarity.COMMON, mage.cards.p.Prophecy.class)); cards.add(new SetCardInfo("Rashka the Slayer", 12, Rarity.RARE, mage.cards.r.RashkaTheSlayer.class)); cards.add(new SetCardInfo("Reef Pirates", "36a", Rarity.COMMON, ReefPirates.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Reef Pirates", "36b", Rarity.COMMON, ReefPirates.class, NON_FULL_USE_VARIOUS));