[SNC] Implemented Patch Up

This commit is contained in:
Evan Kranzler 2022-04-14 22:40:36 -04:00
parent b36b47dc0b
commit 6fd4615ede
2 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,76 @@
package mage.cards.p;
import mage.abilities.Ability;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PatchUp extends CardImpl {
public PatchUp(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}");
// Return up to three target creature cards with total mana value 3 or less from your graveyard to the battlefield.
this.getSpellAbility().addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect());
this.getSpellAbility().addTarget(new PatchUpTarget());
}
private PatchUp(final PatchUp card) {
super(card);
}
@Override
public PatchUp copy() {
return new PatchUp(this);
}
}
class PatchUpTarget extends TargetCardInYourGraveyard {
private static final FilterCard filter
= new FilterCreatureCard("creature cards with total mana value 3 or less from your graveyard");
static {
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 4));
}
PatchUpTarget() {
super(0, 2, filter, false);
}
private PatchUpTarget(final PatchUpTarget target) {
super(target);
}
@Override
public PatchUpTarget copy() {
return new PatchUpTarget(this);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (!super.canTarget(controllerId, id, source, game)) {
return false;
}
Card card = game.getCard(id);
return card != null &&
this.getTargets()
.stream()
.map(game::getCard)
.mapToInt(Card::getManaValue)
.sum() + card.getManaValue() <= 3;
}
}

View file

@ -130,6 +130,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
cards.add(new SetCardInfo("Obscura Storefront", 252, Rarity.COMMON, mage.cards.o.ObscuraStorefront.class));
cards.add(new SetCardInfo("Ognis, the Dragon's Lash", 210, Rarity.RARE, mage.cards.o.OgnisTheDragonsLash.class));
cards.add(new SetCardInfo("Out of the Way", 52, Rarity.UNCOMMON, mage.cards.o.OutOfTheWay.class));
cards.add(new SetCardInfo("Patch Up", 23, Rarity.UNCOMMON, mage.cards.p.PatchUp.class));
cards.add(new SetCardInfo("Plains", 262, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Plasma Jockey", 115, Rarity.COMMON, mage.cards.p.PlasmaJockey.class));
cards.add(new SetCardInfo("Professional Face-Breaker", 116, Rarity.RARE, mage.cards.p.ProfessionalFaceBreaker.class));