implement [MH3] Deem Inferior

This commit is contained in:
Susucre 2024-06-01 00:06:12 +02:00
parent 83c284052f
commit f5c8fb1a4e
2 changed files with 86 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));