From 65f4b4c2d71cde09141ef307c42a7aad5055c504 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 4 Dec 2015 00:44:04 +0100 Subject: [PATCH 1/2] * Homura, Human Ascendant - Fixed return flipped ability. Fixed that some of the Enchantment abilities were applied to all permanents instad of only creatures. --- .../HomuraHumanAscendant.java | 67 +++++++++++++++++-- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/HomuraHumanAscendant.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/HomuraHumanAscendant.java index d1ae39ee11..8eba889753 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/HomuraHumanAscendant.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/HomuraHumanAscendant.java @@ -34,19 +34,29 @@ import mage.abilities.common.CantBlockAbility; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.FlippedCondition; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.FlipSourceEffect; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CopyTokenEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; +import mage.players.Player; /** * @@ -69,7 +79,7 @@ public class HomuraHumanAscendant extends CardImpl { // Homura, Human Ascendant can't block. this.addAbility(new CantBlockAbility()); // When Homura dies, return it to the battlefield flipped. - this.addAbility(new DiesTriggeredAbility(new FlipSourceEffect(new HomurasEssence2()))); + this.addAbility(new DiesTriggeredAbility(new HomuraReturnFlippedSourceEffect(new HomurasEssence2()))); } public HomuraHumanAscendant(final HomuraHumanAscendant card) { @@ -82,8 +92,46 @@ public class HomuraHumanAscendant extends CardImpl { } } -class HomurasEssence2 extends Token { +class HomuraReturnFlippedSourceEffect extends OneShotEffect { + private final Token flipToken; + + public HomuraReturnFlippedSourceEffect(Token flipToken) { + super(Outcome.BecomeCreature); + this.flipToken = flipToken; + staticText = "return it to the battlefield flipped"; + } + + public HomuraReturnFlippedSourceEffect(final HomuraReturnFlippedSourceEffect effect) { + super(effect); + this.flipToken = effect.flipToken; + } + + @Override + public boolean apply(Game game, Ability source) { + Card sourceCard = game.getCard(source.getSourceId()); + Player controller = game.getPlayer(source.getControllerId()); + if (sourceCard != null && controller != null && game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { + ContinuousEffect effect = new ConditionalContinuousEffect(new CopyTokenEffect(flipToken), FlippedCondition.getInstance(), ""); + game.addEffect(effect, source); + controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + permanent.flip(game); // not complete correct because it should enter the battlefield flipped + } + return true; + } + return false; + } + + @Override + public HomuraReturnFlippedSourceEffect copy() { + return new HomuraReturnFlippedSourceEffect(this); + } + +} + +class HomurasEssence2 extends Token { HomurasEssence2() { super("Homura's Essence", ""); @@ -91,10 +139,15 @@ class HomurasEssence2 extends Token { cardType.add(CardType.ENCHANTMENT); color.setRed(true); // Creatures you control get +2/+2 and have flying and "{R}: This creature gets +1/+0 until end of turn." - Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2, 2, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false)); - ability.addEffect(new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield)); - Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1,0, Duration.EndOfTurn), new ManaCostsImpl("{R}")); - ability.addEffect(new GainAbilityControlledEffect(gainedAbility, Duration.WhileOnBattlefield)); + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2, 2, Duration.WhileOnBattlefield, filter, false)); + Effect effect = new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield, filter); + effect.setText("and have flying"); + ability.addEffect(effect); + Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")); + effect = new GainAbilityControlledEffect(gainedAbility, Duration.WhileOnBattlefield, filter); + effect.setText("and \"{R}: This creature gets +1/+0 until end of turn.\""); + ability.addEffect(effect); this.addAbility(ability); } } From 3dcdd7f046f08eccfcb01ae14aa246bb4cf63434 Mon Sep 17 00:00:00 2001 From: emerald000 Date: Fri, 4 Dec 2015 00:34:10 -0500 Subject: [PATCH 2/2] Removed obsolete Zone parameter in CardsImpl constructors. --- .../sets/alarareborn/ArchitectsOfWill.java | 3 +- .../sets/alarareborn/SagesOfTheAnima.java | 2 +- Mage.Sets/src/mage/sets/alliances/Browse.java | 2 +- .../src/mage/sets/alliances/SoldeviSage1.java | 2 +- .../KioraMasterOfTheDepths.java | 2 +- .../mage/sets/bornofthegods/HeroesPodium.java | 2 +- .../sets/bornofthegods/SatyrWayfinder.java | 2 +- .../CranialExtraction.java | 54 +++++++------------ .../sets/commander2013/AEthermagesTouch.java | 2 +- .../mage/sets/commander2013/LimDulsVault.java | 4 +- .../commander2013/UnexpectedlyAbsent.java | 5 +- .../src/mage/sets/conflux/WorldlyCounsel.java | 10 ++-- .../sets/darkascension/CallToTheKindred.java | 10 ++-- .../sets/darkascension/JarOfEyeballs.java | 2 +- .../sets/darkascension/TrackersInstincts.java | 12 ++--- .../src/mage/sets/dissension/ProteanHulk.java | 2 +- .../sets/fifthdawn/PlungeIntoDarkness.java | 2 +- .../sets/fifthdawn/ReversalOfFortune.java | 2 +- .../src/mage/sets/iceage/OrcishLibrarian.java | 2 +- .../mage/sets/innistrad/ForbiddenAlchemy.java | 12 ++--- .../mage/sets/judgment/FlashOfInsight.java | 2 +- .../sets/khansoftarkir/BitterRevelation.java | 2 +- .../sets/khansoftarkir/SeeTheUnwritten.java | 2 +- .../sets/limitedalpha/NaturalSelection.java | 3 +- .../mage/sets/magic2012/SphinxOfUthuun.java | 10 ++-- .../mage/sets/magic2014/GlimpseTheFuture.java | 2 +- .../magicorigins/AlhammarretHighArbiter.java | 2 +- .../sets/magicorigins/AnimistsAwakening.java | 2 +- .../mage/sets/magicorigins/GatherThePack.java | 2 +- .../mage/sets/magicorigins/Nightsnare.java | 2 +- .../magicorigins/TalentOfTheTelepath.java | 5 +- .../mirrodinbesieged/MitoticManipulation.java | 12 ++--- .../sets/modernmasters/ThievingSprite.java | 2 +- .../mage/sets/newphyrexia/PsychicSurgery.java | 2 +- .../newphyrexia/ShrineOfPiercingVision.java | 12 ++--- .../sets/newphyrexia/SurgicalExtraction.java | 10 ++-- .../sets/planechase2012/SilentBladeOni.java | 9 ++-- .../src/mage/sets/ravnica/MindleechMass.java | 2 +- .../returntoravnica/FiremindsForesight.java | 3 +- .../JaceArchitectOfThought.java | 2 +- .../KahoMinamoHistorian.java | 7 ++- .../mage/sets/scarsofmirrodin/CloneShell.java | 2 +- .../sets/scarsofmirrodin/GenesisWave.java | 2 +- .../mage/sets/scarsofmirrodin/Memoricide.java | 42 +++++---------- .../seventhedition/AncestralMemories.java | 2 +- .../sets/shadowmoor/AdviceFromTheFae.java | 8 ++- .../shardsofalara/GiftOfTheGargantuan.java | 10 ++-- Mage.Sets/src/mage/sets/thedark/RagMan.java | 2 +- .../mage/sets/theros/DiscipleOfPhenax.java | 2 +- .../sets/urzaslegacy/HarmonicConvergence.java | 10 ++-- .../mage/sets/urzaslegacy/RavenFamiliar.java | 7 ++- .../sets/vintagemasters/KrovikanSorcerer.java | 2 +- .../src/mage/sets/weatherlight/Doomsday.java | 7 ++- .../src/mage/sets/zendikar/BalaGedThief.java | 2 +- .../mage/sets/zendikar/MerfolkWayfinder.java | 10 ++-- .../mage/sets/zendikar/SphinxOfJwarIsle.java | 10 ++-- .../src/mage/sets/zendikar/SummoningTrap.java | 2 +- .../RevealTargetPlayerLibraryEffect.java | 3 +- .../DiscardCardYouChooseTargetEffect.java | 2 +- ...dHandLibraryForCardNameAndExileEffect.java | 2 +- .../abilities/keyword/HideawayAbility.java | 2 +- Mage/src/main/java/mage/cards/CardsImpl.java | 16 +----- Mage/src/main/java/mage/game/ExileZone.java | 3 +- Mage/src/main/java/mage/game/Graveyard.java | 3 +- .../main/java/mage/players/PlayerImpl.java | 4 +- .../target/common/TargetCardInLibrary.java | 7 ++- 66 files changed, 174 insertions(+), 217 deletions(-) diff --git a/Mage.Sets/src/mage/sets/alarareborn/ArchitectsOfWill.java b/Mage.Sets/src/mage/sets/alarareborn/ArchitectsOfWill.java index fcb12f8349..0f9c4b6f4c 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/ArchitectsOfWill.java +++ b/Mage.Sets/src/mage/sets/alarareborn/ArchitectsOfWill.java @@ -31,7 +31,6 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -104,7 +103,7 @@ class ArchitectsOfWillEffect extends OneShotEffect { || controller == null) { return false; } - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); int count = Math.min(targetPlayer.getLibrary().size(), 3); for (int i = 0; i < count; i++) { Card card = targetPlayer.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java b/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java index b8d83c987f..6c47d17f83 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java +++ b/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java @@ -104,7 +104,7 @@ class SagesOfTheAnimaReplacementEffect extends ReplacementEffectImpl { FilterCard filter = new FilterCard(); filter.add(new CardTypePredicate(CardType.CREATURE)); Player player = game.getPlayer(event.getPlayerId()); - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); if (player != null) { for (int i = 0; i < 3; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/alliances/Browse.java b/Mage.Sets/src/mage/sets/alliances/Browse.java index 8ad8e1516f..407eeca364 100644 --- a/Mage.Sets/src/mage/sets/alliances/Browse.java +++ b/Mage.Sets/src/mage/sets/alliances/Browse.java @@ -91,7 +91,7 @@ class BrowseEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int cardsCount = Math.min(5, player.getLibrary().size()); for (int i = 0; i < cardsCount; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/alliances/SoldeviSage1.java b/Mage.Sets/src/mage/sets/alliances/SoldeviSage1.java index 23be1a5fc3..0e262118d5 100644 --- a/Mage.Sets/src/mage/sets/alliances/SoldeviSage1.java +++ b/Mage.Sets/src/mage/sets/alliances/SoldeviSage1.java @@ -102,7 +102,7 @@ class SoldeviSageEffect extends OneShotEffect { if (player != null) { Cards initialHand = player.getHand().copy(); player.drawCards(3, game); - Cards drawnCards = new CardsImpl(Zone.PICK); + Cards drawnCards = new CardsImpl(); for (UUID cardId : player.getHand()) { if (!initialHand.contains(cardId)) { drawnCards.add(cardId); diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java b/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java index ead4e657e6..64440a19c8 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java @@ -151,7 +151,7 @@ class KioraRevealEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (sourceObject != null && controller != null) { - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 4)); boolean creatureCardFound = false; boolean landCardFound = false; diff --git a/Mage.Sets/src/mage/sets/bornofthegods/HeroesPodium.java b/Mage.Sets/src/mage/sets/bornofthegods/HeroesPodium.java index d8610794d7..9aa39c1083 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/HeroesPodium.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/HeroesPodium.java @@ -154,7 +154,7 @@ class HeroesPodiumEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = source.getManaCostsToPay().getX(); count = Math.min(player.getLibrary().size(), count); boolean legendaryIncluded = false; diff --git a/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java b/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java index cd46582a1a..4986987be1 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java @@ -97,7 +97,7 @@ class SatyrWayfinderEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 4)); boolean properCardFound = cards.count(filterPutInHand, source.getControllerId(), source.getSourceId(), game) > 0; if (!cards.isEmpty()) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/CranialExtraction.java b/Mage.Sets/src/mage/sets/championsofkamigawa/CranialExtraction.java index 948126caae..1754aeebd6 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/CranialExtraction.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/CranialExtraction.java @@ -29,18 +29,16 @@ package mage.sets.championsofkamigawa; import java.util.UUID; import mage.MageObject; -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.Mode; +import mage.abilities.effects.common.search.SearchTargetGraveyardHandLibraryForCardNameAndExileEffect; import mage.cards.CardImpl; -import mage.cards.CardsImpl; import mage.cards.repository.CardRepository; import mage.choices.Choice; import mage.choices.ChoiceImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.game.Game; import mage.players.Player; import mage.target.TargetPlayer; @@ -74,53 +72,37 @@ public class CranialExtraction extends CardImpl { } -class CranialExtractionEffect extends OneShotEffect { +class CranialExtractionEffect extends SearchTargetGraveyardHandLibraryForCardNameAndExileEffect { - public CranialExtractionEffect() { - super(Outcome.Exile); - staticText = "Name a nonland card. Search target player's graveyard, hand, and library for all cards with that name and exile them. Then that player shuffles his or her library"; + CranialExtractionEffect() { + super(false, "target player's", "all cards with that name"); } - public CranialExtractionEffect(final CranialExtractionEffect effect) { + CranialExtractionEffect(final CranialExtractionEffect effect) { super(effect); } @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(targetPointer.getFirst(game, source)); + Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); - MageObject sourceObject = game.getObject(source.getSourceId()); if (player != null && controller != null) { Choice cardChoice = new ChoiceImpl(); cardChoice.setChoices(CardRepository.instance.getNonLandNames()); cardChoice.clearChoice(); + cardChoice.setMessage("Name a nonland card"); while (!controller.choose(Outcome.Exile, cardChoice, game)) { if (!controller.canRespond()) { return false; } } - String cardName = cardChoice.getChoice(); - game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]"); - for (Card card: player.getGraveyard().getCards(game)) { - if (card.getName().equals(cardName)) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); - } + MageObject sourceObject = game.getObject(source.getSourceId()); + if (sourceObject != null) { + game.informPlayers(sourceObject.getName() + " named card: [" + cardName + "]"); } - for (Card card: player.getHand().getCards(game)) { - if (card.getName().equals(cardName)) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true); - } - } - for (Card card: player.getLibrary().getCards(game)) { - if (card.getName().equals(cardName)) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); - } - } - controller.lookAtCards(sourceObject.getName() + " Hand", player.getHand(), game); - controller.lookAtCards(sourceObject.getName() + " Library", new CardsImpl(Zone.PICK, player.getLibrary().getCards(game)), game); - player.shuffleLibrary(game); + super.applySearchAndExile(game, source, cardName, player.getId()); } return true; } @@ -130,4 +112,8 @@ class CranialExtractionEffect extends OneShotEffect { return new CranialExtractionEffect(this); } -} \ No newline at end of file + @Override + public String getText(Mode mode) { + return "Name a nonland card. " + super.getText(mode); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2013/AEthermagesTouch.java b/Mage.Sets/src/mage/sets/commander2013/AEthermagesTouch.java index 413ed2de51..5f4e767c3d 100644 --- a/Mage.Sets/src/mage/sets/commander2013/AEthermagesTouch.java +++ b/Mage.Sets/src/mage/sets/commander2013/AEthermagesTouch.java @@ -96,7 +96,7 @@ class AEthermagesTouchEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); boolean properCardFound = false; int count = Math.min(player.getLibrary().size(), 4); diff --git a/Mage.Sets/src/mage/sets/commander2013/LimDulsVault.java b/Mage.Sets/src/mage/sets/commander2013/LimDulsVault.java index 16dfe1a408..10b1524f4f 100644 --- a/Mage.Sets/src/mage/sets/commander2013/LimDulsVault.java +++ b/Mage.Sets/src/mage/sets/commander2013/LimDulsVault.java @@ -95,7 +95,7 @@ class LimDulsVaultEffect extends OneShotEffect { boolean doAgain; do { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 5); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); @@ -105,7 +105,7 @@ class LimDulsVaultEffect extends OneShotEffect { } } player.lookAtCards("Lim-Dul's Vault", cards, game); - doAgain = player.chooseUse(outcome, "Pay 1 lfe and look at the next 5 cards?", source, game); + doAgain = player.chooseUse(outcome, "Pay 1 life and look at the next 5 cards?", source, game); if (doAgain) { player.loseLife(1, game); } else { diff --git a/Mage.Sets/src/mage/sets/commander2013/UnexpectedlyAbsent.java b/Mage.Sets/src/mage/sets/commander2013/UnexpectedlyAbsent.java index 71bd7105f6..a95faf1983 100644 --- a/Mage.Sets/src/mage/sets/commander2013/UnexpectedlyAbsent.java +++ b/Mage.Sets/src/mage/sets/commander2013/UnexpectedlyAbsent.java @@ -27,11 +27,8 @@ */ package mage.sets.commander2013; -import java.util.ArrayList; import java.util.Deque; import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; @@ -108,7 +105,7 @@ class UnexpectedlyAbsentEffect extends OneShotEffect { Player owner = game.getPlayer(permanent.getOwnerId()); if (owner != null) { int xValue = Math.min(source.getManaCostsToPay().getX(), owner.getLibrary().size()); - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); Deque cardIds = new LinkedList<>(); for (int i = 0; i < xValue; i++) { Card card = owner.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/conflux/WorldlyCounsel.java b/Mage.Sets/src/mage/sets/conflux/WorldlyCounsel.java index 635a9a45d1..bd8ded0fbf 100644 --- a/Mage.Sets/src/mage/sets/conflux/WorldlyCounsel.java +++ b/Mage.Sets/src/mage/sets/conflux/WorldlyCounsel.java @@ -28,10 +28,6 @@ package mage.sets.conflux; 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.dynamicvalue.common.DomainValue; import mage.abilities.effects.OneShotEffect; @@ -39,6 +35,10 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.players.Player; @@ -92,7 +92,7 @@ class WorldlyCounselEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = (new DomainValue()).calculate(game, source, this); count = Math.min(player.getLibrary().size(), count); for (int i = 0; i < count; i++) { diff --git a/Mage.Sets/src/mage/sets/darkascension/CallToTheKindred.java b/Mage.Sets/src/mage/sets/darkascension/CallToTheKindred.java index 0e3912d65a..7f880c0f52 100644 --- a/Mage.Sets/src/mage/sets/darkascension/CallToTheKindred.java +++ b/Mage.Sets/src/mage/sets/darkascension/CallToTheKindred.java @@ -29,10 +29,6 @@ package mage.sets.darkascension; import java.util.ArrayList; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.OnEventTriggeredAbility; @@ -43,6 +39,10 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.Predicate; @@ -119,7 +119,7 @@ class CallToTheKindredEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 5); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java index 4e2890e640..857ff6a323 100644 --- a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java +++ b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java @@ -197,7 +197,7 @@ class JarOfEyeballsEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), countersRemoved); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java b/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java index 689763b79f..856371369e 100644 --- a/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java +++ b/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java @@ -28,11 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.TimingRule; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; @@ -41,6 +36,11 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TimingRule; +import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.players.Player; @@ -93,7 +93,7 @@ class TrackersInstinctsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); boolean creaturesFound = false; int count = Math.min(controller.getLibrary().size(), 4); diff --git a/Mage.Sets/src/mage/sets/dissension/ProteanHulk.java b/Mage.Sets/src/mage/sets/dissension/ProteanHulk.java index 064145d198..a05dbabe29 100644 --- a/Mage.Sets/src/mage/sets/dissension/ProteanHulk.java +++ b/Mage.Sets/src/mage/sets/dissension/ProteanHulk.java @@ -106,7 +106,7 @@ class ProteanHulkEffect extends OneShotEffect { } Cards ProteanHulkSearch(Game game, Ability source) { - Cards cardsPicked = new CardsImpl(Zone.LIBRARY); + Cards cardsPicked = new CardsImpl(); Player player = game.getPlayer(source.getControllerId()); if (player != null) { GameEvent event = GameEvent.getEvent(GameEvent.EventType.SEARCH_LIBRARY, source.getControllerId(), source.getControllerId(), source.getControllerId(), Integer.MAX_VALUE); diff --git a/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java b/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java index 1d8c1a7430..ecfc295f54 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java @@ -150,7 +150,7 @@ class PlungeIntoDarknessSearchEffect extends OneShotEffect { int xValue = cost.announceXValue(source, game); cost.getFixedCostsFromAnnouncedValue(xValue).pay(source, game, source.getSourceId(), source.getControllerId(), false); - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), xValue); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/fifthdawn/ReversalOfFortune.java b/Mage.Sets/src/mage/sets/fifthdawn/ReversalOfFortune.java index b418addb3d..8eb8b0c1cc 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/ReversalOfFortune.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/ReversalOfFortune.java @@ -94,7 +94,7 @@ class ReversalOfFortuneEffect extends OneShotEffect { Player opponent = game.getPlayer(source.getFirstTarget()); if (controller != null && opponent != null) { // Target opponent reveals his or her hand - Cards revealedCards = new CardsImpl(Zone.HAND); + Cards revealedCards = new CardsImpl(); revealedCards.addAll(opponent.getHand()); opponent.revealCards("Reveal", revealedCards, game); diff --git a/Mage.Sets/src/mage/sets/iceage/OrcishLibrarian.java b/Mage.Sets/src/mage/sets/iceage/OrcishLibrarian.java index 2d1db6c7eb..ed8f653aca 100644 --- a/Mage.Sets/src/mage/sets/iceage/OrcishLibrarian.java +++ b/Mage.Sets/src/mage/sets/iceage/OrcishLibrarian.java @@ -99,7 +99,7 @@ class OrcishLibrarianEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int cardsCount = Math.min(8, player.getLibrary().size()); for (int i = 0; i < cardsCount; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/innistrad/ForbiddenAlchemy.java b/Mage.Sets/src/mage/sets/innistrad/ForbiddenAlchemy.java index ac041bd465..0ff05dc5e7 100644 --- a/Mage.Sets/src/mage/sets/innistrad/ForbiddenAlchemy.java +++ b/Mage.Sets/src/mage/sets/innistrad/ForbiddenAlchemy.java @@ -28,11 +28,6 @@ package mage.sets.innistrad; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.TimingRule; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; @@ -41,6 +36,11 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TimingRule; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.players.Player; @@ -94,7 +94,7 @@ class ForbiddenAlchemyEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int cardsCount = Math.min(4, player.getLibrary().size()); for (int i = 0; i < cardsCount; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/judgment/FlashOfInsight.java b/Mage.Sets/src/mage/sets/judgment/FlashOfInsight.java index 7d3422aac2..eda686cff9 100644 --- a/Mage.Sets/src/mage/sets/judgment/FlashOfInsight.java +++ b/Mage.Sets/src/mage/sets/judgment/FlashOfInsight.java @@ -112,7 +112,7 @@ class FlashOfInsightEffect extends OneShotEffect { int xValue; xValue = source.getManaCostsToPay().getX(); - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), xValue); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java b/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java index f7d5f2c831..ee3fad2382 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java @@ -90,7 +90,7 @@ class BitterRevelationEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); int cardsCount = Math.min(4, player.getLibrary().size()); for (int i = 0; i < cardsCount; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/SeeTheUnwritten.java b/Mage.Sets/src/mage/sets/khansoftarkir/SeeTheUnwritten.java index 75c2c3dc55..97bdc7106e 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/SeeTheUnwritten.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/SeeTheUnwritten.java @@ -106,7 +106,7 @@ class SeeTheUnwrittenEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); int creatureCardsFound = 0; int count = Math.min(controller.getLibrary().size(), 8); diff --git a/Mage.Sets/src/mage/sets/limitedalpha/NaturalSelection.java b/Mage.Sets/src/mage/sets/limitedalpha/NaturalSelection.java index 0a160360c1..659fd8c3e4 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/NaturalSelection.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/NaturalSelection.java @@ -28,7 +28,6 @@ package mage.sets.limitedalpha; import java.util.UUID; - import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; @@ -95,7 +94,7 @@ class NaturalSelectionEffect extends OneShotEffect { if (player == null || you == null) { return false; } - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 3); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/magic2012/SphinxOfUthuun.java b/Mage.Sets/src/mage/sets/magic2012/SphinxOfUthuun.java index 53923fd153..6537fddc3b 100644 --- a/Mage.Sets/src/mage/sets/magic2012/SphinxOfUthuun.java +++ b/Mage.Sets/src/mage/sets/magic2012/SphinxOfUthuun.java @@ -31,10 +31,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -45,6 +41,10 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.players.Player; @@ -102,7 +102,7 @@ class SphinxOfUthuunEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 5); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java b/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java index dedcd6f7ba..a51c086bc3 100644 --- a/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java +++ b/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java @@ -89,7 +89,7 @@ class GlimpseTheFutureEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int cardsCount = Math.min(3, controller.getLibrary().size()); for (int i = 0; i < cardsCount; i++) { Card card = controller.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/magicorigins/AlhammarretHighArbiter.java b/Mage.Sets/src/mage/sets/magicorigins/AlhammarretHighArbiter.java index 3ae24d013b..62dbe2cb35 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/AlhammarretHighArbiter.java +++ b/Mage.Sets/src/mage/sets/magicorigins/AlhammarretHighArbiter.java @@ -107,7 +107,7 @@ class AlhammarretHighArbiterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Cards revealedCards = new CardsImpl(Zone.PICK); + Cards revealedCards = new CardsImpl(); for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { if (playerId != controller.getId()) { Player opponent = game.getPlayer(playerId); diff --git a/Mage.Sets/src/mage/sets/magicorigins/AnimistsAwakening.java b/Mage.Sets/src/mage/sets/magicorigins/AnimistsAwakening.java index 4ccfccda7a..15e40a7546 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/AnimistsAwakening.java +++ b/Mage.Sets/src/mage/sets/magicorigins/AnimistsAwakening.java @@ -91,7 +91,7 @@ class AnimistsAwakeningEffect extends OneShotEffect { if (controller == null || sourceObject == null) { return false; } - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); int xValue = source.getManaCostsToPay().getX(); cards.addAll(controller.getLibrary().getTopCards(game, xValue)); if (cards.size() > 0) { diff --git a/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java b/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java index 2d02e4ee35..9b2533c59a 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java +++ b/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java @@ -88,7 +88,7 @@ class GatherThePackEffect extends OneShotEffect { if (controller == null || sourceObject == null) { return false; } - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 5)); if (!cards.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cards, game); diff --git a/Mage.Sets/src/mage/sets/magicorigins/Nightsnare.java b/Mage.Sets/src/mage/sets/magicorigins/Nightsnare.java index 6c728ad2ad..94e4563133 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/Nightsnare.java +++ b/Mage.Sets/src/mage/sets/magicorigins/Nightsnare.java @@ -87,7 +87,7 @@ class NightsnareDiscardEffect extends OneShotEffect { Card sourceCard = game.getCard(source.getSourceId()); if (player != null && controller != null) { if (!player.getHand().isEmpty()) { - Cards revealedCards = new CardsImpl(Zone.HAND); + Cards revealedCards = new CardsImpl(); revealedCards.addAll(player.getHand()); player.revealCards(sourceCard != null ? sourceCard.getIdName() : "Discard", revealedCards, game); // You may choose a nonland card from it. diff --git a/Mage.Sets/src/mage/sets/magicorigins/TalentOfTheTelepath.java b/Mage.Sets/src/mage/sets/magicorigins/TalentOfTheTelepath.java index 3ece67c379..92a4d5aa48 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/TalentOfTheTelepath.java +++ b/Mage.Sets/src/mage/sets/magicorigins/TalentOfTheTelepath.java @@ -101,7 +101,10 @@ class TalentOfTheTelepathEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); if (targetOpponent != null && sourceObject != null) { Set allCards = targetOpponent.getLibrary().getTopCards(game, 7); - Cards cards = new CardsImpl(Zone.LIBRARY, allCards); + Cards cards = new CardsImpl(); + for (Card card : allCards) { + cards.add(card); + } targetOpponent.revealCards(sourceObject.getIdName() + " - " + targetOpponent.getName() + "'s top library cards", cards, game); for (Card card : allCards) { if (filter.match(card, game)) { diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/MitoticManipulation.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/MitoticManipulation.java index c911a7f353..9c2a6e6709 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/MitoticManipulation.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/MitoticManipulation.java @@ -30,16 +30,16 @@ package mage.sets.mirrodinbesieged; import java.util.HashSet; 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.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.NamePredicate; import mage.game.Game; @@ -102,8 +102,8 @@ class MitoticManipulationEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.PICK); - Cards cardsFound = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); + Cards cardsFound = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 7); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/modernmasters/ThievingSprite.java b/Mage.Sets/src/mage/sets/modernmasters/ThievingSprite.java index 845d155714..1d6cdd1972 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/ThievingSprite.java +++ b/Mage.Sets/src/mage/sets/modernmasters/ThievingSprite.java @@ -115,7 +115,7 @@ class ThievingSpriteEffect extends OneShotEffect { Cards revealedCards = new CardsImpl(); if (numberOfFaeries > 0 && targetPlayer.getHand().size() > numberOfFaeries) { - Cards cardsInHand = new CardsImpl(Zone.PICK); + Cards cardsInHand = new CardsImpl(); cardsInHand.addAll(targetPlayer.getHand()); TargetCard target = new TargetCard(numberOfFaeries, Zone.PICK, new FilterCard()); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java b/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java index 8178bb4566..960184d844 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java @@ -128,7 +128,7 @@ class PsychicSurgeryEffect extends OneShotEffect { Player opponent = game.getPlayer(opponentId); if (player != null && opponent != null) { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 2); for (int i = 0; i < count; i++) { Card card = opponent.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java b/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java index e6670e7d7f..8086c1af2f 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java @@ -28,11 +28,6 @@ package mage.sets.newphyrexia; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.TargetController; -import mage.constants.Zone; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; @@ -46,6 +41,11 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.FilterCard; import mage.filter.FilterSpell; @@ -116,7 +116,7 @@ class ShrineOfPiercingVisionEffect extends OneShotEffect { } int count = permanent.getCounters().getCount(CounterType.CHARGE); - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); count = Math.min(player.getLibrary().size(), count); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/SurgicalExtraction.java b/Mage.Sets/src/mage/sets/newphyrexia/SurgicalExtraction.java index 014ab94a02..2c5f5d0272 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/SurgicalExtraction.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/SurgicalExtraction.java @@ -29,16 +29,16 @@ package mage.sets.newphyrexia; 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.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; @@ -113,7 +113,7 @@ class SurgicalExtractionEffect extends OneShotEffect { FilterCard filterNamedCard = new FilterCard("card named " + chosenCard.getName()); filterNamedCard.add(new NamePredicate(chosenCard.getName())); - Cards cardsInLibrary = new CardsImpl(Zone.LIBRARY); + Cards cardsInLibrary = new CardsImpl(); cardsInLibrary.addAll(owner.getLibrary().getCards(game)); // cards in Graveyard diff --git a/Mage.Sets/src/mage/sets/planechase2012/SilentBladeOni.java b/Mage.Sets/src/mage/sets/planechase2012/SilentBladeOni.java index 3cbde4fce7..6295725eea 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/SilentBladeOni.java +++ b/Mage.Sets/src/mage/sets/planechase2012/SilentBladeOni.java @@ -28,10 +28,6 @@ package mage.sets.planechase2012; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; @@ -42,6 +38,9 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterNonlandCard; import mage.game.Game; @@ -101,7 +100,7 @@ class SilentBladeOniEffect extends OneShotEffect { Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (opponent != null && controller != null) { - Cards cardsInHand = new CardsImpl(Zone.PICK); + Cards cardsInHand = new CardsImpl(); cardsInHand.addAll(opponent.getHand()); if (cardsInHand.size() > 0) { TargetCard target = new TargetCard(1, Zone.PICK, new FilterNonlandCard()); diff --git a/Mage.Sets/src/mage/sets/ravnica/MindleechMass.java b/Mage.Sets/src/mage/sets/ravnica/MindleechMass.java index b339320f1d..81db0ad98d 100644 --- a/Mage.Sets/src/mage/sets/ravnica/MindleechMass.java +++ b/Mage.Sets/src/mage/sets/ravnica/MindleechMass.java @@ -98,7 +98,7 @@ class MindleechMassEffect extends OneShotEffect { Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); Player you = game.getPlayer(source.getControllerId()); if (opponent != null && you != null) { - Cards cardsInHand = new CardsImpl(Zone.PICK); + Cards cardsInHand = new CardsImpl(); cardsInHand.addAll(opponent.getHand()); opponent.revealCards("Opponents hand", cardsInHand, game); if (cardsInHand.size() > 0 diff --git a/Mage.Sets/src/mage/sets/returntoravnica/FiremindsForesight.java b/Mage.Sets/src/mage/sets/returntoravnica/FiremindsForesight.java index b8073010e3..c56f82b0dd 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/FiremindsForesight.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/FiremindsForesight.java @@ -27,7 +27,6 @@ */ package mage.sets.returntoravnica; -import java.util.List; import java.util.UUID; import mage.constants.CardType; @@ -100,7 +99,7 @@ class FiremindsForesightSearchEffect extends OneShotEffect { } int cardsCount; Cards cardToReveal = new CardsImpl(); - Cards cardsInLibrary = new CardsImpl(Zone.LIBRARY); + Cards cardsInLibrary = new CardsImpl(); cardsInLibrary.addAll(player.getLibrary().getCards(game)); for (int cmc=3; cmc > 0; cmc--) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java b/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java index cdce3f264d..7d00e7d53a 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java @@ -193,7 +193,7 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 3); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/KahoMinamoHistorian.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/KahoMinamoHistorian.java index 3c514c3b49..88cd714a83 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/KahoMinamoHistorian.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/KahoMinamoHistorian.java @@ -40,7 +40,6 @@ import mage.abilities.effects.SearchEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; -import mage.cards.CardsImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; @@ -155,10 +154,10 @@ class KahoMinamoHistorianCastEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - TargetCardInExile target = new TargetCardInExile(new FilterCard(), CardUtil.getCardExileZoneId(game, source)); FilterCard filter = new FilterCard(); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, source.getManaCostsToPay().getX())); - Cards cards = new CardsImpl(Zone.EXILED, game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)).getCards(filter, game)); + TargetCardInExile target = new TargetCardInExile(filter, CardUtil.getCardExileZoneId(game, source)); + Cards cards = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)); if (cards.size() > 0 && controller.choose(Outcome.PlayForFree, cards, target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { @@ -170,4 +169,4 @@ class KahoMinamoHistorianCastEffect extends OneShotEffect { } return false; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java index 68eae29890..6fb58914f1 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java @@ -95,7 +95,7 @@ class CloneShellEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 4); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java index c8224d6d27..08d1074900 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java @@ -95,7 +95,7 @@ class GenesisWaveEffect extends OneShotEffect { if (controller == null || sourceObject == null) { return false; } - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); int xValue = source.getManaCostsToPay().getX(); int numberCards = Math.min(controller.getLibrary().size(), xValue); for (int i = 0; i < numberCards; i++) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/Memoricide.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/Memoricide.java index 1d4bea6649..319abd5e94 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/Memoricide.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/Memoricide.java @@ -30,17 +30,15 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; +import mage.abilities.Mode; +import mage.abilities.effects.common.search.SearchTargetGraveyardHandLibraryForCardNameAndExileEffect; import mage.cards.CardImpl; -import mage.cards.CardsImpl; import mage.cards.repository.CardRepository; import mage.choices.Choice; import mage.choices.ChoiceImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.Zone; import mage.game.Game; import mage.players.Player; import mage.target.TargetPlayer; @@ -72,55 +70,37 @@ public class Memoricide extends CardImpl { } -class MemoricideEffect extends OneShotEffect { +class MemoricideEffect extends SearchTargetGraveyardHandLibraryForCardNameAndExileEffect { - public MemoricideEffect() { - super(Outcome.Exile); - staticText = "Name a nonland card. Search target player's graveyard, hand, and library for any number of cards with that name and exile them. Then that player shuffles his or her library"; + MemoricideEffect() { + super(true, "target player's", "any number of cards with that name"); } - public MemoricideEffect(final MemoricideEffect effect) { + MemoricideEffect(final MemoricideEffect effect) { super(effect); } @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(targetPointer.getFirst(game, source)); + Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (player != null && controller != null) { Choice cardChoice = new ChoiceImpl(); cardChoice.setChoices(CardRepository.instance.getNonLandNames()); cardChoice.clearChoice(); + cardChoice.setMessage("Name a nonland card"); while (!controller.choose(Outcome.Exile, cardChoice, game)) { if (!controller.canRespond()) { return false; } } - String cardName = cardChoice.getChoice(); MageObject sourceObject = game.getObject(source.getSourceId()); if (sourceObject != null) { game.informPlayers(sourceObject.getName() + " named card: [" + cardName + "]"); } - for (Card card : player.getGraveyard().getCards(game)) { - if (card.getName().equals(cardName)) { - card.moveToExile(null, "", source.getSourceId(), game); - } - } - for (Card card : player.getHand().getCards(game)) { - if (card.getName().equals(cardName)) { - card.moveToExile(null, "", source.getSourceId(), game); - } - } - for (Card card : player.getLibrary().getCards(game)) { - if (card.getName().equals(cardName)) { - card.moveToExile(null, "", source.getSourceId(), game); - } - } - controller.lookAtCards("Memoricide Hand", player.getHand(), game); - controller.lookAtCards("Memoricide Library", new CardsImpl(Zone.PICK, player.getLibrary().getCards(game)), game); - player.shuffleLibrary(game); + super.applySearchAndExile(game, source, cardName, player.getId()); } return true; } @@ -130,4 +110,8 @@ class MemoricideEffect extends OneShotEffect { return new MemoricideEffect(this); } + @Override + public String getText(Mode mode) { + return "Name a nonland card. " + super.getText(mode); + } } diff --git a/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java b/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java index ad72c539aa..96263a28f5 100644 --- a/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java +++ b/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java @@ -90,7 +90,7 @@ class AncestralMemoriesEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int cardsCount = Math.min(7, player.getLibrary().size()); for (int i = 0; i < cardsCount; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java b/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java index bf1ed806de..7cb1a0c1b4 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java @@ -27,10 +27,12 @@ */ package mage.sets.shadowmoor; +import java.util.Set; import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; @@ -93,7 +95,11 @@ class AdviceFromTheFaeEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getObject(source.getSourceId()); if (controller != null) { - Cards cardsFromLibrary = new CardsImpl(Zone.LIBRARY, controller.getLibrary().getTopCards(game, 5)); + Set 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; for (UUID playerId : controller.getInRange()) { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/GiftOfTheGargantuan.java b/Mage.Sets/src/mage/sets/shardsofalara/GiftOfTheGargantuan.java index d9ad98c8b7..6eb8c586f8 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/GiftOfTheGargantuan.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/GiftOfTheGargantuan.java @@ -28,16 +28,16 @@ package mage.sets.shardsofalara; 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.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterLandCard; @@ -93,7 +93,7 @@ class GiftOfTheGargantuanEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); boolean creatureCardFound = false; boolean landCardFound = false; int count = Math.min(player.getLibrary().size(), 4); diff --git a/Mage.Sets/src/mage/sets/thedark/RagMan.java b/Mage.Sets/src/mage/sets/thedark/RagMan.java index b838d7b518..529b4eb56c 100644 --- a/Mage.Sets/src/mage/sets/thedark/RagMan.java +++ b/Mage.Sets/src/mage/sets/thedark/RagMan.java @@ -104,7 +104,7 @@ class RagManDiscardEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - Cards creatureCardsInHand = new CardsImpl(Zone.PICK); + Cards creatureCardsInHand = new CardsImpl(); for (UUID cardId : player.getHand()) { Card card = player.getHand().get(cardId, game); if (filter.match(card, game)) { diff --git a/Mage.Sets/src/mage/sets/theros/DiscipleOfPhenax.java b/Mage.Sets/src/mage/sets/theros/DiscipleOfPhenax.java index 713044ba4c..a3d7b7a62a 100644 --- a/Mage.Sets/src/mage/sets/theros/DiscipleOfPhenax.java +++ b/Mage.Sets/src/mage/sets/theros/DiscipleOfPhenax.java @@ -104,7 +104,7 @@ class DiscipleOfPhenaxEffect extends OneShotEffect { int devotion = new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this); Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (devotion > 0 && targetPlayer != null) { - Cards revealedCards = new CardsImpl(Zone.PICK); + Cards revealedCards = new CardsImpl(); int amount = Math.min(targetPlayer.getHand().size(), devotion); if (targetPlayer.getHand().size() > amount) { FilterCard filter = new FilterCard("card in target player's hand"); diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/HarmonicConvergence.java b/Mage.Sets/src/mage/sets/urzaslegacy/HarmonicConvergence.java index cf0f508360..fde1f0a252 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/HarmonicConvergence.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/HarmonicConvergence.java @@ -31,14 +31,14 @@ import java.util.ArrayList; import java.util.HashMap; 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.CardImpl; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.common.FilterEnchantmentPermanent; import mage.game.Game; @@ -112,7 +112,7 @@ class HarmonicConvergenceEffect extends OneShotEffect { continue; } - CardsImpl cards = new CardsImpl(Zone.PICK); + CardsImpl cards = new CardsImpl(); for (Permanent permanent : list) { cards.add(permanent); } diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/RavenFamiliar.java b/Mage.Sets/src/mage/sets/urzaslegacy/RavenFamiliar.java index 6f708fa0d3..881a72a122 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/RavenFamiliar.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/RavenFamiliar.java @@ -28,9 +28,6 @@ package mage.sets.urzaslegacy; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -43,7 +40,9 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; @@ -103,7 +102,7 @@ public class RavenFamiliar extends CardImpl { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 3); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/vintagemasters/KrovikanSorcerer.java b/Mage.Sets/src/mage/sets/vintagemasters/KrovikanSorcerer.java index dbc7f43996..6d96656619 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/KrovikanSorcerer.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/KrovikanSorcerer.java @@ -116,7 +116,7 @@ class KrovikanSorcererEffect extends OneShotEffect { if (player != null) { Cards initialHand = player.getHand().copy(); player.drawCards(2, game); - Cards drawnCards = new CardsImpl(Zone.PICK); + Cards drawnCards = new CardsImpl(); for (UUID cardId : player.getHand()) { if (!initialHand.contains(cardId)) { drawnCards.add(cardId); diff --git a/Mage.Sets/src/mage/sets/weatherlight/Doomsday.java b/Mage.Sets/src/mage/sets/weatherlight/Doomsday.java index 201d7196b6..a48fff82ec 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/Doomsday.java +++ b/Mage.Sets/src/mage/sets/weatherlight/Doomsday.java @@ -27,6 +27,7 @@ */ package mage.sets.weatherlight; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; @@ -42,8 +43,6 @@ import mage.game.Game; import mage.players.Player; import mage.target.TargetCard; -import java.util.UUID; - /** * * @author Plopman @@ -92,8 +91,8 @@ class DoomsdayEffect extends OneShotEffect { if (player != null) { //Search your library and graveyard for five cards - Cards allCards = new CardsImpl(Zone.PICK); - Cards cards = new CardsImpl(Zone.PICK); + Cards allCards = new CardsImpl(); + Cards cards = new CardsImpl(); allCards.addAll(player.getLibrary().getCardList()); allCards.addAll(player.getGraveyard()); int number = Math.min(5, allCards.size()); diff --git a/Mage.Sets/src/mage/sets/zendikar/BalaGedThief.java b/Mage.Sets/src/mage/sets/zendikar/BalaGedThief.java index eb1ad19cc5..c66289a522 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BalaGedThief.java +++ b/Mage.Sets/src/mage/sets/zendikar/BalaGedThief.java @@ -112,7 +112,7 @@ class BalaGedThiefEffect extends OneShotEffect { int numberOfAllies = game.getBattlefield().countAll(filter, you.getId(), game); - Cards cardsInHand = new CardsImpl(Zone.PICK); + Cards cardsInHand = new CardsImpl(); cardsInHand.addAll(targetPlayer.getHand()); int count = Math.min(cardsInHand.size(), numberOfAllies); diff --git a/Mage.Sets/src/mage/sets/zendikar/MerfolkWayfinder.java b/Mage.Sets/src/mage/sets/zendikar/MerfolkWayfinder.java index 5232704f31..04461008f7 100644 --- a/Mage.Sets/src/mage/sets/zendikar/MerfolkWayfinder.java +++ b/Mage.Sets/src/mage/sets/zendikar/MerfolkWayfinder.java @@ -28,10 +28,6 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -41,6 +37,10 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.players.Player; @@ -98,7 +98,7 @@ class MerfolkWayfinderEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); Cards cardsToReveal = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 3); for (int i = 0; i < count; i++) { diff --git a/Mage.Sets/src/mage/sets/zendikar/SphinxOfJwarIsle.java b/Mage.Sets/src/mage/sets/zendikar/SphinxOfJwarIsle.java index d6bbe38832..5d4c8b1645 100644 --- a/Mage.Sets/src/mage/sets/zendikar/SphinxOfJwarIsle.java +++ b/Mage.Sets/src/mage/sets/zendikar/SphinxOfJwarIsle.java @@ -28,10 +28,6 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.ActivatedAbilityImpl; @@ -43,6 +39,10 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.players.Player; @@ -120,7 +120,7 @@ class SphinxOfJwarIsleEffect extends OneShotEffect { Card card = player.getLibrary().getFromTop(game); if (card != null) { - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); cards.add(card); player.lookAtCards("Sphinx of Jwar Isle", cards, game); } else { diff --git a/Mage.Sets/src/mage/sets/zendikar/SummoningTrap.java b/Mage.Sets/src/mage/sets/zendikar/SummoningTrap.java index 61aa280578..a9fcc4e195 100644 --- a/Mage.Sets/src/mage/sets/zendikar/SummoningTrap.java +++ b/Mage.Sets/src/mage/sets/zendikar/SummoningTrap.java @@ -168,7 +168,7 @@ class SummoningTrapEffect extends OneShotEffect { if (controller == null) { return false; } - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 7)); if (!cards.isEmpty()) { TargetCard target = new TargetCard(Zone.LIBRARY, diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealTargetPlayerLibraryEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealTargetPlayerLibraryEffect.java index 5fb44e5849..558b556a51 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealTargetPlayerLibraryEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealTargetPlayerLibraryEffect.java @@ -35,7 +35,6 @@ import mage.abilities.effects.OneShotEffect; import mage.cards.Cards; import mage.cards.CardsImpl; import mage.constants.Outcome; -import mage.constants.Zone; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; @@ -77,7 +76,7 @@ public class RevealTargetPlayerLibraryEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); cards.addAll(player.getLibrary().getTopCards(game, amountCards.calculate(game, source, this))); player.revealCards(sourceObject.getIdName() + " - Top " + amountCards.toString() + "cards of " + targetPlayer.getName() + "\'s library", cards, game); return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java index 4ab5210339..fbfa6c8145 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java @@ -131,7 +131,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { } int numberToReveal = this.numberCardsToReveal.calculate(game, source, this); if (numberToReveal > 0) { - Cards revealedCards = new CardsImpl(Zone.HAND); + Cards revealedCards = new CardsImpl(); numberToReveal = Math.min(player.getHand().size(), numberToReveal); if (player.getHand().size() > numberToReveal) { TargetCardInHand chosenCards = new TargetCardInHand(numberToReveal, numberToReveal, new FilterCard("card in " + player.getLogName() + "'s hand")); diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchTargetGraveyardHandLibraryForCardNameAndExileEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchTargetGraveyardHandLibraryForCardNameAndExileEffect.java index 26a88824f6..5629f01ef4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchTargetGraveyardHandLibraryForCardNameAndExileEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchTargetGraveyardHandLibraryForCardNameAndExileEffect.java @@ -109,7 +109,7 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect } // cards in Library - Cards cardsInLibrary = new CardsImpl(Zone.LIBRARY); + Cards cardsInLibrary = new CardsImpl(); cardsInLibrary.addAll(targetPlayer.getLibrary().getCards(game)); cardsCount = (cardName.isEmpty() ? 0 : cardsInLibrary.count(filter, game)); filter.setMessage("card named " + cardName + " in the library of " + targetPlayer.getLogName()); diff --git a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java index a3944296a2..03ad60abde 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java @@ -116,7 +116,7 @@ class HideawayExileEffect extends OneShotEffect { return false; } - Cards cards = new CardsImpl(Zone.LIBRARY); + Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 4)); if (cards.size() > 0) { TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1); diff --git a/Mage/src/main/java/mage/cards/CardsImpl.java b/Mage/src/main/java/mage/cards/CardsImpl.java index a33afd4581..d93750d16f 100644 --- a/Mage/src/main/java/mage/cards/CardsImpl.java +++ b/Mage/src/main/java/mage/cards/CardsImpl.java @@ -38,7 +38,6 @@ import java.util.Map; import java.util.Random; import java.util.Set; import java.util.UUID; -import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.util.ThreadLocalStringBuilder; @@ -53,7 +52,6 @@ public class CardsImpl extends LinkedHashSet implements Cards, Serializabl private static Random rnd = new Random(); private UUID ownerId; - private Zone zone; public CardsImpl() { } @@ -70,21 +68,9 @@ public class CardsImpl extends LinkedHashSet implements Cards, Serializabl } } - public CardsImpl(Zone zone) { - this.zone = zone; - } - - public CardsImpl(Zone zone, Collection cards) { - this(zone); - for (Card card : cards) { - this.add(card.getId()); - } - } - public CardsImpl(final CardsImpl cards) { this.addAll(cards); this.ownerId = cards.ownerId; - this.zone = cards.zone; } @Override @@ -126,7 +112,7 @@ public class CardsImpl extends LinkedHashSet implements Cards, Serializabl if (this.size() == 0) { return null; } - UUID[] cards = this.toArray(new UUID[0]); + UUID[] cards = this.toArray(new UUID[this.size()]); return game.getCard(cards[rnd.nextInt(cards.length)]); } diff --git a/Mage/src/main/java/mage/game/ExileZone.java b/Mage/src/main/java/mage/game/ExileZone.java index ce1234008a..dab528b708 100644 --- a/Mage/src/main/java/mage/game/ExileZone.java +++ b/Mage/src/main/java/mage/game/ExileZone.java @@ -30,7 +30,6 @@ package mage.game; import java.io.Serializable; import java.util.UUID; -import mage.constants.Zone; import mage.cards.CardsImpl; /** @@ -48,7 +47,7 @@ public class ExileZone extends CardsImpl implements Serializable { } public ExileZone(UUID id, String name, boolean hidden) { - super(Zone.EXILED); + super(); this.id = id; this.name = name; this.hidden = hidden; diff --git a/Mage/src/main/java/mage/game/Graveyard.java b/Mage/src/main/java/mage/game/Graveyard.java index 40fbbb52df..56af5e2488 100644 --- a/Mage/src/main/java/mage/game/Graveyard.java +++ b/Mage/src/main/java/mage/game/Graveyard.java @@ -4,12 +4,11 @@ import java.util.UUID; import mage.cards.Card; import mage.cards.CardsImpl; -import mage.constants.Zone; public class Graveyard extends CardsImpl { public Graveyard() { - super(Zone.GRAVEYARD); + super(); } public Graveyard(final Graveyard graveyard) { diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 8c180e2fec..1082a21b51 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -245,13 +245,13 @@ public abstract class PlayerImpl implements Player, Serializable { this(UUID.randomUUID()); this.name = name; this.range = range; - hand = new CardsImpl(Zone.HAND); + hand = new CardsImpl(); graveyard = new Graveyard(); abilities = new AbilitiesImpl<>(); counters = new Counters(); manaPool = new ManaPool(playerId); library = new Library(playerId); - sideboard = new CardsImpl(Zone.OUTSIDE); + sideboard = new CardsImpl(); } protected PlayerImpl(UUID id) { diff --git a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java index 49d3eca243..4d83aad72f 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java @@ -34,6 +34,7 @@ import java.util.List; import java.util.UUID; import mage.abilities.Ability; import mage.cards.Card; +import mage.cards.Cards; import mage.cards.CardsImpl; import mage.constants.Outcome; import mage.constants.Zone; @@ -91,9 +92,13 @@ public class TargetCardInLibrary extends TargetCard { cards = new ArrayList<>(targetPlayer.getLibrary().getTopCards(game, librarySearchLimit)); } Collections.sort(cards, new CardNameComparator()); + Cards cardsId = new CardsImpl(); + for (Card card : cards) { + cardsId.add(card); + } while (!isChosen() && !doneChosing()) { chosen = targets.size() >= minNumberOfTargets; - if (!player.chooseTarget(outcome, new CardsImpl(Zone.LIBRARY, cards), this, null, game)) { + if (!player.chooseTarget(outcome, cardsId, this, null, game)) { return chosen; } chosen = targets.size() >= minNumberOfTargets;