[KHC] Implemented Bounty of Skemfar

This commit is contained in:
Evan Kranzler 2021-01-27 12:01:51 -05:00
parent af8ae39f77
commit 08090ee7aa
2 changed files with 94 additions and 0 deletions

View file

@ -0,0 +1,93 @@
package mage.cards.b;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
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.StaticFilters;
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 BountyOfSkemfar extends CardImpl {
public BountyOfSkemfar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
// Reveal the top six cards of your library. You may put a land card from among them onto the battlefield tapped and an Elf card from among them into your hand. Put the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new BountyOfSkemfarEffect());
}
private BountyOfSkemfar(final BountyOfSkemfar card) {
super(card);
}
@Override
public BountyOfSkemfar copy() {
return new BountyOfSkemfar(this);
}
}
class BountyOfSkemfarEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("an Elf card");
static {
filter.add(SubType.ELF.getPredicate());
}
BountyOfSkemfarEffect() {
super(Outcome.Benefit);
staticText = "reveal the top six cards of your library. You may put a land card from among them " +
"onto the battlefield tapped and an Elf card from among them into your hand. " +
"Put the rest on the bottom of your library in a random order";
}
private BountyOfSkemfarEffect(final BountyOfSkemfarEffect effect) {
super(effect);
}
@Override
public BountyOfSkemfarEffect copy() {
return new BountyOfSkemfarEffect(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));
player.revealCards(source, cards, game);
TargetCard target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_LAND);
player.choose(outcome, cards, target, game);
Card land = cards.get(target.getFirstTarget(), game);
if (land != null) {
player.moveCards(
land, Zone.BATTLEFIELD, source, game, true,
false, false, null
);
}
cards.removeIf(uuid -> game.getState().getZone(uuid) != Zone.LIBRARY);
target = new TargetCardInLibrary(0, 1, filter);
player.choose(outcome, cards, target, game);
Card elf = cards.get(target.getFirstTarget(), game);
if (elf != null) {
player.moveCards(elf, Zone.HAND, source, game);
}
cards.removeIf(uuid -> game.getState().getZone(uuid) != Zone.LIBRARY);
player.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
}
}

View file

@ -19,6 +19,7 @@ public final class KaldheimCommander extends ExpansionSet {
super("Kaldheim Commander", "KHC", ExpansionSet.buildDate(2021, 2, 5), SetType.SUPPLEMENTAL); super("Kaldheim Commander", "KHC", ExpansionSet.buildDate(2021, 2, 5), SetType.SUPPLEMENTAL);
this.hasBasicLands = false; this.hasBasicLands = false;
cards.add(new SetCardInfo("Bounty of Skemfar", 12, Rarity.RARE, mage.cards.b.BountyOfSkemfar.class));
cards.add(new SetCardInfo("Crown of Skemfar", 13, Rarity.RARE, mage.cards.c.CrownOfSkemfar.class)); cards.add(new SetCardInfo("Crown of Skemfar", 13, Rarity.RARE, mage.cards.c.CrownOfSkemfar.class));
cards.add(new SetCardInfo("Elderfang Venom", 15, Rarity.RARE, mage.cards.e.ElderfangVenom.class)); cards.add(new SetCardInfo("Elderfang Venom", 15, Rarity.RARE, mage.cards.e.ElderfangVenom.class));
cards.add(new SetCardInfo("Inspired Sphinx", 40, Rarity.MYTHIC, mage.cards.i.InspiredSphinx.class)); cards.add(new SetCardInfo("Inspired Sphinx", 40, Rarity.MYTHIC, mage.cards.i.InspiredSphinx.class));