[ECL] Implement Champions of the Perfect

This commit is contained in:
theelk801 2026-01-06 09:33:46 -05:00
parent 1e3b1ff083
commit 8654e84a81
5 changed files with 154 additions and 0 deletions

View file

@ -0,0 +1,52 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.common.BeholdAndExileCost;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ReturnExiledCardToHandEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.BeholdType;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ChampionsOfThePerfect extends CardImpl {
public ChampionsOfThePerfect(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// As an additional cost to cast this spell, behold an Elf and exile it.
this.getSpellAbility().addCost(new BeholdAndExileCost(BeholdType.ELF));
// Whenever you cast a creature spell, draw a card.
this.addAbility(new SpellCastControllerTriggeredAbility(
new DrawCardSourceControllerEffect(1),
StaticFilters.FILTER_SPELL_A_CREATURE, false
));
// When this creature leaves the battlefield, return the exiled card to its owner's hand.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnExiledCardToHandEffect()));
}
private ChampionsOfThePerfect(final ChampionsOfThePerfect card) {
super(card);
}
@Override
public ChampionsOfThePerfect copy() {
return new ChampionsOfThePerfect(this);
}
}

View file

@ -39,6 +39,8 @@ public final class LorwynEclipsed extends ExpansionSet {
cards.add(new SetCardInfo("Bloom Tender", 400, Rarity.MYTHIC, mage.cards.b.BloomTender.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Blossoming Defense", 167, Rarity.UNCOMMON, mage.cards.b.BlossomingDefense.class));
cards.add(new SetCardInfo("Boggart Mischief", 92, Rarity.UNCOMMON, mage.cards.b.BoggartMischief.class));
cards.add(new SetCardInfo("Champions of the Perfect", 171, Rarity.RARE, mage.cards.c.ChampionsOfThePerfect.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Champions of the Perfect", 365, Rarity.RARE, mage.cards.c.ChampionsOfThePerfect.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Chomping Changeling", 172, Rarity.UNCOMMON, mage.cards.c.ChompingChangeling.class));
cards.add(new SetCardInfo("Crossroads Watcher", 173, Rarity.COMMON, mage.cards.c.CrossroadsWatcher.class));
cards.add(new SetCardInfo("Deceit", 212, Rarity.MYTHIC, mage.cards.d.Deceit.class, NON_FULL_USE_VARIOUS));

View file

@ -0,0 +1,62 @@
package mage.abilities.costs.common;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.cards.Card;
import mage.constants.BeholdType;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public class BeholdAndExileCost extends CostImpl {
private final BeholdType beholdType;
public BeholdAndExileCost(BeholdType beholdType) {
super();
this.beholdType = beholdType;
this.text = "behold " + beholdType.getDescription() + " and exile it";
}
private BeholdAndExileCost(final BeholdAndExileCost cost) {
super(cost);
this.beholdType = cost.beholdType;
}
@Override
public BeholdAndExileCost copy() {
return new BeholdAndExileCost(this);
}
@Override
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
return beholdType.canBehold(controllerId, game, source);
}
@Override
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
Player player = game.getPlayer(controllerId);
if (player == null) {
paid = false;
return paid;
}
Card card = beholdType.doBehold(player, game, source);
if (card == null) {
paid = false;
return paid;
}
player.moveCardsToExile(
card, source, game, true,
CardUtil.getExileZoneId(game, source, 1),
CardUtil.getSourceName(game, source)
);
paid = true;
return paid;
}
}

View file

@ -0,0 +1,37 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
* @author TheElk801
*/
public class ReturnExiledCardToHandEffect extends OneShotEffect {
public ReturnExiledCardToHandEffect() {
super(Outcome.Benefit);
staticText = "return the exiled card to its owner's hand";
}
private ReturnExiledCardToHandEffect(final ReturnExiledCardToHandEffect effect) {
super(effect);
}
@Override
public ReturnExiledCardToHandEffect copy() {
return new ReturnExiledCardToHandEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source));
return player != null && exileZone != null && player.moveCards(exileZone, Zone.HAND, source, game);
}
}

View file

@ -21,6 +21,7 @@ import java.util.UUID;
*/
public enum BeholdType {
DRAGON(SubType.DRAGON),
ELF(SubType.ELF),
MERFOLK(SubType.MERFOLK);
private final FilterPermanent filterPermanent;