From eef6160a4cc4c82860a34e21bdfde5d4500faaf4 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 9 Sep 2021 19:48:21 -0400 Subject: [PATCH] [MID] Implemented Ghoulcaller's Harvest --- .../src/mage/cards/g/GhoulcallersHarvest.java | 77 +++++++++++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 1 + 2 files changed, 78 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GhoulcallersHarvest.java diff --git a/Mage.Sets/src/mage/cards/g/GhoulcallersHarvest.java b/Mage.Sets/src/mage/cards/g/GhoulcallersHarvest.java new file mode 100644 index 00000000000..f33a3f72459 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GhoulcallersHarvest.java @@ -0,0 +1,77 @@ +package mage.cards.g; + +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TimingRule; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.token.ZombieDecayedToken; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GhoulcallersHarvest extends CardImpl { + + private static final Hint hint = new ValueHint( + "Half the number of creature cards in your graveyard", GhoulcallersHarvestValue.instance + ); + + public GhoulcallersHarvest(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{G}"); + + // Create X 2/2 black Zombie creature tokens with decayed, where X is half the number of creature cards in your graveyard, rounded up. + this.getSpellAbility().addEffect(new CreateTokenEffect( + new ZombieDecayedToken(), GhoulcallersHarvestValue.instance + ).setText("create X 2/2 black Zombie creature tokens with decayed, " + + "where X is half the number of creature cards in your graveyard, rounded up")); + this.getSpellAbility().addHint(hint); + + // Flashback {3}{B}{G} + this.addAbility(new FlashbackAbility(new ManaCostsImpl<>("{3}{B}{G}"), TimingRule.SORCERY)); + } + + private GhoulcallersHarvest(final GhoulcallersHarvest card) { + super(card); + } + + @Override + public GhoulcallersHarvest copy() { + return new GhoulcallersHarvest(this); + } +} + +enum GhoulcallersHarvestValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Player player = game.getPlayer(sourceAbility.getControllerId()); + if (player == null) { + return 0; + } + int amount = player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game); + return Math.floorDiv(amount, 2) + amount % 2; + } + + @Override + public GhoulcallersHarvestValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index 826d41cfe7a..5eac004ab6d 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -80,6 +80,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { 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("Galvanic Iteration", 224, Rarity.RARE, mage.cards.g.GalvanicIteration.class)); + cards.add(new SetCardInfo("Ghoulcaller's Harvest", 225, Rarity.RARE, mage.cards.g.GhoulcallersHarvest.class)); cards.add(new SetCardInfo("Grafted Identity", 57, Rarity.RARE, mage.cards.g.GraftedIdentity.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));