Fixed Mana Pool text bug, added Door to Nothingness, it should now be(kind of) possible to "import" dck files if you can't find the deck directory :).

This commit is contained in:
jendave
2011-08-06 02:47:57 +00:00
parent 9a90fa9ce3
commit c7e29fa4b0
6 changed files with 67 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
Door to Nothingness
5
Artifact
no text
Comes into play tapped.
Cruel Edict Cruel Edict
1 B 1 B
Sorcery Sorcery

View File

@@ -1,6 +1,6 @@
program/mail=mtgrares@yahoo.com program/mail=mtgrares@yahoo.com
program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26 program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26
program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 74 program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 77
tokens--file=AllTokens.txt tokens--file=AllTokens.txt

View File

@@ -16577,6 +16577,26 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
card.clearSpellAbility(); card.clearSpellAbility();
card.addSpellAbility(spell); card.addSpellAbility(spell);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
else if (cardName.equals("Door to Nothingness"))
{
Ability_Tap ab1 = new Ability_Tap(card, "G G R R B B U U W W")
{
/**
*
*/
private static final long serialVersionUID = 6665327569823149191L;
public void resolve() {
AllZone.GameAction.getPlayerLife(getTargetPlayer()).setLife(0);
}
public boolean canPlayAI(){return true;}
};
ab1.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
ab1.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ab1));
ab1.setDescription("WWUUBBRRGG, tap, sacrifice Door to Nothingness: Target player loses the game.");
card.addSpellAbility(ab1);
}//*************** END ************ END **************************
// Cards with Cycling abilities // Cards with Cycling abilities
// -1 means keyword "Cycling" not found // -1 means keyword "Cycling" not found

View File

@@ -10,6 +10,7 @@ import java.io.FileOutputStream;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.nio.channels.FileChannel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
@@ -296,10 +297,22 @@ public class Gui_DeckEditor_Menu extends JMenuBar implements NewConstants {
return filter; return filter;
}//getFileFilter() }//getFileFilter()
private FileFilter dckFilter = new FileFilter(){
public boolean accept(File f) {
return f.getName().endsWith(".dck") || f.isDirectory();
}
public String getDescription() {
return "Simple Deck File .dck";
}
};
private File getImportFilename() { private File getImportFilename() {
JFileChooser chooser = new JFileChooser(previousDirectory); JFileChooser chooser = new JFileChooser(previousDirectory);
chooser.addChoosableFileFilter(dckFilter);
chooser.addChoosableFileFilter(getFileFilter()); chooser.addChoosableFileFilter(getFileFilter());
int returnVal = chooser.showOpenDialog(null); int returnVal = chooser.showOpenDialog(null);
@@ -328,6 +341,27 @@ public class Gui_DeckEditor_Menu extends JMenuBar implements NewConstants {
File file = getImportFilename(); File file = getImportFilename();
if(file == null) return; if(file == null) return;
else if (file.getName().endsWith(".dck"))
{
try {
FileChannel srcChannel = new FileInputStream(file).getChannel();
File dst = new File(ForgeProps.getFile(NEW_DECKS).getAbsolutePath() + java.io.File.pathSeparator + (file.getName()));
if(!dst.createNewFile())
{
JOptionPane.showMessageDialog(null, "Cannot import deck " + file.getName() + ", a deck currently has that name.");
return;
}
FileChannel dstChannel = new FileOutputStream(dst).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();
dstChannel.close();
JOptionPane.showMessageDialog(null, file.getName() + "imported succesfully. Restart the deck editor to see it.");
} catch (Exception ex) {
ErrorViewer.showError(ex);
throw new RuntimeException("Gui_DeckEditor_Menu : importDeck() error, " + ex);
}
return;
}
Object check = null; Object check = null;

View File

@@ -134,6 +134,7 @@ public class ManaPool extends Card
} }
int containsColor(char color) int containsColor(char color)
{ {
sortContents();
if(!has.contains(color + "")) return 0; if(!has.contains(color + "")) return 0;
int res = has.lastIndexOf(color) - has.indexOf(color) + 1; int res = has.lastIndexOf(color) - has.indexOf(color) + 1;
if(!isSnow()) res += smp.containsColor(color); if(!isSnow()) res += smp.containsColor(color);

View File

@@ -201,7 +201,11 @@ public class NewDeckIO implements DeckIO {
throw new RuntimeException("DeckIO : read() error, " + ex.getMessage()); throw new RuntimeException("DeckIO : read() error, " + ex.getMessage());
} }
} }
public Deck parseDeck(File f)//cast(in case read is private for a good reason)
{
try{return read(new BufferedReader(new FileReader(f)));}
catch(Exception e){return null;}
}
private Deck read(BufferedReader in) throws IOException { private Deck read(BufferedReader in) throws IOException {
String line; String line;