mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
refactor
This commit is contained in:
@@ -6426,7 +6426,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("AttachedBy")) {
|
||||
if (!equippedBy.contains(source) && !enchantedBy.contains(source)) {
|
||||
if (!equippedBy.contains(source) && !getEnchantedBy().contains(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("Attached")) {
|
||||
@@ -6434,11 +6434,11 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("EnchantedBy")) {
|
||||
if (!enchantedBy.contains(source)) {
|
||||
if (!getEnchantedBy().contains(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("NotEnchantedBy")) {
|
||||
if (enchantedBy.contains(source)) {
|
||||
if (getEnchantedBy().contains(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("Enchanted")) {
|
||||
|
||||
@@ -25,68 +25,68 @@ import forge.properties.NewConstants;
|
||||
*/
|
||||
public class CopyFiles extends SwingWorker<Void, Integer> implements NewConstants {
|
||||
|
||||
private List<File> FileList;
|
||||
private final List<File> fileList;
|
||||
|
||||
/** The j lb. */
|
||||
JLabel jLb;
|
||||
private final JLabel jLabel;
|
||||
|
||||
/** The j b. */
|
||||
JProgressBar jB;
|
||||
private JProgressBar jProgressBar;
|
||||
|
||||
/** The j check. */
|
||||
JCheckBox jCheck;
|
||||
private final JCheckBox jCheck;
|
||||
|
||||
/** The j source. */
|
||||
JButton jSource;
|
||||
private final JButton jSource;
|
||||
|
||||
/** The count. */
|
||||
int count;
|
||||
private int count;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for CopyFiles.
|
||||
* </p>
|
||||
*
|
||||
* @param FileList
|
||||
* @param fileList
|
||||
* a {@link java.util.List} object.
|
||||
* @param jLabelTotalFiles
|
||||
* a {@link javax.swing.JLabel} object.
|
||||
* @param Jbar
|
||||
* @param jProgressBar
|
||||
* a {@link javax.swing.JProgressBar} object.
|
||||
* @param jCheckBox
|
||||
* a {@link javax.swing.JCheckBox} object.
|
||||
* @param jButtonSource
|
||||
* a {@link javax.swing.JButton} object.
|
||||
*/
|
||||
public CopyFiles(final List<File> FileList, final JLabel jLabelTotalFiles, final JProgressBar Jbar, final JCheckBox jCheckBox,
|
||||
final JButton jButtonSource) {
|
||||
this.FileList = FileList;
|
||||
jLb = jLabelTotalFiles;
|
||||
jB = Jbar;
|
||||
jCheck = jCheckBox;
|
||||
jSource = jButtonSource;
|
||||
public CopyFiles(final List<File> fileList, final JLabel jLabelTotalFiles, JProgressBar jProgressBar,
|
||||
final JCheckBox jCheckBox, final JButton jButtonSource) {
|
||||
this.fileList = fileList;
|
||||
this.jLabel = jLabelTotalFiles;
|
||||
this.jProgressBar = jProgressBar;
|
||||
this.jCheck = jCheckBox;
|
||||
this.jSource = jButtonSource;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected final Void doInBackground() {
|
||||
for (int i = 0; i < this.FileList.size(); i++) {
|
||||
publish();
|
||||
for (int i = 0; i < this.fileList.size(); i++) {
|
||||
this.publish();
|
||||
String cName, name, source;
|
||||
name = this.FileList.get(i).getName();
|
||||
source = this.FileList.get(i).getAbsolutePath();
|
||||
name = this.fileList.get(i).getName();
|
||||
source = this.fileList.get(i).getAbsolutePath();
|
||||
cName = name.substring(0, name.length() - 8);
|
||||
cName = GuiDisplayUtil.cleanString(cName) + ".jpg";
|
||||
File sourceFile = new File(source);
|
||||
File base = ForgeProps.getFile(IMAGE_BASE);
|
||||
File reciever = new File(base, cName);
|
||||
final File sourceFile = new File(source);
|
||||
final File base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
|
||||
final File reciever = new File(base, cName);
|
||||
reciever.delete();
|
||||
|
||||
try {
|
||||
reciever.createNewFile();
|
||||
FileOutputStream fos = new FileOutputStream(reciever);
|
||||
FileInputStream fis = new FileInputStream(sourceFile);
|
||||
byte[] buff = new byte[32 * 1024];
|
||||
final FileOutputStream fos = new FileOutputStream(reciever);
|
||||
final FileInputStream fis = new FileInputStream(sourceFile);
|
||||
final byte[] buff = new byte[32 * 1024];
|
||||
int length;
|
||||
while (fis.available() > 0) {
|
||||
length = fis.read(buff);
|
||||
@@ -97,10 +97,10 @@ public class CopyFiles extends SwingWorker<Void, Integer> implements NewConstant
|
||||
fos.flush();
|
||||
fis.close();
|
||||
fos.close();
|
||||
count = i * 100 / this.FileList.size() + 1;
|
||||
setProgress(count);
|
||||
this.count = ((i * 100) / this.fileList.size()) + 1;
|
||||
this.setProgress(this.count);
|
||||
|
||||
} catch (IOException e1) {
|
||||
} catch (final IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -112,10 +112,10 @@ public class CopyFiles extends SwingWorker<Void, Integer> implements NewConstant
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected final void done() {
|
||||
jLb.setText("All files were copied successfully.");
|
||||
jB.setIndeterminate(false);
|
||||
jCheck.setEnabled(true);
|
||||
jSource.setEnabled(true);
|
||||
this.jLabel.setText("All files were copied successfully.");
|
||||
this.jProgressBar.setIndeterminate(false);
|
||||
this.jCheck.setEnabled(true);
|
||||
this.jSource.setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ public enum Counters {
|
||||
* </p>
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,7 +337,7 @@ public enum Counters {
|
||||
* @return a {@link forge.Counters} object.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
private static final long serialVersionUID = -5687652485777639176L;
|
||||
|
||||
/** The cards. */
|
||||
protected List<Card> cards = new ArrayList<Card>();
|
||||
private List<Card> cardList = new ArrayList<Card>();
|
||||
private final Constant.Zone zoneName;
|
||||
private final Player player;
|
||||
private boolean update = true;
|
||||
|
||||
private CardList cardsAddedThisTurn = new CardList();
|
||||
private ArrayList<Constant.Zone> cardsAddedThisTurnSource = new ArrayList<Constant.Zone>();
|
||||
private final CardList cardsAddedThisTurn = new CardList();
|
||||
private final ArrayList<Constant.Zone> cardsAddedThisTurnSource = new ArrayList<Constant.Zone>();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -39,8 +39,8 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* a {@link forge.Player} object.
|
||||
*/
|
||||
public DefaultPlayerZone(final Constant.Zone zone, final Player inPlayer) {
|
||||
zoneName = zone;
|
||||
player = inPlayer;
|
||||
this.zoneName = zone;
|
||||
this.player = inPlayer;
|
||||
}
|
||||
|
||||
// ************ BEGIN - these methods fire updateObservers() *************
|
||||
@@ -51,30 +51,32 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* @param o
|
||||
* a {@link java.lang.Object} object.
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
// don't want to log those.
|
||||
if (!c.isImmutable()) {
|
||||
cardsAddedThisTurn.add(c);
|
||||
this.cardsAddedThisTurn.add(c);
|
||||
if (AllZone.getZoneOf(c) != null) {
|
||||
cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType());
|
||||
this.cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType());
|
||||
} else {
|
||||
cardsAddedThisTurnSource.add(null);
|
||||
this.cardsAddedThisTurnSource.add(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (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.")) {
|
||||
PlayerZone lib = c.getOwner().getZone(Constant.Zone.Library);
|
||||
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.")) {
|
||||
final PlayerZone lib = c.getOwner().getZone(Constant.Zone.Library);
|
||||
lib.add(c);
|
||||
c.getOwner().shuffle();
|
||||
return;
|
||||
}
|
||||
|
||||
if (c.isUnearthed() && (is(Zone.Graveyard) || is(Zone.Hand) || is(Zone.Library))) {
|
||||
PlayerZone removed = c.getOwner().getZone(Constant.Zone.Exile);
|
||||
if (c.isUnearthed() && (this.is(Zone.Graveyard) || this.is(Zone.Hand) || this.is(Zone.Library))) {
|
||||
final PlayerZone removed = c.getOwner().getZone(Constant.Zone.Exile);
|
||||
removed.add(c);
|
||||
c.setUnearthed(false);
|
||||
return;
|
||||
@@ -84,8 +86,8 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
|
||||
c.setTurnInZone(AllZone.getPhase().getTurn());
|
||||
|
||||
cards.add((Card) c);
|
||||
update();
|
||||
this.getCardList().add(c);
|
||||
this.update();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,6 +98,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* @param object
|
||||
* an Object
|
||||
*/
|
||||
@Override
|
||||
public final void update(final Observable ob, final Object object) {
|
||||
this.update();
|
||||
}
|
||||
@@ -108,21 +111,22 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* @param index
|
||||
* a int.
|
||||
*/
|
||||
@Override
|
||||
public final void add(final Card c, final int index) {
|
||||
// Immutable cards are usually emblems,effects and the mana pool and we
|
||||
// don't want to log those.
|
||||
if (!c.isImmutable()) {
|
||||
cardsAddedThisTurn.add(c);
|
||||
this.cardsAddedThisTurn.add(c);
|
||||
if (AllZone.getZoneOf(c) != null) {
|
||||
cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType());
|
||||
this.cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType());
|
||||
} else {
|
||||
cardsAddedThisTurnSource.add(null);
|
||||
this.cardsAddedThisTurnSource.add(null);
|
||||
}
|
||||
}
|
||||
|
||||
cards.add(index, c);
|
||||
this.getCardList().add(index, c);
|
||||
c.setTurnInZone(AllZone.getPhase().getTurn());
|
||||
update();
|
||||
this.update();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -132,10 +136,12 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
*/
|
||||
/**
|
||||
* @return boolean
|
||||
* @param c Card
|
||||
* @param c
|
||||
* Card
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
* an Object
|
||||
*/
|
||||
@Override
|
||||
public void remove(final Object c) {
|
||||
cards.remove((Card) c);
|
||||
update();
|
||||
this.getCardList().remove(c);
|
||||
this.update();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,9 +164,10 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* @param c
|
||||
* an array of {@link forge.Card} objects.
|
||||
*/
|
||||
@Override
|
||||
public final void setCards(final Card[] c) {
|
||||
cards = new ArrayList<Card>(Arrays.asList(c));
|
||||
update();
|
||||
this.setCardList(new ArrayList<Card>(Arrays.asList(c)));
|
||||
this.update();
|
||||
}
|
||||
|
||||
// removes all cards
|
||||
@@ -168,11 +176,12 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* reset.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public final void reset() {
|
||||
cardsAddedThisTurn.clear();
|
||||
cardsAddedThisTurnSource.clear();
|
||||
cards.clear();
|
||||
update();
|
||||
this.cardsAddedThisTurn.clear();
|
||||
this.cardsAddedThisTurnSource.clear();
|
||||
this.getCardList().clear();
|
||||
this.update();
|
||||
}
|
||||
|
||||
// ************ END - these methods fire updateObservers() *************
|
||||
@@ -184,8 +193,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a boolean
|
||||
*/
|
||||
@Override
|
||||
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)
|
||||
*/
|
||||
@Override
|
||||
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.
|
||||
* @return a boolean
|
||||
*/
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
@Override
|
||||
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.
|
||||
* @return a int
|
||||
*/
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
public Card[] getCards(final boolean filter) {
|
||||
// Non-Battlefield PlayerZones don't care about the filter
|
||||
Card[] c = new Card[cards.size()];
|
||||
cards.toArray(c);
|
||||
final Card[] c = new Card[this.getCardList().size()];
|
||||
this.getCardList().toArray(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -283,10 +300,11 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
*
|
||||
* @see forge.IPlayerZone#getCards(int)
|
||||
*/
|
||||
@Override
|
||||
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++) {
|
||||
c[i] = cards.get(i);
|
||||
c[i] = this.getCardList().get(i);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -298,7 +316,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
*/
|
||||
@Override
|
||||
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>
|
||||
*/
|
||||
public final void update() {
|
||||
if (update) {
|
||||
updateObservers();
|
||||
if (this.update) {
|
||||
this.updateObservers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,8 +336,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* @param b
|
||||
* a boolean.
|
||||
*/
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
public final CardList getCardsAddedThisTurn(final Constant.Zone origin) {
|
||||
System.out.print("Request cards put into " + getZoneType() + " from " + origin + ".Amount: ");
|
||||
CardList ret = new CardList();
|
||||
for (int i = 0; i < cardsAddedThisTurn.size(); i++) {
|
||||
if (cardsAddedThisTurnSource.get(i) == origin || origin == null /*
|
||||
System.out.print("Request cards put into " + this.getZoneType() + " from " + origin + ".Amount: ");
|
||||
final CardList ret = new CardList();
|
||||
for (int i = 0; i < this.cardsAddedThisTurn.size(); i++) {
|
||||
if ((this.cardsAddedThisTurnSource.get(i) == origin) || (origin == null /*
|
||||
* former
|
||||
* :
|
||||
* equals
|
||||
* (
|
||||
* 'Any')
|
||||
*/)
|
||||
{
|
||||
ret.add(cardsAddedThisTurn.get(i));
|
||||
*/)) {
|
||||
ret.add(this.cardsAddedThisTurn.get(i));
|
||||
}
|
||||
}
|
||||
System.out.println(ret.size());
|
||||
@@ -377,9 +397,24 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* resetCardsAddedThisTurn.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public final void resetCardsAddedThisTurn() {
|
||||
cardsAddedThisTurn.clear();
|
||||
cardsAddedThisTurnSource.clear();
|
||||
this.cardsAddedThisTurn.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.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -148,7 +148,8 @@ public class EndOfTurn implements java.io.Serializable {
|
||||
AllZone.getStack().addSimultaneousStackEntry(sac);
|
||||
|
||||
} 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.")) {
|
||||
@@ -162,7 +163,8 @@ public class EndOfTurn implements java.io.Serializable {
|
||||
// new CardList(vale), vale.getController(),
|
||||
// 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.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -56,7 +56,8 @@ public class ExternalPanel extends JPanel {
|
||||
*/
|
||||
public ExternalPanel(final Component child, final String side) {
|
||||
super(new BorderLayout());
|
||||
add(this.child = child);
|
||||
this.child = child;
|
||||
add(this.child);
|
||||
JButton b = new JButton();
|
||||
b.setPreferredSize(new Dimension(6, 6));
|
||||
b.setToolTipText("Click to move component into an extra Window");
|
||||
|
||||
@@ -36,7 +36,7 @@ import forge.properties.NewConstants;
|
||||
* @version $Id$
|
||||
*/
|
||||
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 JPanel jContentPane = null;
|
||||
private JLabel jLabel = null;
|
||||
@@ -48,12 +48,12 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
|
||||
private JButton jButtonStart = null;
|
||||
|
||||
/** The frame. */
|
||||
GUI_ImportPicture frame;
|
||||
private GUI_ImportPicture frame;
|
||||
private JLabel jLabelHDDFree = null;
|
||||
private JLabel jLabelNeedSpace = null;
|
||||
|
||||
/** The j label total files. */
|
||||
public JLabel jLabelTotalFiles = null;
|
||||
private JLabel jLabelTotalFiles = null;
|
||||
private List<File> listFiles;
|
||||
private ArrayList<File> fileCopyList;
|
||||
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() {
|
||||
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
|
||||
*/
|
||||
@@ -146,7 +146,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonSource
|
||||
* This method initializes jButtonSource.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
@@ -251,7 +251,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jCheckBox
|
||||
* This method initializes 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
|
||||
*/
|
||||
@@ -370,7 +370,7 @@ public class GUI_ImportPicture extends JDialog implements NewConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jProgressBar
|
||||
* This method initializes jProgressBar.
|
||||
*
|
||||
* @return javax.swing.JProgressBar
|
||||
*/
|
||||
|
||||
@@ -183,8 +183,7 @@ public class GameAction {
|
||||
// UNLESS we're dealing with Skullbriar, the Walking Grave
|
||||
if (!zone.is(Constant.Zone.Battlefield)
|
||||
&& !(c.getName().equals("Skullbriar, the Walking Grave") && !zone.is(Constant.Zone.Hand) && !zone
|
||||
.is(Constant.Zone.Library)))
|
||||
{
|
||||
.is(Constant.Zone.Library))) {
|
||||
copied.clearCounters();
|
||||
}
|
||||
|
||||
@@ -211,8 +210,7 @@ public class GameAction {
|
||||
// String prevName = prev != null ? prev.getZoneName() : "";
|
||||
|
||||
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);
|
||||
c.removeExtrinsicKeyword("If CARDNAME would leave the battlefield, "
|
||||
+ "exile it instead of putting it anywhere else.");
|
||||
@@ -351,8 +349,7 @@ public class GameAction {
|
||||
|
||||
for (Card card : opponentsBoard) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public final class GameActionUtil {
|
||||
} else {
|
||||
activateRipple = true;
|
||||
}
|
||||
if (activateRipple == true) {
|
||||
if (activateRipple) {
|
||||
final Ability ability = new Ability(c, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
@@ -744,7 +744,8 @@ public final class GameActionUtil {
|
||||
&& a.get(i)
|
||||
.toString()
|
||||
.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 String kw = a.get(i).toString();
|
||||
Ability ability2 = new Ability(c, "0") {
|
||||
@@ -1165,7 +1166,8 @@ public final class GameActionUtil {
|
||||
"Creature", "Elemental" }, 2, 2, new String[] { "Trample" });
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1202,7 +1204,8 @@ public final class GameActionUtil {
|
||||
emblem = emblem.filter(new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
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 final long serialVersionUID = -3213793711304934358L;
|
||||
|
||||
CardList previouslyPumped = new CardList();
|
||||
ArrayList<Integer> previouslyPumpedValue = new ArrayList<Integer>();
|
||||
private CardList previouslyPumped = new CardList();
|
||||
private ArrayList<Integer> previouslyPumpedValue = new ArrayList<Integer>();
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
@@ -1629,7 +1632,7 @@ public final class GameActionUtil {
|
||||
};
|
||||
|
||||
/** stores the Command. */
|
||||
public static Command Umbra_Stalker = new Command() {
|
||||
private static Command umbraStalker = new Command() {
|
||||
private static final long serialVersionUID = -3500747003228938898L;
|
||||
|
||||
public void execute() {
|
||||
@@ -1646,7 +1649,7 @@ public final class GameActionUtil {
|
||||
};
|
||||
|
||||
/** 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;
|
||||
|
||||
public void execute() {
|
||||
@@ -1667,7 +1670,7 @@ public final class GameActionUtil {
|
||||
}; // Ajani Avatar
|
||||
|
||||
/** 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;
|
||||
|
||||
public void execute() {
|
||||
@@ -1686,7 +1689,7 @@ public final class GameActionUtil {
|
||||
}; // Old Man of the Sea
|
||||
|
||||
/** Constant <code>Homarid</code>. */
|
||||
public static Command Homarid = new Command() {
|
||||
private static Command homarid = new Command() {
|
||||
private static final long serialVersionUID = 7156319758035295773L;
|
||||
|
||||
public void execute() {
|
||||
@@ -1702,7 +1705,7 @@ public final class GameActionUtil {
|
||||
};
|
||||
|
||||
/** Constant <code>Liu_Bei</code>. */
|
||||
public static Command Liu_Bei = new Command() {
|
||||
private static Command liuBei = new Command() {
|
||||
|
||||
private static final long serialVersionUID = 4235093010715735727L;
|
||||
|
||||
@@ -1748,7 +1751,8 @@ public final class GameActionUtil {
|
||||
list = list.filter(new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
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
|
||||
|
||||
/** Constant <code>Tarmogoyf</code>. */
|
||||
public static Command Tarmogoyf = new Command() {
|
||||
private static Command tarmogoyf = new Command() {
|
||||
private static final long serialVersionUID = 5895665460018262987L;
|
||||
|
||||
public void execute() {
|
||||
@@ -1868,7 +1872,8 @@ public final class GameActionUtil {
|
||||
|
||||
for (int i = 0; i < creature.size(); 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.addSemiPermanentDefenseBoost(2);
|
||||
|
||||
@@ -1914,22 +1919,22 @@ public final class GameActionUtil {
|
||||
static {
|
||||
// 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("Coat_of_Arms", Coat_of_Arms);
|
||||
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("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("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.
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public abstract class GameEntity extends MyObservable {
|
||||
private int preventNextDamage = 0;
|
||||
|
||||
/** The enchanted by. */
|
||||
protected ArrayList<Card> enchantedBy = new ArrayList<Card>();
|
||||
private ArrayList<Card> enchantedBy = new ArrayList<Card>();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -288,7 +288,7 @@ public abstract class GameEntity extends MyObservable {
|
||||
/**
|
||||
* Checks if is valid.
|
||||
*
|
||||
* @param Restrictions
|
||||
* @param restrictions
|
||||
* the restrictions
|
||||
* @param sourceController
|
||||
* the source controller
|
||||
@@ -296,12 +296,13 @@ public abstract class GameEntity extends MyObservable {
|
||||
* the source
|
||||
* @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++) {
|
||||
if (isValid(Restrictions[i], sourceController, source))
|
||||
for (int i = 0; i < restrictions.length; i++) {
|
||||
if (isValid(restrictions[i], sourceController, source)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
} // isValid
|
||||
@@ -309,7 +310,7 @@ public abstract class GameEntity extends MyObservable {
|
||||
/**
|
||||
* Checks if is valid.
|
||||
*
|
||||
* @param Restriction
|
||||
* @param restriction
|
||||
* the restriction
|
||||
* @param sourceController
|
||||
* the source controller
|
||||
@@ -317,14 +318,14 @@ public abstract class GameEntity extends MyObservable {
|
||||
* the source
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for property.
|
||||
*
|
||||
* @param Property
|
||||
* @param property
|
||||
* the property
|
||||
* @param sourceController
|
||||
* the source controller
|
||||
@@ -332,7 +333,7 @@ public abstract class GameEntity extends MyObservable {
|
||||
* the source
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,22 +110,22 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
private GuiInput inputControl;
|
||||
|
||||
/** The stat font. */
|
||||
Font statFont = new Font("Dialog", Font.PLAIN, 12);
|
||||
private Font statFont = new Font("Dialog", Font.PLAIN, 12);
|
||||
|
||||
/** 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);
|
||||
|
||||
/** 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 HUMAN_REMOVED_ACTION;
|
||||
private Action HUMAN_FLASHBACK_ACTION;
|
||||
private Action COMPUTER_GRAVEYARD_ACTION;
|
||||
private Action COMPUTER_REMOVED_ACTION;
|
||||
private Action CONCEDE_ACTION;
|
||||
private Action HUMAN_DECKLIST_ACTION;
|
||||
private Action humanGraveyardAction;
|
||||
private Action humanRemovedACtion;
|
||||
private Action humanFlashbackAction;
|
||||
private Action computerGraveyardAction;
|
||||
private Action computerRemovedAction;
|
||||
private Action concedeAction;
|
||||
private Action humanDecklistAction;
|
||||
// public Card cCardHQ;
|
||||
|
||||
// private CardList multiBlockers = new CardList();
|
||||
@@ -177,9 +177,9 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
* </p>
|
||||
*/
|
||||
private void setupActions() {
|
||||
HUMAN_GRAVEYARD_ACTION = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_GRAVEYARD);
|
||||
HUMAN_REMOVED_ACTION = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Exile), HUMAN_REMOVED);
|
||||
HUMAN_FLASHBACK_ACTION = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_FLASHBACK) {
|
||||
humanGraveyardAction = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_GRAVEYARD);
|
||||
humanRemovedACtion = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Exile), HUMAN_REMOVED);
|
||||
humanFlashbackAction = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_FLASHBACK) {
|
||||
|
||||
private static final long serialVersionUID = 8120331222693706164L;
|
||||
|
||||
@@ -194,12 +194,12 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
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_REMOVED_ACTION = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Exile), COMPUTER_REMOVED);
|
||||
CONCEDE_ACTION = new ConcedeAction();
|
||||
computerRemovedAction = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Exile), COMPUTER_REMOVED);
|
||||
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();
|
||||
|
||||
// Game Menu Creation
|
||||
Object[] obj = { HUMAN_DECKLIST_ACTION, HUMAN_GRAVEYARD_ACTION, HUMAN_REMOVED_ACTION, HUMAN_FLASHBACK_ACTION,
|
||||
COMPUTER_GRAVEYARD_ACTION, COMPUTER_REMOVED_ACTION, new JSeparator(), playsoundCheckboxForMenu,
|
||||
new JSeparator(), ErrorViewer.ALL_THREADS_ACTION, CONCEDE_ACTION };
|
||||
Object[] obj = { humanDecklistAction, humanGraveyardAction, humanRemovedACtion, humanFlashbackAction,
|
||||
computerGraveyardAction, computerRemovedAction, new JSeparator(), playsoundCheckboxForMenu,
|
||||
new JSeparator(), ErrorViewer.ALL_THREADS_ACTION, concedeAction };
|
||||
|
||||
JMenu gameMenu = new JMenu(ForgeProps.getLocalized(MENU_BAR.MENU.TITLE));
|
||||
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 viewAILibrary = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Library),
|
||||
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) {
|
||||
private static final long serialVersionUID = 7171104690016706405L;
|
||||
|
||||
@@ -1189,8 +1190,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
oppHandLabel.setFont(statFont);
|
||||
}
|
||||
|
||||
JButton oppGraveButton = new JButton(COMPUTER_GRAVEYARD_ACTION);
|
||||
oppGraveButton.setText((String) COMPUTER_GRAVEYARD_ACTION.getValue("buttonText"));
|
||||
JButton oppGraveButton = new JButton(computerGraveyardAction);
|
||||
oppGraveButton.setText((String) computerGraveyardAction.getValue("buttonText"));
|
||||
oppGraveButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
oppGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
if (!Singletons.getModel().getPreferences().lafFonts) {
|
||||
@@ -1200,8 +1201,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
JPanel gravePanel = new JPanel(new BorderLayout());
|
||||
gravePanel.add(oppGraveButton, BorderLayout.EAST);
|
||||
|
||||
JButton oppRemovedButton = new JButton(COMPUTER_REMOVED_ACTION);
|
||||
oppRemovedButton.setText((String) COMPUTER_REMOVED_ACTION.getValue("buttonText"));
|
||||
JButton oppRemovedButton = new JButton(computerRemovedAction);
|
||||
oppRemovedButton.setText((String) computerRemovedAction.getValue("buttonText"));
|
||||
oppRemovedButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
// removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
if (!Singletons.getModel().getPreferences().lafFonts) {
|
||||
@@ -1290,16 +1291,16 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
|
||||
// JLabel playerGraveLabel = new JLabel("Grave:",
|
||||
// SwingConstants.TRAILING);
|
||||
JButton playerGraveButton = new JButton(HUMAN_GRAVEYARD_ACTION);
|
||||
playerGraveButton.setText((String) HUMAN_GRAVEYARD_ACTION.getValue("buttonText"));
|
||||
JButton playerGraveButton = new JButton(humanGraveyardAction);
|
||||
playerGraveButton.setText((String) humanGraveyardAction.getValue("buttonText"));
|
||||
playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
if (!Singletons.getModel().getPreferences().lafFonts) {
|
||||
playerGraveButton.setFont(statFont);
|
||||
}
|
||||
|
||||
JButton playerFlashBackButton = new JButton(HUMAN_FLASHBACK_ACTION);
|
||||
playerFlashBackButton.setText((String) HUMAN_FLASHBACK_ACTION.getValue("buttonText"));
|
||||
JButton playerFlashBackButton = new JButton(humanFlashbackAction);
|
||||
playerFlashBackButton.setText((String) humanFlashbackAction.getValue("buttonText"));
|
||||
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
if (!Singletons.getModel().getPreferences().lafFonts) {
|
||||
@@ -1312,8 +1313,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
JPanel playerFBPanel = new JPanel(new BorderLayout());
|
||||
playerFBPanel.add(playerFlashBackButton, BorderLayout.EAST);
|
||||
|
||||
JButton playerRemovedButton = new JButton(HUMAN_REMOVED_ACTION);
|
||||
playerRemovedButton.setText((String) HUMAN_REMOVED_ACTION.getValue("buttonText"));
|
||||
JButton playerRemovedButton = new JButton(humanRemovedACtion);
|
||||
playerRemovedButton.setText((String) humanRemovedACtion.getValue("buttonText"));
|
||||
playerRemovedButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
// removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
if (!Singletons.getModel().getPreferences().lafFonts) {
|
||||
@@ -1510,42 +1511,42 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
}
|
||||
|
||||
/** Constant <code>playsoundCheckboxForMenu</code>. */
|
||||
public static JCheckBoxMenuItem playsoundCheckboxForMenu = new JCheckBoxMenuItem("Play Sound", false);
|
||||
private static JCheckBoxMenuItem playsoundCheckboxForMenu = new JCheckBoxMenuItem("Play Sound", false);
|
||||
|
||||
// Phases
|
||||
/** Constant <code>cbAIUpkeep</code>. */
|
||||
public static JCheckBoxMenuItem cbAIUpkeep = new JCheckBoxMenuItem("Upkeep", true);
|
||||
private static JCheckBoxMenuItem cbAIUpkeep = new JCheckBoxMenuItem("Upkeep", true);
|
||||
|
||||
/** Constant <code>cbAIDraw</code>. */
|
||||
public static JCheckBoxMenuItem cbAIDraw = new JCheckBoxMenuItem("Draw", true);
|
||||
private static JCheckBoxMenuItem cbAIDraw = new JCheckBoxMenuItem("Draw", true);
|
||||
|
||||
/** 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>. */
|
||||
public static JCheckBoxMenuItem cbAIBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
|
||||
private static JCheckBoxMenuItem cbAIBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
|
||||
|
||||
/** 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>. */
|
||||
public static JCheckBoxMenuItem cbHumanUpkeep = new JCheckBoxMenuItem("Upkeep", true);
|
||||
private static JCheckBoxMenuItem cbHumanUpkeep = new JCheckBoxMenuItem("Upkeep", true);
|
||||
/** Constant <code>cbHumanDraw</code>. */
|
||||
public static JCheckBoxMenuItem cbHumanDraw = new JCheckBoxMenuItem("Draw", true);
|
||||
private static JCheckBoxMenuItem cbHumanDraw = new JCheckBoxMenuItem("Draw", true);
|
||||
/** 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>. */
|
||||
public static JCheckBoxMenuItem cbHumanBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
|
||||
private static JCheckBoxMenuItem cbHumanBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
|
||||
|
||||
/** 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 ******************
|
||||
|
||||
// ****** Developer Mode *******
|
||||
|
||||
/** 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
@@ -89,14 +89,14 @@ public class Gui_DownloadPictures_LQ extends GuiDownloader {
|
||||
ArrayList<DownloadObject> ret = new ArrayList<DownloadObject>();
|
||||
|
||||
String url = c.getSVar("Picture");
|
||||
String[] URLs = url.split("\\\\");
|
||||
String[] urls = url.split("\\\\");
|
||||
|
||||
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) {
|
||||
for (int j = 1; j < URLs.length; j++) {
|
||||
ret.add(new DownloadObject(iName + j + ".jpg", URLs[j], base));
|
||||
if (urls.length > 1) {
|
||||
for (int j = 1; j < urls.length; j++) {
|
||||
ret.add(new DownloadObject(iName + j + ".jpg", urls[j], base));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,25 +49,24 @@ public class Gui_DownloadSetPictures_LQ extends GuiDownloader {
|
||||
ArrayList<DownloadObject> cList = new ArrayList<DownloadObject>();
|
||||
|
||||
File base = ForgeProps.getFile(IMAGE_BASE);
|
||||
String URLBase = "http://cardforge.org/fpics/";
|
||||
String urlBase = "http://cardforge.org/fpics/";
|
||||
for (CardPrinted c : CardDb.instance().getAllCards()) {
|
||||
String SC3 = c.getSet();
|
||||
if (StringUtils.isBlank(SC3) || "???".equals(SC3))
|
||||
{
|
||||
String setCode3 = c.getSet();
|
||||
if (StringUtils.isBlank(setCode3) || "???".equals(setCode3)) {
|
||||
continue; // we don't want cards from unknown sets
|
||||
}
|
||||
|
||||
CardSet thisSet = SetUtils.getSetByCode(SC3);
|
||||
String SC2 = thisSet.getCode2();
|
||||
CardSet thisSet = SetUtils.getSetByCode(setCode3);
|
||||
String setCode2 = thisSet.getCode2();
|
||||
|
||||
String imgFN = CardUtil.buildFilename(c);
|
||||
boolean foundSetImage = imgFN.contains(SC3) || imgFN.contains(SC2);
|
||||
boolean foundSetImage = imgFN.contains(setCode3) || imgFN.contains(setCode2);
|
||||
|
||||
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);
|
||||
cList.add(new DownloadObject(fn, URLBase + SC2 + "/" + Base64Coder.encodeString(fn, true), base
|
||||
.getPath() + File.separator + SC3));
|
||||
cList.add(new DownloadObject(fn, urlBase + setCode2 + "/" + Base64Coder.encodeString(fn, true), base
|
||||
.getPath() + File.separator + setCode3));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
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.EventQueue;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -41,6 +37,7 @@ import com.esotericsoftware.minlog.Log;
|
||||
import forge.error.ErrorViewer;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.properties.NewConstants.LANG.Gui_DownloadPictures;
|
||||
|
||||
//import java.io.BufferedReader;
|
||||
//import java.io.FileReader;
|
||||
@@ -55,29 +52,29 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRangeModel implements Runnable, NewConstants,
|
||||
NewConstants.LANG.Gui_DownloadPictures {
|
||||
public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRangeModel implements Runnable,
|
||||
NewConstants, NewConstants.LANG.Gui_DownloadPictures {
|
||||
|
||||
/** Constant <code>serialVersionUID=-7890794857949935256L</code>. */
|
||||
private static final long serialVersionUID = -7890794857949935256L;
|
||||
|
||||
/** Constant <code>types</code>. */
|
||||
public static final Proxy.Type[] types = Proxy.Type.values();
|
||||
public static final Proxy.Type[] TYPES = Proxy.Type.values();
|
||||
|
||||
// proxy
|
||||
private int type;
|
||||
private JTextField addr, port;
|
||||
private final JTextField addr, port;
|
||||
|
||||
// progress
|
||||
private mCard[] cards;
|
||||
private final MCard[] cards;
|
||||
private int card;
|
||||
private boolean cancel;
|
||||
private JProgressBar bar;
|
||||
private final JProgressBar bar;
|
||||
|
||||
private JOptionPane dlg;
|
||||
private JButton close;
|
||||
private final JOptionPane dlg;
|
||||
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 long lTime = System.currentTimeMillis();
|
||||
|
||||
@@ -92,23 +89,23 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
int aTime = 0;
|
||||
int nz = 10;
|
||||
|
||||
if (tptr > 9) {
|
||||
tptr = 0;
|
||||
if (this.tptr > 9) {
|
||||
this.tptr = 0;
|
||||
}
|
||||
|
||||
times[tptr] = System.currentTimeMillis() - lTime;
|
||||
lTime = System.currentTimeMillis();
|
||||
this.times[this.tptr] = System.currentTimeMillis() - this.lTime;
|
||||
this.lTime = System.currentTimeMillis();
|
||||
|
||||
int tTime = 0;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
tTime += times[i];
|
||||
if (times[i] == 0) {
|
||||
tTime += this.times[i];
|
||||
if (this.times[i] == 0) {
|
||||
nz--;
|
||||
}
|
||||
}
|
||||
aTime = tTime / nz;
|
||||
|
||||
tptr++;
|
||||
this.tptr++;
|
||||
|
||||
return aTime;
|
||||
}
|
||||
@@ -120,23 +117,24 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
*
|
||||
* @param c
|
||||
* 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;
|
||||
addr = new JTextField(ForgeProps.getLocalized(PROXY_ADDRESS));
|
||||
port = new JTextField(ForgeProps.getLocalized(PROXY_PORT));
|
||||
bar = new JProgressBar(this);
|
||||
this.addr = new JTextField(ForgeProps.getLocalized(Gui_DownloadPictures.PROXY_ADDRESS));
|
||||
this.port = new JTextField(ForgeProps.getLocalized(Gui_DownloadPictures.PROXY_PORT));
|
||||
this.bar = new JProgressBar(this);
|
||||
|
||||
JPanel p0 = new JPanel();
|
||||
final JPanel p0 = new JPanel();
|
||||
p0.setLayout(new BoxLayout(p0, BoxLayout.Y_AXIS));
|
||||
|
||||
// Proxy Choice
|
||||
ButtonGroup bg = new ButtonGroup();
|
||||
String[] labels = { ForgeProps.getLocalized(NO_PROXY), ForgeProps.getLocalized(HTTP_PROXY),
|
||||
ForgeProps.getLocalized(SOCKS_PROXY) };
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
JRadioButton rb = new JRadioButton(labels[i]);
|
||||
final ButtonGroup bg = new ButtonGroup();
|
||||
final String[] labels = { ForgeProps.getLocalized(Gui_DownloadPictures.NO_PROXY),
|
||||
ForgeProps.getLocalized(Gui_DownloadPictures.HTTP_PROXY),
|
||||
ForgeProps.getLocalized(Gui_DownloadPictures.SOCKS_PROXY) };
|
||||
for (int i = 0; i < Gui_MigrateLocalMWSSetPictures_HQ.TYPES.length; i++) {
|
||||
final JRadioButton rb = new JRadioButton(labels[i]);
|
||||
rb.addChangeListener(new ProxyHandler(i));
|
||||
bg.add(rb);
|
||||
p0.add(rb);
|
||||
@@ -146,8 +144,8 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
}
|
||||
|
||||
// Proxy config
|
||||
p0.add(addr);
|
||||
p0.add(port);
|
||||
p0.add(this.addr);
|
||||
p0.add(this.port);
|
||||
// JTextField[] tfs = {addr, port};
|
||||
// String[] labels = {"Address", "Port"};
|
||||
// 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");
|
||||
b.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
new Thread(Gui_MigrateLocalMWSSetPictures_HQ.this).start();
|
||||
b.setEnabled(false);
|
||||
@@ -171,19 +170,21 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
p0.add(Box.createVerticalStrut(5));
|
||||
|
||||
// Progress
|
||||
p0.add(bar);
|
||||
bar.setStringPainted(true);
|
||||
p0.add(this.bar);
|
||||
this.bar.setStringPainted(true);
|
||||
// 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 ==
|
||||
// cards.length? BAR_CLOSE:BAR_WAIT), this.card, cards.length));
|
||||
Dimension d = bar.getPreferredSize();
|
||||
final Dimension d = this.bar.getPreferredSize();
|
||||
d.width = 300;
|
||||
bar.setPreferredSize(d);
|
||||
this.bar.setPreferredSize(d);
|
||||
|
||||
// JOptionPane
|
||||
Object[] options = { b, close = new JButton(ForgeProps.getLocalized(BUTTONS.CANCEL)) };
|
||||
dlg = new JOptionPane(p0, DEFAULT_OPTION, PLAIN_MESSAGE, null, options, options[1]);
|
||||
this.close = new JButton(ForgeProps.getLocalized(BUTTONS.CANCEL));
|
||||
final Object[] options = { b, this.close };
|
||||
this.dlg = new JOptionPane(p0, JOptionPane.DEFAULT_OPTION,
|
||||
JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -195,7 +196,7 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getValue() {
|
||||
return card;
|
||||
return this.card;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -207,7 +208,7 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
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) {
|
||||
this.card = card;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
final class Worker implements Runnable {
|
||||
private int card;
|
||||
private final int card;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO: Write javadoc for Constructor.
|
||||
*
|
||||
* @param card
|
||||
* int
|
||||
*/
|
||||
Worker(final int card) {
|
||||
this.card = card;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
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) {
|
||||
sb.append(card + "/" + cards.length + " - ");
|
||||
if (this.card != Gui_MigrateLocalMWSSetPictures_HQ.this.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;
|
||||
if (t2Go > 3600000) {
|
||||
@@ -257,14 +274,15 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
sb.append(String.format("0:%02d remaining.", t2Go / 1000));
|
||||
}
|
||||
} 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 ==
|
||||
// cards.length? BAR_CLOSE:BAR_WAIT), card,
|
||||
// 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));
|
||||
@@ -280,8 +298,9 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
* @return a {@link javax.swing.JDialog} object.
|
||||
*/
|
||||
public JDialog getDlg(final JFrame frame) {
|
||||
final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(TITLE));
|
||||
close.addActionListener(new ActionListener() {
|
||||
final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(Gui_DownloadPictures.TITLE));
|
||||
this.close.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
dlg.setVisible(false);
|
||||
}
|
||||
@@ -306,23 +325,25 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
* run.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
BufferedInputStream in;
|
||||
BufferedOutputStream out;
|
||||
|
||||
File base = ForgeProps.getFile(IMAGE_BASE);
|
||||
File base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
|
||||
|
||||
// Random r = MyRandom.random;
|
||||
|
||||
Proxy p = null;
|
||||
if (type == 0) {
|
||||
if (this.type == 0) {
|
||||
p = Proxy.NO_PROXY;
|
||||
} else {
|
||||
try {
|
||||
p = new Proxy(types[type], new InetSocketAddress(addr.getText(), parseInt(port.getText())));
|
||||
} catch (Exception ex) {
|
||||
ErrorViewer
|
||||
.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), addr.getText(), port.getText());
|
||||
p = new Proxy(Gui_MigrateLocalMWSSetPictures_HQ.TYPES[this.type], new InetSocketAddress(
|
||||
this.addr.getText(), Integer.parseInt(this.port.getText())));
|
||||
} catch (final Exception ex) {
|
||||
ErrorViewer.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), this.addr.getText(),
|
||||
this.port.getText());
|
||||
// throw new
|
||||
// RuntimeException("Gui_DownloadPictures : error 1 - " +ex);
|
||||
return;
|
||||
@@ -330,29 +351,29 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
}
|
||||
|
||||
if (p != null) {
|
||||
byte[] buf = new byte[1024];
|
||||
final byte[] buf = new byte[1024];
|
||||
int len;
|
||||
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 {
|
||||
String url = cards[card].url;
|
||||
final String url = this.cards[this.card].url;
|
||||
String cName;
|
||||
if (cards[card].name.substring(0, 3).equals("[T]")) {
|
||||
base = ForgeProps.getFile(IMAGE_TOKEN);
|
||||
cName = cards[card].name.substring(3, cards[card].name.length());
|
||||
if (this.cards[this.card].name.substring(0, 3).equals("[T]")) {
|
||||
base = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
|
||||
cName = this.cards[this.card].name.substring(3, this.cards[this.card].name.length());
|
||||
} else {
|
||||
base = ForgeProps.getFile(IMAGE_BASE);
|
||||
cName = cards[card].name;
|
||||
base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
|
||||
cName = this.cards[this.card].name;
|
||||
}
|
||||
|
||||
File f = new File(base, cName);
|
||||
final File f = new File(base, cName);
|
||||
|
||||
// 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()) {
|
||||
// create folder
|
||||
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
|
||||
// URL(url).openConnection(p).getInputStream());
|
||||
|
||||
File src = new File(url);
|
||||
InputStream in2 = new FileInputStream(src);
|
||||
final File src = new File(url);
|
||||
final InputStream in2 = new FileInputStream(src);
|
||||
|
||||
in = new BufferedInputStream(in2);
|
||||
out = new BufferedOutputStream(new FileOutputStream(f));
|
||||
|
||||
while ((len = in.read(buf)) != -1) {
|
||||
// user cancelled
|
||||
if (cancel) {
|
||||
if (this.cancel) {
|
||||
in.close();
|
||||
out.flush();
|
||||
out.close();
|
||||
@@ -385,15 +406,15 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
in.close();
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (MalformedURLException mURLe) {
|
||||
} catch (final MalformedURLException mURLe) {
|
||||
// System.out.println("Error - possibly missing URL for: "+cards[card].name);
|
||||
// Log.error("LQ Pictures",
|
||||
// "Malformed URL for: "+cards[card].name, mURLe);
|
||||
}
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
System.out.println("Error - the HQ picture for " + cards[card].name + " could not be found. ["
|
||||
+ cards[card].url + "] - " + fnfe.getMessage());
|
||||
} catch (Exception ex) {
|
||||
} catch (final FileNotFoundException fnfe) {
|
||||
System.out.println("Error - the HQ picture for " + this.cards[this.card].name
|
||||
+ " could not be found. [" + this.cards[this.card].url + "] - " + fnfe.getMessage());
|
||||
} catch (final Exception ex) {
|
||||
Log.error("HQ Pictures", "Error copying pictures", ex);
|
||||
}
|
||||
|
||||
@@ -401,12 +422,12 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
} catch (final InterruptedException e) {
|
||||
Log.error("HQ Set Pictures", "Sleep Error", e);
|
||||
}
|
||||
} // for
|
||||
}
|
||||
close.setText(ForgeProps.getLocalized(BUTTONS.CLOSE));
|
||||
this.close.setText(ForgeProps.getLocalized(BUTTONS.CLOSE));
|
||||
} // run
|
||||
|
||||
/**
|
||||
@@ -418,15 +439,15 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
* a {@link javax.swing.JFrame} object.
|
||||
*/
|
||||
public static void startDownload(final JFrame frame) {
|
||||
final mCard[] card = getNeededCards();
|
||||
final MCard[] card = Gui_MigrateLocalMWSSetPictures_HQ.getNeededCards();
|
||||
|
||||
if (card.length == 0) {
|
||||
JOptionPane.showMessageDialog(frame, ForgeProps.getLocalized(NO_MORE));
|
||||
JOptionPane.showMessageDialog(frame, ForgeProps.getLocalized(Gui_DownloadPictures.NO_MORE));
|
||||
return;
|
||||
}
|
||||
|
||||
Gui_MigrateLocalMWSSetPictures_HQ download = new Gui_MigrateLocalMWSSetPictures_HQ(card);
|
||||
JDialog dlg = download.getDlg(frame);
|
||||
final Gui_MigrateLocalMWSSetPictures_HQ download = new Gui_MigrateLocalMWSSetPictures_HQ(card);
|
||||
final JDialog dlg = download.getDlg(frame);
|
||||
dlg.setVisible(true);
|
||||
dlg.dispose();
|
||||
download.setCancel(true);
|
||||
@@ -437,30 +458,30 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
* getNeededCards.
|
||||
* </p>
|
||||
*
|
||||
* @return an array of {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.mCard}
|
||||
* @return an array of {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.MCard}
|
||||
* objects.
|
||||
*/
|
||||
private static mCard[] getNeededCards() {
|
||||
private static MCard[] getNeededCards() {
|
||||
// read all card names and urls
|
||||
// mCard[] cardPlay = readFile(CARD_PICTURES);
|
||||
// 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);
|
||||
String URLBase = "C:\\MTGForge\\HQPICS\\";
|
||||
final String urlBase = "C:\\MTGForge\\HQPICS\\";
|
||||
String imgFN = "";
|
||||
|
||||
for (Card c : AllZone.getCardFactory()) {
|
||||
for (final Card c : AllZone.getCardFactory()) {
|
||||
// String url = c.getSVar("Picture");
|
||||
// String[] URLs = url.split("\\\\");
|
||||
|
||||
ArrayList<SetInfo> cSetInfo = c.getSets();
|
||||
final ArrayList<SetInfo> cSetInfo = c.getSets();
|
||||
if (cSetInfo.size() > 0) {
|
||||
for (int j = 0; j < cSetInfo.size(); j++) {
|
||||
c.setCurSetCode(cSetInfo.get(j).Code);
|
||||
String SC3 = c.getCurSetCode();
|
||||
String SC2 = SetUtils.getCode2ByCode(c.getCurSetCode());
|
||||
final String setCode3 = c.getCurSetCode();
|
||||
final String setCode2 = SetUtils.getCode2ByCode(c.getCurSetCode());
|
||||
|
||||
int n = 0;
|
||||
if (cSetInfo.get(j).PicCount > 0) {
|
||||
@@ -471,13 +492,13 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
|
||||
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";
|
||||
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 +
|
||||
// SC2 + "/" + Base64Coder.encodeString(fn,
|
||||
// true), SC3));
|
||||
CList.add(new mCard(SC3 + "\\" + imgFN, URLBase + SC2 + "\\" + fn, SC3));
|
||||
cList.add(new MCard(setCode3 + "\\" + imgFN, urlBase + setCode2 + "\\" + fn, setCode3));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -485,17 +506,18 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
|
||||
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";
|
||||
|
||||
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%");
|
||||
// CList.add(new mCard(SC3 + "/" + fn, URLBase + SC2
|
||||
// + "/" + Base64Coder.encodeString(fn, true),
|
||||
// SC3));
|
||||
CList.add(new mCard(SC3 + "\\" + newFileName, URLBase + SC2 + "\\" + fn, SC3));
|
||||
cList.add(new MCard(setCode3 + "\\"
|
||||
+ newFileName, urlBase + setCode2 + "\\" + fn, setCode3));
|
||||
|
||||
}
|
||||
|
||||
@@ -517,11 +539,11 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
* if(!file.exists()) CList.add(cardTokenLQ[i]); }
|
||||
*/
|
||||
// return all card names and urls that are needed
|
||||
mCard[] out = new mCard[CList.size()];
|
||||
CList.toArray(out);
|
||||
final MCard[] out = new MCard[cList.size()];
|
||||
cList.toArray(out);
|
||||
|
||||
for (int i = 0; i < out.length; i++) {
|
||||
System.out.println(out[i].name + " " + out[i].url);
|
||||
for (final MCard element : out) {
|
||||
System.out.println(element.name + " " + element.url);
|
||||
}
|
||||
return out;
|
||||
} // getNeededCards()
|
||||
@@ -547,30 +569,31 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
|
||||
*/
|
||||
|
||||
private class ProxyHandler implements ChangeListener {
|
||||
private int type;
|
||||
private final int type;
|
||||
|
||||
public ProxyHandler(final int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateChanged(final ChangeEvent e) {
|
||||
if (((AbstractButton) e.getSource()).isSelected()) {
|
||||
Gui_MigrateLocalMWSSetPictures_HQ.this.type = type;
|
||||
addr.setEnabled(type != 0);
|
||||
port.setEnabled(type != 0);
|
||||
Gui_MigrateLocalMWSSetPictures_HQ.this.type = this.type;
|
||||
Gui_MigrateLocalMWSSetPictures_HQ.this.addr.setEnabled(this.type != 0);
|
||||
Gui_MigrateLocalMWSSetPictures_HQ.this.port.setEnabled(this.type != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class mCard {
|
||||
public final String name;
|
||||
public final String url;
|
||||
public final String folder;
|
||||
private static class MCard {
|
||||
private final String name;
|
||||
private final String url;
|
||||
private final String folder;
|
||||
|
||||
mCard(final String cardName, final String cardURL, final String cardFolder) {
|
||||
name = cardName;
|
||||
url = cardURL;
|
||||
folder = cardFolder;
|
||||
MCard(final String cardName, final String cardURL, final String cardFolder) {
|
||||
this.name = cardName;
|
||||
this.url = cardURL;
|
||||
this.folder = cardFolder;
|
||||
}
|
||||
} // mCard
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ import forge.gui.game.CardPanel;
|
||||
*/
|
||||
|
||||
/**
|
||||
* very hacky
|
||||
* very hacky.
|
||||
*
|
||||
*/
|
||||
class Gui_MultipleBlockers4 extends JFrame {
|
||||
/** Constant <code>serialVersionUID=7622818310877381045L</code> */
|
||||
/** Constant <code>serialVersionUID=7622818310877381045L</code>. */
|
||||
private static final long serialVersionUID = 7622818310877381045L;
|
||||
|
||||
private int assignDamage;
|
||||
@@ -57,7 +57,8 @@ class Gui_MultipleBlockers4 extends JFrame {
|
||||
* @param display
|
||||
* 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();
|
||||
assignDamage = damage;
|
||||
updateDamageLabel(); // update user message about assigning damage
|
||||
@@ -120,13 +121,13 @@ class Gui_MultipleBlockers4 extends JFrame {
|
||||
creaturePanel.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
creaturePanel_mousePressed(e);
|
||||
creaturePanelMousePressed(e);
|
||||
}
|
||||
});
|
||||
creaturePanel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
|
||||
@Override
|
||||
public void mouseMoved(final MouseEvent e) {
|
||||
creaturePanel_mouseMoved(e);
|
||||
creaturePanelMouseMoved(e);
|
||||
}
|
||||
});
|
||||
mainPanel.add(jPanel3, null);
|
||||
@@ -144,7 +145,7 @@ class Gui_MultipleBlockers4 extends JFrame {
|
||||
* @param e
|
||||
* a {@link java.awt.event.ActionEvent} object.
|
||||
*/
|
||||
void okButton_actionPerformed(final ActionEvent e) {
|
||||
void okButtonActionPerformed(final ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ class Gui_MultipleBlockers4 extends JFrame {
|
||||
* @param e
|
||||
* a {@link java.awt.event.MouseEvent} object.
|
||||
*/
|
||||
void creaturePanel_mousePressed(final MouseEvent e) {
|
||||
void creaturePanelMousePressed(final MouseEvent e) {
|
||||
Object o = creaturePanel.getComponentAt(e.getPoint());
|
||||
if (o instanceof CardPanel) {
|
||||
|
||||
@@ -217,7 +218,7 @@ class Gui_MultipleBlockers4 extends JFrame {
|
||||
* @param e
|
||||
* a {@link java.awt.event.MouseEvent} object.
|
||||
*/
|
||||
void creaturePanel_mouseMoved(final MouseEvent e) {
|
||||
void creaturePanelMouseMoved(final MouseEvent e) {
|
||||
Object o = creaturePanel.getComponentAt(e.getPoint());
|
||||
if (o instanceof CardPanel) {
|
||||
CardContainer cardPanel = (CardContainer) o;
|
||||
|
||||
@@ -344,10 +344,10 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
|
||||
// getCards(false) to get Phased Out cards
|
||||
Card[] c;
|
||||
if (!filter) {
|
||||
c = new Card[cards.size()];
|
||||
cards.toArray(c);
|
||||
c = new Card[getCardList().size()];
|
||||
getCardList().toArray(c);
|
||||
} else {
|
||||
Iterator<Card> itr = cards.iterator();
|
||||
Iterator<Card> itr = getCardList().iterator();
|
||||
ArrayList<Card> list = new ArrayList<Card>();
|
||||
while (itr.hasNext()) {
|
||||
Card crd = itr.next();
|
||||
|
||||
Reference in New Issue
Block a user