diff --git a/Mage.Sets/src/mage/cards/t/TemporalCleansing.java b/Mage.Sets/src/mage/cards/t/TemporalCleansing.java new file mode 100644 index 0000000000..cf3e97c9e1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TemporalCleansing.java @@ -0,0 +1,77 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.ConvokeAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetNonlandPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TemporalCleansing extends CardImpl { + + public TemporalCleansing(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}"); + + // Convoke + this.addAbility(new ConvokeAbility()); + + // The owner of target nonland permanent puts it into their library second from the top or on the bottom. + this.getSpellAbility().addEffect(new TemporalCleansingEffect()); + this.getSpellAbility().addTarget(new TargetNonlandPermanent()); + } + + private TemporalCleansing(final TemporalCleansing card) { + super(card); + } + + @Override + public TemporalCleansing copy() { + return new TemporalCleansing(this); + } +} + +class TemporalCleansingEffect extends OneShotEffect { + + TemporalCleansingEffect() { + super(Outcome.Benefit); + staticText = "the owner of target nonland permanent puts it into their library second from the top or on the bottom"; + } + + private TemporalCleansingEffect(final TemporalCleansingEffect effect) { + super(effect); + } + + @Override + public TemporalCleansingEffect copy() { + return new TemporalCleansingEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent == null) { + return false; + } + Player player = game.getPlayer(permanent.getOwnerId()); + if (player == null) { + return false; + } + if (player.chooseUse( + outcome, "Put " + permanent.getIdName() + " second from the top or on the bottom?", + null, "Second from top", "Bottom", source, game + )) { + return player.putCardOnTopXOfLibrary(permanent, game, source, 2, true); + } + return player.putCardsOnBottomOfLibrary(permanent, game, source, false); + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java index 9ae1900beb..4b9e878ca8 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java @@ -224,6 +224,7 @@ public final class MarchOfTheMachine extends ExpansionSet { cards.add(new SetCardInfo("Swordsworn Cavalier", 42, Rarity.COMMON, mage.cards.s.SwordswornCavalier.class)); cards.add(new SetCardInfo("Tangled Skyline", 209, Rarity.UNCOMMON, mage.cards.t.TangledSkyline.class)); cards.add(new SetCardInfo("Tarkir Duneshaper", 43, Rarity.COMMON, mage.cards.t.TarkirDuneshaper.class)); + cards.add(new SetCardInfo("Temporal Cleansing", 80, Rarity.COMMON, mage.cards.t.TemporalCleansing.class)); cards.add(new SetCardInfo("Tenured Oilcaster", 126, Rarity.COMMON, mage.cards.t.TenuredOilcaster.class)); cards.add(new SetCardInfo("Thornwood Falls", 274, Rarity.COMMON, mage.cards.t.ThornwoodFalls.class)); cards.add(new SetCardInfo("Thrashing Frontliner", 167, Rarity.COMMON, mage.cards.t.ThrashingFrontliner.class));