[STX] Implemented Pestilent Cauldron / Restorative Burst

This commit is contained in:
Evan Kranzler 2021-04-10 19:02:23 -04:00
parent 1264be8c36
commit ee027c0d73
2 changed files with 127 additions and 0 deletions

View file

@ -0,0 +1,126 @@
package mage.cards.p;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.ControllerGotLifeCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.*;
import mage.cards.CardSetInfo;
import mage.cards.ModalDoubleFacesCard;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.game.permanent.token.WitherbloomToken;
import mage.players.Player;
import mage.target.common.TargetCardInASingleGraveyard;
import mage.target.common.TargetCardInYourGraveyard;
import mage.watchers.common.PlayerGainedLifeWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PestilentCauldron extends ModalDoubleFacesCard {
private static final FilterCard filter
= new FilterCard("creature, land, and/or planeswalker cards from your graveyard");
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.LAND.getPredicate(),
CardType.PLANESWALKER.getPredicate()
));
}
public PestilentCauldron(UUID ownerId, CardSetInfo setInfo) {
super(
ownerId, setInfo,
new CardType[]{CardType.ARTIFACT}, new SubType[]{}, "{2}{B}",
"Restorative Burst",
new CardType[]{CardType.ARTIFACT}, new SubType[]{}, "{3}{G}{G}"
);
// 1.
// Pestilent Cauldron
// Artifact
// {T}, Discard a card: Create a 1/1 black and green Pest creature token with "When this creature dies, you gain 1 life."
Ability ability = new SimpleActivatedAbility(
new CreateTokenEffect(new WitherbloomToken()), new TapSourceCost()
);
ability.addCost(new DiscardCardCost());
this.getLeftHalfCard().addAbility(ability);
// {1}, {T}: Each opponent mills cards equal to the amount of life you gained this turn.
ability = new SimpleActivatedAbility(new MillCardsEachPlayerEffect(
ControllerGotLifeCount.instance, TargetController.OPPONENT
).setText("each opponent mills cards equal to the amount of life you gained this turn"), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
ability.addWatcher(new PlayerGainedLifeWatcher());
this.getLeftHalfCard().addAbility(ability.addHint(ControllerGotLifeCount.getHint()));
// {4}, {T}: Exile four target cards from a single graveyard. Draw a card.
ability = new SimpleActivatedAbility(new ExileTargetEffect(), new GenericManaCost(4));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCardInASingleGraveyard(
0, 4, StaticFilters.FILTER_CARD_CARDS
));
ability.addEffect(new DrawCardSourceControllerEffect(1));
this.getLeftHalfCard().addAbility(ability);
// 2.
// Restorative Burst
// Sorcery
// Return up to two target creature, land, and/or planeswalker cards from your graveyard to your hand. Each player gains 4 life. Exile Restorative Burst.
this.getRightHalfCard().getSpellAbility().addEffect(new ReturnFromGraveyardToHandTargetEffect());
this.getRightHalfCard().getSpellAbility().addEffect(new RestorativeBurstEffect());
this.getRightHalfCard().getSpellAbility().addEffect(ExileSpellEffect.getInstance());
this.getRightHalfCard().getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, 2, filter));
}
private PestilentCauldron(final PestilentCauldron card) {
super(card);
}
@Override
public PestilentCauldron copy() {
return new PestilentCauldron(this);
}
}
class RestorativeBurstEffect extends OneShotEffect {
RestorativeBurstEffect() {
super(Outcome.GainLife);
staticText = "Each player gains 4 life.";
}
private RestorativeBurstEffect(final RestorativeBurstEffect effect) {
super(effect);
}
@Override
public RestorativeBurstEffect copy() {
return new RestorativeBurstEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.gainLife(4, game, source);
}
}
return true;
}
}

View file

@ -184,6 +184,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Overgrown Arch", 139, Rarity.UNCOMMON, mage.cards.o.OvergrownArch.class));
cards.add(new SetCardInfo("Owlin Shieldmage", 210, Rarity.COMMON, mage.cards.o.OwlinShieldmage.class));
cards.add(new SetCardInfo("Pest Summoning", 211, Rarity.COMMON, mage.cards.p.PestSummoning.class));
cards.add(new SetCardInfo("Pestilent Cauldron", 154, Rarity.RARE, mage.cards.p.PestilentCauldron.class));
cards.add(new SetCardInfo("Pigment Storm", 111, Rarity.COMMON, mage.cards.p.PigmentStorm.class));
cards.add(new SetCardInfo("Pilgrim of the Ages", 22, Rarity.COMMON, mage.cards.p.PilgrimOfTheAges.class));
cards.add(new SetCardInfo("Pillardrop Rescuer", 23, Rarity.COMMON, mage.cards.p.PillardropRescuer.class));