Implemented Eerie Ultimatum

This commit is contained in:
Evan Kranzler 2020-04-09 10:37:08 -04:00
parent 6473f544c3
commit 4cf38a2c4b
2 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,107 @@
package mage.cards.e;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterPermanentCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EerieUltimatum extends CardImpl {
public EerieUltimatum(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}{W}{B}{B}{B}{G}{G}");
// Return any number of permanent cards with different names from your graveyard to the battlefield
this.getSpellAbility().addEffect(new EerieUltimatumEffect());
}
private EerieUltimatum(final EerieUltimatum card) {
super(card);
}
@Override
public EerieUltimatum copy() {
return new EerieUltimatum(this);
}
}
class EerieUltimatumEffect extends OneShotEffect {
EerieUltimatumEffect() {
super(Outcome.Benefit);
staticText = "return any number of permanent cards with different names from your graveyard to the battlefield";
}
private EerieUltimatumEffect(final EerieUltimatumEffect effect) {
super(effect);
}
@Override
public EerieUltimatumEffect copy() {
return new EerieUltimatumEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetCard target = new EerieUltimatumTarget();
if (!player.choose(outcome, player.getGraveyard(), target, game)) {
return false;
}
return player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
}
}
class EerieUltimatumTarget extends TargetCardInYourGraveyard {
private static final FilterCard filter
= new FilterPermanentCard("permanent cards with different names");
EerieUltimatumTarget() {
super(0, Integer.MAX_VALUE, filter, true);
}
private EerieUltimatumTarget(final EerieUltimatumTarget target) {
super(target);
}
@Override
public EerieUltimatumTarget copy() {
return new EerieUltimatumTarget(this);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (!super.canTarget(controllerId, id, source, game)) {
return false;
}
Card card = game.getCard(id);
if (card == null) {
return false;
}
return this.getTargets()
.stream()
.map(game::getCard)
.map(MageObject::getName)
.noneMatch(card.getName()::equals);
}
}

View file

@ -88,6 +88,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
cards.add(new SetCardInfo("Drannith Magistrate", 11, Rarity.RARE, mage.cards.d.DrannithMagistrate.class)); cards.add(new SetCardInfo("Drannith Magistrate", 11, Rarity.RARE, mage.cards.d.DrannithMagistrate.class));
cards.add(new SetCardInfo("Drannith Stinger", 113, Rarity.COMMON, mage.cards.d.DrannithStinger.class)); cards.add(new SetCardInfo("Drannith Stinger", 113, Rarity.COMMON, mage.cards.d.DrannithStinger.class));
cards.add(new SetCardInfo("Dreamtail Heron", 47, Rarity.COMMON, mage.cards.d.DreamtailHeron.class)); cards.add(new SetCardInfo("Dreamtail Heron", 47, Rarity.COMMON, mage.cards.d.DreamtailHeron.class));
cards.add(new SetCardInfo("Eerie Ultimatum", 184, Rarity.RARE, mage.cards.e.EerieUltimatum.class));
cards.add(new SetCardInfo("Essence Scatter", 49, Rarity.COMMON, mage.cards.e.EssenceScatter.class)); cards.add(new SetCardInfo("Essence Scatter", 49, Rarity.COMMON, mage.cards.e.EssenceScatter.class));
cards.add(new SetCardInfo("Everquill Phoenix", 114, Rarity.RARE, mage.cards.e.EverquillPhoenix.class)); cards.add(new SetCardInfo("Everquill Phoenix", 114, Rarity.RARE, mage.cards.e.EverquillPhoenix.class));
cards.add(new SetCardInfo("Extinction Event", 88, Rarity.RARE, mage.cards.e.ExtinctionEvent.class)); cards.add(new SetCardInfo("Extinction Event", 88, Rarity.RARE, mage.cards.e.ExtinctionEvent.class));