[STX] Implemented Containment Breach

This commit is contained in:
Evan Kranzler 2021-04-04 10:05:20 -04:00
parent 9a06c31aa2
commit ec4eead278
2 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,72 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.WitherbloomToken;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ContainmentBreach extends CardImpl {
public ContainmentBreach(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
this.subtype.add(SubType.LESSON);
// Destroy target artifact or enchantment. If its mana value is 2 or less, create a 1/1 black and green Pest creature token with "When this creature dies, you gain 1 life."
this.getSpellAbility().addEffect(new ContainmentBreachEffect());
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
}
private ContainmentBreach(final ContainmentBreach card) {
super(card);
}
@Override
public ContainmentBreach copy() {
return new ContainmentBreach(this);
}
}
class ContainmentBreachEffect extends OneShotEffect {
ContainmentBreachEffect() {
super(Outcome.Benefit);
staticText = "destroy target artifact or enchantment. If its mana value is 2 or less, " +
"create a 1/1 black and green Pest creature token with \"When this creature dies, you gain 1 life.\"";
}
private ContainmentBreachEffect(final ContainmentBreachEffect effect) {
super(effect);
}
@Override
public ContainmentBreachEffect copy() {
return new ContainmentBreachEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
permanent.destroy(source, game, false);
if (permanent.getConvertedManaCost() <= 2) {
new WitherbloomToken().putOntoBattlefield(1, game, source, source.getControllerId());
}
return true;
}
}

View file

@ -59,6 +59,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Cogwork Archivist", 254, Rarity.COMMON, mage.cards.c.CogworkArchivist.class));
cards.add(new SetCardInfo("Combat Professor", 11, Rarity.COMMON, mage.cards.c.CombatProfessor.class));
cards.add(new SetCardInfo("Confront the Past", 67, Rarity.RARE, mage.cards.c.ConfrontThePast.class));
cards.add(new SetCardInfo("Containment Breach", 125, Rarity.UNCOMMON, mage.cards.c.ContainmentBreach.class));
cards.add(new SetCardInfo("Crackle with Power", 95, Rarity.MYTHIC, mage.cards.c.CrackleWithPower.class));
cards.add(new SetCardInfo("Cram Session", 170, Rarity.COMMON, mage.cards.c.CramSession.class));
cards.add(new SetCardInfo("Creative Outburst", 171, Rarity.UNCOMMON, mage.cards.c.CreativeOutburst.class));