diff --git a/Mage.Sets/src/mage/cards/e/EnigmaThief.java b/Mage.Sets/src/mage/cards/e/EnigmaThief.java new file mode 100644 index 0000000000..1f3c90f1f5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EnigmaThief.java @@ -0,0 +1,73 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.ProwlAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterNonlandPermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.targetadjustment.TargetAdjuster; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EnigmaThief extends CardImpl { + + public EnigmaThief(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}"); + + this.subtype.add(SubType.SPHINX); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Prowl {3}{U} + this.addAbility(new ProwlAbility(this, "{3}{U}")); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Enigma Thief enters the battlefield, for each opponent, return up to one target nonland permanent that player controls to its owner's hand. + Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(true) + .setText("for each opponent, return up to one target nonland permanent that player controls to its owner's hand")); + } + + private EnigmaThief(final EnigmaThief card) { + super(card); + } + + @Override + public EnigmaThief copy() { + return new EnigmaThief(this); + } +} + +enum EnigmaThiefAdjuster implements TargetAdjuster { + instance; + + @Override + public void adjustTargets(Ability ability, Game game) { + ability.getTargets().clear(); + for (UUID opponentId : game.getOpponents(ability.getControllerId())) { + Player opponent = game.getPlayer(opponentId); + if (opponent == null) { + continue; + } + FilterPermanent filter = new FilterNonlandPermanent("nonland permanent controlled by " + opponent.getLogName()); + filter.add(new ControllerIdPredicate(opponentId)); + ability.addTarget(new TargetPermanent(0, 1, filter, false)); + } + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRisingCommander.java b/Mage.Sets/src/mage/sets/ZendikarRisingCommander.java index def2043e33..2ed961b772 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRisingCommander.java +++ b/Mage.Sets/src/mage/sets/ZendikarRisingCommander.java @@ -1,6 +1,7 @@ package mage.sets; import mage.cards.ExpansionSet; +import mage.constants.Rarity; import mage.constants.SetType; /** @@ -16,5 +17,7 @@ public final class ZendikarRisingCommander extends ExpansionSet { private ZendikarRisingCommander() { super("Zendikar Rising Commander", "ZNC", ExpansionSet.buildDate(2020, 9, 25), SetType.SUPPLEMENTAL); + + cards.add(new SetCardInfo("Enigma Thief", 4, Rarity.RARE, mage.cards.e.EnigmaThief.class)); } }