[MID] Implemented Moonsilver Key

This commit is contained in:
Evan Kranzler 2021-09-08 09:48:23 -04:00
parent d12a690c3d
commit 43b3f12b56
2 changed files with 70 additions and 0 deletions

View file

@ -0,0 +1,69 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.abilities.mana.ManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MoonsilverKey extends CardImpl {
private static final FilterCard filter
= new FilterCard("an artifact card with a mana ability or a basic land card");
static {
filter.add(MoonsilverKeyPredicate.instance);
}
public MoonsilverKey(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// {1}, {T}, Sacrifice Moonsilver Key: Search your library for an artifact card with a mana ability or a basic land card, reveal it, put it into your hand, then shuffle.
Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInHandEffect(
new TargetCardInLibrary(filter), true, true
), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}
private MoonsilverKey(final MoonsilverKey card) {
super(card);
}
@Override
public MoonsilverKey copy() {
return new MoonsilverKey(this);
}
}
enum MoonsilverKeyPredicate implements Predicate<Card> {
instance;
@Override
public boolean apply(Card input, Game game) {
if (input.isLand(game) && input.isBasic()) {
return true;
}
return input.isArtifact(game)
&& input
.getAbilities(game)
.stream()
.anyMatch(ManaAbility.class::isInstance);
}
}

View file

@ -82,6 +82,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Lord of the Ulvenwald", 231, Rarity.UNCOMMON, mage.cards.l.LordOfTheUlvenwald.class));
cards.add(new SetCardInfo("Lunar Frenzy", 147, Rarity.UNCOMMON, mage.cards.l.LunarFrenzy.class));
cards.add(new SetCardInfo("Might of the Old Ways", 189, Rarity.COMMON, mage.cards.m.MightOfTheOldWays.class));
cards.add(new SetCardInfo("Moonsilver Key", 255, Rarity.UNCOMMON, mage.cards.m.MoonsilverKey.class));
cards.add(new SetCardInfo("Mountain", 274, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Neblegast Intruder", 64, Rarity.UNCOMMON, mage.cards.n.NeblegastIntruder.class));
cards.add(new SetCardInfo("Overgrown Farmland", 265, Rarity.RARE, mage.cards.o.OvergrownFarmland.class));