From ff8cfe8beb92f5abc23dec993e1e4b09c9242b08 Mon Sep 17 00:00:00 2001 From: Sol Date: Sun, 11 Nov 2012 04:00:57 +0000 Subject: [PATCH] - Converted Remove Enchantments to Script, All Instants have no been converted --- .gitattributes | 1 - res/cardsfolder/r/remove_enchantments.txt | 4 +- .../forge/card/cardfactory/CardFactory.java | 2 - .../card/cardfactory/CardFactoryInstants.java | 111 ------------------ 4 files changed, 3 insertions(+), 115 deletions(-) delete mode 100644 src/main/java/forge/card/cardfactory/CardFactoryInstants.java diff --git a/.gitattributes b/.gitattributes index 2ce0eca0345..3439b127814 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12709,7 +12709,6 @@ src/main/java/forge/card/cardfactory/CardFactoryAuras.java svneol=native#text/pl src/main/java/forge/card/cardfactory/CardFactoryCreatures.java svneol=native#text/plain src/main/java/forge/card/cardfactory/CardFactoryEnchantments.java -text src/main/java/forge/card/cardfactory/CardFactoryEquipment.java svneol=native#text/plain -src/main/java/forge/card/cardfactory/CardFactoryInstants.java svneol=native#text/plain src/main/java/forge/card/cardfactory/CardFactoryInterface.java svneol=native#text/plain src/main/java/forge/card/cardfactory/CardFactoryLands.java svneol=native#text/plain src/main/java/forge/card/cardfactory/CardFactoryPlaneswalkers.java svneol=native#text/plain diff --git a/res/cardsfolder/r/remove_enchantments.txt b/res/cardsfolder/r/remove_enchantments.txt index 57129123042..8491d5aab38 100644 --- a/res/cardsfolder/r/remove_enchantments.txt +++ b/res/cardsfolder/r/remove_enchantments.txt @@ -1,7 +1,9 @@ Name:Remove Enchantments ManaCost:W Types:Instant -Text:Return to your hand all enchantments you both own and control, all Auras you own attached to permanents you control, and all Auras you own attached to attacking creatures your opponents control. Then destroy all other enchantments you control, all other Auras attached to permanents you control, and all other Auras attached to attacking creatures your opponents control. +Text:no text +A:SP$ ChangeZoneAll | Cost$ W | ChangeType$ Card.Enchantment+YouCtrl+YouOwn,Card.Aura+YouOwn+AttachedTo Permanent.YouCtrl,Card.Aura+YouOwn+AttachedTo Creature.attacking+OppCtrl | UseAllOriginZones$ True | Origin$ Battlefield | Destination$ Hand | SubAbility$ DBDestroyEnchantments | SpellDescription$ Return to your hand all enchantments you both own and control, all Auras you own attached to permanents you control, and all Auras you own attached to attacking creatures your opponents control. Then destroy all other enchantments you control, all other Auras attached to permanents you control, and all other Auras attached to attacking creatures your opponents control. +SVar:DBDestroyEnchantments:DB$ DestroyAll | ValidCards$ Card.Enchantment+YouCtrl,Card.Aura+AttachedTo Permanent.YouCtrl,Card.Aura+AttachedTo Creature.attacking+OppCtrl SVar:RemRandomDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/remove_enchantments.jpg diff --git a/src/main/java/forge/card/cardfactory/CardFactory.java b/src/main/java/forge/card/cardfactory/CardFactory.java index d72d3bc03a8..89449ad477a 100644 --- a/src/main/java/forge/card/cardfactory/CardFactory.java +++ b/src/main/java/forge/card/cardfactory/CardFactory.java @@ -313,8 +313,6 @@ public class CardFactory implements CardFactoryInterface { CardFactoryPlaneswalkers.buildCard(card); } else if (card.isLand()) { CardFactoryLands.buildCard(card, cardName); - } else if (card.isInstant()) { - CardFactoryInstants.buildCard(card, cardName); } else if (card.isSorcery()) { CardFactorySorceries.buildCard(card, cardName); } else if (card.isEnchantment()) { diff --git a/src/main/java/forge/card/cardfactory/CardFactoryInstants.java b/src/main/java/forge/card/cardfactory/CardFactoryInstants.java deleted file mode 100644 index 0a9a56166b6..00000000000 --- a/src/main/java/forge/card/cardfactory/CardFactoryInstants.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Forge: Play Magic: the Gathering. - * Copyright (C) 2011 Forge Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package forge.card.cardfactory; - -import java.util.ArrayList; -import java.util.List; - -import com.google.common.base.Predicate; - -import forge.Card; - -import forge.CardLists; -import forge.CardPredicates.Presets; -import forge.Singletons; -import forge.card.cost.Cost; -import forge.card.spellability.Spell; -import forge.card.spellability.SpellAbility; -import forge.card.spellability.Target; -import forge.game.player.ComputerUtil; -import forge.game.player.Player; -import forge.game.zone.ZoneType; -import forge.gui.GuiChoose; - -/** - *

- * CardFactoryInstants class. - *

- * - * @author Forge - * @version $Id$ - */ -public class CardFactoryInstants { - - /** - *

- * getCard. - *

- * - * @param card - * a {@link forge.Card} object. - * @param cardName - * a {@link java.lang.String} object. - * @return a {@link forge.Card} object. - */ - public static void buildCard(final Card card, final String cardName) { - - // *************** START *********** START ************************** - if (cardName.equals("Remove Enchantments")) { - final SpellAbility spell = new Spell(card) { - private static final long serialVersionUID = -7324132132222075031L; - - @Override - public boolean canPlayAI() { - return false; - } - - @Override - public void resolve() { - final Player you = card.getController(); - final List ens = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.ENCHANTMENTS); - final List toReturn = CardLists.filter(ens, new Predicate() { - @Override - public boolean apply(final Card c) { - final Card enchanting = c.getEnchantingCard(); - - if (enchanting != null) { - if ((enchanting.isAttacking() && enchanting.getController().equals(you.getOpponent())) - || enchanting.getController().equals(you)) { - return true; - } - } - - return (c.getOwner().equals(you) && c.getController().equals(you)); - } - }); - for (final Card c : toReturn) { - Singletons.getModel().getGame().getAction().moveToHand(c); - } - - for (final Card c : ens) { - if (!toReturn.contains(c)) { - Singletons.getModel().getGame().getAction().destroy(c); - } - } - } - }; - - final StringBuilder sb = new StringBuilder(); - sb.append(card).append(" - destroy/return enchantments."); - spell.setStackDescription(sb.toString()); - - card.addSpellAbility(spell); - } // *************** END ************ END ************************** - } // getCard - -} // end class CardFactory_Instants