From de0b115151968e49370f2b9fcd002682aa69c6e7 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 4 Sep 2020 11:01:59 -0400 Subject: [PATCH] [ZNR] Implemented Thwart the Grave --- .../src/mage/cards/t/ThwartTheGrave.java | 84 +++++++++++++++++++ Mage.Sets/src/mage/sets/ZendikarRising.java | 1 + 2 files changed, 85 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/ThwartTheGrave.java diff --git a/Mage.Sets/src/mage/cards/t/ThwartTheGrave.java b/Mage.Sets/src/mage/cards/t/ThwartTheGrave.java new file mode 100644 index 0000000000..218c0d2607 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/ThwartTheGrave.java @@ -0,0 +1,84 @@ +package mage.cards.t; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.PartyCount; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; +import mage.abilities.effects.common.cost.SpellCostReductionForEachSourceEffect; +import mage.abilities.hint.common.PartyCountHint; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.Set; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ThwartTheGrave extends CardImpl { + + public ThwartTheGrave(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}{B}"); + + // This spell costs {1} less to cast for each creature in your party. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, new SpellCostReductionForEachSourceEffect(1, PartyCount.instance) + ).addHint(PartyCountHint.instance)); + + // Return target creature card and up to one target Cleric, Rogue, Warrior, or Wizard creature card from your graveyard to the battlefield. + this.getSpellAbility().addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect().setText("Return target creature card and up to one target Cleric, Rogue, Warrior, or Wizard creature card from your graveyard to the battlefield.")); + this.getSpellAbility().addTarget(new ThwartTheGraveTarget()); + } + + private ThwartTheGrave(final ThwartTheGrave card) { + super(card); + } + + @Override + public ThwartTheGrave copy() { + return new ThwartTheGrave(this); + } +} + +class ThwartTheGraveTarget extends TargetCardInYourGraveyard { + + private static final FilterCard filter = new FilterCreatureCard( + "creature card and up to one target Cleric, Rogue, Warrior, or Wizard creature card from your graveyard" + ); + + ThwartTheGraveTarget() { + super(1, 2, filter, false); + } + + private ThwartTheGraveTarget(final ThwartTheGraveTarget target) { + super(target); + } + + @Override + public ThwartTheGraveTarget copy() { + return new ThwartTheGraveTarget(this); + } + + @Override + public Set possibleTargets(UUID sourceId, UUID playerId, Game game) { + Set possibleTargets = super.possibleTargets(sourceId, playerId, game); + if (!this.getTargets().isEmpty()) { + possibleTargets.removeIf(uuid -> { + Card card = game.getCard(uuid); + return card != null + && !card.hasSubtype(SubType.CLERIC, game) + && !card.hasSubtype(SubType.ROGUE, game) + && !card.hasSubtype(SubType.WARRIOR, game) + && !card.hasSubtype(SubType.WIZARD, game); + }); + } + return possibleTargets; + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index c665b547fe..d692540244 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -155,6 +155,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Tangled Vale", 211, Rarity.UNCOMMON, mage.cards.t.TangledVale.class)); cards.add(new SetCardInfo("Taunting Arbormage", 212, Rarity.UNCOMMON, mage.cards.t.TauntingArbormage.class)); cards.add(new SetCardInfo("Tazri, Beacon of Unity", 44, Rarity.MYTHIC, mage.cards.t.TazriBeaconOfUnity.class)); + cards.add(new SetCardInfo("Thwart the Grave", 130, Rarity.UNCOMMON, mage.cards.t.ThwartTheGrave.class)); cards.add(new SetCardInfo("Timbercrown Pathway", 261, Rarity.RARE, mage.cards.t.TimbercrownPathway.class)); cards.add(new SetCardInfo("Umara Mystic", 238, Rarity.UNCOMMON, mage.cards.u.UmaraMystic.class)); cards.add(new SetCardInfo("Umara Skyfalls", 86, Rarity.UNCOMMON, mage.cards.u.UmaraSkyfalls.class));