From 9ff08d979b67bb3d9ed2aa5693af87e43305e379 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 4 Jul 2015 19:27:24 +0200 Subject: [PATCH] Some minor changes. --- .../betrayersofkamigawa/PatronOfTheMoon.java | 15 ++--- .../sets/scarsofmirrodin/GenesisWave.java | 31 +++++----- .../mage/sets/shardsofalara/BantPanorama.java | 11 ++-- .../src/mage/sets/zendikar/SummoningTrap.java | 57 +++++-------------- .../filter/common/FilterBasicLandCard.java | 17 +++--- 5 files changed, 55 insertions(+), 76 deletions(-) diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheMoon.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheMoon.java index 6dcb76e201..826408a71b 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheMoon.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheMoon.java @@ -28,9 +28,6 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -40,14 +37,16 @@ import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.OfferingAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterLandCard; import mage.game.Game; import mage.players.Player; +import mage.target.TargetCard; import mage.target.common.TargetCardInHand; - /** * @author LevelX2 */ @@ -70,7 +69,6 @@ public class PatronOfTheMoon extends CardImpl { // {1}: Put up to two land cards from your hand onto the battlefield tapped. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PatronOfTheMoonEffect(), new ManaCostsImpl("{1}")); - ability.addTarget(new TargetCardInHand(0,2, new FilterLandCard())); this.addAbility(ability); } @@ -86,6 +84,7 @@ public class PatronOfTheMoon extends CardImpl { } class PatronOfTheMoonEffect extends OneShotEffect { + PatronOfTheMoonEffect() { super(Outcome.PutLandInPlay); staticText = "Put up to two land cards from your hand onto the battlefield tapped"; @@ -99,7 +98,9 @@ class PatronOfTheMoonEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - for (UUID cardId : targetPointer.getTargets(game, source)) { + TargetCard target = new TargetCardInHand(0, 2, new FilterLandCard("up to two land cards to put onto the battlefield tapped")); + controller.chooseTarget(outcome, controller.getHand(), target, source, game); + for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); if (card != null) { controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId(), true); @@ -115,4 +116,4 @@ class PatronOfTheMoonEffect extends OneShotEffect { return new PatronOfTheMoonEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java index 1d54c0cce9..b20a7cfe24 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java @@ -1,16 +1,16 @@ /* * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. @@ -29,16 +29,16 @@ package mage.sets.scarsofmirrodin; 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.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.Filter.ComparisonType; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; @@ -58,7 +58,6 @@ public class GenesisWave extends CardImpl { super(ownerId, 122, "Genesis Wave", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{G}{G}{G}"); this.expansionSetCode = "SOM"; - // Reveal the top X cards of your library. You may put any number of permanent cards with converted mana // cost X or less from among them onto the battlefield. Then put all cards revealed this way that weren't // put onto the battlefield into your graveyard. @@ -102,21 +101,21 @@ class GenesisWaveEffect extends OneShotEffect { cards.add(card); } if (cards.size() > 0) { - controller.revealCards(sourceObject.getName(), cards, game); + controller.revealCards(sourceObject.getIdName(), cards, game); FilterCard filter = new FilterCard("cards with converted mana cost " + xValue + " or less to put onto the battlefield"); filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, xValue + 1)); filter.add( Predicates.or(new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.CREATURE), - new CardTypePredicate(CardType.ENCHANTMENT), - new CardTypePredicate(CardType.LAND), - new CardTypePredicate(CardType.PLANESWALKER) + new CardTypePredicate(CardType.CREATURE), + new CardTypePredicate(CardType.ENCHANTMENT), + new CardTypePredicate(CardType.LAND), + new CardTypePredicate(CardType.PLANESWALKER) )); TargetCard target1 = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, filter); target1.setRequired(false); controller.choose(Outcome.PutCardInPlay, cards, target1, game); - for (UUID cardId: target1.getTargets()) { + for (UUID cardId : target1.getTargets()) { Card card = cards.get(cardId, game); if (card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/sets/shardsofalara/BantPanorama.java b/Mage.Sets/src/mage/sets/shardsofalara/BantPanorama.java index 99e9f76453..d93ffc176f 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/BantPanorama.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/BantPanorama.java @@ -28,10 +28,6 @@ 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.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeSourceCost; @@ -40,6 +36,10 @@ import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; +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; @@ -68,7 +68,10 @@ public class BantPanorama extends CardImpl { super(ownerId, 221, "Bant Panorama", Rarity.COMMON, new CardType[]{CardType.LAND}, ""); this.expansionSetCode = "ALA"; + // {T}: Add {1} to your mana pool. this.addAbility(new ColorlessManaAbility()); + + // {1}, {T}, Sacrifice Bant Panorama: Search your library for a basic Forest, Plains, or Island card and put it onto the battlefield tapped. Then shuffle your library. TargetCardInLibrary target = new TargetCardInLibrary(filter); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(target, true, Outcome.PutLandInPlay), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); diff --git a/Mage.Sets/src/mage/sets/zendikar/SummoningTrap.java b/Mage.Sets/src/mage/sets/zendikar/SummoningTrap.java index 6766cf3467..e2fd1b88a4 100644 --- a/Mage.Sets/src/mage/sets/zendikar/SummoningTrap.java +++ b/Mage.Sets/src/mage/sets/zendikar/SummoningTrap.java @@ -43,7 +43,6 @@ import mage.cards.Card; 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.game.events.GameEvent; @@ -54,7 +53,7 @@ import mage.target.TargetCard; import mage.watchers.Watcher; /** - * + * * @author Rafbill */ public class SummoningTrap extends CardImpl { @@ -65,7 +64,6 @@ public class SummoningTrap extends CardImpl { this.expansionSetCode = "ZEN"; this.subtype.add("Trap"); - // If a creature spell you cast this turn was countered by a spell or // ability an opponent controlled, you may pay {0} rather than pay // Summoning Trap's mana cost. @@ -117,7 +115,7 @@ class SummoningTrapWatcher extends Watcher { if (counterObject == null) { counterObject = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK); } - if (stackObject != null && counterObject != null + if (stackObject != null && counterObject != null && stackObject.getCardType().contains(CardType.CREATURE) && game.getOpponents(controllerId).contains(counterObject.getControllerId())) { condition = true; @@ -145,10 +143,7 @@ class SummoningTrapAlternativeCost extends AlternativeCostImpl { @Override public boolean isAvailable(Game game, Ability source) { Watcher watcher = game.getState().getWatchers().get("CreatureSpellCountered", source.getControllerId()); - if (watcher != null && watcher.conditionMet()) { - return true; - } - return false; + return watcher != null && watcher.conditionMet(); } @Override @@ -170,54 +165,32 @@ class SummoningTrapEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - - Cards cards = new CardsImpl(Zone.PICK); - int count = Math.min(player.getLibrary().size(), 7); - for (int i = 0; i < count; i++) { - Card card = player.getLibrary().removeFromTop(game); - if (card != null) { - cards.add(card); - } + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; } - + Cards cards = new CardsImpl(Zone.LIBRARY); + cards.addAll(controller.getLibrary().getTopCards(game, 7)); if (!cards.isEmpty()) { - TargetCard target = new TargetCard(Zone.PICK, + TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCreatureCard( - "creature card to put on the battlefield")); - if (player.choose(Outcome.PutCreatureInPlay, cards, target, game)) { + "creature card to put on the battlefield")); + if (controller.choose(Outcome.PutCreatureInPlay, cards, target, game)) { Card card = cards.get(target.getFirstTarget(), game); if (card != null) { cards.remove(card); - card.putOntoBattlefield(game, Zone.PICK, - source.getSourceId(), source.getControllerId()); + controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); } } if (cards.size() > 0) { - TargetCard target2 = new TargetCard(Zone.PICK, - new FilterCard( - "card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { - player.choose(Outcome.Benefit, cards, target2, - game); - Card card = cards.get(target2.getFirstTarget(), game); - if (card != null) { - cards.remove(card); - player.getLibrary().putOnBottom(card, game); - } - target2.clearChosen(); - } - Card card = cards.get(cards.iterator().next(), game); - cards.remove(card); - player.getLibrary().putOnBottom(card, game); + controller.putCardsOnBottomOfLibrary(cards, game, source, true); } } - - return false; + return true; } @Override public SummoningTrapEffect copy() { return new SummoningTrapEffect(this); } -} \ No newline at end of file +} diff --git a/Mage/src/mage/filter/common/FilterBasicLandCard.java b/Mage/src/mage/filter/common/FilterBasicLandCard.java index 87ed9fcf95..9c4a4dc52c 100644 --- a/Mage/src/mage/filter/common/FilterBasicLandCard.java +++ b/Mage/src/mage/filter/common/FilterBasicLandCard.java @@ -1,16 +1,16 @@ /* * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR @@ -20,12 +20,11 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.filter.common; import mage.constants.CardType; @@ -40,7 +39,11 @@ import mage.filter.predicate.mageobject.SupertypePredicate; public class FilterBasicLandCard extends FilterCard { public FilterBasicLandCard() { - super("basic land card"); + this("basic land card"); + } + + public FilterBasicLandCard(String name) { + super(name); this.add(new CardTypePredicate(CardType.LAND)); this.add(new SupertypePredicate("Basic")); }