diff --git a/Mage.Sets/src/mage/cards/e/EstridTheMasked.java b/Mage.Sets/src/mage/cards/e/EstridTheMasked.java new file mode 100644 index 00000000000..fee3b6e092c --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EstridTheMasked.java @@ -0,0 +1,160 @@ +package mage.cards.e; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.CanBeYourCommanderAbility; +import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect; +import mage.abilities.effects.common.UntapAllControllerEffect; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterEnchantmentCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.EnchantedPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.MaskToken; +import mage.players.Player; +import mage.target.TargetPermanent; + +/** + * + * @author TheElk801 + */ +public final class EstridTheMasked extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent(); + private static final FilterPermanent filter2 = new FilterPermanent("another permanent"); + + static { + filter.add(new EnchantedPredicate()); + filter2.add(new AnotherPredicate()); + } + + public EstridTheMasked(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{G}{W}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.ESTRID); + this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); + + // +2: Untap each enchanted permanent you control. + this.addAbility(new LoyaltyAbility(new UntapAllControllerEffect( + filter, "untap each enchanted permanent you control" + ), 2)); + + // -1: Create a white Aura enchantment token named Mask attached to another target permanent. The token has enchant permanent and totem armor. + Ability ability = new LoyaltyAbility( + new EstridTheMaskedTokenEffect(), -1 + ); + ability.addTarget(new TargetPermanent(filter2)); + this.addAbility(ability); + + // -7: Put the top seven cards of your library into your graveyard. Return all non-Aura enchantment cards from your graveyard to the battlefield, then do the same for Aura cards. + this.addAbility(new LoyaltyAbility( + new EstridTheMaskedGraveyardEffect(), -7 + )); + + // Estrid, the Masked can be your commander. + this.addAbility(CanBeYourCommanderAbility.getInstance()); + } + + public EstridTheMasked(final EstridTheMasked card) { + super(card); + } + + @Override + public EstridTheMasked copy() { + return new EstridTheMasked(this); + } +} + +class EstridTheMaskedTokenEffect extends OneShotEffect { + + public EstridTheMaskedTokenEffect() { + super(Outcome.Benefit); + this.staticText = "create a white Aura enchantment token named Mask " + + "attached to another target permanent. " + + "The token has enchant permanent and totem armor"; + } + + public EstridTheMaskedTokenEffect(final EstridTheMaskedTokenEffect effect) { + super(effect); + } + + @Override + public EstridTheMaskedTokenEffect copy() { + return new EstridTheMaskedTokenEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + CreateTokenEffect effect = new CreateTokenEffect(new MaskToken()); + effect.apply(game, source); + for (UUID tokenId : effect.getLastAddedTokenIds()) { + Permanent token = game.getPermanent(tokenId); + if (token == null) { + continue; + } + token.attachTo(source.getFirstTarget(), game); + } + return true; + } +} + +class EstridTheMaskedGraveyardEffect extends OneShotEffect { + + private static final FilterEnchantmentCard filter + = new FilterEnchantmentCard(); + private static final FilterEnchantmentCard filter2 + = new FilterEnchantmentCard(); + + static { + filter.add(Predicates.not(new SubtypePredicate(SubType.AURA))); + filter.add(new SubtypePredicate(SubType.AURA)); + } + + public EstridTheMaskedGraveyardEffect() { + super(Outcome.PutCardInPlay); + this.staticText = "put the top seven cards of your library " + + "into your graveyard. Return all non-Aura enchantment cards " + + "from your graveyard to the battlefield, " + + "then do the same for Aura cards"; + } + + public EstridTheMaskedGraveyardEffect(final EstridTheMaskedGraveyardEffect effect) { + super(effect); + } + + @Override + public EstridTheMaskedGraveyardEffect copy() { + return new EstridTheMaskedGraveyardEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + new PutTopCardOfLibraryIntoGraveControllerEffect(7).apply(game, source); + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + controller.moveCards(controller.getGraveyard().getCards( + filter, source.getSourceId(), source.getControllerId(), game + ), Zone.BATTLEFIELD, source, game); + controller.moveCards(controller.getGraveyard().getCards( + filter2, source.getSourceId(), source.getControllerId(), game + ), Zone.BATTLEFIELD, source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2018.java b/Mage.Sets/src/mage/sets/Commander2018.java index 463e666766c..2f7998b98c7 100644 --- a/Mage.Sets/src/mage/sets/Commander2018.java +++ b/Mage.Sets/src/mage/sets/Commander2018.java @@ -107,6 +107,7 @@ public final class Commander2018 extends ExpansionSet { cards.add(new SetCardInfo("Epic Proportions", 142, Rarity.RARE, mage.cards.e.EpicProportions.class)); cards.add(new SetCardInfo("Esper Charm", 179, Rarity.UNCOMMON, mage.cards.e.EsperCharm.class)); cards.add(new SetCardInfo("Estrid's Invocation", 8, Rarity.RARE, mage.cards.e.EstridsInvocation.class)); + cards.add(new SetCardInfo("Estrid, the Masked", 40, Rarity.MYTHIC, mage.cards.e.EstridTheMasked.class)); cards.add(new SetCardInfo("Etherium Sculptor", 90, Rarity.COMMON, mage.cards.e.EtheriumSculptor.class)); cards.add(new SetCardInfo("Ever-Watching Threshold", 9, Rarity.RARE, mage.cards.e.EverWatchingThreshold.class)); cards.add(new SetCardInfo("Evolving Wilds", 245, Rarity.COMMON, mage.cards.e.EvolvingWilds.class)); diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 49ca306dd6b..745320babd8 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -375,6 +375,7 @@ public enum SubType { DOOKU("Dooku", SubTypeSet.PlaneswalkerType, true), // Star Wars DOVIN("Dovin", SubTypeSet.PlaneswalkerType), ELSPETH("Elspeth", SubTypeSet.PlaneswalkerType), + ESTRID("Estrid", SubTypeSet.PlaneswalkerType), FREYALISE("Freyalise", SubTypeSet.PlaneswalkerType), GARRUK("Garruk", SubTypeSet.PlaneswalkerType), GIDEON("Gideon", SubTypeSet.PlaneswalkerType), diff --git a/Mage/src/main/java/mage/game/permanent/token/MaskToken.java b/Mage/src/main/java/mage/game/permanent/token/MaskToken.java new file mode 100644 index 00000000000..e133169b7ec --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/MaskToken.java @@ -0,0 +1,43 @@ +package mage.game.permanent.token; + +import mage.constants.CardType; +import mage.constants.SubType; +import mage.abilities.Ability; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.TotemArmorAbility; +import mage.constants.Outcome; +import mage.target.TargetPermanent; + +/** + * + * @author TheElk801 + */ +public final class MaskToken extends TokenImpl { + + public MaskToken() { + super( + "Mask", "white Aura enchantment token named Mask " + + "attached to another target permanent. " + + "The token has enchant permanent and totem armor." + ); + cardType.add(CardType.ENCHANTMENT); + color.setWhite(true); + subtype.add(SubType.AURA); + + TargetPermanent auraTarget = new TargetPermanent(); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + ability.addEffect(new AttachEffect(Outcome.BoostCreature)); + this.addAbility(ability); + + this.addAbility(new TotemArmorAbility()); + } + + public MaskToken(final MaskToken token) { + super(token); + } + + public MaskToken copy() { + return new MaskToken(this); + } +}