[MH2] Implemented Glimpse of Tomorrow

This commit is contained in:
Evan Kranzler 2021-06-03 09:58:37 -04:00
parent e5ccca1563
commit 06a15f9e83
2 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,99 @@
package mage.cards.g;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.List;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GlimpseOfTomorrow extends CardImpl {
public GlimpseOfTomorrow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "");
// Suspend 3{R}{R}
this.addAbility(new SuspendAbility(3, new ManaCostsImpl<>("{R}{R}"), this));
// Shuffle all permanents you own into your library, then reveal that many cards from the top of your library. Put all non-Aura permanent cards revealed this way onto the battlefield, then do the same for Aura cards, then put the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new GlimpseOfTomorrowEffect());
}
private GlimpseOfTomorrow(final GlimpseOfTomorrow card) {
super(card);
}
@Override
public GlimpseOfTomorrow copy() {
return new GlimpseOfTomorrow(this);
}
}
class GlimpseOfTomorrowEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent();
static {
filter.add(TargetController.YOU.getOwnerPredicate());
}
GlimpseOfTomorrowEffect() {
super(Outcome.Benefit);
staticText = "shuffle all permanents you own into your library, then reveal " +
"that many cards from the top of your library. Put all non-Aura permanent cards " +
"revealed this way onto the battlefield, then do the same for Aura cards, " +
"then put the rest on the bottom of your library in a random order";
}
private GlimpseOfTomorrowEffect(final GlimpseOfTomorrowEffect effect) {
super(effect);
}
@Override
public GlimpseOfTomorrowEffect copy() {
return new GlimpseOfTomorrowEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
List<Permanent> permanents = game.getBattlefield().getActivePermanents(
filter, source.getControllerId(), source.getSourceId(), game
);
int count = permanents.size();
player.shuffleCardsToLibrary(new CardsImpl(permanents), game, source);
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, count));
player.revealCards(source, cards, game);
Cards toBattlefield = new CardsImpl(cards.getCards(StaticFilters.FILTER_CARD_PERMANENT, game));
toBattlefield.removeIf(uuid -> game.getCard(uuid).hasSubtype(SubType.AURA, game));
player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);
toBattlefield.clear();
cards.retainZone(Zone.LIBRARY, game);
toBattlefield.addAll(cards.getCards(StaticFilters.FILTER_CARD_PERMANENT, game));
toBattlefield.removeIf(uuid -> !game.getCard(uuid).hasSubtype(SubType.AURA, game));
player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);
cards.retainZone(Zone.LIBRARY, game);
player.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
}
}

View file

@ -126,6 +126,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Ghost-Lit Drifter", 45, Rarity.UNCOMMON, mage.cards.g.GhostLitDrifter.class));
cards.add(new SetCardInfo("Gilt-Blade Prowler", 86, Rarity.COMMON, mage.cards.g.GiltBladeProwler.class));
cards.add(new SetCardInfo("Glimmer Bairn", 163, Rarity.COMMON, mage.cards.g.GlimmerBairn.class));
cards.add(new SetCardInfo("Glimpse of Tomorrow", 129, Rarity.RARE, mage.cards.g.GlimpseOfTomorrow.class));
cards.add(new SetCardInfo("Glinting Creeper", 164, Rarity.UNCOMMON, mage.cards.g.GlintingCreeper.class));
cards.add(new SetCardInfo("Glorious Enforcer", 14, Rarity.UNCOMMON, mage.cards.g.GloriousEnforcer.class));
cards.add(new SetCardInfo("Goblin Anarchomancer", 200, Rarity.COMMON, mage.cards.g.GoblinAnarchomancer.class));