rework RevealCardsFromLibraryUntilEffect to use PutCards

This commit is contained in:
theelk801 2023-05-03 17:07:13 -04:00
parent 39d78aff2f
commit a3c4dc2395
18 changed files with 122 additions and 159 deletions

View file

@ -1,6 +1,5 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.dynamicvalue.common.ControllerLifeCount; import mage.abilities.dynamicvalue.common.ControllerLifeCount;
@ -11,17 +10,14 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author Styxo * @author Styxo
*/ */
public final class AjaniValiantProtector extends CardImpl { public final class AjaniValiantProtector extends CardImpl {
@ -39,7 +35,7 @@ public final class AjaniValiantProtector extends CardImpl {
this.addAbility(ability); 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. // +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. // -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); Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(), ControllerLifeCount.instance);

View file

@ -61,7 +61,7 @@ public final class ArtificerClass extends CardImpl {
this.addAbility(new BecomesClassLevelTriggeredAbility( this.addAbility(new BecomesClassLevelTriggeredAbility(
new RevealCardsFromLibraryUntilEffect( new RevealCardsFromLibraryUntilEffect(
StaticFilters.FILTER_CARD_ARTIFACT_AN, StaticFilters.FILTER_CARD_ARTIFACT_AN,
Zone.HAND, Zone.LIBRARY, false, false PutCards.HAND, PutCards.BOTTOM_RANDOM
), 2 ), 2
)); ));

View file

@ -1,19 +1,18 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.PutCards;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.filter.StaticFilters;
import mage.filter.common.FilterLandCard;
import java.util.UUID;
/** /**
*
* @author Styxo * @author Styxo
*/ */
public final class AvengingDruid extends CardImpl { public final class AvengingDruid extends CardImpl {
@ -27,7 +26,9 @@ public final class AvengingDruid extends CardImpl {
this.toughness = new MageInt(3); 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. // 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) { private AvengingDruid(final AvengingDruid card) {

View file

@ -10,9 +10,9 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.PutCards;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterPermanentCard; 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. // 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( this.addAbility(new BeginningOfEndStepTriggeredAbility(new DoIfCostPaid(
new RevealCardsFromLibraryUntilEffect(filter, Zone.BATTLEFIELD, Zone.LIBRARY), new RevealCardsFromLibraryUntilEffect(
filter, PutCards.BATTLEFIELD, PutCards.BOTTOM_RANDOM
),
new CompositeCost( new CompositeCost(
new ManaCostsImpl<>("{2}{R}"), new ManaCostsImpl<>("{2}{R}"),
new SacrificeTargetCost(new TargetControlledPermanent( new SacrificeTargetCost(new TargetControlledPermanent(

View file

@ -1,6 +1,5 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
@ -9,13 +8,15 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.PutCards;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class EvolutionaryLeap extends CardImpl { 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}"); 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. // {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))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,7 +1,5 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DoIfCostPaid;
@ -9,11 +7,12 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.PutCards;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class Foster extends CardImpl { 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}"); 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. // 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( this.addAbility(new DiesCreatureTriggeredAbility(
new DoIfCostPaid(new RevealCardsFromLibraryUntilEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.HAND, Zone.GRAVEYARD), new GenericManaCost(1)), new DoIfCostPaid(new RevealCardsFromLibraryUntilEffect(
false, StaticFilters.FILTER_CONTROLLED_A_CREATURE); StaticFilters.FILTER_CARD_CREATURE, PutCards.HAND, PutCards.GRAVEYARD
this.addAbility(ability); ), new GenericManaCost(1)), false, StaticFilters.FILTER_CONTROLLED_A_CREATURE
));
} }
private Foster(final Foster card) { private Foster(final Foster card) {

View file

@ -1,8 +1,6 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility; import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.costs.common.ExileSourceFromGraveCost; import mage.abilities.costs.common.ExileSourceFromGraveCost;
import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DoIfCostPaid;
@ -10,12 +8,13 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.PutCards;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class Gamekeeper extends CardImpl { public final class Gamekeeper extends CardImpl {
@ -27,8 +26,11 @@ public final class Gamekeeper extends CardImpl {
this.toughness = new MageInt(2); 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. // 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(new DiesSourceTriggeredAbility(new DoIfCostPaid(
this.addAbility(ability); new RevealCardsFromLibraryUntilEffect(
StaticFilters.FILTER_CARD_CREATURE, PutCards.BATTLEFIELD, PutCards.GRAVEYARD
), new ExileSourceFromGraveCost()
), false));
} }
private Gamekeeper(final Gamekeeper card) { private Gamekeeper(final Gamekeeper card) {

View file

@ -1,4 +1,3 @@
package mage.cards.h; package mage.cards.h;
import mage.MageInt; import mage.MageInt;
@ -10,14 +9,13 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.PutCards;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class HermitDruid extends CardImpl { public final class HermitDruid extends CardImpl {
@ -31,7 +29,9 @@ public final class HermitDruid extends CardImpl {
this.toughness = new MageInt(1); 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. // {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()); ability.addCost(new TapSourceCost());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,7 +1,5 @@
package mage.cards.j; package mage.cards.j;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -12,16 +10,17 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.PutCards;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class JaliraMasterPolymorphist extends CardImpl { 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. // {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. // 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 TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true)));
this.addAbility(ability); this.addAbility(ability);

View file

@ -96,7 +96,7 @@ class KethekCrucibleGoliathEffect extends OneShotEffect {
// Lesser Mana Value // Lesser Mana Value
filterCreatureCard.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue)); 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. //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); effect.apply(game, source);
return true; return true;
} }

View file

@ -41,7 +41,7 @@ public final class NissaResurgentAnimist extends CardImpl {
Ability ability = new LandfallAbility(new AddManaOfAnyColorEffect()); Ability ability = new LandfallAbility(new AddManaOfAnyColorEffect());
ability.addEffect(new IfAbilityHasResolvedXTimesEffect( ability.addEffect(new IfAbilityHasResolvedXTimesEffect(
Outcome.DrawCard, 2, Outcome.DrawCard, 2,
new RevealCardsFromLibraryUntilEffect(filter, Zone.HAND, Zone.LIBRARY) new RevealCardsFromLibraryUntilEffect(filter, PutCards.HAND, PutCards.BOTTOM_RANDOM)
).concatBy("Then")); ).concatBy("Then"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,19 +1,17 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.abilities.effects.common.DoIfClashWonEffect; import mage.abilities.effects.common.DoIfClashWonEffect;
import mage.abilities.effects.common.ReturnToHandSpellEffect; import mage.abilities.effects.common.ReturnToHandSpellEffect;
import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect; import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.PutCards;
import mage.filter.common.FilterLandCard; import mage.filter.StaticFilters;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class RecrossThePaths extends CardImpl { 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}"); 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. // 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. // Clash with an opponent. If you win, return Recross the Paths to its owner's hand.
this.getSpellAbility().addEffect(new DoIfClashWonEffect(ReturnToHandSpellEffect.getInstance())); this.getSpellAbility().addEffect(new DoIfClashWonEffect(ReturnToHandSpellEffect.getInstance()));

View file

@ -1,7 +1,6 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -12,13 +11,14 @@ import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.PutCards;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author Styxo * @author Styxo
*/ */
public final class SacredGuide extends CardImpl { public final class SacredGuide extends CardImpl {
@ -38,7 +38,9 @@ public final class SacredGuide extends CardImpl {
this.toughness = new MageInt(1); 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. // {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()); ability.addCost(new SacrificeSourceCost());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -36,7 +36,7 @@ public final class TezzeretMasterOfMetal extends CardImpl {
this.setStartingLoyalty(5); 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. // +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. // -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); Ability ability = new LoyaltyAbility(new LoseLifeTargetEffect(ArtifactYouControlCount.instance).setText("target opponent loses life equal to the number of artifacts you control"), -3);

View file

@ -1,8 +1,6 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCondition; import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
@ -11,12 +9,13 @@ import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.PutCards;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class ThicketElemental extends CardImpl { public final class ThicketElemental extends CardImpl {
@ -31,9 +30,13 @@ public final class ThicketElemental extends CardImpl {
this.addAbility(new KickerAbility("{1}{G}")); 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. // 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(
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE, new EntersBattlefieldTriggeredAbility(new RevealCardsFromLibraryUntilEffect(
"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.")); 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) { private ThicketElemental(final ThicketElemental card) {

View file

@ -20,10 +20,10 @@ import java.util.UUID;
* @author TheElk801 * @author TheElk801
*/ */
public final class VivienNaturesAvenger extends CardImpl { public final class VivienNaturesAvenger extends CardImpl {
public VivienNaturesAvenger(UUID ownerId, CardSetInfo setInfo) { public VivienNaturesAvenger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{G}{G}");
this.addSuperType(SuperType.LEGENDARY); this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.VIVIEN); this.subtype.add(SubType.VIVIEN);
this.setStartingLoyalty(3); 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. // 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( 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)); ), -1));
// 6: Target creature gets +10/+10 and gains trample until end of turn. // 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()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
} }
private VivienNaturesAvenger(final VivienNaturesAvenger card) { private VivienNaturesAvenger(final VivienNaturesAvenger card) {
super(card); super(card);
} }
@Override @Override
public VivienNaturesAvenger copy() { public VivienNaturesAvenger copy() {
return new VivienNaturesAvenger(this); return new VivienNaturesAvenger(this);

View file

@ -1,6 +1,5 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -8,10 +7,10 @@ import mage.cards.Card;
import mage.cards.Cards; import mage.cards.Cards;
import mage.cards.CardsImpl; import mage.cards.CardsImpl;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.PutCards;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.game.Game; import mage.game.Game;
import mage.players.Library;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
@ -21,35 +20,21 @@ import mage.util.CardUtil;
public class RevealCardsFromLibraryUntilEffect extends OneShotEffect { public class RevealCardsFromLibraryUntilEffect extends OneShotEffect {
private final FilterCard filter; private final FilterCard filter;
private final Zone zoneToPutRest; private final PutCards putPickedCard;
private final Zone zoneToPutCard; private final PutCards putRemainingCards;
private final boolean shuffleRestInto;
private final boolean anyOrder;
public RevealCardsFromLibraryUntilEffect(FilterCard filter, Zone zoneToPutCard, Zone zoneToPutRest) { public RevealCardsFromLibraryUntilEffect(FilterCard filter, PutCards putPickedCard, PutCards putRemainingCards) {
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) {
super(Outcome.Benefit); super(Outcome.Benefit);
this.filter = filter; this.filter = filter;
this.zoneToPutCard = zoneToPutCard; this.putPickedCard = putPickedCard;
this.zoneToPutRest = zoneToPutRest; this.putRemainingCards = putRemainingCards;
this.shuffleRestInto = shuffleRestInto;
this.anyOrder = anyOrder;
} }
private RevealCardsFromLibraryUntilEffect(final RevealCardsFromLibraryUntilEffect effect) { private RevealCardsFromLibraryUntilEffect(final RevealCardsFromLibraryUntilEffect effect) {
super(effect); super(effect);
this.filter = effect.filter; this.filter = effect.filter;
this.zoneToPutCard = effect.zoneToPutCard; this.putPickedCard = effect.putPickedCard;
this.zoneToPutRest = effect.zoneToPutRest; this.putRemainingCards = effect.putRemainingCards;
this.shuffleRestInto = effect.shuffleRestInto;
this.anyOrder = effect.anyOrder;
} }
@Override @Override
@ -57,47 +42,32 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect {
return new RevealCardsFromLibraryUntilEffect(this); 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 @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source);
if (controller == null || !controller.getLibrary().hasCards()) { if (controller == null || !controller.getLibrary().hasCards()) {
return false; return false;
} }
Cards cards = new CardsImpl(); Cards cards = new CardsImpl();
Library library = controller.getLibrary(); Card card = getCard(controller, cards, source, game);
Card card = null; controller.revealCards(source, cards, game);
do { putPickedCard.moveCard(controller, card, source, game, "card");
card = library.removeFromTop(game); if (putPickedCard.getZone() == Zone.LIBRARY) {
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
cards.remove(card); 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 { } else {
if (!cards.isEmpty()) { cards.retainZone(Zone.LIBRARY, game);
controller.moveCards(cards, zoneToPutRest, source, game);
}
} }
putRemainingCards.moveCards(controller, cards, source, game);
return true; 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 "); StringBuilder sb = new StringBuilder("reveal cards from the top of your library until you reveal ");
sb.append(CardUtil.addArticle(filter.getMessage())); sb.append(CardUtil.addArticle(filter.getMessage()));
sb.append(". Put that card "); sb.append(". Put that card ");
sb.append(putPickedCard.getMessage(false, false));
switch (zoneToPutCard) { switch (putRemainingCards) {
case HAND: { case SHUFFLE:
sb.append("into your hand"); sb.append(" and shuffle the rest into your library");
break; break;
} case EXILED:
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: {
sb.append(" and exile all other cards revealed this way."); sb.append(" and exile all other cards revealed this way.");
break; 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(); return sb.toString();
} }

View file

@ -22,7 +22,8 @@ public enum PutCards {
TOP_OR_BOTTOM(Outcome.Benefit, Zone.LIBRARY, "on the top or bottom of your library"), 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"), 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_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 Outcome outcome;
private final Zone zone; private final Zone zone;
@ -74,6 +75,8 @@ public enum PutCards {
return player.putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, false); return player.putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, false);
case BATTLEFIELD_TAPPED: case BATTLEFIELD_TAPPED:
return player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); return player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
case SHUFFLE:
return player.shuffleCardsToLibrary(card, game, source);
case BATTLEFIELD_TRANSFORMED: case BATTLEFIELD_TRANSFORMED:
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId(), Boolean.TRUE); game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId(), Boolean.TRUE);
case BATTLEFIELD: case BATTLEFIELD:
@ -98,6 +101,8 @@ public enum PutCards {
return player.putCardsOnBottomOfLibrary(cards, game, source, false); return player.putCardsOnBottomOfLibrary(cards, game, source, false);
case BATTLEFIELD_TAPPED: case BATTLEFIELD_TAPPED:
return player.moveCards(cards.getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null); 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: case BATTLEFIELD_TRANSFORMED:
cards.stream().forEach(uuid -> game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + uuid, Boolean.TRUE)); cards.stream().forEach(uuid -> game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + uuid, Boolean.TRUE));
case BATTLEFIELD: case BATTLEFIELD: