From 09d8ee3dcef0634cc9c708126bfe6607fef7bed8 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 5 Sep 2021 07:22:01 -0400 Subject: [PATCH] [MID] Implemented Graveyard Trespasser / Graveyard Glutton --- .../src/mage/cards/g/GraveyardGlutton.java | 100 +++++++++++++++++ .../src/mage/cards/g/GraveyardTrespasser.java | 102 ++++++++++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 2 + 3 files changed, 204 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GraveyardGlutton.java create mode 100644 Mage.Sets/src/mage/cards/g/GraveyardTrespasser.java diff --git a/Mage.Sets/src/mage/cards/g/GraveyardGlutton.java b/Mage.Sets/src/mage/cards/g/GraveyardGlutton.java new file mode 100644 index 0000000000..9e700d816c --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GraveyardGlutton.java @@ -0,0 +1,100 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; +import mage.abilities.costs.common.DiscardCardCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.NightboundAbility; +import mage.abilities.keyword.WardAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GraveyardGlutton extends CardImpl { + + public GraveyardGlutton(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, ""); + + this.subtype.add(SubType.WEREWOLF); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + this.color.setBlack(true); + this.nightCard = true; + this.transformable = true; + + // Ward—Discard a card. + this.addAbility(new WardAbility(new DiscardCardCost())); + + // Whenever Graveyard Glutton enters the battlefield or attacks, exile up to two target cards from graveyards. For each creature card exiled this way, each opponent loses 1 life and you gain 1 life. + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new GraveyardGluttonEffect()); + ability.addTarget(new TargetCardInGraveyard(0, 2)); + this.addAbility(ability); + + // Nightbound + this.addAbility(NightboundAbility.getInstance()); + } + + private GraveyardGlutton(final GraveyardGlutton card) { + super(card); + } + + @Override + public GraveyardGlutton copy() { + return new GraveyardGlutton(this); + } +} + +class GraveyardGluttonEffect extends OneShotEffect { + + GraveyardGluttonEffect() { + super(Outcome.Benefit); + staticText = "exile up to two target cards from graveyards. " + + "For each creature card exiled this way, each opponent loses 1 life and you gain 1 life"; + } + + private GraveyardGluttonEffect(final GraveyardGluttonEffect effect) { + super(effect); + } + + @Override + public GraveyardGluttonEffect copy() { + return new GraveyardGluttonEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source)); + if (player == null || cards.isEmpty()) { + return false; + } + player.moveCards(cards, Zone.EXILED, source, game); + int amount = cards.count(StaticFilters.FILTER_CARD_CREATURE, game); + if (amount < 1) { + return true; + } + player.gainLife(amount, game, source); + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(opponentId); + if (opponent != null) { + opponent.loseLife(amount, game, source, false); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/g/GraveyardTrespasser.java b/Mage.Sets/src/mage/cards/g/GraveyardTrespasser.java new file mode 100644 index 0000000000..f74e5125d3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GraveyardTrespasser.java @@ -0,0 +1,102 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; +import mage.abilities.costs.common.DiscardCardCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.DayboundAbility; +import mage.abilities.keyword.TransformAbility; +import mage.abilities.keyword.WardAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GraveyardTrespasser extends CardImpl { + + public GraveyardTrespasser(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WEREWOLF); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + this.transformable = true; + this.secondSideCardClazz = mage.cards.g.GraveyardGlutton.class; + + // Ward—Discard a card. + this.addAbility(new WardAbility(new DiscardCardCost())); + + // Whenever Graveyard Trespasser enters the battlefield or attacks, exile up to one target card from a graveyard. If a creature card was exiled this way, each opponent loses 1 life and you gain 1 life. + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new GraveyardTrespasserEffect()); + ability.addTarget(new TargetCardInGraveyard(0, 1)); + this.addAbility(ability); + + // Daybound + this.addAbility(new TransformAbility()); + this.addAbility(DayboundAbility.getInstance()); + } + + private GraveyardTrespasser(final GraveyardTrespasser card) { + super(card); + } + + @Override + public GraveyardTrespasser copy() { + return new GraveyardTrespasser(this); + } +} + +class GraveyardTrespasserEffect extends OneShotEffect { + + GraveyardTrespasserEffect() { + super(Outcome.Benefit); + staticText = "exile up to one target card from a graveyard. " + + "If a creature card was exiled this way, each opponent loses 1 life and you gain 1 life"; + } + + private GraveyardTrespasserEffect(final GraveyardTrespasserEffect effect) { + super(effect); + } + + @Override + public GraveyardTrespasserEffect copy() { + return new GraveyardTrespasserEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source)); + if (player == null || cards.isEmpty()) { + return false; + } + player.moveCards(cards, Zone.EXILED, source, game); + int amount = cards.count(StaticFilters.FILTER_CARD_CREATURE, game); + if (amount < 1) { + return true; + } + player.gainLife(amount, game, source); + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(opponentId); + if (opponent != null) { + opponent.loseLife(amount, game, source, false); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index cd5825f35a..50e45c0960 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -47,6 +47,8 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Festival Crasher", 140, Rarity.COMMON, mage.cards.f.FestivalCrasher.class)); cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Foul Play", 101, Rarity.UNCOMMON, mage.cards.f.FoulPlay.class)); + cards.add(new SetCardInfo("Graveyard Glutton", 104, Rarity.RARE, mage.cards.g.GraveyardGlutton.class)); + cards.add(new SetCardInfo("Graveyard Trespasser", 104, Rarity.RARE, mage.cards.g.GraveyardTrespasser.class)); cards.add(new SetCardInfo("Haunted Ridge", 263, Rarity.RARE, mage.cards.h.HauntedRidge.class)); cards.add(new SetCardInfo("Hobbling Zombie", 106, Rarity.COMMON, mage.cards.h.HobblingZombie.class)); cards.add(new SetCardInfo("Howl of the Hunt", 188, Rarity.COMMON, mage.cards.h.HowlOfTheHunt.class));