[MOM] Implement Knight-Errant of Eos

This commit is contained in:
theelk801 2023-04-09 13:35:43 -04:00
parent 7a3841c45c
commit ecf8fe5d50
2 changed files with 111 additions and 0 deletions

View file

@ -0,0 +1,110 @@
package mage.cards.k;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.ConvokedSourceCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.ConvokeAbility;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class KnightErrantOfEos extends CardImpl {
public KnightErrantOfEos(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.KNIGHT);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Convoke
this.addAbility(new ConvokeAbility());
// When Knight-Errant of Eos enters the battlefield, look at the top six cards of your library. You may reveal up to two creature cards with mana value X or less from among them, where X is the number of creatures that convoked Knight-Errant of Eos. Put the revealed cards into your hand, then shuffle.
this.addAbility(new EntersBattlefieldTriggeredAbility(new KnightErrantOfEosEffect()));
}
private KnightErrantOfEos(final KnightErrantOfEos card) {
super(card);
}
@Override
public KnightErrantOfEos copy() {
return new KnightErrantOfEos(this);
}
}
class KnightErrantOfEosEffect extends OneShotEffect {
enum KnightErrantOfEosPredicate implements ObjectSourcePlayerPredicate<Card> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
return input
.getObject()
.getManaValue()
<= ConvokedSourceCount
.PERMANENT
.calculate(game, input.getSource(), null);
}
}
private static final FilterCard filter = new FilterCreatureCard(
"creature card with mana value less than or equal to the number of creatures that convoked this"
);
static {
filter.add(KnightErrantOfEosPredicate.instance);
}
KnightErrantOfEosEffect() {
super(Outcome.Benefit);
staticText = "look at the top six cards of your library. You may reveal up to two creature cards " +
"with mana value X or less from among them, where X is the number of creatures that convoked {this}. " +
"Put the revealed cards into your hand, then shuffle";
}
private KnightErrantOfEosEffect(final KnightErrantOfEosEffect effect) {
super(effect);
}
@Override
public KnightErrantOfEosEffect copy() {
return new KnightErrantOfEosEffect(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.getLibrary().getTopCards(game, 6));
TargetCard target = new TargetCardInLibrary(0, 2, filter);
player.choose(Outcome.DrawCard, cards, target, game);
Cards toHand = new CardsImpl(target.getTargets());
player.revealCards(source, toHand, game);
player.moveCards(toHand, Zone.HAND, source, game);
player.shuffleLibrary(source, game);
return true;
}
}

View file

@ -134,6 +134,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Kitesail", 261, Rarity.COMMON, mage.cards.k.Kitesail.class));
cards.add(new SetCardInfo("Kithkin Billyrider", 24, Rarity.COMMON, mage.cards.k.KithkinBillyrider.class));
cards.add(new SetCardInfo("Knight of the New Coalition", 25, Rarity.COMMON, mage.cards.k.KnightOfTheNewCoalition.class));
cards.add(new SetCardInfo("Knight-Errant of Eos", 26, Rarity.RARE, mage.cards.k.KnightErrantOfEos.class));
cards.add(new SetCardInfo("Kor Halberd", 27, Rarity.COMMON, mage.cards.k.KorHalberd.class));
cards.add(new SetCardInfo("Kroxa and Kunoros", 245, Rarity.MYTHIC, mage.cards.k.KroxaAndKunoros.class));
cards.add(new SetCardInfo("Lithomantic Barrage", 152, Rarity.UNCOMMON, mage.cards.l.LithomanticBarrage.class));