diff --git a/Mage.Sets/src/mage/cards/b/BountyOfSkemfar.java b/Mage.Sets/src/mage/cards/b/BountyOfSkemfar.java new file mode 100644 index 0000000000..f433f8d2fc --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BountyOfSkemfar.java @@ -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; + } +} diff --git a/Mage.Sets/src/mage/sets/KaldheimCommander.java b/Mage.Sets/src/mage/sets/KaldheimCommander.java index 90705eec3b..deda422cab 100644 --- a/Mage.Sets/src/mage/sets/KaldheimCommander.java +++ b/Mage.Sets/src/mage/sets/KaldheimCommander.java @@ -19,6 +19,7 @@ public final class KaldheimCommander extends ExpansionSet { super("Kaldheim Commander", "KHC", ExpansionSet.buildDate(2021, 2, 5), SetType.SUPPLEMENTAL); 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("Elderfang Venom", 15, Rarity.RARE, mage.cards.e.ElderfangVenom.class)); cards.add(new SetCardInfo("Inspired Sphinx", 40, Rarity.MYTHIC, mage.cards.i.InspiredSphinx.class));