mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
changed Constants and NewConstants from Interfaces to static classes.
This commit is contained in:
@@ -28,7 +28,7 @@ import forge.quest.gui.main.QuestEventManager;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class AllZone implements NewConstants {
|
||||
public final class AllZone {
|
||||
// only for testing, should read decks from local directory
|
||||
// public static final IO IO = new IO("all-decks");
|
||||
|
||||
@@ -283,7 +283,7 @@ public final class AllZone implements NewConstants {
|
||||
if (cardFactory == null) {
|
||||
// setCardFactory(new
|
||||
// LazyCardFactory(ForgeProps.getFile(CARDSFOLDER)));
|
||||
setCardFactory(new PreloadingCardFactory(ForgeProps.getFile(CARDSFOLDER)));
|
||||
setCardFactory(new PreloadingCardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER)));
|
||||
}
|
||||
return cardFactory;
|
||||
}
|
||||
@@ -553,7 +553,7 @@ public final class AllZone implements NewConstants {
|
||||
*/
|
||||
public static DeckManager getDeckManager() {
|
||||
if (deckManager == null) {
|
||||
deckManager = new DeckManager(ForgeProps.getFile(NEW_DECKS));
|
||||
deckManager = new DeckManager(ForgeProps.getFile(NewConstants.NEW_DECKS));
|
||||
}
|
||||
return deckManager;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import forge.card.CardRules;
|
||||
import forge.card.CardRulesReader;
|
||||
import forge.card.trigger.TriggerHandler;
|
||||
import forge.error.ErrorViewer;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.view.FView;
|
||||
|
||||
/**
|
||||
@@ -42,7 +41,7 @@ import forge.view.FView;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CardReader implements Runnable, NewConstants {
|
||||
public class CardReader implements Runnable {
|
||||
// NOPMD by Braids on 8/18/11 10:55
|
||||
// PM
|
||||
private static final String CARD_FILE_DOT_EXTENSION = ".txt"; // NOPMD by
|
||||
|
||||
@@ -14,15 +14,15 @@ import forge.game.GameType;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface Constant {
|
||||
public final class Constant {
|
||||
/** Constant <code>ProgramName="Forge - http://cardforge.org"</code>. */
|
||||
String PROGRAM_NAME = "Forge - http://cardforge.org";
|
||||
public static final String PROGRAM_NAME = "Forge - http://cardforge.org";
|
||||
|
||||
// used to pass information between the GUI screens
|
||||
/**
|
||||
* The Class Runtime.
|
||||
*/
|
||||
public abstract class Runtime {
|
||||
public static class Runtime {
|
||||
|
||||
/** The Constant HumanDeck. */
|
||||
public static final Deck[] HUMAN_DECK = new Deck[1];
|
||||
@@ -110,52 +110,52 @@ public interface Constant {
|
||||
/**
|
||||
* The Interface Phase.
|
||||
*/
|
||||
public interface Phase {
|
||||
public static class Phase {
|
||||
|
||||
/** The Constant Untap. */
|
||||
String UNTAP = "Untap";
|
||||
public static final String UNTAP = "Untap";
|
||||
|
||||
/** The Constant Upkeep. */
|
||||
String UPKEEP = "Upkeep";
|
||||
public static final String UPKEEP = "Upkeep";
|
||||
|
||||
/** The Constant Draw. */
|
||||
String DRAW = "Draw";
|
||||
public static final String DRAW = "Draw";
|
||||
|
||||
/** The Constant Main1. */
|
||||
String MAIN1 = "Main1";
|
||||
public static final String MAIN1 = "Main1";
|
||||
|
||||
/** The Constant Combat_Begin. */
|
||||
String COMBAT_BEGIN = "BeginCombat";
|
||||
public static final String COMBAT_BEGIN = "BeginCombat";
|
||||
|
||||
/** The Constant Combat_Declare_Attackers. */
|
||||
String COMBAT_DECLARE_ATTACKERS = "Declare Attackers";
|
||||
public static final String COMBAT_DECLARE_ATTACKERS = "Declare Attackers";
|
||||
|
||||
/** The Constant Combat_Declare_Attackers_InstantAbility. */
|
||||
String COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY = "Declare Attackers - Play Instants and Abilities";
|
||||
public static final String COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY = "Declare Attackers - Play Instants and Abilities";
|
||||
|
||||
/** The Constant Combat_Declare_Blockers. */
|
||||
String COMBAT_DECLARE_BLOCKERS = "Declare Blockers";
|
||||
public static final String COMBAT_DECLARE_BLOCKERS = "Declare Blockers";
|
||||
|
||||
/** The Constant Combat_Declare_Blockers_InstantAbility. */
|
||||
String COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY = "Declare Blockers - Play Instants and Abilities";
|
||||
public static final String COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY = "Declare Blockers - Play Instants and Abilities";
|
||||
|
||||
/** The Constant Combat_Damage. */
|
||||
String COMBAT_DAMAGE = "Combat Damage";
|
||||
public static final String COMBAT_DAMAGE = "Combat Damage";
|
||||
|
||||
/** The Constant Combat_FirstStrikeDamage. */
|
||||
String COMBAT_FIRST_STRIKE_DAMAGE = "First Strike Damage";
|
||||
public static final String COMBAT_FIRST_STRIKE_DAMAGE = "First Strike Damage";
|
||||
|
||||
/** The Constant Combat_End. */
|
||||
String COMBAT_END = "EndCombat";
|
||||
public static final String COMBAT_END = "EndCombat";
|
||||
|
||||
/** The Constant Main2. */
|
||||
String MAIN2 = "Main2";
|
||||
public static final String MAIN2 = "Main2";
|
||||
|
||||
/** The Constant End_Of_Turn. */
|
||||
String END_OF_TURN = "End of Turn";
|
||||
public static final String END_OF_TURN = "End of Turn";
|
||||
|
||||
/** The Constant Cleanup. */
|
||||
String CLEANUP = "Cleanup";
|
||||
public static final String CLEANUP = "Cleanup";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,122 +226,122 @@ public interface Constant {
|
||||
/**
|
||||
* The Interface Color.
|
||||
*/
|
||||
public interface Color {
|
||||
public static class Color {
|
||||
|
||||
/** The Black. */
|
||||
String BLACK = "black";
|
||||
public static final String BLACK = "black";
|
||||
|
||||
/** The Blue. */
|
||||
String BLUE = "blue";
|
||||
public static final String BLUE = "blue";
|
||||
|
||||
/** The Green. */
|
||||
String GREEN = "green";
|
||||
public static final String GREEN = "green";
|
||||
|
||||
/** The Red. */
|
||||
String RED = "red";
|
||||
public static final String RED = "red";
|
||||
|
||||
/** The White. */
|
||||
String WHITE = "white";
|
||||
public static final String WHITE = "white";
|
||||
|
||||
/** The Colorless. */
|
||||
String COLORLESS = "colorless";
|
||||
public static final String COLORLESS = "colorless";
|
||||
// color order "wubrg"
|
||||
/** The Colors. */
|
||||
String[] COLORS = { WHITE, BLUE, BLACK, RED, GREEN, COLORLESS };
|
||||
public static final String[] COLORS = { WHITE, BLUE, BLACK, RED, GREEN, COLORLESS };
|
||||
|
||||
/** The only colors. */
|
||||
String[] ONLY_COLORS = { WHITE, BLUE, BLACK, RED, GREEN };
|
||||
public static final String[] ONLY_COLORS = { WHITE, BLUE, BLACK, RED, GREEN };
|
||||
|
||||
/** The Snow. */
|
||||
String SNOW = "snow";
|
||||
public static final String SNOW = "snow";
|
||||
|
||||
/** The Mana colors. */
|
||||
String[] MANA_COLORS = { WHITE, BLUE, BLACK, RED, GREEN, COLORLESS, SNOW };
|
||||
public static final String[] MANA_COLORS = { WHITE, BLUE, BLACK, RED, GREEN, COLORLESS, SNOW };
|
||||
|
||||
/** The loaded. */
|
||||
boolean[] LOADED = { false };
|
||||
public static final boolean[] LOADED = { false };
|
||||
// public static final Constant_StringHashMap[] LandColor = new
|
||||
// Constant_StringHashMap[1];
|
||||
|
||||
/** The Basic lands. */
|
||||
String[] BASIC_LANDS = { "Plains", "Island", "Swamp", "Mountain", "Forest" };
|
||||
public static final String[] BASIC_LANDS = { "Plains", "Island", "Swamp", "Mountain", "Forest" };
|
||||
}
|
||||
|
||||
/**
|
||||
* The Interface Quest.
|
||||
*/
|
||||
public interface Quest {
|
||||
public static class Quest {
|
||||
|
||||
/** The fantasy quest. */
|
||||
boolean[] FANTASY_QUEST = new boolean[1];
|
||||
public static final boolean[] FANTASY_QUEST = new boolean[1];
|
||||
|
||||
// public static final Quest_Assignment[] qa = new Quest_Assignment[1];
|
||||
|
||||
/** The human list. */
|
||||
CardList[] HUMAN_LIST = new CardList[1];
|
||||
public static final CardList[] HUMAN_LIST = new CardList[1];
|
||||
|
||||
/** The computer list. */
|
||||
CardList[] COMPUTER_LIST = new CardList[1];
|
||||
public static final CardList[] COMPUTER_LIST = new CardList[1];
|
||||
|
||||
/** The human life. */
|
||||
int[] HUMAN_LIFE = new int[1];
|
||||
public static final int[] HUMAN_LIFE = new int[1];
|
||||
|
||||
/** The computer life. */
|
||||
int[] COMPUTER_LIFE = new int[1];
|
||||
public static final int[] COMPUTER_LIFE = new int[1];
|
||||
|
||||
/** The opp icon name. */
|
||||
String[] OPP_ICON_NAME = new String[1];
|
||||
public static final String[] OPP_ICON_NAME = new String[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* The Interface CardTypes.
|
||||
*/
|
||||
public interface CardTypes {
|
||||
public static class CardTypes {
|
||||
|
||||
/** The loaded. */
|
||||
boolean[] LOADED = { false };
|
||||
public static final boolean[] LOADED = { false };
|
||||
|
||||
/** The card types. */
|
||||
ConstantStringArrayList[] CARD_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] CARD_TYPES = new ConstantStringArrayList[1];
|
||||
|
||||
/** The super types. */
|
||||
ConstantStringArrayList[] SUPER_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] SUPER_TYPES = new ConstantStringArrayList[1];
|
||||
|
||||
/** The basic types. */
|
||||
ConstantStringArrayList[] BASIC_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] BASIC_TYPES = new ConstantStringArrayList[1];
|
||||
|
||||
/** The land types. */
|
||||
ConstantStringArrayList[] LAND_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] LAND_TYPES = new ConstantStringArrayList[1];
|
||||
|
||||
/** The creature types. */
|
||||
ConstantStringArrayList[] CREATURE_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] CREATURE_TYPES = new ConstantStringArrayList[1];
|
||||
|
||||
/** The instant types. */
|
||||
ConstantStringArrayList[] INSTANT_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] INSTANT_TYPES = new ConstantStringArrayList[1];
|
||||
|
||||
/** The sorcery types. */
|
||||
ConstantStringArrayList[] SORCERY_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] SORCERY_TYPES = new ConstantStringArrayList[1];
|
||||
|
||||
/** The enchantment types. */
|
||||
ConstantStringArrayList[] ENCHANTMENT_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] ENCHANTMENT_TYPES = new ConstantStringArrayList[1];
|
||||
|
||||
/** The artifact types. */
|
||||
ConstantStringArrayList[] ARTIFACT_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] ARTIFACT_TYPES = new ConstantStringArrayList[1];
|
||||
|
||||
/** The walker types. */
|
||||
ConstantStringArrayList[] WALKER_TYPES = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] WALKER_TYPES = new ConstantStringArrayList[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* The Interface Keywords.
|
||||
*/
|
||||
public interface Keywords {
|
||||
public static class Keywords {
|
||||
|
||||
/** The loaded. */
|
||||
boolean[] LOADED = { false };
|
||||
public static final boolean[] LOADED = { false };
|
||||
|
||||
/** The Non stacking list. */
|
||||
ConstantStringArrayList[] NON_STACKING_LIST = new ConstantStringArrayList[1];
|
||||
public static final ConstantStringArrayList[] NON_STACKING_LIST = new ConstantStringArrayList[1];
|
||||
}
|
||||
|
||||
} // Constant
|
||||
|
||||
@@ -23,7 +23,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CopyFiles extends SwingWorker<Void, Integer> implements NewConstants {
|
||||
public class CopyFiles extends SwingWorker<Void, Integer> {
|
||||
|
||||
private final List<File> fileList;
|
||||
|
||||
|
||||
@@ -93,6 +93,10 @@ import forge.item.CardPrinted;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.properties.NewConstants.Lang.GuiDisplay.ComputerHand;
|
||||
import forge.properties.NewConstants.Lang.GuiDisplay.ComputerLibrary;
|
||||
import forge.properties.NewConstants.Lang.GuiDisplay.HumanHand;
|
||||
import forge.properties.NewConstants.Lang.GuiDisplay.HumanLibrary;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -102,8 +106,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class GuiDisplay extends JFrame implements CardContainer, Display, NewConstants, NewConstants.Gui.GuiDisplay,
|
||||
NewConstants.Lang.GuiDisplay {
|
||||
public class GuiDisplay extends JFrame implements CardContainer, Display {
|
||||
/** Constant <code>serialVersionUID=4519302185194841060L</code>. */
|
||||
private static final long serialVersionUID = 4519302185194841060L;
|
||||
|
||||
@@ -177,9 +180,9 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
* </p>
|
||||
*/
|
||||
private void setupActions() {
|
||||
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) {
|
||||
humanGraveyardAction = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), NewConstants.Lang.GuiDisplay.HUMAN_GRAVEYARD);
|
||||
humanRemovedACtion = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Exile), NewConstants.Lang.GuiDisplay.HUMAN_REMOVED);
|
||||
humanFlashbackAction = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), NewConstants.Lang.GuiDisplay.HUMAN_FLASHBACK) {
|
||||
|
||||
private static final long serialVersionUID = 8120331222693706164L;
|
||||
|
||||
@@ -195,11 +198,11 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
}
|
||||
};
|
||||
computerGraveyardAction = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Graveyard),
|
||||
COMPUTER_GRAVEYARD);
|
||||
computerRemovedAction = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Exile), COMPUTER_REMOVED);
|
||||
NewConstants.Lang.GuiDisplay.COMPUTER_GRAVEYARD);
|
||||
computerRemovedAction = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Exile), NewConstants.Lang.GuiDisplay.COMPUTER_REMOVED);
|
||||
concedeAction = new ConcedeAction();
|
||||
|
||||
humanDecklistAction = new DeckListAction(HUMAN_DECKLIST);
|
||||
humanDecklistAction = new DeckListAction(NewConstants.Lang.GuiDisplay.HUMAN_DECKLIST);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,7 +219,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
computerGraveyardAction, computerRemovedAction, new JSeparator(), playsoundCheckboxForMenu,
|
||||
new JSeparator(), ErrorViewer.ALL_THREADS_ACTION, concedeAction };
|
||||
|
||||
JMenu gameMenu = new JMenu(ForgeProps.getLocalized(MenuBar.Menu.TITLE));
|
||||
JMenu gameMenu = new JMenu(ForgeProps.getLocalized(NewConstants.Lang.GuiDisplay.MenuBar.Menu.TITLE));
|
||||
for (Object o : obj) {
|
||||
if (o instanceof ForgeAction) {
|
||||
gameMenu.add(((ForgeAction) o).setupButton(new JMenuItem()));
|
||||
@@ -230,7 +233,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
}
|
||||
|
||||
// Phase Menu Creation
|
||||
JMenu gamePhases = new JMenu(ForgeProps.getLocalized(MenuBar.PHASE.TITLE));
|
||||
JMenu gamePhases = new JMenu(ForgeProps.getLocalized(NewConstants.Lang.GuiDisplay.MenuBar.PHASE.TITLE));
|
||||
|
||||
JMenuItem aiLabel = new JMenuItem("Computer");
|
||||
JMenuItem humanLabel = new JMenuItem("Human");
|
||||
@@ -244,7 +247,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
}
|
||||
|
||||
// Dev Mode Creation
|
||||
JMenu devMenu = new JMenu(ForgeProps.getLocalized(MenuBar.DEV.TITLE));
|
||||
JMenu devMenu = new JMenu(ForgeProps.getLocalized(NewConstants.Lang.GuiDisplay.MenuBar.DEV.TITLE));
|
||||
|
||||
devMenu.setEnabled(Constant.Runtime.DEV_MODE[0]);
|
||||
|
||||
@@ -256,7 +259,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
ComputerLibrary.BASE);
|
||||
Action viewHumanLibrary
|
||||
= new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Library), HumanLibrary.BASE);
|
||||
ForgeAction generateMana = new ForgeAction(MANAGEN) {
|
||||
ForgeAction generateMana = new ForgeAction(NewConstants.Lang.GuiDisplay.MANAGEN) {
|
||||
private static final long serialVersionUID = 7171104690016706405L;
|
||||
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
@@ -265,7 +268,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
};
|
||||
|
||||
// + Battlefield setup +
|
||||
ForgeAction setupBattleField = new ForgeAction(SETUPBATTLEFIELD) {
|
||||
ForgeAction setupBattleField = new ForgeAction(NewConstants.Lang.GuiDisplay.SETUPBATTLEFIELD) {
|
||||
private static final long serialVersionUID = -6660930759092583160L;
|
||||
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
@@ -275,7 +278,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
// - Battlefield setup -
|
||||
|
||||
// DevMode Tutor
|
||||
ForgeAction tutor = new ForgeAction(TUTOR) {
|
||||
ForgeAction tutor = new ForgeAction(NewConstants.Lang.GuiDisplay.TUTOR) {
|
||||
private static final long serialVersionUID = 2003222642609217705L;
|
||||
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
@@ -285,7 +288,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
// end DevMode Tutor
|
||||
|
||||
// DevMode AddCounter
|
||||
ForgeAction addCounter = new ForgeAction(ADDCOUNTER) {
|
||||
ForgeAction addCounter = new ForgeAction(NewConstants.Lang.GuiDisplay.ADDCOUNTER) {
|
||||
private static final long serialVersionUID = 3136264111882855268L;
|
||||
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
@@ -295,7 +298,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
// end DevMode AddCounter
|
||||
|
||||
// DevMode Tap
|
||||
ForgeAction tapPerm = new ForgeAction(TAPPERM) {
|
||||
ForgeAction tapPerm = new ForgeAction(NewConstants.Lang.GuiDisplay.TAPPERM) {
|
||||
private static final long serialVersionUID = -6092045653540313527L;
|
||||
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
@@ -305,7 +308,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
// end DevMode Tap
|
||||
|
||||
// DevMode Untap
|
||||
ForgeAction untapPerm = new ForgeAction(UNTAPPERM) {
|
||||
ForgeAction untapPerm = new ForgeAction(NewConstants.Lang.GuiDisplay.UNTAPPERM) {
|
||||
private static final long serialVersionUID = 5425291996157256656L;
|
||||
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
@@ -315,7 +318,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
// end DevMode Untap
|
||||
|
||||
// DevMode UnlimitedLand
|
||||
ForgeAction unlimitedLand = new ForgeAction(NOLANDLIMIT) {
|
||||
ForgeAction unlimitedLand = new ForgeAction(NewConstants.Lang.GuiDisplay.NOLANDLIMIT) {
|
||||
private static final long serialVersionUID = 2184353891062202796L;
|
||||
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
@@ -325,7 +328,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
// end DevMode UnlimitedLand
|
||||
|
||||
// DevMode SetLife
|
||||
ForgeAction setLife = new ForgeAction(SETLIFE) {
|
||||
ForgeAction setLife = new ForgeAction(NewConstants.Lang.GuiDisplay.SETLIFE) {
|
||||
private static final long serialVersionUID = -1750588303928974918L;
|
||||
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
@@ -674,7 +677,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
AllZone.getComputerPlayer().updateObservers();
|
||||
|
||||
if (AllZone.getQuestData() != null) {
|
||||
File base = ForgeProps.getFile(IMAGE_ICON);
|
||||
File base = ForgeProps.getFile(NewConstants.IMAGE_ICON);
|
||||
String iconName = "";
|
||||
if (Constant.Quest.OPP_ICON_NAME[0] != null) {
|
||||
iconName = Constant.Quest.OPP_ICON_NAME[0];
|
||||
@@ -860,7 +863,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
*/
|
||||
private void initComponents() {
|
||||
// Preparing the Frame
|
||||
setTitle(ForgeProps.getLocalized(Lang.PROGRAM_NAME));
|
||||
setTitle(ForgeProps.getLocalized(NewConstants.Lang.PROGRAM_NAME));
|
||||
if (!Singletons.getModel().getPreferences().isLafFonts()) {
|
||||
setFont(new Font("Times New Roman", 0, 16));
|
||||
}
|
||||
@@ -882,7 +885,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
|
||||
// Write the layout to the new file, usually
|
||||
// res/gui/display_new_layout.xml
|
||||
File f = ForgeProps.getFile(LAYOUT_NEW);
|
||||
File f = ForgeProps.getFile(NewConstants.Gui.GuiDisplay.LAYOUT_NEW);
|
||||
|
||||
Node layout = pane.getMultiSplitLayout().getModel();
|
||||
|
||||
@@ -914,7 +917,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
|
||||
// Try to load the latest saved layout, usually
|
||||
// res/gui/display_new_layout.xml
|
||||
final File file = ForgeProps.getFile(LAYOUT_NEW);
|
||||
final File file = ForgeProps.getFile(NewConstants.Gui.GuiDisplay.LAYOUT_NEW);
|
||||
|
||||
try {
|
||||
model = loadModel(xstream, file);
|
||||
@@ -950,7 +953,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
|
||||
if (model == null) {
|
||||
System.err.println("XMLDecoder failed; using default layout.");
|
||||
final File defaultFile = ForgeProps.getFile(LAYOUT);
|
||||
final File defaultFile = ForgeProps.getFile(NewConstants.Gui.GuiDisplay.LAYOUT);
|
||||
|
||||
try {
|
||||
model = loadModel(xstream, defaultFile);
|
||||
@@ -1231,7 +1234,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
oppIconLifePanel.add(oppLifeLabel);
|
||||
|
||||
JPanel oppPanel = new JPanel();
|
||||
oppPanel.setBorder(new TitledBorder(new EtchedBorder(), ForgeProps.getLocalized(COMPUTER_TITLE)));
|
||||
oppPanel.setBorder(new TitledBorder(new EtchedBorder(), ForgeProps.getLocalized(NewConstants.Lang.GuiDisplay.COMPUTER_TITLE)));
|
||||
oppPanel.setLayout(new BorderLayout());
|
||||
oppPanel.add(oppNumbersPanel, BorderLayout.WEST);
|
||||
// oppPanel.add(oppIconLabel, BorderLayout.CENTER);
|
||||
@@ -1261,7 +1264,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
|
||||
JScrollPane combatPane = new JScrollPane(combatArea);
|
||||
|
||||
combatPane.setBorder(new TitledBorder(new EtchedBorder(), ForgeProps.getLocalized(COMBAT)));
|
||||
combatPane.setBorder(new TitledBorder(new EtchedBorder(), ForgeProps.getLocalized(NewConstants.Lang.GuiDisplay.COMBAT)));
|
||||
pane.add(new ExternalPanel(combatPane), "combat");
|
||||
}
|
||||
|
||||
@@ -1342,7 +1345,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
playerNumbersPanel.add(playerFBValue);
|
||||
|
||||
JPanel playerPanel = new JPanel();
|
||||
playerPanel.setBorder(new TitledBorder(new EtchedBorder(), ForgeProps.getLocalized(HUMAN_TITLE)));
|
||||
playerPanel.setBorder(new TitledBorder(new EtchedBorder(), ForgeProps.getLocalized(NewConstants.Lang.GuiDisplay.HUMAN_TITLE)));
|
||||
playerPanel.setLayout(new BorderLayout());
|
||||
playerPanel.add(playerNumbersPanel, BorderLayout.WEST);
|
||||
playerPanel.add(playerLifeLabel, BorderLayout.EAST);
|
||||
@@ -1647,7 +1650,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
private static final long serialVersionUID = -6976695235601916762L;
|
||||
|
||||
public ConcedeAction() {
|
||||
super(CONCEDE);
|
||||
super(NewConstants.Lang.GuiDisplay.CONCEDE);
|
||||
}
|
||||
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
@@ -1723,7 +1726,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
public TriggerReactionMenu() {
|
||||
super();
|
||||
|
||||
ForgeAction actAccept = new ForgeAction(Lang.GuiDisplay.Trigger.ALWAYSACCEPT) {
|
||||
ForgeAction actAccept = new ForgeAction(NewConstants.Lang.GuiDisplay.Trigger.ALWAYSACCEPT) {
|
||||
private static final long serialVersionUID = -3734674058185367612L;
|
||||
|
||||
@Override
|
||||
@@ -1732,7 +1735,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
}
|
||||
};
|
||||
|
||||
ForgeAction actDecline = new ForgeAction(Lang.GuiDisplay.Trigger.ALWAYSDECLINE) {
|
||||
ForgeAction actDecline = new ForgeAction(NewConstants.Lang.GuiDisplay.Trigger.ALWAYSDECLINE) {
|
||||
private static final long serialVersionUID = -1983295769159971502L;
|
||||
|
||||
@Override
|
||||
@@ -1741,7 +1744,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display, NewCon
|
||||
}
|
||||
};
|
||||
|
||||
ForgeAction actAsk = new ForgeAction(Lang.GuiDisplay.Trigger.ALWAYSASK) {
|
||||
ForgeAction actAsk = new ForgeAction(NewConstants.Lang.GuiDisplay.Trigger.ALWAYSASK) {
|
||||
private static final long serialVersionUID = 5045255351332940821L;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,7 +31,6 @@ import forge.card.mana.ManaPool;
|
||||
import forge.card.spellability.AbilityMana;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.gui.game.CardPanel;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -41,7 +40,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class GuiDisplayUtil implements NewConstants {
|
||||
public final class GuiDisplayUtil {
|
||||
|
||||
private GuiDisplayUtil() {
|
||||
throw new AssertionError();
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -41,10 +42,10 @@ public class GuiDownloadPicturesLQ extends GuiDownloader {
|
||||
*/
|
||||
protected final DownloadObject[] getNeededImages() {
|
||||
// read token names and urls
|
||||
DownloadObject[] cardTokenLQ = readFileWithNames(TOKEN_IMAGES, ForgeProps.getFile(IMAGE_TOKEN));
|
||||
DownloadObject[] cardTokenLQ = readFileWithNames(NewConstants.TOKEN_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_TOKEN));
|
||||
ArrayList<DownloadObject> cList = new ArrayList<DownloadObject>();
|
||||
|
||||
String base = ForgeProps.getFile(IMAGE_BASE).getPath();
|
||||
String base = ForgeProps.getFile(NewConstants.IMAGE_BASE).getPath();
|
||||
for (Card c : AllZone.getCardFactory()) {
|
||||
cList.addAll(createDLObjects(c, base));
|
||||
if (c.hasAlternateState()) {
|
||||
@@ -67,7 +68,7 @@ public class GuiDownloadPicturesLQ extends GuiDownloader {
|
||||
}
|
||||
|
||||
// add missing tokens to the list of things to download
|
||||
File filebase = ForgeProps.getFile(IMAGE_TOKEN);
|
||||
File filebase = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
|
||||
for (int i = 0; i < cardTokenLQ.length; i++) {
|
||||
file = new File(filebase, cardTokenLQ[i].getName());
|
||||
if (!file.exists()) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -40,14 +41,14 @@ public class GuiDownloadQuestImages extends GuiDownloader {
|
||||
*/
|
||||
protected final DownloadObject[] getNeededImages() {
|
||||
// read all card names and urls
|
||||
DownloadObject[] questOpponents = readFile(Quest.OPPONENT_ICONS, ForgeProps.getFile(Quest.OPPONENT_DIR));
|
||||
DownloadObject[] boosterImages = readFile(PICS_BOOSTER_IMAGES, ForgeProps.getFile(PICS_BOOSTER));
|
||||
DownloadObject[] petIcons = readFileWithNames(Quest.PET_SHOP_ICONS, ForgeProps.getFile(IMAGE_ICON));
|
||||
DownloadObject[] questPets = readFileWithNames(Quest.PET_TOKEN_IMAGES, ForgeProps.getFile(IMAGE_TOKEN));
|
||||
DownloadObject[] questOpponents = readFile(NewConstants.Quest.OPPONENT_ICONS, ForgeProps.getFile(NewConstants.Quest.OPPONENT_DIR));
|
||||
DownloadObject[] boosterImages = readFile(NewConstants.PICS_BOOSTER_IMAGES, ForgeProps.getFile(NewConstants.PICS_BOOSTER));
|
||||
DownloadObject[] petIcons = readFileWithNames(NewConstants.Quest.PET_SHOP_ICONS, ForgeProps.getFile(NewConstants.IMAGE_ICON));
|
||||
DownloadObject[] questPets = readFileWithNames(NewConstants.Quest.PET_TOKEN_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_TOKEN));
|
||||
ArrayList<DownloadObject> urls = new ArrayList<DownloadObject>();
|
||||
|
||||
File file;
|
||||
File dir = ForgeProps.getFile(Quest.OPPONENT_DIR);
|
||||
File dir = ForgeProps.getFile(NewConstants.Quest.OPPONENT_DIR);
|
||||
for (int i = 0; i < questOpponents.length; i++) {
|
||||
file = new File(dir, questOpponents[i].getName().replace("%20", " "));
|
||||
if (!file.exists()) {
|
||||
@@ -55,7 +56,7 @@ public class GuiDownloadQuestImages extends GuiDownloader {
|
||||
}
|
||||
}
|
||||
|
||||
dir = ForgeProps.getFile(PICS_BOOSTER);
|
||||
dir = ForgeProps.getFile(NewConstants.PICS_BOOSTER);
|
||||
for (int i = 0; i < boosterImages.length; i++) {
|
||||
file = new File(dir, boosterImages[i].getName().replace("%20", " "));
|
||||
if (!file.exists()) {
|
||||
@@ -63,7 +64,7 @@ public class GuiDownloadQuestImages extends GuiDownloader {
|
||||
}
|
||||
}
|
||||
|
||||
dir = ForgeProps.getFile(IMAGE_ICON);
|
||||
dir = ForgeProps.getFile(NewConstants.IMAGE_ICON);
|
||||
for (int i = 0; i < petIcons.length; i++) {
|
||||
file = new File(dir, petIcons[i].getName().replace("%20", " "));
|
||||
if (!file.exists()) {
|
||||
@@ -71,7 +72,7 @@ public class GuiDownloadQuestImages extends GuiDownloader {
|
||||
}
|
||||
}
|
||||
|
||||
dir = ForgeProps.getFile(IMAGE_TOKEN);
|
||||
dir = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
|
||||
for (int i = 0; i < questPets.length; i++) {
|
||||
file = new File(dir, questPets[i].getName().replace("%20", " "));
|
||||
if (!file.exists()) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import forge.card.CardSet;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -45,10 +46,10 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader {
|
||||
*/
|
||||
protected final DownloadObject[] getNeededImages() {
|
||||
// read token names and urls
|
||||
DownloadObject[] cardTokenLQ = readFileWithNames(TOKEN_IMAGES, ForgeProps.getFile(IMAGE_TOKEN));
|
||||
DownloadObject[] cardTokenLQ = readFileWithNames(NewConstants.TOKEN_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_TOKEN));
|
||||
ArrayList<DownloadObject> cList = new ArrayList<DownloadObject>();
|
||||
|
||||
File base = ForgeProps.getFile(IMAGE_BASE);
|
||||
File base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
|
||||
String urlBase = "http://cardforge.org/fpics/";
|
||||
for (CardPrinted c : CardDb.instance().getAllCards()) {
|
||||
String setCode3 = c.getSet();
|
||||
@@ -72,7 +73,7 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader {
|
||||
|
||||
// add missing tokens to the list of things to download
|
||||
File file;
|
||||
File filebase = ForgeProps.getFile(IMAGE_TOKEN);
|
||||
File filebase = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
|
||||
for (int i = 0; i < cardTokenLQ.length; i++) {
|
||||
file = new File(filebase, cardTokenLQ[i].getName());
|
||||
if (!file.exists()) {
|
||||
|
||||
@@ -53,8 +53,7 @@ import forge.properties.NewConstants;
|
||||
*
|
||||
* @author Forge
|
||||
*/
|
||||
public abstract class GuiDownloader extends DefaultBoundedRangeModel implements Runnable, NewConstants,
|
||||
NewConstants.Lang.GuiDownloadPictures {
|
||||
public abstract class GuiDownloader extends DefaultBoundedRangeModel implements Runnable {
|
||||
|
||||
private static final long serialVersionUID = -8596808503046590349L;
|
||||
|
||||
@@ -141,12 +140,12 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
cards = getNeededImages();
|
||||
|
||||
if (cards.length == 0) {
|
||||
JOptionPane.showMessageDialog(frame, ForgeProps.getLocalized(NO_MORE));
|
||||
JOptionPane.showMessageDialog(frame, ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.NO_MORE));
|
||||
return;
|
||||
}
|
||||
|
||||
addr = new JTextField(ForgeProps.getLocalized(PROXY_ADDRESS));
|
||||
port = new JTextField(ForgeProps.getLocalized(PROXY_PORT));
|
||||
addr = new JTextField(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.PROXY_ADDRESS));
|
||||
port = new JTextField(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.PROXY_PORT));
|
||||
bar = new JProgressBar(this);
|
||||
|
||||
JPanel p0 = new JPanel();
|
||||
@@ -154,8 +153,8 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
|
||||
// Proxy Choice
|
||||
ButtonGroup bg = new ButtonGroup();
|
||||
String[] labels = { ForgeProps.getLocalized(NO_PROXY), ForgeProps.getLocalized(HTTP_PROXY),
|
||||
ForgeProps.getLocalized(SOCKS_PROXY) };
|
||||
String[] labels = { ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.NO_PROXY), ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.HTTP_PROXY),
|
||||
ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.SOCKS_PROXY) };
|
||||
for (int i = 0; i < TYPES.length; i++) {
|
||||
JRadioButton rb = new JRadioButton(labels[i]);
|
||||
rb.addChangeListener(new ProxyHandler(i));
|
||||
@@ -171,7 +170,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
p0.add(port);
|
||||
|
||||
// Start
|
||||
final JButton b = new JButton(ForgeProps.getLocalized(Buttons.START));
|
||||
final JButton b = new JButton(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.Buttons.START));
|
||||
b.addActionListener(new ActionListener() {
|
||||
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
@@ -194,7 +193,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
bar.setPreferredSize(d);
|
||||
|
||||
// JOptionPane
|
||||
close = new JButton(ForgeProps.getLocalized(Buttons.CANCEL));
|
||||
close = new JButton(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.Buttons.CANCEL));
|
||||
Object[] options = { b, close };
|
||||
dlg = new JOptionPane(p0, DEFAULT_OPTION, PLAIN_MESSAGE, null, options, options[1]);
|
||||
|
||||
@@ -288,7 +287,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
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(NewConstants.Lang.GuiDownloadPictures.BAR_CLOSE), card, cards.length));
|
||||
}
|
||||
|
||||
bar.setString(sb.toString());
|
||||
@@ -308,7 +307,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
* @return a {@link javax.swing.JDialog} object.
|
||||
*/
|
||||
private JDialog getDlg(final JFrame frame) {
|
||||
final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(TITLE));
|
||||
final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.TITLE));
|
||||
close.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
dlg.setVisible(false);
|
||||
@@ -348,7 +347,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
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());
|
||||
.showError(ex, ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.Errors.PROXY_CONNECT), addr.getText(), port.getText());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -417,7 +416,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
}
|
||||
} // for
|
||||
}
|
||||
close.setText(ForgeProps.getLocalized(Buttons.CLOSE));
|
||||
close.setText(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.Buttons.CLOSE));
|
||||
} // run
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class GuiImportPicture extends JDialog implements NewConstants {
|
||||
public class GuiImportPicture extends JDialog {
|
||||
/** Constant <code>serialVersionUID=-4191539152208389089L</code>. */
|
||||
private static final long serialVersionUID = -4191539152208389089L;
|
||||
private JPanel jContentPane = null;
|
||||
@@ -110,7 +110,7 @@ public class GuiImportPicture extends JDialog implements NewConstants {
|
||||
jLabelHDDFree = new JLabel();
|
||||
jLabelHDDFree.setBounds(new Rectangle(15, 119, 177, 16));
|
||||
|
||||
File file = ForgeProps.getFile(IMAGE_BASE);
|
||||
File file = ForgeProps.getFile(NewConstants.IMAGE_BASE);
|
||||
|
||||
long freeSpace = file.getFreeSpace();
|
||||
freeSpaceM = freeSpace / 1024 / 1024;
|
||||
@@ -200,7 +200,7 @@ public class GuiImportPicture extends JDialog implements NewConstants {
|
||||
start = fName.indexOf("full");
|
||||
fName = fName.substring(0, start - 1) + fName.substring(start + 4, fName.length() - 4);
|
||||
fName = GuiDisplayUtil.cleanString(fName) + ".jpg";
|
||||
File file = new File(ForgeProps.getFile(IMAGE_BASE), fName);
|
||||
File file = new File(ForgeProps.getFile(NewConstants.IMAGE_BASE), fName);
|
||||
if (!file.exists()) {
|
||||
filesForCopy = filesForCopy + 1;
|
||||
filesToCopySize = filesToCopySize + listFiles.get(i).length();
|
||||
@@ -294,7 +294,7 @@ public class GuiImportPicture extends JDialog implements NewConstants {
|
||||
start = fName.indexOf("full");
|
||||
fName = fName.substring(0, start - 1) + fName.substring(start + 4, fName.length() - 4);
|
||||
fName = GuiDisplayUtil.cleanString(fName) + ".jpg";
|
||||
File file = new File(ForgeProps.getFile(IMAGE_BASE), fName);
|
||||
File file = new File(ForgeProps.getFile(NewConstants.IMAGE_BASE), fName);
|
||||
if (!file.exists()) {
|
||||
filesForCopy = filesForCopy + 1;
|
||||
filesToCopySize = filesToCopySize + listFiles.get(i).length();
|
||||
|
||||
@@ -52,8 +52,7 @@ import forge.properties.NewConstants.Lang.GuiDownloadPictures;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class GuiMigrateLocalMWSSetPicturesHQ extends DefaultBoundedRangeModel implements Runnable,
|
||||
NewConstants, NewConstants.Lang.GuiDownloadPictures {
|
||||
public final class GuiMigrateLocalMWSSetPicturesHQ extends DefaultBoundedRangeModel implements Runnable {
|
||||
|
||||
/** Constant <code>serialVersionUID=-7890794857949935256L</code>. */
|
||||
private static final long serialVersionUID = -7890794857949935256L;
|
||||
@@ -181,7 +180,7 @@ public final class GuiMigrateLocalMWSSetPicturesHQ extends DefaultBoundedRangeMo
|
||||
this.bar.setPreferredSize(d);
|
||||
|
||||
// JOptionPane
|
||||
this.close = new JButton(ForgeProps.getLocalized(Buttons.CANCEL));
|
||||
this.close = new JButton(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.Buttons.CANCEL));
|
||||
final Object[] options = { b, this.close };
|
||||
this.dlg = new JOptionPane(p0, JOptionPane.DEFAULT_OPTION,
|
||||
JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
|
||||
@@ -342,7 +341,7 @@ public final class GuiMigrateLocalMWSSetPicturesHQ extends DefaultBoundedRangeMo
|
||||
p = new Proxy(GuiMigrateLocalMWSSetPicturesHQ.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(),
|
||||
ErrorViewer.showError(ex, ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.Errors.PROXY_CONNECT), this.addr.getText(),
|
||||
this.port.getText());
|
||||
// throw new
|
||||
// RuntimeException("Gui_DownloadPictures : error 1 - " +ex);
|
||||
@@ -427,7 +426,7 @@ public final class GuiMigrateLocalMWSSetPicturesHQ extends DefaultBoundedRangeMo
|
||||
}
|
||||
} // for
|
||||
}
|
||||
this.close.setText(ForgeProps.getLocalized(Buttons.CLOSE));
|
||||
this.close.setText(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.Buttons.CLOSE));
|
||||
} // run
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ImageCache implements NewConstants {
|
||||
public class ImageCache {
|
||||
/** Constant <code>imageCache</code>. */
|
||||
private static final Map<String, BufferedImage> IMAGE_CACHE;
|
||||
/** Constant <code>FULL_SIZE</code>. */
|
||||
@@ -88,9 +88,9 @@ public class ImageCache implements NewConstants {
|
||||
File path;
|
||||
if (key.endsWith(TOKEN)) {
|
||||
key = key.substring(0, key.length() - TOKEN.length());
|
||||
path = ForgeProps.getFile(IMAGE_TOKEN);
|
||||
path = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
|
||||
} else {
|
||||
path = ForgeProps.getFile(IMAGE_BASE);
|
||||
path = ForgeProps.getFile(NewConstants.IMAGE_BASE);
|
||||
}
|
||||
|
||||
File file = null;
|
||||
|
||||
@@ -19,7 +19,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MenuItemHowToPlay extends JMenuItem implements NewConstants.Lang.HowTo {
|
||||
public class MenuItemHowToPlay extends JMenuItem {
|
||||
/** Constant <code>serialVersionUID=5552000208438248428L</code>. */
|
||||
private static final long serialVersionUID = 5552000208438248428L;
|
||||
|
||||
@@ -29,11 +29,11 @@ public class MenuItemHowToPlay extends JMenuItem implements NewConstants.Lang.Ho
|
||||
* </p>
|
||||
*/
|
||||
public MenuItemHowToPlay() {
|
||||
super(ForgeProps.getLocalized(TITLE));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.HowTo.TITLE));
|
||||
|
||||
this.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(final ActionEvent a) {
|
||||
String text = ForgeProps.getLocalized(MESSAGE);
|
||||
String text = ForgeProps.getLocalized(NewConstants.Lang.HowTo.MESSAGE);
|
||||
|
||||
JTextArea area = new JTextArea(text, 25, 40);
|
||||
area.setWrapStyleWord(true);
|
||||
@@ -42,7 +42,7 @@ public class MenuItemHowToPlay extends JMenuItem implements NewConstants.Lang.Ho
|
||||
|
||||
area.setOpaque(false);
|
||||
|
||||
JOptionPane.showMessageDialog(null, new JScrollPane(area), ForgeProps.getLocalized(TITLE),
|
||||
JOptionPane.showMessageDialog(null, new JScrollPane(area), ForgeProps.getLocalized(NewConstants.Lang.HowTo.TITLE),
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class NameChanger implements NewConstants {
|
||||
public class NameChanger {
|
||||
private Map<String, String> mutatedMap = new TreeMap<String, String>();
|
||||
private Map<String, String> originalMap = new TreeMap<String, String>();
|
||||
|
||||
@@ -215,7 +215,7 @@ public class NameChanger implements NewConstants {
|
||||
@SuppressWarnings("unused")
|
||||
private void readFile() {
|
||||
try {
|
||||
BufferedReader in = new BufferedReader(new FileReader(ForgeProps.getFile(NAME_MUTATOR)));
|
||||
BufferedReader in = new BufferedReader(new FileReader(ForgeProps.getFile(NewConstants.NAME_MUTATOR)));
|
||||
|
||||
String line = in.readLine();
|
||||
|
||||
@@ -232,7 +232,7 @@ public class NameChanger implements NewConstants {
|
||||
|
||||
// ~ (could be cleaner...)
|
||||
try {
|
||||
BufferedReader in = new BufferedReader(new FileReader(ForgeProps.getFile(NAME_MUTATOR)));
|
||||
BufferedReader in = new BufferedReader(new FileReader(ForgeProps.getFile(NewConstants.NAME_MUTATOR)));
|
||||
|
||||
String line;
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ public final class AbilityFactoryClash {
|
||||
* </p>
|
||||
*
|
||||
* @param af
|
||||
* a {@link forge.card.abilityFactory.AbilityFactory} object.
|
||||
* a {@link forge.card.abilityfactory.AbilityFactory} object.
|
||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @since 1.1.7
|
||||
*/
|
||||
@@ -486,7 +486,7 @@ public final class AbilityFactoryClash {
|
||||
* </p>
|
||||
*
|
||||
* @param af
|
||||
* a {@link forge.card.abilityFactory.AbilityFactory} object.
|
||||
* a {@link forge.card.abilityfactory.AbilityFactory} object.
|
||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @since 1.1.7
|
||||
*/
|
||||
@@ -519,7 +519,7 @@ public final class AbilityFactoryClash {
|
||||
* </p>
|
||||
*
|
||||
* @param af
|
||||
* a {@link forge.card.abilityFactory.AbilityFactory} object.
|
||||
* a {@link forge.card.abilityfactory.AbilityFactory} object.
|
||||
* @return a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @since 1.1.7
|
||||
*/
|
||||
|
||||
@@ -68,7 +68,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class AbstractCardFactory implements NewConstants, CardFactoryInterface {
|
||||
public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
/**
|
||||
* This maps card name Strings to Card instances. The Card instances have no
|
||||
* owner, and lack abilities.
|
||||
|
||||
@@ -34,7 +34,7 @@ import forge.properties.NewConstants;
|
||||
* @author Clemens Koza
|
||||
* @version V1.0 02.08.2009
|
||||
*/
|
||||
public class ErrorViewer implements NewConstants, NewConstants.Lang.ErrorViewer {
|
||||
public class ErrorViewer {
|
||||
/** Constant <code>NAME_OS="os.name"</code>. */
|
||||
private static final String NAME_OS = "os.name";
|
||||
/** Constant <code>VERSION_OS="os.version"</code>. */
|
||||
@@ -166,11 +166,11 @@ public class ErrorViewer implements NewConstants, NewConstants.Lang.ErrorViewer
|
||||
// Button is not modified, String gets the automatic listener to hide
|
||||
// the dialog
|
||||
final Object[] options = { new JButton(new BugzAction(area)), new JButton(new SaveAction(area)),
|
||||
ForgeProps.getLocalized(ErrorViewer.BUTTON_CLOSE), new JButton(new ExitAction()) };
|
||||
ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.BUTTON_CLOSE), new JButton(new ExitAction()) };
|
||||
|
||||
final JOptionPane pane = new JOptionPane(new JScrollPane(area), JOptionPane.ERROR_MESSAGE,
|
||||
JOptionPane.DEFAULT_OPTION, null, options, options[1]);
|
||||
ErrorViewer.dlg = pane.createDialog(null, ForgeProps.getLocalized(ErrorViewer.TITLE));
|
||||
ErrorViewer.dlg = pane.createDialog(null, ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.TITLE));
|
||||
ErrorViewer.dlg.setResizable(true);
|
||||
ErrorViewer.dlg.setVisible(true);
|
||||
ErrorViewer.dlg.dispose();
|
||||
@@ -192,7 +192,7 @@ public class ErrorViewer implements NewConstants, NewConstants.Lang.ErrorViewer
|
||||
}
|
||||
ex.printStackTrace();
|
||||
|
||||
pw.printf(ForgeProps.getLocalized(ErrorViewer.MESSAGE),
|
||||
pw.printf(ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.MESSAGE),
|
||||
ForgeProps.getProperty(NewConstants.HOW_TO_REPORT_BUGS_URL),
|
||||
message != null ? message : ex.getMessage(), Singletons.getModel().getBuildInfo().toPrettyString(),
|
||||
System.getProperty(ErrorViewer.NAME_OS), System.getProperty(ErrorViewer.VERSION_OS),
|
||||
@@ -213,7 +213,7 @@ public class ErrorViewer implements NewConstants, NewConstants.Lang.ErrorViewer
|
||||
private static void printError(final PrintWriter pw, final String message) {
|
||||
System.err.println(message);
|
||||
|
||||
pw.printf(ForgeProps.getLocalized(ErrorViewer.MESSAGE),
|
||||
pw.printf(ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.MESSAGE),
|
||||
ForgeProps.getProperty(NewConstants.HOW_TO_REPORT_BUGS_URL), message, Singletons.getModel()
|
||||
.getBuildInfo().toPrettyString(), System.getProperty(ErrorViewer.NAME_OS),
|
||||
System.getProperty(ErrorViewer.VERSION_OS), System.getProperty(ErrorViewer.ARCHITECTURE_OS),
|
||||
@@ -237,7 +237,7 @@ public class ErrorViewer implements NewConstants, NewConstants.Lang.ErrorViewer
|
||||
private final JTextArea area;
|
||||
|
||||
public SaveAction(final JTextArea areaParam) {
|
||||
super(ForgeProps.getLocalized(ErrorViewer.BUTTON_SAVE));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.BUTTON_SAVE));
|
||||
this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK));
|
||||
this.area = areaParam;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ public class ErrorViewer implements NewConstants, NewConstants.Lang.ErrorViewer
|
||||
bw.write(this.area.getText());
|
||||
bw.close();
|
||||
} catch (final IOException ex) {
|
||||
ErrorViewer.showError(ex, ForgeProps.getLocalized(ERRORS.SAVE_MESSAGE));
|
||||
ErrorViewer.showError(ex, ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.ERRORS.SAVE_MESSAGE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,7 +296,7 @@ public class ErrorViewer implements NewConstants, NewConstants.Lang.ErrorViewer
|
||||
private static final long serialVersionUID = 276202595758381626L;
|
||||
|
||||
public ExitAction() {
|
||||
super(ForgeProps.getLocalized(ErrorViewer.BUTTON_EXIT));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.BUTTON_EXIT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -310,12 +310,12 @@ public class ErrorViewer implements NewConstants, NewConstants.Lang.ErrorViewer
|
||||
private static final long serialVersionUID = 5638147106706803363L;
|
||||
|
||||
public ShowAllThreadsAction() {
|
||||
super(ForgeProps.getLocalized(ErrorViewer.SHOW_ERROR));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.SHOW_ERROR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
ErrorViewer.showErrorAllThreads(ForgeProps.getLocalized(ERRORS.SHOW_MESSAGE));
|
||||
ErrorViewer.showErrorAllThreads(ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.ERRORS.SHOW_MESSAGE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class DeckEditorCommonMenu extends JMenuBar implements NewConstants {
|
||||
public final class DeckEditorCommonMenu extends JMenuBar {
|
||||
|
||||
/** Constant <code>serialVersionUID=-4037993759604768755L</code>. */
|
||||
private static final long serialVersionUID = -4037993759604768755L;
|
||||
|
||||
@@ -34,7 +34,6 @@ import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.properties.NewConstants.Lang.GuiBoosterDraft;
|
||||
import forge.view.swing.GuiHomeScreen;
|
||||
import forge.view.swing.OldGuiNewGame;
|
||||
@@ -47,7 +46,7 @@ import forge.view.swing.OldGuiNewGame;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class DeckEditorDraft extends DeckEditorBase implements NewConstants, NewConstants.Lang.GuiBoosterDraft {
|
||||
public class DeckEditorDraft extends DeckEditorBase {
|
||||
/**
|
||||
* Constant <code>serialVersionUID=-6055633915602448260L</code>.
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,6 @@ import forge.item.CardPrinted;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.quest.data.QuestData;
|
||||
|
||||
//import forge.quest.data.QuestBoosterPack;
|
||||
@@ -39,7 +38,7 @@ import forge.quest.data.QuestData;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class DeckEditorQuest extends DeckEditorBase implements NewConstants {
|
||||
public final class DeckEditorQuest extends DeckEditorBase {
|
||||
/** Constant <code>serialVersionUID=152061168634545L</code>. */
|
||||
private static final long serialVersionUID = 152061168634545L;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@ import forge.properties.NewConstants;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ReadPriceList implements NewConstants {
|
||||
public class ReadPriceList {
|
||||
|
||||
/** Constant <code>comment="//"</code>. */
|
||||
private static final String COMMENT = "//";
|
||||
@@ -44,8 +44,8 @@ public class ReadPriceList implements NewConstants {
|
||||
* </p>
|
||||
*/
|
||||
private void setup() {
|
||||
this.priceMap = this.readFile(ForgeProps.getFile(Quest.PRICE));
|
||||
this.priceMap.putAll(this.readFile(ForgeProps.getFile(Quest.BOOSTER_PRICE)));
|
||||
this.priceMap = this.readFile(ForgeProps.getFile(NewConstants.Quest.PRICE));
|
||||
this.priceMap.putAll(this.readFile(ForgeProps.getFile(NewConstants.Quest.BOOSTER_PRICE)));
|
||||
|
||||
} // setup()
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import javax.swing.border.EmptyBorder;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.quest.data.QuestData;
|
||||
import forge.quest.data.bazaar.QuestStallDefinition;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
@@ -33,7 +32,7 @@ import forge.quest.data.bazaar.QuestStallPurchasable;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestBazaarStall extends JPanel implements NewConstants {
|
||||
public class QuestBazaarStall extends JPanel {
|
||||
/** Constant <code>serialVersionUID=-4147745071116906043L</code>. */
|
||||
private static final long serialVersionUID = -4147745071116906043L;
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ import forge.quest.gui.QuestOptions;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.Lang.OldGuiNewGame {
|
||||
public class OldGuiNewGame extends JFrame {
|
||||
/** Constant <code>serialVersionUID=-2437047615019135648L</code>. */
|
||||
private static final long serialVersionUID = -2437047615019135648L;
|
||||
|
||||
@@ -141,19 +141,19 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
// use these two variables
|
||||
/** Constant <code>removeSmallCreatures</code>. */
|
||||
private static JCheckBoxMenuItem removeSmallCreatures = new JCheckBoxMenuItem(
|
||||
ForgeProps.getLocalized(MenuBar.Options.Generate.REMOVE_SMALL));
|
||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.REMOVE_SMALL));
|
||||
|
||||
/** Constant <code>removeArtifacts</code>. */
|
||||
private static JCheckBoxMenuItem removeArtifacts = new JCheckBoxMenuItem(
|
||||
ForgeProps.getLocalized(MenuBar.Options.Generate.REMOVE_ARTIFACTS));
|
||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.REMOVE_ARTIFACTS));
|
||||
/** Constant <code>useLAFFonts</code>. */
|
||||
private static JCheckBoxMenuItem useLAFFonts = new JCheckBoxMenuItem(ForgeProps.getLocalized(MenuBar.Options.FONT));
|
||||
private static JCheckBoxMenuItem useLAFFonts = new JCheckBoxMenuItem(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.FONT));
|
||||
/** Constant <code>cardOverlay</code>. */
|
||||
private static JCheckBoxMenuItem cardOverlay = new JCheckBoxMenuItem(
|
||||
ForgeProps.getLocalized(MenuBar.Options.CARD_OVERLAY));
|
||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.CARD_OVERLAY));
|
||||
/** Constant <code>cardScale</code>. */
|
||||
private static JCheckBoxMenuItem cardScale = new JCheckBoxMenuItem(
|
||||
ForgeProps.getLocalized(MenuBar.Options.CARD_SCALE));
|
||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.CARD_SCALE));
|
||||
private final JButton questButton = new JButton();
|
||||
|
||||
private final Action lookAndFeelAction = new LookAndFeelAction(this);
|
||||
@@ -220,7 +220,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
this.setSize(550, 565);
|
||||
GuiUtils.centerFrame(this);
|
||||
|
||||
this.setTitle(ForgeProps.getLocalized(Lang.PROGRAM_NAME));
|
||||
this.setTitle(ForgeProps.getLocalized(NewConstants.Lang.PROGRAM_NAME));
|
||||
this.setupMenu();
|
||||
this.setVisible(true);
|
||||
|
||||
@@ -258,7 +258,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
// useLAFFonts.setSelected(false);
|
||||
|
||||
// new stuff
|
||||
final JMenu generatedDeck = new JMenu(ForgeProps.getLocalized(MenuBar.Options.Generate.TITLE));
|
||||
final JMenu generatedDeck = new JMenu(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.TITLE));
|
||||
|
||||
generatedDeck.add(OldGuiNewGame.removeSmallCreatures);
|
||||
OldGuiNewGame.removeSmallCreatures.addActionListener(new ActionListener() {
|
||||
@@ -293,7 +293,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
}
|
||||
});
|
||||
|
||||
final JMenu helpMenu = new JMenu(ForgeProps.getLocalized(MenuBar.Help.TITLE));
|
||||
final JMenu helpMenu = new JMenu(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Help.TITLE));
|
||||
|
||||
final Action[] helpActions = { this.howToPlayAction };
|
||||
for (final Action a : helpActions) {
|
||||
@@ -402,8 +402,8 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
}
|
||||
|
||||
final String sDeckName = JOptionPane.showInputDialog(null,
|
||||
ForgeProps.getLocalized(NewGameText.SAVE_SEALED_MSG),
|
||||
ForgeProps.getLocalized(NewGameText.SAVE_SEALED_TTL), JOptionPane.QUESTION_MESSAGE);
|
||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SAVE_SEALED_MSG),
|
||||
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SAVE_SEALED_TTL), JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
deck.setName(sDeckName);
|
||||
deck.setPlayerType(PlayerType.HUMAN);
|
||||
@@ -472,7 +472,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
*/
|
||||
private void jbInit() throws Exception {
|
||||
|
||||
this.titleLabel.setText(ForgeProps.getLocalized(NewGameText.NEW_GAME));
|
||||
this.titleLabel.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.NEW_GAME));
|
||||
this.titleLabel.setFont(new java.awt.Font("Dialog", 0, 26));
|
||||
|
||||
/* CHOPPIC */
|
||||
@@ -488,10 +488,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
*/
|
||||
|
||||
/* jPanel2.setBorder(titledBorder1); */
|
||||
this.setCustomBorder(this.jPanel2, ForgeProps.getLocalized(NewGameText.GAMETYPE));
|
||||
this.setCustomBorder(this.jPanel2, ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.GAMETYPE));
|
||||
this.jPanel2.setLayout(new MigLayout("align center"));
|
||||
|
||||
this.singleRadioButton.setText(ForgeProps.getLocalized(NewGameText.CONSTRUCTED_TEXT));
|
||||
this.singleRadioButton.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.CONSTRUCTED_TEXT));
|
||||
this.singleRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
@@ -500,7 +500,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
});
|
||||
|
||||
// sealedRadioButton.setToolTipText("");
|
||||
this.sealedRadioButton.setText(ForgeProps.getLocalized(NewGameText.SEALED_TEXT));
|
||||
this.sealedRadioButton.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SEALED_TEXT));
|
||||
this.sealedRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
@@ -509,7 +509,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
});
|
||||
|
||||
// draftRadioButton.setToolTipText("");
|
||||
this.draftRadioButton.setText(ForgeProps.getLocalized(NewGameText.BOOSTER_TEXT));
|
||||
this.draftRadioButton.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.BOOSTER_TEXT));
|
||||
this.draftRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
@@ -522,24 +522,24 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
*/
|
||||
|
||||
/* jPanel1.setBorder(titledBorder2); */
|
||||
this.setCustomBorder(this.jPanel1, ForgeProps.getLocalized(NewGameText.LIBRARY));
|
||||
this.setCustomBorder(this.jPanel1, ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.LIBRARY));
|
||||
this.jPanel1.setLayout(new MigLayout("align center"));
|
||||
|
||||
this.jLabel2.setText(ForgeProps.getLocalized(NewGameText.YOURDECK));
|
||||
this.jLabel3.setText(ForgeProps.getLocalized(NewGameText.OPPONENT));
|
||||
this.jLabel2.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.YOURDECK));
|
||||
this.jLabel3.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.OPPONENT));
|
||||
|
||||
/*
|
||||
* Settings Panel
|
||||
*/
|
||||
|
||||
/* jPanel3.setBorder(titledBorder3); */
|
||||
this.setCustomBorder(this.jPanel3, ForgeProps.getLocalized(NewGameText.SETTINGS));
|
||||
this.setCustomBorder(this.jPanel3, ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SETTINGS));
|
||||
this.jPanel3.setLayout(new MigLayout("align center"));
|
||||
|
||||
// newGuiCheckBox.setText(ForgeProps.getLocalized(NEW_GAME_TEXT.NEW_GUI));
|
||||
OldGuiNewGame.getSmoothLandCheckBox().setText(ForgeProps.getLocalized(NewGameText.AI_LAND));
|
||||
OldGuiNewGame.getSmoothLandCheckBox().setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.AI_LAND));
|
||||
|
||||
OldGuiNewGame.getDevModeCheckBox().setText(ForgeProps.getLocalized(NewGameText.DEV_MODE));
|
||||
OldGuiNewGame.getDevModeCheckBox().setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.DEV_MODE));
|
||||
OldGuiNewGame.getDevModeCheckBox().addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
@@ -578,7 +578,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
*/
|
||||
|
||||
this.deckEditorButton.setFont(new java.awt.Font("Dialog", 0, 15));
|
||||
this.deckEditorButton.setText(ForgeProps.getLocalized(NewGameText.DECK_EDITOR));
|
||||
this.deckEditorButton.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.DECK_EDITOR));
|
||||
this.deckEditorButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
@@ -588,7 +588,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
|
||||
this.startButton.setFont(new java.awt.Font("Dialog", 0, 18));
|
||||
this.startButton.setHorizontalTextPosition(SwingConstants.LEADING);
|
||||
this.startButton.setText(ForgeProps.getLocalized(NewGameText.START_GAME));
|
||||
this.startButton.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.START_GAME));
|
||||
this.startButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
@@ -597,7 +597,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
});
|
||||
|
||||
this.questButton.setFont(new java.awt.Font("Dialog", 0, 18));
|
||||
this.questButton.setText(ForgeProps.getLocalized(NewGameText.QUEST_MODE));
|
||||
this.questButton.setText(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.QUEST_MODE));
|
||||
|
||||
this.getContentPane().add(this.titleLabel, "align center, span 3, grow, wrap");
|
||||
|
||||
@@ -1003,7 +1003,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* the component
|
||||
*/
|
||||
public LookAndFeelAction(final Component component) {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.LF));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.LF));
|
||||
this.c = component;
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new download price action.
|
||||
*/
|
||||
public DownloadPriceAction() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.DOWNLOADPRICE));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.DOWNLOADPRICE));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1187,7 +1187,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new download action lq.
|
||||
*/
|
||||
public DownloadActionLQ() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.DOWNLOADLQ));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.DOWNLOADLQ));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1221,7 +1221,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new download action set lq.
|
||||
*/
|
||||
public DownloadActionSetLQ() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.DOWNLOADSETLQ));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.DOWNLOADSETLQ));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1255,7 +1255,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new download action quest.
|
||||
*/
|
||||
public DownloadActionQuest() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.DOWNLOADQUESTIMG));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.DOWNLOADQUESTIMG));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1291,7 +1291,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new import picture action.
|
||||
*/
|
||||
public ImportPictureAction() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.IMPORTPICTURE));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.IMPORTPICTURE));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1329,7 +1329,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new card sizes action.
|
||||
*/
|
||||
public CardSizesAction() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.CARD_SIZES));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.CARD_SIZES));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1410,7 +1410,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new card stack action.
|
||||
*/
|
||||
public CardStackAction() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.CARD_STACK));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.CARD_STACK));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1484,7 +1484,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new card stack offset action.
|
||||
*/
|
||||
public CardStackOffsetAction() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.CARD_STACK_OFFSET));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.CARD_STACK_OFFSET));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1562,7 +1562,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new how to play action.
|
||||
*/
|
||||
public HowToPlayAction() {
|
||||
super(ForgeProps.getLocalized(Lang.HowTo.TITLE));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.HowTo.TITLE));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1580,7 +1580,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
*/
|
||||
@Override
|
||||
public final void actionPerformed(final ActionEvent e) {
|
||||
final String text = ForgeProps.getLocalized(Lang.HowTo.MESSAGE);
|
||||
final String text = ForgeProps.getLocalized(NewConstants.Lang.HowTo.MESSAGE);
|
||||
|
||||
final JTextArea area = new JTextArea(text, 25, 40);
|
||||
area.setWrapStyleWord(true);
|
||||
@@ -1588,7 +1588,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
area.setEditable(false);
|
||||
area.setOpaque(false);
|
||||
|
||||
JOptionPane.showMessageDialog(null, new JScrollPane(area), ForgeProps.getLocalized(Lang.HowTo.TITLE),
|
||||
JOptionPane.showMessageDialog(null, new JScrollPane(area), ForgeProps.getLocalized(NewConstants.Lang.HowTo.TITLE),
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
@@ -1606,7 +1606,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new about action.
|
||||
*/
|
||||
public AboutAction() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.ABOUT));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.ABOUT));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1659,7 +1659,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Instantiates a new exit action.
|
||||
*/
|
||||
public ExitAction() {
|
||||
super(ForgeProps.getLocalized(MenuBar.Menu.EXIT));
|
||||
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.EXIT));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,63 +1,78 @@
|
||||
package forge;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.card.BoosterGenerator;
|
||||
import forge.deck.Deck;
|
||||
|
||||
import forge.game.limited.IBoosterDraft;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.ItemPool;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* <p>BoosterDraftTest class.</p>
|
||||
*
|
||||
* <p>
|
||||
* BoosterDraftTest class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000, enabled = false)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false)
|
||||
public class BoosterDraftTest implements IBoosterDraft {
|
||||
|
||||
/** The n. */
|
||||
int n = 3;
|
||||
|
||||
/**
|
||||
* <p>getDecks.</p>
|
||||
*
|
||||
* <p>
|
||||
* getDecks.
|
||||
* </p>
|
||||
*
|
||||
* @return an array of {@link forge.deck.Deck} objects.
|
||||
*/
|
||||
@Override
|
||||
@Test(timeOut = 1000)
|
||||
public Deck[] getDecks() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>nextChoice.</p>
|
||||
*
|
||||
* <p>
|
||||
* nextChoice.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
@Override
|
||||
public ItemPoolView<CardPrinted> nextChoice() {
|
||||
n--;
|
||||
BoosterGenerator pack = new BoosterGenerator(SetUtils.getSetByCode("M11"));
|
||||
this.n--;
|
||||
final BoosterGenerator pack = new BoosterGenerator(SetUtils.getSetByCode("M11"));
|
||||
return ItemPool.createFrom(pack.getBoosterPack(), CardPrinted.class);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void setChoice(CardPrinted c) {
|
||||
@Override
|
||||
public void setChoice(final CardPrinted c) {
|
||||
System.out.println(c.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>hasNextChoice.</p>
|
||||
*
|
||||
* <p>
|
||||
* hasNextChoice.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNextChoice() {
|
||||
return n > 0;
|
||||
return this.n > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getChosenCards.</p>
|
||||
*
|
||||
* <p>
|
||||
* getChosenCards.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardList getChosenCards() {
|
||||
@@ -65,14 +80,19 @@ public class BoosterDraftTest implements IBoosterDraft {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getUnchosenCards.</p>
|
||||
*
|
||||
* <p>
|
||||
* getUnchosenCards.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardList getUnchosenCards() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.game.limited.IBoosterDraft#finishedDrafting()
|
||||
*/
|
||||
@Override
|
||||
public void finishedDrafting() {
|
||||
|
||||
|
||||
@@ -2,27 +2,27 @@ package forge;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
import forge.game.limited.BoosterDraft;
|
||||
import forge.game.limited.CardPoolLimitation;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.ItemPoolView;
|
||||
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000)
|
||||
public class BoosterDraft_1Test {
|
||||
|
||||
/**
|
||||
* Booster draft_1 test1.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = 1000)
|
||||
public void BoosterDraft_1Test1() throws Exception {
|
||||
BoosterDraft draft = new BoosterDraft(CardPoolLimitation.Full);
|
||||
final BoosterDraft draft = new BoosterDraft(CardPoolLimitation.Full);
|
||||
while (draft.hasNextChoice()) {
|
||||
ItemPoolView<CardPrinted> list = draft.nextChoice();
|
||||
final ItemPoolView<CardPrinted> list = draft.nextChoice();
|
||||
System.out.println(list.countAll());
|
||||
draft.setChoice(list.toFlatList().get(0));
|
||||
}
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
package forge;
|
||||
|
||||
import forge.card.mana.ManaCost;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.card.mana.ManaCost;
|
||||
|
||||
/**
|
||||
*
|
||||
* The Class CardColorTest.
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000)
|
||||
public class CardColorTest {
|
||||
|
||||
/**
|
||||
*
|
||||
* Card color test1.
|
||||
*/
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = 1000)
|
||||
public void CardColorTest1() {
|
||||
ManaCost mc = new ManaCost("R W U");
|
||||
EnumSet<Color> col = Color.convertManaCostToColor(mc);
|
||||
final ManaCost mc = new ManaCost("R W U");
|
||||
final EnumSet<Color> col = Color.convertManaCostToColor(mc);
|
||||
System.out.println(col.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
package forge;
|
||||
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import net.slightlymagic.braids.util.ClumsyRunnable;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static net.slightlymagic.braids.util.testng.BraidsAssertFunctions.assertThrowsException;
|
||||
import net.slightlymagic.braids.util.ClumsyRunnable;
|
||||
import net.slightlymagic.braids.util.testng.BraidsAssertFunctions;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
/**
|
||||
* Created by hand to test the CardReader class.
|
||||
*/
|
||||
@Test(groups = {"UnitTest"})
|
||||
public class CardReaderTest implements NewConstants {
|
||||
@Test(groups = { "UnitTest" })
|
||||
public class CardReaderTest {
|
||||
|
||||
/** The default test-timeout. */
|
||||
public static final int TEST_TIMEOUT = 1000;
|
||||
@@ -25,64 +26,85 @@ public class CardReaderTest implements NewConstants {
|
||||
/** The estimated number of cards in the cardsfolder. */
|
||||
public static final int ESTIMATED_CARDS_IN_FOLDER = 9001;
|
||||
|
||||
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
/**
|
||||
* Test_ read card_null map.
|
||||
*/
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = CardReaderTest.TEST_TIMEOUT)
|
||||
public final void test_ReadCard_nullMap() {
|
||||
final ClumsyRunnable withScissors = new ClumsyRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
new CardReader(ForgeProps.getFile(CARDSFOLDER), null);
|
||||
new CardReader(ForgeProps.getFile(NewConstants.CARDSFOLDER), null);
|
||||
}
|
||||
};
|
||||
|
||||
assertThrowsException(NullPointerException.class, withScissors);
|
||||
BraidsAssertFunctions.assertThrowsException(NullPointerException.class, withScissors);
|
||||
}
|
||||
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
/**
|
||||
* Test_ read card_null cards folder.
|
||||
*/
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = CardReaderTest.TEST_TIMEOUT)
|
||||
public final void test_ReadCard_nullCardsFolder() {
|
||||
final ClumsyRunnable withScissors = new ClumsyRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
Map<String, Card> map = new HashMap<String, Card>();
|
||||
final Map<String, Card> map = new HashMap<String, Card>();
|
||||
new CardReader(null, map);
|
||||
}
|
||||
};
|
||||
|
||||
assertThrowsException(NullPointerException.class, withScissors);
|
||||
BraidsAssertFunctions.assertThrowsException(NullPointerException.class, withScissors);
|
||||
}
|
||||
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
/**
|
||||
* Test_ read card_nonexistent cards folder.
|
||||
*/
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = CardReaderTest.TEST_TIMEOUT)
|
||||
public final void test_ReadCard_nonexistentCardsFolder() {
|
||||
final ClumsyRunnable withScissors = new ClumsyRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
Map<String, Card> map = new HashMap<String, Card>();
|
||||
new CardReader(new File(
|
||||
"this_does_not_exist_fjksdjfsdjfkdjslkfksdlajfikajfklsdhfksdalfhjklsdahfeakslfdsfdsfdsfdsfdssfc"
|
||||
), map);
|
||||
final Map<String, Card> map = new HashMap<String, Card>();
|
||||
new CardReader(
|
||||
new File(
|
||||
"this_does_not_exist_fjksdjfsdjfkdjslkfksdlajfikajfklsdhfksdalfhjklsdahfeakslfdsfdsfdsfdsfdssfc"),
|
||||
map);
|
||||
}
|
||||
};
|
||||
|
||||
assertThrowsException(RuntimeException.class, withScissors);
|
||||
BraidsAssertFunctions.assertThrowsException(RuntimeException.class, withScissors);
|
||||
}
|
||||
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
/**
|
||||
* Test_ read card_file not folder.
|
||||
*
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = CardReaderTest.TEST_TIMEOUT)
|
||||
public final void test_ReadCard_fileNotFolder() throws IOException {
|
||||
|
||||
final File tmpFile = File.createTempFile("just-a-file", ".testng.tmp");
|
||||
tmpFile.deleteOnExit(); // request VM to delete later
|
||||
tmpFile.deleteOnExit(); // request VM to delete later
|
||||
|
||||
final ClumsyRunnable withScissors = new ClumsyRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
Map<String, Card> map = new HashMap<String, Card>();
|
||||
final Map<String, Card> map = new HashMap<String, Card>();
|
||||
new CardReader(tmpFile, map);
|
||||
}
|
||||
};
|
||||
|
||||
assertThrowsException(RuntimeException.class, withScissors);
|
||||
BraidsAssertFunctions.assertThrowsException(RuntimeException.class, withScissors);
|
||||
}
|
||||
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
/**
|
||||
* Test_ read card_find card_zip.
|
||||
*/
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = CardReaderTest.TEST_TIMEOUT)
|
||||
public final void test_ReadCard_findCard_zip() {
|
||||
final Map<String, Card> map = new HashMap<String, Card>();
|
||||
final File cardsfolder = ForgeProps.getFile(CARDSFOLDER);
|
||||
final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER);
|
||||
final CardReader cardReader = new CardReader(cardsfolder, map);
|
||||
|
||||
final File zipFile = new File(cardsfolder, "cardsfolder.zip");
|
||||
@@ -95,10 +117,13 @@ public class CardReaderTest implements NewConstants {
|
||||
Assert.assertEquals(elvishWarrior.getName(), "Elvish Warrior", "name is correct");
|
||||
}
|
||||
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
/**
|
||||
* Test_ read card_find card_nonzip.
|
||||
*/
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = CardReaderTest.TEST_TIMEOUT)
|
||||
public final void test_ReadCard_findCard_nonzip() {
|
||||
final Map<String, Card> map = new HashMap<String, Card>();
|
||||
final File cardsfolder = ForgeProps.getFile(CARDSFOLDER);
|
||||
final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER);
|
||||
final CardReader cardReader = new CardReader(cardsfolder, map, null, false);
|
||||
|
||||
final Card savannahLions = cardReader.findCard("Savannah Lions");
|
||||
@@ -107,20 +132,26 @@ public class CardReaderTest implements NewConstants {
|
||||
Assert.assertEquals(savannahLions.getName(), "Savannah Lions", "name is correct");
|
||||
}
|
||||
|
||||
@Test(groups = {"slow"})
|
||||
/**
|
||||
* Test_ read card_run_nonzip.
|
||||
*/
|
||||
@Test(groups = { "slow" })
|
||||
public final void test_ReadCard_run_nonzip() {
|
||||
final Map<String, Card> map = new HashMap<String, Card>(2 * ESTIMATED_CARDS_IN_FOLDER);
|
||||
final File cardsfolder = ForgeProps.getFile(CARDSFOLDER);
|
||||
final CardReader cardReader = new CardReader(cardsfolder, map, null,false);
|
||||
final Map<String, Card> map = new HashMap<String, Card>(2 * CardReaderTest.ESTIMATED_CARDS_IN_FOLDER);
|
||||
final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER);
|
||||
final CardReader cardReader = new CardReader(cardsfolder, map, null, false);
|
||||
cardReader.run();
|
||||
Assert.assertNotNull(map.get("Elvish Warrior"), "Elvish Warrior was loaded");
|
||||
Assert.assertNotNull(map.get("Savannah Lions"), "Savannah Lions were loaded");
|
||||
}
|
||||
|
||||
@Test(groups = {"slow"})
|
||||
/**
|
||||
* Test_ read card_run_zip.
|
||||
*/
|
||||
@Test(groups = { "slow" })
|
||||
public final void test_ReadCard_run_zip() {
|
||||
final Map<String, Card> map = new HashMap<String, Card>(2 * ESTIMATED_CARDS_IN_FOLDER);
|
||||
final File cardsfolder = ForgeProps.getFile(CARDSFOLDER);
|
||||
final Map<String, Card> map = new HashMap<String, Card>(2 * CardReaderTest.ESTIMATED_CARDS_IN_FOLDER);
|
||||
final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER);
|
||||
final CardReader cardReader = new CardReader(cardsfolder, map);
|
||||
cardReader.run();
|
||||
Assert.assertNotNull(map.get("Elvish Warrior"), "Elvish Warrior was loaded");
|
||||
|
||||
@@ -1,36 +1,42 @@
|
||||
package forge;
|
||||
|
||||
import forge.deck.generate.GenerateConstructedDeck;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.deck.generate.GenerateConstructedDeck;
|
||||
|
||||
/**
|
||||
*
|
||||
* The Class GameActionTest.
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000)
|
||||
public class GameActionTest {
|
||||
|
||||
/**
|
||||
* <p>main.</p>
|
||||
* <p>
|
||||
* main.
|
||||
* </p>
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 5000)
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = 5000)
|
||||
public void GameActionTest1() throws Exception {
|
||||
System.out.println("GameActionTest");
|
||||
GameAction gameAction = new GameAction();
|
||||
GenerateConstructedDeck gen = new GenerateConstructedDeck();
|
||||
final GameAction gameAction = new GameAction();
|
||||
final GenerateConstructedDeck gen = new GenerateConstructedDeck();
|
||||
|
||||
for (int i = 0; i < 2000; i++) {
|
||||
CardList list = gen.generateDeck();
|
||||
final CardList list = gen.generateDeck();
|
||||
|
||||
Card[] card = gameAction.smoothComputerManaCurve(list.toArray());
|
||||
final Card[] card = gameAction.smoothComputerManaCurve(list.toArray());
|
||||
|
||||
CardList check = new CardList();
|
||||
for (int a = 0; a < 30; a++)
|
||||
final CardList check = new CardList();
|
||||
for (int a = 0; a < 30; a++) {
|
||||
check.add(card[a]);
|
||||
}
|
||||
|
||||
if (check.getType("Land").size() != 7) {
|
||||
System.out.println("error - " + check);
|
||||
break;
|
||||
}
|
||||
}//for
|
||||
}// for
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,29 @@
|
||||
package forge;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.deck.Deck;
|
||||
import forge.game.GameType;
|
||||
import forge.game.limited.BoosterDraft;
|
||||
import forge.game.limited.CardPoolLimitation;
|
||||
import forge.gui.deckeditor.DeckEditorDraft;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
*/
|
||||
@Test(groups = {"UnitTest"})
|
||||
@Test(groups = { "UnitTest" })
|
||||
public class GuiBoosterDraftTest {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Gui booster draft test1.
|
||||
*/
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void GuiBoosterDraftTest1() {
|
||||
@Test(groups = { "UnitTest", "fast" })
|
||||
public void guiBoosterDraftTest1() {
|
||||
Constant.Runtime.setGameType(GameType.Draft);
|
||||
Constant.Runtime.HUMAN_DECK[0] = new Deck(GameType.Sealed);
|
||||
|
||||
DeckEditorDraft g = new DeckEditorDraft();
|
||||
final DeckEditorDraft g = new DeckEditorDraft();
|
||||
g.showGui(new BoosterDraft(CardPoolLimitation.Full));
|
||||
Assert.assertNotNull(g);
|
||||
g.dispose();
|
||||
|
||||
@@ -3,18 +3,16 @@ package forge;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000, enabled = false)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false)
|
||||
public class GuiDownloadPicturesLQTest {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Gui download pictures test1.
|
||||
*/
|
||||
@Test(enabled = false, timeOut = 1000)
|
||||
public void GuiDownloadPicturesTest1() {
|
||||
public void GuiDownloadPicturesTest1() {
|
||||
new GuiDownloadPicturesLQ(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package forge;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000, enabled = false)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false)
|
||||
public class GuiDownloadSetPicturesLQTest {
|
||||
|
||||
/**
|
||||
*
|
||||
* Gui download set pictures lq test1.
|
||||
*/
|
||||
@Test(enabled = false, timeOut = 1000)
|
||||
public void GuiDownloadSetPicturesLQTest1() {
|
||||
|
||||
@@ -3,18 +3,16 @@ package forge;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000, enabled = false)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false)
|
||||
public class GuiMigrateLocalMWSSetPicturesHQTest {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Gui migrate local mws set pictures h q1.
|
||||
*/
|
||||
@Test(enabled = false, timeOut = 1000)
|
||||
public void GuiMigrateLocalMWSSetPicturesHQ1() {
|
||||
public void GuiMigrateLocalMWSSetPicturesHQ1() {
|
||||
GuiMigrateLocalMWSSetPicturesHQ.startDownload(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,17 @@ package forge;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000, enabled = false)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false)
|
||||
public class GuiMultipleBlockers4Test {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Gui multiple blockers4 test1.
|
||||
*/
|
||||
@Test(timeOut = 1000, enabled = false)
|
||||
public void GuiMultipleBlockers4Test1() {
|
||||
CardList list = new CardList();
|
||||
final CardList list = new CardList();
|
||||
list.add(AllZone.getCardFactory().getCard("Elvish Piper", null));
|
||||
list.add(AllZone.getCardFactory().getCard("Lantern Kami", null));
|
||||
list.add(AllZone.getCardFactory().getCard("Frostling", null));
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
package forge;
|
||||
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
*/
|
||||
@Test(groups = {"UnitTest"})
|
||||
@Test(groups = { "UnitTest" })
|
||||
public class GuiProgressBarWindowTest {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Gui progress bar window test1.
|
||||
*/
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
@Test(groups = { "UnitTest", "fast" })
|
||||
public void GuiProgressBarWindowTest1() {
|
||||
try {
|
||||
GuiProgressBarWindow dialog = new GuiProgressBarWindow();
|
||||
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
final GuiProgressBarWindow dialog = new GuiProgressBarWindow();
|
||||
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
dialog.setVisible(true);
|
||||
Assert.assertNotNull(dialog);
|
||||
dialog.dispose();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,18 +6,17 @@ import org.testng.annotations.Test;
|
||||
import forge.quest.gui.QuestOptions;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
*/
|
||||
@Test(groups = {"UnitTest"})
|
||||
@Test(groups = { "UnitTest" })
|
||||
public class GuiQuestOptionsTest {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Gui quest options test1.
|
||||
*/
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
@Test(groups = { "UnitTest", "fast" })
|
||||
public void GuiQuestOptionsTest1() {
|
||||
QuestOptions dialog = new QuestOptions();
|
||||
final QuestOptions dialog = new QuestOptions();
|
||||
dialog.setVisible(true);
|
||||
Assert.assertNotNull(dialog);
|
||||
dialog.dispose();
|
||||
|
||||
@@ -1,63 +1,73 @@
|
||||
package forge;
|
||||
|
||||
import forge.error.ErrorViewer;
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.*;
|
||||
|
||||
import forge.error.ErrorViewer;
|
||||
|
||||
/**
|
||||
* <p>PanelTest class.</p>
|
||||
*
|
||||
* <p>
|
||||
* PanelTest class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000, enabled = false)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false)
|
||||
public class PanelTest extends JFrame {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private JPanel jPanel1 = new JPanel();
|
||||
private JLabel jLabel1 = new JLabel();
|
||||
private final JPanel jPanel1 = new JPanel();
|
||||
private final JLabel jLabel1 = new JLabel();
|
||||
|
||||
/**
|
||||
*
|
||||
* Phase test1.
|
||||
*/
|
||||
@Test(timeOut = 1000, enabled = false)
|
||||
public void PhaseTest1() {
|
||||
PanelTest p = new PanelTest();
|
||||
final PanelTest p = new PanelTest();
|
||||
p.setSize(300, 300);
|
||||
p.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for PanelTest.</p>
|
||||
* <p>
|
||||
* Constructor for PanelTest.
|
||||
* </p>
|
||||
*/
|
||||
public PanelTest() {
|
||||
try {
|
||||
jbInit();
|
||||
} catch (Exception ex) {
|
||||
this.jbInit();
|
||||
} catch (final Exception ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>jbInit.</p>
|
||||
*
|
||||
* @throws java.lang.Exception if any.
|
||||
* <p>
|
||||
* jbInit.
|
||||
* </p>
|
||||
*
|
||||
* @throws java.lang.Exception
|
||||
* if any.
|
||||
*/
|
||||
private void jbInit() throws Exception {
|
||||
this.getContentPane().setLayout(null);
|
||||
jPanel1.setForeground(Color.orange);
|
||||
jPanel1.setBounds(new Rectangle(15, 36, 252, 156));
|
||||
jLabel1.setFont(new java.awt.Font("Dialog", 1, 12));
|
||||
jLabel1.setForeground(new Color(70, 90, 163));
|
||||
jLabel1.setText("jLabel1");
|
||||
this.getContentPane().add(jPanel1, null);
|
||||
jPanel1.add(jLabel1, null);
|
||||
this.jPanel1.setForeground(Color.orange);
|
||||
this.jPanel1.setBounds(new Rectangle(15, 36, 252, 156));
|
||||
this.jLabel1.setFont(new java.awt.Font("Dialog", 1, 12));
|
||||
this.jLabel1.setForeground(new Color(70, 90, 163));
|
||||
this.jLabel1.setText("jLabel1");
|
||||
this.getContentPane().add(this.jPanel1, null);
|
||||
this.jPanel1.add(this.jLabel1, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,18 +3,17 @@ package forge;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 5000, enabled = false)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 5000, enabled = false)
|
||||
public class PhaseTest {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Phase test1.
|
||||
*/
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 5000, enabled = false)
|
||||
@Test(groups = { "UnitTest", "fast" }, timeOut = 5000, enabled = false)
|
||||
public void PhaseTest1() {
|
||||
Phase phase = new Phase();
|
||||
final Phase phase = new Phase();
|
||||
for (int i = 0; i < phase.getPhaseOrder().length; i++) {
|
||||
System.out.println(phase.getPlayerTurn() + " " + phase.getPhase());
|
||||
phase.nextPhase();
|
||||
|
||||
@@ -1,251 +1,263 @@
|
||||
package forge;
|
||||
|
||||
import forge.card.cardfactory.CardFactoryInterface;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.gui.input.InputPayManaCostUtil;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.card.cardfactory.CardFactoryInterface;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.gui.input.InputPayManaCostUtil;
|
||||
|
||||
/**
|
||||
* <p>RunTest class.</p>
|
||||
*
|
||||
* <p>
|
||||
* RunTest class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000, enabled = false)
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false)
|
||||
public class RunTest {
|
||||
//@SuppressWarnings("unchecked") // HashSet needs <type>
|
||||
// @SuppressWarnings("unchecked") // HashSet needs <type>
|
||||
|
||||
/**
|
||||
* <p>test.</p>
|
||||
* <p>
|
||||
* test.
|
||||
* </p>
|
||||
*/
|
||||
@Test(timeOut = 1000, enabled = false)
|
||||
void test() {
|
||||
{
|
||||
Card c;
|
||||
CardFactoryInterface cf = AllZone.getCardFactory();
|
||||
//********* test Card
|
||||
final CardFactoryInterface cf = AllZone.getCardFactory();
|
||||
// ********* test Card
|
||||
c = cf.getCard("Elvish Warrior", AllZone.getComputerPlayer());
|
||||
check("1", c.getOwner().isComputer());
|
||||
check("1.1", c.getName().equals("Elvish Warrior"));
|
||||
check("2", c.getManaCost().equals("G G"));
|
||||
check("2.1", c.isCreature());
|
||||
check("2.2", c.isType("Elf"));
|
||||
check("2.3", c.isType("Warrior"));
|
||||
check("3", c.getText().equals(""));
|
||||
check("4", c.getNetAttack() == 2);
|
||||
check("5", c.getNetDefense() == 3);
|
||||
check("6", c.getKeyword().isEmpty());
|
||||
this.check("1", c.getOwner().isComputer());
|
||||
this.check("1.1", c.getName().equals("Elvish Warrior"));
|
||||
this.check("2", c.getManaCost().equals("G G"));
|
||||
this.check("2.1", c.isCreature());
|
||||
this.check("2.2", c.isType("Elf"));
|
||||
this.check("2.3", c.isType("Warrior"));
|
||||
this.check("3", c.getText().equals(""));
|
||||
this.check("4", c.getNetAttack() == 2);
|
||||
this.check("5", c.getNetDefense() == 3);
|
||||
this.check("6", c.getKeyword().isEmpty());
|
||||
|
||||
c = cf.getCard("Shock", null);
|
||||
check("14", c.isInstant());
|
||||
//check("15", c.getText().equals("Shock deals 2 damge to target creature or player."));
|
||||
this.check("14", c.isInstant());
|
||||
// check("15",
|
||||
// c.getText().equals("Shock deals 2 damge to target creature or player."));
|
||||
|
||||
c = cf.getCard("Bayou", null);
|
||||
check("17", c.getManaCost().equals(""));
|
||||
check("18", c.isLand());
|
||||
check("19", c.isType("Swamp"));
|
||||
check("20", c.isType("Forest"));
|
||||
this.check("17", c.getManaCost().equals(""));
|
||||
this.check("18", c.isLand());
|
||||
this.check("19", c.isType("Swamp"));
|
||||
this.check("20", c.isType("Forest"));
|
||||
|
||||
//********* test ManaCost
|
||||
// ********* test ManaCost
|
||||
ManaCost manaCost = new ManaCost("G");
|
||||
check("21", !manaCost.isPaid());
|
||||
this.check("21", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.GREEN);
|
||||
check("22", manaCost.isPaid());
|
||||
this.check("22", manaCost.isPaid());
|
||||
|
||||
manaCost = new ManaCost("7");
|
||||
check("23", !manaCost.isPaid());
|
||||
this.check("23", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLACK);
|
||||
check("24", !manaCost.isPaid());
|
||||
this.check("24", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLUE);
|
||||
check("25", !manaCost.isPaid());
|
||||
this.check("25", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.COLORLESS);
|
||||
check("26", !manaCost.isPaid());
|
||||
this.check("26", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.GREEN);
|
||||
check("27", !manaCost.isPaid());
|
||||
this.check("27", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.RED);
|
||||
check("28", !manaCost.isPaid());
|
||||
this.check("28", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.WHITE);
|
||||
check("29", !manaCost.isPaid());
|
||||
this.check("29", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.WHITE);
|
||||
check("30", manaCost.isPaid());
|
||||
this.check("30", manaCost.isPaid());
|
||||
|
||||
manaCost = new ManaCost("2 W W G G B B U U R R");
|
||||
check("31", !manaCost.isPaid());
|
||||
this.check("31", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.WHITE);
|
||||
check("32", !manaCost.isPaid());
|
||||
this.check("32", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.WHITE);
|
||||
check("32.1", !manaCost.isPaid());
|
||||
this.check("32.1", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLACK);
|
||||
check("33", !manaCost.isPaid());
|
||||
this.check("33", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLACK);
|
||||
check("34", !manaCost.isPaid());
|
||||
this.check("34", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLUE);
|
||||
check("35", !manaCost.isPaid());
|
||||
this.check("35", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLUE);
|
||||
check("36", !manaCost.isPaid());
|
||||
this.check("36", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.GREEN);
|
||||
check("37", !manaCost.isPaid());
|
||||
this.check("37", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.GREEN);
|
||||
check("38", !manaCost.isPaid());
|
||||
this.check("38", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.RED);
|
||||
check("39", !manaCost.isPaid());
|
||||
this.check("39", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.RED);
|
||||
check("40", !manaCost.isPaid());
|
||||
this.check("40", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.RED);
|
||||
check("41", !manaCost.isPaid());
|
||||
this.check("41", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLUE);
|
||||
check("42", manaCost.isPaid());
|
||||
this.check("42", manaCost.isPaid());
|
||||
|
||||
manaCost = new ManaCost("G G");
|
||||
check("43", !manaCost.isPaid());
|
||||
this.check("43", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.GREEN);
|
||||
check("44", !manaCost.isPaid());
|
||||
this.check("44", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.GREEN);
|
||||
check("45", manaCost.isPaid());
|
||||
this.check("45", manaCost.isPaid());
|
||||
|
||||
manaCost = new ManaCost("1 U B");
|
||||
check("45", !manaCost.isPaid());
|
||||
this.check("45", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLACK);
|
||||
check("46", !manaCost.isPaid());
|
||||
this.check("46", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLUE);
|
||||
check("47", !manaCost.isPaid());
|
||||
this.check("47", !manaCost.isPaid());
|
||||
manaCost.payMana(Constant.Color.BLUE);
|
||||
check("48", manaCost.isPaid());
|
||||
this.check("48", manaCost.isPaid());
|
||||
|
||||
//********* test CardUtil.getColors()
|
||||
// ********* test CardUtil.getColors()
|
||||
c = new Card();
|
||||
c.setManaCost("G");
|
||||
ArrayList<String> color = CardUtil.getColors(c);
|
||||
check("49", color.contains(Constant.Color.GREEN));
|
||||
check("50", color.size() == 1);
|
||||
this.check("49", color.contains(Constant.Color.GREEN));
|
||||
this.check("50", color.size() == 1);
|
||||
|
||||
c = new Card();
|
||||
c.setManaCost("W B G R U");
|
||||
color = CardUtil.getColors(c);
|
||||
Set<String> set = new HashSet<String>(color);
|
||||
final Set<String> set = new HashSet<String>(color);
|
||||
System.out.println("color: " + color);
|
||||
check("51", set.size() == 5);
|
||||
check("52", color.contains(Constant.Color.BLACK));
|
||||
check("53", color.contains(Constant.Color.BLUE));
|
||||
check("54", color.contains(Constant.Color.GREEN));
|
||||
check("55", color.contains(Constant.Color.RED));
|
||||
check("56", color.contains(Constant.Color.WHITE));
|
||||
this.check("51", set.size() == 5);
|
||||
this.check("52", color.contains(Constant.Color.BLACK));
|
||||
this.check("53", color.contains(Constant.Color.BLUE));
|
||||
this.check("54", color.contains(Constant.Color.GREEN));
|
||||
this.check("55", color.contains(Constant.Color.RED));
|
||||
this.check("56", color.contains(Constant.Color.WHITE));
|
||||
|
||||
c = new Card();
|
||||
c.setManaCost("2");
|
||||
color = CardUtil.getColors(c);
|
||||
check("57", color.size() == 1);
|
||||
check("58", color.contains(Constant.Color.COLORLESS));
|
||||
this.check("57", color.size() == 1);
|
||||
this.check("58", color.contains(Constant.Color.COLORLESS));
|
||||
|
||||
c = new Card();
|
||||
color = CardUtil.getColors(c);
|
||||
check("59", color.size() == 1);
|
||||
check("60", color.contains(Constant.Color.COLORLESS));
|
||||
this.check("59", color.size() == 1);
|
||||
this.check("60", color.contains(Constant.Color.COLORLESS));
|
||||
|
||||
c = new Card();
|
||||
c.setManaCost("");
|
||||
color = CardUtil.getColors(c);
|
||||
check("61", color.size() == 1);
|
||||
check("62", color.contains(Constant.Color.COLORLESS));
|
||||
this.check("61", color.size() == 1);
|
||||
this.check("62", color.contains(Constant.Color.COLORLESS));
|
||||
|
||||
c = cf.getCard("Bayou", null);
|
||||
color = CardUtil.getColors(c);
|
||||
check("63", color.size() == 1);
|
||||
check("64", color.contains(Constant.Color.COLORLESS));
|
||||
this.check("63", color.size() == 1);
|
||||
this.check("64", color.contains(Constant.Color.COLORLESS));
|
||||
|
||||
c = cf.getCard("Elvish Warrior", null);
|
||||
color = CardUtil.getColors(c);
|
||||
check("65", color.size() == 1);
|
||||
check("66", color.contains(Constant.Color.GREEN));
|
||||
this.check("65", color.size() == 1);
|
||||
this.check("66", color.contains(Constant.Color.GREEN));
|
||||
|
||||
c = new Card();
|
||||
c.setManaCost("11 W W B B U U R R G G");
|
||||
color = CardUtil.getColors(c);
|
||||
check("67", color.size() == 5);
|
||||
this.check("67", color.size() == 5);
|
||||
|
||||
c = new Card();
|
||||
c = cf.getCard("Elvish Warrior", null);
|
||||
c.setManaCost("11");
|
||||
color = CardUtil.getColors(c);
|
||||
check("68", color.size() == 1);
|
||||
check("69", color.contains(Constant.Color.COLORLESS));
|
||||
this.check("68", color.size() == 1);
|
||||
this.check("69", color.contains(Constant.Color.COLORLESS));
|
||||
|
||||
check("70", c.isCreature());
|
||||
check("71", !c.isArtifact());
|
||||
check("72", !c.isBasicLand());
|
||||
check("73", !c.isEnchantment());
|
||||
check("74", !c.isGlobalEnchantment());
|
||||
check("75", !c.isInstant());
|
||||
check("76", !c.isLand());
|
||||
check("77", !c.isAura());
|
||||
check("78", c.isPermanent());
|
||||
check("79", !c.isSorcery());
|
||||
check("80", !c.isTapped());
|
||||
check("81", c.isUntapped());
|
||||
this.check("70", c.isCreature());
|
||||
this.check("71", !c.isArtifact());
|
||||
this.check("72", !c.isBasicLand());
|
||||
this.check("73", !c.isEnchantment());
|
||||
this.check("74", !c.isGlobalEnchantment());
|
||||
this.check("75", !c.isInstant());
|
||||
this.check("76", !c.isLand());
|
||||
this.check("77", !c.isAura());
|
||||
this.check("78", c.isPermanent());
|
||||
this.check("79", !c.isSorcery());
|
||||
this.check("80", !c.isTapped());
|
||||
this.check("81", c.isUntapped());
|
||||
|
||||
c = cf.getCard("Swamp", null);
|
||||
check("82", c.isBasicLand());
|
||||
check("83", c.isLand());
|
||||
this.check("82", c.isBasicLand());
|
||||
this.check("83", c.isLand());
|
||||
|
||||
c = cf.getCard("Bayou", null);
|
||||
check("84", !c.isBasicLand());
|
||||
check("85", c.isLand());
|
||||
this.check("84", !c.isBasicLand());
|
||||
this.check("85", c.isLand());
|
||||
|
||||
c = cf.getCard("Shock", null);
|
||||
check("86", !c.isCreature());
|
||||
check("87", !c.isArtifact());
|
||||
check("88", !c.isBasicLand());
|
||||
check("89", !c.isEnchantment());
|
||||
check("90", !c.isGlobalEnchantment());
|
||||
check("91", c.isInstant());
|
||||
check("92", !c.isLand());
|
||||
check("93", !c.isAura());
|
||||
check("94", !c.isPermanent());
|
||||
check("95", !c.isSorcery());
|
||||
check("96", !c.isTapped());
|
||||
check("97", c.isUntapped());
|
||||
this.check("86", !c.isCreature());
|
||||
this.check("87", !c.isArtifact());
|
||||
this.check("88", !c.isBasicLand());
|
||||
this.check("89", !c.isEnchantment());
|
||||
this.check("90", !c.isGlobalEnchantment());
|
||||
this.check("91", c.isInstant());
|
||||
this.check("92", !c.isLand());
|
||||
this.check("93", !c.isAura());
|
||||
this.check("94", !c.isPermanent());
|
||||
this.check("95", !c.isSorcery());
|
||||
this.check("96", !c.isTapped());
|
||||
this.check("97", c.isUntapped());
|
||||
|
||||
//test Input_PayManaCostUtil
|
||||
check("98", InputPayManaCostUtil.getLongColorString("G").equals(Constant.Color.GREEN));
|
||||
check("99", InputPayManaCostUtil.getLongColorString("1").equals(Constant.Color.COLORLESS));
|
||||
// test Input_PayManaCostUtil
|
||||
this.check("98", InputPayManaCostUtil.getLongColorString("G").equals(Constant.Color.GREEN));
|
||||
this.check("99", InputPayManaCostUtil.getLongColorString("1").equals(Constant.Color.COLORLESS));
|
||||
|
||||
/*
|
||||
check("101", Input_PayManaCostUtil.isManaNeeded(Constant.Color.Green, new ManaCost("5")) == true);
|
||||
check("102", Input_PayManaCostUtil.isManaNeeded(Constant.Color.Blue, new ManaCost("4")) == true);
|
||||
check("103", Input_PayManaCostUtil.isManaNeeded(Constant.Color.White, new ManaCost("3")) == true);
|
||||
check("104", Input_PayManaCostUtil.isManaNeeded(Constant.Color.Black, new ManaCost("2")) == true);
|
||||
check("105", Input_PayManaCostUtil.isManaNeeded(Constant.Color.Red, new ManaCost("1")) == true);
|
||||
*/
|
||||
* check("101",
|
||||
* Input_PayManaCostUtil.isManaNeeded(Constant.Color.Green, new
|
||||
* ManaCost("5")) == true); check("102",
|
||||
* Input_PayManaCostUtil.isManaNeeded(Constant.Color.Blue, new
|
||||
* ManaCost("4")) == true); check("103",
|
||||
* Input_PayManaCostUtil.isManaNeeded(Constant.Color.White, new
|
||||
* ManaCost("3")) == true); check("104",
|
||||
* Input_PayManaCostUtil.isManaNeeded(Constant.Color.Black, new
|
||||
* ManaCost("2")) == true); check("105",
|
||||
* Input_PayManaCostUtil.isManaNeeded(Constant.Color.Red, new
|
||||
* ManaCost("1")) == true);
|
||||
*/
|
||||
/*
|
||||
ManaCost cost = new ManaCost("1 B B");
|
||||
Input_PayManaCostUtil.isManaNeeded(Constant.Color.Black, cost);
|
||||
cost.subtractMana(Constant.Color.Black);
|
||||
cost.subtractMana(Constant.Color.Green);
|
||||
check("106", Input_PayManaCostUtil.isManaNeeded(Constant.Color.Green, cost) == false);
|
||||
*/
|
||||
* ManaCost cost = new ManaCost("1 B B");
|
||||
* Input_PayManaCostUtil.isManaNeeded(Constant.Color.Black, cost);
|
||||
* cost.subtractMana(Constant.Color.Black);
|
||||
* cost.subtractMana(Constant.Color.Green); check("106",
|
||||
* Input_PayManaCostUtil.isManaNeeded(Constant.Color.Green, cost) ==
|
||||
* false);
|
||||
*/
|
||||
|
||||
c = new Card();
|
||||
Card c2 = new Card();
|
||||
c.addIntrinsicKeyword("Flying");
|
||||
c2.addIntrinsicKeyword("Flying");
|
||||
//check("107", CombatUtil.canBlock(c, c2));
|
||||
//check("108", CombatUtil.canBlock(c2, c));
|
||||
// check("107", CombatUtil.canBlock(c, c2));
|
||||
// check("108", CombatUtil.canBlock(c2, c));
|
||||
|
||||
c = new Card();
|
||||
c2 = new Card();
|
||||
c2.addIntrinsicKeyword("Flying");
|
||||
check("109", CombatUtil.canBlock(c, c2));
|
||||
check("110", !CombatUtil.canBlock(c2, c));
|
||||
|
||||
this.check("109", CombatUtil.canBlock(c, c2));
|
||||
this.check("110", !CombatUtil.canBlock(c2, c));
|
||||
|
||||
c = cf.getCard("Fyndhorn Elves", null);
|
||||
c2 = cf.getCard("Talas Warrior", null);
|
||||
check("110a", !CombatUtil.canBlock(c2, c));
|
||||
check("110b", CombatUtil.canBlock(c, c2));
|
||||
this.check("110a", !CombatUtil.canBlock(c2, c));
|
||||
this.check("110b", CombatUtil.canBlock(c, c2));
|
||||
|
||||
c = new Card();
|
||||
c.setName("1");
|
||||
@@ -254,79 +266,84 @@ public class RunTest {
|
||||
c2.setName("2");
|
||||
c2.setUniqueNumber(2);
|
||||
|
||||
//test CardList
|
||||
CardList cardList = new CardList(new Card[]
|
||||
{c, c2});
|
||||
check("111", cardList.contains(c));
|
||||
check("112", cardList.contains(c2));
|
||||
check("113", cardList.containsName(c));
|
||||
check("114", cardList.containsName(c.getName()));
|
||||
check("115", cardList.containsName(c2));
|
||||
check("116", cardList.containsName(c2.getName()));
|
||||
// test CardList
|
||||
final CardList cardList = new CardList(new Card[] { c, c2 });
|
||||
this.check("111", cardList.contains(c));
|
||||
this.check("112", cardList.contains(c2));
|
||||
this.check("113", cardList.containsName(c));
|
||||
this.check("114", cardList.containsName(c.getName()));
|
||||
this.check("115", cardList.containsName(c2));
|
||||
this.check("116", cardList.containsName(c2.getName()));
|
||||
|
||||
c = new Card();
|
||||
check("117", c.hasSickness() == true);
|
||||
this.check("117", c.hasSickness() == true);
|
||||
c.addIntrinsicKeyword("Haste");
|
||||
check("118", c.hasSickness() == false);
|
||||
|
||||
this.check("118", c.hasSickness() == false);
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
CardFactoryInterface cf = AllZone.getCardFactory();
|
||||
CardList c1 = new CardList();
|
||||
final CardFactoryInterface cf = AllZone.getCardFactory();
|
||||
final CardList c1 = new CardList();
|
||||
c1.add(cf.getCard("Shock", null));
|
||||
c1.add(cf.getCard("Royal Assassin", null));
|
||||
c1.add(cf.getCard("Hymn to Tourach", null));
|
||||
|
||||
CardList c2 = c1.filter(new CardListFilter() {
|
||||
public boolean addCard(Card c) {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isCreature();
|
||||
}
|
||||
});
|
||||
check("119", c2.containsName("Royal Assassin"));
|
||||
check("119", c2.size() == 1);
|
||||
this.check("119", c2.containsName("Royal Assassin"));
|
||||
this.check("119", c2.size() == 1);
|
||||
|
||||
c2 = c1.filter(new CardListFilter() {
|
||||
public boolean addCard(Card c) {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isInstant();
|
||||
}
|
||||
});
|
||||
check("120", c2.containsName("Shock"));
|
||||
check("121", c2.size() == 1);
|
||||
this.check("120", c2.containsName("Shock"));
|
||||
this.check("121", c2.size() == 1);
|
||||
|
||||
c2 = c1.filter(new CardListFilter() {
|
||||
public boolean addCard(Card c) {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return c.getName().equals("Hymn to Tourach");
|
||||
}
|
||||
});
|
||||
check("120", c2.containsName("Hymn to Tourach"));
|
||||
check("121", c2.size() == 1);
|
||||
this.check("120", c2.containsName("Hymn to Tourach"));
|
||||
this.check("121", c2.size() == 1);
|
||||
|
||||
Card card = cf.getCard("Sylvan Basilisk", null);
|
||||
Card card2 = cf.getCard("Exalted Angel", null);
|
||||
final Card card = cf.getCard("Sylvan Basilisk", null);
|
||||
final Card card2 = cf.getCard("Exalted Angel", null);
|
||||
|
||||
check("121a", !CombatUtil.canDestroyAttacker(card, card2, null, false));
|
||||
this.check("121a", !CombatUtil.canDestroyAttacker(card, card2, null, false));
|
||||
}
|
||||
{
|
||||
check("122", CardUtil.getConvertedManaCost("0") == 0);
|
||||
check("123", CardUtil.getConvertedManaCost("R") == 1);
|
||||
check("124", CardUtil.getConvertedManaCost("R R") == 2);
|
||||
check("125", CardUtil.getConvertedManaCost("R R R") == 3);
|
||||
check("126", CardUtil.getConvertedManaCost("1") == 1);
|
||||
check("127", CardUtil.getConvertedManaCost("2/R 2/G 2/W 2/B 2/U") == 10);
|
||||
this.check("122", CardUtil.getConvertedManaCost("0") == 0);
|
||||
this.check("123", CardUtil.getConvertedManaCost("R") == 1);
|
||||
this.check("124", CardUtil.getConvertedManaCost("R R") == 2);
|
||||
this.check("125", CardUtil.getConvertedManaCost("R R R") == 3);
|
||||
this.check("126", CardUtil.getConvertedManaCost("1") == 1);
|
||||
this.check("127", CardUtil.getConvertedManaCost("2/R 2/G 2/W 2/B 2/U") == 10);
|
||||
}
|
||||
}//test()
|
||||
}// test()
|
||||
|
||||
/**
|
||||
* <p>check.</p>
|
||||
*
|
||||
* @param message a {@link java.lang.String} object.
|
||||
* @param ok a boolean.
|
||||
* <p>
|
||||
* check.
|
||||
* </p>
|
||||
*
|
||||
* @param message
|
||||
* a {@link java.lang.String} object.
|
||||
* @param ok
|
||||
* a boolean.
|
||||
*/
|
||||
void check(String message, boolean ok) {
|
||||
void check(final String message, final boolean ok) {
|
||||
if (!ok) {
|
||||
//throw new RuntimeException("RunTest test error : " +message);
|
||||
// throw new RuntimeException("RunTest test error : " +message);
|
||||
System.out.println("RunTest test error : " + message);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ import org.testng.annotations.Test;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
@Test(groups = {"UnitTest"})
|
||||
@Test(groups = { "UnitTest" })
|
||||
public class TinyTest {
|
||||
/**
|
||||
* Just a quick test to see if TestNG and Assert are working.
|
||||
*/
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
@Test(groups = { "UnitTest", "fast" })
|
||||
public void test_true() {
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
package forge.card.cardFactory;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.slightlymagic.braids.util.ClumsyRunnable;
|
||||
import net.slightlymagic.braids.util.testng.BraidsAssertFunctions;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
import forge.card.cardfactory.CardFactoryInterface;
|
||||
@@ -8,28 +18,24 @@ import forge.card.cardfactory.PreloadingCardFactory;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.view.swing.OldGuiNewGame;
|
||||
import net.slightlymagic.braids.util.ClumsyRunnable;
|
||||
import net.slightlymagic.braids.util.testng.BraidsAssertFunctions;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
//import net.slightlymagic.braids.testng.BraidsAssertFunctions;
|
||||
|
||||
/**
|
||||
* <p>Mana_PartTest class.</p>
|
||||
*
|
||||
* <p>
|
||||
* Mana_PartTest class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
@Test(groups = {"UnitTest" }, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS)
|
||||
public class CardFactoryTest implements NewConstants {
|
||||
@Test(groups = { "UnitTest" }, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS)
|
||||
public class CardFactoryTest {
|
||||
|
||||
/** The default time to allow a test to run before TestNG ignores it. */
|
||||
public static final int DEFAULT_TEST_TIMEOUT_MS = 5000; // NOPMD by Braids on 8/18/11 11:43 PM
|
||||
public static final int DEFAULT_TEST_TIMEOUT_MS = 5000; // NOPMD by Braids
|
||||
// on 8/18/11 11:43
|
||||
// PM
|
||||
|
||||
private transient CardFactoryInterface factory;
|
||||
|
||||
@@ -39,16 +45,16 @@ public class CardFactoryTest implements NewConstants {
|
||||
@BeforeMethod
|
||||
public final void setUp() {
|
||||
OldGuiNewGame.loadDynamicGamedata();
|
||||
factory = new LazyCardFactory(ForgeProps.getFile(CARDSFOLDER));
|
||||
this.factory = new LazyCardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER));
|
||||
}
|
||||
|
||||
/**
|
||||
* Just a quick test to see if Arc-Slogger is in the database, and if it
|
||||
* has the correct owner.
|
||||
* Just a quick test to see if Arc-Slogger is in the database, and if it has
|
||||
* the correct owner.
|
||||
*/
|
||||
@Test(enabled = true, timeOut = DEFAULT_TEST_TIMEOUT_MS)
|
||||
@Test(enabled = true, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS)
|
||||
public final void test_getCard_1() { // NOPMD by Braids on 8/18/11 11:39 PM
|
||||
final Card card = factory.getCard("Arc-Slogger", null);
|
||||
final Card card = this.factory.getCard("Arc-Slogger", null);
|
||||
Assert.assertNotNull(card, "card is not null");
|
||||
Assert.assertNull(card.getOwner(), "card has correct owner");
|
||||
}
|
||||
@@ -56,38 +62,55 @@ public class CardFactoryTest implements NewConstants {
|
||||
/**
|
||||
* Make sure the method throws an exception when it's supposed to.
|
||||
*/
|
||||
@Test(enabled = true, timeOut = DEFAULT_TEST_TIMEOUT_MS)
|
||||
public final void test_getRandomCombinationWithoutRepetition_tooLarge() { // NOPMD by Braids on 8/18/11 11:39 PM
|
||||
BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class,
|
||||
new ClumsyRunnable() {
|
||||
public void run() throws Exception { // NOPMD by Braids on 8/18/11 11:40 PM
|
||||
factory.getRandomCombinationWithoutRepetition(factory.size());
|
||||
@Test(enabled = true, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS)
|
||||
public final void test_getRandomCombinationWithoutRepetition_tooLarge() { // NOPMD
|
||||
// by
|
||||
// Braids
|
||||
// on
|
||||
// 8/18/11
|
||||
// 11:39
|
||||
// PM
|
||||
BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class, new ClumsyRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception { // NOPMD by Braids on 8/18/11
|
||||
// 11:40 PM
|
||||
CardFactoryTest.this.factory.getRandomCombinationWithoutRepetition(CardFactoryTest.this.factory.size());
|
||||
}
|
||||
});
|
||||
|
||||
BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class,
|
||||
new ClumsyRunnable() {
|
||||
public void run() throws Exception { // NOPMD by Braids on 8/18/11 11:40 PM
|
||||
final int largeDivisorForRandomCombo = 4; // NOPMD by Braids on 8/18/11 11:41 PM
|
||||
factory.getRandomCombinationWithoutRepetition(factory.size() / largeDivisorForRandomCombo);
|
||||
BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class, new ClumsyRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception { // NOPMD by Braids on 8/18/11
|
||||
// 11:40 PM
|
||||
final int largeDivisorForRandomCombo = 4; // NOPMD by Braids on
|
||||
// 8/18/11 11:41 PM
|
||||
CardFactoryTest.this.factory.getRandomCombinationWithoutRepetition(CardFactoryTest.this.factory.size()
|
||||
/ largeDivisorForRandomCombo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure the method works.
|
||||
*
|
||||
* This doesn't work with LazyCardFactory, so it is too slow to enable by default.
|
||||
*
|
||||
* This doesn't work with LazyCardFactory, so it is too slow to enable by
|
||||
* default.
|
||||
*/
|
||||
@Test(enabled = false, timeOut = DEFAULT_TEST_TIMEOUT_MS)
|
||||
public final void test_getRandomCombinationWithoutRepetition_oneTenth() { // NOPMD by Braids on 8/18/11 11:39 PM
|
||||
factory = new PreloadingCardFactory(ForgeProps.getFile(CARDSFOLDER));
|
||||
@Test(enabled = false, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS)
|
||||
public final void test_getRandomCombinationWithoutRepetition_oneTenth() { // NOPMD
|
||||
// by
|
||||
// Braids
|
||||
// on
|
||||
// 8/18/11
|
||||
// 11:39
|
||||
// PM
|
||||
this.factory = new PreloadingCardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER));
|
||||
final int divisor = 10; // NOPMD by Braids on 8/18/11 11:41 PM
|
||||
final CardList actual = factory.getRandomCombinationWithoutRepetition(factory.size() / divisor);
|
||||
final CardList actual = this.factory.getRandomCombinationWithoutRepetition(this.factory.size() / divisor);
|
||||
|
||||
final Set<String> cardNames = new TreeSet<String>();
|
||||
|
||||
for (Card card : actual) {
|
||||
for (final Card card : actual) {
|
||||
Assert.assertNotNull(card);
|
||||
cardNames.add(card.getName());
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package forge.card.cardFactory;
|
||||
|
||||
import static forge.card.cardfactory.CardFactoryUtil.getMostProminentCreatureType;
|
||||
import static forge.card.cardfactory.CardFactoryUtil.isNegativeCounter;
|
||||
import static forge.card.cardfactory.CardFactoryUtil.multiplyManaCost;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.code.jyield.Generator;
|
||||
@@ -14,19 +10,21 @@ import forge.Card;
|
||||
import forge.CardFilter;
|
||||
import forge.CardList;
|
||||
import forge.Counters;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
|
||||
/**
|
||||
* <p>Mana_PartTest class.</p>
|
||||
*
|
||||
* <p>
|
||||
* Mana_PartTest class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
@Test(groups = {"UnitTest"}, timeOut = 1000, enabled = false)
|
||||
public class CardFactoryUtilTest implements NewConstants {
|
||||
@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false)
|
||||
public class CardFactoryUtilTest {
|
||||
|
||||
/**
|
||||
*
|
||||
* Card factory test1.
|
||||
*/
|
||||
@Test(timeOut = 1000, enabled = false)
|
||||
public void CardFactoryTest1() {
|
||||
@@ -34,23 +32,23 @@ public class CardFactoryUtilTest implements NewConstants {
|
||||
Generator<Card> in = YieldUtils.toGenerator(AllZone.getCardFactory());
|
||||
|
||||
in = CardFilter.getColor(in, "black");
|
||||
|
||||
|
||||
CardList list = new CardList(in);
|
||||
list = list.getType("Creature");
|
||||
|
||||
System.out.println("Most prominent creature type: " + getMostProminentCreatureType(list));
|
||||
System.out.println("Most prominent creature type: " + CardFactoryUtil.getMostProminentCreatureType(list));
|
||||
|
||||
|
||||
String manacost = "3 GW W W R B S";
|
||||
String multipliedTwice = multiplyManaCost(manacost, 2);
|
||||
String multipliedThrice = multiplyManaCost(manacost, 3);
|
||||
final String manacost = "3 GW W W R B S";
|
||||
final String multipliedTwice = CardFactoryUtil.multiplyManaCost(manacost, 2);
|
||||
final String multipliedThrice = CardFactoryUtil.multiplyManaCost(manacost, 3);
|
||||
|
||||
System.out.println(manacost + " times 2 = " + multipliedTwice);
|
||||
System.out.println(manacost + " times 3 = " + multipliedThrice);
|
||||
|
||||
if (isNegativeCounter(Counters.M1M1)) {
|
||||
if (CardFactoryUtil.isNegativeCounter(Counters.M1M1)) {
|
||||
System.out.println("M1M1 is a bad counter!");
|
||||
} else
|
||||
} else {
|
||||
System.out.println("M1M1 is a good counter!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user