From 5fcea7e6df14980943f9a9e6b03879d8dd13b95c Mon Sep 17 00:00:00 2001 From: emerald000 Date: Tue, 16 Dec 2014 13:58:13 -0500 Subject: [PATCH] Added Plea for Power, Spelljack and Wild Research. --- .../mage/sets/apocalypse/WildResearch.java | 126 ++++++++++++++ .../mage/sets/conspiracy/PleaForPower.java | 52 ++++++ .../src/mage/sets/judgment/Spelljack.java | 162 ++++++++++++++++++ .../sets/vintagemasters/PleaForPower.java | 108 ++++++++++++ 4 files changed, 448 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/apocalypse/WildResearch.java create mode 100644 Mage.Sets/src/mage/sets/conspiracy/PleaForPower.java create mode 100644 Mage.Sets/src/mage/sets/judgment/Spelljack.java create mode 100644 Mage.Sets/src/mage/sets/vintagemasters/PleaForPower.java diff --git a/Mage.Sets/src/mage/sets/apocalypse/WildResearch.java b/Mage.Sets/src/mage/sets/apocalypse/WildResearch.java new file mode 100644 index 0000000000..37eba90ac7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/apocalypse/WildResearch.java @@ -0,0 +1,126 @@ +/* + * 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.apocalypse; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +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.CardTypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author emerald000 + */ +public class WildResearch extends CardImpl { + + private static final FilterCard filterEnchantment = new FilterCard("enchantment card"); + private static final FilterCard filterInstant = new FilterCard("instant card"); + static { + filterEnchantment.add(new CardTypePredicate(CardType.ENCHANTMENT)); + filterInstant.add(new CardTypePredicate(CardType.INSTANT)); + } + + public WildResearch(UUID ownerId) { + super(ownerId, 72, "Wild Research", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + this.expansionSetCode = "APC"; + + // {1}{W}: Search your library for an enchantment card and reveal that card. Put it into your hand, then discard a card at random. Then shuffle your library. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WildResearchEffect(filterEnchantment), new ManaCostsImpl<>("{1}{W}"))); + + // {1}{U}: Search your library for an instant card and reveal that card. Put it into your hand, then discard a card at random. Then shuffle your library. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WildResearchEffect(filterInstant), new ManaCostsImpl<>("{1}{U}"))); + + } + + public WildResearch(final WildResearch card) { + super(card); + } + + @Override + public WildResearch copy() { + return new WildResearch(this); + } +} + +class WildResearchEffect extends OneShotEffect { + + protected final FilterCard filter; + + WildResearchEffect(FilterCard filter) { + super(Outcome.DrawCard); + this.staticText = "Search your library for an " + filter.getMessage() + " and reveal that card. Put it into your hand, then discard a card at random. Then shuffle your library."; + this.filter = filter; + } + + WildResearchEffect(final WildResearchEffect effect) { + super(effect); + this.filter = effect.filter; + } + + @Override + public WildResearchEffect copy() { + return new WildResearchEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + TargetCardInLibrary target = new TargetCardInLibrary(filter); + if (player.searchLibrary(target, game)) { + if (target.getTargets().size() > 0) { + Card card = player.getLibrary().remove(target.getFirstTarget(), game); + if (card != null) { + player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY); + Cards cards = new CardsImpl(); + cards.add(card); + player.revealCards("Wild Research", cards, game, true); + } + } + } + player.discardOne(true, source, game); + player.shuffleLibrary(game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/conspiracy/PleaForPower.java b/Mage.Sets/src/mage/sets/conspiracy/PleaForPower.java new file mode 100644 index 0000000000..2411d07cbc --- /dev/null +++ b/Mage.Sets/src/mage/sets/conspiracy/PleaForPower.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.conspiracy; + +import java.util.UUID; + +/** + * + * @author emerald000 + */ +public class PleaForPower extends mage.sets.vintagemasters.PleaForPower { + + public PleaForPower(UUID ownerId) { + super(ownerId); + this.cardNumber = 24; + this.expansionSetCode = "CNS"; + } + + public PleaForPower(final PleaForPower card) { + super(card); + } + + @Override + public PleaForPower copy() { + return new PleaForPower(this); + } +} diff --git a/Mage.Sets/src/mage/sets/judgment/Spelljack.java b/Mage.Sets/src/mage/sets/judgment/Spelljack.java new file mode 100644 index 0000000000..00703ee289 --- /dev/null +++ b/Mage.Sets/src/mage/sets/judgment/Spelljack.java @@ -0,0 +1,162 @@ +/* + * 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.judgment; + +import java.util.UUID; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.AsThoughEffectImpl; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.AsThoughEffectType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; +import mage.players.Player; +import mage.target.TargetSpell; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author emerald000 + */ +public class Spelljack extends CardImpl { + + public Spelljack(UUID ownerId) { + super(ownerId, 51, "Spelljack", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{3}{U}{U}{U}"); + this.expansionSetCode = "JUD"; + + // Counter target spell. If that spell is countered this way, exile it instead of putting it into its owner's graveyard. You may play it without paying its mana cost for as long as it remains exiled. + this.getSpellAbility().addEffect(new SpelljackEffect()); + this.getSpellAbility().addTarget(new TargetSpell()); + } + + public Spelljack(final Spelljack card) { + super(card); + } + + @Override + public Spelljack copy() { + return new Spelljack(this); + } +} + +class SpelljackEffect extends OneShotEffect { + + SpelljackEffect() { + super(Outcome.PlayForFree); + this.staticText = "Counter target spell. If that spell is countered this way, exile it instead of putting it into its owner's graveyard. You may play it without paying its mana cost for as long as it remains exiled"; + } + + SpelljackEffect(final SpelljackEffect effect) { + super(effect); + } + + @Override + public SpelljackEffect copy() { + return new SpelljackEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID objectId = targetPointer.getFirst(game, source); + UUID sourceId = source.getSourceId(); + + StackObject stackObject = game.getStack().getStackObject(objectId); + if (stackObject != null && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, objectId, sourceId, stackObject.getControllerId()))) { + game.rememberLKI(objectId, Zone.STACK, stackObject); + game.getStack().remove(stackObject); + if (!((Spell) stackObject).isCopiedSpell()) { + MageObject card = game.getObject(stackObject.getSourceId()); + if (card instanceof Card) { + ((Card) card).moveToZone(Zone.EXILED, sourceId, game, true); + ContinuousEffect effect = new SpelljackCastFromExileEffect(); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); + } + } + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, objectId, sourceId, stackObject.getControllerId())); + return true; + } + return false; + } +} + +class SpelljackCastFromExileEffect extends AsThoughEffectImpl { + + SpelljackCastFromExileEffect() { + super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.Custom, Outcome.Benefit); + staticText = "You may cast that card without paying its mana cost as long as it remains exiled"; + } + + SpelljackCastFromExileEffect(final SpelljackCastFromExileEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public SpelljackCastFromExileEffect copy() { + return new SpelljackCastFromExileEffect(this); + } + + @Override + public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { + if (affectedControllerId.equals(source.getControllerId())) { + if (getTargetPointer().getFirst(game, source) == null) { + this.discard(); + return false; + } + if (sourceId.equals(getTargetPointer().getFirst(game, source))) { + Card card = game.getCard(sourceId); + if (card != null) { + if (game.getState().getZone(sourceId) == Zone.EXILED) { + Player player = game.getPlayer(affectedControllerId); + player.setCastSourceIdWithoutMana(sourceId); + return true; + } + else { + this.discard(); + } + } + } + } + return false; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/vintagemasters/PleaForPower.java b/Mage.Sets/src/mage/sets/vintagemasters/PleaForPower.java new file mode 100644 index 0000000000..0a0668a2d9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/PleaForPower.java @@ -0,0 +1,108 @@ +/* + * 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.vintagemasters; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author emerald000 + */ +public class PleaForPower extends CardImpl { + + public PleaForPower(UUID ownerId) { + super(ownerId, 87, "Plea for Power", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{U}"); + this.expansionSetCode = "VMA"; + + // Will of the council - Starting with you, each player votes for time or knowledge. If time gets more votes, take an extra turn after this one. If knowledge gets more votes or the vote is tied, draw three cards. + this.getSpellAbility().addEffect(new PleaForPowerEffect()); + } + + public PleaForPower(final PleaForPower card) { + super(card); + } + + @Override + public PleaForPower copy() { + return new PleaForPower(this); + } +} + +class PleaForPowerEffect extends OneShotEffect { + + PleaForPowerEffect() { + super(Outcome.Benefit); + this.staticText = "Will of the council — Starting with you, each player votes for time or knowledge. If time gets more votes, take an extra turn after this one. If knowledge gets more votes or the vote is tied, draw three cards"; + } + + PleaForPowerEffect(final PleaForPowerEffect effect) { + super(effect); + } + + @Override + public PleaForPowerEffect copy() { + return new PleaForPowerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int timeCount = 0; + int knowledgeCount = 0; + for (UUID playerId : controller.getInRange()) { + Player player = game.getPlayer(playerId); + if (player.chooseUse(Outcome.ExtraTurn, "Choose time?", game)) { + timeCount++; + game.informPlayers(player.getName() + " has chosen: time"); + } + else { + knowledgeCount++; + game.informPlayers(player.getName() + " has chosen: knowledge"); + } + } + if (timeCount > knowledgeCount) { + new AddExtraTurnControllerEffect().apply(game, source); + } + else { + controller.drawCards(3, game); + } + return true; + } + return false; + } +}