Refactor LookLibraryAndPickControllerEffect (#8841)

This commit is contained in:
Alex W. Jackson 2022-04-16 00:32:24 -04:00 committed by GitHub
parent 7db8dd11b4
commit dc7dcec39a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
195 changed files with 1463 additions and 3526 deletions

View file

@ -1,13 +1,11 @@
package mage.cards.a; package mage.cards.a;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.CasualtyAbility; import mage.abilities.keyword.CasualtyAbility;
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.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -23,10 +21,7 @@ public final class ALittleChat extends CardImpl {
this.addAbility(new CasualtyAbility(this, 1)); this.addAbility(new CasualtyAbility(this, 1));
// Look at the top two cards of your library. Put one of them into your hand and the other on the bottom of your library. // Look at the top two cards of your library. Put one of them into your hand and the other on the bottom of your library.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(2, 1, PutCards.HAND, PutCards.BOTTOM_ANY));
StaticValue.get(2), false, StaticValue.get(1),
StaticFilters.FILTER_CARD, Zone.LIBRARY, false, false
));
} }
private ALittleChat(final ALittleChat card) { private ALittleChat(final ALittleChat card) {

View file

@ -5,14 +5,13 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition; import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.SubType; import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
@ -56,9 +55,8 @@ public final class AcclaimedContender extends CardImpl {
// When Acclaimed Contender enters the battlefield, if you control another Knight, look at the top five cards of your library. You may reveal a Knight, Aura, Equipment, or legendary artifact card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // When Acclaimed Contender enters the battlefield, if you control another Knight, look at the top five cards of your library. You may reveal a Knight, Aura, Equipment, or legendary artifact card from among them and put it into your hand. Put the rest on the bottom of your library in a random order.
this.addAbility(new ConditionalInterveningIfTriggeredAbility( this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect( new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(5), false, StaticValue.get(1), filter2, Zone.LIBRARY, false, 5, 1, filter2, PutCards.HAND, PutCards.BOTTOM_RANDOM
true, false, Zone.HAND, true, false, false )), condition, "When {this} enters the battlefield, " +
).setBackInRandomOrder(true)), condition, "When {this} enters the battlefield, " +
"if you control another Knight, look at the top five cards of your library. " + "if you control another Knight, look at the top five cards of your library. " +
"You may reveal a Knight, Aura, Equipment, or legendary artifact card from among them " + "You may reveal a Knight, Aura, Equipment, or legendary artifact card from among them " +
"and put it into your hand. Put the rest on the bottom of your library in a random order." "and put it into your hand. Put the rest on the bottom of your library in a random order."

View file

@ -1,16 +1,14 @@
package mage.cards.a; package mage.cards.a;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.Mode;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.*; import mage.cards.*;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID; import java.util.UUID;
@ -22,7 +20,8 @@ public final class AdventureAwaits extends CardImpl {
public AdventureAwaits(UUID ownerId, CardSetInfo setInfo) { public AdventureAwaits(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// Look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. If you don't put a card into your hand this way, draw a card. // Look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand.
// Put the rest on the bottom of your library in a random order. If you don't put a card into your hand this way, draw a card.
this.getSpellAbility().addEffect(new AdventureAwaitsEffect()); this.getSpellAbility().addEffect(new AdventureAwaitsEffect());
} }
@ -36,14 +35,10 @@ public final class AdventureAwaits extends CardImpl {
} }
} }
class AdventureAwaitsEffect extends OneShotEffect { class AdventureAwaitsEffect extends LookLibraryAndPickControllerEffect {
AdventureAwaitsEffect() { AdventureAwaitsEffect() {
super(Outcome.Benefit); super(5, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_RANDOM);
staticText = "Look at the top five cards of your library. " +
"You may reveal a creature card from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order. " +
"If you didn't put a card into your hand this way, draw a card.";
} }
private AdventureAwaitsEffect(final AdventureAwaitsEffect effect) { private AdventureAwaitsEffect(final AdventureAwaitsEffect effect) {
@ -56,25 +51,16 @@ class AdventureAwaitsEffect extends OneShotEffect {
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
Player player = game.getPlayer(source.getControllerId()); super.actionWithPickedCards(game, source, player, pickedCards, otherCards);
if (player == null) { if (pickedCards.isEmpty()) {
return false;
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 5));
TargetCard target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_CREATURE);
player.choose(outcome, cards, target, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null && player.chooseUse(outcome, "Put " + card.getName() + " into your hand?",
"Otherwise draw a card", "Put into hand", "Draw a card", source, game
)) {
player.moveCards(card, Zone.HAND, source, game);
cards.remove(card);
player.putCardsOnBottomOfLibrary(cards, game, source, false);
} else {
player.putCardsOnBottomOfLibrary(cards, game, source, false);
player.drawCards(1, source, game); player.drawCards(1, source, game);
} }
return true; return true;
} }
@Override
public String getText(Mode mode) {
return super.getText(mode).concat(". If you didn't put a card into your hand this way, draw a card");
}
} }

View file

@ -1,14 +1,12 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.FilterCard; import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
/** /**
* *
@ -16,18 +14,14 @@ import mage.filter.predicate.Predicates;
*/ */
public final class AdventurousImpulse extends CardImpl { public final class AdventurousImpulse extends CardImpl {
private static final FilterCard filter = new FilterCard("a creature or land card");
static {
filter.add(Predicates.or(CardType.CREATURE.getPredicate(), CardType.LAND.getPredicate()));
}
public AdventurousImpulse(UUID ownerId, CardSetInfo setInfo) { public AdventurousImpulse(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}"); super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}");
//Look at the top three cards of your library. You may reveal a creature or land card from among them and put it into your hand. Put the rest on the bottom of your library in any order. // Look at the top three cards of your library.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(3), false, StaticValue.get(1), filter, false)); // You may reveal a creature or land card from among them and put it into your hand.
// Put the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
3, 1, StaticFilters.FILTER_CARD_CREATURE_OR_LAND, PutCards.HAND, PutCards.BOTTOM_ANY));
} }
private AdventurousImpulse(final AdventurousImpulse card) { private AdventurousImpulse(final AdventurousImpulse card) {

View file

@ -1,37 +1,36 @@
package mage.cards.a; package mage.cards.a;
import java.util.Objects;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.condition.Condition;
import mage.cards.*; import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.filter.StaticFilters;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
* @author jeffwadsworth * @author awjackson
*/ */
public final class AdviceFromTheFae extends CardImpl { public final class AdviceFromTheFae extends CardImpl {
public AdviceFromTheFae(UUID ownerId, CardSetInfo setInfo) { public AdviceFromTheFae(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2/U}{2/U}{2/U}"); super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2/U}{2/U}{2/U}");
// <i>({2U} can be paid with any two mana or with {U}. This card's converted mana cost is 6.)</i> // Look at the top five cards of your library. If you control more creatures than each other player,
// Look at the top five cards of your library. If you control more creatures than each other player, put two of those cards into your hand. Otherwise, put one of them into your hand. Then put the rest on the bottom of your library in any order. // put two of those cards into your hand. Otherwise, put one of them into your hand.
this.getSpellAbility().addEffect(new AdviceFromTheFaeEffect()); // Then put the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new LookLibraryAndPickControllerEffect(5, 2, PutCards.HAND, PutCards.BOTTOM_ANY),
new LookLibraryAndPickControllerEffect(5, 1, PutCards.HAND, PutCards.BOTTOM_ANY),
AdviceFromTheFaeCondition.instance, "Look at the top five cards of your library. " +
"If you control more creatures than each other player, put two of those cards into your hand. " +
"Otherwise, put one of them into your hand. Then put the rest on the bottom of your library in any order."
));
} }
private AdviceFromTheFae(final AdviceFromTheFae card) { private AdviceFromTheFae(final AdviceFromTheFae card) {
@ -44,52 +43,23 @@ public final class AdviceFromTheFae extends CardImpl {
} }
} }
class AdviceFromTheFaeEffect extends OneShotEffect { enum AdviceFromTheFaeCondition implements Condition {
instance;
public AdviceFromTheFaeEffect() {
super(Outcome.DrawCard);
this.staticText = "Look at the top five cards of your library. If you control more creatures than each other player, put two of those cards into your hand. Otherwise, put one of them into your hand. Then put the rest on the bottom of your library in any order";
}
public AdviceFromTheFaeEffect(final AdviceFromTheFaeEffect effect) {
super(effect);
}
@Override
public AdviceFromTheFaeEffect copy() {
return new AdviceFromTheFaeEffect(this);
}
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source);
if (controller != null && mageObject != null) {
Set<Card> topCards = controller.getLibrary().getTopCards(game, 5);
Cards cardsFromLibrary = new CardsImpl();
for (Card card : topCards) {
cardsFromLibrary.add(card);
}
controller.lookAtCards(mageObject.getIdName(), cardsFromLibrary, game);
int max = 0; int max = 0;
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { UUID controllerId = source.getControllerId();
FilterCreaturePermanent filter = new FilterCreaturePermanent(); for (UUID playerId : game.getState().getPlayersInRange(controllerId, game)) {
filter.add(new ControllerIdPredicate(playerId)); if (!playerId.equals(controllerId)) {
if (!Objects.equals(playerId, controller.getId())) { max = Math.max(max, game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, playerId, game));
if (max < game.getBattlefield().countAll(filter, playerId, game)) {
max = game.getBattlefield().countAll(filter, playerId, game);
} }
} }
return game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, controllerId, game) > max;
} }
boolean moreCreatures = game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), controller.getId(), game) > max;
TargetCard target = new TargetCard(moreCreatures ? 2 : 1, Zone.LIBRARY, new FilterCard()); @Override
if (controller.choose(Outcome.DrawCard, cardsFromLibrary, target, game)) { public String toString() {
cardsFromLibrary.removeAll(target.getTargets()); return "you control more creatures than each other player";
controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
}
controller.putCardsOnBottomOfLibrary(cardsFromLibrary, game, source, true);
return true;
}
return false;
} }
} }

View file

@ -6,6 +6,7 @@ import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.counter.DistributeCountersEffect; import mage.abilities.effects.common.counter.DistributeCountersEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -13,7 +14,6 @@ import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
@ -49,8 +49,9 @@ public final class AjaniMentorOfHeroes extends CardImpl {
ability.addTarget(new TargetCreaturePermanentAmount(3, filter)); ability.addTarget(new TargetCreaturePermanentAmount(3, filter));
this.addAbility(ability); this.addAbility(ability);
// +1: Look at the top four cards of your library. You may reveal an Aura, creature, or planeswalker card from among them and put that card into your hand. Put the rest on the bottom of your library in any order. // +1: Look at the top four cards of your library. You may reveal an Aura, creature, or planeswalker card
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(4, 1, filterCard, true, false, Zone.HAND, true), 1)); // from among them and put it into your hand. Put the rest on the bottom of your library in any order.
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(4, 1, filterCard, PutCards.HAND, PutCards.BOTTOM_ANY), 1));
// -8: You gain 100 life. // -8: You gain 100 life.
this.addAbility(new LoyaltyAbility(new GainLifeEffect(100), -8)); this.addAbility(new LoyaltyAbility(new GainLifeEffect(100), -8));

View file

@ -2,13 +2,12 @@ package mage.cards.a;
import java.util.UUID; import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
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.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
@ -35,12 +34,7 @@ public final class AjanisInfluence extends CardImpl {
// Look at the top five cards of your library. You may reveal a white card form among them and put it into your hand. Put the rest on the bottom of your library in a random order. // Look at the top five cards of your library. You may reveal a white card form among them and put it into your hand. Put the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
StaticValue.get(5), false, StaticValue.get(1), filter, 5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM).concatBy("<br>"));
Zone.LIBRARY, false, true, false, Zone.HAND, true, false, false
).setBackInRandomOrder(true).setText("<br>Look at the top five cards of your library. "
+ "You may reveal a white card from among them and put it into your hand. "
+ "Put the rest on the bottom of your library in a random order.")
);
} }
private AjanisInfluence(final AjanisInfluence card) { private AjanisInfluence(final AjanisInfluence card) {

View file

@ -1,12 +1,10 @@
package mage.cards.a; package mage.cards.a;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -19,8 +17,7 @@ public final class AncestralMemories extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{U}{U}");
// Look at the top seven cards of your library. Put two of them into your hand and the rest into your graveyard. // Look at the top seven cards of your library. Put two of them into your hand and the rest into your graveyard.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(7), false, StaticValue.get(2), this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(7, 2, PutCards.HAND, PutCards.GRAVEYARD));
StaticFilters.FILTER_CARD, Zone.GRAVEYARD, false, false, false, Zone.HAND, false));
} }
private AncestralMemories(final AncestralMemories card) { private AncestralMemories(final AncestralMemories card) {

View file

@ -1,14 +1,11 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorlessPredicate; import mage.filter.predicate.mageobject.ColorlessPredicate;
@ -23,15 +20,12 @@ public final class AncientStirrings extends CardImpl {
filter.add(ColorlessPredicate.instance); filter.add(ColorlessPredicate.instance);
} }
public AncientStirrings(UUID ownerId, CardSetInfo setInfo) { public AncientStirrings(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}"); super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}");
// Look at the top five cards of your library. You may reveal a colorless card from among them and put it into your hand. // Look at the top five cards of your library. You may reveal a colorless card from among them and put it into your hand.
// Then put the rest on the bottom of your library in any order. (Cards with no colored mana in their mana costs are colorless. Lands are also colorless.) // Then put the rest on the bottom of your library in any order. (Cards with no colored mana in their mana costs are colorless. Lands are also colorless.)
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(5), false, StaticValue.get(1), filter, Zone.LIBRARY, this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(5, 1, filter, PutCards.HAND, PutCards.BOTTOM_ANY));
false, true, false, Zone.HAND, true));
} }
private AncientStirrings(final AncientStirrings card) { private AncientStirrings(final AncientStirrings card) {
@ -42,5 +36,4 @@ public final class AncientStirrings extends CardImpl {
public AncientStirrings copy() { public AncientStirrings copy() {
return new AncientStirrings(this); return new AncientStirrings(this);
} }
} }

View file

@ -1,12 +1,10 @@
package mage.cards.a; package mage.cards.a;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -19,11 +17,7 @@ public final class Anticipate extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order. // Look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(3, 1, PutCards.HAND, PutCards.BOTTOM_ANY));
StaticValue.get(3), false, StaticValue.get(1),
StaticFilters.FILTER_CARD, Zone.LIBRARY, false, false
).setText("look at the top three cards of your library. " +
"Put one of them into your hand and the rest on the bottom of your library in any order"));
} }
private Anticipate(final Anticipate card) { private Anticipate(final Anticipate card) {

View file

@ -1,14 +1,12 @@
package mage.cards.a; package mage.cards.a;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.FlashbackAbility; import mage.abilities.keyword.FlashbackAbility;
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.TimingRule;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -23,13 +21,7 @@ public final class ArcaneInfusion extends CardImpl {
// Look at the top four cards of your library. You may reveal an instant or sorcery card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // Look at the top four cards of your library. You may reveal an instant or sorcery card from among them and put it into your hand. Put the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
StaticValue.get(4), false, StaticValue.get(1), 4, 1, StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, PutCards.HAND, PutCards.BOTTOM_RANDOM));
StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, Zone.LIBRARY,
false, true, false, Zone.HAND,
true, false, false
).setBackInRandomOrder(true).setText("Look at the top four cards of your library. " +
"You may reveal an instant or sorcery card from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order."));
// Flashback {3}{U}{R} // Flashback {3}{U}{R}
this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{3}{U}{R}"))); this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{3}{U}{R}")));

View file

@ -3,16 +3,14 @@ package mage.cards.a;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.RollDieWithResultTableEffect; import mage.abilities.effects.common.RollDieWithResultTableEffect;
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.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -39,11 +37,7 @@ public final class ArcaneInvestigator extends CardImpl {
effect.addTableEntry(1, 9, new DrawCardSourceControllerEffect(1)); effect.addTableEntry(1, 9, new DrawCardSourceControllerEffect(1));
// 10-20 | Look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order. // 10-20 | Look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order.
effect.addTableEntry(10, 20, new LookLibraryAndPickControllerEffect( effect.addTableEntry(10, 20, new LookLibraryAndPickControllerEffect(3, 1, PutCards.HAND, PutCards.BOTTOM_ANY));
StaticValue.get(3), false, StaticValue.get(1),
StaticFilters.FILTER_CARD, Zone.LIBRARY, false, false
).setText("look at the top three cards of your library. Put one of them " +
"into your hand and the rest on the bottom of your library in any order"));
} }
private ArcaneInvestigator(final ArcaneInvestigator card) { private ArcaneInvestigator(final ArcaneInvestigator card) {

View file

@ -2,14 +2,13 @@ package mage.cards.a;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
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.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterArtifactOrEnchantmentCard; import mage.filter.common.FilterArtifactOrEnchantmentCard;
@ -32,16 +31,11 @@ public final class ArcanistsOwl extends CardImpl {
// Flying // Flying
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Arcanist's Owl enters the battlefield, look at the top four cards of your library. You may reveal an artifact or enchantment card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // When Arcanist's Owl enters the battlefield, look at the top four cards of your library.
// You may reveal an artifact or enchantment card from among them and put it into your hand.
// Put the rest on the bottom of your library in a random order.
this.addAbility(new EntersBattlefieldTriggeredAbility( this.addAbility(new EntersBattlefieldTriggeredAbility(
new LookLibraryAndPickControllerEffect( new LookLibraryAndPickControllerEffect(4, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM)));
StaticValue.get(4), false, StaticValue.get(1), filter,
Zone.LIBRARY, false, true, false, Zone.HAND,
true, false, false
).setBackInRandomOrder(true).setText("look at the top four cards of your library. " +
"You may reveal an artifact or enchantment card from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order.")
));
} }
private ArcanistsOwl(final ArcanistsOwl card) { private ArcanistsOwl(final ArcanistsOwl card) {

View file

@ -1,36 +1,22 @@
package mage.cards.a; package mage.cards.a;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.cards.*; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.filter.StaticFilters;
import mage.filter.FilterCard;
import mage.filter.common.FilterInstantOrSorceryCard;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
/** /**
* @author jeffwadsworth * @author awjackson
*/ */
public final class AugurOfBolas extends CardImpl { public final class AugurOfBolas extends CardImpl {
private static final FilterCard filter = new FilterCard("an instant or sorcery card");
static {
filter.add(Predicates.or(CardType.INSTANT.getPredicate(), CardType.SORCERY.getPredicate()));
}
public AugurOfBolas(UUID ownerId, CardSetInfo setInfo) { public AugurOfBolas(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add(SubType.MERFOLK); this.subtype.add(SubType.MERFOLK);
@ -39,8 +25,11 @@ public final class AugurOfBolas extends CardImpl {
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// When Augur of Bolas enters the battlefield, look at the top three cards of your library. You may reveal an instant or sorcery card from among them and put it into your hand. Put the rest on the bottom of your library in any order. // When Augur of Bolas enters the battlefield, look at the top three cards of your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new AugurOfBolasEffect())); // You may reveal an instant or sorcery card from among them and put it into your hand.
// Put the rest on the bottom of your library in any order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
3, 1, StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, PutCards.HAND, PutCards.BOTTOM_ANY)));
} }
private AugurOfBolas(final AugurOfBolas card) { private AugurOfBolas(final AugurOfBolas card) {
@ -52,57 +41,3 @@ public final class AugurOfBolas extends CardImpl {
return new AugurOfBolas(this); return new AugurOfBolas(this);
} }
} }
class AugurOfBolasEffect extends OneShotEffect {
public AugurOfBolasEffect() {
super(Outcome.DrawCard);
this.staticText = "look at the top three cards of your library. You may reveal an instant or sorcery card from among them and put it into your hand. Put the rest on the bottom of your library in any order";
}
public AugurOfBolasEffect(final AugurOfBolasEffect effect) {
super(effect);
}
@Override
public AugurOfBolasEffect copy() {
return new AugurOfBolasEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source);
if (controller != null && sourceObject != null) {
Cards topCards = new CardsImpl();
topCards.addAll(controller.getLibrary().getTopCards(game, 3));
if (!topCards.isEmpty()) {
controller.lookAtCards(sourceObject.getIdName(), topCards, game);
int number = topCards.count(new FilterInstantOrSorceryCard(), source.getControllerId(), source, game);
if (number > 0) {
if (controller.chooseUse(outcome, "Reveal an instant or sorcery card from the looked at cards and put it into your hand?", source, game)) {
Card card = null;
if (number == 1) {
Set<Card> cards = topCards.getCards(new FilterInstantOrSorceryCard(), source.getControllerId(), source, game);
if (!cards.isEmpty()) {
card = cards.iterator().next();
}
} else {
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterInstantOrSorceryCard());
controller.chooseTarget(outcome, topCards, target, source, game);
card = topCards.get(target.getFirstTarget(), game);
}
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
topCards.remove(card);
}
}
}
controller.putCardsOnBottomOfLibrary(topCards, game, source, true);
}
return true;
}
return false;
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID; import java.util.UUID;
@ -6,14 +5,13 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.mana.BlueManaAbility; import mage.abilities.mana.BlueManaAbility;
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.SuperType; import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -44,11 +42,8 @@ public final class AzcantaTheSunkenRuin extends CardImpl {
// {2}{U} , {T} : Look at the top four cards of your library. You may reveal a noncreature, nonland card from among them and put it into your hand. Put the rest on the bottom of your library in any order. // {2}{U} , {T} : Look at the top four cards of your library. You may reveal a noncreature, nonland card from among them and put it into your hand. Put the rest on the bottom of your library in any order.
Ability ability = new SimpleActivatedAbility( Ability ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD, new LookLibraryAndPickControllerEffect(4, 1, filter, PutCards.HAND, PutCards.BOTTOM_ANY),
new LookLibraryAndPickControllerEffect( new ManaCostsImpl<>("{2}{U}")
StaticValue.get(4), false, StaticValue.get(1),
filter, Zone.LIBRARY, false, true, true
), new ManaCostsImpl<>("{2}{U}")
); );
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
this.addAbility(ability); this.addAbility(ability);

View file

@ -2,11 +2,11 @@ package mage.cards.b;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.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;
@ -24,9 +24,7 @@ public final class BasicConjuration extends CardImpl {
// Look at the top six cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. You gain 3 life. // Look at the top six cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. You gain 3 life.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
6, 1, StaticFilters.FILTER_CARD_CREATURE_A, 6, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_RANDOM));
true, false, Zone.HAND, true
).setBackInRandomOrder(true));
this.getSpellAbility().addEffect(new GainLifeEffect(3)); this.getSpellAbility().addEffect(new GainLifeEffect(3));
} }

