From 139443971a0cc403e8f9fd4a1772a9159b58b28c Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Sat, 6 Nov 2021 08:46:11 -0500 Subject: [PATCH] [VOW] Implemented Diregraf Scavenger --- .../src/mage/cards/d/DiregrafScavenger.java | 91 +++++++++++++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 1 + 2 files changed, 92 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DiregrafScavenger.java diff --git a/Mage.Sets/src/mage/cards/d/DiregrafScavenger.java b/Mage.Sets/src/mage/cards/d/DiregrafScavenger.java new file mode 100644 index 0000000000..0e33df1cf2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DiregrafScavenger.java @@ -0,0 +1,91 @@ +package mage.cards.d; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.abilities.keyword.DeathtouchAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInGraveyard; + +/** + * + * @author weirddan455 + */ +public final class DiregrafScavenger extends CardImpl { + + public DiregrafScavenger(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); + + this.subtype.add(SubType.ZOMBIE); + this.subtype.add(SubType.BEAR); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Deathtouch + this.addAbility(DeathtouchAbility.getInstance()); + + // When Diregraf Scavenger enters the battlefield, exile up to one target card from a graveyard. If a creature card was exiled this way, each opponent loses 2 life and you gain 2 life. + Ability ability = new EntersBattlefieldTriggeredAbility(new DiregrafScavengerEffect()); + ability.addTarget(new TargetCardInGraveyard(0, 1)); + this.addAbility(ability); + } + + private DiregrafScavenger(final DiregrafScavenger card) { + super(card); + } + + @Override + public DiregrafScavenger copy() { + return new DiregrafScavenger(this); + } +} + +class DiregrafScavengerEffect extends OneShotEffect { + + public DiregrafScavengerEffect() { + super(Outcome.Exile); + staticText = "exile up to one target card from a graveyard. If a creature card was exiled this way, each opponent loses 2 life and you gain 2 life"; + } + + private DiregrafScavengerEffect(final DiregrafScavengerEffect effect) { + super(effect); + } + + @Override + public DiregrafScavengerEffect copy() { + return new DiregrafScavengerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Card targetCard = game.getCard(source.getFirstTarget()); + if (controller == null || targetCard == null) { + return false; + } + boolean creature = targetCard.isCreature(game); + if (!controller.moveCards(targetCard, Zone.EXILED, source, game)) { + return false; + } + if (creature) { + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(opponentId); + if (opponent != null) { + opponent.loseLife(2, game, source, false); + } + } + controller.gainLife(2, game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index 54af30b12d..6e40ef70a6 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -92,6 +92,7 @@ public final class InnistradCrimsonVow extends ExpansionSet { cards.add(new SetCardInfo("Desperate Farmer", 104, Rarity.COMMON, mage.cards.d.DesperateFarmer.class)); cards.add(new SetCardInfo("Dig Up", 197, Rarity.RARE, mage.cards.d.DigUp.class)); cards.add(new SetCardInfo("Dire-Strain Anarchist", 181, Rarity.MYTHIC, mage.cards.d.DireStrainAnarchist.class)); + cards.add(new SetCardInfo("Diregraf Scavenger", 105, Rarity.COMMON, mage.cards.d.DiregrafScavenger.class)); cards.add(new SetCardInfo("Distracting Geist", 9, Rarity.UNCOMMON, mage.cards.d.DistractingGeist.class)); cards.add(new SetCardInfo("Diver Skaab", 56, Rarity.UNCOMMON, mage.cards.d.DiverSkaab.class)); cards.add(new SetCardInfo("Dominating Vampire", 154, Rarity.RARE, mage.cards.d.DominatingVampire.class));