From dd32411e8398203eb8b20af70dd3f0b483d92820 Mon Sep 17 00:00:00 2001 From: Luna Skyrise Date: Sun, 10 May 2015 23:51:00 -0300 Subject: [PATCH] [8ED, FEM] Added Orcish Spy... ...and the revealing target player's library effect --- .../mage/sets/eighthedition/OrcishSpy.java | 52 +++++++++ .../mage/sets/fallenempires/OrcishSpy.java | 69 ++++++++++++ .../RevealTargetPlayerLibraryEffect.java | 100 ++++++++++++++++++ 3 files changed, 221 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/eighthedition/OrcishSpy.java create mode 100644 Mage.Sets/src/mage/sets/fallenempires/OrcishSpy.java create mode 100644 Mage/src/mage/abilities/effects/common/RevealTargetPlayerLibraryEffect.java diff --git a/Mage.Sets/src/mage/sets/eighthedition/OrcishSpy.java b/Mage.Sets/src/mage/sets/eighthedition/OrcishSpy.java new file mode 100644 index 0000000000..8dc7c9a562 --- /dev/null +++ b/Mage.Sets/src/mage/sets/eighthedition/OrcishSpy.java @@ -0,0 +1,52 @@ +/* + * 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.eighthedition; + +import java.util.UUID; + +/** + * + * @author anonymous + */ +public class OrcishSpy extends mage.sets.fallenempires.OrcishSpy { + + public OrcishSpy(UUID ownerId) { + super(ownerId); + this.cardNumber = 208; + this.expansionSetCode = "8ED"; + } + + public OrcishSpy(final OrcishSpy card) { + super(card); + } + + @Override + public OrcishSpy copy() { + return new OrcishSpy(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fallenempires/OrcishSpy.java b/Mage.Sets/src/mage/sets/fallenempires/OrcishSpy.java new file mode 100644 index 0000000000..1df6be2d05 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fallenempires/OrcishSpy.java @@ -0,0 +1,69 @@ +/* + * 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.fallenempires; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.RevealTargetPlayerLibraryEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author anonymous + */ +public class OrcishSpy extends CardImpl { + + public OrcishSpy(UUID ownerId) { + super(ownerId, 124, "Orcish Spy", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}"); + this.expansionSetCode = "FEM"; + this.subtype.add("Orc"); + this.subtype.add("Rogue"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {tap}: Look at the top three cards of target player's library. + Ability ability = new SimpleActivatedAbility(Zone.LIBRARY, new RevealTargetPlayerLibraryEffect(3), new TapSourceCost()); + this.addAbility(ability); + } + + public OrcishSpy(final OrcishSpy card) { + super(card); + } + + @Override + public OrcishSpy copy() { + return new OrcishSpy(this); + } +} + diff --git a/Mage/src/mage/abilities/effects/common/RevealTargetPlayerLibraryEffect.java b/Mage/src/mage/abilities/effects/common/RevealTargetPlayerLibraryEffect.java new file mode 100644 index 0000000000..c2a40e7970 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/RevealTargetPlayerLibraryEffect.java @@ -0,0 +1,100 @@ +/* + * 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.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +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; + +/** + * + * @author anonymous + */ + +public class RevealTargetPlayerLibraryEffect extends OneShotEffect { + + private DynamicValue amountCards; + + public RevealTargetPlayerLibraryEffect(int amountCards) { + this(new StaticValue(amountCards)); + } + + public RevealTargetPlayerLibraryEffect(DynamicValue amountCards) { + super(Outcome.Neutral); + this.amountCards = amountCards; + this.staticText = setText(); + } + + public RevealTargetPlayerLibraryEffect(final RevealTargetPlayerLibraryEffect effect) { + super(effect); + this.amountCards = effect.amountCards; + } + + @Override + public RevealTargetPlayerLibraryEffect copy() { + return new RevealTargetPlayerLibraryEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Player targetPlayer = game.getPlayer(source.getFirstTarget()); + + if (player == null || targetPlayer == null) { + return false; + } + + Cards cards = new CardsImpl(Zone.LIBRARY); + int count = Math.min(targetPlayer.getLibrary().size(), amountCards.calculate(game, source, this)); + for (int i = 0; i < count; i++) { + Card card = targetPlayer.getLibrary().removeFromTop(game); + if (card != null) { + cards.add(card); + } + } + + player.lookAtCards("Top " + amountCards.toString() + "cards of " + targetPlayer.getName() + "\'s library", cards, game); + + return true; + } + + private String setText() { + StringBuilder sb = new StringBuilder("Reveal the top "); + sb.append(CardUtil.numberToText(amountCards.toString())).append(" cards of target player's library."); + return sb.toString(); + } +}