Implemented Wrenn and Six

This commit is contained in:
Evan Kranzler 2019-05-25 10:23:31 -04:00
parent 758453b617
commit ca9197b783
4 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,63 @@
package mage.cards.w;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.filter.common.FilterLandCard;
import mage.filter.predicate.other.OwnerPredicate;
import mage.game.command.emblems.WrennAndSixEmblem;
import mage.target.common.TargetAnyTarget;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WrennAndSix extends CardImpl {
private static final FilterLandCard filter = new FilterLandCard("land card from your graveyard");
static {
filter.add(new OwnerPredicate(TargetController.YOU));
}
public WrennAndSix(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{R}{G}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.WRENN);
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(3));
// +1: Return up to one target land card from your graveyard to your hand.
Ability ability = new LoyaltyAbility(new ReturnFromGraveyardToHandTargetEffect(), 1);
ability.addTarget(new TargetCardInYourGraveyard(filter));
this.addAbility(ability);
// -1: Wrenn and Six deals 1 damage to any target.
ability = new LoyaltyAbility(new DamageTargetEffect(1), -1);
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
// -7: You get an emblem with "Instant and sorcery cards in your graveyard have retrace."
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new WrennAndSixEmblem()), -7));
}
private WrennAndSix(final WrennAndSix card) {
super(card);
}
@Override
public WrennAndSix copy() {
return new WrennAndSix(this);
}
}

View file

@ -125,5 +125,6 @@ public final class ModernHorizons extends ExpansionSet {
cards.add(new SetCardInfo("Wall of One Thousand Cuts", 36, Rarity.COMMON, mage.cards.w.WallOfOneThousandCuts.class));
cards.add(new SetCardInfo("Waterlogged Grove", 249, Rarity.RARE, mage.cards.w.WaterloggedGrove.class));
cards.add(new SetCardInfo("Wing Shards", 38, Rarity.UNCOMMON, mage.cards.w.WingShards.class));
cards.add(new SetCardInfo("Wrenn and Six", 217, Rarity.MYTHIC, mage.cards.w.WrennAndSix.class));
}
}

View file

@ -423,6 +423,7 @@ public enum SubType {
VRASKA("Vraska", SubTypeSet.PlaneswalkerType),
WILL("Will", SubTypeSet.PlaneswalkerType),
WINDGRACE("Windgrace", SubTypeSet.PlaneswalkerType),
WRENN("Wrenn", SubTypeSet.PlaneswalkerType),
XENAGOS("Xenagos", SubTypeSet.PlaneswalkerType),
YANGGU("Yanggu", SubTypeSet.PlaneswalkerType),
YANLING("Yanling", SubTypeSet.PlaneswalkerType),

View file

@ -0,0 +1,60 @@
package mage.game.command.emblems;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.RetraceAbility;
import mage.cards.Card;
import mage.constants.*;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WrennAndSixEmblem extends Emblem {
public WrennAndSixEmblem() {
this.setName("Emblem Wrenn");
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new WrennAndSixEmblemEffect()));
this.setExpansionSetCodeForImage("MH1");
}
}
class WrennAndSixEmblemEffect extends ContinuousEffectImpl {
WrennAndSixEmblemEffect() {
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
staticText = "Instant and sorcery cards in your graveyard have retrace.";
}
private WrennAndSixEmblemEffect(final WrennAndSixEmblemEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId);
if (card == null || !card.isInstantOrSorcery()) {
continue;
}
Ability ability = new RetraceAbility(card);
ability.setSourceId(cardId);
ability.setControllerId(card.getOwnerId());
game.getState().addOtherAbility(card, ability);
}
return true;
}
@Override
public WrennAndSixEmblemEffect copy() {
return new WrennAndSixEmblemEffect(this);
}
}