View file

@ -1,14 +1,12 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect; import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.cards.*; import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/** /**
* *
@ -20,8 +18,7 @@ public final class BitterRevelation extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
// Look at the top four cards of your library. Put two of them into your hand and the rest into your graveyard. You lose 2 life. // Look at the top four cards of your library. Put two of them into your hand and the rest into your graveyard. You lose 2 life.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(4), false, StaticValue.get(2), this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(4, 2, PutCards.HAND, PutCards.GRAVEYARD));
StaticFilters.FILTER_CARD, Zone.GRAVEYARD, false, false, false, Zone.HAND, false));
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(2)); this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(2));
} }

View file

@ -6,21 +6,18 @@ import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.common.DiesSourceTriggeredAbility; import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.cards.Cards; import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.cards.ModalDoubleFacesCard; import mage.cards.ModalDoubleFacesCard;
import mage.constants.*; import mage.constants.*;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
@ -81,15 +78,11 @@ public final class BlexVexingPest extends ModalDoubleFacesCard {
} }
} }
class SearchForBlexEffect extends LookLibraryControllerEffect { class SearchForBlexEffect extends LookLibraryAndPickControllerEffect {
private static final FilterCard filter = new FilterCard("cards to put into your hand"); SearchForBlexEffect() {
super(5, Integer.MAX_VALUE, PutCards.HAND, PutCards.GRAVEYARD);
public SearchForBlexEffect() { this.optional = true;
super(Outcome.DrawCard, StaticValue.get(5), false, Zone.GRAVEYARD, true);
this.staticText = "Look at the top five cards of your library. "
+ "You may put any number of them into your hand and the rest into your graveyard. "
+ "You lose 3 life for each card you put into your hand this way";
} }
private SearchForBlexEffect(final SearchForBlexEffect effect) { private SearchForBlexEffect(final SearchForBlexEffect effect) {
@ -102,21 +95,14 @@ class SearchForBlexEffect extends LookLibraryControllerEffect {
} }
@Override @Override
protected void actionWithSelectedCards(Cards cards, Game game, Ability source) { protected boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
Player player = game.getPlayer(source.getControllerId()); super.actionWithPickedCards(game, source, player, pickedCards, otherCards);
if (player != null) {
TargetCard target = new TargetCard(0, 5, Zone.LIBRARY, filter);
if (player.choose(outcome, cards, target, game)) {
Cards pickedCards = new CardsImpl(target.getTargets());
cards.removeAll(pickedCards);
player.moveCards(pickedCards, Zone.HAND, source, game);
player.loseLife(pickedCards.size() * 3, game, source, false); player.loseLife(pickedCards.size() * 3, game, source, false);
} return true;
}
} }
@Override @Override
public String getText(Mode mode) { public String getText(Mode mode) {
return staticText; return super.getText(mode).concat(". You lose 3 life for each card you put into your hand this way");
} }
} }

View file

@ -1,13 +1,11 @@
package mage.cards.b; package mage.cards.b;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect; import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
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.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -20,13 +18,7 @@ public final class BloodPrice extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
// Look at the top four cards of your library. Put two of them into your hand and the rest on the bottom of your library in any order. You lose 2 life. // Look at the top four cards of your library. Put two of them into your hand and the rest on the bottom of your library in any order. You lose 2 life.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(4, 2, PutCards.HAND, PutCards.BOTTOM_ANY));
StaticValue.get(4), false, StaticValue.get(2),
StaticFilters.FILTER_CARD, Zone.LIBRARY, false,
false, false, Zone.HAND, false,
false, true
).setText("Look at the top four cards of your library. " +
"Put two of them into your hand and the rest on the bottom of your library in any order"));
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(2)); this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(2));
} }

View file

@ -2,20 +2,18 @@ package mage.cards.b;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.ReachAbility; import mage.abilities.keyword.ReachAbility;
import mage.cards.*; import mage.cards.*;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID; import java.util.UUID;
@ -34,7 +32,10 @@ public final class BlossomPrancer extends CardImpl {
// Reach // Reach
this.addAbility(ReachAbility.getInstance()); this.addAbility(ReachAbility.getInstance());
// When Blossom Prancer enters the battlefield, look at the top five cards of your library. You may reveal a creature or enchantment card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. If you didn't put a card into your hand this way, you gain 4 life. // When Blossom Prancer enters the battlefield, look at the top five cards of your library.
// You may reveal a creature or enchantment card from among them and put it into your hand.
// Put the rest on the bottom of your library in a random order.
// If you didn't put a card into your hand this way, you gain 4 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(new BlossomPrancerEffect())); this.addAbility(new EntersBattlefieldTriggeredAbility(new BlossomPrancerEffect()));
} }
@ -48,7 +49,7 @@ public final class BlossomPrancer extends CardImpl {
} }
} }
class BlossomPrancerEffect extends OneShotEffect { class BlossomPrancerEffect extends LookLibraryAndPickControllerEffect {
private static final FilterCard filter = new FilterCard("creature or enchantment card"); private static final FilterCard filter = new FilterCard("creature or enchantment card");
@ -60,10 +61,7 @@ class BlossomPrancerEffect extends OneShotEffect {
} }
BlossomPrancerEffect() { BlossomPrancerEffect() {
super(Outcome.Benefit); super(5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM);
staticText = "look at the top five cards of your library. You may reveal a creature or enchantment card from " +
"among them and put it into your hand. Put the rest on the bottom of your library in a random order. " +
"If you didn't put a card into your hand this way, you gain 4 life";
} }
private BlossomPrancerEffect(final BlossomPrancerEffect effect) { private BlossomPrancerEffect(final BlossomPrancerEffect effect) {
@ -76,24 +74,16 @@ class BlossomPrancerEffect extends OneShotEffect {
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
Player player = game.getPlayer(source.getControllerId()); super.actionWithPickedCards(game, source, player, pickedCards, otherCards);
if (player == null) { if (pickedCards.isEmpty()) {
return false;
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 5));
TargetCard target = new TargetCardInLibrary(0, 1, filter);
player.choose(outcome, cards, target, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.revealCards(source, new CardsImpl(card), game);
player.moveCards(card, Zone.HAND, source, game);
cards.remove(card);
player.putCardsOnBottomOfLibrary(cards, game, source, false);
} else {
player.putCardsOnBottomOfLibrary(cards, game, source, false);
player.gainLife(4, game, source); player.gainLife(4, game, source);
} }
return true; return true;
} }
@Override
public String getText(Mode mode) {
return super.getText(mode).concat(". If you didn't put a card into your hand this way, you gain 4 life");
}
} }

View file

@ -1,12 +1,11 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.HistoricPredicate; import mage.filter.predicate.mageobject.HistoricPredicate;
@ -27,10 +26,7 @@ public final class BoardTheWeatherlight extends CardImpl {
// Look at the top five cards of your library. You may reveal a historic card from among them and put it into your hand. Put the rest on the bottom of your library in random order. // Look at the top five cards of your library. You may reveal a historic card from among them and put it into your hand. Put the rest on the bottom of your library in random order.
this.getSpellAbility().addEffect( this.getSpellAbility().addEffect(
new LookLibraryAndPickControllerEffect( new LookLibraryAndPickControllerEffect(5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM)
StaticValue.get(5), false, StaticValue.get(1), filter,
Zone.LIBRARY, false, true, false, Zone.HAND, true, false, false)
.setBackInRandomOrder(true)
.setText("Look at the top five cards of your library. You may reveal a historic card from among them" .setText("Look at the top five cards of your library. You may reveal a historic card from among them"
+ " and put it into your hand. Put the rest on the bottom of your library in a random order. " + " and put it into your hand. Put the rest on the bottom of your library in a random order. "
+ "<i>(Artifacts, legendaries, and Sagas are historic.)</i>") + "<i>(Artifacts, legendaries, and Sagas are historic.)</i>")

View file

@ -1,8 +1,8 @@
package mage.cards.b; package mage.cards.b;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -22,11 +22,8 @@ public final class BondOfFlourishing extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// Look at the top three card of your library. You may reveal a permanent card from among them and put it into your hand. Put the rest on the bottom of your library in any order. You gain 3 life. // Look at the top three card of your library. You may reveal a permanent card from among them and put it into your hand. Put the rest on the bottom of your library in any order. You gain 3 life.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(3, 1, filter, PutCards.HAND, PutCards.BOTTOM_ANY));
StaticValue.get(3), false, this.getSpellAbility().addEffect(new GainLifeEffect(3));
StaticValue.get(1), filter, false
));
this.getSpellAbility().addEffect(new GainLifeEffect(3).setText("You gain 3 life."));
} }
private BondOfFlourishing(final BondOfFlourishing card) { private BondOfFlourishing(final BondOfFlourishing card) {

View file

@ -3,12 +3,12 @@ package mage.cards.b;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.DiesSourceTriggeredAbility; import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.VigilanceAbility;
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.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;
@ -31,9 +31,7 @@ public final class BrazenUpstart extends CardImpl {
// When Brazen Upstart dies, look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // When Brazen Upstart dies, look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order.
this.addAbility(new DiesSourceTriggeredAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new DiesSourceTriggeredAbility(new LookLibraryAndPickControllerEffect(
5, 1, StaticFilters.FILTER_CARD_CREATURE_A, 5, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_RANDOM)));
true, false, Zone.HAND, true
).setBackInRandomOrder(true)));
} }
private BrazenUpstart(final BrazenUpstart card) { private BrazenUpstart(final BrazenUpstart card) {

View file

@ -6,11 +6,11 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.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;
@ -28,11 +28,11 @@ public final class BrightwoodTracker extends CardImpl {
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// {5}{G}, {T}: Look at the top four cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // {5}{G}, {T}: Look at the top four cards of your library. You may reveal a creature card from among them and put it into your hand.
Ability ability = new SimpleActivatedAbility(new LookLibraryAndPickControllerEffect( // Put the rest on the bottom of your library in a random order.
4, 1, StaticFilters.FILTER_CARD_CREATURE_A, Ability ability = new SimpleActivatedAbility(
true, false, Zone.HAND, true new LookLibraryAndPickControllerEffect(4, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_RANDOM),
).setBackInRandomOrder(true), new ManaCostsImpl("{5}{G}")); new ManaCostsImpl("{5}{G}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -7,6 +7,7 @@ import mage.abilities.LoyaltyAbility;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect; import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -56,12 +57,11 @@ public final class CalixDestinysHand extends CardImpl {
this.subtype.add(SubType.CALIX); this.subtype.add(SubType.CALIX);
this.setStartingLoyalty(4); this.setStartingLoyalty(4);
// +1: Look at the top four cards of your library. You may reveal an enchantment card from among them and put that card into your hand. Put the rest on the bottom of your library in a random order. // +1: Look at the top four cards of your library. You may reveal an enchantment card from among them and put that card into your hand.
// Put the rest on the bottom of your library in a random order.
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(4), false, StaticValue.get(1), filter, 4, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM
Zone.LIBRARY, false, true, false, ).setText("Look at the top four cards of your library. "
Zone.HAND, true, false, false
).setBackInRandomOrder(true).setText("Look at the top four cards of your library. "
+ "You may reveal an enchantment card from among them and put that card into your hand. " + "You may reveal an enchantment card from among them and put that card into your hand. "
+ "Put the rest on the bottom of your library in a random order."), 1 + "Put the rest on the bottom of your library in a random order."), 1
)); ));

View file

@ -7,6 +7,7 @@ import mage.abilities.LoyaltyAbility;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.constants.*; import mage.constants.*;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -56,9 +57,7 @@ class CarthTheLionTriggeredAbility extends TriggeredAbilityImpl {
public CarthTheLionTriggeredAbility() { public CarthTheLionTriggeredAbility() {
super(Zone.BATTLEFIELD, new LookLibraryAndPickControllerEffect( super(Zone.BATTLEFIELD, new LookLibraryAndPickControllerEffect(
7, 1, filter, true, false, Zone.HAND, true) 7, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM));
.setBackInRandomOrder(true)
);
} }
private CarthTheLionTriggeredAbility(final CarthTheLionTriggeredAbility ability) { private CarthTheLionTriggeredAbility(final CarthTheLionTriggeredAbility ability) {

View file

@ -2,20 +2,12 @@ package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.LookLibraryControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
@ -27,7 +19,8 @@ public final class CartographersSurvey extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}");
// Look at the top seven cards of your library. Put up to two land cards from among them onto the battlefield tapped. Put the rest on the bottom of your library in a random order. // Look at the top seven cards of your library. Put up to two land cards from among them onto the battlefield tapped. Put the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new CartographersSurveyEffect()); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
7, 2, StaticFilters.FILTER_CARD_LANDS, PutCards.BATTLEFIELD_TAPPED, PutCards.BOTTOM_RANDOM, false));
} }
private CartographersSurvey(final CartographersSurvey card) { private CartographersSurvey(final CartographersSurvey card) {
@ -39,35 +32,3 @@ public final class CartographersSurvey extends CardImpl {
return new CartographersSurvey(this); return new CartographersSurvey(this);
} }
} }
class CartographersSurveyEffect extends LookLibraryControllerEffect {
public CartographersSurveyEffect() {
super(Outcome.PutLandInPlay, StaticValue.get(7), false, Zone.LIBRARY, false);
this.setBackInRandomOrder(true);
staticText = "Look at the top seven cards of your library. Put up to two land cards from among them onto the battlefield tapped. Put the rest on the bottom of your library in a random order";
}
private CartographersSurveyEffect(final CartographersSurveyEffect effect) {
super(effect);
}
@Override
public CartographersSurveyEffect copy() {
return new CartographersSurveyEffect(this);
}
@Override
protected void actionWithSelectedCards(Cards cards, Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCard target = new TargetCard(0, 2, Zone.LIBRARY, StaticFilters.FILTER_CARD_LANDS);
controller.choose(outcome, cards, target, game);
Cards pickedCards = new CardsImpl(target.getTargets());
if (!pickedCards.isEmpty()) {
cards.removeAll(pickedCards);
controller.moveCards(pickedCards.getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
}
}
}
}

View file

@ -5,27 +5,24 @@ import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility; import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.common.ExileSourceFromGraveCost; import mage.abilities.costs.common.ExileSourceFromGraveCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.PutOnLibraryTargetEffect; import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.abilities.effects.common.RevealLibraryPickControllerEffect;
import mage.abilities.keyword.ReachAbility; import mage.abilities.keyword.ReachAbility;
import mage.cards.*; import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterLandCard; import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID; import java.util.UUID;
/** /**
* @author TheElk801 * @author awjackson
*/ */
public final class CavalierOfThorns extends CardImpl { public final class CavalierOfThorns extends CardImpl {
@ -46,8 +43,10 @@ public final class CavalierOfThorns extends CardImpl {
// Reach // Reach
this.addAbility(ReachAbility.getInstance()); this.addAbility(ReachAbility.getInstance());
// When Cavalier of Thorns enters the battlefield, reveal the top five cards of your library. You may put a land card from among them onto the battlefield. Put the rest into your graveyard. // When Cavalier of Thorns enters the battlefield, reveal the top five cards of your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CavalierOfThornsEffect())); // Put a land card from among them onto the battlefield and the rest into your graveyard.
this.addAbility(new EntersBattlefieldTriggeredAbility(new RevealLibraryPickControllerEffect(
5, 1, StaticFilters.FILTER_CARD_LAND_A, PutCards.BATTLEFIELD, PutCards.GRAVEYARD, false)));
// When Cavalier of Thorns dies, you may exile it. If you do, put another target card from your graveyard on top of your library. // When Cavalier of Thorns dies, you may exile it. If you do, put another target card from your graveyard on top of your library.
Ability ability = new DiesSourceTriggeredAbility(new DoIfCostPaid( Ability ability = new DiesSourceTriggeredAbility(new DoIfCostPaid(
@ -66,47 +65,3 @@ public final class CavalierOfThorns extends CardImpl {
return new CavalierOfThorns(this); return new CavalierOfThorns(this);
} }
} }
class CavalierOfThornsEffect extends OneShotEffect {
private static final FilterCard filter = new FilterLandCard("land card to put on the battlefield");
CavalierOfThornsEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "reveal the top five cards of your library. " +
"Put a land card from among them onto the battlefield and the rest into your graveyard.";
}
private CavalierOfThornsEffect(final CavalierOfThornsEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
if (cards.isEmpty()) {
return true;
}
controller.revealCards(source, cards, game);
TargetCard target = new TargetCard(1, 1, Zone.LIBRARY, filter);
if (cards.getCards(game).stream().anyMatch(card1 -> card1.isLand(game))
&& controller.choose(Outcome.PutCardInPlay, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
return true;
}
@Override
public CavalierOfThornsEffect copy() {
return new CavalierOfThornsEffect(this);
}
}

View file

@ -3,14 +3,12 @@ package mage.cards.c;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.BecomeDayAsEntersAbility; import mage.abilities.common.BecomeDayAsEntersAbility;
import mage.abilities.common.BecomesDayOrNightTriggeredAbility; import mage.abilities.common.BecomesDayOrNightTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -31,10 +29,8 @@ public final class CelestusSanctifier extends CardImpl {
this.addAbility(new BecomeDayAsEntersAbility()); this.addAbility(new BecomeDayAsEntersAbility());
// Whenever day becomes night or night becomes day, look at the top two cards of your library. Put one of them into your graveyard. // Whenever day becomes night or night becomes day, look at the top two cards of your library. Put one of them into your graveyard.
this.addAbility(new BecomesDayOrNightTriggeredAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new BecomesDayOrNightTriggeredAbility(
StaticValue.get(2), false, StaticValue.get(1), StaticFilters.FILTER_CARD, new LookLibraryAndPickControllerEffect(2, 1, PutCards.GRAVEYARD, PutCards.TOP_ANY)));
Zone.LIBRARY, true, false, false, Zone.GRAVEYARD, false
).setText("look at the top two cards of your library. Put one of them into your graveyard")));
} }
private CelestusSanctifier(final CelestusSanctifier card) { private CelestusSanctifier(final CelestusSanctifier card) {

View file

@ -1,14 +1,14 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.ComparisonType; import mage.constants.ComparisonType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ManaValuePredicate; import mage.filter.predicate.mageobject.ManaValuePredicate;
/** /**
@ -17,20 +17,18 @@ import mage.filter.predicate.mageobject.ManaValuePredicate;
*/ */
public final class CollectedCompany extends CardImpl { public final class CollectedCompany extends CardImpl {
private static final FilterCard filter = new FilterCard("up to two creature cards with mana value 3 or less"); private static final FilterCard filter = new FilterCreatureCard("creature cards with mana value 3 or less");
static { static {
filter.add(CardType.CREATURE.getPredicate());
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 4)); filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 4));
} }
public CollectedCompany(UUID ownerId, CardSetInfo setInfo) { public CollectedCompany(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{G}"); super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{G}");
// Look at the top six cards of your library. Put up to two creature cards with converted mana cost 3 or less from among them onto the battlefield. // Look at the top six cards of your library. Put up to two creature cards with mana value 3 or less from among them onto the battlefield.
// Put the rest on the bottom of your library in any order. // Put the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(6, 2, filter, false, true, Zone.BATTLEFIELD, false)); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(6, 2, filter, PutCards.BATTLEFIELD, PutCards.BOTTOM_ANY, false));
} }
private CollectedCompany(final CollectedCompany card) { private CollectedCompany(final CollectedCompany card) {

View file

@ -1,9 +1,8 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -30,7 +29,7 @@ public final class CommuneWithDinosaurs extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}");
//Look at the top five cards of your library. You may reveal a Dinosaur or land card from among them and put it into your hand. Put the rest on the bottom of your library in any order. //Look at the top five cards of your library. You may reveal a Dinosaur or land card from among them and put it into your hand. Put the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(5), false, StaticValue.get(1), filter, false)); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(5, 1, filter, PutCards.HAND, PutCards.BOTTOM_ANY));
} }
private CommuneWithDinosaurs(final CommuneWithDinosaurs card) { private CommuneWithDinosaurs(final CommuneWithDinosaurs card) {

View file

@ -1,13 +1,12 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.common.FilterCreatureCard; import mage.filter.StaticFilters;
/** /**
* *
@ -18,12 +17,10 @@ public final class CommuneWithNature extends CardImpl {
public CommuneWithNature(UUID ownerId, CardSetInfo setInfo) { public CommuneWithNature(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}");
// Look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in any order. // Look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand.
this.getSpellAbility().addEffect( // Put the rest on the bottom of your library in any order.
new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
StaticValue.get(5), false, StaticValue.get(1), new FilterCreatureCard("a creature card"), false 5, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_ANY));
)
);
} }
private CommuneWithNature(final CommuneWithNature card) { private CommuneWithNature(final CommuneWithNature card) {
@ -34,5 +31,4 @@ public final class CommuneWithNature extends CardImpl {
public CommuneWithNature copy() { public CommuneWithNature copy() {
return new CommuneWithNature(this); return new CommuneWithNature(this);
} }
} }

View file

@ -1,11 +1,10 @@
package mage.cards.c; package mage.cards.c;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -28,13 +27,9 @@ public final class CommuneWithSpirits extends CardImpl {
public CommuneWithSpirits(UUID ownerId, CardSetInfo setInfo) { public CommuneWithSpirits(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}");
// Look at the top four cards of your library. You may reveal an enchantment or land card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // Look at the top four cards of your library. You may reveal an enchantment or land card from among them and put it into your hand.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( // Put the rest on the bottom of your library in a random order.
StaticValue.get(4), false, StaticValue.get(1), filter, Zone.LIBRARY, false, this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(4, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM));
true, false, Zone.HAND, true, false, false
).setBackInRandomOrder(true).setText("look at the top four cards of your library. " +
"You may reveal an enchantment or land card from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order"));
} }
private CommuneWithSpirits(final CommuneWithSpirits card) { private CommuneWithSpirits(final CommuneWithSpirits card) {

View file

@ -1,31 +1,35 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.RevealLibraryPickControllerEffect;
import mage.cards.*; import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
* @author LevelX2 * @author awjackson
*/ */
public final class CommuneWithTheGods extends CardImpl { public final class CommuneWithTheGods extends CardImpl {
private static final FilterCard filter = new FilterCard("a creature or enchantment card");
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.ENCHANTMENT.getPredicate()
));
}
public CommuneWithTheGods(UUID ownerId, CardSetInfo setInfo) { public CommuneWithTheGods(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// Reveal the top five cards of your library. You may put a creature or enchantment card from among them into your hand. Put the rest into your graveyard. // Reveal the top five cards of your library. You may put a creature or enchantment card from among them into your hand.
this.getSpellAbility().addEffect(new CommuneWithTheGodsEffect()); // Put the rest into your graveyard.
this.getSpellAbility().addEffect(new RevealLibraryPickControllerEffect(5, 1, filter, PutCards.HAND, PutCards.GRAVEYARD));
} }
private CommuneWithTheGods(final CommuneWithTheGods card) { private CommuneWithTheGods(final CommuneWithTheGods card) {
@ -37,47 +41,3 @@ public final class CommuneWithTheGods extends CardImpl {
return new CommuneWithTheGods(this); return new CommuneWithTheGods(this);
} }
} }
class CommuneWithTheGodsEffect extends OneShotEffect {
public CommuneWithTheGodsEffect() {
super(Outcome.DrawCard);
this.staticText = "Reveal the top five cards of your library. You may put a creature or enchantment card from among them into your hand. Put the rest into your graveyard";
}
public CommuneWithTheGodsEffect(final CommuneWithTheGodsEffect effect) {
super(effect);
}
@Override
public CommuneWithTheGodsEffect copy() {
return new CommuneWithTheGodsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
if (!cards.isEmpty()) {
FilterCard filterPutInHand = new FilterCard("creature or enchantment card to put in hand");
filterPutInHand.add(Predicates.or(CardType.CREATURE.getPredicate(), CardType.ENCHANTMENT.getPredicate()));
controller.revealCards(source, cards, game);
if (cards.count(filterPutInHand, source.getControllerId(), source, game) > 0) {
TargetCard target = new TargetCard(0, 1, Zone.LIBRARY, filterPutInHand);
if (controller.choose(Outcome.DrawCard, cards, target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.remove(card);
controller.moveCards(card, Zone.HAND, source, game);
}
}
}
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
}
return true;
}
return false;
}
}

