diff --git a/Mage.Sets/src/mage/cards/d/DemolitionField.java b/Mage.Sets/src/mage/cards/d/DemolitionField.java new file mode 100644 index 0000000000..cac932ebe9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DemolitionField.java @@ -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); + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index c96ac57e1d..79e19fc770 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -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("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("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("Desynchronize", 46, Rarity.COMMON, mage.cards.d.Desynchronize.class)); cards.add(new SetCardInfo("Diabolic Intent", 89, Rarity.RARE, mage.cards.d.DiabolicIntent.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java index b5fd0db9e5..5b85f91eb8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java @@ -19,6 +19,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect { protected boolean tapped; protected boolean forceShuffle; + protected boolean optional; public SearchLibraryPutInPlayEffect(TargetCardInLibrary target) { 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) { + this(target, tapped, forceShuffle, false, outcome); + } + + public SearchLibraryPutInPlayEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle, boolean optional, Outcome outcome) { super(target, outcome); this.tapped = tapped; this.forceShuffle = forceShuffle; - staticText = "search your library for " + this.optional = optional; + staticText = (optional ? "you may " : "") + + "search your library for " + target.getDescription() + (forceShuffle ? ", " : " and ") + (target.getMaxNumberOfTargets() > 1 ? "put them onto the battlefield" : "put it onto the battlefield") @@ -52,6 +59,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect { super(effect); this.tapped = effect.tapped; this.forceShuffle = effect.forceShuffle; + this.optional = effect.optional; } @Override @@ -65,6 +73,9 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect { if (player == null) { return false; } + if (optional && !player.chooseUse(outcome, "Search your library for " + target.getDescription() + '?', source, game)) { + return true; + } if (player.searchLibrary(target, source, game)) { if (!target.getTargets().isEmpty()) { player.moveCards(new CardsImpl(target.getTargets()).getCards(game),