[CMM] Implement Sliver Gravemother

This commit is contained in:
theelk801 2023-05-07 09:54:25 -04:00
parent 5f22004ad3
commit 9b95faf0fe
2 changed files with 93 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));
}
}