Implemented Ethereal Forager

This commit is contained in:
Evan Kranzler 2020-04-18 18:59:48 -04:00
parent 4bfbfe2232
commit ad0c75895f
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,96 @@
package mage.cards.e;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.DelveAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInExile;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EtherealForager extends CardImpl {
public EtherealForager(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
this.subtype.add(SubType.ELEMENTAL);
this.subtype.add(SubType.WHALE);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Delve
this.addAbility(new DelveAbility());
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Ethereal Forager attacks, you may return an instant or sorcery card exiled with Ethereal Forager to its owner's hand.
this.addAbility(new AttacksTriggeredAbility(new EtherealForagerEffect(), true));
}
private EtherealForager(final EtherealForager card) {
super(card);
}
@Override
public EtherealForager copy() {
return new EtherealForager(this);
}
}
class EtherealForagerEffect extends OneShotEffect {
EtherealForagerEffect() {
super(Outcome.Benefit);
staticText = "return an instant or sorcery card exiled with {this} to its owner's hand";
}
private EtherealForagerEffect(final EtherealForagerEffect effect) {
super(effect);
}
@Override
public EtherealForagerEffect copy() {
return new EtherealForagerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
String keyString = CardUtil.getCardZoneString("delvedCards", source.getSourceId(), game, true);
Cards delvedCards = (Cards) game.getState().getValue(keyString);
if (delvedCards == null || delvedCards.count(StaticFilters.FILTER_CARD_INSTANT_AND_SORCERY, game) < 1) {
return false;
}
TargetCard targetCard = new TargetCardInExile(0, 1, StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, null, true);
;
player.choose(Outcome.DrawCard, delvedCards, targetCard, game);
Card card = game.getCard(targetCard.getFirstTarget());
if (card == null || !player.moveCards(card, Zone.HAND, source, game)) {
return false;
}
delvedCards.remove(card);
return true;
}
}

View file

@ -124,6 +124,7 @@ public final class Commander2020Edition extends ExpansionSet {
cards.add(new SetCardInfo("Eon Frolicker", 33, Rarity.RARE, mage.cards.e.EonFrolicker.class));
cards.add(new SetCardInfo("Etali, Primal Storm", 151, Rarity.RARE, mage.cards.e.EtaliPrimalStorm.class));
cards.add(new SetCardInfo("Eternal Dragon", 88, Rarity.RARE, mage.cards.e.EternalDragon.class));
cards.add(new SetCardInfo("Ethereal Forager", 34, Rarity.RARE, mage.cards.e.EtherealForager.class));
cards.add(new SetCardInfo("Ever After", 133, Rarity.RARE, mage.cards.e.EverAfter.class));
cards.add(new SetCardInfo("Evolution Charm", 171, Rarity.COMMON, mage.cards.e.EvolutionCharm.class));
cards.add(new SetCardInfo("Exotic Orchard", 273, Rarity.RARE, mage.cards.e.ExoticOrchard.class));