[LTR] Implement Ringsight

This commit is contained in:
theelk801 2023-06-01 08:19:15 -04:00
parent 0073389511
commit 041ca734ac
2 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,72 @@
package mage.cards.r;
import mage.ObjectColor;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.abilities.effects.keyword.TheRingTemptsYouEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Ringsight extends CardImpl {
private static final FilterCard filter
= new FilterCard("card that shares a color with a legendary creature you control");
static {
filter.add(RingsightPredicate.instance);
}
public Ringsight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}{B}");
// The Ring tempts you. Search your library for a card that shares a color with a legendary creature you control, reveal it, put it into your hand, then shuffle.
this.getSpellAbility().addEffect(new TheRingTemptsYouEffect());
this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect(
new TargetCardInLibrary(filter), true
));
}
private Ringsight(final Ringsight card) {
super(card);
}
@Override
public Ringsight copy() {
return new Ringsight(this);
}
}
enum RingsightPredicate implements ObjectSourcePlayerPredicate<Card> {
instance;
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(SuperType.LEGENDARY.getPredicate());
}
@Override
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
ObjectColor color = input.getObject().getColor(game);
return color
.hasColor()
&& game
.getBattlefield()
.getActivePermanents(filter, input.getPlayerId(), input.getSource(), game)
.stream()
.anyMatch(permanent -> permanent.isCreature(game) && permanent.getColor(game).shares(color));
}
}

View file

@ -59,6 +59,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
cards.add(new SetCardInfo("Protector of Gondor", 25, Rarity.COMMON, mage.cards.p.ProtectorOfGondor.class));
cards.add(new SetCardInfo("Quickbeam, Upstart Ent", 183, Rarity.UNCOMMON, mage.cards.q.QuickbeamUpstartEnt.class));
cards.add(new SetCardInfo("Reprieve", 26, Rarity.UNCOMMON, mage.cards.r.Reprieve.class));
cards.add(new SetCardInfo("Ringsight", 220, Rarity.UNCOMMON, mage.cards.r.Ringsight.class));
cards.add(new SetCardInfo("Rising of the Day", 145, Rarity.UNCOMMON, mage.cards.r.RisingOfTheDay.class));
cards.add(new SetCardInfo("Samwise Gamgee", 222, Rarity.RARE, mage.cards.s.SamwiseGamgee.class));
cards.add(new SetCardInfo("Samwise the Stouthearted", 28, Rarity.UNCOMMON, mage.cards.s.SamwiseTheStouthearted.class));