From 86393db911751646c83358862d9cdd98a1bd51bf Mon Sep 17 00:00:00 2001 From: fireshoes Date: Thu, 26 Feb 2015 15:46:36 -0600 Subject: [PATCH] Added Decree of Annihilation, Pit Keeper, and Songs of the Damned. --- .../mage/sets/iceage/SongsOfTheDamned.java | 62 +++++++++ .../sets/scourge/DecreeOfAnnihilation.java | 130 ++++++++++++++++++ .../src/mage/sets/timespiral/PitKeeper.java | 95 +++++++++++++ 3 files changed, 287 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/iceage/SongsOfTheDamned.java create mode 100644 Mage.Sets/src/mage/sets/scourge/DecreeOfAnnihilation.java create mode 100644 Mage.Sets/src/mage/sets/timespiral/PitKeeper.java diff --git a/Mage.Sets/src/mage/sets/iceage/SongsOfTheDamned.java b/Mage.Sets/src/mage/sets/iceage/SongsOfTheDamned.java new file mode 100644 index 0000000000..5732302dad --- /dev/null +++ b/Mage.Sets/src/mage/sets/iceage/SongsOfTheDamned.java @@ -0,0 +1,62 @@ +/* + * 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.iceage; + +import java.util.UUID; +import mage.Mana; +import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; +import mage.abilities.effects.common.DynamicManaEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterCreatureCard; + +/** + * + * @author fireshoes + */ +public class SongsOfTheDamned extends CardImpl { + + public SongsOfTheDamned(UUID ownerId) { + super(ownerId, 48, "Songs of the Damned", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}"); + this.expansionSetCode = "ICE"; + + // Add {B} to your mana pool for each creature card in your graveyard. + DynamicManaEffect effect = new DynamicManaEffect(Mana.BlackMana, new CardsInControllerGraveyardCount(new FilterCreatureCard())); + this.getSpellAbility().addEffect(effect); + } + + public SongsOfTheDamned(final SongsOfTheDamned card) { + super(card); + } + + @Override + public SongsOfTheDamned copy() { + return new SongsOfTheDamned(this); + } +} diff --git a/Mage.Sets/src/mage/sets/scourge/DecreeOfAnnihilation.java b/Mage.Sets/src/mage/sets/scourge/DecreeOfAnnihilation.java new file mode 100644 index 0000000000..8f1efa909a --- /dev/null +++ b/Mage.Sets/src/mage/sets/scourge/DecreeOfAnnihilation.java @@ -0,0 +1,130 @@ + /* + * 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.scourge; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.CycleTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.abilities.keyword.CyclingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author fireshoes + */ +public class DecreeOfAnnihilation extends CardImpl { + + public DecreeOfAnnihilation(UUID ownerId) { + super(ownerId, 85, "Decree of Annihilation", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{8}{R}{R}"); + this.expansionSetCode = "SCG"; + + // Exile all artifacts, creatures, and lands from the battlefield, all cards from all graveyards, and all cards from all hands. + this.getSpellAbility().addEffect(new DecreeOfAnnihilationEffect()); + + // Cycling {5}{R}{R} + this.addAbility(new CyclingAbility(new ManaCostsImpl("{5}{R}{R}"))); + + // When you cycle Decree of Annihilation, destroy all lands. + Ability ability = new CycleTriggeredAbility(new DestroyAllEffect(new FilterLandPermanent("lands")), false); + this.addAbility(ability); + } + + public DecreeOfAnnihilation(final DecreeOfAnnihilation card) { + super(card); + } + + @Override + public DecreeOfAnnihilation copy() { + return new DecreeOfAnnihilation(this); + } +} + +class DecreeOfAnnihilationEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterPermanent(""); + + static { + filter.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE), + new CardTypePredicate(CardType.LAND))); + } + + public DecreeOfAnnihilationEffect() { + super(Outcome.Detriment); + staticText = "Exile all artifacts, creatures, and lands from the battlefield, all cards from all graveyards, and all cards from all hands"; + } + + public DecreeOfAnnihilationEffect(final DecreeOfAnnihilationEffect effect) { + super(effect); + } + + @Override + public DecreeOfAnnihilationEffect copy() { + return new DecreeOfAnnihilationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + permanent.moveToExile(id, "all artifacts, creatures, and land", id, game); + } + for (UUID playerId : game.getPlayerList()) { + Player player = game.getPlayer(playerId); + if (player != null) { + for (UUID cid : player.getHand().copy()) { + Card c = game.getCard(cid); + if (c != null) { + c.moveToExile(null, null, source.getSourceId(), game); + } + } + for (UUID cid : player.getGraveyard().copy()) { + Card c = game.getCard(cid); + if (c != null) { + c.moveToExile(null, null, source.getSourceId(), game); + } + } + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/PitKeeper.java b/Mage.Sets/src/mage/sets/timespiral/PitKeeper.java new file mode 100644 index 0000000000..a6e1d955a8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/PitKeeper.java @@ -0,0 +1,95 @@ +/* + * 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.timespiral; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author fireshoes + */ +public class PitKeeper extends CardImpl { + + public PitKeeper(UUID ownerId) { + super(ownerId, 123, "Pit Keeper", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "TSP"; + this.subtype.add("Human"); + this.subtype.add("Wizard"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // When Pit Keeper enters the battlefield, if you have four or more creature cards in your graveyard, you may return target creature card from your graveyard to your hand. + TriggeredAbility triggeredAbility = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true); + triggeredAbility.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard"))); + this.addAbility(new ConditionalTriggeredAbility( + triggeredAbility, + new CreatureCardsInControllerGraveCondition(4), + "When {this} enters the battlefield, if you have four or more creature cards in your graveyard, you may return target creature card from your graveyard to your hand.")); + } + + public PitKeeper(final PitKeeper card) { + super(card); + } + + @Override + public PitKeeper copy() { + return new PitKeeper(this); + } +} + +class CreatureCardsInControllerGraveCondition implements Condition { + private int value; + + public CreatureCardsInControllerGraveCondition(int value) { + this.value = value; + } + + @Override + public boolean apply(Game game, Ability source) { + Player p = game.getPlayer(source.getControllerId()); + if (p != null && p.getGraveyard().count(new FilterCreatureCard(), game) >= value) + { + return true; + } + return false; + } +} \ No newline at end of file