View file

@ -1,14 +1,11 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.FilterCard;
/** /**
* *
@ -20,9 +17,7 @@ public final class ContingencyPlan extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{U}"); super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{U}");
// Look at the top five cards of your library. Put any number of them into your graveyard and the rest back on top of your library in any order. // Look at the top five cards of your library. Put any number of them into your graveyard and the rest back on top of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(5), false, StaticValue.get(5), this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(5, Integer.MAX_VALUE, PutCards.GRAVEYARD, PutCards.TOP_ANY));
new FilterCard("cards"), Zone.LIBRARY, true, false, true, Zone.GRAVEYARD, false));
} }
private ContingencyPlan(final ContingencyPlan card) { private ContingencyPlan(final ContingencyPlan card) {

View file

@ -3,15 +3,14 @@ package mage.cards.c;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.DrawDiscardControllerEffect; import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.KickerAbility; 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.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
@ -45,11 +44,7 @@ public final class CoralhelmChronicler extends CardImpl {
// When Coralhelm Chronicler enters the battlefield, look at the top five cards of your library. You may reveal a card with a kicker ability from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // When Coralhelm Chronicler enters the battlefield, look at the top five cards of your library. You may reveal a card with a kicker ability from among them and put it into your hand. Put the rest on the bottom of your library in a random order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(5), false, StaticValue.get(1), filter, Zone.LIBRARY, false, 5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM)));
true, false, Zone.HAND, true, false, false
).setBackInRandomOrder(true).setText("look at the top five cards of your library. " +
"You may reveal a card with a kicker ability from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order")));
} }
private CoralhelmChronicler(final CoralhelmChronicler card) { private CoralhelmChronicler(final CoralhelmChronicler card) {

View file

@ -1,11 +1,10 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -33,7 +32,8 @@ public final class CourageousOutrider extends CardImpl {
// When Courageous Outrider enters the battlefield, look at the top four cards of your library. You may reveal a Human card from among them // When Courageous Outrider enters the battlefield, look at the top four cards of your library. You may reveal a Human card from among them
// and put it into your hand. Put the rest on the bottom of your library in any order. // and put it into your hand. Put the rest on the bottom of your library in any order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(StaticValue.get(4), false, StaticValue.get(1), filter, false) , false)); this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
4, 1, filter, PutCards.HAND, PutCards.BOTTOM_ANY)));
} }
private CourageousOutrider(final CourageousOutrider card) { private CourageousOutrider(final CourageousOutrider card) {

View file

@ -1,12 +1,11 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.SacrificeSourceUnlessConditionEffect; import mage.abilities.effects.common.SacrificeSourceUnlessConditionEffect;
import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -14,8 +13,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.ColoredManaSymbol; import mage.constants.ColoredManaSymbol;
import mage.constants.Zone;
import mage.filter.FilterCard;
/** /**
* *
@ -34,9 +31,7 @@ public final class CourtHussar extends CardImpl {
// Vigilance // Vigilance
this.addAbility(VigilanceAbility.getInstance()); this.addAbility(VigilanceAbility.getInstance());
// When Court Hussar enters the battlefield, look at the top three cards of your library, then put one of them into your hand and the rest on the bottom of your library in any order. // When Court Hussar enters the battlefield, look at the top three cards of your library, then put one of them into your hand and the rest on the bottom of your library in any order.
this.addAbility(new EntersBattlefieldTriggeredAbility( this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(3, 1, PutCards.HAND, PutCards.BOTTOM_ANY)));
new LookLibraryAndPickControllerEffect(StaticValue.get(3), false, StaticValue.get(1), new FilterCard(), Zone.LIBRARY, false, false),
false));
// When Court Hussar enters the battlefield, sacrifice it unless {W} was spent to cast it. // When Court Hussar enters the battlefield, sacrifice it unless {W} was spent to cast it.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessConditionEffect(new ManaWasSpentCondition(ColoredManaSymbol.W)), false)); this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessConditionEffect(new ManaWasSpentCondition(ColoredManaSymbol.W)), false));
} }
@ -50,4 +45,3 @@ public final class CourtHussar extends CardImpl {
return new CourtHussar(this); return new CourtHussar(this);
} }
} }

View file

@ -10,9 +10,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
import java.util.UUID; import java.util.UUID;
@ -21,15 +19,6 @@ import java.util.UUID;
*/ */
public final class CourtOfBounty extends CardImpl { public final class CourtOfBounty extends CardImpl {
private static final FilterCard filter = new FilterCard("a creature or land card");
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.LAND.getPredicate()
));
}
public CourtOfBounty(UUID ownerId, CardSetInfo setInfo) { public CourtOfBounty(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}");
@ -38,7 +27,7 @@ public final class CourtOfBounty extends CardImpl {
// At the beginning of your upkeep, you may put a land card from your hand onto the battlefield. If you're the monarch, instead you may put a creature or land card from your hand onto the battlefield. // At the beginning of your upkeep, you may put a land card from your hand onto the battlefield. If you're the monarch, instead you may put a creature or land card from your hand onto the battlefield.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ConditionalOneShotEffect( this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ConditionalOneShotEffect(
new PutCardFromHandOntoBattlefieldEffect(filter), new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_OR_LAND),
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_LAND_A), new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_LAND_A),
MonarchIsSourceControllerCondition.instance, "you may put a land card " + MonarchIsSourceControllerCondition.instance, "you may put a land card " +
"from your hand onto the battlefield. If you're the monarch, " + "from your hand onto the battlefield. If you're the monarch, " +

View file

@ -4,15 +4,14 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardSourceCost; import mage.abilities.costs.common.DiscardSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.Zone;
import mage.filter.StaticFilters;
import mage.game.permanent.token.TreasureToken; import mage.game.permanent.token.TreasureToken;
import mage.target.common.TargetAnyTarget; import mage.target.common.TargetAnyTarget;
@ -28,11 +27,7 @@ public final class CreativeOutburst extends CardImpl {
// Creative Outburst deals 5 damage to any target. Look at the top five cards of your library. Put one of them into your hand and the rest on the bottom of your library in a random order. // Creative Outburst deals 5 damage to any target. Look at the top five cards of your library. Put one of them into your hand and the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new DamageTargetEffect(5)); this.getSpellAbility().addEffect(new DamageTargetEffect(5));
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(5, 1, PutCards.HAND, PutCards.BOTTOM_RANDOM));
StaticValue.get(5), false, StaticValue.get(1),
StaticFilters.FILTER_CARD, Zone.LIBRARY, false, false
).setBackInRandomOrder(true).setText("Look at the top five cards of your library. " +
"Put one of them into your hand and the rest on the bottom of your library in a random order"));
this.getSpellAbility().addTarget(new TargetAnyTarget()); this.getSpellAbility().addTarget(new TargetAnyTarget());
// {U/R}{U/R}, Discard Creative Outburst: Create a Treasure token. // {U/R}{U/R}, Discard Creative Outburst: Create a Treasure token.

View file

@ -40,7 +40,7 @@ public final class CruelFate extends CardImpl {
class CruelFateEffect extends OneShotEffect { class CruelFateEffect extends OneShotEffect {
CruelFateEffect() { CruelFateEffect() {
super(Outcome.DrawCard); super(Outcome.Detriment);
this.staticText = "Look at the top five cards of target opponent's library. " + this.staticText = "Look at the top five cards of target opponent's library. " +
"Put one of those cards into that player's graveyard and the rest on top of their library in any order"; "Put one of those cards into that player's graveyard and the rest on top of their library in any order";
} }
@ -75,6 +75,6 @@ class CruelFateEffect extends OneShotEffect {
controller.moveCards(card, Zone.GRAVEYARD, source, game); controller.moveCards(card, Zone.GRAVEYARD, source, game);
cards.remove(card); cards.remove(card);
} }
return controller.putCardsOnTopOfLibrary(card, game, source, true); return controller.putCardsOnTopOfLibrary(cards, game, source, true);
} }
} }

View file

@ -1,23 +1,16 @@
package mage.cards.c; package mage.cards.c;
import mage.abilities.Ability; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID; import java.util.UUID;
/** /**
* @author TheElk801 * @author awjackson
*/ */
public final class Curate extends CardImpl { public final class Curate extends CardImpl {
@ -25,8 +18,10 @@ public final class Curate extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Look at the top two cards of your library. Put any number of them into your graveyard and the rest back on top of your library in any order. // Look at the top two cards of your library. Put any number of them into your graveyard and the rest back on top of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(2, Integer.MAX_VALUE, PutCards.GRAVEYARD, PutCards.TOP_ANY));
// Draw a card. // Draw a card.
this.getSpellAbility().addEffect(new CurateEffect()); this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).concatBy("<br>"));
} }
private Curate(final Curate card) { private Curate(final Curate card) {
@ -38,40 +33,3 @@ public final class Curate extends CardImpl {
return new Curate(this); return new Curate(this);
} }
} }
class CurateEffect extends OneShotEffect {
CurateEffect() {
super(Outcome.Benefit);
staticText = "look at the top two cards of your library. Put any number of them into your graveyard " +
"and the rest back on top of your library in any order.<br>Draw a card";
}
private CurateEffect(final CurateEffect effect) {
super(effect);
}
@Override
public CurateEffect copy() {
return new CurateEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 2));
if (!cards.isEmpty()) {
TargetCard target = new TargetCard(0, cards.size(), Zone.LIBRARY, StaticFilters.FILTER_CARD);
target.withChooseHint("to graveyard");
player.chooseTarget(Outcome.Benefit, cards, target, source, game);
player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game);
cards.removeAll(target.getTargets());
player.putCardsOnTopOfLibrary(cards, game, source, true);
}
player.drawCards(1, source, game);
return true;
}
}

View file

@ -1,32 +1,25 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageControllerEffect; import mage.abilities.effects.common.DamageControllerEffect;
import mage.cards.*; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
* @author Quercitron * @author awjackson
*/ */
public final class DarkBargain extends CardImpl { public final class DarkBargain extends CardImpl {
public DarkBargain(UUID ownerId, CardSetInfo setInfo) { public DarkBargain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}");
// Look at the top three cards of your library. Put two of them into your hand and the rest into your graveyard. // Look at the top three cards of your library. Put two of them into your hand and the other into your graveyard.
// Dark Bargain deals 2 damage to you. // Dark Bargain deals 2 damage to you.
this.getSpellAbility().addEffect(new DarkBargainEffect()); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(3, 2, PutCards.HAND, PutCards.GRAVEYARD));
this.getSpellAbility().addEffect(new DamageControllerEffect(2)); this.getSpellAbility().addEffect(new DamageControllerEffect(2));
} }
@ -39,47 +32,3 @@ public final class DarkBargain extends CardImpl {
return new DarkBargain(this); return new DarkBargain(this);
} }
} }
class DarkBargainEffect extends OneShotEffect {
public DarkBargainEffect() {
super(Outcome.Benefit);
this.staticText = "Look at the top three cards of your library. Put two of them into your hand and the other into your graveyard";
}
public DarkBargainEffect(final DarkBargainEffect effect) {
super(effect);
}
@Override
public DarkBargainEffect copy() {
return new DarkBargainEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
MageObject sourceOject = source.getSourceObject(game);
if (player != null && sourceOject != null) {
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 3));
if (!cards.isEmpty()) {
Cards cardsToHand = new CardsImpl();
player.lookAtCards(sourceOject.getIdName(), cards, game);
TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand"));
if (player.choose(Outcome.DrawCard, cards, target, game)) {
for (UUID targetId : target.getTargets()) {
Card card = cards.get(targetId, game);
if (card != null) {
cardsToHand.add(card);
cards.remove(card);
}
}
}
player.moveCards(cardsToHand, Zone.HAND, source, game);
player.moveCards(cards, Zone.GRAVEYARD, source, game);
}
return true;
}
return false;
}
}

