[CLB] Implemented Ascend from Avernus

This commit is contained in:
Evan Kranzler 2022-05-24 09:51:16 -04:00
parent 9ec2c5b3a4
commit 77fbe2229c
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.a;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AscendFromAvernus extends CardImpl {
public AscendFromAvernus(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{W}{W}{W}");
// Return all creature and planeswalker cards with mana value X or less from your graveyard to the battlefield. Exile Ascend from Avernus.
this.getSpellAbility().addEffect(new AscendFromAvernusEffect());
this.getSpellAbility().addEffect(new ExileSpellEffect());
}
private AscendFromAvernus(final AscendFromAvernus card) {
super(card);
}
@Override
public AscendFromAvernus copy() {
return new AscendFromAvernus(this);
}
}
class AscendFromAvernusEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard();
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.PLANESWALKER.getPredicate()
));
}
AscendFromAvernusEffect() {
super(Outcome.Benefit);
staticText = "return all creature and planeswalker cards " +
"with mana value X or less from your graveyard to the battlefield";
}
private AscendFromAvernusEffect(final AscendFromAvernusEffect effect) {
super(effect);
}
@Override
public AscendFromAvernusEffect copy() {
return new AscendFromAvernusEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(player.getGraveyard().getCards(filter, game));
cards.removeIf(uuid -> game.getCard(uuid).getManaValue() > source.getManaCostsToPay().getX());
return player.moveCards(cards, Zone.BATTLEFIELD, source, game);
}
}

View file

@ -29,6 +29,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Ancient Brass Dragon", 111, Rarity.MYTHIC, mage.cards.a.AncientBrassDragon.class));
cards.add(new SetCardInfo("Arcane Encyclopedia", 297, Rarity.UNCOMMON, mage.cards.a.ArcaneEncyclopedia.class));
cards.add(new SetCardInfo("Arcane Signet", 298, Rarity.UNCOMMON, mage.cards.a.ArcaneSignet.class));
cards.add(new SetCardInfo("Ascend from Avernus", 5, Rarity.RARE, mage.cards.a.AscendFromAvernus.class));
cards.add(new SetCardInfo("Astarion, the Decadent", 265, Rarity.RARE, mage.cards.a.AstarionTheDecadent.class));
cards.add(new SetCardInfo("Astral Confrontation", 6, Rarity.COMMON, mage.cards.a.AstralConfrontation.class));
cards.add(new SetCardInfo("Avenging Hunter", 215, Rarity.COMMON, mage.cards.a.AvengingHunter.class));