[SNC] Implemented Rogues' Gallery

This commit is contained in:
Evan Kranzler 2022-04-14 20:09:12 -04:00
parent d54485e4af
commit 65cbc55972
2 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,90 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.ColorAssignment;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.cards.*;
import mage.constants.CardType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorlessPredicate;
import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RoguesGallery extends CardImpl {
public RoguesGallery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}");
// For each color, return up to one target creature card of that color from your graveyard to your hand.
this.getSpellAbility().addEffect(new ReturnFromGraveyardToHandTargetEffect()
.setText("for each color, return up to one target creature card " +
"of that color from your graveyard to your hand"));
this.getSpellAbility().addTarget(new RoguesGalleryTarget());
}
private RoguesGallery(final RoguesGallery card) {
super(card);
}
@Override
public RoguesGallery copy() {
return new RoguesGallery(this);
}
}
class RoguesGalleryTarget extends TargetCardInYourGraveyard {
private static final ColorAssignment colorAssigner = new ColorAssignment("W", "U", "B", "R", "G");
private static final FilterCard filter = new FilterCreatureCard("a creature card of each color");
static {
filter.add(Predicates.not(ColorlessPredicate.instance));
}
RoguesGalleryTarget() {
super(0, Integer.MAX_VALUE, filter, true);
}
private RoguesGalleryTarget(final RoguesGalleryTarget target) {
super(target);
}
@Override
public RoguesGalleryTarget copy() {
return new RoguesGalleryTarget(this);
}
@Override
public boolean canTarget(UUID playerId, UUID id, Ability ability, Game game) {
if (!super.canTarget(playerId, id, ability, game)) {
return false;
}
Card card = game.getCard(id);
if (card == null) {
return false;
}
if (this.getTargets().isEmpty()) {
return true;
}
Cards cards = new CardsImpl(this.getTargets());
cards.add(card);
return colorAssigner.getRoleCount(cards, game) >= cards.size();
}
@Override
public Set<UUID> possibleTargets(UUID sourceControllerId, Ability source, Game game) {
Set<UUID> possibleTargets = super.possibleTargets(sourceControllerId, source, game);
possibleTargets.removeIf(uuid -> !this.canTarget(sourceControllerId, uuid, null, game));
return possibleTargets;
}
}

View file

@ -146,6 +146,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
cards.add(new SetCardInfo("Riveteers Initiate", 120, Rarity.COMMON, mage.cards.r.RiveteersInitiate.class)); cards.add(new SetCardInfo("Riveteers Initiate", 120, Rarity.COMMON, mage.cards.r.RiveteersInitiate.class));
cards.add(new SetCardInfo("Rob the Archives", 122, Rarity.UNCOMMON, mage.cards.r.RobTheArchives.class)); cards.add(new SetCardInfo("Rob the Archives", 122, Rarity.UNCOMMON, mage.cards.r.RobTheArchives.class));
cards.add(new SetCardInfo("Rocco, Cabaretti Caterer", 218, Rarity.UNCOMMON, mage.cards.r.RoccoCabarettiCaterer.class)); cards.add(new SetCardInfo("Rocco, Cabaretti Caterer", 218, Rarity.UNCOMMON, mage.cards.r.RoccoCabarettiCaterer.class));
cards.add(new SetCardInfo("Rogues' Gallery", 92, Rarity.UNCOMMON, mage.cards.r.RoguesGallery.class));
cards.add(new SetCardInfo("Rooftop Nuisance", 57, Rarity.COMMON, mage.cards.r.RooftopNuisance.class)); cards.add(new SetCardInfo("Rooftop Nuisance", 57, Rarity.COMMON, mage.cards.r.RooftopNuisance.class));
cards.add(new SetCardInfo("Rumor Gatherer", 29, Rarity.UNCOMMON, mage.cards.r.RumorGatherer.class)); cards.add(new SetCardInfo("Rumor Gatherer", 29, Rarity.UNCOMMON, mage.cards.r.RumorGatherer.class));
cards.add(new SetCardInfo("Security Bypass", 59, Rarity.COMMON, mage.cards.s.SecurityBypass.class)); cards.add(new SetCardInfo("Security Bypass", 59, Rarity.COMMON, mage.cards.s.SecurityBypass.class));