View file

@ -2,29 +2,29 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.*; import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.game.Game; import mage.filter.common.FilterPlaneswalkerCard;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
* @author fireshoes * @author awjackson
*/ */
public final class DeployTheGatewatch extends CardImpl { public final class DeployTheGatewatch extends CardImpl {
private static final FilterCard filter = new FilterPlaneswalkerCard("planeswalker cards");
public DeployTheGatewatch(UUID ownerId, CardSetInfo setInfo) { public DeployTheGatewatch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}{W}");
// Look at the top seven cards of your library. Put up to two planeswalker cards from among them onto the battlefield. // Look at the top seven cards of your library. Put up to two planeswalker cards from among them onto the battlefield.
// Put the rest on the bottom of your library in a random order. // Put the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new DeployTheGatewatchEffect()); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
7, 2, filter, PutCards.BATTLEFIELD, PutCards.BOTTOM_RANDOM, false));
} }
private DeployTheGatewatch(final DeployTheGatewatch card) { private DeployTheGatewatch(final DeployTheGatewatch card) {
@ -36,50 +36,3 @@ public final class DeployTheGatewatch extends CardImpl {
return new DeployTheGatewatch(this); return new DeployTheGatewatch(this);
} }
} }
class DeployTheGatewatchEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("up to two planeswalker cards");
static {
filter.add(CardType.PLANESWALKER.getPredicate());
}
public DeployTheGatewatchEffect() {
super(Outcome.DrawCard);
this.staticText = "Look at the top seven cards of your library. Put up to two planeswalker cards from among them onto the battlefield. "
+ "Put the rest on the bottom of your library in a random order";
}
public DeployTheGatewatchEffect(final DeployTheGatewatchEffect effect) {
super(effect);
}
@Override
public DeployTheGatewatchEffect copy() {
return new DeployTheGatewatchEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
// Look at the top seven cards of your library.
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 7));
controller.lookAtCards(source, null, cards, game);
// Put up to two planeswalker cards from among them onto the battlefield.
if (cards.count(filter, game) > 0) {
TargetCard target = new TargetCard(0, 2, Zone.LIBRARY, filter);
if (controller.choose(Outcome.DrawCard, cards, target, game)) {
Cards pickedCards = new CardsImpl(target.getTargets());
cards.removeAll(pickedCards);
controller.moveCards(pickedCards.getCards(game), Zone.BATTLEFIELD, source, game);
}
}
// Put the rest on the bottom of your library in a random order
controller.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
}
}

View file

@ -1,13 +1,11 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.FilterCard;
/** /**
* *
@ -19,7 +17,7 @@ public final class DiabolicVision extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}{B}");
// Look at the top five cards of your library. Put one of them into your hand and the rest on top of your library in any order. // Look at the top five cards of your library. Put one of them into your hand and the rest on top of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(5), false, StaticValue.get(1), new FilterCard(), true, false)); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(5, 1, PutCards.HAND, PutCards.TOP_ANY));
} }
private DiabolicVision(final DiabolicVision card) { private DiabolicVision(final DiabolicVision card) {

View file

@ -1,13 +1,11 @@
package mage.cards.d; package mage.cards.d;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.DelveAbility; import mage.abilities.keyword.DelveAbility;
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.filter.FilterCard;
import java.util.UUID; import java.util.UUID;
@ -23,7 +21,7 @@ public final class DigThroughTime extends CardImpl {
this.addAbility(new DelveAbility()); this.addAbility(new DelveAbility());
// Look at the top seven cards of your library. Put two of them into your hand and the rest on the bottom of your library in any order. // Look at the top seven cards of your library. Put two of them into your hand and the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(7), false, StaticValue.get(2), new FilterCard(), Zone.LIBRARY, false, false)); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(7, 2, PutCards.HAND, PutCards.BOTTOM_ANY));
} }
private DigThroughTime(final DigThroughTime card) { private DigThroughTime(final DigThroughTime card) {

View file

@ -4,14 +4,13 @@ import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards; import mage.cards.Cards;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
@ -41,10 +40,8 @@ public final class DiscerningTaste extends CardImpl {
class DiscerningTasteEffect extends LookLibraryAndPickControllerEffect { class DiscerningTasteEffect extends LookLibraryAndPickControllerEffect {
public DiscerningTasteEffect() { DiscerningTasteEffect() {
super(StaticValue.get(4), false, StaticValue.get(1), StaticFilters.FILTER_CARD, Zone.GRAVEYARD, super(4, 1, PutCards.HAND, PutCards.GRAVEYARD);
false, false, false, Zone.HAND, false, false, false
);
} }
private DiscerningTasteEffect(final DiscerningTasteEffect effect) { private DiscerningTasteEffect(final DiscerningTasteEffect effect) {
@ -57,16 +54,17 @@ class DiscerningTasteEffect extends LookLibraryAndPickControllerEffect {
} }
@Override @Override
protected void putCardsBack(Ability source, Player player, Cards cards, Game game) { protected boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
super.actionWithPickedCards(game, source, player, pickedCards, otherCards);
int life = 0; int life = 0;
for (Card card : cards.getCards(StaticFilters.FILTER_CARD_CREATURE, game)) { for (Card card : otherCards.getCards(StaticFilters.FILTER_CARD_CREATURE, game)) {
int power = card.getPower().getValue(); int power = card.getPower().getValue();
if (power > life) { if (power > life) {
life = power; life = power;
} }
} }
player.moveCards(cards, Zone.GRAVEYARD, source, game);
player.gainLife(life, game, source); player.gainLife(life, game, source);
return true;
} }
@Override @Override

View file

@ -5,10 +5,10 @@ import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility; import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GetEmblemEffect; import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.ManaEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect;
import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.effects.mana.BasicManaEffect;
@ -46,15 +46,7 @@ public final class DomriChaosBringer extends CardImpl {
// creature cards from among them and put them into your hand. Put the rest // creature cards from among them and put them into your hand. Put the rest
// on the bottom of your library in a random order. // on the bottom of your library in a random order.
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(4), false, StaticValue.get(2), 4, 2, StaticFilters.FILTER_CARD_CREATURES, PutCards.HAND, PutCards.BOTTOM_RANDOM), -3));
StaticFilters.FILTER_CARD_CREATURE, Zone.LIBRARY, false,
true, true, Zone.HAND, false, false, false
).setText(
"Look at the top four cards of your library. "
+ "You may reveal up to two creature cards from among them "
+ "and put them into your hand. Put the rest on the bottom of your library "
+ "in a random order."
), -3));
// 8: You get an emblem with "At the beginning of each end step, create a 4/4 red // 8: You get an emblem with "At the beginning of each end step, create a 4/4 red
// and green Beast creature token with trample." // and green Beast creature token with trample."

View file

@ -3,17 +3,16 @@ package mage.cards.d;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility; import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DamagedPlayerEvent; import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
@ -41,19 +40,13 @@ public final class DovinGrandArbiter extends CardImpl {
// -1: Create a 1/1 colorless Thopter artifact creature token with flying. You gain 1 life. // -1: Create a 1/1 colorless Thopter artifact creature token with flying. You gain 1 life.
Ability ability = new LoyaltyAbility(new CreateTokenEffect(new ThopterColorlessToken()), -1); Ability ability = new LoyaltyAbility(new CreateTokenEffect(new ThopterColorlessToken()), -1);
ability.addEffect(new GainLifeEffect(1).setText("You gain 1 life.")); ability.addEffect(new GainLifeEffect(1));
this.addAbility(ability); this.addAbility(ability);
// -7: Look at the top ten cards of your library. Put three of them into your hand and the rest on the bottom of your library in a random order. // -7: Look at the top ten cards of your library. Put three of them into your hand
// and the rest on the bottom of your library in a random order.
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(10), false, 10, 3, PutCards.HAND, PutCards.BOTTOM_RANDOM), -7));
StaticValue.get(3), StaticFilters.FILTER_CARD,
Zone.LIBRARY, false, false, false,
Zone.HAND, false, false, false
).setBackInRandomOrder(true).setText("Look at the top ten cards of your library. " +
"Put three of them into your hand and the rest " +
"on the bottom of your library in a random order."
), -7));
} }
private DovinGrandArbiter(final DovinGrandArbiter card) { private DovinGrandArbiter(final DovinGrandArbiter card) {

View file

@ -1,26 +1,22 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.SourceTappedCondition; import mage.abilities.condition.common.SourceTappedCondition;
import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HexproofAbility; import mage.abilities.keyword.HexproofAbility;
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.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
/** /**
* *
@ -40,14 +36,15 @@ public final class DragonlordOjutai extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Dragonlord Ojutai has hexproof as long as it's untapped. // Dragonlord Ojutai has hexproof as long as it's untapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
new GainAbilitySourceEffect(HexproofAbility.getInstance(), Duration.WhileOnBattlefield), new GainAbilitySourceEffect(HexproofAbility.getInstance(), Duration.WhileOnBattlefield),
SourceTappedCondition.UNTAPPED, SourceTappedCondition.UNTAPPED,
"{this} has hexproof as long as it's untapped"))); "{this} has hexproof as long as it's untapped")));
// Whenever Dragonlord Ojutai deals combat damage to a player, look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order. // Whenever Dragonlord Ojutai deals combat damage to a player, look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new LookLibraryAndPickControllerEffect this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
(StaticValue.get(3), false, StaticValue.get(1), new FilterCard(), Zone.LIBRARY, false, false), false)); new LookLibraryAndPickControllerEffect(3, 1, PutCards.HAND, PutCards.BOTTOM_ANY),
false));
} }
private DragonlordOjutai(final DragonlordOjutai card) { private DragonlordOjutai(final DragonlordOjutai card) {

View file

@ -1,12 +1,10 @@
package mage.cards.d; package mage.cards.d;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -19,10 +17,7 @@ public final class DrawnFromDreams extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{U}");
// Look at the top seven cards of your library. Put two of them into your hand and the rest on the bottom of your library in a random order. // Look at the top seven cards of your library. Put two of them into your hand and the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(7, 2, PutCards.HAND, PutCards.BOTTOM_RANDOM));
StaticValue.get(7), false, StaticValue.get(2),
StaticFilters.FILTER_CARD, Zone.LIBRARY, false, false
).setBackInRandomOrder(true));
} }
private DrawnFromDreams(final DrawnFromDreams card) { private DrawnFromDreams(final DrawnFromDreams card) {

View file

@ -7,21 +7,19 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.WerewolfFrontTriggeredAbility; import mage.abilities.common.WerewolfFrontTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.TransformAbility; import mage.abilities.keyword.TransformAbility;
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.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
/** /**
* @author fireshoes * @author fireshoes
*/ */
public final class DuskwatchRecruiter extends CardImpl { public final class DuskwatchRecruiter extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("a creature card");
public DuskwatchRecruiter(UUID ownerId, CardSetInfo setInfo) { public DuskwatchRecruiter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
@ -35,8 +33,8 @@ public final class DuskwatchRecruiter extends CardImpl {
// {2}{G}: Look at the top three cards of your library. You may reveal a creature card from among them and put it into your hand. // {2}{G}: Look at the top three cards of your library. You may reveal a creature card from among them and put it into your hand.
// Put the rest on the bottom of your library in any order. // Put the rest on the bottom of your library in any order.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleActivatedAbility(
new LookLibraryAndPickControllerEffect(3, 1, filter, true, false, Zone.HAND, true), new LookLibraryAndPickControllerEffect(3, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_ANY),
new ManaCostsImpl("{2}{G}"))); new ManaCostsImpl("{2}{G}")));
// At the beginning of each upkeep, if no spells were cast last turn, transform Duskwatch Recruiter. // At the beginning of each upkeep, if no spells were cast last turn, transform Duskwatch Recruiter.
@ -52,5 +50,4 @@ public final class DuskwatchRecruiter extends CardImpl {
public DuskwatchRecruiter copy() { public DuskwatchRecruiter copy() {
return new DuskwatchRecruiter(this); return new DuskwatchRecruiter(this);
} }
} }

View file

@ -2,26 +2,18 @@ package mage.cards.e;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.cards.Card; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.constants.SubType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.SubType;
import mage.constants.Zone; import mage.filter.StaticFilters;
import mage.filter.common.FilterLandCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
* @author TheElk801 * @author awjackson
*/ */
public final class ElvishRejuvenator extends CardImpl { public final class ElvishRejuvenator extends CardImpl {
@ -33,8 +25,11 @@ public final class ElvishRejuvenator extends CardImpl {
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Whenever Elvish Rejuvenator enters the battlefield, look at the top five cards of your library. You may put a land card from among them onto the battlefield tapped. Put the rest on the bottom of your library in a random order. // When Elvish Rejuvenator enters the battlefield, look at the top five cards of your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ElvishRejuvenatorEffect(), false)); // You may put a land card from among them onto the battlefield tapped.
// Put the rest on the bottom of your library in a random order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
5, 1, StaticFilters.FILTER_CARD_LAND_A, PutCards.BATTLEFIELD_TAPPED, PutCards.BOTTOM_RANDOM)));
} }
private ElvishRejuvenator(final ElvishRejuvenator card) { private ElvishRejuvenator(final ElvishRejuvenator card) {
@ -46,49 +41,3 @@ public final class ElvishRejuvenator extends CardImpl {
return new ElvishRejuvenator(this); return new ElvishRejuvenator(this);
} }
} }
class ElvishRejuvenatorEffect extends OneShotEffect {
public ElvishRejuvenatorEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "look at the top five cards of your library. "
+ "You may put a land card from among them onto the battlefield tapped. "
+ "Put the rest on the bottom of your library in a random order";
}
public ElvishRejuvenatorEffect(final ElvishRejuvenatorEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Cards cards = new CardsImpl();
cards.addAll(controller.getLibrary().getTopCards(game, 5));
if (!cards.isEmpty()) {
TargetCard target = new TargetCard(
0, 1, Zone.LIBRARY,
new FilterLandCard("land card to put on the battlefield")
);
if (controller.choose(Outcome.PutCardInPlay, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, true, null);
}
}
if (!cards.isEmpty()) {
controller.putCardsOnBottomOfLibrary(cards, game, source, false);
}
}
return true;
}
@Override
public ElvishRejuvenatorEffect copy() {
return new ElvishRejuvenatorEffect(this);
}
}

View file

@ -1,18 +1,16 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
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.SubType; import mage.constants.SubType;
import mage.filter.FilterCard; import mage.filter.StaticFilters;
/** /**
* *
@ -20,11 +18,6 @@ import mage.filter.FilterCard;
*/ */
public final class FaerieMechanist extends CardImpl { public final class FaerieMechanist extends CardImpl {
private static final FilterCard filter = new FilterCard("an artifact card");
static {
filter.add(CardType.ARTIFACT.getPredicate());
}
public FaerieMechanist(UUID ownerId, CardSetInfo setInfo) { public FaerieMechanist(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{3}{U}"); super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{3}{U}");
@ -36,7 +29,8 @@ public final class FaerieMechanist extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Faerie Mechanist enters the battlefield, look at the top three cards of your library. // When Faerie Mechanist enters the battlefield, look at the top three cards of your library.
// You may reveal an artifact card from among them and put it into your hand. Put the rest on the bottom of your library in any order. // You may reveal an artifact card from among them and put it into your hand. Put the rest on the bottom of your library in any order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(StaticValue.get(3), false, StaticValue.get(1), filter, false))); this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
3, 1, StaticFilters.FILTER_CARD_ARTIFACT_AN, PutCards.HAND, PutCards.BOTTOM_ANY)));
} }
private FaerieMechanist(final FaerieMechanist card) { private FaerieMechanist(final FaerieMechanist card) {
@ -47,5 +41,4 @@ public final class FaerieMechanist extends CardImpl {
public FaerieMechanist copy() { public FaerieMechanist copy() {
return new FaerieMechanist(this); return new FaerieMechanist(this);
} }
} }

View file

@ -2,8 +2,8 @@ package mage.cards.f;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.CastSecondSpellTriggeredAbility; import mage.abilities.common.CastSecondSpellTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LifelinkAbility; import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -11,8 +11,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
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 java.util.UUID; import java.util.UUID;
@ -36,11 +34,10 @@ public final class FirjaJudgeOfValor extends CardImpl {
// Lifelink // Lifelink
this.addAbility(LifelinkAbility.getInstance()); this.addAbility(LifelinkAbility.getInstance());
// Whenever you cast your second spell each turn, look at the top three cards of your library. Put one of them into your hand and the rest into your graveyard. // Whenever you cast your second spell each turn, look at the top three cards of your library.
// Put one of them into your hand and the rest into your graveyard.
this.addAbility(new CastSecondSpellTriggeredAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new CastSecondSpellTriggeredAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(3), false, StaticValue.get(1), StaticFilters.FILTER_CARD, 3, 1, PutCards.HAND, PutCards.GRAVEYARD)));
Zone.GRAVEYARD, false, false, false, Zone.HAND, false
)));
} }
private FirjaJudgeOfValor(final FirjaJudgeOfValor card) { private FirjaJudgeOfValor(final FirjaJudgeOfValor card) {

View file

@ -1,28 +1,26 @@
package mage.cards.f; package mage.cards.f;
import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.costs.common.ExileXFromYourGraveCost; import mage.abilities.costs.common.ExileXFromYourGraveCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.FlashbackAbility; import mage.abilities.keyword.FlashbackAbility;
import mage.cards.*; import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
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 mage.game.Game; import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID; import java.util.UUID;
/** /**
* @author LevelX2 * @author awjackson
*/ */
public final class FlashOfInsight extends CardImpl { public final class FlashOfInsight extends CardImpl {
@ -36,7 +34,8 @@ public final class FlashOfInsight extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{1}{U}");
// Look at the top X cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order. // Look at the top X cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new FlashOfInsightEffect()); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
FlashOfInsightValue.instance, 1, PutCards.HAND, PutCards.BOTTOM_ANY));
// Flashback-{1}{U}, Exile X blue cards from your graveyard. // Flashback-{1}{U}, Exile X blue cards from your graveyard.
Ability ability = new FlashbackAbility(this, new ManaCostsImpl<>("{1}{U}")); Ability ability = new FlashbackAbility(this, new ManaCostsImpl<>("{1}{U}"));
@ -54,51 +53,32 @@ public final class FlashOfInsight extends CardImpl {
} }
} }
class FlashOfInsightEffect extends OneShotEffect { enum FlashOfInsightValue implements DynamicValue {
instance;
public FlashOfInsightEffect() { @Override
super(Outcome.DrawCard); public int calculate(Game game, Ability sourceAbility, Effect effect) {
this.staticText = "Look at the top X cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order"; int xValue = sourceAbility.getManaCostsToPay().getX();
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof ExileXFromYourGraveCost) {
xValue = ((ExileXFromYourGraveCost) cost).getAmount();
} }
}
public FlashOfInsightEffect(final FlashOfInsightEffect effect) { return xValue;
super(effect);
} }
@Override @Override
public FlashOfInsightEffect copy() { public FlashOfInsightValue copy() {
return new FlashOfInsightEffect(this); return instance;
} }
@Override @Override
public boolean apply(Game game, Ability source) { public String toString() {
Player controller = game.getPlayer(source.getControllerId()); return "X";
MageObject sourceObject = game.getObject(source);
if (controller == null || sourceObject == null) {
return false;
} }
int xValue = source.getManaCostsToPay().getX(); @Override
public String getMessage() {
for (Cost cost : source.getCosts()) { return "";
if (cost instanceof ExileFromGraveCost) {
xValue = ((ExileFromGraveCost) cost).getExiledCards().size();
}
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, xValue));
controller.lookAtCards(sourceObject.getIdName(), cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put into your hand"));
target.setNotTarget(true);
if (controller.chooseTarget(Outcome.DrawCard, cards, target, source, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);
cards.remove(card);
}
}
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
return true;
} }
} }

