[C21] Implemented Pest Infestation

This commit is contained in:
Evan Kranzler 2021-04-10 09:32:45 -04:00
parent dc39fcd5c0
commit b5864bb97c
2 changed files with 60 additions and 0 deletions

View file

@ -0,0 +1,59 @@
package mage.cards.p;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.MultipliedValue;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.token.WitherbloomToken;
import mage.target.TargetPermanent;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PestInfestation extends CardImpl {
private static final DynamicValue xValue = new MultipliedValue(ManacostVariableValue.instance, 2);
public PestInfestation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{X}{G}");
// Destroy up to X target artifacts and/or enchantments. Create twice X 1/1 black and green Pest creature tokens with "When this creature dies, you gain 1 life."
this.getSpellAbility().addEffect(new DestroyTargetEffect()
.setText("destroy up to X target artifacts and/or enchantments."));
this.getSpellAbility().addEffect(new CreateTokenEffect(new WitherbloomToken(), xValue)
.setText("Create twice X 1/1 black and green Pest creature tokens with \"When this creature dies, you gain 1 life.\""));
this.getSpellAbility().setTargetAdjuster(PestInfestationAdjuster.instance);
}
private PestInfestation(final PestInfestation card) {
super(card);
}
@Override
public PestInfestation copy() {
return new PestInfestation(this);
}
}
enum PestInfestationAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
ability.addTarget(new TargetPermanent(
0, ability.getManaCostsToPay().getX(),
StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT, false
));
}
}

View file

@ -159,6 +159,7 @@ public final class Commander2021Edition extends ExpansionSet {
cards.add(new SetCardInfo("Parasitic Impetus", 150, Rarity.UNCOMMON, mage.cards.p.ParasiticImpetus.class));
cards.add(new SetCardInfo("Pendant of Prosperity", 256, Rarity.RARE, mage.cards.p.PendantOfProsperity.class));
cards.add(new SetCardInfo("Perplexing Test", 30, Rarity.RARE, mage.cards.p.PerplexingTest.class));
cards.add(new SetCardInfo("Pest Infestation", 65, Rarity.RARE, mage.cards.p.PestInfestation.class));
cards.add(new SetCardInfo("Phyrexia's Core", 309, Rarity.UNCOMMON, mage.cards.p.PhyrexiasCore.class));
cards.add(new SetCardInfo("Pia Nalaar", 177, Rarity.RARE, mage.cards.p.PiaNalaar.class));
cards.add(new SetCardInfo("Pilgrim's Eye", 257, Rarity.COMMON, mage.cards.p.PilgrimsEye.class));