Implemented Estrid, the Masked

This commit is contained in:
Evan Kranzler 2018-07-29 22:55:28 -04:00
parent 5a846e9343
commit ef38467326
4 changed files with 205 additions and 0 deletions

View file

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

View file

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

View file

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

View file

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