View file

@ -1,16 +1,13 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID; import java.util.UUID;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.FlashbackAbility; import mage.abilities.keyword.FlashbackAbility;
import mage.cards.*; import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/** /**
* *
@ -22,8 +19,7 @@ public final class ForbiddenAlchemy extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}");
// Look at the top four cards of your library. Put one of them into your hand and the rest into your graveyard. // Look at the top four cards of your library. Put one of them into your hand and the rest into your graveyard.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(4), false, StaticValue.get(1), this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(4, 1, PutCards.HAND, PutCards.GRAVEYARD));
StaticFilters.FILTER_CARD, Zone.GRAVEYARD, false, false, false, Zone.HAND, false));
// Flashback {6}{B} // Flashback {6}{B}
this.addAbility(new FlashbackAbility(this, new ManaCostsImpl("{6}{B}"))); this.addAbility(new FlashbackAbility(this, new ManaCostsImpl("{6}{B}")));

View file

@ -1,20 +1,19 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SacrificeSourceTriggeredAbility; import mage.abilities.common.SacrificeSourceTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.EmergeAbility; import mage.abilities.keyword.EmergeAbility;
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.SubType; import mage.constants.SubType;
import mage.filter.FilterCard; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.token.EldraziHorrorToken; import mage.game.permanent.token.EldraziHorrorToken;
@ -26,12 +25,6 @@ import mage.game.stack.Spell;
*/ */
public final class FoulEmissary extends CardImpl { public final class FoulEmissary extends CardImpl {
private static final FilterCard filter = new FilterCard("a creature card");
static {
filter.add(CardType.CREATURE.getPredicate());
}
public FoulEmissary(UUID ownerId, CardSetInfo setInfo) { public FoulEmissary(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}"); super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
@ -40,7 +33,8 @@ public final class FoulEmissary extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// When Foul Emissary enters the battlefield, look at the top four cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in any order. // When Foul Emissary enters the battlefield, look at the top four cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in any order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(StaticValue.get(4), false, StaticValue.get(1), filter, false))); this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
4, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_ANY)));
// When you sacrifice Foul Emissary while casting a spell with emerge, create a 3/2 colorless Eldrazi Horror creature token. // When you sacrifice Foul Emissary while casting a spell with emerge, create a 3/2 colorless Eldrazi Horror creature token.
this.addAbility(new FoulEmissaryTriggeredAbility(new CreateTokenEffect(new EldraziHorrorToken()), false)); this.addAbility(new FoulEmissaryTriggeredAbility(new CreateTokenEffect(new EldraziHorrorToken()), false));

View file

@ -1,20 +1,17 @@
package mage.cards.g; package mage.cards.g;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.HexproofFromBlackAbility; import mage.abilities.keyword.HexproofFromBlackAbility;
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.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.game.Game;
import java.util.UUID; import java.util.UUID;
@ -24,6 +21,17 @@ import java.util.UUID;
*/ */
public final class GarruksHarbinger extends CardImpl { public final class GarruksHarbinger extends CardImpl {
private static final FilterCard filter = new FilterCard("creature card or Garruk planeswalker card");
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
Predicates.and(
CardType.PLANESWALKER.getPredicate(),
SubType.GARRUK.getPredicate()
)
));
}
public GarruksHarbinger(UUID ownerId, CardSetInfo setInfo) { public GarruksHarbinger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{G}");
@ -34,11 +42,12 @@ public final class GarruksHarbinger extends CardImpl {
// Hexproof from Black // Hexproof from Black
this.addAbility(HexproofFromBlackAbility.getInstance()); this.addAbility(HexproofFromBlackAbility.getInstance());
// Whenever Garruk's Harbinger deals combat damage to a player or planeswalker, look at that many cards from the top of your library. You may reveal a creature card or Garruk planeswalker card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // Whenever Garruk's Harbinger deals combat damage to a player or planeswalker, look at that many cards from the top of your library.
this.addAbility( // You may reveal a creature card or Garruk planeswalker card from among them and put it into your hand.
new DealsCombatDamageToAPlayerTriggeredAbility(new GarruksHarbingerEffect(), false, true) // Put the rest on the bottom of your library in a random order.
.setOrPlaneswalker(true) this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
); new LookLibraryAndPickControllerEffect(SavedDamageValue.MANY, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM),
false, true).setOrPlaneswalker(true));
} }
private GarruksHarbinger(final GarruksHarbinger card) { private GarruksHarbinger(final GarruksHarbinger card) {
@ -50,37 +59,3 @@ public final class GarruksHarbinger extends CardImpl {
return new GarruksHarbinger(this); return new GarruksHarbinger(this);
} }
} }
class GarruksHarbingerEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("a creature or Garruk planeswalker card");
static {
filter.add(Predicates.or(CardType.CREATURE.getPredicate(), Predicates.and(CardType.PLANESWALKER.getPredicate(), SubType.GARRUK.getPredicate())));
}
GarruksHarbingerEffect() {
super(Outcome.Benefit);
staticText = "look at that many cards from the top of your library. You may reveal a creature card or Garruk planeswalker card from among them and put it into your hand. Put the rest on the bottom of your library in a random order";
}
private GarruksHarbingerEffect(GarruksHarbingerEffect effect) {
super(effect);
}
@Override
public GarruksHarbingerEffect copy() {
return new GarruksHarbingerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Integer damage = (Integer) getValue("damage");
if (damage != null) {
LookLibraryAndPickControllerEffect effect = new LookLibraryAndPickControllerEffect(StaticValue.get(damage), false, StaticValue.get(1), filter, false);
effect.setBackInRandomOrder(true);
return effect.apply(game, source);
}
return false;
}
}

View file

@ -1,35 +1,37 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.condition.common.SpellMasteryCondition; import mage.abilities.condition.common.SpellMasteryCondition;
import mage.abilities.effects.OneShotEffect; import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.RevealLibraryPickControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards; import mage.constants.AbilityWord;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
* @author LevelX2 * @author awjackson
*/ */
public final class GatherThePack extends CardImpl { public final class GatherThePack extends CardImpl {
private static final String rule = "Reveal the top five cards of your library. " +
"You may put a creature card from among them into your hand. Put the rest into your graveyard.<br>" +
AbilityWord.SPELL_MASTERY.formatWord() + "If " + SpellMasteryCondition.instance.toString() +
", put up to two creature cards from among the revealed cards into your hand instead of one";
public GatherThePack(UUID ownerId, CardSetInfo setInfo) { public GatherThePack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// Reveal the top five cards of your library. You may put a creature card from among them into your hand. Put the rest into your graveyard. // Reveal the top five cards of your library. You may put a creature card from among them into your hand. Put the rest into your graveyard.
// <i>Spell mastery</i> &mdash; If there are two or more instant and/or sorcery cards in your graveyard, put up to two creature cards from among the revealed cards into your hand instead of one. // <i>Spell mastery</i> &mdash; If there are two or more instant and/or sorcery cards in your graveyard, put up to two creature cards from among the revealed cards into your hand instead of one.
this.getSpellAbility().addEffect(new GatherThePackEffect()); this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new RevealLibraryPickControllerEffect(5, 2, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.GRAVEYARD),
new RevealLibraryPickControllerEffect(5, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.GRAVEYARD),
SpellMasteryCondition.instance, rule
));
} }
private GatherThePack(final GatherThePack card) { private GatherThePack(final GatherThePack card) {
@ -41,53 +43,3 @@ public final class GatherThePack extends CardImpl {
return new GatherThePack(this); return new GatherThePack(this);
} }
} }
class GatherThePackEffect extends OneShotEffect {
public GatherThePackEffect(final GatherThePackEffect effect) {
super(effect);
}
public GatherThePackEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "Reveal the top five cards of your library. You may put a creature card from among them into your hand. Put the rest into your graveyard."
+ "<br><i>Spell mastery</i> &mdash; If there are two or more instant and/or sorcery cards in your graveyard, put up to two creature cards from among the revealed cards into your hand instead of one";
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller == null || sourceObject == null) {
return false;
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
if (!cards.isEmpty()) {
controller.revealCards(sourceObject.getIdName(), cards, game);
int creatures = cards.count(StaticFilters.FILTER_CARD_CREATURE, source.getControllerId(), source, game);
if (creatures > 0) {
int max = 1;
if (SpellMasteryCondition.instance.apply(game, source) && creatures > 1) {
max++;
}
TargetCard target = new TargetCard(0, max, Zone.LIBRARY, new FilterCreatureCard("creature card" + (max > 1 ? "s" : "") + " to put into your hand"));
if (controller.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
Cards cardsToHand = new CardsImpl(target.getTargets());
if (!cardsToHand.isEmpty()) {
cards.removeAll(cardsToHand);
controller.moveCards(cardsToHand, Zone.HAND, source, game);
}
}
}
if (!cards.isEmpty()) {
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
}
}
return true;
}
@Override
public GatherThePackEffect copy() {
return new GatherThePackEffect(this);
}
}

View file

@ -3,16 +3,15 @@ package mage.cards.g;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.BecomeDayAsEntersAbility; import mage.abilities.common.BecomeDayAsEntersAbility;
import mage.abilities.common.BecomesDayOrNightTriggeredAbility; import mage.abilities.common.BecomesDayOrNightTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.WardAbility; import mage.abilities.keyword.WardAbility;
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.ComparisonType; import mage.constants.ComparisonType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ManaValuePredicate; import mage.filter.predicate.mageobject.ManaValuePredicate;
@ -24,7 +23,7 @@ import java.util.UUID;
*/ */
public final class GavonyDawnguard extends CardImpl { public final class GavonyDawnguard extends CardImpl {
private static final FilterCard filter = new FilterCreatureCard("creature card with mana value 3 or less"); private static final FilterCard filter = new FilterCreatureCard("a creature card with mana value 3 or less");
static { static {
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 4)); filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 4));
@ -39,18 +38,14 @@ public final class GavonyDawnguard extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// Ward {1} // Ward {1}
this.addAbility(new WardAbility(new ManaCostsImpl<>("{1}"))); this.addAbility(new WardAbility(new GenericManaCost(1)));
// If it's neither day nor night, it becomes day as Gavony Dawnguard enters the battlefield. // If it's neither day nor night, it becomes day as Gavony Dawnguard enters the battlefield.
this.addAbility(new BecomeDayAsEntersAbility()); this.addAbility(new BecomeDayAsEntersAbility());
// Whenever day becomes night or night becomes day, look at the top four cards of your library. You may reveal a creature card with mana value 3 or less from among them and put it into your hand. Put the rest on the bottom of your library in any order. // Whenever day becomes night or night becomes day, look at the top four cards of your library. You may reveal a creature card with mana value 3 or less from among them and put it into your hand. Put the rest on the bottom of your library in any order.
this.addAbility(new BecomesDayOrNightTriggeredAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new BecomesDayOrNightTriggeredAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(4), false, StaticValue.get(1), filter, Zone.LIBRARY, false, 4, 1, filter, PutCards.HAND, PutCards.BOTTOM_ANY)));
true, false, Zone.HAND, true, false, false
).setBackInRandomOrder(true).setText("look at the top four cards of your library. " +
"You may reveal a creature card with mana value 3 or less from among them " +
"and put it into your hand. Put the rest on the bottom of your library in any order")));
} }
private GavonyDawnguard(final GavonyDawnguard card) { private GavonyDawnguard(final GavonyDawnguard card) {

View file

@ -1,34 +1,32 @@
package mage.cards.g; package mage.cards.g;
import mage.abilities.Ability; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.ExileSpellEffect; import mage.abilities.effects.common.ExileSpellEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterPermanentCard; import mage.filter.common.FilterPermanentCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID; import java.util.UUID;
/** /**
* @author TheElk801 * @author awjackson
*/ */
public final class GenesisUltimatum extends CardImpl { public final class GenesisUltimatum extends CardImpl {
private static final FilterCard filter = new FilterPermanentCard("permanent cards");
public GenesisUltimatum(UUID ownerId, CardSetInfo setInfo) { public GenesisUltimatum(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}{G}{U}{U}{U}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}{G}{U}{U}{U}{R}{R}");
// Look at the top five cards of your library. Put any number of permanent cards from among them onto the battlefield and the rest into your hand. Exile Genesis Ultimatum. // Look at the top five cards of your library.
this.getSpellAbility().addEffect(new GenesisUltimatumEffect()); // Put any number of permanent cards from among them onto the battlefield and the rest into your hand.
// Exile Genesis Ultimatum.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
5, Integer.MAX_VALUE, filter, PutCards.BATTLEFIELD, PutCards.HAND, false
).setText("look at the top five cards of your library. Put any number of permanent cards from among them onto the battlefield and the rest into your hand"));
this.getSpellAbility().addEffect(new ExileSpellEffect()); this.getSpellAbility().addEffect(new ExileSpellEffect());
} }
@ -41,45 +39,3 @@ public final class GenesisUltimatum extends CardImpl {
return new GenesisUltimatum(this); return new GenesisUltimatum(this);
} }
} }
class GenesisUltimatumEffect extends OneShotEffect {
private static final FilterCard filter = new FilterPermanentCard("any number of permanent cards");
GenesisUltimatumEffect() {
super(Outcome.PutCardInPlay);
staticText = "Look at the top five cards of your library. Put any number of permanent cards " +
"from among them onto the battlefield and the rest into your hand";
}
private GenesisUltimatumEffect(final GenesisUltimatumEffect effect) {
super(effect);
}
@Override
public GenesisUltimatumEffect copy() {
return new GenesisUltimatumEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards toHand = new CardsImpl(player.getLibrary().getTopCards(game, 5));
player.lookAtCards(source, null, toHand, game);
TargetCard targetCard = new TargetCardInLibrary(0, 5, filter);
targetCard.withChooseHint("put to battlefield");
player.choose(outcome, toHand, targetCard, game);
Cards toBattlefield = new CardsImpl(targetCard.getTargets());
if (player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game)) {
toBattlefield
.stream()
.filter(id -> Zone.BATTLEFIELD.equals(game.getState().getZone(id)))
.forEach(toHand::remove);
}
player.moveCards(toHand, Zone.HAND, source, game);
return true;
}
}

View file

@ -1,33 +1,35 @@
package mage.cards.g; package mage.cards.g;
import mage.abilities.Ability; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.RevealLibraryPickControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterPermanentCard; import mage.filter.common.FilterPermanentCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID; import java.util.UUID;
/** /**
* @author TheElk801 * @author awjackson
*/ */
public final class GlacialRevelation extends CardImpl { public final class GlacialRevelation extends CardImpl {
private static final FilterCard filter = new FilterPermanentCard("snow permanent cards");
static {
filter.add(SuperType.SNOW.getPredicate());
}
public GlacialRevelation(UUID ownerId, CardSetInfo setInfo) { public GlacialRevelation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
// Reveal the top six cards of your library. You may put any number of snow permanent cards from among them into your hand. Put the rest into your graveyard. // Reveal the top six cards of your library.
this.getSpellAbility().addEffect(new GlacialRevelationEffect()); // You may put any number of snow permanent cards from among them into your hand.
// Put the rest into your graveyard.
this.getSpellAbility().addEffect(new RevealLibraryPickControllerEffect(
6, Integer.MAX_VALUE, filter, PutCards.HAND, PutCards.GRAVEYARD));
} }
private GlacialRevelation(final GlacialRevelation card) { private GlacialRevelation(final GlacialRevelation card) {
@ -39,45 +41,3 @@ public final class GlacialRevelation extends CardImpl {
return new GlacialRevelation(this); return new GlacialRevelation(this);
} }
} }
class GlacialRevelationEffect extends OneShotEffect {
private static final FilterCard filter = new FilterPermanentCard("snow permanent cards");
static {
filter.add(SuperType.SNOW.getPredicate());
}
GlacialRevelationEffect() {
super(Outcome.Benefit);
staticText = "Reveal the top six cards of your library. You may put any number of snow permanent cards " +
"from among them into your hand. Put the rest into your graveyard.";
}
private GlacialRevelationEffect(final GlacialRevelationEffect effect) {
super(effect);
}
@Override
public GlacialRevelationEffect copy() {
return new GlacialRevelationEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6));
player.revealCards(source, cards, game);
TargetCard targetCard = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, filter);
targetCard.setNotTarget(true);
if (player.choose(outcome, cards, targetCard, game)) {
Cards toHand = new CardsImpl(targetCard.getTargets());
cards.removeAll(targetCard.getTargets());
player.moveCards(toHand, Zone.HAND, source, game);
}
return player.moveCards(cards, Zone.GRAVEYARD, source, game);
}
}

View file

@ -4,14 +4,13 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
@ -35,12 +34,7 @@ public class GlimpseTheCosmos extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}");
// Look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order. // Look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(3, 1, PutCards.HAND, PutCards.BOTTOM_ANY));
StaticValue.get(3), false, StaticValue.get(1),
StaticFilters.FILTER_CARD, Zone.LIBRARY, false,
false, false, Zone.HAND, false
).setText("look at the top three cards of your library. "
+ "Put one of them into your hand and the rest on the bottom of your library in any order"));
//As long as you control a Giant, you may cast Glimpse the Cosmos from your graveyard by paying {U} rather than paying its mana cost. If you cast Glimpse the Cosmos this way and it would be put into your graveyard, exile it instead. //As long as you control a Giant, you may cast Glimpse the Cosmos from your graveyard by paying {U} rather than paying its mana cost. If you cast Glimpse the Cosmos this way and it would be put into your graveyard, exile it instead.
this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD,

View file

