diff --git a/Mage.Sets/src/mage/cards/a/AjaniValiantProtector.java b/Mage.Sets/src/mage/cards/a/AjaniValiantProtector.java index 1bff23aab2..165bddba54 100644 --- a/Mage.Sets/src/mage/cards/a/AjaniValiantProtector.java +++ b/Mage.Sets/src/mage/cards/a/AjaniValiantProtector.java @@ -1,6 +1,5 @@ package mage.cards.a; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.dynamicvalue.common.ControllerLifeCount; @@ -11,17 +10,14 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.SubType; -import mage.constants.SuperType; -import mage.constants.Zone; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.StaticFilters; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author Styxo */ public final class AjaniValiantProtector extends CardImpl { @@ -39,7 +35,7 @@ public final class AjaniValiantProtector extends CardImpl { this.addAbility(ability); // +1: Reveal cards from the top of your library until you reveal a creature card. Put that card into your hand and the rest on the bottom of your library in a random order. - this.addAbility(new LoyaltyAbility(new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.HAND, Zone.LIBRARY), 1)); + this.addAbility(new LoyaltyAbility(new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_CREATURE, PutCards.HAND, PutCards.BOTTOM_RANDOM), 1)); // -11: Put X +1/+1 counters on target creature, where X is your life total. That creature gains trample until end of turn. Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(), ControllerLifeCount.instance); diff --git a/Mage.Sets/src/mage/cards/a/ArtificerClass.java b/Mage.Sets/src/mage/cards/a/ArtificerClass.java index b0d0a8e7f9..6295c31b0e 100644 --- a/Mage.Sets/src/mage/cards/a/ArtificerClass.java +++ b/Mage.Sets/src/mage/cards/a/ArtificerClass.java @@ -61,7 +61,7 @@ public final class ArtificerClass extends CardImpl { this.addAbility(new BecomesClassLevelTriggeredAbility( new RevealCardsFromLibraryUntilEffect( StaticFilters.FILTER_CARD_ARTIFACT_AN, - Zone.HAND, Zone.LIBRARY, false, false + PutCards.HAND, PutCards.BOTTOM_RANDOM ), 2 )); diff --git a/Mage.Sets/src/mage/cards/a/AvengingDruid.java b/Mage.Sets/src/mage/cards/a/AvengingDruid.java index 99f5fe6ed6..ad772f48aa 100644 --- a/Mage.Sets/src/mage/cards/a/AvengingDruid.java +++ b/Mage.Sets/src/mage/cards/a/AvengingDruid.java @@ -1,19 +1,18 @@ - package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.PutCards; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.common.FilterLandCard; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author Styxo */ public final class AvengingDruid extends CardImpl { @@ -27,7 +26,9 @@ public final class AvengingDruid extends CardImpl { this.toughness = new MageInt(3); // Whenever Avenging Druid deals damage to an opponent, you may reveal cards from the top of your library until you reveal a land card. If you do, put that card onto the battlefield and put all other cards revealed this way into your graveyard. - this.addAbility(new DealsDamageToOpponentTriggeredAbility(new RevealCardsFromLibraryUntilEffect(new FilterLandCard(), Zone.BATTLEFIELD, Zone.GRAVEYARD), true)); + this.addAbility(new DealsDamageToOpponentTriggeredAbility(new RevealCardsFromLibraryUntilEffect( + StaticFilters.FILTER_CARD_LAND, PutCards.BATTLEFIELD, PutCards.GRAVEYARD + ), true)); } private AvengingDruid(final AvengingDruid card) { diff --git a/Mage.Sets/src/mage/cards/d/DreamshaperShaman.java b/Mage.Sets/src/mage/cards/d/DreamshaperShaman.java index c963e575a5..fc37cee90b 100644 --- a/Mage.Sets/src/mage/cards/d/DreamshaperShaman.java +++ b/Mage.Sets/src/mage/cards/d/DreamshaperShaman.java @@ -10,9 +10,9 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.PutCards; import mage.constants.SubType; import mage.constants.TargetController; -import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.StaticFilters; import mage.filter.common.FilterPermanentCard; @@ -42,7 +42,9 @@ public final class DreamshaperShaman extends CardImpl { // At the beginning of your end step, you may pay {2}{R} and sacrifice a nonland permanent. If you do, reveal cards from the top of your library until you reveal a nonland permanent card. Put that card onto the battlefield and the rest on the bottom of your library in a random order. this.addAbility(new BeginningOfEndStepTriggeredAbility(new DoIfCostPaid( - new RevealCardsFromLibraryUntilEffect(filter, Zone.BATTLEFIELD, Zone.LIBRARY), + new RevealCardsFromLibraryUntilEffect( + filter, PutCards.BATTLEFIELD, PutCards.BOTTOM_RANDOM + ), new CompositeCost( new ManaCostsImpl<>("{2}{R}"), new SacrificeTargetCost(new TargetControlledPermanent( diff --git a/Mage.Sets/src/mage/cards/e/EvolutionaryLeap.java b/Mage.Sets/src/mage/cards/e/EvolutionaryLeap.java index 5bf31d26da..f7990030e2 100644 --- a/Mage.Sets/src/mage/cards/e/EvolutionaryLeap.java +++ b/Mage.Sets/src/mage/cards/e/EvolutionaryLeap.java @@ -1,6 +1,5 @@ package mage.cards.e; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeTargetCost; @@ -9,13 +8,15 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Zone; +import mage.constants.PutCards; import mage.filter.StaticFilters; -import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + +import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT; + /** - * * @author fireshoes */ public final class EvolutionaryLeap extends CardImpl { @@ -24,7 +25,9 @@ public final class EvolutionaryLeap extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); // {G}, Sacrifice a creature: Reveal cards from the top of your library until you reveal a creature card. Put that card into your hand and the rest on the bottom of your library in a random order. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.HAND, Zone.LIBRARY), new ManaCostsImpl<>("{G}")); + Ability ability = new SimpleActivatedAbility(new RevealCardsFromLibraryUntilEffect( + StaticFilters.FILTER_CARD_CREATURE, PutCards.HAND, PutCards.BOTTOM_RANDOM + ), new ManaCostsImpl<>("{G}")); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/f/Foster.java b/Mage.Sets/src/mage/cards/f/Foster.java index 47d8ac6b23..10e0ed9b72 100644 --- a/Mage.Sets/src/mage/cards/f/Foster.java +++ b/Mage.Sets/src/mage/cards/f/Foster.java @@ -1,7 +1,5 @@ package mage.cards.f; -import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.DoIfCostPaid; @@ -9,11 +7,12 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Zone; +import mage.constants.PutCards; import mage.filter.StaticFilters; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class Foster extends CardImpl { @@ -22,10 +21,11 @@ public final class Foster extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}"); // Whenever a creature you control dies, you may pay {1}. If you do, reveal cards from the top of your library until you reveal a creature card. Put that card into your hand and the rest into your graveyard. - Ability ability = new DiesCreatureTriggeredAbility( - new DoIfCostPaid(new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.HAND, Zone.GRAVEYARD), new GenericManaCost(1)), - false, StaticFilters.FILTER_CONTROLLED_A_CREATURE); - this.addAbility(ability); + this.addAbility(new DiesCreatureTriggeredAbility( + new DoIfCostPaid(new RevealCardsFromLibraryUntilEffect( + StaticFilters.FILTER_CARD_CREATURE, PutCards.HAND, PutCards.GRAVEYARD + ), new GenericManaCost(1)), false, StaticFilters.FILTER_CONTROLLED_A_CREATURE + )); } private Foster(final Foster card) { diff --git a/Mage.Sets/src/mage/cards/g/Gamekeeper.java b/Mage.Sets/src/mage/cards/g/Gamekeeper.java index edd3b3c030..1fc2ed6b20 100644 --- a/Mage.Sets/src/mage/cards/g/Gamekeeper.java +++ b/Mage.Sets/src/mage/cards/g/Gamekeeper.java @@ -1,8 +1,6 @@ package mage.cards.g; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.DiesSourceTriggeredAbility; import mage.abilities.costs.common.ExileSourceFromGraveCost; import mage.abilities.effects.common.DoIfCostPaid; @@ -10,12 +8,13 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.PutCards; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.StaticFilters; +import java.util.UUID; + /** - * * @author fireshoes */ public final class Gamekeeper extends CardImpl { @@ -27,8 +26,11 @@ public final class Gamekeeper extends CardImpl { this.toughness = new MageInt(2); // When Gamekeeper dies, you may exile it. If you do, reveal cards from the top of your library until you reveal a creature card. Put that card onto the battlefield and put all other cards revealed this way into your graveyard. - Ability ability = new DiesSourceTriggeredAbility(new DoIfCostPaid(new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.BATTLEFIELD, Zone.GRAVEYARD), new ExileSourceFromGraveCost(), "Exile to reveal cards from the top of your library until you reveal a creature card?"), false); - this.addAbility(ability); + this.addAbility(new DiesSourceTriggeredAbility(new DoIfCostPaid( + new RevealCardsFromLibraryUntilEffect( + StaticFilters.FILTER_CARD_CREATURE, PutCards.BATTLEFIELD, PutCards.GRAVEYARD + ), new ExileSourceFromGraveCost() + ), false)); } private Gamekeeper(final Gamekeeper card) { diff --git a/Mage.Sets/src/mage/cards/h/HermitDruid.java b/Mage.Sets/src/mage/cards/h/HermitDruid.java index 657563c269..d25d1a6c36 100644 --- a/Mage.Sets/src/mage/cards/h/HermitDruid.java +++ b/Mage.Sets/src/mage/cards/h/HermitDruid.java @@ -1,4 +1,3 @@ - package mage.cards.h; import mage.MageInt; @@ -10,14 +9,13 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.PutCards; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.StaticFilters; import java.util.UUID; /** - * * @author LevelX2 */ public final class HermitDruid extends CardImpl { @@ -31,7 +29,9 @@ public final class HermitDruid extends CardImpl { this.toughness = new MageInt(1); // {G}, {tap}: Reveal cards from the top of your library until you reveal a basic land card. Put that card into your hand and all other cards revealed this way into your graveyard. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_BASIC_LAND, Zone.HAND, Zone.GRAVEYARD), new ManaCostsImpl<>("{G}")); + Ability ability = new SimpleActivatedAbility(new RevealCardsFromLibraryUntilEffect( + StaticFilters.FILTER_CARD_BASIC_LAND, PutCards.HAND, PutCards.GRAVEYARD + ), new ManaCostsImpl<>("{G}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/j/JaliraMasterPolymorphist.java b/Mage.Sets/src/mage/cards/j/JaliraMasterPolymorphist.java index 5e02166c4d..915fddd72a 100644 --- a/Mage.Sets/src/mage/cards/j/JaliraMasterPolymorphist.java +++ b/Mage.Sets/src/mage/cards/j/JaliraMasterPolymorphist.java @@ -1,7 +1,5 @@ - package mage.cards.j; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -12,16 +10,17 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.PutCards; import mage.constants.SubType; import mage.constants.SuperType; -import mage.constants.Zone; import mage.filter.StaticFilters; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.Predicates; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class JaliraMasterPolymorphist extends CardImpl { @@ -43,7 +42,9 @@ public final class JaliraMasterPolymorphist extends CardImpl { // {2}{U}, {T}, Sacrifice another creature: Reveal cards from the top of your library until you reveal a nonlegendary creature card. // Put that card onto the battlefield and the rest on the bottom of your library in a random order. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RevealCardsFromLibraryUntilEffect(filterCard, Zone.BATTLEFIELD, Zone.LIBRARY), new ManaCostsImpl<>("{2}{U}")); + Ability ability = new SimpleActivatedAbility(new RevealCardsFromLibraryUntilEffect( + filterCard, PutCards.BATTLEFIELD, PutCards.BOTTOM_RANDOM + ), new ManaCostsImpl<>("{2}{U}")); ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true))); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/k/KethekCrucibleGoliath.java b/Mage.Sets/src/mage/cards/k/KethekCrucibleGoliath.java index 2b99c64d0c..f4d1f38738 100644 --- a/Mage.Sets/src/mage/cards/k/KethekCrucibleGoliath.java +++ b/Mage.Sets/src/mage/cards/k/KethekCrucibleGoliath.java @@ -96,7 +96,7 @@ class KethekCrucibleGoliathEffect extends OneShotEffect { // Lesser Mana Value filterCreatureCard.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue)); //put it onto the battlefield, then put the rest on the bottom of your library in a random order. - RevealCardsFromLibraryUntilEffect effect = new RevealCardsFromLibraryUntilEffect(filterCreatureCard, Zone.BATTLEFIELD, Zone.LIBRARY); + RevealCardsFromLibraryUntilEffect effect = new RevealCardsFromLibraryUntilEffect(filterCreatureCard, PutCards.BATTLEFIELD,PutCards.BOTTOM_RANDOM); effect.apply(game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/n/NissaResurgentAnimist.java b/Mage.Sets/src/mage/cards/n/NissaResurgentAnimist.java index 370de1c2b2..da09c8ad36 100644 --- a/Mage.Sets/src/mage/cards/n/NissaResurgentAnimist.java +++ b/Mage.Sets/src/mage/cards/n/NissaResurgentAnimist.java @@ -41,7 +41,7 @@ public final class NissaResurgentAnimist extends CardImpl { Ability ability = new LandfallAbility(new AddManaOfAnyColorEffect()); ability.addEffect(new IfAbilityHasResolvedXTimesEffect( Outcome.DrawCard, 2, - new RevealCardsFromLibraryUntilEffect(filter, Zone.HAND, Zone.LIBRARY) + new RevealCardsFromLibraryUntilEffect(filter, PutCards.HAND, PutCards.BOTTOM_RANDOM) ).concatBy("Then")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/r/RecrossThePaths.java b/Mage.Sets/src/mage/cards/r/RecrossThePaths.java index 7e611c4344..b148e2531d 100644 --- a/Mage.Sets/src/mage/cards/r/RecrossThePaths.java +++ b/Mage.Sets/src/mage/cards/r/RecrossThePaths.java @@ -1,19 +1,17 @@ - package mage.cards.r; -import java.util.UUID; - import mage.abilities.effects.common.DoIfClashWonEffect; import mage.abilities.effects.common.ReturnToHandSpellEffect; import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Zone; -import mage.filter.common.FilterLandCard; +import mage.constants.PutCards; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class RecrossThePaths extends CardImpl { @@ -22,7 +20,9 @@ public final class RecrossThePaths extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}"); // Reveal cards from the top of your library until you reveal a land card. Put that card onto the battlefield and the rest on the bottom of your library in any order. - this.getSpellAbility().addEffect(new RevealCardsFromLibraryUntilEffect(new FilterLandCard(), Zone.BATTLEFIELD, Zone.LIBRARY, false, true)); + this.getSpellAbility().addEffect(new RevealCardsFromLibraryUntilEffect( + StaticFilters.FILTER_CARD_LAND, PutCards.BATTLEFIELD, PutCards.BOTTOM_ANY + )); // Clash with an opponent. If you win, return Recross the Paths to its owner's hand. this.getSpellAbility().addEffect(new DoIfClashWonEffect(ReturnToHandSpellEffect.getInstance())); diff --git a/Mage.Sets/src/mage/cards/s/SacredGuide.java b/Mage.Sets/src/mage/cards/s/SacredGuide.java index eed93986ac..e1083b3433 100644 --- a/Mage.Sets/src/mage/cards/s/SacredGuide.java +++ b/Mage.Sets/src/mage/cards/s/SacredGuide.java @@ -1,7 +1,6 @@ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -12,13 +11,14 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.PutCards; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ColorPredicate; +import java.util.UUID; + /** - * * @author Styxo */ public final class SacredGuide extends CardImpl { @@ -38,7 +38,9 @@ public final class SacredGuide extends CardImpl { this.toughness = new MageInt(1); // {1}{W}, Sacrifice Sacred Guide: Reveal cards from the top of your library until you reveal a white card. Put that card into your hand and exile all other cards revealed this way. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RevealCardsFromLibraryUntilEffect(filterCard, Zone.HAND, Zone.EXILED), new ManaCostsImpl<>("{1}{W}")); + Ability ability = new SimpleActivatedAbility( + new RevealCardsFromLibraryUntilEffect(filterCard, PutCards.HAND, PutCards.EXILED), new ManaCostsImpl<>("{1}{W}") + ); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TezzeretMasterOfMetal.java b/Mage.Sets/src/mage/cards/t/TezzeretMasterOfMetal.java index c9a4fd6ecb..5d3c33c786 100644 --- a/Mage.Sets/src/mage/cards/t/TezzeretMasterOfMetal.java +++ b/Mage.Sets/src/mage/cards/t/TezzeretMasterOfMetal.java @@ -36,7 +36,7 @@ public final class TezzeretMasterOfMetal extends CardImpl { this.setStartingLoyalty(5); // +1: Reveal cards from the top of your library until you reveal an artifact card. Put that card into your hand and the rest on the bottom of your library in a random order. - this.addAbility(new LoyaltyAbility(new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_ARTIFACT, Zone.HAND, Zone.LIBRARY), 1)); + this.addAbility(new LoyaltyAbility(new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_ARTIFACT, PutCards.HAND, PutCards.BOTTOM_RANDOM), 1)); // -3: Target opponent loses life equal to the number of artifacts you control. Ability ability = new LoyaltyAbility(new LoseLifeTargetEffect(ArtifactYouControlCount.instance).setText("target opponent loses life equal to the number of artifacts you control"), -3); diff --git a/Mage.Sets/src/mage/cards/t/ThicketElemental.java b/Mage.Sets/src/mage/cards/t/ThicketElemental.java index c5c45584f9..2778fe4c23 100644 --- a/Mage.Sets/src/mage/cards/t/ThicketElemental.java +++ b/Mage.Sets/src/mage/cards/t/ThicketElemental.java @@ -1,8 +1,6 @@ package mage.cards.t; -import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.condition.common.KickedCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; @@ -11,12 +9,13 @@ import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.PutCards; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.StaticFilters; +import java.util.UUID; + /** - * * @author fireshoes */ public final class ThicketElemental extends CardImpl { @@ -31,9 +30,13 @@ public final class ThicketElemental extends CardImpl { this.addAbility(new KickerAbility("{1}{G}")); // When Thicket Elemental enters the battlefield, if it was kicked, you may reveal cards from the top of your library until you reveal a creature card. If you do, put that card onto the battlefield and shuffle all other cards revealed this way into your library. - TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.BATTLEFIELD, Zone.LIBRARY, true)); - this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE, - "When {this} enters the battlefield, if it was kicked, you may reveal cards from the top of your library until you reveal a creature card. If you do, put that card onto the battlefield and shuffle all other cards revealed this way into your library.")); + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new EntersBattlefieldTriggeredAbility(new RevealCardsFromLibraryUntilEffect( + StaticFilters.FILTER_CARD_CREATURE, PutCards.BATTLEFIELD, PutCards.SHUFFLE + )), KickedCondition.ONCE, "When {this} enters the battlefield, if it was kicked, " + + "you may reveal cards from the top of your library until you reveal a creature card. If you do, " + + "put that card onto the battlefield and shuffle all other cards revealed this way into your library." + )); } private ThicketElemental(final ThicketElemental card) { diff --git a/Mage.Sets/src/mage/cards/v/VivienNaturesAvenger.java b/Mage.Sets/src/mage/cards/v/VivienNaturesAvenger.java index 3280173988..30b7ed1713 100644 --- a/Mage.Sets/src/mage/cards/v/VivienNaturesAvenger.java +++ b/Mage.Sets/src/mage/cards/v/VivienNaturesAvenger.java @@ -20,10 +20,10 @@ import java.util.UUID; * @author TheElk801 */ public final class VivienNaturesAvenger extends CardImpl { - + public VivienNaturesAvenger(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{G}{G}"); - + this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.VIVIEN); this.setStartingLoyalty(3); @@ -37,7 +37,7 @@ public final class VivienNaturesAvenger extends CardImpl { // −1: Reveal cards from the top of your library until you reveal a creature card. Put that card into your hand and the rest on the bottom of your library in a random order. this.addAbility(new LoyaltyAbility(new RevealCardsFromLibraryUntilEffect( - StaticFilters.FILTER_CARD_CREATURE, Zone.HAND, Zone.HAND, false, false + StaticFilters.FILTER_CARD_CREATURE, PutCards.HAND, PutCards.BOTTOM_RANDOM ), -1)); // −6: Target creature gets +10/+10 and gains trample until end of turn. @@ -50,11 +50,11 @@ public final class VivienNaturesAvenger extends CardImpl { ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } - + private VivienNaturesAvenger(final VivienNaturesAvenger card) { super(card); } - + @Override public VivienNaturesAvenger copy() { return new VivienNaturesAvenger(this); diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java index fa4c695c65..aace9e4a4e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java @@ -1,6 +1,5 @@ package mage.abilities.effects.common; -import mage.MageObject; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; @@ -8,10 +7,10 @@ import mage.cards.Card; import mage.cards.Cards; import mage.cards.CardsImpl; import mage.constants.Outcome; +import mage.constants.PutCards; import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; -import mage.players.Library; import mage.players.Player; import mage.util.CardUtil; @@ -21,35 +20,21 @@ import mage.util.CardUtil; public class RevealCardsFromLibraryUntilEffect extends OneShotEffect { private final FilterCard filter; - private final Zone zoneToPutRest; - private final Zone zoneToPutCard; - private final boolean shuffleRestInto; - private final boolean anyOrder; + private final PutCards putPickedCard; + private final PutCards putRemainingCards; - public RevealCardsFromLibraryUntilEffect(FilterCard filter, Zone zoneToPutCard, Zone zoneToPutRest) { - this(filter, zoneToPutCard, zoneToPutRest, false, false); - } - - public RevealCardsFromLibraryUntilEffect(FilterCard filter, Zone zoneToPutCard, Zone zoneToPutRest, boolean shuffleRestInto) { - this(filter, zoneToPutCard, zoneToPutRest, shuffleRestInto, false); - } - - public RevealCardsFromLibraryUntilEffect(FilterCard filter, Zone zoneToPutCard, Zone zoneToPutRest, boolean shuffleRestInto, boolean anyOrder) { + public RevealCardsFromLibraryUntilEffect(FilterCard filter, PutCards putPickedCard, PutCards putRemainingCards) { super(Outcome.Benefit); this.filter = filter; - this.zoneToPutCard = zoneToPutCard; - this.zoneToPutRest = zoneToPutRest; - this.shuffleRestInto = shuffleRestInto; - this.anyOrder = anyOrder; + this.putPickedCard = putPickedCard; + this.putRemainingCards = putRemainingCards; } private RevealCardsFromLibraryUntilEffect(final RevealCardsFromLibraryUntilEffect effect) { super(effect); this.filter = effect.filter; - this.zoneToPutCard = effect.zoneToPutCard; - this.zoneToPutRest = effect.zoneToPutRest; - this.shuffleRestInto = effect.shuffleRestInto; - this.anyOrder = effect.anyOrder; + this.putPickedCard = effect.putPickedCard; + this.putRemainingCards = effect.putRemainingCards; } @Override @@ -57,47 +42,32 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect { return new RevealCardsFromLibraryUntilEffect(this); } + private Card getCard(Player controller, Cards cards, Ability source, Game game) { + for (Card card : controller.getLibrary().getCards(game)) { + cards.add(card); + if (filter.match(card, source.getControllerId(), source, game)) { + return card; + } + } + return null; + } + @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - MageObject sourceObject = game.getObject(source); if (controller == null || !controller.getLibrary().hasCards()) { return false; } Cards cards = new CardsImpl(); - Library library = controller.getLibrary(); - Card card = null; - do { - card = library.removeFromTop(game); - if (card != null) { - cards.add(card); - } - } while (library.hasCards() && !filter.match(card, game)); - // reveal cards - if (cards.isEmpty()) { - return true; - } - controller.revealCards(sourceObject.getIdName(), cards, game); - if (filter.match(card, game)) { - // put card in correct zone - controller.moveCards(card, zoneToPutCard, source, game); - // remove it from revealed card list + Card card = getCard(controller, cards, source, game); + controller.revealCards(source, cards, game); + putPickedCard.moveCard(controller, card, source, game, "card"); + if (putPickedCard.getZone() == Zone.LIBRARY) { cards.remove(card); - } - // Put the rest in correct zone - if (zoneToPutRest == Zone.LIBRARY) { - if (!cards.isEmpty()) { - if (shuffleRestInto) { - library.addAll(cards.getCards(game), game); - } else { - controller.putCardsOnBottomOfLibrary(cards, game, source, anyOrder); - } - } } else { - if (!cards.isEmpty()) { - controller.moveCards(cards, zoneToPutRest, source, game); - } + cards.retainZone(Zone.LIBRARY, game); } + putRemainingCards.moveCards(controller, cards, source, game); return true; } @@ -109,42 +79,20 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect { StringBuilder sb = new StringBuilder("reveal cards from the top of your library until you reveal "); sb.append(CardUtil.addArticle(filter.getMessage())); sb.append(". Put that card "); - - switch (zoneToPutCard) { - case HAND: { - sb.append("into your hand"); + sb.append(putPickedCard.getMessage(false, false)); + switch (putRemainingCards) { + case SHUFFLE: + sb.append(" and shuffle the rest into your library"); break; - } - case BATTLEFIELD: { - sb.append("onto the battlefield"); - break; - } - } - - switch (zoneToPutRest) { - case GRAVEYARD: { - sb.append(" and put all other cards revealed this way into your graveyard."); - break; - } - case LIBRARY: { - if (shuffleRestInto) { - sb.append(", then shuffles the rest into their library."); - } else { - sb.append(" and the rest on the bottom of your library in "); - if (anyOrder) { - sb.append("any"); - } else { - sb.append("a random"); - - } - sb.append(" order"); - } - break; - } - case EXILED: { + case EXILED: sb.append(" and exile all other cards revealed this way."); break; - } + case GRAVEYARD: + sb.append(" and all other cards revealed this way into your graveyard"); + break; + default: + sb.append(" and the rest "); + sb.append(putRemainingCards.getMessage(false, true)); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/constants/PutCards.java b/Mage/src/main/java/mage/constants/PutCards.java index 24e6fb7b00..e23963b674 100644 --- a/Mage/src/main/java/mage/constants/PutCards.java +++ b/Mage/src/main/java/mage/constants/PutCards.java @@ -22,7 +22,8 @@ public enum PutCards { TOP_OR_BOTTOM(Outcome.Benefit, Zone.LIBRARY, "on the top or bottom of your library"), TOP_ANY(Outcome.Benefit, Zone.LIBRARY, "on top of your library", " in any order"), BOTTOM_ANY(Outcome.Benefit, Zone.LIBRARY, "on the bottom of your library", " in any order"), - BOTTOM_RANDOM(Outcome.Benefit, Zone.LIBRARY, "on the bottom of your library", " in a random order"); + BOTTOM_RANDOM(Outcome.Benefit, Zone.LIBRARY, "on the bottom of your library", " in a random order"), + SHUFFLE(Outcome.Benefit, Zone.LIBRARY, "shuffled into your library"); // may need special case code to generate correct text private final Outcome outcome; private final Zone zone; @@ -74,6 +75,8 @@ public enum PutCards { return player.putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, false); case BATTLEFIELD_TAPPED: return player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); + case SHUFFLE: + return player.shuffleCardsToLibrary(card, game, source); case BATTLEFIELD_TRANSFORMED: game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId(), Boolean.TRUE); case BATTLEFIELD: @@ -98,6 +101,8 @@ public enum PutCards { return player.putCardsOnBottomOfLibrary(cards, game, source, false); case BATTLEFIELD_TAPPED: return player.moveCards(cards.getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null); + case SHUFFLE: + return player.shuffleCardsToLibrary(cards, game, source); case BATTLEFIELD_TRANSFORMED: cards.stream().forEach(uuid -> game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + uuid, Boolean.TRUE)); case BATTLEFIELD: