[DMU] Implemented Ertai Resurrected

This commit is contained in:
Daniel Bomar 2022-08-30 17:59:51 -05:00
parent 8d75c8f256
commit e8f82b7f98
No known key found for this signature in database
GPG key ID: C86C8658F4023918
2 changed files with 137 additions and 0 deletions

View file

@ -0,0 +1,136 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetStackObject;
/**
*
* @author weirddan455
*/
public final class ErtaiResurrected extends CardImpl {
private static final FilterCreatureOrPlaneswalkerPermanent filter =
new FilterCreatureOrPlaneswalkerPermanent("another creature or planeswalker");
static {
filter.add(AnotherPredicate.instance);
}
public ErtaiResurrected(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Flash
this.addAbility(FlashAbility.getInstance());
// When Ertai Resurrected enters the battlefield, choose up to one --
// * Counter target spell, activated ability, or triggered ability. Its controller draws a card.
Ability ability = new EntersBattlefieldTriggeredAbility(new ErtaiResurrectedCounterEffect());
ability.addTarget(new TargetStackObject());
ability.getModes().setMinModes(0);
ability.getModes().setMaxModes(1);
// * Destroy another target creature or planeswalker. Its controller draws a card.
Mode mode = new Mode(new ErtaiResurrectedDestroyEffect());
mode.addTarget(new TargetPermanent(filter));
ability.addMode(mode);
this.addAbility(ability);
}
private ErtaiResurrected(final ErtaiResurrected card) {
super(card);
}
@Override
public ErtaiResurrected copy() {
return new ErtaiResurrected(this);
}
}
class ErtaiResurrectedCounterEffect extends OneShotEffect {
public ErtaiResurrectedCounterEffect() {
super(Outcome.Detriment);
this.staticText = "Counter target spell, activated ability, or triggered ability. Its controller draws a card.";
}
private ErtaiResurrectedCounterEffect(final ErtaiResurrectedCounterEffect effect) {
super(effect);
}
@Override
public ErtaiResurrectedCounterEffect copy() {
return new ErtaiResurrectedCounterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
UUID targetId = source.getFirstTarget();
StackObject stackObject = game.getStack().getStackObject(targetId);
if (stackObject == null) {
return false;
}
Player player = game.getPlayer(stackObject.getControllerId());;
game.getStack().counter(targetId, source, game);
if (player != null) {
player.drawCards(1, source, game);
}
return true;
}
}
class ErtaiResurrectedDestroyEffect extends OneShotEffect {
public ErtaiResurrectedDestroyEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Destroy another target creature or planeswalker. Its controller draws a card.";
}
private ErtaiResurrectedDestroyEffect(final ErtaiResurrectedDestroyEffect effect) {
super(effect);
}
@Override
public ErtaiResurrectedDestroyEffect copy() {
return new ErtaiResurrectedDestroyEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
Player player = game.getPlayer(permanent.getControllerId());
permanent.destroy(source, game);
if (player != null) {
player.drawCards(1, source, game);
}
return true;
}
}

View file

@ -85,6 +85,7 @@ public final class DominariaUnited extends ExpansionSet {
cards.add(new SetCardInfo("Electrostatic Infantry", 122, Rarity.UNCOMMON, mage.cards.e.ElectrostaticInfantry.class));
cards.add(new SetCardInfo("Elfhame Wurm", 161, Rarity.COMMON, mage.cards.e.ElfhameWurm.class));
cards.add(new SetCardInfo("Elvish Hydromancer", 162, Rarity.UNCOMMON, mage.cards.e.ElvishHydromancer.class));
cards.add(new SetCardInfo("Ertai Resurrected", 199, Rarity.RARE, mage.cards.e.ErtaiResurrected.class));
cards.add(new SetCardInfo("Ertai's Scorn", 48, Rarity.UNCOMMON, mage.cards.e.ErtaisScorn.class));
cards.add(new SetCardInfo("Essence Scatter", 49, Rarity.COMMON, mage.cards.e.EssenceScatter.class));
cards.add(new SetCardInfo("Evolved Sleeper", 93, Rarity.RARE, mage.cards.e.EvolvedSleeper.class));