From 02fa9e6c81b8f647e72eedbcab1850df1a2a3310 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 21 Apr 2013 22:41:57 +0200 Subject: [PATCH] Chenged cards using LookLibraryAndPickControllerEffect. --- .../OpalEyeKondasYojimbo.java | 2 - .../CommuneWithNature.java | 2 +- .../PeerThroughDepths.java | 2 +- .../mage/sets/conflux/FaerieMechanist.java | 2 +- .../src/mage/sets/magic2013/AugurOfBolas.java | 98 ++--------------- .../mirrodinbesieged/LeadTheStampede.java | 101 ++---------------- .../TezzeretAgentOfBolas.java | 90 ++-------------- .../riseoftheeldrazi/AncientStirrings.java | 3 +- 8 files changed, 30 insertions(+), 270 deletions(-) diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/OpalEyeKondasYojimbo.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/OpalEyeKondasYojimbo.java index 1813a07c3e..67626cec08 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/OpalEyeKondasYojimbo.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/OpalEyeKondasYojimbo.java @@ -146,8 +146,6 @@ class OpalEyeKondasYojimboRedirectionEffect extends ReplacementEffectImpl { - private static final FilterCard filter = new FilterCard("creature card"); + private static final FilterCard filter = new FilterCard("a creature card"); static { filter.add(new CardTypePredicate(CardType.CREATURE)); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/PeerThroughDepths.java b/Mage.Sets/src/mage/sets/championsofkamigawa/PeerThroughDepths.java index 9cadeab756..9d5eff6869 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/PeerThroughDepths.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/PeerThroughDepths.java @@ -44,7 +44,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate; */ public class PeerThroughDepths extends CardImpl { - private static final FilterCard filter = new FilterCard("instant or sorcery card"); + private static final FilterCard filter = new FilterCard("an instant or sorcery card"); static { filter.add(Predicates.or( new CardTypePredicate(CardType.SORCERY), diff --git a/Mage.Sets/src/mage/sets/conflux/FaerieMechanist.java b/Mage.Sets/src/mage/sets/conflux/FaerieMechanist.java index da4abbdeff..523ac8ed7f 100644 --- a/Mage.Sets/src/mage/sets/conflux/FaerieMechanist.java +++ b/Mage.Sets/src/mage/sets/conflux/FaerieMechanist.java @@ -46,7 +46,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate; */ public class FaerieMechanist extends CardImpl { - private static final FilterCard filter = new FilterCard("artifact card"); + private static final FilterCard filter = new FilterCard("an artifact card"); static { filter.add(new CardTypePredicate(CardType.ARTIFACT)); } diff --git a/Mage.Sets/src/mage/sets/magic2013/AugurOfBolas.java b/Mage.Sets/src/mage/sets/magic2013/AugurOfBolas.java index e4282073bb..97b28aea78 100644 --- a/Mage.Sets/src/mage/sets/magic2013/AugurOfBolas.java +++ b/Mage.Sets/src/mage/sets/magic2013/AugurOfBolas.java @@ -28,23 +28,15 @@ package mage.sets.magic2013; import java.util.UUID; -import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.cards.CardImpl; -import mage.cards.Cards; -import mage.cards.CardsImpl; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; -import mage.players.Player; -import mage.target.TargetCard; /** * @@ -52,6 +44,11 @@ import mage.target.TargetCard; */ public class AugurOfBolas extends CardImpl { + private static final FilterCard filter = new FilterCard("an instant or sorcery card"); + static { + filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY))); + } + public AugurOfBolas(UUID ownerId) { super(ownerId, 43, "Augur of Bolas", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.expansionSetCode = "M13"; @@ -63,7 +60,7 @@ public class AugurOfBolas extends CardImpl { 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. - this.addAbility(new EntersBattlefieldTriggeredAbility(new AugurOfBolasEffect())); + this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(3, 1, filter, false))); } public AugurOfBolas(final AugurOfBolas card) { @@ -75,84 +72,3 @@ public class AugurOfBolas extends CardImpl { return new AugurOfBolas(this); } } - -class AugurOfBolasEffect extends OneShotEffect { - - private static final FilterCard filter = new FilterCard("Instant or Sorcery card"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.INSTANT), - new CardTypePredicate(CardType.SORCERY))); - } - - public AugurOfBolasEffect() { - super(Constants.Outcome.DrawCard); - 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 player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - - Cards cards = new CardsImpl(Constants.Zone.PICK); - boolean spellFound = false; - int count = Math.min(player.getLibrary().size(), 3); - for (int i = 0; i < count; i++) { - Card card = player.getLibrary().removeFromTop(game); - if (card != null) { - cards.add(card); - game.setZone(card.getId(), Constants.Zone.PICK); - if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) { - spellFound = true; - } - } - } - player.lookAtCards("Augur of Bolas", cards, game); - - if (spellFound && player.chooseUse(Constants.Outcome.DrawCard, "Do you wish to reveal an instant or sorcery card and put it into your hand?", game)) { - TargetCard target = new TargetCard(Constants.Zone.PICK, filter); - if (player.choose(Constants.Outcome.DrawCard, cards, target, game)) { - Card card = cards.get(target.getFirstTarget(), game); - if (card != null) { - cards.remove(card); - card.moveToZone(Constants.Zone.HAND, source.getId(), game, false); - - Cards reveal = new CardsImpl(Constants.Zone.OUTSIDE); - reveal.add(card); - player.revealCards("Augur of Bolas", reveal, game); - } - } - } - - TargetCard target = new TargetCard(Constants.Zone.PICK, new FilterCard("card to put on the bottom of your library")); - target.setRequired(true); - while (cards.size() > 1) { - player.choose(Constants.Outcome.Neutral, cards, target, game); - Card card = cards.get(target.getFirstTarget(), game); - if (card != null) { - cards.remove(card); - card.moveToZone(Constants.Zone.LIBRARY, source.getId(), game, false); - } - target.clearChosen(); - } - if (cards.size() == 1) { - Card card = cards.get(cards.iterator().next(), game); - card.moveToZone(Constants.Zone.LIBRARY, source.getId(), game, false); - } - - return true; - } -} diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/LeadTheStampede.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/LeadTheStampede.java index 6a27f1d8f4..2319e94114 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/LeadTheStampede.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/LeadTheStampede.java @@ -27,23 +27,13 @@ */ package mage.sets.mirrodinbesieged; -import java.util.List; import java.util.UUID; import mage.Constants.CardType; -import mage.Constants.Outcome; import mage.Constants.Rarity; -import mage.Constants.Zone; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.cards.CardImpl; -import mage.cards.Cards; -import mage.cards.CardsImpl; import mage.filter.FilterCard; -import mage.filter.common.FilterCreatureCard; -import mage.game.Game; -import mage.players.Player; -import mage.target.TargetCard; +import mage.filter.predicate.mageobject.CardTypePredicate; /** * @@ -51,13 +41,18 @@ import mage.target.TargetCard; */ public class LeadTheStampede extends CardImpl { + private static final FilterCard filter = new FilterCard("any number of creature cards"); + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + } + public LeadTheStampede(UUID ownerId) { super(ownerId, 82, "Lead the Stampede", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}"); this.expansionSetCode = "MBS"; this.color.setGreen(true); - - this.getSpellAbility().addEffect(new LeadTheStampedeEffect()); + // 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(5, 5, filter, true)); } public LeadTheStampede(final LeadTheStampede card) { @@ -69,81 +64,3 @@ public class LeadTheStampede extends CardImpl { return new LeadTheStampede(this); } } - -class LeadTheStampedeEffect extends OneShotEffect { - - public LeadTheStampedeEffect() { - super(Outcome.DrawCard); - this.staticText = "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"; - } - - public LeadTheStampedeEffect(final LeadTheStampedeEffect effect) { - super(effect); - } - - @Override - public LeadTheStampedeEffect copy() { - return new LeadTheStampedeEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - - Cards cards = new CardsImpl(Zone.PICK); - int creatureCardsFound = 0; - int count = Math.min(player.getLibrary().size(), 5); - for (int i = 0; i < count; i++) { - Card card = player.getLibrary().removeFromTop(game); - if (card != null) { - cards.add(card); - game.setZone(card.getId(), Zone.PICK); - if (card.getCardType().contains(CardType.CREATURE)) { - creatureCardsFound++; - } - } - } - player.lookAtCards("Lead the Stampede", cards, game); - - if (creatureCardsFound > 0 && player.chooseUse(Outcome.DrawCard, "Do you wish to reveal creature cards and put them into your hand?", game)) { - Cards revealedCards = new CardsImpl(); - TargetCard target = new TargetCard(0, creatureCardsFound, Zone.PICK, new FilterCreatureCard("creature cards to reveal and put into your hand")); - - if (player.choose(Outcome.DrawCard, cards, target, game)) { - List targets = target.getTargets(); - for (UUID targetId : targets) { - Card card = cards.get(targetId, game); - if (card != null) { - cards.remove(card); - card.moveToZone(Zone.HAND, source.getId(), game, false); - revealedCards.add(card); - } - } - } - if (!revealedCards.isEmpty()) { - player.revealCards("Lead the Stampede", revealedCards, game); - } - } - - TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - target.setRequired(true); - while (cards.size() > 1) { - player.choose(Outcome.Neutral, cards, target, game); - Card card = cards.get(target.getFirstTarget(), game); - if (card != null) { - cards.remove(card); - card.moveToZone(Zone.LIBRARY, source.getId(), game, false); - } - target.clearChosen(); - } - if (cards.size() == 1) { - Card card = cards.get(cards.iterator().next(), game); - card.moveToZone(Zone.LIBRARY, source.getId(), game, false); - } - - return true; - } -} diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java index a972eeaa57..4bd1f25b21 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java @@ -32,7 +32,6 @@ import mage.Constants.CardType; import mage.Constants.Duration; import mage.Constants.Outcome; import mage.Constants.Rarity; -import mage.Constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; @@ -40,21 +39,17 @@ import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.continious.BecomesCreatureTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; -import mage.cards.Card; import mage.cards.CardImpl; -import mage.cards.Cards; -import mage.cards.CardsImpl; import mage.counters.CounterType; import mage.filter.FilterCard; -import mage.filter.common.FilterArtifactCard; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.permanent.token.Token; import mage.players.Player; -import mage.target.TargetCard; import mage.target.TargetPlayer; import mage.target.common.TargetArtifactPermanent; @@ -64,6 +59,11 @@ import mage.target.common.TargetArtifactPermanent; */ public class TezzeretAgentOfBolas extends CardImpl { + private static final FilterCard filter = new FilterCard("an artifact card"); + static { + filter.add(new CardTypePredicate(CardType.ARTIFACT)); + } + public TezzeretAgentOfBolas(UUID ownerId) { super(ownerId, 97, "Tezzeret, Agent of Bolas", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{2}{U}{B}"); this.expansionSetCode = "MBS"; @@ -72,12 +72,15 @@ public class TezzeretAgentOfBolas extends CardImpl { this.color.setBlack(true); this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false)); - this.addAbility(new LoyaltyAbility(new TezzeretAgentOfBolasEffect1(), 1)); + // +1: Look at the top five 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. + this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(5, 1, filter, true), 1)); + // -1: Target artifact becomes a 5/5 artifact creature. LoyaltyAbility ability1 = new LoyaltyAbility(new BecomesCreatureTargetEffect(new ArtifactCreatureToken(), "", Duration.EndOfGame), -1); ability1.addTarget(new TargetArtifactPermanent()); this.addAbility(ability1); + // -4: Target player loses X life and you gain X life, where X is twice the number of artifacts you control. LoyaltyAbility ability2 = new LoyaltyAbility(new TezzeretAgentOfBolasEffect2(), -4); ability2.addTarget(new TargetPlayer()); this.addAbility(ability2); @@ -95,79 +98,6 @@ public class TezzeretAgentOfBolas extends CardImpl { } -class TezzeretAgentOfBolasEffect1 extends OneShotEffect { - - public TezzeretAgentOfBolasEffect1() { - super(Outcome.DrawCard); - staticText = "Look at the top five 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"; - } - - public TezzeretAgentOfBolasEffect1(final TezzeretAgentOfBolasEffect1 effect) { - super(effect); - } - - @Override - public TezzeretAgentOfBolasEffect1 copy() { - return new TezzeretAgentOfBolasEffect1(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - - Cards cards = new CardsImpl(Zone.PICK); - boolean artifactFound = false; - int count = Math.min(player.getLibrary().size(), 5); - for (int i = 0; i < count; i++) { - Card card = player.getLibrary().removeFromTop(game); - if (card != null) { - cards.add(card); - game.setZone(card.getId(), Zone.PICK); - if (card.getCardType().contains(CardType.ARTIFACT)) { - artifactFound = true; - } - } - } - player.lookAtCards("Tezzeret, Agent of Bolas", cards, game); - - if (artifactFound && player.chooseUse(Outcome.DrawCard, "Do you wish to reveal an artifact card and put it into your hand?", game)) { - TargetCard target = new TargetCard(Zone.PICK, new FilterArtifactCard("artifact card to reveal and put into your hand")); - if (player.choose(Outcome.DrawCard, cards, target, game)) { - Card card = cards.get(target.getFirstTarget(), game); - if (card != null) { - cards.remove(card); - card.moveToZone(Zone.HAND, source.getId(), game, false); - - Cards reveal = new CardsImpl(Zone.OUTSIDE); - reveal.add(card); - player.revealCards("Tezzeret, Agent of Bolas", reveal, game); - } - } - } - - TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - target.setRequired(true); - while (cards.size() > 1) { - player.choose(Outcome.Neutral, cards, target, game); - Card card = cards.get(target.getFirstTarget(), game); - if (card != null) { - cards.remove(card); - card.moveToZone(Zone.LIBRARY, source.getId(), game, false); - } - target.clearChosen(); - } - if (cards.size() == 1) { - Card card = cards.get(cards.iterator().next(), game); - card.moveToZone(Zone.LIBRARY, source.getId(), game, false); - } - - return true; - } -} - class ArtifactCreatureToken extends Token { public ArtifactCreatureToken() { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/AncientStirrings.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/AncientStirrings.java index cd9c5a37dc..fa5db045d9 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/AncientStirrings.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/AncientStirrings.java @@ -43,7 +43,7 @@ import java.util.UUID; */ public class AncientStirrings extends CardImpl { - private static final FilterCard filter = new FilterCard("colorless card"); + private static final FilterCard filter = new FilterCard("a colorless card"); static { filter.add(new ColorlessPredicate()); @@ -70,4 +70,3 @@ public class AncientStirrings extends CardImpl { } } -