This commit is contained in:
jendave
2011-10-29 07:03:23 +00:00
parent 626fa471ee
commit f940e9a46d
17 changed files with 669 additions and 594 deletions

View File

@@ -6426,7 +6426,7 @@ public class Card extends GameEntity implements Comparable<Card> {
return false; return false;
} }
} else if (property.startsWith("AttachedBy")) { } else if (property.startsWith("AttachedBy")) {
if (!equippedBy.contains(source) && !enchantedBy.contains(source)) { if (!equippedBy.contains(source) && !getEnchantedBy().contains(source)) {
return false; return false;
} }
} else if (property.startsWith("Attached")) { } else if (property.startsWith("Attached")) {
@@ -6434,11 +6434,11 @@ public class Card extends GameEntity implements Comparable<Card> {
return false; return false;
} }
} else if (property.startsWith("EnchantedBy")) { } else if (property.startsWith("EnchantedBy")) {
if (!enchantedBy.contains(source)) { if (!getEnchantedBy().contains(source)) {
return false; return false;
} }
} else if (property.startsWith("NotEnchantedBy")) { } else if (property.startsWith("NotEnchantedBy")) {
if (enchantedBy.contains(source)) { if (getEnchantedBy().contains(source)) {
return false; return false;
} }
} else if (property.startsWith("Enchanted")) { } else if (property.startsWith("Enchanted")) {

View File

@@ -25,68 +25,68 @@ import forge.properties.NewConstants;
*/ */
public class CopyFiles extends SwingWorker<Void, Integer> implements NewConstants { public class CopyFiles extends SwingWorker<Void, Integer> implements NewConstants {
private List<File> FileList; private final List<File> fileList;
/** The j lb. */ /** The j lb. */
JLabel jLb; private final JLabel jLabel;
/** The j b. */ /** The j b. */
JProgressBar jB; private JProgressBar jProgressBar;
/** The j check. */ /** The j check. */
JCheckBox jCheck; private final JCheckBox jCheck;
/** The j source. */ /** The j source. */
JButton jSource; private final JButton jSource;
/** The count. */ /** The count. */
int count; private int count;
/** /**
* <p> * <p>
* Constructor for CopyFiles. * Constructor for CopyFiles.
* </p> * </p>
* *
* @param FileList * @param fileList
* a {@link java.util.List} object. * a {@link java.util.List} object.
* @param jLabelTotalFiles * @param jLabelTotalFiles
* a {@link javax.swing.JLabel} object. * a {@link javax.swing.JLabel} object.
* @param Jbar * @param jProgressBar
* a {@link javax.swing.JProgressBar} object. * a {@link javax.swing.JProgressBar} object.
* @param jCheckBox * @param jCheckBox
* a {@link javax.swing.JCheckBox} object. * a {@link javax.swing.JCheckBox} object.
* @param jButtonSource * @param jButtonSource
* a {@link javax.swing.JButton} object. * a {@link javax.swing.JButton} object.
*/ */
public CopyFiles(final List<File> FileList, final JLabel jLabelTotalFiles, final JProgressBar Jbar, final JCheckBox jCheckBox, public CopyFiles(final List<File> fileList, final JLabel jLabelTotalFiles, JProgressBar jProgressBar,
final JButton jButtonSource) { final JCheckBox jCheckBox, final JButton jButtonSource) {
this.FileList = FileList; this.fileList = fileList;
jLb = jLabelTotalFiles; this.jLabel = jLabelTotalFiles;
jB = Jbar; this.jProgressBar = jProgressBar;
jCheck = jCheckBox; this.jCheck = jCheckBox;
jSource = jButtonSource; this.jSource = jButtonSource;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected final Void doInBackground() { protected final Void doInBackground() {
for (int i = 0; i < this.FileList.size(); i++) { for (int i = 0; i < this.fileList.size(); i++) {
publish(); this.publish();
String cName, name, source; String cName, name, source;
name = this.FileList.get(i).getName(); name = this.fileList.get(i).getName();
source = this.FileList.get(i).getAbsolutePath(); source = this.fileList.get(i).getAbsolutePath();
cName = name.substring(0, name.length() - 8); cName = name.substring(0, name.length() - 8);
cName = GuiDisplayUtil.cleanString(cName) + ".jpg"; cName = GuiDisplayUtil.cleanString(cName) + ".jpg";
File sourceFile = new File(source); final File sourceFile = new File(source);
File base = ForgeProps.getFile(IMAGE_BASE); final File base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
File reciever = new File(base, cName); final File reciever = new File(base, cName);
reciever.delete(); reciever.delete();
try { try {
reciever.createNewFile(); reciever.createNewFile();
FileOutputStream fos = new FileOutputStream(reciever); final FileOutputStream fos = new FileOutputStream(reciever);
FileInputStream fis = new FileInputStream(sourceFile); final FileInputStream fis = new FileInputStream(sourceFile);
byte[] buff = new byte[32 * 1024]; final byte[] buff = new byte[32 * 1024];
int length; int length;
while (fis.available() > 0) { while (fis.available() > 0) {
length = fis.read(buff); length = fis.read(buff);
@@ -97,10 +97,10 @@ public class CopyFiles extends SwingWorker<Void, Integer> implements NewConstant
fos.flush(); fos.flush();
fis.close(); fis.close();
fos.close(); fos.close();
count = i * 100 / this.FileList.size() + 1; this.count = ((i * 100) / this.fileList.size()) + 1;
setProgress(count); this.setProgress(this.count);
} catch (IOException e1) { } catch (final IOException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
@@ -112,10 +112,10 @@ public class CopyFiles extends SwingWorker<Void, Integer> implements NewConstant
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected final void done() { protected final void done() {
jLb.setText("All files were copied successfully."); this.jLabel.setText("All files were copied successfully.");
jB.setIndeterminate(false); this.jProgressBar.setIndeterminate(false);
jCheck.setEnabled(true); this.jCheck.setEnabled(true);
jSource.setEnabled(true); this.jSource.setEnabled(true);
} }

View File

@@ -301,7 +301,7 @@ public enum Counters {
* </p> * </p>
*/ */
private Counters() { private Counters() {
this.name = name().substring(0, 1).toUpperCase() + name().substring(1).toLowerCase(); this.name = this.name().substring(0, 1).toUpperCase() + this.name().substring(1).toLowerCase();
} }
/** /**
@@ -324,7 +324,7 @@ public enum Counters {
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public String getName() { public String getName() {
return name; return this.name;
} }
/** /**
@@ -337,7 +337,7 @@ public enum Counters {
* @return a {@link forge.Counters} object. * @return a {@link forge.Counters} object.
*/ */
public static Counters getType(final String name) { public static Counters getType(final String name) {
String replacedName = name.replace("/", "").replaceAll("\\+", "p").replaceAll("\\-", "m").toUpperCase(); final String replacedName = name.replace("/", "").replaceAll("\\+", "p").replaceAll("\\-", "m").toUpperCase();
return Enum.valueOf(Counters.class, replacedName); return Enum.valueOf(Counters.class, replacedName);
} }
} }

View File

@@ -20,13 +20,13 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
private static final long serialVersionUID = -5687652485777639176L; private static final long serialVersionUID = -5687652485777639176L;
/** The cards. */ /** The cards. */
protected List<Card> cards = new ArrayList<Card>(); private List<Card> cardList = new ArrayList<Card>();
private final Constant.Zone zoneName; private final Constant.Zone zoneName;
private final Player player; private final Player player;
private boolean update = true; private boolean update = true;
private CardList cardsAddedThisTurn = new CardList(); private final CardList cardsAddedThisTurn = new CardList();
private ArrayList<Constant.Zone> cardsAddedThisTurnSource = new ArrayList<Constant.Zone>(); private final ArrayList<Constant.Zone> cardsAddedThisTurnSource = new ArrayList<Constant.Zone>();
/** /**
* <p> * <p>
@@ -39,8 +39,8 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* a {@link forge.Player} object. * a {@link forge.Player} object.
*/ */
public DefaultPlayerZone(final Constant.Zone zone, final Player inPlayer) { public DefaultPlayerZone(final Constant.Zone zone, final Player inPlayer) {
zoneName = zone; this.zoneName = zone;
player = inPlayer; this.player = inPlayer;
} }
// ************ BEGIN - these methods fire updateObservers() ************* // ************ BEGIN - these methods fire updateObservers() *************
@@ -51,30 +51,32 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* @param o * @param o
* a {@link java.lang.Object} object. * a {@link java.lang.Object} object.
*/ */
@Override
public void add(final Object o) { public void add(final Object o) {
Card c = (Card) o; final Card c = (Card) o;
// Immutable cards are usually emblems,effects and the mana pool and we // Immutable cards are usually emblems,effects and the mana pool and we
// don't want to log those. // don't want to log those.
if (!c.isImmutable()) { if (!c.isImmutable()) {
cardsAddedThisTurn.add(c); this.cardsAddedThisTurn.add(c);
if (AllZone.getZoneOf(c) != null) { if (AllZone.getZoneOf(c) != null) {
cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType()); this.cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType());
} else { } else {
cardsAddedThisTurnSource.add(null); this.cardsAddedThisTurnSource.add(null);
} }
} }
if (is(Zone.Graveyard) if (this.is(Zone.Graveyard)
&& c.hasKeyword("If CARDNAME would be put into a graveyard from anywhere, reveal CARDNAME and shuffle it into its owner's library instead.")) { && c.hasKeyword("If CARDNAME would be put into a graveyard "
PlayerZone lib = c.getOwner().getZone(Constant.Zone.Library); + "from anywhere, reveal CARDNAME and shuffle it into its owner's library instead.")) {
final PlayerZone lib = c.getOwner().getZone(Constant.Zone.Library);
lib.add(c); lib.add(c);
c.getOwner().shuffle(); c.getOwner().shuffle();
return; return;
} }
if (c.isUnearthed() && (is(Zone.Graveyard) || is(Zone.Hand) || is(Zone.Library))) { if (c.isUnearthed() && (this.is(Zone.Graveyard) || this.is(Zone.Hand) || this.is(Zone.Library))) {
PlayerZone removed = c.getOwner().getZone(Constant.Zone.Exile); final PlayerZone removed = c.getOwner().getZone(Constant.Zone.Exile);
removed.add(c); removed.add(c);
c.setUnearthed(false); c.setUnearthed(false);
return; return;
@@ -84,8 +86,8 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
c.setTurnInZone(AllZone.getPhase().getTurn()); c.setTurnInZone(AllZone.getPhase().getTurn());
cards.add((Card) c); this.getCardList().add(c);
update(); this.update();
} }
/** /**
@@ -96,6 +98,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* @param object * @param object
* an Object * an Object
*/ */
@Override
public final void update(final Observable ob, final Object object) { public final void update(final Observable ob, final Object object) {
this.update(); this.update();
} }
@@ -108,21 +111,22 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* @param index * @param index
* a int. * a int.
*/ */
@Override
public final void add(final Card c, final int index) { public final void add(final Card c, final int index) {
// Immutable cards are usually emblems,effects and the mana pool and we // Immutable cards are usually emblems,effects and the mana pool and we
// don't want to log those. // don't want to log those.
if (!c.isImmutable()) { if (!c.isImmutable()) {
cardsAddedThisTurn.add(c); this.cardsAddedThisTurn.add(c);
if (AllZone.getZoneOf(c) != null) { if (AllZone.getZoneOf(c) != null) {
cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType()); this.cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType());
} else { } else {
cardsAddedThisTurnSource.add(null); this.cardsAddedThisTurnSource.add(null);
} }
} }
cards.add(index, c); this.getCardList().add(index, c);
c.setTurnInZone(AllZone.getPhase().getTurn()); c.setTurnInZone(AllZone.getPhase().getTurn());
update(); this.update();
} }
/* /*
@@ -132,10 +136,12 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
*/ */
/** /**
* @return boolean * @return boolean
* @param c Card * @param c
* Card
*/ */
@Override
public final boolean contains(final Card c) { public final boolean contains(final Card c) {
return cards.contains(c); return this.getCardList().contains(c);
} }
/** /**
@@ -144,9 +150,10 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* @param c * @param c
* an Object * an Object
*/ */
@Override
public void remove(final Object c) { public void remove(final Object c) {
cards.remove((Card) c); this.getCardList().remove(c);
update(); this.update();
} }
/** /**
@@ -157,9 +164,10 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* @param c * @param c
* an array of {@link forge.Card} objects. * an array of {@link forge.Card} objects.
*/ */
@Override
public final void setCards(final Card[] c) { public final void setCards(final Card[] c) {
cards = new ArrayList<Card>(Arrays.asList(c)); this.setCardList(new ArrayList<Card>(Arrays.asList(c)));
update(); this.update();
} }
// removes all cards // removes all cards
@@ -168,11 +176,12 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* reset. * reset.
* </p> * </p>
*/ */
@Override
public final void reset() { public final void reset() {
cardsAddedThisTurn.clear(); this.cardsAddedThisTurn.clear();
cardsAddedThisTurnSource.clear(); this.cardsAddedThisTurnSource.clear();
cards.clear(); this.getCardList().clear();
update(); this.update();
} }
// ************ END - these methods fire updateObservers() ************* // ************ END - these methods fire updateObservers() *************
@@ -184,8 +193,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
* @return a boolean * @return a boolean
*/ */
@Override
public final boolean is(final Constant.Zone zone) { public final boolean is(final Constant.Zone zone) {
return zone.equals(zoneName); return zone.equals(this.zoneName);
} }
/* /*
@@ -193,8 +203,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* *
* @see forge.IPlayerZone#is(java.util.List) * @see forge.IPlayerZone#is(java.util.List)
*/ */
@Override
public final boolean is(final List<Constant.Zone> zones) { public final boolean is(final List<Constant.Zone> zones) {
return zones.contains(zoneName); return zones.contains(this.zoneName);
} }
/** /**
@@ -206,8 +217,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* a {@link forge.Player} object. * a {@link forge.Player} object.
* @return a boolean * @return a boolean
*/ */
@Override
public final boolean is(final Constant.Zone zone, final Player player) { public final boolean is(final Constant.Zone zone, final Player player) {
return (zone.equals(zoneName) && player.isPlayer(player)); return (zone.equals(this.zoneName) && player.isPlayer(player));
} }
/** /**
@@ -217,8 +229,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* *
* @return a {@link forge.Player} object. * @return a {@link forge.Player} object.
*/ */
@Override
public final Player getPlayer() { public final Player getPlayer() {
return player; return this.player;
} }
/** /**
@@ -228,8 +241,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* *
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
@Override
public final Constant.Zone getZoneType() { public final Constant.Zone getZoneType() {
return zoneName; return this.zoneName;
} }
/** /**
@@ -239,8 +253,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* *
* @return a int. * @return a int.
*/ */
@Override
public final int size() { public final int size() {
return cards.size(); return this.getCardList().size();
} }
/** /**
@@ -250,8 +265,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* a int. * a int.
* @return a int * @return a int
*/ */
@Override
public final Card get(final int index) { public final Card get(final int index) {
return (Card) cards.get(index); return this.getCardList().get(index);
} }
/** /**
@@ -261,8 +277,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* *
* @return an array of {@link forge.Card} objects. * @return an array of {@link forge.Card} objects.
*/ */
@Override
public final Card[] getCards() { public final Card[] getCards() {
return getCards(true); return this.getCards(true);
} }
/* /*
@@ -273,8 +290,8 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
@Override @Override
public Card[] getCards(final boolean filter) { public Card[] getCards(final boolean filter) {
// Non-Battlefield PlayerZones don't care about the filter // Non-Battlefield PlayerZones don't care about the filter
Card[] c = new Card[cards.size()]; final Card[] c = new Card[this.getCardList().size()];
cards.toArray(c); this.getCardList().toArray(c);
return c; return c;
} }
@@ -283,10 +300,11 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* *
* @see forge.IPlayerZone#getCards(int) * @see forge.IPlayerZone#getCards(int)
*/ */
@Override
public final Card[] getCards(final int n) { public final Card[] getCards(final int n) {
Card[] c = new Card[Math.min(cards.size(), n)]; final Card[] c = new Card[Math.min(this.getCardList().size(), n)];
for (int i = 0; i < c.length; i++) { for (int i = 0; i < c.length; i++) {
c[i] = cards.get(i); c[i] = this.getCardList().get(i);
} }
return c; return c;
} }
@@ -298,7 +316,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
*/ */
@Override @Override
public final boolean isEmpty() { public final boolean isEmpty() {
return cards.isEmpty(); return this.getCardList().isEmpty();
} }
/** /**
@@ -307,8 +325,8 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* </p> * </p>
*/ */
public final void update() { public final void update() {
if (update) { if (this.update) {
updateObservers(); this.updateObservers();
} }
} }
@@ -318,8 +336,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* @param b * @param b
* a boolean. * a boolean.
*/ */
@Override
public final void setUpdate(final boolean b) { public final void setUpdate(final boolean b) {
update = b; this.update = b;
} }
/** /**
@@ -329,8 +348,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* *
* @return a boolean. * @return a boolean.
*/ */
@Override
public final boolean getUpdate() { public final boolean getUpdate() {
return update; return this.update;
} }
/** /**
@@ -340,8 +360,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* *
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
@Override
public final String toString() { public final String toString() {
return player != null ? String.format("%s %s", player, zoneName) : zoneName.toString(); return this.player != null ? String.format("%s %s", this.player, this.zoneName) : this.zoneName.toString();
} }
/** /**
@@ -354,18 +375,17 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public final CardList getCardsAddedThisTurn(final Constant.Zone origin) { public final CardList getCardsAddedThisTurn(final Constant.Zone origin) {
System.out.print("Request cards put into " + getZoneType() + " from " + origin + ".Amount: "); System.out.print("Request cards put into " + this.getZoneType() + " from " + origin + ".Amount: ");
CardList ret = new CardList(); final CardList ret = new CardList();
for (int i = 0; i < cardsAddedThisTurn.size(); i++) { for (int i = 0; i < this.cardsAddedThisTurn.size(); i++) {
if (cardsAddedThisTurnSource.get(i) == origin || origin == null /* if ((this.cardsAddedThisTurnSource.get(i) == origin) || (origin == null /*
* former * former
* : * :
* equals * equals
* ( * (
* 'Any') * 'Any')
*/) */)) {
{ ret.add(this.cardsAddedThisTurn.get(i));
ret.add(cardsAddedThisTurn.get(i));
} }
} }
System.out.println(ret.size()); System.out.println(ret.size());
@@ -377,9 +397,24 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
* resetCardsAddedThisTurn. * resetCardsAddedThisTurn.
* </p> * </p>
*/ */
@Override
public final void resetCardsAddedThisTurn() { public final void resetCardsAddedThisTurn() {
cardsAddedThisTurn.clear(); this.cardsAddedThisTurn.clear();
cardsAddedThisTurnSource.clear(); this.cardsAddedThisTurnSource.clear();
}
/**
* @return the cardList
*/
public List<Card> getCardList() {
return cardList;
}
/**
* @param cardList the cardList to set
*/
public void setCardList(List<Card> cardList) {
this.cardList = cardList; // TODO: Add 0 to parameter's name.
} }
} }

View File

@@ -148,7 +148,8 @@ public class EndOfTurn implements java.io.Serializable {
AllZone.getStack().addSimultaneousStackEntry(sac); AllZone.getStack().addSimultaneousStackEntry(sac);
} else { } else {
c.removeExtrinsicKeyword("At the beginning of the next end step, destroy CARDNAME if it attacked this turn."); c.removeExtrinsicKeyword("At the beginning of the next end step, "
+ "destroy CARDNAME if it attacked this turn.");
} }
} }
if (c.hasKeyword("An opponent gains control of CARDNAME at the beginning of the next end step.")) { if (c.hasKeyword("An opponent gains control of CARDNAME at the beginning of the next end step.")) {
@@ -162,7 +163,8 @@ public class EndOfTurn implements java.io.Serializable {
// new CardList(vale), vale.getController(), // new CardList(vale), vale.getController(),
// vale.getController().getOpponent()); // vale.getController().getOpponent());
vale.removeExtrinsicKeyword("An opponent gains control of CARDNAME at the beginning of the next end step."); vale.removeExtrinsicKeyword("An opponent gains control of CARDNAME "
+ "at the beginning of the next end step.");
} }
} }
}; };

