From 0c2d0a7a1757ef5c761c4413f8597ae7a8f13bcd Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 4 Sep 2020 16:47:23 -0400 Subject: [PATCH] [ZNR] Implemented Feed the Swarm --- Mage.Sets/src/mage/cards/f/FeedTheSwarm.java | 79 ++++++++++++++++++++ Mage.Sets/src/mage/sets/ZendikarRising.java | 1 + 2 files changed, 80 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FeedTheSwarm.java diff --git a/Mage.Sets/src/mage/cards/f/FeedTheSwarm.java b/Mage.Sets/src/mage/cards/f/FeedTheSwarm.java new file mode 100644 index 0000000000..32114c07d1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FeedTheSwarm.java @@ -0,0 +1,79 @@ +package mage.cards.f; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FeedTheSwarm extends CardImpl { + + private static final FilterPermanent filter + = new FilterPermanent("creature or enchantment an opponent controls"); + + static { + filter.add(Predicates.or( + CardType.ARTIFACT.getPredicate(), + CardType.ENCHANTMENT.getPredicate() + )); + } + + public FeedTheSwarm(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}"); + + // Destroy target creature or enchantment an opponent controls. You lose life equal to that permanent's converted mana cost. + this.getSpellAbility().addEffect(new FeedTheSwarmEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + } + + private FeedTheSwarm(final FeedTheSwarm card) { + super(card); + } + + @Override + public FeedTheSwarm copy() { + return new FeedTheSwarm(this); + } +} + +class FeedTheSwarmEffect extends OneShotEffect { + + FeedTheSwarmEffect() { + super(Outcome.Benefit); + staticText = "destroy target creature or enchantment an opponent controls. " + + "You lose life equal to that permanent's converted mana cost"; + } + + private FeedTheSwarmEffect(final FeedTheSwarmEffect effect) { + super(effect); + } + + @Override + public FeedTheSwarmEffect copy() { + return new FeedTheSwarmEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + Player player = game.getPlayer(source.getControllerId()); + if (permanent == null || player == null) { + return false; + } + player.loseLife(permanent.getConvertedManaCost(), game, false); + permanent.destroy(source.getSourceId(), game, false); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index 359e55ae4a..cf8ad7045c 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -104,6 +104,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Expedition Diviner", 57, Rarity.COMMON, mage.cards.e.ExpeditionDiviner.class)); cards.add(new SetCardInfo("Expedition Skulker", 101, Rarity.COMMON, mage.cards.e.ExpeditionSkulker.class)); cards.add(new SetCardInfo("Farsight Adept", 14, Rarity.COMMON, mage.cards.f.FarsightAdept.class)); + cards.add(new SetCardInfo("Feed the Swarm", 102, Rarity.COMMON, mage.cards.f.FeedTheSwarm.class)); cards.add(new SetCardInfo("Fissure Wizard", 140, Rarity.COMMON, mage.cards.f.FissureWizard.class)); cards.add(new SetCardInfo("Forest", 278, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Gnarlid Colony", 185, Rarity.COMMON, mage.cards.g.GnarlidColony.class));