diff --git a/Mage.Sets/src/mage/cards/b/BorderlandRanger.java b/Mage.Sets/src/mage/cards/b/BorderlandRanger.java index b6b9476a39a..7f44e20ce9b 100644 --- a/Mage.Sets/src/mage/cards/b/BorderlandRanger.java +++ b/Mage.Sets/src/mage/cards/b/BorderlandRanger.java @@ -27,7 +27,7 @@ public final class BorderlandRanger extends CardImpl { this.toughness = new MageInt(2); // When Borderland Ranger enters the battlefield, you may search your library for a basic land card, reveal it, and put it into your hand. If you do, shuffle your library. - this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true, true), true)); + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true, false), true)); } public BorderlandRanger(final BorderlandRanger card) { diff --git a/Mage.Sets/src/mage/cards/c/CentaurRootcaster.java b/Mage.Sets/src/mage/cards/c/CentaurRootcaster.java index fae71361296..c6481efda58 100644 --- a/Mage.Sets/src/mage/cards/c/CentaurRootcaster.java +++ b/Mage.Sets/src/mage/cards/c/CentaurRootcaster.java @@ -28,7 +28,7 @@ public final class CentaurRootcaster extends CardImpl { // Whenever Centaur Rootcaster deals combat damage to a player, you may search your library for a basic land card and put that card onto the battlefield tapped. If you do, shuffle your library. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility( - new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_BASIC_LAND), true, true), + new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true, true), true)); } diff --git a/Mage.Sets/src/mage/cards/c/CivicWayfinder.java b/Mage.Sets/src/mage/cards/c/CivicWayfinder.java index 7b92b1bc6a0..9ffcbf1a038 100644 --- a/Mage.Sets/src/mage/cards/c/CivicWayfinder.java +++ b/Mage.Sets/src/mage/cards/c/CivicWayfinder.java @@ -29,7 +29,7 @@ public final class CivicWayfinder extends CardImpl { this.toughness = new MageInt(2); // When Civic Wayfinder enters the battlefield, you may search your library for a basic land card, reveal it, and put it into your hand. If you do, shuffle your library. - this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true, true), true)); + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true, false), true)); } public CivicWayfinder(final CivicWayfinder card) { diff --git a/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java b/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java index 97fe6f1794b..65231c23e64 100644 --- a/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java +++ b/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java @@ -1,39 +1,36 @@ package mage.cards.g; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; +import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.Effect; -import mage.abilities.effects.Effects; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; import mage.abilities.keyword.TrampleAbility; -import mage.cards.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.SuperType; -import mage.constants.Zone; import mage.filter.StaticFilters; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreaturePermanent; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.game.permanent.token.WolfTokenWithDeathtouch; -import mage.players.Player; -import mage.target.Target; import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetControlledPermanent; +import java.util.UUID; + /** * @author nantuko */ public final class GarrukTheVeilCursed extends CardImpl { + private static final DynamicValue xValue = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE); + public GarrukTheVeilCursed(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, ""); this.addSuperType(SuperType.LEGENDARY); @@ -47,25 +44,31 @@ public final class GarrukTheVeilCursed extends CardImpl { this.color.setBlack(true); // +1 : Create a 1/1 black Wolf creature token with deathtouch. - LoyaltyAbility ability1 = new LoyaltyAbility(new CreateTokenEffect(new WolfTokenWithDeathtouch()), 1); - this.addAbility(ability1); + this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new WolfTokenWithDeathtouch()), 1)); // -1 : Sacrifice a creature. If you do, search your library for a creature card, reveal it, put it into your hand, then shuffle your library. - LoyaltyAbility ability2 = new LoyaltyAbility(new GarrukTheVeilCursedEffect(), -1); - this.addAbility(ability2); + this.addAbility(new LoyaltyAbility(new DoIfCostPaid( + new SearchLibraryPutInHandEffect(new TargetCardInLibrary( + StaticFilters.FILTER_CARD_CREATURE_A + ), true, true), + null, + new SacrificeTargetCost(new TargetControlledPermanent( + StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT + )), + false + ), -1)); // -3 : Creatures you control gain trample and get +X/+X until end of turn, where X is the number of creature cards in your graveyard. - Effects effects1 = new Effects(); - BoostControlledEffect effect = new BoostControlledEffect(new GarrukTheVeilCursedValue(), new GarrukTheVeilCursedValue(), Duration.EndOfTurn); - // +X/+X should be counted only once - effect.setLockedIn(true); - effect.setRule("Creatures you control get +X/+X until end of turn, where X is the number of creature cards in your graveyard"); - effects1.add(effect); - effects1.add(new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent())); - this.addAbility(new LoyaltyAbility(effects1, -3)); + Ability ability = new LoyaltyAbility(new GainAbilityControlledEffect( + TrampleAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_CONTROLLED_CREATURE + ).setText("creatures you control gain trample"), -3); + ability.addEffect(new BoostControlledEffect( + xValue, xValue, Duration.EndOfTurn + ).setText("and get +X/+X until end of turn, where X is the number of creature cards in your graveyard")); + this.addAbility(ability); } - public GarrukTheVeilCursed(final GarrukTheVeilCursed card) { + private GarrukTheVeilCursed(final GarrukTheVeilCursed card) { super(card); } @@ -74,97 +77,3 @@ public final class GarrukTheVeilCursed extends CardImpl { return new GarrukTheVeilCursed(this); } } - -class GarrukTheVeilCursedValue implements DynamicValue { - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - Player player = game.getPlayer(sourceAbility.getControllerId()); - if (player != null) { - return player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game).size(); - } - return 0; - } - - @Override - public DynamicValue copy() { - return this; - } - - @Override - public String getMessage() { - return "the number of creature cards in your graveyard"; - } - - @Override - public String toString() { - return "+X"; - } -} - -class GarrukTheVeilCursedEffect extends OneShotEffect { - - private static final FilterControlledCreaturePermanent filterCreature = new FilterControlledCreaturePermanent("a creature you control"); - - public GarrukTheVeilCursedEffect() { - super(Outcome.Benefit); - staticText = "Sacrifice a creature. If you do, search your library for a creature card, reveal it, put it into your hand, then shuffle your library"; - } - - public GarrukTheVeilCursedEffect(final GarrukTheVeilCursedEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - - if (controller == null) { - return false; - } - - // sacrifice a creature - Target target = new TargetControlledPermanent(1, 1, filterCreature, false); - boolean sacrificed = false; - if (target.canChoose(source.getSourceId(), controller.getId(), game)) { - while (controller.canRespond() && !target.isChosen() && target.canChoose(source.getSourceId(), controller.getId(), game)) { - controller.chooseTarget(Outcome.Sacrifice, target, source, game); - } - - for (int idx = 0; idx < target.getTargets().size(); idx++) { - Permanent permanent = game.getPermanent(target.getTargets().get(idx)); - if (permanent != null) { - sacrificed |= permanent.sacrifice(source, game); - } - } - } - - if (sacrificed) { - // search - TargetCardInLibrary targetInLibrary = new TargetCardInLibrary(StaticFilters.FILTER_CARD_CREATURE); - Cards cards = new CardsImpl(); - if (controller.searchLibrary(targetInLibrary, source, game)) { - for (UUID cardId : targetInLibrary.getTargets()) { - Card card = controller.getLibrary().remove(cardId, game); - if (card != null) { - card.moveToZone(Zone.HAND, source, game, false); - cards.add(card); - } - } - } - // reveal - if (!cards.isEmpty()) { - controller.revealCards("Garruk, the Veil-Cursed", cards, game); - } - // shuffle - controller.shuffleLibrary(source, game); - return true; - } - return false; - } - - @Override - public GarrukTheVeilCursedEffect copy() { - return new GarrukTheVeilCursedEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/i/IdyllicTutor.java b/Mage.Sets/src/mage/cards/i/IdyllicTutor.java index c25b4c96e3c..dfcce568d98 100644 --- a/Mage.Sets/src/mage/cards/i/IdyllicTutor.java +++ b/Mage.Sets/src/mage/cards/i/IdyllicTutor.java @@ -1,33 +1,30 @@ - package mage.cards.i; -import java.util.UUID; import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.filter.FilterCard; +import mage.filter.common.FilterEnchantmentCard; import mage.target.common.TargetCardInLibrary; +import java.util.UUID; + /** * @author Loki */ public final class IdyllicTutor extends CardImpl { - private static final FilterCard filter = new FilterCard("an enchantment"); - - static { - filter.add(CardType.ENCHANTMENT.getPredicate()); - } + private static final FilterCard filter = new FilterEnchantmentCard("an enchantment card"); public IdyllicTutor(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}"); // Search your library for an enchantment card, reveal it, and put it into your hand. Then shuffle your library. this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true)); } - public IdyllicTutor(final IdyllicTutor card) { + private IdyllicTutor(final IdyllicTutor card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/k/KnightOfTheWhiteOrchid.java b/Mage.Sets/src/mage/cards/k/KnightOfTheWhiteOrchid.java index 23438bfc9ea..b6b03a8c5ac 100644 --- a/Mage.Sets/src/mage/cards/k/KnightOfTheWhiteOrchid.java +++ b/Mage.Sets/src/mage/cards/k/KnightOfTheWhiteOrchid.java @@ -38,7 +38,7 @@ public final class KnightOfTheWhiteOrchid extends CardImpl { this.addAbility(new ConditionalInterveningIfTriggeredAbility( new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, new FilterBySubtypeCard(SubType.PLAINS)), false), true), new OpponentControlsMoreCondition(StaticFilters.FILTER_LANDS), - "When {this} enters the battlefield, if an opponent controls more lands than you, you may search your library for a Plains card, put it onto the battlefield, then shuffle your library")); + "When {this} enters the battlefield, if an opponent controls more lands than you, you may search your library for a Plains card, put it onto the battlefield, then shuffle your library.")); } diff --git a/Mage.Sets/src/mage/cards/k/KyscuDrake.java b/Mage.Sets/src/mage/cards/k/KyscuDrake.java index 709edbfb9aa..5bf8708c8af 100644 --- a/Mage.Sets/src/mage/cards/k/KyscuDrake.java +++ b/Mage.Sets/src/mage/cards/k/KyscuDrake.java @@ -1,9 +1,9 @@ package mage.cards.k; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.LimitedTimesPerTurnActivatedAbility; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.CompositeCost; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -22,7 +22,6 @@ import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; /** - * * @author jmharmon */ @@ -30,6 +29,7 @@ public final class KyscuDrake extends CardImpl { private static final FilterCard filter = new FilterCard("card named Viashivan Dragon"); private static final FilterControlledCreaturePermanent filterSpitting = new FilterControlledCreaturePermanent("creature named Spitting Drake"); + static { filter.add(new NamePredicate("Viashivan Dragon")); filterSpitting.add(new NamePredicate("Spitting Drake")); @@ -49,11 +49,7 @@ public final class KyscuDrake extends CardImpl { this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(0, 1, Duration.EndOfTurn), new ManaCostsImpl("{G}"))); // Sacrifice Kyscu Drake and a creature named Spitting Drake: Search your library for a card named Viashivan Dragon and put that card onto the battlefield. Then shuffle your library. - TargetCardInLibrary target = new TargetCardInLibrary(1, 1, new FilterCard(filter)); - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(target,true,true, Outcome.PutCardInPlay), new SacrificeSourceCost()); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterSpitting, false))); - this.addAbility(ability); - + this.addAbility(new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(1, 1, filter), false, true, Outcome.PutCardInPlay), new CompositeCost(new SacrificeSourceCost(), new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterSpitting, false)), "sacrifice {this} and a creature named Spitting Drake"))); } public KyscuDrake(final KyscuDrake card) { diff --git a/Mage.Sets/src/mage/cards/l/LandTax.java b/Mage.Sets/src/mage/cards/l/LandTax.java index d25dd644331..3c21a088b55 100644 --- a/Mage.Sets/src/mage/cards/l/LandTax.java +++ b/Mage.Sets/src/mage/cards/l/LandTax.java @@ -25,7 +25,7 @@ public final class LandTax extends CardImpl { // At the beginning of your upkeep, if an opponent controls more lands than you, you may search your library for up to three basic land cards, reveal them, and put them into your hand. If you do, shuffle your library. this.addAbility(new ConditionalInterveningIfTriggeredAbility( - new BeginningOfUpkeepTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 3, StaticFilters.FILTER_CARD_BASIC_LAND), true), TargetController.YOU, true), + new BeginningOfUpkeepTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 3, StaticFilters.FILTER_CARD_BASIC_LAND), true, true), TargetController.YOU, true), new OpponentControlsMoreCondition(StaticFilters.FILTER_LANDS), "At the beginning of your upkeep, if an opponent controls more lands than you, you may search your library for up to three basic land cards, reveal them, and put them into your hand. If you do, shuffle your library" )); diff --git a/Mage.Sets/src/mage/cards/n/NissaVastwoodSeer.java b/Mage.Sets/src/mage/cards/n/NissaVastwoodSeer.java index 5912acb6067..2564d38f77d 100644 --- a/Mage.Sets/src/mage/cards/n/NissaVastwoodSeer.java +++ b/Mage.Sets/src/mage/cards/n/NissaVastwoodSeer.java @@ -45,7 +45,7 @@ public final class NissaVastwoodSeer extends CardImpl { this.secondSideCardClazz = NissaSageAnimist.class; // When Nissa, Vastwood Seer enters the battlefield, you may search your library for a basic Forest card, reveal it, put it into your hand, then shuffle your library. - this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, filter), true, true), true)); + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, true), true)); // Whenever a land enters the battlefield under your control, if you control seven or more lands, exile Nissa, then return her to the battlefield transformed under her owner's control. this.addAbility(new TransformAbility()); diff --git a/Mage.Sets/src/mage/cards/t/TheBirthOfMeletis.java b/Mage.Sets/src/mage/cards/t/TheBirthOfMeletis.java index 26fc064b6cc..ed138ab380c 100644 --- a/Mage.Sets/src/mage/cards/t/TheBirthOfMeletis.java +++ b/Mage.Sets/src/mage/cards/t/TheBirthOfMeletis.java @@ -39,7 +39,7 @@ public final class TheBirthOfMeletis extends CardImpl { // I — Search your library for a basic Plains card, reveal it, put it into your hand, then shuffle your library. sagaAbility.addChapterEffect( this, SagaChapter.CHAPTER_I, new SearchLibraryPutInHandEffect( - new TargetCardInLibrary(filter), false, true + new TargetCardInLibrary(filter), true, true ) ); diff --git a/Mage.Sets/src/mage/cards/t/TrailOfMystery.java b/Mage.Sets/src/mage/cards/t/TrailOfMystery.java index 544fb5147aa..29267792a5e 100644 --- a/Mage.Sets/src/mage/cards/t/TrailOfMystery.java +++ b/Mage.Sets/src/mage/cards/t/TrailOfMystery.java @@ -19,7 +19,6 @@ import mage.target.common.TargetCardInLibrary; import java.util.UUID; /** - * * @author LevelX2 */ public final class TrailOfMystery extends CardImpl { @@ -31,12 +30,12 @@ public final class TrailOfMystery extends CardImpl { } public TrailOfMystery(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); // Whenever a face-down creature enters the battlefield under your control, you may search your library for a basic land card, reveal it, put it into your hand, then shuffle your library. - Effect effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0,1, StaticFilters.FILTER_CARD_BASIC_LAND), true, true); + Effect effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND), true, true); this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, effect, filter, true)); - + // Whenever a permanent you control is turned face up, if it's a creature, it gets +2/+2 until end of turn. this.addAbility(new TrailOfMysteryTriggeredAbility()); } @@ -54,7 +53,7 @@ public final class TrailOfMystery extends CardImpl { class TrailOfMysteryTriggeredAbility extends TurnedFaceUpAllTriggeredAbility { public TrailOfMysteryTriggeredAbility() { - super(new BoostTargetEffect(2,2,Duration.EndOfTurn), new FilterControlledCreaturePermanent(), true); + super(new BoostTargetEffect(2, 2, Duration.EndOfTurn), new FilterControlledCreaturePermanent(), true); } public TrailOfMysteryTriggeredAbility(final TrailOfMysteryTriggeredAbility ability) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/watchers/TunnelIgnusTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/watchers/TunnelIgnusTest.java index 2847f49bd94..c15f5f137d9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/watchers/TunnelIgnusTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/watchers/TunnelIgnusTest.java @@ -26,7 +26,7 @@ public class TunnelIgnusTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Scalding Tarn"); playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Scalding Tarn"); - activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}, Pay 1 life, Sacrifice {this}: Search your library for a Island or Mountain and put it onto the battlefield. Then shuffle your library."); + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}, "); setStopAt(1, PhaseStep.END_TURN); execute(); diff --git a/Mage/src/main/java/mage/abilities/common/FetchLandActivatedAbility.java b/Mage/src/main/java/mage/abilities/common/FetchLandActivatedAbility.java index 1e477edf74d..0180f8ece00 100644 --- a/Mage/src/main/java/mage/abilities/common/FetchLandActivatedAbility.java +++ b/Mage/src/main/java/mage/abilities/common/FetchLandActivatedAbility.java @@ -23,7 +23,6 @@ import java.util.Set; import java.util.stream.Collectors; /** - * * @author BetaSteward_at_googlemail.com */ public class FetchLandActivatedAbility extends ActivatedAbilityImpl { @@ -55,7 +54,7 @@ public class FetchLandActivatedAbility extends ActivatedAbilityImpl { } private String subTypeNames(Set subTypes) { - return subTypes.stream().map(SubType::getDescription).collect(Collectors.joining(" or ")); + return subTypes.stream().map(SubType::getDescription).collect(Collectors.joining(" or ")) + " card"; } @Override