@ -1,13 +1,11 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.cards.*; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/** /**
* *
@ -19,9 +17,7 @@ public final class GlimpseTheFuture extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}");
// Look at the top three cards of your library. Put one of them into your hand and the rest into your graveyard. // Look at the top three cards of your library. Put one of them into your hand and the rest into your graveyard.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(3), false, StaticValue.get(1), this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(3, 1, PutCards.HAND, PutCards.GRAVEYARD));
StaticFilters.FILTER_CARD, Zone.GRAVEYARD, false, false, false, Zone.HAND, false));
} }
private GlimpseTheFuture(final GlimpseTheFuture card) { private GlimpseTheFuture(final GlimpseTheFuture card) {

View file

@ -1,17 +1,15 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
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.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
/** /**
@ -29,11 +27,11 @@ public final class GlintNestCrane extends CardImpl {
// Flying // Flying
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Glint-Nest Crane enters the battlefield, look at the top four cards of your library. You may reveal an artifact card from among them and // When Glint-Nest Crane enters the battlefield, look at the top four cards of your library.
// put it into your hand. Put the rest on the bottom of your library in any order. // You may reveal an artifact card from among them and put it into your hand.
this.addAbility(new EntersBattlefieldTriggeredAbility( // Put the rest on the bottom of your library in any order.
new LookLibraryAndPickControllerEffect(StaticValue.get(4), false, StaticValue.get(1), this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
StaticFilters.FILTER_CARD_ARTIFACT_AN, Zone.LIBRARY, false, true, false, Zone.HAND, true))); 4, 1, StaticFilters.FILTER_CARD_ARTIFACT_AN, PutCards.HAND, PutCards.BOTTOM_ANY)));
} }
private GlintNestCrane(final GlintNestCrane card) { private GlintNestCrane(final GlintNestCrane card) {

View file

@ -7,19 +7,17 @@ import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.DeliriumCondition; import mage.abilities.condition.common.DeliriumCondition;
import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.hint.common.CardTypesInGraveyardHint; import mage.abilities.hint.common.CardTypesInGraveyardHint;
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.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Zone; import mage.constants.SubType;
import mage.filter.FilterCard;
/** /**
* @author fireshoes * @author fireshoes
@ -36,19 +34,18 @@ public final class GrimFlayer extends CardImpl {
// Trample // Trample
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// Whenever Grim Flayer deals combat damage to a player, look at the top three cards of your library. Put any number of them into your graveyard // Whenever Grim Flayer deals combat damage to a player, look at the top three cards of your library.
// and the rest back on top of your library in any order. // Put any number of them into your graveyard and the rest back on top of your library in any order.
Effect effect = new LookLibraryAndPickControllerEffect( this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
StaticValue.get(3), false, StaticValue.get(3), new FilterCard(), Zone.LIBRARY, true, false, true, Zone.GRAVEYARD, false); new LookLibraryAndPickControllerEffect(3, Integer.MAX_VALUE, PutCards.GRAVEYARD, PutCards.TOP_ANY),
effect.setText("look at the top three cards of your library. Put any number of them into your graveyard and the rest back on top of your library in any order"); false));
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(effect, false));
// <i>Delirium</i> &mdash; Grim Flayer gets +2/+2 as long as there are four or more card types among cards in your graveyard. // <i>Delirium</i> &mdash; Grim Flayer gets +2/+2 as long as there are four or more card types among cards in your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield),
DeliriumCondition.instance, DeliriumCondition.instance,
"<i>Delirium</i> &mdash; {this} gets +2/+2 as long as there are four or more card types among cards in your graveyard")) "{this} gets +2/+2 as long as there are four or more card types among cards in your graveyard"))
.addHint(CardTypesInGraveyardHint.YOU)); .setAbilityWord(AbilityWord.DELIRIUM).addHint(CardTypesInGraveyardHint.YOU));
} }
private GrimFlayer(final GrimFlayer card) { private GrimFlayer(final GrimFlayer card) {

View file

@ -1,30 +1,28 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.*; import mage.abilities.effects.common.RevealLibraryPickControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.filter.StaticFilters;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
* @author LevelX2 * @author awjackson
*/ */
public final class GrislySalvage extends CardImpl { public final class GrislySalvage extends CardImpl {
public GrislySalvage(UUID ownerId, CardSetInfo setInfo) { public GrislySalvage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}{G}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}{G}");
// Reveal the top five cards of your library. You may put a creature or land card from among them into your hand. Put the rest into your graveyard. // Reveal the top five cards of your library.
this.getSpellAbility().addEffect(new GrislySalvageEffect()); // You may put a creature or land card from among them into your hand.
// Put the rest into your graveyard.
this.getSpellAbility().addEffect(new RevealLibraryPickControllerEffect(
5, 1, StaticFilters.FILTER_CARD_CREATURE_OR_LAND, PutCards.HAND, PutCards.GRAVEYARD));
} }
private GrislySalvage(final GrislySalvage card) { private GrislySalvage(final GrislySalvage card) {
@ -36,50 +34,3 @@ public final class GrislySalvage extends CardImpl {
return new GrislySalvage(this); return new GrislySalvage(this);
} }
} }
class GrislySalvageEffect extends OneShotEffect {
private static final FilterCard filterPutInHand = new FilterCard("creature or land card to put in hand");
static {
filterPutInHand.add(Predicates.or(CardType.CREATURE.getPredicate(), CardType.LAND.getPredicate()));
}
public GrislySalvageEffect() {
super(Outcome.DrawCard);
this.staticText = "Reveal the top five cards of your library. You may put a creature or land card from among them into your hand. Put the rest into your graveyard";
}
public GrislySalvageEffect(final GrislySalvageEffect effect) {
super(effect);
}
@Override
public GrislySalvageEffect copy() {
return new GrislySalvageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
boolean properCardFound = cards.count(filterPutInHand, game) > 0;
if (!cards.isEmpty()) {
controller.revealCards(source, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, filterPutInHand);
if (properCardFound && controller.chooseUse(outcome, "Put a creature or land card from the revealed cards into your hand?", source, game)
&& controller.choose(Outcome.DrawCard, cards, target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);
cards.remove(card);
}
}
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
}
return true;
}
return false;
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
@ -8,6 +7,7 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.TransformAbility; import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -16,8 +16,6 @@ import mage.constants.CardType;
import mage.constants.ComparisonType; import mage.constants.ComparisonType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
/** /**
@ -25,12 +23,6 @@ import mage.filter.StaticFilters;
*/ */
public final class GrowingRitesOfItlimoc extends CardImpl { public final class GrowingRitesOfItlimoc extends CardImpl {
private static final FilterCard filter = new FilterCard("a creature card");
static {
filter.add(CardType.CREATURE.getPredicate());
}
public GrowingRitesOfItlimoc(UUID ownerId, CardSetInfo setInfo) { public GrowingRitesOfItlimoc(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
@ -41,7 +33,8 @@ public final class GrowingRitesOfItlimoc extends CardImpl {
// When Growing Rites of Itlimoc enters the battlefield, look at the top four cards of your library. // When Growing Rites of Itlimoc enters the battlefield, look at the top four cards of your library.
// You may reveal a creature card from among them and put it into your hand. // You may reveal a creature card from among them and put it into your hand.
// Put the rest on the bottom of your library in any order. // Put the rest on the bottom of your library in any order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(4, 1, filter, true, true, Zone.HAND, false))); this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
4, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_ANY)));
// At the beginning of your end step, if you control four or more creatures, transform Growing Rites of Itlimoc. // At the beginning of your end step, if you control four or more creatures, transform Growing Rites of Itlimoc.
this.addAbility(new TransformAbility()); this.addAbility(new TransformAbility());

View file

@ -1,17 +1,15 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.ExploitCreatureTriggeredAbility; import mage.abilities.common.ExploitCreatureTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.ExploitAbility; import mage.abilities.keyword.ExploitAbility;
import mage.cards.*; import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/** /**
* *
@ -29,9 +27,10 @@ public final class GurmagDrowner extends CardImpl {
// Exploit // Exploit
this.addAbility(new ExploitAbility()); this.addAbility(new ExploitAbility());
// When Gurmag Drowner exploits a creature, look at the top four cards of your library. Put one of them into your hand and the rest into your graveyard. // When Gurmag Drowner exploits a creature, look at the top four cards of your library.
this.addAbility(new ExploitCreatureTriggeredAbility(new LookLibraryAndPickControllerEffect(StaticValue.get(4), false, StaticValue.get(1), // Put one of them into your hand and the rest into your graveyard.
StaticFilters.FILTER_CARD, Zone.GRAVEYARD, false, false, false, Zone.HAND, false), false)); this.addAbility(new ExploitCreatureTriggeredAbility(
new LookLibraryAndPickControllerEffect(4, 1, PutCards.HAND, PutCards.GRAVEYARD)));
} }
private GurmagDrowner(final GurmagDrowner card) { private GurmagDrowner(final GurmagDrowner card) {

View file

@ -2,15 +2,14 @@ package mage.cards.h;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.MenaceAbility; import mage.abilities.keyword.MenaceAbility;
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.SubType; import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -43,13 +42,11 @@ public final class HaraldKingOfSkemfar extends CardImpl {
// Menace // Menace
this.addAbility(new MenaceAbility()); this.addAbility(new MenaceAbility());
// When Harald, King of Skemfar enters the battlefield, look at the top five cards of your library. You may reveal an Elf, Warrior, or Tyvar card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // When Harald, King of Skemfar enters the battlefield, look at the top five cards of your library.
// You may reveal an Elf, Warrior, or Tyvar card from among them and put it into your hand.
// Put the rest on the bottom of your library in a random order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(5), false, StaticValue.get(1), filter, Zone.LIBRARY, false, 5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM)));
true, false, Zone.HAND, true, false, false
).setBackInRandomOrder(true).setText("look at the top five cards of your library." +
" You may reveal an Elf, Warrior, or Tyvar card from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order")));
} }
private HaraldKingOfSkemfar(final HaraldKingOfSkemfar card) { private HaraldKingOfSkemfar(final HaraldKingOfSkemfar card) {

View file

@ -5,18 +5,18 @@ import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CastSourceTriggeredAbility; import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.RevealLibraryPickControllerEffect;
import mage.abilities.keyword.ReachAbility; import mage.abilities.keyword.ReachAbility;
import mage.cards.*; import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterPermanentCard; import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.ManaValuePredicate; import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID; import java.util.UUID;
@ -52,7 +52,7 @@ public final class HatcherySpider extends CardImpl {
class HatcherySpiderEffect extends OneShotEffect { class HatcherySpiderEffect extends OneShotEffect {
public HatcherySpiderEffect() { public HatcherySpiderEffect() {
super(Outcome.Benefit); super(Outcome.PutCardInPlay);
this.staticText = "reveal the top X cards of your library, " this.staticText = "reveal the top X cards of your library, "
+ "where X is the number of creature cards in your graveyard. " + "where X is the number of creature cards in your graveyard. "
+ "You may put a green permanent card with mana value " + "You may put a green permanent card with mana value "
@ -77,19 +77,9 @@ class HatcherySpiderEffect extends OneShotEffect {
return false; return false;
} }
int xValue = player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game); int xValue = player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game);
FilterCard filter = new FilterPermanentCard("green permanent card with mana value " + xValue + " or less"); FilterPermanentCard filter = new FilterPermanentCard("green permanent card with mana value " + xValue + " or less");
filter.add(new ColorPredicate(ObjectColor.GREEN)); filter.add(new ColorPredicate(ObjectColor.GREEN));
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue + 1)); filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue + 1));
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, xValue)); return new RevealLibraryPickControllerEffect(xValue, 1, filter, PutCards.BATTLEFIELD, PutCards.BOTTOM_RANDOM).apply(game, source);
player.revealCards(source, cards, game);
TargetCard target = new TargetCardInLibrary(0, 1, filter);
player.choose(outcome, cards, target, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.moveCards(card, Zone.BATTLEFIELD, source, game);
}
cards.retainZone(Zone.LIBRARY, game);
player.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
} }
} }

View file

@ -1,25 +1,26 @@
package mage.cards.h; package mage.cards.h;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.cards.*; import mage.cards.CardImpl;
import mage.constants.*; import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
@ -27,10 +28,12 @@ import mage.target.TargetCard;
*/ */
public final class HeroesPodium extends CardImpl { public final class HeroesPodium extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Each legendary creature you control"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("each legendary creature");
private static final FilterCreatureCard filter2 = new FilterCreatureCard("a legendary creature card");
static { static {
filter.add(SuperType.LEGENDARY.getPredicate()); filter.add(SuperType.LEGENDARY.getPredicate());
filter2.add(SuperType.LEGENDARY.getPredicate());
} }
public HeroesPodium(UUID ownerId, CardSetInfo setInfo) { public HeroesPodium(UUID ownerId, CardSetInfo setInfo) {
@ -38,15 +41,16 @@ public final class HeroesPodium extends CardImpl {
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
// Each legendary creature you control gets +1/+1 for each other legendary creature you control. // Each legendary creature you control gets +1/+1 for each other legendary creature you control.
DynamicValue xValue = new HeroesPodiumLegendaryCount(); this.addAbility(new SimpleStaticAbility(
Effect effect = new BoostControlledEffect(xValue, xValue, Duration.WhileOnBattlefield, filter, false); new BoostControlledEffect(HeroesPodiumValue.instance, HeroesPodiumValue.instance, Duration.WhileOnBattlefield, filter, false)));
effect.setText("Each legendary creature you control gets +1/+1 for each other legendary creature you control"); // {X}, {T}: Look at the top X cards of your library.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); // You may reveal a legendary creature card from among them and put it into your hand.
// {X}, {T}: Look at the top X cards of your library. You may reveal a legendary creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // Put the rest on the bottom of your library in a random order.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new HeroesPodiumEffect(), new ManaCostsImpl("{X}")); Ability ability = new SimpleActivatedAbility(
new LookLibraryAndPickControllerEffect(ManacostVariableValue.REGULAR, 1, filter2, PutCards.HAND, PutCards.BOTTOM_RANDOM),
new ManaCostsImpl("{X}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
this.addAbility(ability); this.addAbility(ability);
} }
private HeroesPodium(final HeroesPodium card) { private HeroesPodium(final HeroesPodium card) {
@ -59,7 +63,8 @@ public final class HeroesPodium extends CardImpl {
} }
} }
class HeroesPodiumLegendaryCount implements DynamicValue { enum HeroesPodiumValue implements DynamicValue {
instance;
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other legendary creature you control"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other legendary creature you control");
@ -69,16 +74,12 @@ class HeroesPodiumLegendaryCount implements DynamicValue {
@Override @Override
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
int value = game.getBattlefield().count(filter, sourceAbility.getControllerId(), sourceAbility, game); return Math.max(game.getBattlefield().count(filter, sourceAbility.getControllerId(), sourceAbility, game) - 1, 0);
if (value > 0) {
value--;
}
return value;
} }
@Override @Override
public String toString() { public String toString() {
return "X"; return "1";
} }
@Override @Override
@ -87,64 +88,7 @@ class HeroesPodiumLegendaryCount implements DynamicValue {
} }
@Override @Override
public HeroesPodiumLegendaryCount copy() { public HeroesPodiumValue copy() {
return new HeroesPodiumLegendaryCount(); return instance;
}
}
class HeroesPodiumEffect extends OneShotEffect {
private static final FilterCreatureCard filter = new FilterCreatureCard("a legendary creature card");
static {
filter.add(SuperType.LEGENDARY.getPredicate());
}
public HeroesPodiumEffect() {
super(Outcome.DrawCard);
this.staticText = "Look at the top X cards of your library. You may reveal a legendary creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order";
}
public HeroesPodiumEffect(final HeroesPodiumEffect effect) {
super(effect);
}
@Override
public HeroesPodiumEffect copy() {
return new HeroesPodiumEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller == null || sourceObject == null) {
return false;
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
boolean legendaryIncluded = cards.count(filter, game) > 0;
controller.lookAtCards(sourceObject.getIdName(), cards, game);
// You may reveal a legendary creature card from among them and put it into your hand.
if (!cards.isEmpty() && legendaryIncluded && controller.chooseUse(outcome, "Put a legendary creature card into your hand?", source, game)) {
if (cards.size() == 1) {
controller.moveCards(cards, Zone.HAND, source, game);
return true;
} else {
TargetCard target = new TargetCard(Zone.LIBRARY, filter);
if (controller.choose(outcome, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
controller.moveCards(card, Zone.HAND, source, game);
}
}
}
}
// Put the rest on the bottom of your library in a random order
controller.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
} }
} }

View file

@ -6,9 +6,10 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ChooseCreatureTypeEffect; import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -61,15 +62,10 @@ public final class IconOfAncestry extends CardImpl {
} }
} }
class IconOfAncestryEffect extends LookLibraryAndPickControllerEffect { class IconOfAncestryEffect extends OneShotEffect {
public IconOfAncestryEffect() { public IconOfAncestryEffect() {
super(StaticValue.get(3), false, StaticValue.get(1), new FilterCreatureCard( super(Outcome.AIDontUseIt);
"creature card that matches the chosen subtype"
), Zone.LIBRARY, false, true, false,
Zone.HAND, true, false, false);
this.setOutcome(Outcome.AIDontUseIt);
this.setBackInRandomOrder(true);
staticText = "look at the top three cards of your library. " + staticText = "look at the top three cards of your library. " +
"You may reveal a creature card of the chosen type from among them and put it into your hand. " + "You may reveal a creature card of the chosen type from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order"; "Put the rest on the bottom of your library in a random order";
@ -77,13 +73,13 @@ class IconOfAncestryEffect extends LookLibraryAndPickControllerEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type"); SubType subtype = ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game);
if (subtype == null) { if (subtype == null) {
return false; return false;
} }
FilterCreatureCard filter = new FilterCreatureCard(subtype.toString() + " creature card");
filter.add(subtype.getPredicate()); filter.add(subtype.getPredicate());
filter.setMessage(subtype.toString() + " creature card"); return new LookLibraryAndPickControllerEffect(3, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM).apply(game, source);
return super.apply(game, source);
} }
public IconOfAncestryEffect(final IconOfAncestryEffect effect) { public IconOfAncestryEffect(final IconOfAncestryEffect effect) {

View file

@ -1,14 +1,11 @@
package mage.cards.i; package mage.cards.i;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.FilterCard;
/** /**
* *
@ -20,8 +17,7 @@ public final class Impulse extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}"); super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}");
// Look at the top four cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order. // Look at the top four cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(4), false, StaticValue.get(1), new FilterCard(), Zone.LIBRARY, false, false)); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(4, 1, PutCards.HAND, PutCards.BOTTOM_ANY));
} }
private Impulse(final Impulse card) { private Impulse(final Impulse card) {

View file

@ -1,16 +1,15 @@
package mage.cards.i; package mage.cards.i;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.SplitCard; import mage.cards.SplitCard;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SpellAbilityType; import mage.constants.SpellAbilityType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -28,13 +27,10 @@ public final class IncubationIncongruity extends SplitCard {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, new CardType[]{CardType.INSTANT}, "{G/U}", "{1}{G}{U}", SpellAbilityType.SPLIT); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, new CardType[]{CardType.INSTANT}, "{G/U}", "{1}{G}{U}", SpellAbilityType.SPLIT);
// Incubation // Incubation
// Look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // Look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand.
// Put the rest on the bottom of your library in a random order.
this.getLeftHalfCard().getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getLeftHalfCard().getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
StaticValue.get(5), false, 5, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_RANDOM));
StaticValue.get(1), StaticFilters.FILTER_CARD_CREATURE_A,
Zone.LIBRARY, false, true, false,
Zone.HAND, false, false, false
).setBackInRandomOrder(true));
// Incongruity // Incongruity
// Exile target creature. That creature's controller creates a 3/3 green Frog Lizard creature token. // Exile target creature. That creature's controller creates a 3/3 green Frog Lizard creature token.

View file

@ -4,14 +4,13 @@ import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.SubType;
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.SubType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterArtifactPermanent; import mage.filter.common.FilterArtifactPermanent;
@ -36,10 +35,7 @@ public final class IngeniousSmith extends CardImpl {
// You may reveal an artifact card from among them and put it into your hand. // You may reveal an artifact card from among them and put it into your hand.
// Put the rest on the bottom of your library in a random order. // Put the rest on the bottom of your library in a random order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect( this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(4), false, StaticValue.get(1), StaticFilters.FILTER_CARD_ARTIFACT_AN, 4, 1, StaticFilters.FILTER_CARD_ARTIFACT_AN, PutCards.HAND, PutCards.BOTTOM_RANDOM)));
Zone.LIBRARY, false, true, false, Zone.HAND,
true, false, false).setBackInRandomOrder(true)
));
// Whenever one or more artifacts enter the battlefield under your control, put a +1/+1 counter on Ingenious Smith. // Whenever one or more artifacts enter the battlefield under your control, put a +1/+1 counter on Ingenious Smith.
// This ability triggers only once each turn. // This ability triggers only once each turn.

View file

@ -2,10 +2,9 @@ package mage.cards.j;
import java.util.UUID; import java.util.UUID;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect; import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -13,8 +12,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterNonlandPermanent; import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
@ -40,10 +37,7 @@ public final class JaceTheLivingGuildpact extends CardImpl {
this.setStartingLoyalty(5); this.setStartingLoyalty(5);
// +1: Look at the top two cards of your library. Put one of them into your graveyard. // +1: Look at the top two cards of your library. Put one of them into your graveyard.
Effect effect = new LookLibraryAndPickControllerEffect( this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(2, 1, PutCards.GRAVEYARD, PutCards.TOP_ANY), 1));
StaticValue.get(2), false, StaticValue.get(1), new FilterCard(), Zone.LIBRARY, true, false, false, Zone.GRAVEYARD, false);
effect.setText("Look at the top two cards of your library. Put one of them into your graveyard");
this.addAbility(new LoyaltyAbility(effect, 1));
// -3: Return another target nonland permanent to its owner's hand. // -3: Return another target nonland permanent to its owner's hand.
LoyaltyAbility ability = new LoyaltyAbility(new ReturnToHandTargetEffect(), -3); LoyaltyAbility ability = new LoyaltyAbility(new ReturnToHandTargetEffect(), -3);
@ -52,9 +46,8 @@ public final class JaceTheLivingGuildpact extends CardImpl {
// -8: Each player shuffles their hand and graveyard into their library. You draw seven cards. // -8: Each player shuffles their hand and graveyard into their library. You draw seven cards.
ability = new LoyaltyAbility(new ShuffleHandGraveyardAllEffect(), -8); ability = new LoyaltyAbility(new ShuffleHandGraveyardAllEffect(), -8);
ability.addEffect(new DrawCardSourceControllerEffect(7).setText("You draw seven cards")); ability.addEffect(new DrawCardSourceControllerEffect(7, "you"));
this.addAbility(ability); this.addAbility(ability);
} }
private JaceTheLivingGuildpact(final JaceTheLivingGuildpact card) { private JaceTheLivingGuildpact(final JaceTheLivingGuildpact card) {

View file

@ -7,26 +7,22 @@ import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RemoveAllCountersSourceCost; import mage.abilities.costs.common.RemoveAllCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID; import java.util.UUID;
/** /**
* @author North * @author awjackson
*/ */
public final class JarOfEyeballs extends CardImpl { public final class JarOfEyeballs extends CardImpl {
@ -42,7 +38,9 @@ public final class JarOfEyeballs extends CardImpl {
// {3}, {tap}, Remove all eyeball counters from Jar of Eyeballs: // {3}, {tap}, Remove all eyeball counters from Jar of Eyeballs:
// Look at the top X cards of your library, where X is the number of eyeball counters removed this way. // Look at the top X cards of your library, where X is the number of eyeball counters removed this way.
// Put one of them into your hand and the rest on the bottom of your library in any order. // Put one of them into your hand and the rest on the bottom of your library in any order.
SimpleActivatedAbility ability = new SimpleActivatedAbility(new JarOfEyeballsEffect(), new GenericManaCost(3)); SimpleActivatedAbility ability = new SimpleActivatedAbility(
new LookLibraryAndPickControllerEffect(JarOfEyeballsValue.instance, 1, PutCards.HAND, PutCards.BOTTOM_ANY),
new GenericManaCost(3));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new RemoveAllCountersSourceCost(CounterType.EYEBALL)); ability.addCost(new RemoveAllCountersSourceCost(CounterType.EYEBALL));
this.addAbility(ability); this.addAbility(ability);
@ -58,43 +56,32 @@ public final class JarOfEyeballs extends CardImpl {
} }
} }
class JarOfEyeballsEffect extends OneShotEffect { enum JarOfEyeballsValue implements DynamicValue {
instance;
public JarOfEyeballsEffect() {
super(Outcome.DrawCard);
this.staticText = "Look at the top X cards of your library, where X is the number of eyeball counters removed this way. Put one of them into your hand and the rest on the bottom of your library in any order";
}
public JarOfEyeballsEffect(final JarOfEyeballsEffect effect) {
super(effect);
}
@Override @Override
public JarOfEyeballsEffect copy() { public int calculate(Game game, Ability sourceAbility, Effect effect) {
return new JarOfEyeballsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int countersRemoved = 0; int countersRemoved = 0;
for (Cost cost : source.getCosts()) { for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof RemoveAllCountersSourceCost) { if (cost instanceof RemoveAllCountersSourceCost) {
countersRemoved = ((RemoveAllCountersSourceCost) cost).getRemovedCounters(); countersRemoved = ((RemoveAllCountersSourceCost) cost).getRemovedCounters();
} }
} }
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, countersRemoved)); return countersRemoved;
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put into your hand"));
if (controller.choose(Outcome.DrawCard, cards, target, game)) {
Cards targetCards = new CardsImpl(target.getTargets());
controller.moveCards(targetCards, Zone.HAND, source, game);
cards.removeAll(targetCards);
} }
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
return true; @Override
public JarOfEyeballsValue copy() {
return instance;
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "the number of eyeball counters removed this way";
} }
} }

