diff --git a/Mage.Sets/src/mage/cards/s/SharedSummons.java b/Mage.Sets/src/mage/cards/s/SharedSummons.java new file mode 100644 index 0000000000..93105a6117 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SharedSummons.java @@ -0,0 +1,69 @@ +package mage.cards.s; + +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.constants.CardType; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SharedSummons extends CardImpl { + + public SharedSummons(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}{G}"); + + // Search your library for up to two creature cards with different names, reveal them, put them into your hand, then shuffle your library. + this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect( + new SharedSummonsTarget(), true, true + )); + } + + private SharedSummons(final SharedSummons card) { + super(card); + } + + @Override + public SharedSummons copy() { + return new SharedSummons(this); + } +} + +class SharedSummonsTarget extends TargetCardInLibrary { + + private static final FilterCard filter2 = new FilterCreatureCard("creature cards with different names"); + + SharedSummonsTarget() { + super(0, 4, filter2); + } + + private SharedSummonsTarget(final SharedSummonsTarget target) { + super(target); + } + + @Override + public SharedSummonsTarget copy() { + return new SharedSummonsTarget(this); + } + + @Override + public boolean canTarget(UUID id, Cards cards, Game game) { + Card card = cards.get(id, game); + if (card == null || !card.isCreature()) { + return false; + } + return !this + .getTargets() + .stream() + .map(uuid -> game.getCard(uuid)) + .anyMatch(c -> c != null && c.getName().equals(card.getName())); + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index c4d4798d7e..0265687e6c 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -120,6 +120,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Scholar of the Ages", 74, Rarity.UNCOMMON, mage.cards.s.ScholarOfTheAges.class)); cards.add(new SetCardInfo("Scoured Barrens", 251, Rarity.COMMON, mage.cards.s.ScouredBarrens.class)); cards.add(new SetCardInfo("Scuttlemutt", 238, Rarity.UNCOMMON, mage.cards.s.Scuttlemutt.class)); + cards.add(new SetCardInfo("Shared Summons", 193, Rarity.RARE, mage.cards.s.SharedSummons.class)); cards.add(new SetCardInfo("Silverback Shaman", 195, Rarity.COMMON, mage.cards.s.SilverbackShaman.class)); cards.add(new SetCardInfo("Sorin, Imperious Bloodlord", 115, Rarity.MYTHIC, mage.cards.s.SorinImperiousBloodlord.class)); cards.add(new SetCardInfo("Spectral Sailor", 76, Rarity.UNCOMMON, mage.cards.s.SpectralSailor.class));