diff --git a/Mage.Sets/src/mage/cards/t/TeferiWhoSlowsTheSunset.java b/Mage.Sets/src/mage/cards/t/TeferiWhoSlowsTheSunset.java new file mode 100644 index 00000000000..bcbbc31e51c --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TeferiWhoSlowsTheSunset.java @@ -0,0 +1,99 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.GetEmblemEffect; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.game.command.emblems.TeferiWhoSlowsTheSunsetEmblem; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetArtifactPermanent; +import mage.target.common.TargetCreaturePermanent; +import mage.target.common.TargetLandPermanent; + +import java.util.UUID; + +/** + * @author LePwnerer + */ +public final class TeferiWhoSlowsTheSunset extends CardImpl { + + public TeferiWhoSlowsTheSunset(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.TEFERI); + this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(4)); + + // +1: Choose up to one target artifact, up to one target creature, and up to one target land. Untap the chosen permanents you control. Tap the chosen permanents you don't control. You gain 2 life. + Ability ability = new LoyaltyAbility(new TeferiWhoSlowsTheSunsetEffect(), 1); + ability.addTarget(new TargetArtifactPermanent()); + ability.addTarget(new TargetCreaturePermanent()); + ability.addTarget(new TargetLandPermanent()); + this.addAbility(ability); + + // −2: Look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order. + this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(StaticValue.get(3), false, StaticValue.get(1), new FilterCard("card"), false, false), -2)); + + // −7: You get an emblem with "Untap all permanents you control during each opponent's untap step" and "You draw a card during each opponent's draw step." + this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new TeferiWhoSlowsTheSunsetEmblem()), -7)); + } + + private TeferiWhoSlowsTheSunset(final TeferiWhoSlowsTheSunset card) { + super(card); + } + + @Override + public TeferiWhoSlowsTheSunset copy() { + return new TeferiWhoSlowsTheSunset(this); + } +} + +class TeferiWhoSlowsTheSunsetEffect extends OneShotEffect { + + TeferiWhoSlowsTheSunsetEffect() { + super(Outcome.Benefit); + staticText = "Choose up to one target artifact, up to one target creature, and up to one target land. " + + "Untap the chosen permanents you control. " + + "Tap the chosen permanents you don't control. "; + } + + private TeferiWhoSlowsTheSunsetEffect(final TeferiWhoSlowsTheSunsetEffect effect) { + super(effect); + } + + @Override + public TeferiWhoSlowsTheSunsetEffect copy() { + return new TeferiWhoSlowsTheSunsetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + for (Target target : source.getTargets()) { + Permanent targetPermanent = game.getPermanent(target.getFirstTarget()); + if (targetPermanent != null) { + if (targetPermanent.getControllerId() == player.getId()) { + targetPermanent.untap(game); + } else { + targetPermanent.tap(source, game); + } + } + } + + player.gainLife(2, game, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index e8484c9a1ab..0361ced3dd4 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -308,6 +308,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Tapping at the Window", 201, Rarity.COMMON, mage.cards.t.TappingAtTheWindow.class)); cards.add(new SetCardInfo("Tavern Ruffian", 163, Rarity.COMMON, mage.cards.t.TavernRuffian.class)); cards.add(new SetCardInfo("Tavern Smasher", 163, Rarity.COMMON, mage.cards.t.TavernSmasher.class)); + cards.add(new SetCardInfo("Teferi, Who Slows the Sunset", 245, Rarity.MYTHIC, mage.cards.t.TeferiWhoSlowsTheSunset.class)); cards.add(new SetCardInfo("The Meathook Massacre", 112, Rarity.MYTHIC, mage.cards.t.TheMeathookMassacre.class)); cards.add(new SetCardInfo("Thermo-Alchemist", 164, Rarity.UNCOMMON, mage.cards.t.ThermoAlchemist.class)); cards.add(new SetCardInfo("Thraben Exorcism", 39, Rarity.COMMON, mage.cards.t.ThrabenExorcism.class)); diff --git a/Mage/src/main/java/mage/game/command/emblems/TeferiWhoSlowsTheSunsetEmblem.java b/Mage/src/main/java/mage/game/command/emblems/TeferiWhoSlowsTheSunsetEmblem.java new file mode 100644 index 00000000000..99ba626e571 --- /dev/null +++ b/Mage/src/main/java/mage/game/command/emblems/TeferiWhoSlowsTheSunsetEmblem.java @@ -0,0 +1,19 @@ +package mage.game.command.emblems; + +import mage.abilities.common.BeginningOfDrawTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.UntapAllDuringEachOtherPlayersUntapStepEffect; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.game.command.Emblem; + +public class TeferiWhoSlowsTheSunsetEmblem extends Emblem { + // You get an emblem with "Untap all permanents you control during each opponent's untap step" and "You draw a card during each opponent's draw step." + public TeferiWhoSlowsTheSunsetEmblem() { + this.setName("Emblem Teferi"); + this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new UntapAllDuringEachOtherPlayersUntapStepEffect(new FilterControlledPermanent("permanents you control")))); + this.getAbilities().add(new BeginningOfDrawTriggeredAbility(Zone.COMMAND, new DrawCardSourceControllerEffect(1), TargetController.OPPONENT, false)); + } +}