diff --git a/Mage.Sets/src/mage/cards/d/DeemInferior.java b/Mage.Sets/src/mage/cards/d/DeemInferior.java new file mode 100644 index 00000000000..393310aa7a8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DeemInferior.java @@ -0,0 +1,85 @@ +package mage.cards.d; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.CardsDrawnThisTurnDynamicValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetNonlandPermanent; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class DeemInferior extends CardImpl { + + public DeemInferior(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}"); + + // This spell costs {1} less to cast for each card you've drawn this turn. + Ability ability = new SimpleStaticAbility(Zone.ALL, + new SpellCostReductionSourceEffect(CardsDrawnThisTurnDynamicValue.instance) + .setText("this spell costs {1} less to cast for each card type among permanents you've sacrificed this turn") + ); + this.addAbility(ability.addHint(CardsDrawnThisTurnDynamicValue.getHint())); + + // The owner of target nonland permanent puts it into their library second from the top or on the bottom. + this.getSpellAbility().addEffect(new DeemInferiorEffect()); + this.getSpellAbility().addTarget(new TargetNonlandPermanent()); + } + + private DeemInferior(final DeemInferior card) { + super(card); + } + + @Override + public DeemInferior copy() { + return new DeemInferior(this); + } +} + +// Same as Temporal Cleansing. +class DeemInferiorEffect extends OneShotEffect { + + DeemInferiorEffect() { + super(Outcome.Benefit); + staticText = "the owner of target nonland permanent puts it into their library second from the top or on the bottom"; + } + + private DeemInferiorEffect(final DeemInferiorEffect effect) { + super(effect); + } + + @Override + public DeemInferiorEffect copy() { + return new DeemInferiorEffect(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/ModernHorizons3.java b/Mage.Sets/src/mage/sets/ModernHorizons3.java index f66232d600a..b61c69ba3ba 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons3.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons3.java @@ -62,6 +62,7 @@ public final class ModernHorizons3 extends ExpansionSet { cards.add(new SetCardInfo("Cyclops Superconductor", 182, Rarity.COMMON, mage.cards.c.CyclopsSuperconductor.class)); cards.add(new SetCardInfo("Deceptive Landscape", 219, Rarity.COMMON, mage.cards.d.DeceptiveLandscape.class)); cards.add(new SetCardInfo("Decree of Justice", 263, Rarity.UNCOMMON, mage.cards.d.DecreeOfJustice.class)); + cards.add(new SetCardInfo("Deem Inferior", 57, Rarity.COMMON, mage.cards.d.DeemInferior.class)); cards.add(new SetCardInfo("Deep Analysis", 268, Rarity.UNCOMMON, mage.cards.d.DeepAnalysis.class)); cards.add(new SetCardInfo("Deserted Temple", 301, Rarity.RARE, mage.cards.d.DesertedTemple.class)); cards.add(new SetCardInfo("Detective's Phoenix", 116, Rarity.RARE, mage.cards.d.DetectivesPhoenix.class));