View file

@ -5,16 +5,14 @@ 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;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.PartnerAbility; import mage.abilities.keyword.PartnerAbility;
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.SubType; import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
@ -48,11 +46,11 @@ public final class KeskitTheFleshSculptor extends CardImpl {
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// {T}, Sacrifice three other artifacts and/or creatures: Look at the top three cards of your library. Put two of them into your hand and the other into your graveyard. // {T}, Sacrifice three other artifacts and/or creatures: Look at the top three cards of your library.
Ability ability = new SimpleActivatedAbility(new LookLibraryAndPickControllerEffect( // Put two of them into your hand and the other into your graveyard.
StaticValue.get(3), false, StaticValue.get(2), StaticFilters.FILTER_CARD, Ability ability = new SimpleActivatedAbility(
Zone.GRAVEYARD, false, false new LookLibraryAndPickControllerEffect(3, 2, PutCards.HAND, PutCards.GRAVEYARD),
), new TapSourceCost()); new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(3, filter))); ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(3, filter)));
this.addAbility(ability); this.addAbility(ability);

View file

@ -4,8 +4,8 @@ import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.TapForManaAllTriggeredManaAbility; import mage.abilities.common.TapForManaAllTriggeredManaAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.mana.AddManaOfAnyTypeProducedEffect; import mage.abilities.effects.mana.AddManaOfAnyTypeProducedEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -47,14 +47,12 @@ public final class KinnanBonderProdigy extends CardImpl {
effect, filter, SetTargetPointer.PERMANENT effect, filter, SetTargetPointer.PERMANENT
)); ));
// {5}{G}{U}: Look at the top five cards of your library. You may put a non-Human creature card from among them onto the battlefield. Put the rest on the bottom of your library in a random order. // {5}{G}{U}: Look at the top five cards of your library.
this.addAbility(new SimpleActivatedAbility(new LookLibraryAndPickControllerEffect( // You may put a non-Human creature card from among them onto the battlefield.
StaticValue.get(5), false, StaticValue.get(1), filter2, Zone.LIBRARY, false, // Put the rest on the bottom of your library in a random order.
true, false, Zone.BATTLEFIELD, true, false, false this.addAbility(new SimpleActivatedAbility(
).setBackInRandomOrder(true).setText("Look at the top five cards of your library. " + new LookLibraryAndPickControllerEffect(5, 1, filter2, PutCards.BATTLEFIELD, PutCards.BOTTOM_RANDOM),
"You may put a non-Human creature card from among them onto the battlefield. " + new ManaCostsImpl("{5}{G}{U}")));
"Put the rest on the bottom of your library in a random order."
), new ManaCostsImpl("{5}{G}{U}")));
} }
private KinnanBonderProdigy(final KinnanBonderProdigy card) { private KinnanBonderProdigy(final KinnanBonderProdigy card) {

View file

@ -14,9 +14,9 @@ import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.ChooseCreatureTypeEffect; import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.VigilanceAbility;
@ -73,11 +73,9 @@ public final class KolvoriGodOfKinship extends ModalDoubleFacesCard {
// {1}{G}, {T}: Look at the top six cards of your library. // {1}{G}, {T}: Look at the top six cards of your library.
// You may reveal a legendary creature card from among them and put it into your hand. // You may reveal a legendary creature card from among them and put it into your hand.
// Put the rest on the bottom of your library in a random order. // Put the rest on the bottom of your library in a random order.
ability = new SimpleActivatedAbility(new LookLibraryAndPickControllerEffect( ability = new SimpleActivatedAbility(
StaticValue.get(6), false, StaticValue.get(1), filter2, new LookLibraryAndPickControllerEffect(6, 1, filter2, PutCards.HAND, PutCards.BOTTOM_RANDOM),
Zone.LIBRARY, false, true, false, Zone.HAND, new ManaCostsImpl("{1}{G}"));
true, false, false).setBackInRandomOrder(true), new ManaCostsImpl("{1}{G}")
);
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
this.getLeftHalfCard().addAbility(ability); this.getLeftHalfCard().addAbility(ability);

View file

@ -1,13 +1,12 @@
package mage.cards.k; package mage.cards.k;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.RevealLibraryPickControllerEffect;
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.filter.FilterCard; import mage.filter.FilterCard;
/** /**
@ -16,7 +15,7 @@ import mage.filter.FilterCard;
*/ */
public final class KruphixsInsight extends CardImpl { public final class KruphixsInsight extends CardImpl {
private static final FilterCard filter = new FilterCard("up to three enchantment cards"); private static final FilterCard filter = new FilterCard("enchantment cards");
static { static {
filter.add(CardType.ENCHANTMENT.getPredicate()); filter.add(CardType.ENCHANTMENT.getPredicate());
@ -25,9 +24,13 @@ public final class KruphixsInsight extends CardImpl {
public KruphixsInsight(UUID ownerId, CardSetInfo setInfo) { public KruphixsInsight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{G}"); super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{G}");
// Reveal the top six cards of your library. Put up to three enchantment cards from among them into your hand
// Reveal the top six cards of your library. Put up to three enchantment cards from among them into your hand and the rest of the revealed cards into your graveyard. // and the rest of the revealed cards into your graveyard.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(6), false, StaticValue.get(3), filter, Zone.GRAVEYARD, false, true, true,Zone.HAND, false)); Effect effect = new RevealLibraryPickControllerEffect(6, 3, filter, PutCards.HAND, PutCards.GRAVEYARD, false);
effect.setText("reveal the top six cards of your library. " +
"Put up to three enchantment cards from among them into your hand " +
"and the rest of the revealed cards into your graveyard");
this.getSpellAbility().addEffect(effect);
} }
private KruphixsInsight(final KruphixsInsight card) { private KruphixsInsight(final KruphixsInsight card) {

View file

@ -1,10 +1,12 @@
package mage.cards.l; package mage.cards.l;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.filter.FilterCard; import mage.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -13,22 +15,16 @@ import java.util.UUID;
*/ */
public final class LeadTheStampede extends CardImpl { public final class LeadTheStampede extends CardImpl {
private static final FilterCard filter = new FilterCard("any number of creature cards");
static {
filter.add(CardType.CREATURE.getPredicate());
}
public LeadTheStampede(UUID ownerId, CardSetInfo setInfo) { public LeadTheStampede(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
// Look at the top five cards of your library. You may reveal any number of creature cards from among them and put the revealed cards into your hand. Put the rest on the bottom of your library in any order. // Look at the top five cards of your library. You may reveal any number of creature cards from among them and put the revealed cards into your hand. Put the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( Effect effect = new LookLibraryAndPickControllerEffect(
5, 5, filter, true 5, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURES, PutCards.HAND, PutCards.BOTTOM_ANY);
).setText("Look at the top five cards of your library. " + effect.setText("look at the top five cards of your library. " +
"You may reveal any number of creature cards from among them " + "You may reveal any number of creature cards from among them and put the revealed cards into your hand. " +
"and put the revealed cards into your hand. " + "Put the rest on the bottom of your library in any order");
"Put the rest on the bottom of your library in any order.")); this.getSpellAbility().addEffect(effect);
} }
private LeadTheStampede(final LeadTheStampede card) { private LeadTheStampede(final LeadTheStampede card) {

View file

@ -2,13 +2,12 @@ package mage.cards.l;
import java.util.UUID; import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.effects.common.discard.DiscardTargetEffect;
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.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
@ -34,12 +33,7 @@ public final class LilianasSpoils extends CardImpl {
// Look at the top five cards of your library. You may reveal a black card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // Look at the top five cards of your library. You may reveal a black card from among them and put it into your hand. Put the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
StaticValue.get(5), false, StaticValue.get(1), filter, 5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM).concatBy("<br>"));
Zone.LIBRARY, false, true, false, Zone.HAND, true, false, false
).setBackInRandomOrder(true).setText("<br>Look at the top five cards of your library. "
+ "You may reveal a black card from among them and put it into your hand. "
+ "Put the rest on the bottom of your library in a random order.")
);
} }
private LilianasSpoils(final LilianasSpoils card) { private LilianasSpoils(final LilianasSpoils card) {

View file

@ -8,8 +8,7 @@ import mage.abilities.hint.common.OpenSideboardHint;
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.filter.FilterCard; import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
/** /**
* *
@ -17,19 +16,11 @@ import mage.filter.predicate.Predicates;
*/ */
public final class LivingWish extends CardImpl { public final class LivingWish extends CardImpl {
private static final FilterCard filter = new FilterCard("creature or land card");
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.LAND.getPredicate()));
}
public LivingWish(UUID ownerId, CardSetInfo setInfo) { public LivingWish(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// You may reveal a creature or land card you own from outside the game and put it into your hand. // You may reveal a creature or land card you own from outside the game and put it into your hand.
this.getSpellAbility().addEffect(new WishEffect(filter)); this.getSpellAbility().addEffect(new WishEffect(StaticFilters.FILTER_CARD_CREATURE_OR_LAND));
this.getSpellAbility().addHint(OpenSideboardHint.instance); this.getSpellAbility().addHint(OpenSideboardHint.instance);
// Exile Living Wish. // Exile Living Wish.

View file

@ -1,31 +1,30 @@
package mage.cards.l; package mage.cards.l;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.HexproofAbility; import mage.abilities.keyword.HexproofAbility;
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.ComparisonType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.filter.StaticFilters;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
/** /**
* *
* @author jeffwadsworth * @author awjackson
*/ */
public final class LoneRevenant extends CardImpl { public final class LoneRevenant extends CardImpl {
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, ComparisonType.EQUAL_TO, 0);
public LoneRevenant(UUID ownerId, CardSetInfo setInfo) { public LoneRevenant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}"); super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}");
this.subtype.add(SubType.SPIRIT); this.subtype.add(SubType.SPIRIT);
@ -35,8 +34,17 @@ public final class LoneRevenant extends CardImpl {
this.addAbility(HexproofAbility.getInstance()); this.addAbility(HexproofAbility.getInstance());
// Whenever Lone Revenant deals combat damage to a player, if you control no other creatures, look at the top four cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order. // Whenever Lone Revenant deals combat damage to a player,
this.addAbility(new LoneRevenantTriggeredAbility()); // if you control no other creatures, look at the top four cards of your library.
// Put one of them into your hand and the rest on the bottom of your library in any order.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new DealsCombatDamageToAPlayerTriggeredAbility(
new LookLibraryAndPickControllerEffect(4, 1, PutCards.HAND, PutCards.BOTTOM_ANY),
false
), condition, "Whenever {this} deals combat damage to a player, " +
"if you control no other creatures, look at the top four cards of your library. " +
"Put one of them into your hand and the rest on the bottom of your library in any order."
));
} }
private LoneRevenant(final LoneRevenant card) { private LoneRevenant(final LoneRevenant card) {
@ -48,46 +56,3 @@ public final class LoneRevenant extends CardImpl {
return new LoneRevenant(this); return new LoneRevenant(this);
} }
} }
class LoneRevenantTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
public LoneRevenantTriggeredAbility() {
super(Zone.BATTLEFIELD, new LookLibraryAndPickControllerEffect(StaticValue.get(4), false, StaticValue.get(1), new FilterCard(), Zone.LIBRARY, false, false));
}
public LoneRevenantTriggeredAbility(final LoneRevenantTriggeredAbility ability) {
super(ability);
}
@Override
public LoneRevenantTriggeredAbility copy() {
return new LoneRevenantTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent permanent = game.getPermanent(event.getSourceId());
int number = game.getBattlefield().countAll(filter, controllerId, game);
if (permanent != null && number != 1) {
return false;
}
return permanent != null || number == 0;
}
return false;
}
@Override
public String getTriggerPhrase() {
return "Whenever {this} deals combat damage to a player, if you control no other creatures, " ;
}
}

View file

@ -1,36 +1,31 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
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.filter.StaticFilters;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
/** /**
* *
* @author Alexsandr0x * @author Alexsandr0x
*/ */
public final class Machinate extends CardImpl { public final class Machinate extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("artifacts you control");
static { private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACTS, null);
filter.add(CardType.ARTIFACT.getPredicate());
}
public Machinate(UUID ownerId, CardSetInfo setInfo) { public Machinate(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
// Look at the top X cards of your library, where X is the number of artifacts you control. Put one of those cards into your hand and the rest on the bottom of your library in any order. // Look at the top X cards of your library, where X is the number of artifacts you control. Put one of those cards into your hand and the rest on the bottom of your library in any order.
DynamicValue artifactsOnControl = new PermanentsOnBattlefieldCount(filter); Effect effect = new LookLibraryAndPickControllerEffect(xValue, 1, PutCards.HAND, PutCards.BOTTOM_ANY);
LookLibraryAndPickControllerEffect effect = new LookLibraryAndPickControllerEffect(artifactsOnControl, false, StaticValue.get(1), new FilterCard(), Zone.LIBRARY, false, false); effect.setText("look at the top X cards of your library, where X is the number of artifacts you control. " +
effect.setText("Look at the top X cards of your library, where X is the number of artifacts you control. Put one of those cards into your hand and the rest on the bottom of your library in any order."); "Put one of those cards into your hand and the rest on the bottom of your library in any order");
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addEffect(effect);
} }

View file