View File

@@ -56,7 +56,8 @@ public class ExternalPanel extends JPanel {
*/ */
public ExternalPanel(final Component child, final String side) { public ExternalPanel(final Component child, final String side) {
super(new BorderLayout()); super(new BorderLayout());
add(this.child = child); this.child = child;
add(this.child);
JButton b = new JButton(); JButton b = new JButton();
b.setPreferredSize(new Dimension(6, 6)); b.setPreferredSize(new Dimension(6, 6));
b.setToolTipText("Click to move component into an extra Window"); b.setToolTipText("Click to move component into an extra Window");

View File

@@ -36,7 +36,7 @@ import forge.properties.NewConstants;
* @version $Id$ * @version $Id$
*/ */
public class GUI_ImportPicture extends JDialog implements NewConstants { public class GUI_ImportPicture extends JDialog implements NewConstants {
/** Constant <code>serialVersionUID=-4191539152208389089L</code> */ /** Constant <code>serialVersionUID=-4191539152208389089L</code>. */
private static final long serialVersionUID = -4191539152208389089L; private static final long serialVersionUID = -4191539152208389089L;
private JPanel jContentPane = null; private JPanel jContentPane = null;
private JLabel jLabel = null; private JLabel jLabel = null;
@@ -48,12 +48,12 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
private JButton jButtonStart = null; private JButton jButtonStart = null;
/** The frame. */ /** The frame. */
GUI_ImportPicture frame; private GUI_ImportPicture frame;
private JLabel jLabelHDDFree = null; private JLabel jLabelHDDFree = null;
private JLabel jLabelNeedSpace = null; private JLabel jLabelNeedSpace = null;
/** The j label total files. */ /** The j label total files. */
public JLabel jLabelTotalFiles = null; private JLabel jLabelTotalFiles = null;
private List<File> listFiles; private List<File> listFiles;
private ArrayList<File> fileCopyList; private ArrayList<File> fileCopyList;
private long freeSpaceM; private long freeSpaceM;
@@ -76,7 +76,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
} }
/** /**
* This method initializes this * This method initializes this.
*/ */
private void initialize() { private void initialize() {
Dimension screen = getToolkit().getScreenSize(); Dimension screen = getToolkit().getScreenSize();
@@ -95,7 +95,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
} }
/** /**
* This method initializes jContentPane * This method initializes jContentPane.
* *
* @return javax.swing.JPanel * @return javax.swing.JPanel
*/ */
@@ -146,7 +146,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
} }
/** /**
* This method initializes jButtonSource * This method initializes jButtonSource.
* *
* @return javax.swing.JButton * @return javax.swing.JButton
*/ */
@@ -230,7 +230,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
} }
/** /**
* This method initializes jPanel * This method initializes jPanel.
* *
* @return javax.swing.JPanel * @return javax.swing.JPanel
*/ */
@@ -251,7 +251,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
} }
/** /**
* This method initializes jCheckBox * This method initializes jCheckBox.
* *
* @return javax.swing.JCheckBox * @return javax.swing.JCheckBox
*/ */
@@ -316,7 +316,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
} }
/** /**
* This method initializes jButtonStart * This method initializes jButtonStart.
* *
* @return javax.swing.JButton * @return javax.swing.JButton
*/ */
@@ -370,7 +370,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
} }
/** /**
* This method initializes jProgressBar * This method initializes jProgressBar.
* *
* @return javax.swing.JProgressBar * @return javax.swing.JProgressBar
*/ */

