From bd67b7af2251215f7e51d2972837f92deef1ed9e Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Thu, 9 Sep 2021 15:37:01 -0500 Subject: [PATCH] [MID] Implemented Corpse Cobble --- Mage.Sets/src/mage/cards/c/CorpseCobble.java | 82 +++++++++++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 1 + .../permanent/token/ZombieMenaceToken.java | 29 +++++++ 3 files changed, 112 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CorpseCobble.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/ZombieMenaceToken.java diff --git a/Mage.Sets/src/mage/cards/c/CorpseCobble.java b/Mage.Sets/src/mage/cards/c/CorpseCobble.java new file mode 100644 index 00000000000..8cd490110b9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CorpseCobble.java @@ -0,0 +1,82 @@ +package mage.cards.c; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TimingRule; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.ZombieMenaceToken; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author weirddan455 + */ +public final class CorpseCobble extends CardImpl { + + private static final FilterControlledCreaturePermanent filter + = new FilterControlledCreaturePermanent("any number of creatures"); + + public CorpseCobble(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}{B}"); + + // As an additional cost to cast this spell, sacrifice any number of creatures. + this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true))); + + // Create an X/X blue and black Zombie creature token with menace, where X is the total power of the sacrificed creatures. + this.getSpellAbility().addEffect(new CorpseCobbleEffect()); + + // Flashback {3}{U}{B} + this.addAbility(new FlashbackAbility(new ManaCostsImpl<>("{3}{U}{B}"), TimingRule.INSTANT)); + } + + private CorpseCobble(final CorpseCobble card) { + super(card); + } + + @Override + public CorpseCobble copy() { + return new CorpseCobble(this); + } +} + +class CorpseCobbleEffect extends OneShotEffect { + + public CorpseCobbleEffect() { + super(Outcome.PutCreatureInPlay); + staticText = "Create an X/X blue and black Zombie creature token with menace, where X is the total power of the sacrificed creatures"; + } + + private CorpseCobbleEffect(final CorpseCobbleEffect effect) { + super(effect); + } + + @Override + public CorpseCobbleEffect copy() { + return new CorpseCobbleEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int xValue = 0; + for (Cost cost : source.getCosts()) { + if (cost instanceof SacrificeTargetCost) { + for (Permanent permanent : ((SacrificeTargetCost) cost).getPermanents()) { + xValue += permanent.getPower().getValue(); + } + } + } + return new ZombieMenaceToken(xValue).putOntoBattlefield(1, game, source, source.getControllerId()); + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index 39819f7c6e0..d77f3a9445a 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -50,6 +50,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Clear Shot", 176, Rarity.UNCOMMON, mage.cards.c.ClearShot.class)); cards.add(new SetCardInfo("Consider", 44, Rarity.COMMON, mage.cards.c.Consider.class)); cards.add(new SetCardInfo("Contortionist Troupe", 178, Rarity.UNCOMMON, mage.cards.c.ContortionistTroupe.class)); + cards.add(new SetCardInfo("Corpse Cobble", 214, Rarity.UNCOMMON, mage.cards.c.CorpseCobble.class)); cards.add(new SetCardInfo("Croaking Counterpart", 215, Rarity.RARE, mage.cards.c.CroakingCounterpart.class)); cards.add(new SetCardInfo("Curse of Shaken Faith", 134, Rarity.RARE, mage.cards.c.CurseOfShakenFaith.class)); cards.add(new SetCardInfo("Curse of Silence", 326, Rarity.RARE, mage.cards.c.CurseOfSilence.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/ZombieMenaceToken.java b/Mage/src/main/java/mage/game/permanent/token/ZombieMenaceToken.java new file mode 100644 index 00000000000..3ebca8811cf --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/ZombieMenaceToken.java @@ -0,0 +1,29 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.MenaceAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +public class ZombieMenaceToken extends TokenImpl { + + public ZombieMenaceToken(int xValue) { + super("Zombie", "X/X blue and black Zombie creature token with menace"); + cardType.add(CardType.CREATURE); + color.setBlue(true); + color.setBlack(true); + subtype.add(SubType.ZOMBIE); + power = new MageInt(xValue); + toughness = new MageInt(xValue); + addAbility(new MenaceAbility()); + } + + private ZombieMenaceToken(final ZombieMenaceToken token) { + super(token); + } + + @Override + public ZombieMenaceToken copy() { + return new ZombieMenaceToken(this); + } +}