@ -1,16 +1,14 @@
package mage.cards.m; package mage.cards.m;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.LoseLifeOpponentsEffect; import mage.abilities.effects.common.LoseLifeOpponentsEffect;
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.filter.StaticFilters;
import mage.target.common.TargetCreatureOrPlaneswalker; import mage.target.common.TargetCreatureOrPlaneswalker;
import java.util.UUID; import java.util.UUID;
@ -25,10 +23,9 @@ public final class MaestrosCharm extends CardImpl {
// Choose one // Choose one
// Look at the top five cards of your library. Put one of those cards into your hand and the rest into your graveyard. // Look at the top five cards of your library. Put one of those cards into your hand and the rest into your graveyard.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(5, 1, PutCards.HAND, PutCards.GRAVEYARD)
StaticValue.get(5), false, StaticValue.get(1), StaticFilters.FILTER_CARD, .setText("look at the top five cards of your library. " +
Zone.GRAVEYARD, false, false, false, Zone.HAND, false "Put one of those cards into your hand and the rest into your graveyard"));
));
// Each opponent loses 3 life and you gain 3 life. // Each opponent loses 3 life and you gain 3 life.
Mode mode = new Mode(new LoseLifeOpponentsEffect(3)); Mode mode = new Mode(new LoseLifeOpponentsEffect(3));

View file

@ -7,13 +7,13 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.SubType;
import mage.constants.ComparisonType; import mage.constants.ComparisonType;
import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.PowerPredicate; import mage.filter.predicate.mageobject.PowerPredicate;
@ -41,8 +41,8 @@ public final class MayaelTheAnima extends CardImpl {
// {3}{R}{G}{W}, {tap}: Look at the top five cards of your library. // {3}{R}{G}{W}, {tap}: Look at the top five cards of your library.
// You may put a creature card with power 5 or greater from among them onto the battlefield. // You may put a creature card with power 5 or greater from among them onto the battlefield.
// Put the rest on the bottom of your library in any order. // Put the rest on the bottom of your library in any order.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, SimpleActivatedAbility ability = new SimpleActivatedAbility(
new LookLibraryAndPickControllerEffect(5,1, filter,false, false, Zone.BATTLEFIELD, true), new LookLibraryAndPickControllerEffect(5, 1, filter, PutCards.BATTLEFIELD, PutCards.BOTTOM_ANY),
new ManaCostsImpl("{3}{R}{G}{W}")); new ManaCostsImpl("{3}{R}{G}{W}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
this.addAbility(ability); this.addAbility(ability);

View file

@ -1,16 +1,16 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.HeroicAbility; import mage.abilities.keyword.HeroicAbility;
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.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterEnchantmentCard;
/** /**
* *
@ -18,10 +18,7 @@ import mage.filter.FilterCard;
*/ */
public final class MeletisAstronomer extends CardImpl { public final class MeletisAstronomer extends CardImpl {
private static final FilterCard filter = new FilterCard("an enchantment card"); private static final FilterCard filter = new FilterEnchantmentCard("an enchantment card");
static {
filter.add(CardType.ENCHANTMENT.getPredicate());
}
public MeletisAstronomer(UUID ownerId, CardSetInfo setInfo) { public MeletisAstronomer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");
@ -32,7 +29,7 @@ public final class MeletisAstronomer extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// <i>Heroic</i> &mdash; Whenever you cast a spell that targets Meletis Astronomer, look at the top three cards of your library. You may reveal an enchantment card from among them and put it into your hand. Put the rest on the bottom of your library in any order. // <i>Heroic</i> &mdash; Whenever you cast a spell that targets Meletis Astronomer, look at the top three cards of your library. You may reveal an enchantment card from among them and put it into your hand. Put the rest on the bottom of your library in any order.
this.addAbility(new HeroicAbility(new LookLibraryAndPickControllerEffect(3, 1, filter, true, false, Zone.HAND, true), false)); this.addAbility(new HeroicAbility(new LookLibraryAndPickControllerEffect(3, 1, filter, PutCards.HAND, PutCards.BOTTOM_ANY)));
} }
private MeletisAstronomer(final MeletisAstronomer card) { private MeletisAstronomer(final MeletisAstronomer card) {

View file

@ -1,4 +1,3 @@
package mage.cards.m; package mage.cards.m;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -7,15 +6,13 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.mana.GreenManaAbility; import mage.abilities.mana.GreenManaAbility;
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.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
import java.util.UUID; import java.util.UUID;
@ -27,21 +24,20 @@ public final class MemorialToUnity extends CardImpl {
public MemorialToUnity(UUID ownerId, CardSetInfo setInfo) { public MemorialToUnity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// Memorial to Uniity enters the battlefield tapped. // Memorial to Unity enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility()); this.addAbility(new EntersBattlefieldTappedAbility());
this.addAbility(new GreenManaAbility()); this.addAbility(new GreenManaAbility());
// {2}{G}, {T}, Sacrifice Memorial to Unity: Look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand. Then put the rest on the bottom of your library in a random order. // {2}{G}, {T}, Sacrifice Memorial to Unity: Look at the top five cards of your library.
Effect effect = new LookLibraryAndPickControllerEffect( // You may reveal a creature card from among them and put it into your hand.
StaticValue.get(5), false, StaticValue.get(1), new FilterCreatureCard("a creature card"), false, true // Then put the rest on the bottom of your library in a random order.
).setBackInRandomOrder(true); Ability ability = new SimpleActivatedAbility(
new LookLibraryAndPickControllerEffect(5, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_RANDOM),
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{2}{G}")); new ManaCostsImpl("{2}{G}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
this.addAbility(ability); this.addAbility(ability);
} }
private MemorialToUnity(final MemorialToUnity card) { private MemorialToUnity(final MemorialToUnity card) {
@ -52,5 +48,4 @@ public final class MemorialToUnity extends CardImpl {
public MemorialToUnity copy() { public MemorialToUnity copy() {
return new MemorialToUnity(this); return new MemorialToUnity(this);
} }
} }

View file

@ -2,14 +2,12 @@ package mage.cards.m;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.ManaSpentToCastCount; import mage.abilities.dynamicvalue.common.ManaSpentToCastCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.FlashbackAbility; import mage.abilities.keyword.FlashbackAbility;
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.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -23,9 +21,8 @@ public final class MemoryDeluge extends CardImpl {
// Look at the top X cards of your library, where X is the amount of mana spent to cast this spell. Put two of them into your hand and the rest on the bottom of your library in a random order. // Look at the top X cards of your library, where X is the amount of mana spent to cast this spell. Put two of them into your hand and the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect( this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
ManaSpentToCastCount.instance, false, StaticValue.get(2), ManaSpentToCastCount.instance, 2, PutCards.HAND, PutCards.BOTTOM_RANDOM
StaticFilters.FILTER_CARD, Zone.LIBRARY, false, false ).setText("look at the top X cards of your library, where X " +
).setBackInRandomOrder(true).setText("look at the top X cards of your library, where X " +
"is the amount of mana spent to cast this spell. Put two of them into your " + "is the amount of mana spent to cast this spell. Put two of them into your " +
"hand and the rest on the bottom of your library in a random order")); "hand and the rest on the bottom of your library in a random order"));

View file

@ -2,15 +2,14 @@ package mage.cards.m;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.VigilanceAbility;
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.ComparisonType; import mage.constants.ComparisonType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.PowerPredicate; import mage.filter.predicate.mageobject.PowerPredicate;
@ -38,11 +37,11 @@ public final class MilitiaBugler extends CardImpl {
// Vigilance // Vigilance
this.addAbility(VigilanceAbility.getInstance()); this.addAbility(VigilanceAbility.getInstance());
// When Militia Bugler enters the battlefield, look at the top four cards of your library. You may reveal a creature card with power 2 or less from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // When Militia Bugler enters the battlefield, look at the top four cards of your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect( // You may reveal a creature card with power 2 or less from among them and put it into your hand.
StaticValue.get(4), false, StaticValue.get(1), filter, Zone.LIBRARY, false, // Put the rest on the bottom of your library in a random order.
true, true, Zone.HAND, false, true, false this.addAbility(new EntersBattlefieldTriggeredAbility(
), false)); new LookLibraryAndPickControllerEffect(4, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM)));
} }
private MilitiaBugler(final MilitiaBugler card) { private MilitiaBugler(final MilitiaBugler card) {

View file

@ -1,29 +1,31 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.AllyEntersBattlefieldTriggeredAbility; import mage.abilities.common.AllyEntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards; import mage.constants.CardType;
import mage.cards.CardsImpl; import mage.constants.SubType;
import mage.constants.*; import mage.constants.SuperType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/** /**
* *
* @author LevelX2 * @author awjackson
*/ */
public final class MundaAmbushLeader extends CardImpl { public final class MundaAmbushLeader extends CardImpl {
private static final FilterCard filter = new FilterCard("Ally cards");
static {
filter.add(SubType.ALLY.getPredicate());
}
public MundaAmbushLeader(UUID ownerId, CardSetInfo setInfo) { public MundaAmbushLeader(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{W}"); super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{W}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
@ -34,9 +36,13 @@ public final class MundaAmbushLeader extends CardImpl {
// Haste // Haste
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
// <i>Rally</i>-Whenever Munda, Ambush Leader or another Ally enters the battlefield under your control, you may look at the top four cards of your library. If you do, reveal any number of Ally cards from among them, then put those cards on top of your library in any order and the rest on the bottom in any order. // <i>Rally</i>-Whenever Munda, Ambush Leader or another Ally enters the battlefield under your control,
this.addAbility(new AllyEntersBattlefieldTriggeredAbility(new MundaAmbushLeaderEffect(), true)); // you may look at the top four cards of your library. If you do, reveal any number of Ally cards from among them,
// then put those cards on top of your library in any order and the rest on the bottom in any order.
Effect effect = new LookLibraryAndPickControllerEffect(4, Integer.MAX_VALUE, filter, PutCards.TOP_ANY, PutCards.BOTTOM_ANY, false);
effect.setText("look at the top four cards of your library. If you do, reveal any number of Ally cards from among them, "
+ "then put those cards on top of your library in any order and the rest on the bottom in any order");
this.addAbility(new AllyEntersBattlefieldTriggeredAbility(effect, true));
} }
private MundaAmbushLeader(final MundaAmbushLeader card) { private MundaAmbushLeader(final MundaAmbushLeader card) {
@ -48,53 +54,3 @@ public final class MundaAmbushLeader extends CardImpl {
return new MundaAmbushLeader(this); return new MundaAmbushLeader(this);
} }
} }
class MundaAmbushLeaderEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("Ally cards to reveal and put on top of your library");
static {
filter.add(SubType.ALLY.getPredicate());
}
public MundaAmbushLeaderEffect() {
super(Outcome.Benefit);
this.staticText = "you may look at the top four cards of your library. If you do, reveal any number of Ally cards from among them, then put those cards on top of your library in any order and the rest on the bottom in any order";
}
public MundaAmbushLeaderEffect(final MundaAmbushLeaderEffect effect) {
super(effect);
}
@Override
public MundaAmbushLeaderEffect copy() {
return new MundaAmbushLeaderEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source);
if (controller != null && sourceObject != null) {
Cards allCards = new CardsImpl();
allCards.addAll(controller.getLibrary().getTopCards(game, 4));
controller.lookAtCards(sourceObject.getIdName(), allCards, game);
if (!allCards.isEmpty()) {
Cards cardsToReveal = new CardsImpl();
TargetCard target = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, filter);
controller.chooseTarget(outcome, allCards, target, source, game);
cardsToReveal.addAll(target.getTargets());
if (!cardsToReveal.isEmpty()) {
controller.revealCards(sourceObject.getIdName(), cardsToReveal, game, true);
allCards.removeAll(cardsToReveal);
}
controller.putCardsOnTopOfLibrary(cardsToReveal, game, source, true);
}
if (!allCards.isEmpty()) {
controller.putCardsOnBottomOfLibrary(allCards, game, source, true);
}
return true;
}
return false;
}
}

View file

@ -1,18 +1,14 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
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.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
/** /**
* *
@ -30,21 +26,8 @@ public final class NagaOracle extends CardImpl {
// When Naga Oracle enters the battlefield, look at the top three cards of your library. Put any number of them into your graveyard // When Naga Oracle enters the battlefield, look at the top three cards of your library. Put any number of them into your graveyard
// and the rest back on top of your library in any order. // and the rest back on top of your library in any order.
Effect effect = new LookLibraryAndPickControllerEffect( addAbility(new EntersBattlefieldTriggeredAbility(
/* oh god, Microsoft looks conservative with their function parameters in comparison */ new LookLibraryAndPickControllerEffect(3, Integer.MAX_VALUE, PutCards.GRAVEYARD, PutCards.TOP_ANY)));
StaticValue.get(3),
false,
StaticValue.get(3),
new FilterCard("cards"),
Zone.LIBRARY,
true,
false,
true,
Zone.GRAVEYARD,
false);
effect.setText("look at the top three cards of your library. Put any number of them into your graveyard "
+ "and the rest back on top of your library in any order");
addAbility(new EntersBattlefieldTriggeredAbility(effect));
} }
private NagaOracle(final NagaOracle card) { private NagaOracle(final NagaOracle card) {

View file

@ -1,16 +1,13 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID; import java.util.UUID;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.keyword.MadnessAbility; import mage.abilities.keyword.MadnessAbility;
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.filter.FilterCard;
/** /**
* *
@ -22,7 +19,7 @@ public final class NaggingThoughts extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{U}"); super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{U}");
// Look at the top two cards of your library. Put one of them into your hand and the other into your graveyard. // Look at the top two cards of your library. Put one of them into your hand and the other into your graveyard.
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(StaticValue.get(2), false, StaticValue.get(1), new FilterCard(), Zone.GRAVEYARD, false, false)); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(2, 1, PutCards.HAND, PutCards.GRAVEYARD));
// Madness {1}{U} // Madness {1}{U}
this.addAbility(new MadnessAbility(new ManaCostsImpl("{1}{U}"))); this.addAbility(new MadnessAbility(new ManaCostsImpl("{1}{U}")));

View file

@ -5,10 +5,10 @@ import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
@ -35,7 +35,7 @@ import java.util.stream.Collectors;
*/ */
public final class NahiriHeirOfTheAncients extends CardImpl { public final class NahiriHeirOfTheAncients extends CardImpl {
private static final FilterCard filter = new FilterCard("Warrior or Equipment card"); private static final FilterCard filter = new FilterCard("a Warrior or Equipment card");
static { static {
filter.add(Predicates.or( filter.add(Predicates.or(
@ -57,15 +57,10 @@ public final class NahiriHeirOfTheAncients extends CardImpl {
// +1: Create a 1/1 white Kor Warrior creature token. You may attach an Equipment you control to it. // +1: Create a 1/1 white Kor Warrior creature token. You may attach an Equipment you control to it.
this.addAbility(new LoyaltyAbility(new NahiriHeirOfTheAncientsEffect(), 1)); this.addAbility(new LoyaltyAbility(new NahiriHeirOfTheAncientsEffect(), 1));
// 2: Look at the top six cards of your library. You may reveal a Warrior or Equipment card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // 2: Look at the top six cards of your library.
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect( // You may reveal a Warrior or Equipment card from among them and put it into your hand.
StaticValue.get(6), false, StaticValue.get(1), filter, // Put the rest on the bottom of your library in a random order.
Zone.LIBRARY, false, true, false, Zone.HAND, this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(6, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM), -2));
true, false, false
).setBackInRandomOrder(true).setText("Look at the top six cards of your library. " +
"You may reveal a Warrior or Equipment card from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order."
), -2));
// 3: Nahiri, Heir of the Ancients deals damage to target creature or planeswalker equal to twice the number of Equipment you control. // 3: Nahiri, Heir of the Ancients deals damage to target creature or planeswalker equal to twice the number of Equipment you control.
Ability ability = new LoyaltyAbility(new DamageTargetEffect(xValue) Ability ability = new LoyaltyAbility(new DamageTargetEffect(xValue)

View file

@ -3,9 +3,9 @@ package mage.cards.n;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
@ -23,7 +23,7 @@ import java.util.UUID;
*/ */
public final class NarsetParterOfVeils extends CardImpl { public final class NarsetParterOfVeils extends CardImpl {
private static final FilterCard filter = new FilterCard("noncreature, nonland card"); private static final FilterCard filter = new FilterCard("a noncreature, nonland card");
static { static {
filter.add(Predicates.not(CardType.CREATURE.getPredicate())); filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
@ -40,15 +40,10 @@ public final class NarsetParterOfVeils extends CardImpl {
// Each opponent can't draw more than one card each turn. // Each opponent can't draw more than one card each turn.
this.addAbility(new SimpleStaticAbility(new NarsetParterOfVeilsEffect()), new CardsAmountDrawnThisTurnWatcher()); this.addAbility(new SimpleStaticAbility(new NarsetParterOfVeilsEffect()), new CardsAmountDrawnThisTurnWatcher());
// -2: Look at the top four cards of your library. You may reveal a noncreature, nonland card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. // -2: Look at the top four cards of your library.
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect( // You may reveal a noncreature, nonland card from among them and put it into your hand.
StaticValue.get(4), false, StaticValue.get(1), filter, // Put the rest on the bottom of your library in a random order.
Zone.LIBRARY, false, true, false, Zone.HAND, this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(4, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM), -2));
true, false, false
).setBackInRandomOrder(true).setText("Look at the top four cards of your library. " +
"You may reveal a noncreature, nonland card from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order."
), -2));
} }
private NarsetParterOfVeils(final NarsetParterOfVeils card) { private NarsetParterOfVeils(final NarsetParterOfVeils card) {

View file

@ -5,10 +5,10 @@ import mage.abilities.common.DiesAttachedTriggeredAbility;
import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect.PutCards;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
@ -16,7 +16,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
@ -47,12 +46,10 @@ public final class Necrosynthesis extends CardImpl {
effect.setText("Enchanted creature has \"Whenever another creature dies, put a +1/+1 counter on this creature.\""); effect.setText("Enchanted creature has \"Whenever another creature dies, put a +1/+1 counter on this creature.\"");
this.addAbility(new SimpleStaticAbility(effect)); this.addAbility(new SimpleStaticAbility(effect));
// When enchanted creature dies, look at the top X cards of your library, where X is its power. Put one of those cards into your hand and the rest on the bottom of your library in a random order. // When enchanted creature dies, look at the top X cards of your library, where X is its power.
// Put one of those cards into your hand and the rest on the bottom of your library in a random order.
DynamicValue attachedPower = new NecrosynthesisAttachedPermanentPowerCount(); DynamicValue attachedPower = new NecrosynthesisAttachedPermanentPowerCount();
effect = new LookLibraryAndPickControllerEffect( effect = new LookLibraryAndPickControllerEffect(attachedPower, 1, PutCards.HAND, PutCards.BOTTOM_RANDOM);
attachedPower, false, StaticValue.get(1), StaticFilters.FILTER_CARD, false,
false
).setBackInRandomOrder(true);
effect.setText("look at the top X cards of your library, where X is its power. " + effect.setText("look at the top X cards of your library, where X is its power. " +
"Put one of those cards into your hand and the rest on the bottom of your library in a random order"); "Put one of those cards into your hand and the rest on the bottom of your library in a random order");
ability = new DiesAttachedTriggeredAbility(effect, "enchanted creature"); ability = new DiesAttachedTriggeredAbility(effect, "enchanted creature");

Some files were not shown because too many files have changed in this diff Show more