View File

@@ -183,8 +183,7 @@ public class GameAction {
// UNLESS we're dealing with Skullbriar, the Walking Grave // UNLESS we're dealing with Skullbriar, the Walking Grave
if (!zone.is(Constant.Zone.Battlefield) if (!zone.is(Constant.Zone.Battlefield)
&& !(c.getName().equals("Skullbriar, the Walking Grave") && !zone.is(Constant.Zone.Hand) && !zone && !(c.getName().equals("Skullbriar, the Walking Grave") && !zone.is(Constant.Zone.Hand) && !zone
.is(Constant.Zone.Library))) .is(Constant.Zone.Library))) {
{
copied.clearCounters(); copied.clearCounters();
} }
@@ -211,8 +210,7 @@ public class GameAction {
// String prevName = prev != null ? prev.getZoneName() : ""; // String prevName = prev != null ? prev.getZoneName() : "";
if (c.hasKeyword("If CARDNAME would leave the battlefield, exile it instead of putting it anywhere else.") if (c.hasKeyword("If CARDNAME would leave the battlefield, exile it instead of putting it anywhere else.")
&& !zone.is(Constant.Zone.Exile)) && !zone.is(Constant.Zone.Exile)) {
{
PlayerZone removed = c.getOwner().getZone(Constant.Zone.Exile); PlayerZone removed = c.getOwner().getZone(Constant.Zone.Exile);
c.removeExtrinsicKeyword("If CARDNAME would leave the battlefield, " c.removeExtrinsicKeyword("If CARDNAME would leave the battlefield, "
+ "exile it instead of putting it anywhere else."); + "exile it instead of putting it anywhere else.");
@@ -351,8 +349,7 @@ public class GameAction {
for (Card card : opponentsBoard) { for (Card card : opponentsBoard) {
if (card.hasKeyword("If a card would be put into an opponent's " if (card.hasKeyword("If a card would be put into an opponent's "
+ "graveyard from anywhere, exile it instead.")) + "graveyard from anywhere, exile it instead.")) {
{
return moveTo(exile, c); return moveTo(exile, c);
} }
} }

View File

@@ -220,7 +220,7 @@ public final class GameActionUtil {
} else { } else {
activateRipple = true; activateRipple = true;
} }
if (activateRipple == true) { if (activateRipple) {
final Ability ability = new Ability(c, "0") { final Ability ability = new Ability(c, "0") {
@Override @Override
public void resolve() { public void resolve() {
@@ -744,7 +744,8 @@ public final class GameActionUtil {
&& a.get(i) && a.get(i)
.toString() .toString()
.startsWith( .startsWith(
"Whenever a creature dealt damage by CARDNAME this turn is put into a graveyard, put")) { "Whenever a creature dealt damage by CARDNAME "
+ "this turn is put into a graveyard, put")) {
final Card thisCard = c; final Card thisCard = c;
final String kw = a.get(i).toString(); final String kw = a.get(i).toString();
Ability ability2 = new Ability(c, "0") { Ability ability2 = new Ability(c, "0") {
@@ -1165,7 +1166,8 @@ public final class GameActionUtil {
"Creature", "Elemental" }, 2, 2, new String[] { "Trample" }); "Creature", "Elemental" }, 2, 2, new String[] { "Trample" });
for (Card c : cl) { for (Card c : cl) {
c.setText("Whenever Spawnwrithe deals combat damage to a player, put a token that's a copy of Spawnwrithe onto the battlefield."); c.setText("Whenever Spawnwrithe deals combat damage to a player, "
+ "put a token that's a copy of Spawnwrithe onto the battlefield.");
c.setCopiedToken(true); c.setCopiedToken(true);
} }
} }
@@ -1202,7 +1204,8 @@ public final class GameActionUtil {
emblem = emblem.filter(new CardListFilter() { emblem = emblem.filter(new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isEmblem() return c.isEmblem()
&& c.hasKeyword("Artifacts, creatures, enchantments, and lands you control are indestructible."); && c.hasKeyword("Artifacts, creatures, enchantments, "
+ "and lands you control are indestructible.");
} }
}); });
@@ -1580,8 +1583,8 @@ public final class GameActionUtil {
private static Command Alpha_Status = new Command() { private static Command Alpha_Status = new Command() {
private static final long serialVersionUID = -3213793711304934358L; private static final long serialVersionUID = -3213793711304934358L;
CardList previouslyPumped = new CardList(); private CardList previouslyPumped = new CardList();
ArrayList<Integer> previouslyPumpedValue = new ArrayList<Integer>(); private ArrayList<Integer> previouslyPumpedValue = new ArrayList<Integer>();
@Override @Override
public void execute() { public void execute() {
@@ -1629,7 +1632,7 @@ public final class GameActionUtil {
}; };
/** stores the Command. */ /** stores the Command. */
public static Command Umbra_Stalker = new Command() { private static Command umbraStalker = new Command() {
private static final long serialVersionUID = -3500747003228938898L; private static final long serialVersionUID = -3500747003228938898L;
public void execute() { public void execute() {
@@ -1646,7 +1649,7 @@ public final class GameActionUtil {
}; };
/** Constant <code>Ajani_Avatar_Token</code>. */ /** Constant <code>Ajani_Avatar_Token</code>. */
public static Command Ajani_Avatar_Token = new Command() { private static Command ajaniAvatarToken = new Command() {
private static final long serialVersionUID = 3027329837165436727L; private static final long serialVersionUID = 3027329837165436727L;
public void execute() { public void execute() {
@@ -1667,7 +1670,7 @@ public final class GameActionUtil {
}; // Ajani Avatar }; // Ajani Avatar
/** Constant <code>Old_Man_of_the_Sea</code>. */ /** Constant <code>Old_Man_of_the_Sea</code>. */
public static Command Old_Man_of_the_Sea = new Command() { private static Command oldManOfTheSea = new Command() {
private static final long serialVersionUID = 8076177362922156784L; private static final long serialVersionUID = 8076177362922156784L;
public void execute() { public void execute() {
@@ -1686,7 +1689,7 @@ public final class GameActionUtil {
}; // Old Man of the Sea }; // Old Man of the Sea
/** Constant <code>Homarid</code>. */ /** Constant <code>Homarid</code>. */
public static Command Homarid = new Command() { private static Command homarid = new Command() {
private static final long serialVersionUID = 7156319758035295773L; private static final long serialVersionUID = 7156319758035295773L;
public void execute() { public void execute() {
@@ -1702,7 +1705,7 @@ public final class GameActionUtil {
}; };
/** Constant <code>Liu_Bei</code>. */ /** Constant <code>Liu_Bei</code>. */
public static Command Liu_Bei = new Command() { private static Command liuBei = new Command() {
private static final long serialVersionUID = 4235093010715735727L; private static final long serialVersionUID = 4235093010715735727L;
@@ -1748,7 +1751,8 @@ public final class GameActionUtil {
list = list.filter(new CardListFilter() { list = list.filter(new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.getName().equals("Wolf") return c.getName().equals("Wolf")
&& c.hasKeyword("This creature gets +1/+1 for each card named Sound the Call in each graveyard."); && c.hasKeyword("This creature gets +1/+1 for each card "
+ "named Sound the Call in each graveyard.");
} }
}); });
@@ -1768,7 +1772,7 @@ public final class GameActionUtil {
}; // Sound_the_Call_Wolf }; // Sound_the_Call_Wolf
/** Constant <code>Tarmogoyf</code>. */ /** Constant <code>Tarmogoyf</code>. */
public static Command Tarmogoyf = new Command() { private static Command tarmogoyf = new Command() {
private static final long serialVersionUID = 5895665460018262987L; private static final long serialVersionUID = 5895665460018262987L;
public void execute() { public void execute() {
@@ -1868,7 +1872,8 @@ public final class GameActionUtil {
for (int i = 0; i < creature.size(); i++) { for (int i = 0; i < creature.size(); i++) {
c = creature.get(i); c = creature.get(i);
if (((c.getAbilityText().trim().equals("") || c.isFaceDown()) && c.getUnhiddenKeyword().size() == 0)) { if (((c.getAbilityText().trim().equals("")
|| c.isFaceDown()) && c.getUnhiddenKeyword().size() == 0)) {
c.addSemiPermanentAttackBoost(2); c.addSemiPermanentAttackBoost(2);
c.addSemiPermanentDefenseBoost(2); c.addSemiPermanentDefenseBoost(2);
@@ -1914,22 +1919,22 @@ public final class GameActionUtil {
static { static {
// Please add cards in alphabetical order so they are easier to find // Please add cards in alphabetical order so they are easier to find
commands.put("Ajani_Avatar_Token", Ajani_Avatar_Token); commands.put("Ajani_Avatar_Token", ajaniAvatarToken);
commands.put("Alpha_Status", Alpha_Status); commands.put("Alpha_Status", Alpha_Status);
commands.put("Coat_of_Arms", Coat_of_Arms); commands.put("Coat_of_Arms", Coat_of_Arms);
commands.put("Elspeth_Emblem", Elspeth_Emblem); commands.put("Elspeth_Emblem", Elspeth_Emblem);
commands.put("Homarid", Homarid); commands.put("Homarid", homarid);
commands.put("Liu_Bei", Liu_Bei); commands.put("Liu_Bei", liuBei);
commands.put("Muraganda_Petroglyphs", Muraganda_Petroglyphs); commands.put("Muraganda_Petroglyphs", Muraganda_Petroglyphs);
commands.put("Old_Man_of_the_Sea", Old_Man_of_the_Sea); commands.put("Old_Man_of_the_Sea", oldManOfTheSea);
commands.put("Sound_the_Call_Wolf", Sound_the_Call_Wolf); commands.put("Sound_the_Call_Wolf", Sound_the_Call_Wolf);
commands.put("Tarmogoyf", Tarmogoyf); commands.put("Tarmogoyf", tarmogoyf);
commands.put("Umbra_Stalker", Umbra_Stalker); commands.put("Umbra_Stalker", umbraStalker);
// /The commands above are in alphabetical order by cardname. // /The commands above are in alphabetical order by cardname.
} }

View File

@@ -17,7 +17,7 @@ public abstract class GameEntity extends MyObservable {
private int preventNextDamage = 0; private int preventNextDamage = 0;
/** The enchanted by. */ /** The enchanted by. */
protected ArrayList<Card> enchantedBy = new ArrayList<Card>(); private ArrayList<Card> enchantedBy = new ArrayList<Card>();
/** /**
* <p> * <p>
@@ -288,7 +288,7 @@ public abstract class GameEntity extends MyObservable {
/** /**
* Checks if is valid. * Checks if is valid.
* *
* @param Restrictions * @param restrictions
* the restrictions * the restrictions
* @param sourceController * @param sourceController
* the source controller * the source controller
@@ -296,20 +296,21 @@ public abstract class GameEntity extends MyObservable {
* the source * the source
* @return true, if is valid * @return true, if is valid
*/ */
public boolean isValid(final String Restrictions[], final Player sourceController, final Card source) { public boolean isValid(final String[] restrictions, final Player sourceController, final Card source) {
for (int i = 0; i < Restrictions.length; i++) { for (int i = 0; i < restrictions.length; i++) {
if (isValid(Restrictions[i], sourceController, source)) if (isValid(restrictions[i], sourceController, source)) {
return true; return true;
}
} }
return false; return false;
}// isValid } // isValid
/** /**
* Checks if is valid. * Checks if is valid.
* *
* @param Restriction * @param restriction
* the restriction * the restriction
* @param sourceController * @param sourceController
* the source controller * the source controller
@@ -317,14 +318,14 @@ public abstract class GameEntity extends MyObservable {
* the source * the source
* @return true, if is valid * @return true, if is valid
*/ */
public boolean isValid(final String Restriction, final Player sourceController, final Card source) { public boolean isValid(final String restriction, final Player sourceController, final Card source) {
return false; return false;
} }
/** /**
* Checks for property. * Checks for property.
* *
* @param Property * @param property
* the property * the property
* @param sourceController * @param sourceController
* the source controller * the source controller
@@ -332,7 +333,7 @@ public abstract class GameEntity extends MyObservable {
* the source * the source
* @return true, if successful * @return true, if successful
*/ */
public boolean hasProperty(String Property, final Player sourceController, final Card source) { public boolean hasProperty(String property, final Player sourceController, final Card source) {
return false; return false;
} }

View File

@@ -110,22 +110,22 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
private GuiInput inputControl; private GuiInput inputControl;
/** The stat font. */ /** The stat font. */
Font statFont = new Font("Dialog", Font.PLAIN, 12); private Font statFont = new Font("Dialog", Font.PLAIN, 12);
/** The life font. */ /** The life font. */
Font lifeFont = new Font("Dialog", Font.PLAIN, 40); private Font lifeFont = new Font("Dialog", Font.PLAIN, 40);
// Font checkboxFont = new Font("Dialog", Font.PLAIN, 9); // Font checkboxFont = new Font("Dialog", Font.PLAIN, 9);
/** Constant <code>greenColor</code>. */ /** Constant <code>greenColor</code>. */
public static Color greenColor = new Color(0, 164, 0); private static Color greenColor = new Color(0, 164, 0);
private Action HUMAN_GRAVEYARD_ACTION; private Action humanGraveyardAction;
private Action HUMAN_REMOVED_ACTION; private Action humanRemovedACtion;
private Action HUMAN_FLASHBACK_ACTION; private Action humanFlashbackAction;
private Action COMPUTER_GRAVEYARD_ACTION; private Action computerGraveyardAction;
private Action COMPUTER_REMOVED_ACTION; private Action computerRemovedAction;
private Action CONCEDE_ACTION; private Action concedeAction;
private Action HUMAN_DECKLIST_ACTION; private Action humanDecklistAction;
// public Card cCardHQ; // public Card cCardHQ;
// private CardList multiBlockers = new CardList(); // private CardList multiBlockers = new CardList();
@@ -177,9 +177,9 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
* </p> * </p>
*/ */
private void setupActions() { private void setupActions() {
HUMAN_GRAVEYARD_ACTION = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_GRAVEYARD); humanGraveyardAction = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_GRAVEYARD);
HUMAN_REMOVED_ACTION = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Exile), HUMAN_REMOVED); humanRemovedACtion = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Exile), HUMAN_REMOVED);
HUMAN_FLASHBACK_ACTION = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_FLASHBACK) { humanFlashbackAction = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_FLASHBACK) {
private static final long serialVersionUID = 8120331222693706164L; private static final long serialVersionUID = 8120331222693706164L;
@@ -194,12 +194,12 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
AllZone.getGameAction().playCard(c); AllZone.getGameAction().playCard(c);
} }
}; };
COMPUTER_GRAVEYARD_ACTION = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Graveyard), computerGraveyardAction = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Graveyard),
COMPUTER_GRAVEYARD); COMPUTER_GRAVEYARD);
COMPUTER_REMOVED_ACTION = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Exile), COMPUTER_REMOVED); computerRemovedAction = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Exile), COMPUTER_REMOVED);
CONCEDE_ACTION = new ConcedeAction(); concedeAction = new ConcedeAction();
HUMAN_DECKLIST_ACTION = new DeckListAction(HUMAN_DECKLIST); humanDecklistAction = new DeckListAction(HUMAN_DECKLIST);
} }
/** /**
@@ -212,9 +212,9 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
triggerMenu = new TriggerReactionMenu(); triggerMenu = new TriggerReactionMenu();
// Game Menu Creation // Game Menu Creation
Object[] obj = { HUMAN_DECKLIST_ACTION, HUMAN_GRAVEYARD_ACTION, HUMAN_REMOVED_ACTION, HUMAN_FLASHBACK_ACTION, Object[] obj = { humanDecklistAction, humanGraveyardAction, humanRemovedACtion, humanFlashbackAction,
COMPUTER_GRAVEYARD_ACTION, COMPUTER_REMOVED_ACTION, new JSeparator(), playsoundCheckboxForMenu, computerGraveyardAction, computerRemovedAction, new JSeparator(), playsoundCheckboxForMenu,
new JSeparator(), ErrorViewer.ALL_THREADS_ACTION, CONCEDE_ACTION }; new JSeparator(), ErrorViewer.ALL_THREADS_ACTION, concedeAction };
JMenu gameMenu = new JMenu(ForgeProps.getLocalized(MENU_BAR.MENU.TITLE)); JMenu gameMenu = new JMenu(ForgeProps.getLocalized(MENU_BAR.MENU.TITLE));
for (Object o : obj) { for (Object o : obj) {
@@ -254,7 +254,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
Action viewAIHand = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Hand), COMPUTER_HAND.BASE); Action viewAIHand = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Hand), COMPUTER_HAND.BASE);
Action viewAILibrary = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Library), Action viewAILibrary = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Library),
COMPUTER_LIBRARY.BASE); COMPUTER_LIBRARY.BASE);
Action viewHumanLibrary = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Library), HUMAN_LIBRARY.BASE); Action viewHumanLibrary
= new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Library), HUMAN_LIBRARY.BASE);
ForgeAction generateMana = new ForgeAction(MANAGEN) { ForgeAction generateMana = new ForgeAction(MANAGEN) {
private static final long serialVersionUID = 7171104690016706405L; private static final long serialVersionUID = 7171104690016706405L;
@@ -1189,8 +1190,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
oppHandLabel.setFont(statFont); oppHandLabel.setFont(statFont);
} }
JButton oppGraveButton = new JButton(COMPUTER_GRAVEYARD_ACTION); JButton oppGraveButton = new JButton(computerGraveyardAction);
oppGraveButton.setText((String) COMPUTER_GRAVEYARD_ACTION.getValue("buttonText")); oppGraveButton.setText((String) computerGraveyardAction.getValue("buttonText"));
oppGraveButton.setMargin(new Insets(0, 0, 0, 0)); oppGraveButton.setMargin(new Insets(0, 0, 0, 0));
oppGraveButton.setHorizontalAlignment(SwingConstants.TRAILING); oppGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) { if (!Singletons.getModel().getPreferences().lafFonts) {
@@ -1200,8 +1201,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
JPanel gravePanel = new JPanel(new BorderLayout()); JPanel gravePanel = new JPanel(new BorderLayout());
gravePanel.add(oppGraveButton, BorderLayout.EAST); gravePanel.add(oppGraveButton, BorderLayout.EAST);
JButton oppRemovedButton = new JButton(COMPUTER_REMOVED_ACTION); JButton oppRemovedButton = new JButton(computerRemovedAction);
oppRemovedButton.setText((String) COMPUTER_REMOVED_ACTION.getValue("buttonText")); oppRemovedButton.setText((String) computerRemovedAction.getValue("buttonText"));
oppRemovedButton.setMargin(new Insets(0, 0, 0, 0)); oppRemovedButton.setMargin(new Insets(0, 0, 0, 0));
// removedButton.setHorizontalAlignment(SwingConstants.TRAILING); // removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) { if (!Singletons.getModel().getPreferences().lafFonts) {
@@ -1290,16 +1291,16 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
// JLabel playerGraveLabel = new JLabel("Grave:", // JLabel playerGraveLabel = new JLabel("Grave:",
// SwingConstants.TRAILING); // SwingConstants.TRAILING);
JButton playerGraveButton = new JButton(HUMAN_GRAVEYARD_ACTION); JButton playerGraveButton = new JButton(humanGraveyardAction);
playerGraveButton.setText((String) HUMAN_GRAVEYARD_ACTION.getValue("buttonText")); playerGraveButton.setText((String) humanGraveyardAction.getValue("buttonText"));
playerGraveButton.setMargin(new Insets(0, 0, 0, 0)); playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING); playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) { if (!Singletons.getModel().getPreferences().lafFonts) {
playerGraveButton.setFont(statFont); playerGraveButton.setFont(statFont);
} }
JButton playerFlashBackButton = new JButton(HUMAN_FLASHBACK_ACTION); JButton playerFlashBackButton = new JButton(humanFlashbackAction);
playerFlashBackButton.setText((String) HUMAN_FLASHBACK_ACTION.getValue("buttonText")); playerFlashBackButton.setText((String) humanFlashbackAction.getValue("buttonText"));
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0)); playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING); playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) { if (!Singletons.getModel().getPreferences().lafFonts) {
@@ -1312,8 +1313,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
JPanel playerFBPanel = new JPanel(new BorderLayout()); JPanel playerFBPanel = new JPanel(new BorderLayout());
playerFBPanel.add(playerFlashBackButton, BorderLayout.EAST); playerFBPanel.add(playerFlashBackButton, BorderLayout.EAST);
JButton playerRemovedButton = new JButton(HUMAN_REMOVED_ACTION); JButton playerRemovedButton = new JButton(humanRemovedACtion);
playerRemovedButton.setText((String) HUMAN_REMOVED_ACTION.getValue("buttonText")); playerRemovedButton.setText((String) humanRemovedACtion.getValue("buttonText"));
playerRemovedButton.setMargin(new Insets(0, 0, 0, 0)); playerRemovedButton.setMargin(new Insets(0, 0, 0, 0));
// removedButton.setHorizontalAlignment(SwingConstants.TRAILING); // removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) { if (!Singletons.getModel().getPreferences().lafFonts) {
@@ -1510,42 +1511,42 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
} }
/** Constant <code>playsoundCheckboxForMenu</code>. */ /** Constant <code>playsoundCheckboxForMenu</code>. */
public static JCheckBoxMenuItem playsoundCheckboxForMenu = new JCheckBoxMenuItem("Play Sound", false); private static JCheckBoxMenuItem playsoundCheckboxForMenu = new JCheckBoxMenuItem("Play Sound", false);
// Phases // Phases
/** Constant <code>cbAIUpkeep</code>. */ /** Constant <code>cbAIUpkeep</code>. */
public static JCheckBoxMenuItem cbAIUpkeep = new JCheckBoxMenuItem("Upkeep", true); private static JCheckBoxMenuItem cbAIUpkeep = new JCheckBoxMenuItem("Upkeep", true);
/** Constant <code>cbAIDraw</code>. */ /** Constant <code>cbAIDraw</code>. */
public static JCheckBoxMenuItem cbAIDraw = new JCheckBoxMenuItem("Draw", true); private static JCheckBoxMenuItem cbAIDraw = new JCheckBoxMenuItem("Draw", true);
/** Constant <code>cbAIEndOfTurn</code>. */ /** Constant <code>cbAIEndOfTurn</code>. */
public static JCheckBoxMenuItem cbAIEndOfTurn = new JCheckBoxMenuItem("End of Turn", true); private static JCheckBoxMenuItem cbAIEndOfTurn = new JCheckBoxMenuItem("End of Turn", true);
/** Constant <code>cbAIBeginCombat</code>. */ /** Constant <code>cbAIBeginCombat</code>. */
public static JCheckBoxMenuItem cbAIBeginCombat = new JCheckBoxMenuItem("Begin Combat", true); private static JCheckBoxMenuItem cbAIBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
/** Constant <code>cbAIEndCombat</code>. */ /** Constant <code>cbAIEndCombat</code>. */
public static JCheckBoxMenuItem cbAIEndCombat = new JCheckBoxMenuItem("End Combat", true); private static JCheckBoxMenuItem cbAIEndCombat = new JCheckBoxMenuItem("End Combat", true);
/** Constant <code>cbHumanUpkeep</code>. */ /** Constant <code>cbHumanUpkeep</code>. */
public static JCheckBoxMenuItem cbHumanUpkeep = new JCheckBoxMenuItem("Upkeep", true); private static JCheckBoxMenuItem cbHumanUpkeep = new JCheckBoxMenuItem("Upkeep", true);
/** Constant <code>cbHumanDraw</code>. */ /** Constant <code>cbHumanDraw</code>. */
public static JCheckBoxMenuItem cbHumanDraw = new JCheckBoxMenuItem("Draw", true); private static JCheckBoxMenuItem cbHumanDraw = new JCheckBoxMenuItem("Draw", true);
/** Constant <code>cbHumanEndOfTurn</code>. */ /** Constant <code>cbHumanEndOfTurn</code>. */
public static JCheckBoxMenuItem cbHumanEndOfTurn = new JCheckBoxMenuItem("End of Turn", true); private static JCheckBoxMenuItem cbHumanEndOfTurn = new JCheckBoxMenuItem("End of Turn", true);
/** Constant <code>cbHumanBeginCombat</code>. */ /** Constant <code>cbHumanBeginCombat</code>. */
public static JCheckBoxMenuItem cbHumanBeginCombat = new JCheckBoxMenuItem("Begin Combat", true); private static JCheckBoxMenuItem cbHumanBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
/** Constant <code>cbHumanEndCombat</code>. */ /** Constant <code>cbHumanEndCombat</code>. */
public static JCheckBoxMenuItem cbHumanEndCombat = new JCheckBoxMenuItem("End Combat", true); private static JCheckBoxMenuItem cbHumanEndCombat = new JCheckBoxMenuItem("End Combat", true);
// ********** End of Phase stuff in Display ****************** // ********** End of Phase stuff in Display ******************
// ****** Developer Mode ******* // ****** Developer Mode *******
/** Constant <code>canLoseByDecking</code>. */ /** Constant <code>canLoseByDecking</code>. */
public static JCheckBoxMenuItem canLoseByDecking = new JCheckBoxMenuItem("Lose by Decking", true); private static JCheckBoxMenuItem canLoseByDecking = new JCheckBoxMenuItem("Lose by Decking", true);
// ***************************** // *****************************

File diff suppressed because it is too large Load Diff

View File

@@ -46,7 +46,7 @@ public class Gui_DownloadPictures_LQ extends GuiDownloader {
String base = ForgeProps.getFile(IMAGE_BASE).getPath(); String base = ForgeProps.getFile(IMAGE_BASE).getPath();
for (Card c : AllZone.getCardFactory()) { for (Card c : AllZone.getCardFactory()) {
if(c.getName().equals("Gatstaf Shepherd")) { if (c.getName().equals("Gatstaf Shepherd")) {
System.out.println("Heyo!"); System.out.println("Heyo!");
} }
cList.addAll(createDLObjects(c, base)); cList.addAll(createDLObjects(c, base));
@@ -89,14 +89,14 @@ public class Gui_DownloadPictures_LQ extends GuiDownloader {
ArrayList<DownloadObject> ret = new ArrayList<DownloadObject>(); ArrayList<DownloadObject> ret = new ArrayList<DownloadObject>();
String url = c.getSVar("Picture"); String url = c.getSVar("Picture");
String[] URLs = url.split("\\\\"); String[] urls = url.split("\\\\");
String iName = GuiDisplayUtil.cleanString(c.getImageName()); String iName = GuiDisplayUtil.cleanString(c.getImageName());
ret.add(new DownloadObject(iName + ".jpg", URLs[0], base)); ret.add(new DownloadObject(iName + ".jpg", urls[0], base));
if (URLs.length > 1) { if (urls.length > 1) {
for (int j = 1; j < URLs.length; j++) { for (int j = 1; j < urls.length; j++) {
ret.add(new DownloadObject(iName + j + ".jpg", URLs[j], base)); ret.add(new DownloadObject(iName + j + ".jpg", urls[j], base));
} }
} }

View File

@@ -49,25 +49,24 @@ public class Gui_DownloadSetPictures_LQ extends GuiDownloader {
ArrayList<DownloadObject> cList = new ArrayList<DownloadObject>(); ArrayList<DownloadObject> cList = new ArrayList<DownloadObject>();
File base = ForgeProps.getFile(IMAGE_BASE); File base = ForgeProps.getFile(IMAGE_BASE);
String URLBase = "http://cardforge.org/fpics/"; String urlBase = "http://cardforge.org/fpics/";
for (CardPrinted c : CardDb.instance().getAllCards()) { for (CardPrinted c : CardDb.instance().getAllCards()) {
String SC3 = c.getSet(); String setCode3 = c.getSet();
if (StringUtils.isBlank(SC3) || "???".equals(SC3)) if (StringUtils.isBlank(setCode3) || "???".equals(setCode3)) {
{
continue; // we don't want cards from unknown sets continue; // we don't want cards from unknown sets
} }
CardSet thisSet = SetUtils.getSetByCode(SC3); CardSet thisSet = SetUtils.getSetByCode(setCode3);
String SC2 = thisSet.getCode2(); String setCode2 = thisSet.getCode2();
String imgFN = CardUtil.buildFilename(c); String imgFN = CardUtil.buildFilename(c);
boolean foundSetImage = imgFN.contains(SC3) || imgFN.contains(SC2); boolean foundSetImage = imgFN.contains(setCode3) || imgFN.contains(setCode2);
if (!foundSetImage) { if (!foundSetImage) {
int artsCnt = c.getCard().getSetInfo(SC3).getCopiesCount(); int artsCnt = c.getCard().getSetInfo(setCode3).getCopiesCount();
String fn = CardUtil.buildIdealFilename(c.getName(), c.getArtIndex(), artsCnt); String fn = CardUtil.buildIdealFilename(c.getName(), c.getArtIndex(), artsCnt);
cList.add(new DownloadObject(fn, URLBase + SC2 + "/" + Base64Coder.encodeString(fn, true), base cList.add(new DownloadObject(fn, urlBase + setCode2 + "/" + Base64Coder.encodeString(fn, true), base
.getPath() + File.separator + SC3)); .getPath() + File.separator + setCode3));
} }
} }

View File

@@ -1,9 +1,5 @@
package forge; package forge;
import static java.lang.Integer.parseInt;
import static javax.swing.JOptionPane.DEFAULT_OPTION;
import static javax.swing.JOptionPane.PLAIN_MESSAGE;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@@ -41,6 +37,7 @@ import com.esotericsoftware.minlog.Log;
import forge.error.ErrorViewer; import forge.error.ErrorViewer;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
import forge.properties.NewConstants; import forge.properties.NewConstants;
import forge.properties.NewConstants.LANG.Gui_DownloadPictures;
//import java.io.BufferedReader; //import java.io.BufferedReader;
//import java.io.FileReader; //import java.io.FileReader;
@@ -55,29 +52,29 @@ import forge.properties.NewConstants;
* @author Forge * @author Forge
* @version $Id$ * @version $Id$
*/ */
public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRangeModel implements Runnable, NewConstants, public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRangeModel implements Runnable,
NewConstants.LANG.Gui_DownloadPictures { NewConstants, NewConstants.LANG.Gui_DownloadPictures {
/** Constant <code>serialVersionUID=-7890794857949935256L</code>. */ /** Constant <code>serialVersionUID=-7890794857949935256L</code>. */
private static final long serialVersionUID = -7890794857949935256L; private static final long serialVersionUID = -7890794857949935256L;
/** Constant <code>types</code>. */ /** Constant <code>types</code>. */
public static final Proxy.Type[] types = Proxy.Type.values(); public static final Proxy.Type[] TYPES = Proxy.Type.values();
// proxy // proxy
private int type; private int type;
private JTextField addr, port; private final JTextField addr, port;
// progress // progress
private mCard[] cards; private final MCard[] cards;
private int card; private int card;
private boolean cancel; private boolean cancel;
private JProgressBar bar; private final JProgressBar bar;
private JOptionPane dlg; private final JOptionPane dlg;
private JButton close; private final JButton close;
private long[] times = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; private final long[] times = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
private int tptr = 0; private int tptr = 0;
private long lTime = System.currentTimeMillis(); private long lTime = System.currentTimeMillis();
@@ -92,23 +89,23 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
int aTime = 0; int aTime = 0;
int nz = 10; int nz = 10;
if (tptr > 9) { if (this.tptr > 9) {
tptr = 0; this.tptr = 0;
} }
times[tptr] = System.currentTimeMillis() - lTime; this.times[this.tptr] = System.currentTimeMillis() - this.lTime;
lTime = System.currentTimeMillis(); this.lTime = System.currentTimeMillis();
int tTime = 0; int tTime = 0;
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
tTime += times[i]; tTime += this.times[i];
if (times[i] == 0) { if (this.times[i] == 0) {
nz--; nz--;
} }
} }
aTime = tTime / nz; aTime = tTime / nz;
tptr++; this.tptr++;
return aTime; return aTime;
} }
@@ -120,23 +117,24 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
* *
* @param c * @param c
* an array of * an array of
* {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.mCard} objects. * {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.MCard} objects.
*/ */
private Gui_MigrateLocalMWSSetPictures_HQ(final mCard[] c) { private Gui_MigrateLocalMWSSetPictures_HQ(final MCard[] c) {
this.cards = c; this.cards = c;
addr = new JTextField(ForgeProps.getLocalized(PROXY_ADDRESS)); this.addr = new JTextField(ForgeProps.getLocalized(Gui_DownloadPictures.PROXY_ADDRESS));
port = new JTextField(ForgeProps.getLocalized(PROXY_PORT)); this.port = new JTextField(ForgeProps.getLocalized(Gui_DownloadPictures.PROXY_PORT));
bar = new JProgressBar(this); this.bar = new JProgressBar(this);
JPanel p0 = new JPanel(); final JPanel p0 = new JPanel();
p0.setLayout(new BoxLayout(p0, BoxLayout.Y_AXIS)); p0.setLayout(new BoxLayout(p0, BoxLayout.Y_AXIS));
// Proxy Choice // Proxy Choice
ButtonGroup bg = new ButtonGroup(); final ButtonGroup bg = new ButtonGroup();
String[] labels = { ForgeProps.getLocalized(NO_PROXY), ForgeProps.getLocalized(HTTP_PROXY), final String[] labels = { ForgeProps.getLocalized(Gui_DownloadPictures.NO_PROXY),
ForgeProps.getLocalized(SOCKS_PROXY) }; ForgeProps.getLocalized(Gui_DownloadPictures.HTTP_PROXY),
for (int i = 0; i < types.length; i++) { ForgeProps.getLocalized(Gui_DownloadPictures.SOCKS_PROXY) };
JRadioButton rb = new JRadioButton(labels[i]); for (int i = 0; i < Gui_MigrateLocalMWSSetPictures_HQ.TYPES.length; i++) {
final JRadioButton rb = new JRadioButton(labels[i]);
rb.addChangeListener(new ProxyHandler(i)); rb.addChangeListener(new ProxyHandler(i));
bg.add(rb); bg.add(rb);
p0.add(rb); p0.add(rb);
@@ -146,8 +144,8 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
} }
// Proxy config // Proxy config
p0.add(addr); p0.add(this.addr);
p0.add(port); p0.add(this.port);
// JTextField[] tfs = {addr, port}; // JTextField[] tfs = {addr, port};
// String[] labels = {"Address", "Port"}; // String[] labels = {"Address", "Port"};
// for(int i = 0; i < labels.length; i++) { // for(int i = 0; i < labels.length; i++) {
@@ -161,6 +159,7 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
final JButton b = new JButton("Start copying"); final JButton b = new JButton("Start copying");
b.addActionListener(new ActionListener() { b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) { public void actionPerformed(final ActionEvent e) {
new Thread(Gui_MigrateLocalMWSSetPictures_HQ.this).start(); new Thread(Gui_MigrateLocalMWSSetPictures_HQ.this).start();
b.setEnabled(false); b.setEnabled(false);
@@ -171,19 +170,21 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
p0.add(Box.createVerticalStrut(5)); p0.add(Box.createVerticalStrut(5));
// Progress // Progress
p0.add(bar); p0.add(this.bar);
bar.setStringPainted(true); this.bar.setStringPainted(true);
// bar.setString(ForgeProps.getLocalized(BAR_BEFORE_START)); // bar.setString(ForgeProps.getLocalized(BAR_BEFORE_START));
bar.setString(card + "/" + cards.length); this.bar.setString(this.card + "/" + this.cards.length);
// bar.setString(String.format(ForgeProps.getLocalized(card == // bar.setString(String.format(ForgeProps.getLocalized(card ==
// cards.length? BAR_CLOSE:BAR_WAIT), this.card, cards.length)); // cards.length? BAR_CLOSE:BAR_WAIT), this.card, cards.length));
Dimension d = bar.getPreferredSize(); final Dimension d = this.bar.getPreferredSize();
d.width = 300; d.width = 300;
bar.setPreferredSize(d); this.bar.setPreferredSize(d);
// JOptionPane // JOptionPane
Object[] options = { b, close = new JButton(ForgeProps.getLocalized(BUTTONS.CANCEL)) }; this.close = new JButton(ForgeProps.getLocalized(BUTTONS.CANCEL));
dlg = new JOptionPane(p0, DEFAULT_OPTION, PLAIN_MESSAGE, null, options, options[1]); final Object[] options = { b, this.close };
this.dlg = new JOptionPane(p0, JOptionPane.DEFAULT_OPTION,
JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@@ -195,7 +196,7 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public int getValue() { public int getValue() {
return card; return this.card;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@@ -207,7 +208,7 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public int getMaximum() { public int getMaximum() {
return cards == null ? 0 : cards.length; return this.cards == null ? 0 : this.cards.length;
} }
/** /**
@@ -221,24 +222,40 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
private void update(final int card) { private void update(final int card) {
this.card = card; this.card = card;
/**
*
* TODO: Write javadoc for this type.
*
*/
final class Worker implements Runnable { final class Worker implements Runnable {
private int card; private final int card;
/**
*
* TODO: Write javadoc for Constructor.
*
* @param card
* int
*/
Worker(final int card) { Worker(final int card) {
this.card = card; this.card = card;
} }
/**
*
*/
@Override
public void run() { public void run() {
fireStateChanged(); Gui_MigrateLocalMWSSetPictures_HQ.this.fireStateChanged();
StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
int a = getAverageTimePerCard(); final int a = Gui_MigrateLocalMWSSetPictures_HQ.this.getAverageTimePerCard();
if (card != cards.length) { if (this.card != Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length) {
sb.append(card + "/" + cards.length + " - "); sb.append(this.card + "/" + Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length + " - ");
long t2Go = (cards.length - card) * a; long t2Go = (Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length - this.card) * a;
boolean secOnly = true; boolean secOnly = true;
if (t2Go > 3600000) { if (t2Go > 3600000) {
@@ -257,14 +274,15 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
sb.append(String.format("0:%02d remaining.", t2Go / 1000)); sb.append(String.format("0:%02d remaining.", t2Go / 1000));
} }
} else { } else {
sb.append(String.format(ForgeProps.getLocalized(BAR_CLOSE), card, cards.length)); sb.append(String.format(ForgeProps.getLocalized(Gui_DownloadPictures.BAR_CLOSE), this.card,
Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length));
} }
bar.setString(sb.toString()); Gui_MigrateLocalMWSSetPictures_HQ.this.bar.setString(sb.toString());
// bar.setString(String.format(ForgeProps.getLocalized(card == // bar.setString(String.format(ForgeProps.getLocalized(card ==
// cards.length? BAR_CLOSE:BAR_WAIT), card, // cards.length? BAR_CLOSE:BAR_WAIT), card,
// cards.length)); // cards.length));
System.out.println(card + "/" + cards.length + " - " + a); System.out.println(this.card + "/" + Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length + " - " + a);
} }
} }
EventQueue.invokeLater(new Worker(card)); EventQueue.invokeLater(new Worker(card));
@@ -280,8 +298,9 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
* @return a {@link javax.swing.JDialog} object. * @return a {@link javax.swing.JDialog} object.
*/ */
public JDialog getDlg(final JFrame frame) { public JDialog getDlg(final JFrame frame) {
final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(TITLE)); final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(Gui_DownloadPictures.TITLE));
close.addActionListener(new ActionListener() { this.close.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) { public void actionPerformed(final ActionEvent e) {
dlg.setVisible(false); dlg.setVisible(false);
} }
@@ -306,23 +325,25 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
* run. * run.
* </p> * </p>
*/ */
@Override
public void run() { public void run() {
BufferedInputStream in; BufferedInputStream in;
BufferedOutputStream out; BufferedOutputStream out;
File base = ForgeProps.getFile(IMAGE_BASE); File base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
// Random r = MyRandom.random; // Random r = MyRandom.random;
Proxy p = null; Proxy p = null;
if (type == 0) { if (this.type == 0) {
p = Proxy.NO_PROXY; p = Proxy.NO_PROXY;
} else { } else {
try { try {
p = new Proxy(types[type], new InetSocketAddress(addr.getText(), parseInt(port.getText()))); p = new Proxy(Gui_MigrateLocalMWSSetPictures_HQ.TYPES[this.type], new InetSocketAddress(
} catch (Exception ex) { this.addr.getText(), Integer.parseInt(this.port.getText())));
ErrorViewer } catch (final Exception ex) {
.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), addr.getText(), port.getText()); ErrorViewer.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), this.addr.getText(),
this.port.getText());
// throw new // throw new
// RuntimeException("Gui_DownloadPictures : error 1 - " +ex); // RuntimeException("Gui_DownloadPictures : error 1 - " +ex);
return; return;
@@ -330,29 +351,29 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
} }
if (p != null) { if (p != null) {
byte[] buf = new byte[1024]; final byte[] buf = new byte[1024];
int len; int len;
System.out.println("basedir: " + base); System.out.println("basedir: " + base);
for (update(0); card < cards.length && !cancel; update(card + 1)) { for (this.update(0); (this.card < this.cards.length) && !this.cancel; this.update(this.card + 1)) {
try { try {
String url = cards[card].url; final String url = this.cards[this.card].url;
String cName; String cName;
if (cards[card].name.substring(0, 3).equals("[T]")) { if (this.cards[this.card].name.substring(0, 3).equals("[T]")) {
base = ForgeProps.getFile(IMAGE_TOKEN); base = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
cName = cards[card].name.substring(3, cards[card].name.length()); cName = this.cards[this.card].name.substring(3, this.cards[this.card].name.length());
} else { } else {
base = ForgeProps.getFile(IMAGE_BASE); base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
cName = cards[card].name; cName = this.cards[this.card].name;
} }
File f = new File(base, cName); final File f = new File(base, cName);
// test for folder existence // test for folder existence
File test = new File(base, cards[card].folder); final File test = new File(base, this.cards[this.card].folder);
if (!test.exists()) { if (!test.exists()) {
// create folder // create folder
if (!test.mkdir()) { if (!test.mkdir()) {
System.out.println("Can't create folder" + cards[card].folder); System.out.println("Can't create folder" + this.cards[this.card].folder);
} }
} }
@@ -360,15 +381,15 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
// in = new BufferedInputStream(new // in = new BufferedInputStream(new
// URL(url).openConnection(p).getInputStream()); // URL(url).openConnection(p).getInputStream());
File src = new File(url); final File src = new File(url);
InputStream in2 = new FileInputStream(src); final InputStream in2 = new FileInputStream(src);
in = new BufferedInputStream(in2); in = new BufferedInputStream(in2);
out = new BufferedOutputStream(new FileOutputStream(f)); out = new BufferedOutputStream(new FileOutputStream(f));
while ((len = in.read(buf)) != -1) { while ((len = in.read(buf)) != -1) {
// user cancelled // user cancelled
if (cancel) { if (this.cancel) {
in.close(); in.close();
out.flush(); out.flush();
out.close(); out.close();
@@ -377,23 +398,23 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
f.delete(); f.delete();
return; return;
}// if - cancel } // if - cancel
out.write(buf, 0, len); out.write(buf, 0, len);
}// while - read and write file } // while - read and write file
in.close(); in.close();
out.flush(); out.flush();
out.close(); out.close();
} catch (MalformedURLException mURLe) { } catch (final MalformedURLException mURLe) {
// System.out.println("Error - possibly missing URL for: "+cards[card].name); // System.out.println("Error - possibly missing URL for: "+cards[card].name);
// Log.error("LQ Pictures", // Log.error("LQ Pictures",
// "Malformed URL for: "+cards[card].name, mURLe); // "Malformed URL for: "+cards[card].name, mURLe);
} }
} catch (FileNotFoundException fnfe) { } catch (final FileNotFoundException fnfe) {
System.out.println("Error - the HQ picture for " + cards[card].name + " could not be found. [" System.out.println("Error - the HQ picture for " + this.cards[this.card].name
+ cards[card].url + "] - " + fnfe.getMessage()); + " could not be found. [" + this.cards[this.card].url + "] - " + fnfe.getMessage());
} catch (Exception ex) { } catch (final Exception ex) {
Log.error("HQ Pictures", "Error copying pictures", ex); Log.error("HQ Pictures", "Error copying pictures", ex);
} }
@@ -401,13 +422,13 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
try { try {
Thread.sleep(1); Thread.sleep(1);
} catch (InterruptedException e) { } catch (final InterruptedException e) {
Log.error("HQ Set Pictures", "Sleep Error", e); Log.error("HQ Set Pictures", "Sleep Error", e);
} }
}// for } // for
} }
close.setText(ForgeProps.getLocalized(BUTTONS.CLOSE)); this.close.setText(ForgeProps.getLocalized(BUTTONS.CLOSE));
}// run } // run
/** /**
* <p> * <p>
@@ -418,49 +439,49 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
* a {@link javax.swing.JFrame} object. * a {@link javax.swing.JFrame} object.
*/ */
public static void startDownload(final JFrame frame) { public static void startDownload(final JFrame frame) {
final mCard[] card = getNeededCards(); final MCard[] card = Gui_MigrateLocalMWSSetPictures_HQ.getNeededCards();
if (card.length == 0) { if (card.length == 0) {
JOptionPane.showMessageDialog(frame, ForgeProps.getLocalized(NO_MORE)); JOptionPane.showMessageDialog(frame, ForgeProps.getLocalized(Gui_DownloadPictures.NO_MORE));
return; return;
} }
Gui_MigrateLocalMWSSetPictures_HQ download = new Gui_MigrateLocalMWSSetPictures_HQ(card); final Gui_MigrateLocalMWSSetPictures_HQ download = new Gui_MigrateLocalMWSSetPictures_HQ(card);
JDialog dlg = download.getDlg(frame); final JDialog dlg = download.getDlg(frame);
dlg.setVisible(true); dlg.setVisible(true);
dlg.dispose(); dlg.dispose();
download.setCancel(true); download.setCancel(true);
}// startDownload() } // startDownload()
/** /**
* <p> * <p>
* getNeededCards. * getNeededCards.
* </p> * </p>
* *
* @return an array of {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.mCard} * @return an array of {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.MCard}
* objects. * objects.
*/ */
private static mCard[] getNeededCards() { private static MCard[] getNeededCards() {
// read all card names and urls // read all card names and urls
// mCard[] cardPlay = readFile(CARD_PICTURES); // mCard[] cardPlay = readFile(CARD_PICTURES);
// mCard[] cardTokenLQ = readFile(CARD_PICTURES_TOKEN_LQ); // mCard[] cardTokenLQ = readFile(CARD_PICTURES_TOKEN_LQ);
ArrayList<mCard> CList = new ArrayList<mCard>(); final ArrayList<MCard> cList = new ArrayList<MCard>();
// File imgBase = ForgeProps.getFile(NewConstants.IMAGE_BASE); // File imgBase = ForgeProps.getFile(NewConstants.IMAGE_BASE);
String URLBase = "C:\\MTGForge\\HQPICS\\"; final String urlBase = "C:\\MTGForge\\HQPICS\\";
String imgFN = ""; String imgFN = "";
for (Card c : AllZone.getCardFactory()) { for (final Card c : AllZone.getCardFactory()) {
// String url = c.getSVar("Picture"); // String url = c.getSVar("Picture");
// String[] URLs = url.split("\\\\"); // String[] URLs = url.split("\\\\");
ArrayList<SetInfo> cSetInfo = c.getSets(); final ArrayList<SetInfo> cSetInfo = c.getSets();
if (cSetInfo.size() > 0) { if (cSetInfo.size() > 0) {
for (int j = 0; j < cSetInfo.size(); j++) { for (int j = 0; j < cSetInfo.size(); j++) {
c.setCurSetCode(cSetInfo.get(j).Code); c.setCurSetCode(cSetInfo.get(j).Code);
String SC3 = c.getCurSetCode(); final String setCode3 = c.getCurSetCode();
String SC2 = SetUtils.getCode2ByCode(c.getCurSetCode()); final String setCode2 = SetUtils.getCode2ByCode(c.getCurSetCode());
int n = 0; int n = 0;
if (cSetInfo.get(j).PicCount > 0) { if (cSetInfo.get(j).PicCount > 0) {
@@ -471,13 +492,13 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
imgFN = CardUtil.buildFilename(c); imgFN = CardUtil.buildFilename(c);
if (imgFN.equals("none") || (!imgFN.contains(SC3) && !imgFN.contains(SC2))) { if (imgFN.equals("none") || (!imgFN.contains(setCode3) && !imgFN.contains(setCode2))) {
imgFN += k + ".jpg"; imgFN += k + ".jpg";
String fn = GuiDisplayUtil.cleanStringMWS(c.getName()) + k + ".full.jpg"; final String fn = GuiDisplayUtil.cleanStringMWS(c.getName()) + k + ".full.jpg";
// CList.add(new mCard(SC3 + "/" + fn, URLBase + // CList.add(new mCard(SC3 + "/" + fn, URLBase +
// SC2 + "/" + Base64Coder.encodeString(fn, // SC2 + "/" + Base64Coder.encodeString(fn,
// true), SC3)); // true), SC3));
CList.add(new mCard(SC3 + "\\" + imgFN, URLBase + SC2 + "\\" + fn, SC3)); cList.add(new MCard(setCode3 + "\\" + imgFN, urlBase + setCode2 + "\\" + fn, setCode3));
} }
} }
} else { } else {
@@ -485,17 +506,18 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
imgFN = CardUtil.buildFilename(c); imgFN = CardUtil.buildFilename(c);
if (imgFN.equals("none") || (!imgFN.contains(SC3) && !imgFN.contains(SC2))) { if (imgFN.equals("none") || (!imgFN.contains(setCode3) && !imgFN.contains(setCode2))) {
// imgFN += ".jpg"; // imgFN += ".jpg";
String newFileName = GuiDisplayUtil.cleanString(c.getName()) + ".jpg"; final String newFileName = GuiDisplayUtil.cleanString(c.getName()) + ".jpg";
String fn = GuiDisplayUtil.cleanStringMWS(c.getName()) + ".full.jpg"; final String fn = GuiDisplayUtil.cleanStringMWS(c.getName()) + ".full.jpg";
// fn = fn.replace(" ", "%20%"); // fn = fn.replace(" ", "%20%");
// CList.add(new mCard(SC3 + "/" + fn, URLBase + SC2 // CList.add(new mCard(SC3 + "/" + fn, URLBase + SC2
// + "/" + Base64Coder.encodeString(fn, true), // + "/" + Base64Coder.encodeString(fn, true),
// SC3)); // SC3));
CList.add(new mCard(SC3 + "\\" + newFileName, URLBase + SC2 + "\\" + fn, SC3)); cList.add(new MCard(setCode3 + "\\"
+ newFileName, urlBase + setCode2 + "\\" + fn, setCode3));
} }
@@ -517,14 +539,14 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
* if(!file.exists()) CList.add(cardTokenLQ[i]); } * if(!file.exists()) CList.add(cardTokenLQ[i]); }
*/ */
// return all card names and urls that are needed // return all card names and urls that are needed
mCard[] out = new mCard[CList.size()]; final MCard[] out = new MCard[cList.size()];
CList.toArray(out); cList.toArray(out);
for (int i = 0; i < out.length; i++) { for (final MCard element : out) {
System.out.println(out[i].name + " " + out[i].url); System.out.println(element.name + " " + element.url);
} }
return out; return out;
}// getNeededCards() } // getNeededCards()
/* /*
* private static mCard[] readFile(String ABC) { try { FileReader zrc = new * private static mCard[] readFile(String ABC) { try { FileReader zrc = new
@@ -547,30 +569,31 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
*/ */
private class ProxyHandler implements ChangeListener { private class ProxyHandler implements ChangeListener {
private int type; private final int type;
public ProxyHandler(final int type) { public ProxyHandler(final int type) {
this.type = type; this.type = type;
} }
@Override
public void stateChanged(final ChangeEvent e) { public void stateChanged(final ChangeEvent e) {
if (((AbstractButton) e.getSource()).isSelected()) { if (((AbstractButton) e.getSource()).isSelected()) {
Gui_MigrateLocalMWSSetPictures_HQ.this.type = type; Gui_MigrateLocalMWSSetPictures_HQ.this.type = this.type;
addr.setEnabled(type != 0); Gui_MigrateLocalMWSSetPictures_HQ.this.addr.setEnabled(this.type != 0);
port.setEnabled(type != 0); Gui_MigrateLocalMWSSetPictures_HQ.this.port.setEnabled(this.type != 0);
} }
} }
} }
private static class mCard { private static class MCard {
public final String name; private final String name;
public final String url; private final String url;
public final String folder; private final String folder;
mCard(final String cardName, final String cardURL, final String cardFolder) { MCard(final String cardName, final String cardURL, final String cardFolder) {
name = cardName; this.name = cardName;
url = cardURL; this.url = cardURL;
folder = cardFolder; this.folder = cardFolder;
} }
}// mCard } // mCard
} }

View File

@@ -23,11 +23,11 @@ import forge.gui.game.CardPanel;
*/ */
/** /**
* very hacky * very hacky.
* *
*/ */
class Gui_MultipleBlockers4 extends JFrame { class Gui_MultipleBlockers4 extends JFrame {
/** Constant <code>serialVersionUID=7622818310877381045L</code> */ /** Constant <code>serialVersionUID=7622818310877381045L</code>. */
private static final long serialVersionUID = 7622818310877381045L; private static final long serialVersionUID = 7622818310877381045L;
private int assignDamage; private int assignDamage;
@@ -57,10 +57,11 @@ class Gui_MultipleBlockers4 extends JFrame {
* @param display * @param display
* a {@link forge.CardContainer} object. * a {@link forge.CardContainer} object.
*/ */
Gui_MultipleBlockers4(final Card attacker, final CardList creatureList, final int damage, final CardContainer display) { Gui_MultipleBlockers4(final Card attacker, final CardList creatureList,
final int damage, final CardContainer display) {
this(); this();
assignDamage = damage; assignDamage = damage;
updateDamageLabel();// update user message about assigning damage updateDamageLabel(); // update user message about assigning damage
guiDisplay = display; guiDisplay = display;
att = attacker; att = attacker;
blockers = creatureList; blockers = creatureList;
@@ -120,13 +121,13 @@ class Gui_MultipleBlockers4 extends JFrame {
creaturePanel.addMouseListener(new java.awt.event.MouseAdapter() { creaturePanel.addMouseListener(new java.awt.event.MouseAdapter() {
@Override @Override
public void mousePressed(final MouseEvent e) { public void mousePressed(final MouseEvent e) {
creaturePanel_mousePressed(e); creaturePanelMousePressed(e);
} }
}); });
creaturePanel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { creaturePanel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
@Override @Override
public void mouseMoved(final MouseEvent e) { public void mouseMoved(final MouseEvent e) {
creaturePanel_mouseMoved(e); creaturePanelMouseMoved(e);
} }
}); });
mainPanel.add(jPanel3, null); mainPanel.add(jPanel3, null);
@@ -144,7 +145,7 @@ class Gui_MultipleBlockers4 extends JFrame {
* @param e * @param e
* a {@link java.awt.event.ActionEvent} object. * a {@link java.awt.event.ActionEvent} object.
*/ */
void okButton_actionPerformed(final ActionEvent e) { void okButtonActionPerformed(final ActionEvent e) {
dispose(); dispose();
} }
@@ -156,7 +157,7 @@ class Gui_MultipleBlockers4 extends JFrame {
* @param e * @param e
* a {@link java.awt.event.MouseEvent} object. * a {@link java.awt.event.MouseEvent} object.
*/ */
void creaturePanel_mousePressed(final MouseEvent e) { void creaturePanelMousePressed(final MouseEvent e) {
Object o = creaturePanel.getComponentAt(e.getPoint()); Object o = creaturePanel.getComponentAt(e.getPoint());
if (o instanceof CardPanel) { if (o instanceof CardPanel) {
@@ -198,7 +199,7 @@ class Gui_MultipleBlockers4 extends JFrame {
} }
// reduce damage, show new user message, exit if necessary // reduce damage, show new user message, exit if necessary
}// creaturePanel_mousePressed() } // creaturePanel_mousePressed()
/** /**
* <p> * <p>
@@ -217,7 +218,7 @@ class Gui_MultipleBlockers4 extends JFrame {
* @param e * @param e
* a {@link java.awt.event.MouseEvent} object. * a {@link java.awt.event.MouseEvent} object.
*/ */
void creaturePanel_mouseMoved(final MouseEvent e) { void creaturePanelMouseMoved(final MouseEvent e) {
Object o = creaturePanel.getComponentAt(e.getPoint()); Object o = creaturePanel.getComponentAt(e.getPoint());
if (o instanceof CardPanel) { if (o instanceof CardPanel) {
CardContainer cardPanel = (CardContainer) o; CardContainer cardPanel = (CardContainer) o;

View File

@@ -344,10 +344,10 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
// getCards(false) to get Phased Out cards // getCards(false) to get Phased Out cards
Card[] c; Card[] c;
if (!filter) { if (!filter) {
c = new Card[cards.size()]; c = new Card[getCardList().size()];
cards.toArray(c); getCardList().toArray(c);
} else { } else {
Iterator<Card> itr = cards.iterator(); Iterator<Card> itr = getCardList().iterator();
ArrayList<Card> list = new ArrayList<Card>(); ArrayList<Card> list = new ArrayList<Card>();
while (itr.hasNext()) { while (itr.hasNext()) {
Card crd = itr.next(); Card crd = itr.next();