From 2086a4303614ae75c761735563f72612269364f6 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 26 Jul 2018 11:11:42 -0400 Subject: [PATCH] Implemented Genesis Storm --- Mage.Sets/src/mage/cards/g/GenesisStorm.java | 90 ++++++++++++++++++++ Mage.Sets/src/mage/sets/Commander2018.java | 1 + 2 files changed, 91 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GenesisStorm.java diff --git a/Mage.Sets/src/mage/cards/g/GenesisStorm.java b/Mage.Sets/src/mage/cards/g/GenesisStorm.java new file mode 100644 index 0000000000..c26ff95762 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GenesisStorm.java @@ -0,0 +1,90 @@ +package mage.cards.g; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.CommanderStormAbility; +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 TheElk801 + */ +public final class GenesisStorm extends CardImpl { + + public GenesisStorm(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}{G}"); + + // When you cast this spell, copy it for each time you've cast your commander from the command zone this game. + this.addAbility(new CommanderStormAbility()); + + // Reveal cards from the top of your library until you reveal a nonland permanent card. You may put that card onto the battlefield. Then put all cards revealed this way that weren't put onto the battlefield on the bottom of your library in a random order. + this.getSpellAbility().addEffect(new GenesisStormEffect()); + } + + public GenesisStorm(final GenesisStorm card) { + super(card); + } + + @Override + public GenesisStorm copy() { + return new GenesisStorm(this); + } +} + +class GenesisStormEffect extends OneShotEffect { + + public GenesisStormEffect() { + super(Outcome.PlayForFree); + this.staticText = "reveal cards from the top of your library " + + "until you reveal a nonland permanent card. " + + "You may put that card onto the battlefield. " + + "Then put all cards revealed this way " + + "that weren't put onto the battlefield " + + "on the bottom of your library in a random order"; + } + + public GenesisStormEffect(GenesisStormEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + CardsImpl toReveal = new CardsImpl(); + Card nonLandCard = null; + for (Card card : controller.getLibrary().getCards(game)) { + toReveal.add(card); + if (card.isPermanent() && !card.isLand()) { + nonLandCard = card; + break; + } + } + controller.revealCards(source, toReveal, game); + if (nonLandCard != null && controller.chooseUse( + outcome, "Put " + nonLandCard.getLogName() + + " onto the battlefield?", source, game + )) { + controller.moveCards(nonLandCard, Zone.BATTLEFIELD, source, game); + toReveal.remove(nonLandCard); + } + controller.putCardsOnBottomOfLibrary(toReveal, game, source, false); + return true; + } + + @Override + public GenesisStormEffect copy() { + return new GenesisStormEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2018.java b/Mage.Sets/src/mage/sets/Commander2018.java index f149cec917..f87e5cf0fb 100644 --- a/Mage.Sets/src/mage/sets/Commander2018.java +++ b/Mage.Sets/src/mage/sets/Commander2018.java @@ -41,6 +41,7 @@ public final class Commander2018 extends ExpansionSet { cards.add(new SetCardInfo("Finest Hour", 180, Rarity.RARE, mage.cards.f.FinestHour.class)); cards.add(new SetCardInfo("Forge of Heroes", 58, Rarity.COMMON, mage.cards.f.ForgeOfHeroes.class)); cards.add(new SetCardInfo("Fury Storm", 22, Rarity.RARE, mage.cards.f.FuryStorm.class)); + cards.add(new SetCardInfo("Genesis Storm", 30, Rarity.RARE, mage.cards.g.GenesisStorm.class)); cards.add(new SetCardInfo("Herald of the Pantheon", 151, Rarity.RARE, mage.cards.h.HeraldOfThePantheon.class)); cards.add(new SetCardInfo("Hydra Omnivore", 153, Rarity.MYTHIC, mage.cards.h.HydraOmnivore.class)); cards.add(new SetCardInfo("Kestia, the Cultivator", 42, Rarity.MYTHIC, mage.cards.k.KestiaTheCultivator.class));