From 9b95faf0febd5bf85c9b8ba2d8ff1c7aeb31ba17 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sun, 7 May 2023 09:54:25 -0400 Subject: [PATCH] [CMM] Implement Sliver Gravemother --- .../src/mage/cards/s/SliverGravemother.java | 92 +++++++++++++++++++ Mage.Sets/src/mage/sets/CommanderMasters.java | 1 + 2 files changed, 93 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SliverGravemother.java diff --git a/Mage.Sets/src/mage/cards/s/SliverGravemother.java b/Mage.Sets/src/mage/cards/s/SliverGravemother.java new file mode 100644 index 0000000000..fecceb1eae --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SliverGravemother.java @@ -0,0 +1,92 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.ruleModifying.LegendRuleDoesntApplyEffect; +import mage.abilities.keyword.EncoreAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SliverGravemother extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.SLIVER, "Slivers you control"); + + public SliverGravemother(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}{R}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.SLIVER); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // The "legend rule" doesn't apply to Slivers you control. + this.addAbility(new SimpleStaticAbility(new LegendRuleDoesntApplyEffect(filter))); + + // Each Sliver creature card in your graveyard has encore {X}, where X is its mana value. + this.addAbility(new SimpleStaticAbility(new SliverGravemotherEffect())); + + // Encore {5} + this.addAbility(new EncoreAbility(new ManaCostsImpl<>("{5}"))); + } + + private SliverGravemother(final SliverGravemother card) { + super(card); + } + + @Override + public SliverGravemother copy() { + return new SliverGravemother(this); + } +} + +class SliverGravemotherEffect extends ContinuousEffectImpl { + + private static final FilterCard filter = new FilterCreatureCard(); + + static { + filter.add(SubType.SLIVER.getPredicate()); + } + + public SliverGravemotherEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); + this.staticText = "each Sliver creature card in your graveyard has encore {X}, where X is its mana value"; + } + + public SliverGravemotherEffect(final SliverGravemotherEffect effect) { + super(effect); + } + + @Override + public SliverGravemotherEffect copy() { + return new SliverGravemotherEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + for (Card card : player.getGraveyard().getCards(filter, game)) { + game.getState().addOtherAbility(card, new EncoreAbility(new GenericManaCost(card.getManaValue()))); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderMasters.java b/Mage.Sets/src/mage/sets/CommanderMasters.java index a0d5eb829f..50a934c746 100644 --- a/Mage.Sets/src/mage/sets/CommanderMasters.java +++ b/Mage.Sets/src/mage/sets/CommanderMasters.java @@ -23,6 +23,7 @@ public final class CommanderMasters extends ExpansionSet { cards.add(new SetCardInfo("Jeweled Lotus", 396, Rarity.MYTHIC, mage.cards.j.JeweledLotus.class)); cards.add(new SetCardInfo("Personal Tutor", 110, Rarity.RARE, mage.cards.p.PersonalTutor.class)); cards.add(new SetCardInfo("Selvala, Heart of the Wilds", 220, Rarity.MYTHIC, mage.cards.s.SelvalaHeartOfTheWilds.class)); + cards.add(new SetCardInfo("Sliver Gravemother", 707, Rarity.MYTHIC, mage.cards.s.SliverGravemother.class)); cards.add(new SetCardInfo("The Ur-Dragon", 361, Rarity.MYTHIC, mage.cards.t.TheUrDragon.class)); } } \ No newline at end of file