- Converted Remove Enchantments to Script, All Instants have no been converted

This commit is contained in:
Sol
2012-11-11 04:00:57 +00:00
parent 9ce1a29433
commit ff8cfe8beb
4 changed files with 3 additions and 115 deletions

1
.gitattributes vendored
View File

@@ -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/CardFactoryCreatures.java svneol=native#text/plain
src/main/java/forge/card/cardfactory/CardFactoryEnchantments.java -text 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/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/CardFactoryInterface.java svneol=native#text/plain
src/main/java/forge/card/cardfactory/CardFactoryLands.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 src/main/java/forge/card/cardfactory/CardFactoryPlaneswalkers.java svneol=native#text/plain

View File

@@ -1,7 +1,9 @@
Name:Remove Enchantments Name:Remove Enchantments
ManaCost:W ManaCost:W
Types:Instant 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:RemRandomDeck:True
SVar:Rarity:Common SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/remove_enchantments.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/remove_enchantments.jpg

View File

@@ -313,8 +313,6 @@ public class CardFactory implements CardFactoryInterface {
CardFactoryPlaneswalkers.buildCard(card); CardFactoryPlaneswalkers.buildCard(card);
} else if (card.isLand()) { } else if (card.isLand()) {
CardFactoryLands.buildCard(card, cardName); CardFactoryLands.buildCard(card, cardName);
} else if (card.isInstant()) {
CardFactoryInstants.buildCard(card, cardName);
} else if (card.isSorcery()) { } else if (card.isSorcery()) {
CardFactorySorceries.buildCard(card, cardName); CardFactorySorceries.buildCard(card, cardName);
} else if (card.isEnchantment()) { } else if (card.isEnchantment()) {

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
/**
* <p>
* CardFactoryInstants class.
* </p>
*
* @author Forge
* @version $Id$
*/
public class CardFactoryInstants {
/**
* <p>
* getCard.
* </p>
*
* @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<Card> ens = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.ENCHANTMENTS);
final List<Card> toReturn = CardLists.filter(ens, new Predicate<Card>() {
@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