diff --git a/Mage.Sets/src/mage/cards/s/SecretsOfTheMausoleum.java b/Mage.Sets/src/mage/cards/s/SecretsOfTheMausoleum.java new file mode 100644 index 0000000000..fe8f5c1ee7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SecretsOfTheMausoleum.java @@ -0,0 +1,75 @@ +package mage.cards.s; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.Outcome; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author TheElk801 + */ +public final class SecretsOfTheMausoleum extends CardImpl { + + public SecretsOfTheMausoleum(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}"); + + // Undergrowth — Search your library for a black card with converted mana cost equal to or less than the number of creature cards in your graveyard, reveal it, put it into your hand, then shuffle your library. + this.getSpellAbility().addEffect(new SecretsOfTheMausoleumEffect()); + } + + public SecretsOfTheMausoleum(final SecretsOfTheMausoleum card) { + super(card); + } + + @Override + public SecretsOfTheMausoleum copy() { + return new SecretsOfTheMausoleum(this); + } +} + +class SecretsOfTheMausoleumEffect extends OneShotEffect { + + public SecretsOfTheMausoleumEffect() { + super(Outcome.Benefit); + this.staticText = "Undergrowth — Search your library " + + "for a black card with converted mana cost less than " + + "or equal to the number of creature cards in your graveyard, " + + "reveal it, put it into your hand, then shuffle your library."; + } + + public SecretsOfTheMausoleumEffect(final SecretsOfTheMausoleumEffect effect) { + super(effect); + } + + @Override + public SecretsOfTheMausoleumEffect copy() { + return new SecretsOfTheMausoleumEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int critterCount = player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game); + FilterCard filter = new FilterCard("a black card with converted mana cost less than or equal to " + critterCount); + filter.add(new ColorPredicate(ObjectColor.BLACK)); + filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, critterCount + 1)); + return new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java index c4c08f1fe4..b0918620b7 100644 --- a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java +++ b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java @@ -87,6 +87,7 @@ public final class GuildsOfRavnica extends ExpansionSet { cards.add(new SetCardInfo("Rosemane Centaur", 197, Rarity.COMMON, mage.cards.r.RosemaneCentaur.class)); cards.add(new SetCardInfo("Runaway Steam-Kin", 115, Rarity.RARE, mage.cards.r.RunawaySteamKin.class)); cards.add(new SetCardInfo("Sacred Foundry", 254, Rarity.RARE, mage.cards.s.SacredFoundry.class)); + cards.add(new SetCardInfo("Secrets of the Mausoleum", 75, Rarity.RARE, mage.cards.s.SecretsOfTheMausoleum.class)); cards.add(new SetCardInfo("Selesnya Guildgate", 255, Rarity.COMMON, mage.cards.s.SelesnyaGuildgate.class)); cards.add(new SetCardInfo("Selesnya Guildgate", 256, Rarity.COMMON, mage.cards.s.SelesnyaGuildgate.class)); cards.add(new SetCardInfo("Sinister Sabotage", 54, Rarity.UNCOMMON, mage.cards.s.SinisterSabotage.class));