diff --git a/Mage.Sets/src/mage/sets/invasion/ScoutingTrek.java b/Mage.Sets/src/mage/sets/invasion/ScoutingTrek.java new file mode 100644 index 00000000000..826c3dd986c --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/ScoutingTrek.java @@ -0,0 +1,59 @@ +/* + * 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 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * 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.sets.invasion; + +import java.util.UUID; +import mage.abilities.effects.common.RecruiterEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterBasicLandCard; + +/** + * + * @author LoneFox + */ +public class ScoutingTrek extends CardImpl { + + public ScoutingTrek(UUID ownerId) { + super(ownerId, 210, "Scouting Trek", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{1}{G}"); + this.expansionSetCode = "INV"; + + // Search your library for any number of basic land cards. Reveal those cards, then shuffle your library and put them on top of it. + this.getSpellAbility().addEffect(new RecruiterEffect(new FilterBasicLandCard("basic land cards"))); + } + + public ScoutingTrek(final ScoutingTrek card) { + super(card); + } + + @Override + public ScoutingTrek copy() { + return new ScoutingTrek(this); + } +} diff --git a/Mage.Sets/src/mage/sets/odyssey/DwarvenRecruiter.java b/Mage.Sets/src/mage/sets/odyssey/DwarvenRecruiter.java new file mode 100644 index 00000000000..bbbdf99d012 --- /dev/null +++ b/Mage.Sets/src/mage/sets/odyssey/DwarvenRecruiter.java @@ -0,0 +1,72 @@ +/* + * 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 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * 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.sets.odyssey; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.RecruiterEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author LoneFox + */ +public class DwarvenRecruiter extends CardImpl { + + private static final FilterCard filter = new FilterCard("Dwarf cards"); + + static { + filter.add(new SubtypePredicate("Dwarf")); + } + + public DwarvenRecruiter(UUID ownerId) { + super(ownerId, 186, "Dwarven Recruiter", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}"); + this.expansionSetCode = "ODY"; + this.subtype.add("Dwarf"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Dwarven Recruiter enters the battlefield, search your library for any number of Dwarf cards and reveal those cards. Shuffle your library, then put them on top of it in any order. + this.addAbility(new EntersBattlefieldTriggeredAbility(new RecruiterEffect(filter), false)); + } + + public DwarvenRecruiter(final DwarvenRecruiter card) { + super(card); + } + + @Override + public DwarvenRecruiter copy() { + return new DwarvenRecruiter(this); + } +} diff --git a/Mage.Sets/src/mage/sets/visions/GoblinRecruiter.java b/Mage.Sets/src/mage/sets/visions/GoblinRecruiter.java index 9d574f3020b..4eb638f77d3 100644 --- a/Mage.Sets/src/mage/sets/visions/GoblinRecruiter.java +++ b/Mage.Sets/src/mage/sets/visions/GoblinRecruiter.java @@ -31,18 +31,13 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.RecruiterEffect; 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.filter.FilterCard; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.players.Player; -import mage.target.common.TargetCardInLibrary; + /** * @@ -50,6 +45,12 @@ import mage.target.common.TargetCardInLibrary; */ public class GoblinRecruiter extends CardImpl { + private static final FilterCard filter = new FilterCard("Goblin cards"); + + static { + filter.add(new SubtypePredicate("Goblin")); + } + public GoblinRecruiter(UUID ownerId) { super(ownerId, 80, "Goblin Recruiter", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{R}"); this.expansionSetCode = "VIS"; @@ -59,7 +60,7 @@ public class GoblinRecruiter extends CardImpl { this.toughness = new MageInt(1); // When Goblin Recruiter enters the battlefield, search your library for any number of Goblin cards and reveal those cards. Shuffle your library, then put them on top of it in any order. - this.addAbility(new EntersBattlefieldTriggeredAbility(new GoblinRecruiterEffect(), false)); + this.addAbility(new EntersBattlefieldTriggeredAbility(new RecruiterEffect(filter), false)); } public GoblinRecruiter(final GoblinRecruiter card) { @@ -71,48 +72,3 @@ public class GoblinRecruiter extends CardImpl { return new GoblinRecruiter(this); } } - -class GoblinRecruiterEffect extends OneShotEffect { - - private static final FilterCard goblinFilter = new FilterCard("Goblin cards"); - - static { - goblinFilter.add(new SubtypePredicate("Goblin")); - } - - public GoblinRecruiterEffect() { - super(Outcome.Benefit); - this.staticText = "search your library for any number of Goblin cards and reveal those cards. Shuffle your library, then put them on top of it in any order."; - } - - public GoblinRecruiterEffect(final GoblinRecruiterEffect effect) { - super(effect); - } - - @Override - public GoblinRecruiterEffect copy() { - return new GoblinRecruiterEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - TargetCardInLibrary targetGoblins = new TargetCardInLibrary(0, Integer.MAX_VALUE, goblinFilter); - Cards cards = new CardsImpl(); - if (controller.searchLibrary(targetGoblins, game)) { - cards.addAll(targetGoblins.getTargets()); - } - controller.revealCards(staticText, cards, game); - controller.shuffleLibrary(game); - - int numberOfGoblins = cards.size(); - if (numberOfGoblins > 0) { - controller.putCardsOnTopOfLibrary(cards, game, source, true); - } - return true; - } - return false; - } - -} diff --git a/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java new file mode 100644 index 00000000000..1ae859cff2b --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java @@ -0,0 +1,92 @@ +/* + * 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 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * 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.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.Outcome; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author LoneFox + */ +public class RecruiterEffect extends OneShotEffect { + + private static FilterCard filter; + + public RecruiterEffect(FilterCard filter) { + super(Outcome.Benefit); + this.filter = filter; + } + + public RecruiterEffect(final RecruiterEffect effect) { + super(effect); + this.filter = effect.filter.copy(); + } + + @Override + public RecruiterEffect copy() { + return new RecruiterEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if(controller != null) { + TargetCardInLibrary targetCards = new TargetCardInLibrary(0, Integer.MAX_VALUE, filter); + Cards cards = new CardsImpl(); + if (controller.searchLibrary(targetCards, game)) { + cards.addAll(targetCards.getTargets()); + } + controller.revealCards(staticText, cards, game); + controller.shuffleLibrary(game); + + if(cards.size() > 0) { + controller.putCardsOnTopOfLibrary(cards, game, source, true); + } + return true; + } + return false; + } + + @Override + public String getText(Mode mode) { + if(staticText != null && !staticText.isEmpty()) { + return staticText; + } + return "search your library for any number of " + filter.getMessage() + + " and reveal those cards. Shuffle your library, then put them on top of it in any order."; + } +}