[BRO] Implemented Demolition Field

This commit is contained in:
Daniel Bomar 2022-11-05 12:25:01 -05:00
parent 74dfbc053d
commit bd8612d25d
No known key found for this signature in database
GPG key ID: C86C8658F4023918
3 changed files with 84 additions and 1 deletions

View file

@ -0,0 +1,71 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayTargetControllerEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetLandPermanent;
/**
*
* @author weirddan455
*/
public final class DemolitionField extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic land an opponent controls");
static {
filter.add(TargetController.OPPONENT.getControllerPredicate());
filter.add(Predicates.not(SuperType.BASIC.getPredicate()));
}
public DemolitionField(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {2}, {T}, Sacrifice Demolition Field: Destroy target nonbasic land an opponent controls.
// That land's controller may search their library for a basic land card, put it onto the battlefield, then shuffle.
// You may search your library for a basic land card, put it onto the battlefield, then shuffle.
Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect(), new GenericManaCost(2));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addEffect(new SearchLibraryPutInPlayTargetControllerEffect(
new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND_A),
false, Outcome.PutLandInPlay, "that land's controller"
));
ability.addEffect(new SearchLibraryPutInPlayEffect(
new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND_A),
false, true, true, Outcome.PutLandInPlay
));
ability.addTarget(new TargetLandPermanent(filter));
this.addAbility(ability);
}
private DemolitionField(final DemolitionField card) {
super(card);
}
@Override
public DemolitionField copy() {
return new DemolitionField(this);
}
}

View file

@ -79,6 +79,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Curate", 44, Rarity.COMMON, mage.cards.c.Curate.class)); cards.add(new SetCardInfo("Curate", 44, Rarity.COMMON, mage.cards.c.Curate.class));
cards.add(new SetCardInfo("Deadly Riposte", 5, Rarity.COMMON, mage.cards.d.DeadlyRiposte.class)); cards.add(new SetCardInfo("Deadly Riposte", 5, Rarity.COMMON, mage.cards.d.DeadlyRiposte.class));
cards.add(new SetCardInfo("Defabricate", 45, Rarity.UNCOMMON, mage.cards.d.Defabricate.class)); cards.add(new SetCardInfo("Defabricate", 45, Rarity.UNCOMMON, mage.cards.d.Defabricate.class));
cards.add(new SetCardInfo("Demolition Field", 260, Rarity.UNCOMMON, mage.cards.d.DemolitionField.class));
cards.add(new SetCardInfo("Depth Charge Colossus", 78, Rarity.COMMON, mage.cards.d.DepthChargeColossus.class)); cards.add(new SetCardInfo("Depth Charge Colossus", 78, Rarity.COMMON, mage.cards.d.DepthChargeColossus.class));
cards.add(new SetCardInfo("Desynchronize", 46, Rarity.COMMON, mage.cards.d.Desynchronize.class)); cards.add(new SetCardInfo("Desynchronize", 46, Rarity.COMMON, mage.cards.d.Desynchronize.class));
cards.add(new SetCardInfo("Diabolic Intent", 89, Rarity.RARE, mage.cards.d.DiabolicIntent.class)); cards.add(new SetCardInfo("Diabolic Intent", 89, Rarity.RARE, mage.cards.d.DiabolicIntent.class));

View file

@ -19,6 +19,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect {
protected boolean tapped; protected boolean tapped;
protected boolean forceShuffle; protected boolean forceShuffle;
protected boolean optional;
public SearchLibraryPutInPlayEffect(TargetCardInLibrary target) { public SearchLibraryPutInPlayEffect(TargetCardInLibrary target) {
this(target, false, true, Outcome.PutCardInPlay); this(target, false, true, Outcome.PutCardInPlay);
@ -37,10 +38,16 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect {
} }
public SearchLibraryPutInPlayEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle, Outcome outcome) { public SearchLibraryPutInPlayEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle, Outcome outcome) {
this(target, tapped, forceShuffle, false, outcome);
}
public SearchLibraryPutInPlayEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle, boolean optional, Outcome outcome) {
super(target, outcome); super(target, outcome);
this.tapped = tapped; this.tapped = tapped;
this.forceShuffle = forceShuffle; this.forceShuffle = forceShuffle;
staticText = "search your library for " this.optional = optional;
staticText = (optional ? "you may " : "")
+ "search your library for "
+ target.getDescription() + target.getDescription()
+ (forceShuffle ? ", " : " and ") + (forceShuffle ? ", " : " and ")
+ (target.getMaxNumberOfTargets() > 1 ? "put them onto the battlefield" : "put it onto the battlefield") + (target.getMaxNumberOfTargets() > 1 ? "put them onto the battlefield" : "put it onto the battlefield")
@ -52,6 +59,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect {
super(effect); super(effect);
this.tapped = effect.tapped; this.tapped = effect.tapped;
this.forceShuffle = effect.forceShuffle; this.forceShuffle = effect.forceShuffle;
this.optional = effect.optional;
} }
@Override @Override
@ -65,6 +73,9 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect {
if (player == null) { if (player == null) {
return false; return false;
} }
if (optional && !player.chooseUse(outcome, "Search your library for " + target.getDescription() + '?', source, game)) {
return true;
}
if (player.searchLibrary(target, source, game)) { if (player.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) { if (!target.getTargets().isEmpty()) {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game), player.moveCards(new CardsImpl(target.getTargets()).getCards(game),