diff --git a/src/main/java/forge/model/BuildInfo.java b/src/main/java/forge/model/BuildInfo.java index 97bd7ac3667..d7950f03e50 100644 --- a/src/main/java/forge/model/BuildInfo.java +++ b/src/main/java/forge/model/BuildInfo.java @@ -7,8 +7,6 @@ import java.nio.charset.Charset; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; -//import java.util.regex.Matcher; -//import java.util.regex.Pattern; /** * Provides access to information about the current version and build ID. @@ -206,7 +204,7 @@ public class BuildInfo { */ public final String toPrettyString() { final String rawVersion = getVersion(); - //final String rawBuildID = getBuildID(); + // final String rawBuildID = getBuildID(); String version; if (rawVersion == null) { @@ -215,14 +213,12 @@ public class BuildInfo { version = rawVersion; } - /*String buildID; - if (rawBuildID == null) { - buildID = "Unknown"; - } else { - buildID = rawBuildID; - } */ + /* + * String buildID; if (rawBuildID == null) { buildID = "Unknown"; } else + * { buildID = rawBuildID; } + */ - return "Forge version " + version; //", build ID " + buildID; + return "Forge version " + version; // ", build ID " + buildID; } } diff --git a/src/main/java/forge/model/FGameState.java b/src/main/java/forge/model/FGameState.java index 4e20e46c4ff..563a6a4581a 100644 --- a/src/main/java/forge/model/FGameState.java +++ b/src/main/java/forge/model/FGameState.java @@ -3,6 +3,7 @@ package forge.model; import forge.AIPlayer; import forge.Combat; import forge.Constant; +import forge.Constant.Zone; import forge.DefaultPlayerZone; import forge.EndOfCombat; import forge.EndOfTurn; @@ -14,7 +15,6 @@ import forge.Player; import forge.PlayerZone; import forge.StaticEffects; import forge.Upkeep; -import forge.Constant.Zone; import forge.card.trigger.TriggerHandler; import forge.game.GameSummary; @@ -22,9 +22,13 @@ import forge.game.GameSummary; * Represents the Forge Game State. */ public class FGameState { + + /** The Constant HUMAN_PLAYER_NAME. */ public static final String HUMAN_PLAYER_NAME = "Human"; + + /** The Constant AI_PLAYER_NAME. */ public static final String AI_PLAYER_NAME = "Computer"; - + private Player humanPlayer = new HumanPlayer(HUMAN_PLAYER_NAME); private Player computerPlayer = new AIPlayer(AI_PLAYER_NAME); private EndOfTurn endOfTurn = new EndOfTurn(); @@ -37,7 +41,6 @@ public class FGameState { private TriggerHandler triggerHandler = new TriggerHandler(); private Combat combat = new Combat(); - private PlayerZone stackZone = new DefaultPlayerZone(Constant.Zone.Stack, null); private long timestamp = 0; @@ -46,199 +49,241 @@ public class FGameState { /** * Constructor. */ - public FGameState() { /* no more zones to map here */ } - + public FGameState() { /* no more zones to map here */ + } /** + * Gets the human player. + * * @return the humanPlayer */ public final Player getHumanPlayer() { return humanPlayer; } - /** - * @param humanPlayer0 the humanPlayer to set + * Sets the human player. + * + * @param humanPlayer0 + * the humanPlayer to set */ protected final void setHumanPlayer(final Player humanPlayer0) { this.humanPlayer = humanPlayer0; } - /** + * Gets the computer player. + * * @return the computerPlayer */ public final Player getComputerPlayer() { return computerPlayer; } - /** - * @param computerPlayer0 the computerPlayer to set + * Sets the computer player. + * + * @param computerPlayer0 + * the computerPlayer to set */ protected final void setComputerPlayer(final Player computerPlayer0) { this.computerPlayer = computerPlayer0; } - - public final Player[] getPlayers() { - return new Player[]{ humanPlayer, computerPlayer }; - } - /** + * Gets the players. + * + * @return the players + */ + public final Player[] getPlayers() { + return new Player[] {humanPlayer, computerPlayer}; + } + + /** + * Gets the end of turn. + * * @return the endOfTurn */ public final EndOfTurn getEndOfTurn() { return endOfTurn; } - /** - * @param endOfTurn0 the endOfTurn to set + * Sets the end of turn. + * + * @param endOfTurn0 + * the endOfTurn to set */ protected final void setEndOfTurn(final EndOfTurn endOfTurn0) { this.endOfTurn = endOfTurn0; } - /** + * Gets the end of combat. + * * @return the endOfCombat */ public final EndOfCombat getEndOfCombat() { return endOfCombat; } - /** - * @param endOfCombat0 the endOfCombat to set + * Sets the end of combat. + * + * @param endOfCombat0 + * the endOfCombat to set */ protected final void setEndOfCombat(final EndOfCombat endOfCombat0) { this.endOfCombat = endOfCombat0; } - /** + * Gets the upkeep. + * * @return the upkeep */ public final Upkeep getUpkeep() { return upkeep; } - /** - * @param upkeep0 the upkeep to set + * Sets the upkeep. + * + * @param upkeep0 + * the upkeep to set */ protected final void setUpkeep(final Upkeep upkeep0) { this.upkeep = upkeep0; } - /** + * Gets the phase. + * * @return the phase */ public final Phase getPhase() { return phase; } - /** - * @param phase0 the phase to set + * Sets the phase. + * + * @param phase0 + * the phase to set */ protected final void setPhase(final Phase phase0) { this.phase = phase0; } - /** + * Gets the stack. + * * @return the stack */ public final MagicStack getStack() { return stack; } - /** - * @param stack0 the stack to set + * Sets the stack. + * + * @param stack0 + * the stack to set */ protected final void setStack(final MagicStack stack0) { this.stack = stack0; } - /** + * Gets the game action. + * * @return the gameAction */ public final GameAction getGameAction() { return gameAction; } - /** - * @param gameAction0 the gameAction to set + * Sets the game action. + * + * @param gameAction0 + * the gameAction to set */ protected final void setGameAction(final GameAction gameAction0) { this.gameAction = gameAction0; } - /** + * Gets the static effects. + * * @return the staticEffects */ public final StaticEffects getStaticEffects() { return staticEffects; } - /** - * @param staticEffects0 the staticEffects to set + * Sets the static effects. + * + * @param staticEffects0 + * the staticEffects to set */ protected final void setStaticEffects(final StaticEffects staticEffects0) { this.staticEffects = staticEffects0; } - /** + * Gets the trigger handler. + * * @return the triggerHandler */ public final TriggerHandler getTriggerHandler() { return triggerHandler; } - /** - * @param triggerHandler0 the triggerHandler to set + * Sets the trigger handler. + * + * @param triggerHandler0 + * the triggerHandler to set */ protected final void setTriggerHandler(final TriggerHandler triggerHandler0) { this.triggerHandler = triggerHandler0; } - /** + * Gets the combat. + * * @return the combat */ public final Combat getCombat() { return combat; } - /** - * @param combat0 the combat to set + * Sets the combat. + * + * @param combat0 + * the combat to set */ public final void setCombat(final Combat combat0) { this.combat = combat0; } - /** + * Gets the stack zone. + * * @return the stackZone */ public final PlayerZone getStackZone() { return stackZone; } - /** - * @param stackZone0 the stackZone to set + * Sets the stack zone. + * + * @param stackZone0 + * the stackZone to set */ protected final void setStackZone(final PlayerZone stackZone0) { this.stackZone = stackZone0; @@ -254,32 +299,38 @@ public class FGameState { return getTimestamp(); } - /** + * Gets the timestamp. + * * @return the timestamp */ public final long getTimestamp() { return timestamp; } - /** - * @param timestamp0 the timestamp to set + * Sets the timestamp. + * + * @param timestamp0 + * the timestamp to set */ protected final void setTimestamp(final long timestamp0) { this.timestamp = timestamp0; } - - public GameSummary getGameInfo() { + /** + * Gets the game info. + * + * @return the game info + */ + public final GameSummary getGameInfo() { return gameInfo; } - /** - * Call this each time you start a new game, ok? + * Call this each time you start a new game, ok?. */ - public void newGameCleanup() { + public final void newGameCleanup() { gameInfo = new GameSummary(humanPlayer.getName(), computerPlayer.getName()); getHumanPlayer().reset(); @@ -290,11 +341,11 @@ public class FGameState { getCombat().reset(); for (Player p : getPlayers()) { - for(Zone z : Player.ALL_ZONES) { + for (Zone z : Player.ALL_ZONES) { p.getZone(z).reset(); } } - + getStaticEffects().reset(); } diff --git a/src/main/java/forge/model/FModel.java b/src/main/java/forge/model/FModel.java index b87be5f5180..8a3c001fb44 100644 --- a/src/main/java/forge/model/FModel.java +++ b/src/main/java/forge/model/FModel.java @@ -7,51 +7,50 @@ import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; +import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor; +import arcane.util.MultiplexOutputStream; import forge.Constant; import forge.HttpUtil; import forge.properties.ForgePreferences; -//import net.slightlymagic.braids.util.progress_monitor.BaseProgressMonitor; -import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor; -import arcane.util.MultiplexOutputStream; - /** * The default Model implementation for Forge. - * + * * This used to be an interface, but it seems unlikely that we will ever use a * different model. - * + * * In case we need to convert it into an interface in the future, all fields of * this class must be either private or public static final. */ public class FModel { - //private static final int NUM_INIT_PHASES = 1; + // private static final int NUM_INIT_PHASES = 1; private final transient OutputStream logFileStream; private final transient PrintStream oldSystemOut; private final transient PrintStream oldSystemErr; private BuildInfo buildInfo; + + /** The preferences. */ public ForgePreferences preferences; private FGameState gameState; /** * Constructor. - * - * @param theMonitor a progress monitor (from the View) that shows the - * progress of the model's initialization. - * - * @throws FileNotFoundException if we could not find or write to the log file. + * + * @param theMonitor + * a progress monitor (from the View) that shows the progress of + * the model's initialization. + * + * @throws FileNotFoundException + * if we could not find or write to the log file. */ public FModel(final BraidsProgressMonitor theMonitor) throws FileNotFoundException { - /* To be implemented later. -Braids - BraidsProgressMonitor monitor; - if (theMonitor == null) { - monitor = new BaseProgressMonitor(NUM_INIT_PHASES, 1); - } - else { - monitor = theMonitor; - } - */ + /* + * To be implemented later. -Braids BraidsProgressMonitor monitor; if + * (theMonitor == null) { monitor = new + * BaseProgressMonitor(NUM_INIT_PHASES, 1); } else { monitor = + * theMonitor; } + */ final File logFile = new File("forge.log"); final boolean deleteSucceeded = logFile.delete(); @@ -70,7 +69,8 @@ public class FModel { try { setPreferences(new ForgePreferences("forge.preferences")); } catch (Exception exn) { - throw new RuntimeException(exn); // NOPMD by Braids on 8/13/11 8:21 PM + throw new RuntimeException(exn); // NOPMD by Braids on 8/13/11 8:21 + // PM } Constant.Runtime.Mill[0] = preferences.millingLossCondition; @@ -90,7 +90,9 @@ public class FModel { /** * Destructor for FModel. - * @throws Throwable indirectly + * + * @throws Throwable + * indirectly */ @Override protected final void finalize() throws Throwable { @@ -99,8 +101,8 @@ public class FModel { } /** - * Opposite of constructor; resets all system resources and closes the - * log file. + * Opposite of constructor; resets all system resources and closes the log + * file. */ public final void close() { System.setOut(oldSystemOut); @@ -114,7 +116,7 @@ public class FModel { /** * Getter for buildInfo. - * + * * @return the buildInfo */ public final BuildInfo getBuildInfo() { @@ -123,14 +125,17 @@ public class FModel { /** * Setter for buildInfo. - * - * @param neoBuildInfo the buildInfo to set + * + * @param neoBuildInfo + * the buildInfo to set */ protected final void setBuildInfo(final BuildInfo neoBuildInfo) { this.buildInfo = neoBuildInfo; } /** + * Gets the preferences. + * * @return the preferences */ public final ForgePreferences getPreferences() { @@ -138,7 +143,10 @@ public class FModel { } /** - * @param neoPreferences the preferences to set + * Sets the preferences. + * + * @param neoPreferences + * the preferences to set */ public final void setPreferences(final ForgePreferences neoPreferences) { this.preferences = neoPreferences; @@ -146,6 +154,7 @@ public class FModel { /** * Getter for gameState. + * * @return the game state */ public final FGameState getGameState() { @@ -154,6 +163,7 @@ public class FModel { /** * Create and return a new game state. + * * @return a fresh game state */ public final FGameState resetGameState() { @@ -161,6 +171,4 @@ public class FModel { return gameState; } - } - diff --git a/src/main/java/forge/properties/ForgePreferences.java b/src/main/java/forge/properties/ForgePreferences.java index 7249cc2379b..824f27cae82 100644 --- a/src/main/java/forge/properties/ForgePreferences.java +++ b/src/main/java/forge/properties/ForgePreferences.java @@ -1,60 +1,123 @@ package forge.properties; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.ArrayList; import java.util.List; +// TODO: Auto-generated Javadoc /** - *
ForgePreferences class.
- * + *+ * ForgePreferences class. + *
+ * * @author Forge * @version $Id$ */ public class ForgePreferences extends Preferences { + + /** The new gui. */ public boolean newGui; + + /** The stack ai land. */ public boolean stackAiLand; + + /** The milling loss condition. */ public boolean millingLossCondition; + + /** The developer mode. */ public boolean developerMode; + + /** The upload draft ai. */ public boolean uploadDraftAI; + + /** The rand c foil. */ public boolean randCFoil; - + + /** The skin. */ public String skin; + + /** The laf. */ public String laf; + + /** The laf fonts. */ public boolean lafFonts; + + /** The stack offset. */ public StackOffsetType stackOffset; + + /** The max stack size. */ public int maxStackSize; + + /** The card size. */ public CardSizeType cardSize; + + /** The card overlay. */ public boolean cardOverlay; + + /** The scale larger than original. */ public boolean scaleLargerThanOriginal; - + + /** The deck gen rmv artifacts. */ public boolean deckGenRmvArtifacts; + + /** The deck gen rmv small. */ public boolean deckGenRmvSmall; - + + /** The Bugz name. */ public String BugzName; + + /** The Bugz pwd. */ public String BugzPwd; // Phases + /** The b ai upkeep. */ public boolean bAIUpkeep; + + /** The b ai draw. */ public boolean bAIDraw; + + /** The b aieot. */ public boolean bAIEOT; + + /** The b ai begin combat. */ public boolean bAIBeginCombat; + + /** The b ai end combat. */ public boolean bAIEndCombat; + + /** The b human upkeep. */ public boolean bHumanUpkeep; + + /** The b human draw. */ public boolean bHumanDraw; + + /** The b human eot. */ public boolean bHumanEOT; + + /** The b human begin combat. */ public boolean bHumanBeginCombat; + + /** The b human end combat. */ public boolean bHumanEndCombat; private ListConstructor for ForgePreferences.
- * - * @param fileName a {@link java.lang.String} object. - * @throws java.lang.Exception if any. + *+ * Constructor for ForgePreferences. + *
+ * + * @param fileName + * a {@link java.lang.String} object. + * @throws Exception + * the exception */ - public ForgePreferences(String fileName) throws Exception { + public ForgePreferences(final String fileName) throws Exception { this.fileName = fileName; File f = new File(fileName); if (!f.exists()) { @@ -74,24 +137,24 @@ public class ForgePreferences extends Preferences { stackAiLand = getBoolean("AI.stack.land", false); millingLossCondition = getBoolean("loss.condition.milling", true); developerMode = getBoolean("developer.mode", false); - + uploadDraftAI = getBoolean("upload.Draft.AI", true); - + randCFoil = getBoolean("rand.C.Foil", true); laf = get("gui.laf", ""); lafFonts = getBoolean("gui.laf.fonts", false); - skin = get("gui.skin","default"); + skin = get("gui.skin", "default"); cardOverlay = getBoolean("card.overlay", true); cardSize = CardSizeType.valueOf(get("card.images.size", "medium")); stackOffset = StackOffsetType.valueOf(get("stack.offset", "tiny")); maxStackSize = getInt("stack.max.size", 3); scaleLargerThanOriginal = getBoolean("card.scale.larger.than.original", true); - + deckGenRmvArtifacts = getBoolean("deck.gen.rmv.artifacts", false); deckGenRmvSmall = getBoolean("deck.gen.rmv.small", false); - + BugzName = get("bugz.user.name", ""); BugzPwd = get("bugz.user.pwd", ""); @@ -109,11 +172,14 @@ public class ForgePreferences extends Preferences { } /** - *save.
- * - * @throws java.lang.Exception if any. + *+ * save. + *
+ * + * @throws Exception + * the exception */ - public void save() throws Exception { + public final void save() throws Exception { set("gui.new", newGui); @@ -121,7 +187,7 @@ public class ForgePreferences extends Preferences { set("loss.condition.milling", millingLossCondition); set("developer.mode", developerMode); set("upload.Draft.AI", uploadDraftAI); - + set("rand.C.Foil", randCFoil); set("gui.skin", skin); @@ -136,10 +202,10 @@ public class ForgePreferences extends Preferences { for (SavePreferencesListener listeners : saveListeners) { listeners.savePreferences(); } - + set("deck.gen.rmv.artifacts", deckGenRmvArtifacts); set("deck.gen.rmv.small", deckGenRmvSmall); - + set("bugz.user.name", BugzName); set("bugz.user.pwd", BugzPwd); @@ -164,19 +230,48 @@ public class ForgePreferences extends Preferences { } /** - *addSaveListener.
- * - * @param listener a {@link forge.properties.SavePreferencesListener} object. + *+ * addSaveListener. + *
+ * + * @param listener + * a {@link forge.properties.SavePreferencesListener} object. */ - public void addSaveListener(SavePreferencesListener listener) { + public final void addSaveListener(final SavePreferencesListener listener) { saveListeners.add(listener); } - static public enum CardSizeType { - tiny, smaller, small, medium, large, huge + /** + * The Enum CardSizeType. + */ + public static enum CardSizeType { + + /** The tiny. */ + tiny, + /** The smaller. */ + smaller, + /** The small. */ + small, + /** The medium. */ + medium, + /** The large. */ + large, + /** The huge. */ + huge } + /** + * The Enum StackOffsetType. + */ static public enum StackOffsetType { - tiny, small, medium, large + + /** The tiny. */ + tiny, + /** The small. */ + small, + /** The medium. */ + medium, + /** The large. */ + large } } diff --git a/src/main/java/forge/properties/ForgeProps.java b/src/main/java/forge/properties/ForgeProps.java index 01c8dc1656d..a1ad8950489 100644 --- a/src/main/java/forge/properties/ForgeProps.java +++ b/src/main/java/forge/properties/ForgeProps.java @@ -1,29 +1,29 @@ package forge.properties; + /** * ForgeProps.java * * Created on 30.08.2009 */ - -import forge.error.ErrorViewer; -import tree.properties.TreeProperties; +import static java.lang.String.format; import java.io.File; import java.io.IOException; import java.util.Locale; -import static java.lang.String.format; - +import tree.properties.TreeProperties; +import forge.error.ErrorViewer; /** - * The class ForgeProps. Wrapper around TreeProperties to support the uses in forge. - * + * The class ForgeProps. Wrapper around TreeProperties to support the uses in + * forge. + * * @author Forge * @version $Id$ */ public class ForgeProps { - /** Constantproperties */
+ /** Constant properties. */
private static final TreeProperties properties;
static {
@@ -39,7 +39,7 @@ public class ForgeProps {
}
/**
- * Returns the tree properties of forge
+ * Returns the tree properties of forge.
*
* @return a {@link treeProperties.TreeProperties} object.
*/
@@ -48,27 +48,29 @@ public class ForgeProps {
}
/**
- * Returns the string property value, or null if there's no such property
+ * Returns the string property value, or null if there's no such property.
*
* @param key a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
- public static String getProperty(String key) {
+ public static String getProperty(final String key) {
return getProperty(key, null);
}
/**
- * Returns the string property value, or def if there's no such property
+ * Returns the string property value, or def if there's no such property.
*
* @param key a {@link java.lang.String} object.
* @param def a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
- public static String getProperty(String key, String def) {
+ public static String getProperty(final String key, final String def) {
String result;
try {
result = getProperties().getProperty(key);
- if (result == null) result = def;
+ if (result == null) {
+ result = def;
+ }
} catch (Exception ex) {
result = def;
}
@@ -76,27 +78,29 @@ public class ForgeProps {
}
/**
- * Returns the File property value, or null if there's no such property
+ * Returns the File property value, or null if there's no such property.
*
* @param key a {@link java.lang.String} object.
* @return a {@link java.io.File} object.
*/
- public static File getFile(String key) {
+ public static File getFile(final String key) {
return getFile(key, null);
}
/**
- * Returns the File property value, or def if there's no such property
+ * Returns the File property value, or def if there's no such property.
*
* @param key a {@link java.lang.String} object.
* @param def a {@link java.io.File} object.
* @return a {@link java.io.File} object.
*/
- public static File getFile(String key, File def) {
+ public static File getFile(final String key, final File def) {
File result;
try {
result = getProperties().getFile(key);
- if (result == null) result = def;
+ if (result == null) {
+ result = def;
+ }
} catch (Exception ex) {
result = def;
}
@@ -104,46 +108,58 @@ public class ForgeProps {
}
/**
- * Returns the localized version of the specified property. The key is a format string containing "%s", which
- * is replaced with a language code (ISO 639-1, see {@link Locale#getLanguage()}). First, the configured
- * language is used. Second, the locale's code is used. If none of them contains the requested key, "en" is
- * used as the language code.
- *
- * @param key a {@link java.lang.String} object.
+ * Returns the localized version of the specified property. The key is a
+ * format string containing "%s", which is replaced with a language code
+ * (ISO 639-1, see {@link Locale#getLanguage()}). First, the configured
+ * language is used. Second, the locale's code is used. If none of them
+ * contains the requested key, "en" is used as the language code.
+ *
+ * @param key
+ * a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
- public static String getLocalized(String key) {
+ public static String getLocalized(final String key) {
return getLocalized(key, null);
}
/**
- * Returns the localized version of the specified property. The key is a format string containing "%s", which
- * is replaced with a language code (ISO 639-1, see {@link Locale#getLanguage()}). First, the configured
- * language is used. Second, the locale's code is used. If none of them contains the requested key, "en" is
- * used as the language code. If even that has no value, the def parameter is returned.
- *
- * @param key a {@link java.lang.String} object.
- * @param def a {@link java.lang.String} object.
+ * Returns the localized version of the specified property. The key is a
+ * format string containing "%s", which is replaced with a language code
+ * (ISO 639-1, see {@link Locale#getLanguage()}). First, the configured
+ * language is used. Second, the locale's code is used. If none of them
+ * contains the requested key, "en" is used as the language code. If even
+ * that has no value, the def parameter is returned.
+ *
+ * @param key
+ * a {@link java.lang.String} object.
+ * @param def
+ * a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
- public static String getLocalized(String key, String def) {
- //the list of languages to look for, in the order to be used
- //the first is the configured language
- //the second is the default locale's language code
+ public static String getLocalized(final String key, final String def) {
+ // the list of languages to look for, in the order to be used
+ // the first is the configured language
+ // the second is the default locale's language code
String[] languages = {getProperty(NewConstants.LANG.LANGUAGE), Locale.getDefault().getLanguage(), "en"};
try {
for (String lang : languages) {
- //could be if a property does not exist
- //just skip it, and try the next
- if (lang == null) continue;
+ // could be if a property does not exist
+ // just skip it, and try the next
+ if (lang == null) {
+ continue;
+ }
String result = getProperty(format(key, lang));
- if (result != null) return result;
+ if (result != null) {
+ return result;
+ }
}
- //exceptions are skipped here; also the error viewer uses this, and reporting exceptions may result
- //in a more fatal error (stack overflow)
+ // exceptions are skipped here; also the error viewer uses this, and
+ // reporting exceptions may result
+ // in a more fatal error (stack overflow)
} catch (Exception ex) {
}
- //if no property was found, or an error occurred, return the default value
+ // if no property was found, or an error occurred, return the default
+ // value
return def;
}
}
diff --git a/src/main/java/forge/properties/NewConstants.java b/src/main/java/forge/properties/NewConstants.java
index ffb7c16198f..04a46dd8e37 100644
--- a/src/main/java/forge/properties/NewConstants.java
+++ b/src/main/java/forge/properties/NewConstants.java
@@ -1,6 +1,6 @@
package forge.properties;
-
+// TODO: Auto-generated Javadoc
/**
* NewConstants.java
*
@@ -9,13 +9,16 @@ package forge.properties;
/**
* These are mostly property keys.
- *
+ *
* @author Clemens Koza
* @version V0.0 22.08.2009
*/
public interface NewConstants {
- //General properties
- /** Constant HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL". */
+ // General properties
+ /**
+ * Constant
+ * HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL".
+ */
String HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL";
/** Constant SHOW2CDECK="showdeck/2color". */
@@ -101,7 +104,10 @@ public interface NewConstants {
/** Constant BOOSTERDATA="boosterdata". */
String BOOSTERDATA = "boosterdata";
+ /** The MT g_ data. */
String MTG_DATA = "mtg-data";
+
+ /** The SYMBOL s_ small. */
String SYMBOLS_SMALL = "symbols/small";
/** Constant IMAGE_BASE="image/base". */
@@ -152,20 +158,34 @@ public interface NewConstants {
/** Property path for a rare card. */
String RARE = "quest/rare";
+ /** The PRICE. */
String PRICE = "quest/price";
- String BOOSTER_PRICE= "quest/boosterprice";
+ /** The BOOSTE r_ price. */
+ String BOOSTER_PRICE = "quest/boosterprice";
+
+ /** The DATA. */
String DATA = "quest/data";
+
+ /** The PREFS. */
String PREFS = "quest/prefs";
+ /** The DECKS. */
String DECKS = "quest/decks-dir";
+
+ /** The XMLDATA. */
String XMLDATA = "quest/data-xml";
-
+
+ /** The OPPONEN t_ icons. */
String OPPONENT_ICONS = "quest/opponent/icons";
+
+ /** The OPPONEN t_ dir. */
String OPPONENT_DIR = "image/icon";
-
+
+ /** The PE t_ sho p_ icons. */
String PET_SHOP_ICONS = "quest/pet/icons";
-
+
+ /** The PE t_ toke n_ images. */
String PET_TOKEN_IMAGES = "quest/pet/tokens";
}
@@ -173,12 +193,25 @@ public interface NewConstants {
* These are GUI-related properties.
*/
public static interface GUI {
+
+ /**
+ * The Interface GuiDisplay.
+ */
public static interface GuiDisplay {
+
+ /** The LAYOUT. */
String LAYOUT = "gui/Display";
+
+ /** The LAYOU t_ new. */
String LAYOUT_NEW = "gui/Display/new";
}
+ /**
+ * The Interface GuiDeckEditor.
+ */
public static interface GuiDeckEditor {
+
+ /** The LAYOUT. */
String LAYOUT = "gui/DeckEditor";
}
@@ -188,354 +221,836 @@ public interface NewConstants {
* These are localization properties.
*/
public static interface LANG {
+
+ /** The PROGRA m_ name. */
String PROGRAM_NAME = "%s/program/name";
+
+ /** The LANGUAGE. */
String LANGUAGE = "lang";
+ /**
+ * The Interface HowTo.
+ */
public static interface HowTo {
+
+ /** The TITLE. */
String TITLE = "%s/HowTo/title";
+
+ /** The MESSAGE. */
String MESSAGE = "%s/HowTo/message";
}
+ /**
+ * The Interface ErrorViewer.
+ */
public static interface ErrorViewer {
+
+ /** The SHO w_ error. */
String SHOW_ERROR = "%s/ErrorViewer/show";
+ /** The TITLE. */
String TITLE = "%s/ErrorViewer/title";
+
+ /** The MESSAGE. */
String MESSAGE = "%s/ErrorViewer/message";
+
+ /** The BUTTO n_ save. */
String BUTTON_SAVE = "%s/ErrorViewer/button/save";
+
+ /** The BUTTO n_ close. */
String BUTTON_CLOSE = "%s/ErrorViewer/button/close";
+
+ /** The BUTTO n_ exit. */
String BUTTON_EXIT = "%s/ErrorViewer/button/exit";
+ /**
+ * The Interface ERRORS.
+ */
public static interface ERRORS {
+
+ /** The SAV e_ message. */
String SAVE_MESSAGE = "%s/ErrorViewer/errors/save/message";
+
+ /** The SHO w_ message. */
String SHOW_MESSAGE = "%s/ErrorViewer/errors/show/message";
}
}
+ /**
+ * The Interface Gui_BoosterDraft.
+ */
public static interface Gui_BoosterDraft {
+
+ /** The CLOS e_ message. */
String CLOSE_MESSAGE = "%s/BoosterDraft/close/message";
+
+ /** The SAV e_ message. */
String SAVE_MESSAGE = "%s/BoosterDraft/save/message";
+
+ /** The SAV e_ title. */
String SAVE_TITLE = "%s/BoosterDraft/save/title";
+
+ /** The RENAM e_ message. */
String RENAME_MESSAGE = "%s/BoosterDraft/rename/message";
+
+ /** The RENAM e_ title. */
String RENAME_TITLE = "%s/BoosterDraft/rename/title";
+
+ /** The SAV e_ draf t_ message. */
String SAVE_DRAFT_MESSAGE = "%s/BoosterDraft/saveDraft/message";
+
+ /** The SAV e_ draf t_ title. */
String SAVE_DRAFT_TITLE = "%s/BoosterDraft/saveDraft/title";
}
+ /**
+ * The Interface GuiDisplay.
+ */
public static interface GuiDisplay {
+
+ /**
+ * The Interface MENU_BAR.
+ */
public static interface MENU_BAR {
+
+ /**
+ * The Interface MENU.
+ */
public static interface MENU {
+
+ /** The TITLE. */
String TITLE = "%s/Display/menu/title";
}
+ /**
+ * The Interface PHASE.
+ */
public static interface PHASE {
+
+ /** The TITLE. */
String TITLE = "%s/Display/phase/title";
}
+ /**
+ * The Interface DEV.
+ */
public static interface DEV {
+
+ /** The TITLE. */
String TITLE = "%s/Display/dev/title";
}
}
+ /** The HUMA n_ title. */
String HUMAN_TITLE = "%s/Display/human/title";
+ /** The HUMA n_ decklist. */
String HUMAN_DECKLIST = "%s/Display/human/decklist";
-
+
+ /**
+ * The Interface HUMAN_HAND.
+ */
public static interface HUMAN_HAND {
+
+ /** The TITLE. */
String TITLE = "%s/Display/human/hand/title";
}
+ /**
+ * The Interface HUMAN_LIBRARY.
+ */
public static interface HUMAN_LIBRARY {
+
+ /** The BASE. */
String BASE = "%s/Display/human/library";
+
+ /** The TITLE. */
String TITLE = "%s/Display/human/library/title";
+
+ /** The MENU. */
String MENU = "%s/Display/human/library/menu";
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/human/library/button";
}
+ /** The HUMA n_ graveyard. */
String HUMAN_GRAVEYARD = "%s/Display/human/graveyard";
+ /**
+ * The Interface HUMAN_GRAVEYARD.
+ */
public static interface HUMAN_GRAVEYARD {
+
+ /** The TITLE. */
String TITLE = "%s/Display/human/graveyard/title";
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/human/graveyard/button";
+
+ /** The MENU. */
String MENU = "%s/Display/human/graveyard/menu";
}
+ /** The HUMA n_ removed. */
String HUMAN_REMOVED = "%s/Display/human/removed";
+ /**
+ * The Interface HUMAN_REMOVED.
+ */
public static interface HUMAN_REMOVED {
+
+ /** The TITLE. */
String TITLE = "%s/Display/human/removed/title";
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/human/removed/button";
+
+ /** The MENU. */
String MENU = "%s/Display/human/removed/menu";
}
+ /** The COMBAT. */
String COMBAT = "%s/Display/combat/title";
+ /** The HUMA n_ flashback. */
String HUMAN_FLASHBACK = "%s/Display/human/flashback";
+ /**
+ * The Interface HUMAN_FLASHBACK.
+ */
public static interface HUMAN_FLASHBACK {
+
+ /** The TITLE. */
String TITLE = "%s/Display/human/flashback/title";
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/human/flashback/button";
+
+ /** The MENU. */
String MENU = "%s/Display/human/flashback/menu";
}
+ /** The COMPUTE r_ title. */
String COMPUTER_TITLE = "%s/Display/computer/title";
-
+ /**
+ * The Interface COMPUTER_HAND.
+ */
public static interface COMPUTER_HAND {
+
+ /** The BASE. */
String BASE = "%s/Display/computer/hand";
+
+ /** The TITLE. */
String TITLE = "%s/Display/computer/hand/title";
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/computer/hand/button";
+
+ /** The MENU. */
String MENU = "%s/Display/computer/hand/menu";
}
-
+ /**
+ * The Interface COMPUTER_LIBRARY.
+ */
public static interface COMPUTER_LIBRARY {
+
+ /** The BASE. */
String BASE = "%s/Display/computer/library";
+
+ /** The TITLE. */
String TITLE = "%s/Display/computer/library/title";
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/computer/library/button";
+
+ /** The MENU. */
String MENU = "%s/Display/computer/library/menu";
}
-
+ /** The COMPUTE r_ graveyard. */
String COMPUTER_GRAVEYARD = "%s/Display/computer/graveyard";
+ /**
+ * The Interface COMPUTER_GRAVEYARD.
+ */
public static interface COMPUTER_GRAVEYARD {
+
+ /** The TITLE. */
String TITLE = "%s/Display/computer/graveyard/title";
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/computer/graveyard/button";
+
+ /** The MENU. */
String MENU = "%s/Display/computer/graveyard/menu";
}
-
+ /** The COMPUTE r_ removed. */
String COMPUTER_REMOVED = "%s/Display/computer/removed";
+ /**
+ * The Interface COMPUTER_REMOVED.
+ */
public static interface COMPUTER_REMOVED {
+
+ /** The TITLE. */
String TITLE = "%s/Display/computer/removed/title";
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/computer/removed/button";
+
+ /** The MENU. */
String MENU = "%s/Display/computer/removed/menu";
}
+ /** The CONCEDE. */
String CONCEDE = "%s/Display/concede";
+ /**
+ * The Interface CONCEDE.
+ */
public static interface CONCEDE {
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/concede/button";
+
+ /** The MENU. */
String MENU = "%s/Display/concede/menu";
}
+ /** The MANAGEN. */
String MANAGEN = "%s/Display/managen";
+ /**
+ * The Interface MANAGEN.
+ */
public static interface MANAGEN {
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/managen/button";
+
+ /** The MENU. */
String MENU = "%s/Display/managen/menu";
}
+ /** The SETUPBATTLEFIELD. */
String SETUPBATTLEFIELD = "%s/Display/setupbattlefield";
+ /**
+ * The Interface SETUPBATTLEFIELD.
+ */
public static interface SETUPBATTLEFIELD {
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/setupbattlefield/button";
+
+ /** The MENU. */
String MENU = "%s/Display/setupbattlefield/menu";
}
+ /** The TUTOR. */
String TUTOR = "%s/Display/tutor";
+ /**
+ * The Interface TUTOR.
+ */
public static interface TUTOR {
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/tutor/button";
+
+ /** The MENU. */
String MENU = "%s/Display/tutor/menu";
}
+ /** The ADDCOUNTER. */
String ADDCOUNTER = "%s/Display/addcounter";
+ /**
+ * The Interface ADDCOUNTER.
+ */
public static interface ADDCOUNTER {
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/addcounter/button";
+
+ /** The MENU. */
String MENU = "%s/Display/addcounter/menu";
}
+ /** The TAPPERM. */
String TAPPERM = "%s/Display/tapperm";
+ /**
+ * The Interface TAPPERM.
+ */
public static interface TAPPERM {
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/tapperm/button";
+
+ /** The MENU. */
String MENU = "%s/Display/tapperm/menu";
}
+ /** The UNTAPPERM. */
String UNTAPPERM = "%s/Display/untapperm";
+ /**
+ * The Interface UNTAPPERM.
+ */
public static interface UNTAPPERM {
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/untapperm/button";
+
+ /** The MENU. */
String MENU = "%s/Display/untapperm/menu";
}
+ /** The NOLANDLIMIT. */
String NOLANDLIMIT = "%s/Display/nolandlimit";
+ /**
+ * The Interface NOLANDLIMIT.
+ */
public static interface NOLANDLIMIT {
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/nolandlimit/button";
+
+ /** The MENU. */
String MENU = "%s/Display/nolandlimit/menu";
}
-
+
+ /** The SETLIFE. */
String SETLIFE = "%s/Display/setlife";
+ /**
+ * The Interface SETLIFE.
+ */
public static interface SETLIFE {
+
+ /** The BUTTON. */
String BUTTON = "%s/Display/setlife/button";
+
+ /** The MENU. */
String MENU = "%s/Display/setlife/menu";
}
-
+
+ /**
+ * The Interface TRIGGER.
+ */
public static interface TRIGGER {
+
+ /** The ALWAYSACCEPT. */
String ALWAYSACCEPT = "%s/Display/alwaysaccept";
+
+ /** The ALWAYSDECLINE. */
String ALWAYSDECLINE = "%s/Display/alwaysdecline";
+
+ /** The ALWAYSASK. */
String ALWAYSASK = "%s/Display/alwaysask";
}
}
+ /**
+ * The Interface Gui_DownloadPictures.
+ */
public static interface Gui_DownloadPictures {
+
+ /** The TITLE. */
String TITLE = "%s/DownloadPictures/title";
+ /** The PROX y_ address. */
String PROXY_ADDRESS = "%s/DownloadPictures/proxy/address";
+
+ /** The PROX y_ port. */
String PROXY_PORT = "%s/DownloadPictures/proxy/port";
+ /** The N o_ proxy. */
String NO_PROXY = "%s/DownloadPictures/proxy/type/none";
+
+ /** The HTT p_ proxy. */
String HTTP_PROXY = "%s/DownloadPictures/proxy/type/http";
+
+ /** The SOCK s_ proxy. */
String SOCKS_PROXY = "%s/DownloadPictures/proxy/type/socks";
+ /** The N o_ more. */
String NO_MORE = "%s/DownloadPictures/no-more";
+ /** The BA r_ befor e_ start. */
String BAR_BEFORE_START = "%s/DownloadPictures/bar/before-start";
+
+ /** The BA r_ wait. */
String BAR_WAIT = "%s/DownloadPictures/bar/wait";
+
+ /** The BA r_ close. */
String BAR_CLOSE = "%s/DownloadPictures/bar/close";
+ /**
+ * The Interface BUTTONS.
+ */
public static interface BUTTONS {
+
+ /** The START. */
String START = "%s/DownloadPictures/button/start";
+
+ /** The CANCEL. */
String CANCEL = "%s/DownloadPictures/button/cancel";
+
+ /** The CLOSE. */
String CLOSE = "%s/DownloadPictures/button/close";
}
+ /**
+ * The Interface ERRORS.
+ */
public static interface ERRORS {
+
+ /** The PROX y_ connect. */
String PROXY_CONNECT = "%s/DownloadPictures/errors/proxy/connect";
+
+ /** The OTHER. */
String OTHER = "%s/DownloadPictures/errors/other";
}
}
-
+ /**
+ * The Interface OldGuiNewGame.
+ */
public static interface OldGuiNewGame {
+
+ /**
+ * The Interface NEW_GAME_TEXT.
+ */
public static interface NEW_GAME_TEXT {
+
+ /** The GAMETYPE. */
String GAMETYPE = "%s/NewGame/gametype";
+
+ /** The LIBRARY. */
String LIBRARY = "%s/NewGame/library";
+
+ /** The SETTINGS. */
String SETTINGS = "%s/NewGame/settings";
+
+ /** The NE w_ game. */
String NEW_GAME = "%s/NewGame/new_game";
+
+ /** The CONSTRUCTE d_ text. */
String CONSTRUCTED_TEXT = "%s/NewGame/constructed_text";
+
+ /** The SEALE d_ text. */
String SEALED_TEXT = "%s/NewGame/sealed_text";
+
+ /** The BOOSTE r_ text. */
String BOOSTER_TEXT = "%s/NewGame/booster_text";
+
+ /** The YOURDECK. */
String YOURDECK = "%s/NewGame/yourdeck";
+
+ /** The OPPONENT. */
String OPPONENT = "%s/NewGame/opponent";
+
+ /** The DEC k_ editor. */
String DECK_EDITOR = "%s/NewGame/deckeditor";
+
+ /** The NE w_ gui. */
String NEW_GUI = "%s/NewGame/newgui";
+
+ /** The A i_ land. */
String AI_LAND = "%s/NewGame/ailand";
+
+ /** The DE v_ mode. */
String DEV_MODE = "%s/NewGame/devmode";
+
+ /** The QUES t_ mode. */
String QUEST_MODE = "%s/NewGame/questmode";
+
+ /** The STAR t_ game. */
String START_GAME = "%s/NewGame/startgame";
+
+ /** The SAV e_ seale d_ msg. */
String SAVE_SEALED_MSG = "%s/NewGame/savesealed_msg";
+
+ /** The SAV e_ seale d_ ttl. */
String SAVE_SEALED_TTL = "%s/NewGame/savesealed_ttl";
}
+ /**
+ * The Interface MENU_BAR.
+ */
public static interface MENU_BAR {
+
+ /**
+ * The Interface MENU.
+ */
public static interface MENU {
+
+ /** The TITLE. */
String TITLE = "%s/NewGame/menu/title";
+
+ /** The LF. */
String LF = "%s/NewGame/menu/lookAndFeel";
+
+ /** The DOWNLOADPRICE. */
String DOWNLOADPRICE = "%s/NewGame/menu/downloadPrice";
+
+ /** The DOWNLOAD. */
String DOWNLOAD = "%s/NewGame/menu/download";
+
+ /** The DOWNLOADLQ. */
String DOWNLOADLQ = "%s/NewGame/menu/downloadlq";
+
+ /** The DOWNLOADSETLQ. */
String DOWNLOADSETLQ = "%s/NewGame/menu/downloadsetlq";
+
+ /** The DOWNLOADQUESTIMG. */
String DOWNLOADQUESTIMG = "%s/NewGame/menu/downloadquest";
+
+ /** The IMPORTPICTURE. */
String IMPORTPICTURE = "%s/NewGame/menu/importPicture";
+
+ /** The CAR d_ sizes. */
String CARD_SIZES = "%s/NewGame/menu/cardSizes";
+
+ /** The CAR d_ stack. */
String CARD_STACK = "%s/NewGame/menu/cardStack";
+
+ /** The CAR d_ stac k_ offset. */
String CARD_STACK_OFFSET = "%s/NewGame/menu/cardStackOffset";
+
+ /** The ABOUT. */
String ABOUT = "%s/NewGame/menu/about";
+
+ /** The EXIT. */
String EXIT = "%s/NewGame/menu/exit";
}
+ /**
+ * The Interface OPTIONS.
+ */
public static interface OPTIONS {
+
+ /** The TITLE. */
String TITLE = "%s/NewGame/options/title";
+
+ /** The FONT. */
String FONT = "%s/NewGame/options/font";
+
+ /** The CAR d_ overlay. */
String CARD_OVERLAY = "%s/NewGame/options/cardOverlay";
+
+ /** The CAR d_ scale. */
String CARD_SCALE = "%s/NewGame/options/cardScale";
+ /**
+ * The Interface GENERATE.
+ */
public static interface GENERATE {
+
+ /** The TITLE. */
String TITLE = "%s/NewGame/options/generate/title";
+
+ /** The REMOV e_ small. */
String REMOVE_SMALL = "%s/NewGame/options/generate/removeSmall";
+
+ /** The REMOV e_ artifacts. */
String REMOVE_ARTIFACTS = "%s/NewGame/options/generate/removeArtifacts";
}
}
+ /**
+ * The Interface HELP.
+ */
public static interface HELP {
+
+ /** The TITLE. */
String TITLE = "%s/NewGame/help/title";
}
}
+ /**
+ * The Interface ERRORS.
+ */
public static interface ERRORS {
}
}
+ /**
+ * The Interface WinLoseFrame.
+ */
public static interface WinLoseFrame {
+
+ /**
+ * The Interface WINLOSETEXT.
+ */
public static interface WINLOSETEXT {
+
+ /** The WON. */
String WON = "%s/WinLose/won";
+
+ /** The LOST. */
String LOST = "%s/WinLose/lost";
+
+ /** The WIN. */
String WIN = "%s/WinLose/win";
+
+ /** The LOSE. */
String LOSE = "%s/WinLose/lose";
+
+ /** The CONTINUE. */
String CONTINUE = "%s/WinLose/continue";
+
+ /** The RESTART. */
String RESTART = "%s/WinLose/restart";
- String QUIT = "%s/WinLose/quit";
- }
- }
- // end
-
- // Doublestrike 02-10-11 - this is soon to be deprecated.
- public static interface Gui_WinLose {
- public static interface WINLOSE_TEXT {
- String WON = "%s/WinLose/won";
- String LOST = "%s/WinLose/lost";
- String WIN = "%s/WinLose/win";
- String LOSE = "%s/WinLose/lose";
- String CONTINUE = "%s/WinLose/continue";
- String RESTART = "%s/WinLose/restart";
+
+ /** The QUIT. */
String QUIT = "%s/WinLose/quit";
}
}
+ // end
+
+ // Doublestrike 02-10-11 - this is soon to be deprecated.
+ /**
+ * The Interface Gui_WinLose.
+ */
+ public static interface Gui_WinLose {
+
+ /**
+ * The Interface WINLOSE_TEXT.
+ */
+ public static interface WINLOSE_TEXT {
+
+ /** The WON. */
+ String WON = "%s/WinLose/won";
+
+ /** The LOST. */
+ String LOST = "%s/WinLose/lost";
+
+ /** The WIN. */
+ String WIN = "%s/WinLose/win";
+
+ /** The LOSE. */
+ String LOSE = "%s/WinLose/lose";
+
+ /** The CONTINUE. */
+ String CONTINUE = "%s/WinLose/continue";
+
+ /** The RESTART. */
+ String RESTART = "%s/WinLose/restart";
+
+ /** The QUIT. */
+ String QUIT = "%s/WinLose/quit";
+ }
+ }
+
+ /**
+ * The Interface Gui_DownloadPrices.
+ */
public static interface Gui_DownloadPrices {
+
+ /**
+ * The Interface DOWNLOADPRICES.
+ */
public static interface DOWNLOADPRICES {
+
+ /** The TITLE. */
String TITLE = "%s/DownloadPrices/title";
+
+ /** The STAR t_ update. */
String START_UPDATE = "%s/DownloadPrices/startupdate";
+
+ /** The DOWNLOADING. */
String DOWNLOADING = "%s/DownloadPrices/downloading";
+
+ /** The COMPILING. */
String COMPILING = "%s/DownloadPrices/compiling";
}
}
+ /**
+ * The Interface GameAction.
+ */
public static interface GameAction {
- public static interface GAMEACTION_TEXT {
- String HEADS = "%s/GameAction/heads";
- String TAILS = "%s/GameAction/tails";
- String HEADS_OR_TAILS = "%s/GameAction/heads_or_tails";
- String COIN_TOSS = "%s/GameAction/coin_toss";
- String HUMAN_WIN = "%s/GameAction/human_win";
- String COMPUTER_WIN = "%s/GameAction/computer_win";
- String COMPUTER_STARTS = "%s/GameAction/computer_starts";
- String HUMAN_STARTS = "%s/GameAction/human_starts";
- String HUMAN_MANA_COST = "%s/GameAction/human_mana_cost";
- String COMPUTER_MANA_COST = "%s/GameAction/computer_mana_cost";
- String COMPUTER_CUT = "%s/GameAction/computer_cut";
- String HUMAN_CUT = "%s/GameAction/human_cut";
- String CUT_NUMBER = "%s/GameAction/cut_number";
- String RESOLVE_STARTER = "%s/GameAction/resolve_starter";
- String EQUAL_CONVERTED_MANA = "%s/GameAction/equal_converted_mana";
- String CUTTING_AGAIN = "%s/GameAction/cutting_again";
- String YES = "%s/GameAction/yes";
- String NO = "%s/GameAction/no";
- String WANT_DREDGE = "%s/GameAction/want_dredge";
- String SELECT_DREDGE = "%s/GameAction/select_dredge";
- String CHOOSE_2ND_LAND = "%s/GameAction/choose_2nd_land";
+ /**
+ * The Interface GAMEACTION_TEXT.
+ */
+ public static interface GAMEACTION_TEXT {
+
+ /** The HEADS. */
+ String HEADS = "%s/GameAction/heads";
+
+ /** The TAILS. */
+ String TAILS = "%s/GameAction/tails";
+
+ /** The HEAD s_ o r_ tails. */
+ String HEADS_OR_TAILS = "%s/GameAction/heads_or_tails";
+
+ /** The COI n_ toss. */
+ String COIN_TOSS = "%s/GameAction/coin_toss";
+
+ /** The HUMA n_ win. */
+ String HUMAN_WIN = "%s/GameAction/human_win";
+
+ /** The COMPUTE r_ win. */
+ String COMPUTER_WIN = "%s/GameAction/computer_win";
+
+ /** The COMPUTE r_ starts. */
+ String COMPUTER_STARTS = "%s/GameAction/computer_starts";
+
+ /** The HUMA n_ starts. */
+ String HUMAN_STARTS = "%s/GameAction/human_starts";
+
+ /** The HUMA n_ man a_ cost. */
+ String HUMAN_MANA_COST = "%s/GameAction/human_mana_cost";
+
+ /** The COMPUTE r_ man a_ cost. */
+ String COMPUTER_MANA_COST = "%s/GameAction/computer_mana_cost";
+
+ /** The COMPUTE r_ cut. */
+ String COMPUTER_CUT = "%s/GameAction/computer_cut";
+
+ /** The HUMA n_ cut. */
+ String HUMAN_CUT = "%s/GameAction/human_cut";
+
+ /** The CU t_ number. */
+ String CUT_NUMBER = "%s/GameAction/cut_number";
+
+ /** The RESOLV e_ starter. */
+ String RESOLVE_STARTER = "%s/GameAction/resolve_starter";
+
+ /** The EQUA l_ converte d_ mana. */
+ String EQUAL_CONVERTED_MANA = "%s/GameAction/equal_converted_mana";
+
+ /** The CUTTIN g_ again. */
+ String CUTTING_AGAIN = "%s/GameAction/cutting_again";
+
+ /** The YES. */
+ String YES = "%s/GameAction/yes";
+
+ /** The NO. */
+ String NO = "%s/GameAction/no";
+
+ /** The WAN t_ dredge. */
+ String WANT_DREDGE = "%s/GameAction/want_dredge";
+
+ /** The SELEC t_ dredge. */
+ String SELECT_DREDGE = "%s/GameAction/select_dredge";
+
+ /** The CHOOS e_2 n d_ land. */
+ String CHOOSE_2ND_LAND = "%s/GameAction/choose_2nd_land";
}
}
}
}
-
diff --git a/src/main/java/forge/properties/Preferences.java b/src/main/java/forge/properties/Preferences.java
index 1d9db49f956..57b5851944a 100644
--- a/src/main/java/forge/properties/Preferences.java
+++ b/src/main/java/forge/properties/Preferences.java
@@ -1,44 +1,55 @@
package forge.properties;
-
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.util.*;
-
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Vector;
/**
* A collection of name/value pairs with sorted keys and utility methods.
- *
+ *
* @author Forge
* @version $Id$
*/
public class Preferences {
+
+ /** The props. */
protected Properties props;
/**
- * Constructor for Preferences.
+ *+ * Constructor for Preferences. + *
*/ public Preferences() { props = new Properties(); } /** - *Constructor for Preferences.
- * - * @param prefs a {@link forge.properties.Preferences} object. + *+ * Constructor for Preferences. + *
+ * + * @param prefs + * a {@link forge.properties.Preferences} object. */ - public Preferences(Preferences prefs) { + public Preferences(final Preferences prefs) { props = prefs.props; } /** - *keys.
- * + *+ * keys. + *
+ * * @return a {@link java.util.Enumeration} object. */ - public synchronized EnumerationgetInt.
- * - * @param name a {@link java.lang.String} object. - * @param defaultValue a int. + *+ * getInt. + *
+ * + * @param name + * a {@link java.lang.String} object. + * @param defaultValue + * a int. * @return a int. */ - public int getInt(String name, int defaultValue) { + public final int getInt(final String name, final int defaultValue) { String value = props.getProperty(name); - if (value == null) return defaultValue; + if (value == null) { + return defaultValue; + } try { return Integer.parseInt(value); } catch (NumberFormatException ex) { @@ -64,72 +81,103 @@ public class Preferences { } /** - *getBoolean.
- * - * @param name a {@link java.lang.String} object. - * @param defaultValue a boolean. + *+ * getBoolean. + *
+ * + * @param name + * a {@link java.lang.String} object. + * @param defaultValue + * a boolean. * @return a boolean. */ - public boolean getBoolean(String name, boolean defaultValue) { + public final boolean getBoolean(final String name, final boolean defaultValue) { String value = props.getProperty(name); - if (value == null) return defaultValue; + if (value == null) { + return defaultValue; + } return Boolean.parseBoolean(value); } /** - *getLong.
- * - * @param name a {@link java.lang.String} object. - * @param defaultValue a long. + *+ * getLong. + *
+ * + * @param name + * a {@link java.lang.String} object. + * @param defaultValue + * a long. * @return a long. */ - public long getLong(String name, long defaultValue) { + public final long getLong(final String name, final long defaultValue) { String value = props.getProperty(name); - if (value == null) return defaultValue; + if (value == null) { + return defaultValue; + } return Long.parseLong(value); } /** - *set.
- * - * @param key a {@link java.lang.String} object. - * @param value a {@link java.lang.Object} object. + *+ * set. + *
+ * + * @param key + * a {@link java.lang.String} object. + * @param value + * a {@link java.lang.Object} object. */ - public void set(String key, Object value) { + public final void set(final String key, final Object value) { props.setProperty(key, String.valueOf(value)); } /** - *get.
- * - * @param key a {@link java.lang.String} object. - * @param value a {@link java.lang.Object} object. + *+ * get. + *
+ * + * @param key + * a {@link java.lang.String} object. + * @param value + * a {@link java.lang.Object} object. * @return a {@link java.lang.String} object. */ - public String get(String key, Object value) { + public final String get(final String key, final Object value) { String string = null; - if (value != null) string = String.valueOf(value); + if (value != null) { + string = String.valueOf(value); + } return props.getProperty(key, string); } /** - *load.
- * - * @param stream a {@link java.io.FileInputStream} object. - * @throws java.io.IOException if any. + *+ * load. + *
+ * + * @param stream + * a {@link java.io.FileInputStream} object. + * @throws IOException + * Signals that an I/O exception has occurred. */ - public void load(FileInputStream stream) throws IOException { + public final void load(final FileInputStream stream) throws IOException { props.load(stream); } /** - *store.
- * - * @param stream a {@link java.io.FileOutputStream} object. - * @param comments a {@link java.lang.String} object. - * @throws java.io.IOException if any. + *+ * store. + *
+ * + * @param stream + * a {@link java.io.FileOutputStream} object. + * @param comments + * a {@link java.lang.String} object. + * @throws IOException + * Signals that an I/O exception has occurred. */ - public void store(FileOutputStream stream, String comments) throws IOException { + public final void store(final FileOutputStream stream, final String comments) throws IOException { props.store(stream, comments); } } diff --git a/src/main/java/forge/properties/SavePreferencesListener.java b/src/main/java/forge/properties/SavePreferencesListener.java index f211fe65b8c..fe09bac026d 100644 --- a/src/main/java/forge/properties/SavePreferencesListener.java +++ b/src/main/java/forge/properties/SavePreferencesListener.java @@ -1,14 +1,18 @@ package forge.properties; /** - *SavePreferencesListener interface.
- * + *+ * SavePreferencesListener interface. + *
+ * * @author Forge * @version $Id$ */ public interface SavePreferencesListener { /** - *savePreferences.
+ *+ * savePreferences. + *
*/ - public void savePreferences(); + void savePreferences(); } diff --git a/src/main/java/forge/properties/package-info.java b/src/main/java/forge/properties/package-info.java index e42a8b073e2..f3bb8ba6afc 100644 --- a/src/main/java/forge/properties/package-info.java +++ b/src/main/java/forge/properties/package-info.java @@ -1,2 +1,2 @@ -/** Forge Card Game */ +/** Forge Card Game. */ package forge.properties; diff --git a/src/main/java/forge/quest/data/QuestData.java b/src/main/java/forge/quest/data/QuestData.java index 4c63245caa7..7a06f3e1904 100644 --- a/src/main/java/forge/quest/data/QuestData.java +++ b/src/main/java/forge/quest/data/QuestData.java @@ -1,5 +1,11 @@ package forge.quest.data; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.slightlymagic.maxmtg.Predicate; import forge.MyRandom; import forge.SetUtils; import forge.deck.Deck; @@ -12,114 +18,138 @@ import forge.properties.NewConstants; import forge.quest.data.item.QuestInventory; import forge.quest.data.pet.QuestPetManager; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.slightlymagic.maxmtg.Predicate; - +// TODO: Auto-generated Javadoc //when you create QuestDataOld and AFTER you copy the AI decks over //you have to call one of these two methods below //see Gui_QuestOptions for more details /** - *QuestData class.
- * + *+ * QuestData class. + *
+ * * @author Forge * @version $Id$ */ public final class QuestData { - //This field holds the version of the Quest Data - /** ConstantCURRENT_VERSION_NUMBER=2 */
+ // This field holds the version of the Quest Data
+ /** Constant CURRENT_VERSION_NUMBER=2. */
public static final int CURRENT_VERSION_NUMBER = 2;
- //This field places the version number into QD instance,
- //but only when the object is created through the constructor
- //DO NOT RENAME THIS FIELD
+ // This field places the version number into QD instance,
+ // but only when the object is created through the constructor
+ // DO NOT RENAME THIS FIELD
+ /** The version number. */
int versionNumber = CURRENT_VERSION_NUMBER;
+ /** The rank index. */
int rankIndex; // level
+
+ /** The win. */
int win; // number of wins
+
+ /** The lost. */
int lost;
+ /** The credits. */
long credits; // this money is good for all modes
-
- int life; // for fantasy mode, how much life bought at shop to start game with
- QuestInventory inventory = new QuestInventory(); // different gadgets
- QuestPetManager petManager = new QuestPetManager(); // pets that start match with you
+ /** The life. */
+ int life; // for fantasy mode, how much life bought at shop to start game
+ // with
+ /** The inventory. */
+ QuestInventory inventory = new QuestInventory(); // different gadgets
+
+ /** The pet manager. */
+ QuestPetManager petManager = new QuestPetManager(); // pets that start match
+ // with you
// Diffuculty - they store both index and title
+ /** The diff index. */
int diffIndex;
+
+ /** The difficulty. */
String difficulty;
// Quest mode - there should be an enum :(
+ /** The mode. */
String mode = "";
+
+ /** The Constant FANTASY. */
public static final String FANTASY = "Fantasy";
+
+ /** The Constant REALISTIC. */
public static final String REALISTIC = "Realistic";
// Decks collected by player
+ /** The my decks. */
MapConstructor for QuestData.
+ *+ * Constructor for QuestData. + *
*/ public QuestData() { initTransients(); @@ -132,15 +162,30 @@ public final class QuestData { myCards = new QuestUtilCards(this); // to avoid NPE some pools will be created here if they are null - if (null == newCardList) { newCardList = new ItemPoolgetCompletedChallenges.
+ * Sets the available challenges. + * + * @param list + * the new available challenges + */ + public void setAvailableChallenges(final List+ * getCompletedChallenges. + *
* Returns stored list of non-repeatable challenge IDs. * * @return ListaddCompletedChallenge.
+ *+ * addCompletedChallenge. + *
* Add non-repeatable challenge ID to list. * - * @param int i + * @param i + * the i */ - + // Poorly named - this should be "setLockedChalleneges" or similar. - public void addCompletedChallenge(int i) { + public void addCompletedChallenge(final int i) { completedChallenges.add(i); } // Wins & Losses - public int getLost() { return lost; } - public void addLost() { lost++; } - public int getWin() { return win; } - public void addWin() { //changes getRank() + /** + * Gets the lost. + * + * @return the lost + */ + public int getLost() { + return lost; + } + + /** + * Adds the lost. + */ + public void addLost() { + lost++; + } + + /** + * Gets the win. + * + * @return the win + */ + public int getWin() { + return win; + } + + /** + * Adds the win. + */ + public void addWin() { // changes getRank() win++; int winsToLvlUp = QuestPreferences.getWinsForRankIncrease(diffIndex); - if (win % winsToLvlUp == 0) { rankIndex++; } + if (win % winsToLvlUp == 0) { + rankIndex++; + } } // Life (only fantasy) - public int getLife() { return isFantasy() ? life : 20; } - public void addLife(final int n) { life += n; } + /** + * Gets the life. + * + * @return the life + */ + public int getLife() { + return isFantasy() ? life : 20; + } + + /** + * Adds the life. + * + * @param n + * the n + */ + public void addLife(final int n) { + life += n; + } // Credits - public void addCredits(final long c) { credits += c; } - public void subtractCredits(final long c) { credits = credits > c ? credits - c : 0; } - public long getCredits() { return credits; } + /** + * Adds the credits. + * + * @param c + * the c + */ + public void addCredits(final long c) { + credits += c; + } + + /** + * Subtract credits. + * + * @param c + * the c + */ + public void subtractCredits(final long c) { + credits = credits > c ? credits - c : 0; + } + + /** + * Gets the credits. + * + * @return the credits + */ + public long getCredits() { + return credits; + } // Quest mode - public boolean isFantasy() { return mode.equals(FANTASY); } - public String getMode() { return mode == null ? "" : mode; } + /** + * Checks if is fantasy. + * + * @return true, if is fantasy + */ + public boolean isFantasy() { + return mode.equals(FANTASY); + } + + /** + * Gets the mode. + * + * @return the mode + */ + public String getMode() { + return mode == null ? "" : mode; + } // Difficulty - public String getDifficulty() { return difficulty; } - public int getDifficultyIndex() { return diffIndex; } + /** + * Gets the difficulty. + * + * @return the difficulty + */ + public String getDifficulty() { + return difficulty; + } + /** + * Gets the difficulty index. + * + * @return the difficulty index + */ + public int getDifficultyIndex() { + return diffIndex; + } + + /** + * Sets the difficulty. + * + * @param i + * the new difficulty + */ public void setDifficulty(final int i) { diffIndex = i; difficulty = QuestPreferences.getDifficulty(i); } + /** + * Guess difficulty index. + */ public void guessDifficultyIndex() { String[] diffStr = QuestPreferences.getDifficulty(); for (int i = 0; i < diffStr.length; i++) { @@ -256,21 +466,64 @@ public final class QuestData { } // Level, read-only ( note: it increments in addWin() ) - public int getLevel() { return rankIndex; } - public String getRank() { - if (rankIndex >= RANK_TITLES.length) { rankIndex = RANK_TITLES.length - 1; } + /** + * Gets the level. + * + * @return the level + */ + public int getLevel() { + return rankIndex; + } + + /** + * Gets the rank. + * + * @return the rank + */ + public String getRank() { + if (rankIndex >= RANK_TITLES.length) { + rankIndex = RANK_TITLES.length - 1; + } return RANK_TITLES[rankIndex]; } // decks management - public ListgetDeck.
- * - * @param deckName a {@link java.lang.String} object. + * Removes the deck. + * + * @param deckName + * the deck name + */ + public void removeDeck(final String deckName) { + myDecks.remove(deckName); + } + + /** + * Adds the deck. + * + * @param d + * the d + */ + public void addDeck(final Deck d) { + myDecks.put(d.getName(), d); + } + + /** + *+ * getDeck. + *
+ * + * @param deckName + * a {@link java.lang.String} object. * @return a {@link forge.deck.Deck} object. */ public Deck getDeck(final String deckName) { @@ -284,7 +537,14 @@ public final class QuestData { } // randomizer - related - public long getRandomSeed() { return randomSeed; } + /** + * Gets the random seed. + * + * @return the random seed + */ + public long getRandomSeed() { + return randomSeed; + } /** * This method should be called whenever the opponents should change. @@ -296,15 +556,30 @@ public final class QuestData { // SERIALIZATION - related things // This must be called by XML-serializer via reflection + /** + * Read resolve. + * + * @return the object + */ public Object readResolve() { initTransients(); return this; } + /** + * Checks for save file. + * + * @return true, if successful + */ public boolean hasSaveFile() { - return ForgeProps.getFile(NewConstants.QUEST.DATA).exists() || - ForgeProps.getFile(NewConstants.QUEST.XMLDATA).exists(); + return ForgeProps.getFile(NewConstants.QUEST.DATA).exists() + || ForgeProps.getFile(NewConstants.QUEST.XMLDATA).exists(); } - public void saveData() { QuestDataIO.saveData(this); } + /** + * Save data. + */ + public void saveData() { + QuestDataIO.saveData(this); + } } diff --git a/src/main/java/forge/quest/data/QuestDataIO.java b/src/main/java/forge/quest/data/QuestDataIO.java index 0348b3921c1..5d38f34d66b 100644 --- a/src/main/java/forge/quest/data/QuestDataIO.java +++ b/src/main/java/forge/quest/data/QuestDataIO.java @@ -1,12 +1,32 @@ package forge.quest.data; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.apache.commons.lang3.StringUtils; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + import com.thoughtworks.xstream.XStream; -import com.thoughtworks.xstream.io.HierarchicalStreamReader; -import com.thoughtworks.xstream.io.HierarchicalStreamWriter; -import com.thoughtworks.xstream.mapper.MapperWrapper; import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import com.thoughtworks.xstream.mapper.MapperWrapper; import forge.error.ErrorViewer; import forge.game.GameType; @@ -19,54 +39,47 @@ import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.quest.data.item.QuestInventory; -import org.apache.commons.lang3.StringUtils; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - /** - *QuestDataIO class.
- * + *+ * QuestDataIO class. + *
+ * * @author Forge * @version $Id$ */ public class QuestDataIO { /** - *Constructor for QuestDataIO.
+ *+ * Constructor for QuestDataIO. + *
*/ public QuestDataIO() { } /** - *loadData.
- * + *+ * loadData. + *
+ * * @return a {@link forge.quest.data.QuestData} object. */ public static QuestData loadData() { try { - //read file "questData" + // read file "questData" QuestData data = null; File xmlSaveFile = ForgeProps.getFile(NewConstants.QUEST.XMLDATA); - GZIPInputStream zin = - new GZIPInputStream(new FileInputStream(xmlSaveFile)); + GZIPInputStream zin = new GZIPInputStream(new FileInputStream(xmlSaveFile)); StringBuilder xml = new StringBuilder(); char[] buf = new char[1024]; InputStreamReader reader = new InputStreamReader(zin); while (reader.ready()) { int len = reader.read(buf); - if (len == -1) { break; } // when end of stream was reached + if (len == -1) { + break; + } // when end of stream was reached xml.append(buf, 0, len); } @@ -75,7 +88,7 @@ public class QuestDataIO { xStream.registerConverter(new GameTypeToXml()); xStream.alias("CardPool", ItemPool.class); data = (QuestData) xStream.fromXML(xml.toString()); - + if (data.versionNumber != QuestData.CURRENT_VERSION_NUMBER) { updateSaveFile(data, xml.toString()); } @@ -90,52 +103,54 @@ public class QuestDataIO { } /** - *updateSaveFile.
- * - * @param newData a {@link forge.quest.data.QuestData} object. - * @param input a {@link java.lang.String} object. + *+ * updateSaveFile. + *
+ * + * @param newData + * a {@link forge.quest.data.QuestData} object. + * @param input + * a {@link java.lang.String} object. */ - private static void updateSaveFile( - final QuestData newData, final String input) { + private static void updateSaveFile(final QuestData newData, final String input) { try { - DocumentBuilder builder = - DocumentBuilderFactory.newInstance().newDocumentBuilder(); + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(input)); Document document = builder.parse(is); - switch (newData.versionNumber) { - //There should be a fall-through b/w the cases so that each + // There should be a fall-through b/w the cases so that each // version's changes get applied progressively - case 0: + case 0: // First beta release with new file format, // inventory needs to be migrated - newData.inventory = new QuestInventory(); - NodeList elements = document.getElementsByTagName("estatesLevel"); - newData.getInventory().setItemLevel("Estates", Integer.parseInt(elements.item(0).getTextContent())); - elements = document.getElementsByTagName("luckyCoinLevel"); - newData.getInventory().setItemLevel("Lucky Coin", Integer.parseInt(elements.item(0).getTextContent())); - elements = document.getElementsByTagName("sleightOfHandLevel"); - newData.getInventory().setItemLevel("Sleight", Integer.parseInt(elements.item(0).getTextContent())); - elements = document.getElementsByTagName("gearLevel"); + newData.inventory = new QuestInventory(); + NodeList elements = document.getElementsByTagName("estatesLevel"); + newData.getInventory().setItemLevel("Estates", Integer.parseInt(elements.item(0).getTextContent())); + elements = document.getElementsByTagName("luckyCoinLevel"); + newData.getInventory().setItemLevel("Lucky Coin", Integer.parseInt(elements.item(0).getTextContent())); + elements = document.getElementsByTagName("sleightOfHandLevel"); + newData.getInventory().setItemLevel("Sleight", Integer.parseInt(elements.item(0).getTextContent())); + elements = document.getElementsByTagName("gearLevel"); - int gearLevel = Integer.parseInt(elements.item(0).getTextContent()); - if (gearLevel >= 1) { - newData.inventory.setItemLevel("Map", 1); - } - if (gearLevel == 2) { - newData.inventory.setItemLevel("Zeppelin", 1); - } - // fall-through - case 1: - // nothing to do here, everything is managed by CardPoolToXml deserializer - break; - default: - break; + int gearLevel = Integer.parseInt(elements.item(0).getTextContent()); + if (gearLevel >= 1) { + newData.inventory.setItemLevel("Map", 1); + } + if (gearLevel == 2) { + newData.inventory.setItemLevel("Zeppelin", 1); + } + // fall-through + case 1: + // nothing to do here, everything is managed by CardPoolToXml + // deserializer + break; + default: + break; } - //mark the QD as the latest version + // mark the QD as the latest version newData.versionNumber = QuestData.CURRENT_VERSION_NUMBER; } catch (Exception e) { @@ -144,9 +159,12 @@ public class QuestDataIO { } /** - *saveData.
- * - * @param qd a {@link forge.quest.data.QuestData} object. + *+ * saveData. + *
+ * + * @param qd + * a {@link forge.quest.data.QuestData} object. */ public static void saveData(final QuestData qd) { try { @@ -161,10 +179,11 @@ public class QuestDataIO { zout.flush(); zout.close(); - //BufferedOutputStream boutUnp = new BufferedOutputStream(new FileOutputStream(f + ".xml")); - //xStream.toXML(qd, boutUnp); - //boutUnp.flush(); - //boutUnp.close(); + // BufferedOutputStream boutUnp = new BufferedOutputStream(new + // FileOutputStream(f + ".xml")); + // xStream.toXML(qd, boutUnp); + // boutUnp.flush(); + // boutUnp.close(); } catch (Exception ex) { ErrorViewer.showError(ex, "Error saving Quest Data."); @@ -173,8 +192,9 @@ public class QuestDataIO { } /** - * Xstream subclass that ignores fields that are present in the save but not in the class. - * This one is intended to skip fields defined in Object class (but are there any fields?) + * Xstream subclass that ignores fields that are present in the save but not + * in the class. This one is intended to skip fields defined in Object class + * (but are there any fields?) */ private static class IgnoringXStream extends XStream { ListQuestMatchState class.
- * + *+ * QuestMatchState class. + *
+ * * @author Forge * @version $Id$ */ - public class QuestMatchState { + + /** The Constant GAMES_PER_MATCH. */ public static final int GAMES_PER_MATCH = 3; + + /** The Constant MIN_GAMES_TO_WIN_MATCH. */ public static final int MIN_GAMES_TO_WIN_MATCH = 2; private ListQuestPreferences class.
- * + *+ * QuestPreferences class. + *
+ * * @author Forge * @version $Id$ */ public class QuestPreferences implements Serializable { - /** ConstantserialVersionUID=3266336025656577905L */
+ /** Constant serialVersionUID=3266336025656577905L. */
private static final long serialVersionUID = 3266336025656577905L;
- /** Constant numDiff=4 */
+ /** Constant numDiff=4. */
private static int numDiff = 4;
// Descriptive difficulty names
- /** Constant sDifficulty="{Easy, Normal, Hard, Very Hard}" */
+ /** Constant sDifficulty="{Easy, Normal, Hard, Very Hard}". */
private static String[] sDifficulty = {"Easy", "Normal", "Hard", "Very Hard"};
// Default match wins it takes to gain a booster
- /** Constant winsForBooster={1, 1, 2, 2} */
- private static int[] winsForBooster = {1, 1, 2, 2};
- /** Constant winsForRankIncrease={1, 2, 3, 4} */
- private static int[] winsForRankIncrease = {1, 2, 3, 4};
- /** Constant winsForMediumAI={6, 6, 11, 11} */
- private static int[] winsForMediumAI = {6, 6, 11, 11};
- /** Constant winsForHardAI={9, 9, 21, 21} */
- private static int[] winsForHardAI = {9, 9, 21, 21};
- /** Constant winsForVeryHardAI={29, 29, 31, 31} */
- private static int[] winsForVeryHardAI = {29, 29, 31, 31};
+ /** Constant winsForBooster={1, 1, 2, 2}. */
+ private static int[] winsForBooster = { 1, 1, 2, 2 };
+ /** Constant winsForRankIncrease={1, 2, 3, 4}. */
+ private static int[] winsForRankIncrease = { 1, 2, 3, 4 };
+ /** Constant winsForMediumAI={6, 6, 11, 11}. */
+ private static int[] winsForMediumAI = { 6, 6, 11, 11 };
+ /** Constant winsForHardAI={9, 9, 21, 21}. */
+ private static int[] winsForHardAI = { 9, 9, 21, 21 };
+ /** Constant winsForVeryHardAI={29, 29, 31, 31}. */
+ private static int[] winsForVeryHardAI = { 29, 29, 31, 31 };
// Default starting land for a quest
- /** Constant startingBasicLand=20 */
+ /** Constant startingBasicLand=20. */
private static int startingBasicLand = 20;
- /** Constant startingSnowBasicLand=20 */
+ /** Constant startingSnowBasicLand=20. */
private static int startingSnowBasicLand = 20;
// Default starting amount of each rarity
- /** Constant startingCommons={45, 40, 40, 40} */
- private static int[] startingCommons = {45, 40, 40, 40};
- /** Constant startingUncommons={20, 15, 15, 15} */
- private static int[] startingUncommons = {20, 15, 15, 15};
- /** Constant startingRares={10, 10, 10, 10} */
- private static int[] startingRares = {10, 10, 10, 10};
+ /** Constant startingCommons={45, 40, 40, 40}. */
+ private static int[] startingCommons = { 45, 40, 40, 40 };
+ /** Constant startingUncommons={20, 15, 15, 15}. */
+ private static int[] startingUncommons = { 20, 15, 15, 15 };
+ /** Constant startingRares={10, 10, 10, 10}. */
+ private static int[] startingRares = { 10, 10, 10, 10 };
- /** Constant startingCredits=250 */
+ /** Constant startingCredits=250. */
private static int startingCredits = 250;
- /** Constant boosterPackRare=1 */
+ /** Constant boosterPackRare=1. */
private static int boosterPackRare = 1;
- /** Constant boosterPackUncommon=3 */
+ /** Constant boosterPackUncommon=3. */
private static int boosterPackUncommon = 3;
- /** Constant boosterPackCommon=9 */
+ /** Constant boosterPackCommon=9. */
private static int boosterPackCommon = 9;
- /** Constant matchRewardBase=10 */
+ /** Constant matchRewardBase=10. */
private static int matchRewardBase = 10;
- /** Constant matchRewardTotalWins=0.3 */
+ /** Constant matchRewardTotalWins=0.3. */
private static double matchRewardTotalWins = 0.3;
- /** Constant matchRewardNoLosses=10 */
+ /** Constant matchRewardNoLosses=10. */
private static int matchRewardNoLosses = 10;
- /** Constant matchRewardPoisonWinBonus=50 */
+ /** Constant matchRewardPoisonWinBonus=50. */
private static int matchRewardPoisonWinBonus = 50;
- /** Constant matchRewardMilledWinBonus=40 */
+ /** Constant matchRewardMilledWinBonus=40. */
private static int matchRewardMilledWinBonus = 40;
- /** Constant matchRewardAltWinBonus=100 */
+ /** Constant matchRewardAltWinBonus=100. */
private static int matchRewardAltWinBonus = 100;
- /** Constant matchRewardWinOnFirstTurn=1500 */
+ /** Constant matchRewardWinOnFirstTurn=1500. */
private static int matchRewardWinOnFirstTurn = 1500;
- /** Constant matchRewardWinByTurnFive=250 */
+ /** Constant matchRewardWinByTurnFive=250. */
private static int matchRewardWinByTurnFive = 250;
- /** Constant matchRewardWinByTurnTen=50 */
+ /** Constant matchRewardWinByTurnTen=50. */
private static int matchRewardWinByTurnTen = 50;
- /** Constant matchRewardWinByTurnFifteen=5 */
+ /** Constant matchRewardWinByTurnFifteen=5. */
private static int matchRewardWinByTurnFifteen = 5;
- /** Constant matchRewardMullToZero=500 */
+ /** Constant matchRewardMullToZero=500. */
private static int matchRewardMullToZero = 500;
-
static {
// if quest.prefs exists
grabPrefsFromFile();
}
/**
- * grabPrefsFromFile.
+ *+ * grabPrefsFromFile. + *
*/ public static void grabPrefsFromFile() { try { BufferedReader input = new BufferedReader(new FileReader(ForgeProps.getFile(QUEST.PREFS))); String line = null; while ((line = input.readLine()) != null) { - if (line.startsWith("#") || line.length() == 0) + if (line.startsWith("#") || line.length() == 0) { continue; + } String[] split = line.split("="); - if (split[0].equals("difficultyString")) + if (split[0].equals("difficultyString")) { setDifficulty(split[1]); - else if (split[0].equals("winsForBooster")) + } else if (split[0].equals("winsForBooster")) { setWinsForBooster(split[1]); - else if (split[0].equals("winsForRankIncrease")) + } else if (split[0].equals("winsForRankIncrease")) { setWinsForRank(split[1]); - else if (split[0].equals("winsForMediumAI")) + } else if (split[0].equals("winsForMediumAI")) { setWinsForMediumAI(split[1]); - else if (split[0].equals("winsForHardAI")) + } else if (split[0].equals("winsForHardAI")) { setWinsForHardAI(split[1]); - else if (split[0].equals("startingBasicLand")) + } else if (split[0].equals("startingBasicLand")) { setStartingBasic(split[1]); - else if (split[0].equals("startingSnowBasicLand")) + } else if (split[0].equals("startingSnowBasicLand")) { setStartingSnowBasic(split[1]); - else if (split[0].equals("startingCommons")) + } else if (split[0].equals("startingCommons")) { setStartingCommons(split[1]); - else if (split[0].equals("startingUncommons")) + } else if (split[0].equals("startingUncommons")) { setStartingUncommons(split[1]); - else if (split[0].equals("startingRares")) + } else if (split[0].equals("startingRares")) { setStartingRares(split[1]); - else if (split[0].equals("startingCredits")) + } else if (split[0].equals("startingCredits")) { setStartingCredits(split[1]); - else if (split[0].equals("boosterPackCommon")) + } else if (split[0].equals("boosterPackCommon")) { setNumCommon(split[1]); - else if (split[0].equals("boosterPackUncommon")) + } else if (split[0].equals("boosterPackUncommon")) { setNumUncommon(split[1]); - else if (split[0].equals("boosterPackRare")) + } else if (split[0].equals("boosterPackRare")) { setNumRares(split[1]); - else if (split[0].equals("matchRewardBase")) + } else if (split[0].equals("matchRewardBase")) { setMatchRewardBase(split[1]); - else if (split[0].equals("matchRewardTotalWins")) + } else if (split[0].equals("matchRewardTotalWins")) { setMatchRewardTotalWins(split[1]); - else if (split[0].equals("matchRewardNoLosses")) + } else if (split[0].equals("matchRewardNoLosses")) { setMatchRewardNoLosses(split[1]); - else if (split[0].equals("matchRewardMilledWinBonus")) + } else if (split[0].equals("matchRewardMilledWinBonus")) { setMatchRewardMilledWinBonus(split[1]); - else if (split[0].equals("matchRewardPoisonWinBonus")) + } else if (split[0].equals("matchRewardPoisonWinBonus")) { setMatchRewardPoisonWinBonus(split[1]); - else if (split[0].equals("matchRewardAltWinBonus")) + } else if (split[0].equals("matchRewardAltWinBonus")) { setMatchRewardAltWinBonus(split[1]); - else if (split[0].equals("matchRewardWinOnFirstTurn")) + } else if (split[0].equals("matchRewardWinOnFirstTurn")) { setMatchRewardWinFirst(split[1]); - else if (split[0].equals("matchRewardWinByTurnFive")) + } else if (split[0].equals("matchRewardWinByTurnFive")) { setMatchRewardWinByFifth(split[1]); - else if (split[0].equals("matchRewardWinByTurnTen")) + } else if (split[0].equals("matchRewardWinByTurnTen")) { setMatchRewardWinByTen(split[1]); - else if (split[0].equals("matchRewardWinByTurnFifteen")) + } else if (split[0].equals("matchRewardWinByTurnFifteen")) { setMatchRewardWinByFifteen(split[1]); - else if (split[0].equals("matchRewardMullToZero")) + } else if (split[0].equals("matchRewardMullToZero")) { setMatchMullToZero(split[1]); + } } } catch (Exception e) { System.out.println("Trouble grabbing quest data preferences. Using default values."); @@ -160,8 +165,10 @@ public class QuestPreferences implements Serializable { } /** - *getDifficulty.
- * + *+ * getDifficulty. + *
+ * * @return an array of {@link java.lang.String} objects. */ public static String[] getDifficulty() { @@ -169,68 +176,88 @@ public class QuestPreferences implements Serializable { } /** - *getDifficulty.
- * - * @param index a int. + *+ * getDifficulty. + *
+ * + * @param index + * a int. * @return a {@link java.lang.String} object. */ - public static String getDifficulty(int index) { + public static String getDifficulty(final int index) { return sDifficulty[index]; } /** - *Getter for the field winsForBooster.
+ * Getter for the field winsForBooster.
+ *
Getter for the field winsForRankIncrease.
+ * Getter for the field winsForRankIncrease.
+ *
Getter for the field winsForMediumAI.
+ * Getter for the field winsForMediumAI.
+ *
Getter for the field winsForHardAI.
+ * Getter for the field winsForHardAI.
+ *
Getter for the field winsForVeryHardAI.
+ * Getter for the field winsForVeryHardAI.
+ *
getStartingBasic.
- * + *+ * getStartingBasic. + *
+ * * @return a int. */ public static int getStartingBasic() { @@ -238,8 +265,10 @@ public class QuestPreferences implements Serializable { } /** - *getStartingSnowBasic.
- * + *+ * getStartingSnowBasic. + *
+ * * @return a int. */ public static int getStartingSnowBasic() { @@ -247,38 +276,49 @@ public class QuestPreferences implements Serializable { } /** - *Getter for the field startingCommons.
+ * Getter for the field startingCommons.
+ *
Getter for the field startingUncommons.
+ * Getter for the field startingUncommons.
+ *
Getter for the field startingRares.
+ * Getter for the field startingRares.
+ *
Getter for the field startingCredits.
+ * Getter for the field startingCredits.
+ *
getNumCommon.
- * + *+ * getNumCommon. + *
+ * * @return a int. */ public static int getNumCommon() { @@ -295,8 +337,10 @@ public class QuestPreferences implements Serializable { } /** - *getNumUncommon.
- * + *+ * getNumUncommon. + *
+ * * @return a int. */ public static int getNumUncommon() { @@ -304,18 +348,21 @@ public class QuestPreferences implements Serializable { } /** - *getNumRare.
- * + *+ * getNumRare. + *
+ * * @return a int. */ public static int getNumRare() { return boosterPackRare; } - /** - *Getter for the field matchRewardBase.
+ * Getter for the field matchRewardBase.
+ *
Getter for the field matchRewardTotalWins.
+ * Getter for the field matchRewardTotalWins.
+ *
Getter for the field matchRewardNoLosses.
+ * Getter for the field matchRewardNoLosses.
+ *
Getter for the field matchRewardPoisonWinBonus.
+ * Getter for the field matchRewardPoisonWinBonus.
+ *
Getter for the field matchRewardMilledWinBonus.
+ * Getter for the field matchRewardMilledWinBonus.
+ *
Getter for the field matchRewardAltWinBonus.
+ * Getter for the field matchRewardAltWinBonus.
+ *
getMatchRewardWinFirst.
- * + *+ * getMatchRewardWinFirst. + *
+ * * @return a int. */ public static int getMatchRewardWinFirst() { @@ -378,8 +436,10 @@ public class QuestPreferences implements Serializable { } /** - *getMatchRewardWinByFifth.
- * + *+ * getMatchRewardWinByFifth. + *
+ * * @return a int. */ public static int getMatchRewardWinByFifth() { @@ -387,8 +447,10 @@ public class QuestPreferences implements Serializable { } /** - *getMatchRewardWinByTen.
- * + *+ * getMatchRewardWinByTen. + *
+ * * @return a int. */ public static int getMatchRewardWinByTen() { @@ -396,8 +458,10 @@ public class QuestPreferences implements Serializable { } /** - *getMatchRewardWinByFifteen.
- * + *+ * getMatchRewardWinByFifteen. + *
+ * * @return a int. */ public static int getMatchRewardWinByFifteen() { @@ -405,261 +469,342 @@ public class QuestPreferences implements Serializable { } /** - *getMatchMullToZero.
- * + *+ * getMatchMullToZero. + *
+ * * @return a int. */ public static int getMatchMullToZero() { return matchRewardMullToZero; } - // setters /** - *setDifficulty.
- * - * @param diff a {@link java.lang.String} object. + *+ * setDifficulty. + *
+ * + * @param diff + * a {@link java.lang.String} object. */ - public static void setDifficulty(String diff) { + public static void setDifficulty(final String diff) { sDifficulty = diff.split(","); } /** - *Setter for the field winsForBooster.
+ * Setter for the field winsForBooster.
+ *
setWinsForRank.
- * - * @param wins a {@link java.lang.String} object. + *+ * setWinsForRank. + *
+ * + * @param wins + * a {@link java.lang.String} object. */ - public static void setWinsForRank(String wins) { + public static void setWinsForRank(final String wins) { String[] winsStr = wins.split(","); - for (int i = 0; i < numDiff; i++) + for (int i = 0; i < numDiff; i++) { winsForRankIncrease[i] = Integer.parseInt(winsStr[i]); + } } /** - *Setter for the field winsForMediumAI.
+ * Setter for the field winsForMediumAI.
+ *
Setter for the field winsForHardAI.
+ * Setter for the field winsForHardAI.
+ *
setStartingBasic.
- * - * @param land a {@link java.lang.String} object. + *+ * setStartingBasic. + *
+ * + * @param land + * a {@link java.lang.String} object. */ - public static void setStartingBasic(String land) { + public static void setStartingBasic(final String land) { startingBasicLand = Integer.parseInt(land); } /** - *setStartingSnowBasic.
- * - * @param land a {@link java.lang.String} object. + *+ * setStartingSnowBasic. + *
+ * + * @param land + * a {@link java.lang.String} object. */ - public static void setStartingSnowBasic(String land) { + public static void setStartingSnowBasic(final String land) { startingSnowBasicLand = Integer.parseInt(land); } /** - *Setter for the field startingCommons.
+ * Setter for the field startingCommons.
+ *
Setter for the field startingUncommons.
+ * Setter for the field startingUncommons.
+ *
Setter for the field startingRares.
+ * Setter for the field startingRares.
+ *
Setter for the field startingCredits.
+ * Setter for the field startingCredits.
+ *
setNumCommon.
- * - * @param pack a {@link java.lang.String} object. + *+ * setNumCommon. + *
+ * + * @param pack + * a {@link java.lang.String} object. */ - public static void setNumCommon(String pack) { + public static void setNumCommon(final String pack) { boosterPackCommon = Integer.parseInt(pack); } /** - *setNumUncommon.
- * - * @param pack a {@link java.lang.String} object. + *+ * setNumUncommon. + *
+ * + * @param pack + * a {@link java.lang.String} object. */ - public static void setNumUncommon(String pack) { + public static void setNumUncommon(final String pack) { boosterPackUncommon = Integer.parseInt(pack); } /** - *setNumRares.
- * - * @param pack a {@link java.lang.String} object. + *+ * setNumRares. + *
+ * + * @param pack + * a {@link java.lang.String} object. */ - public static void setNumRares(String pack) { + public static void setNumRares(final String pack) { boosterPackRare = Integer.parseInt(pack); } - /** - *Setter for the field matchRewardBase.
+ * Setter for the field matchRewardBase.
+ *
Setter for the field matchRewardTotalWins.
+ * Setter for the field matchRewardTotalWins.
+ *
Setter for the field matchRewardNoLosses.
+ * Setter for the field matchRewardNoLosses.
+ *
Setter for the field matchRewardPoisonWinBonus.
+ * Setter for the field matchRewardPoisonWinBonus.
+ *
Setter for the field matchRewardMilledWinBonus.
+ * Setter for the field matchRewardMilledWinBonus.
+ *
Setter for the field matchRewardAltWinBonus.
+ * Setter for the field matchRewardAltWinBonus.
+ *
setMatchRewardWinFirst.
- * - * @param match a {@link java.lang.String} object. + *+ * setMatchRewardWinFirst. + *
+ * + * @param match + * a {@link java.lang.String} object. */ - public static void setMatchRewardWinFirst(String match) { + public static void setMatchRewardWinFirst(final String match) { matchRewardWinOnFirstTurn = Integer.parseInt(match); } /** - *setMatchRewardWinByFifth.
- * - * @param match a {@link java.lang.String} object. + *+ * setMatchRewardWinByFifth. + *
+ * + * @param match + * a {@link java.lang.String} object. */ - public static void setMatchRewardWinByFifth(String match) { + public static void setMatchRewardWinByFifth(final String match) { matchRewardWinByTurnFive = Integer.parseInt(match); } /** - *setMatchRewardWinByTen.
- * - * @param match a {@link java.lang.String} object. + *+ * setMatchRewardWinByTen. + *
+ * + * @param match + * a {@link java.lang.String} object. */ - public static void setMatchRewardWinByTen(String match) { + public static void setMatchRewardWinByTen(final String match) { matchRewardWinByTurnTen = Integer.parseInt(match); } /** - *setMatchRewardWinByFifteen.
- * - * @param match a {@link java.lang.String} object. + *+ * setMatchRewardWinByFifteen. + *
+ * + * @param match + * a {@link java.lang.String} object. */ - public static void setMatchRewardWinByFifteen(String match) { + public static void setMatchRewardWinByFifteen(final String match) { matchRewardWinByTurnFifteen = Integer.parseInt(match); } /** - *setMatchMullToZero.
- * - * @param match a {@link java.lang.String} object. + *+ * setMatchMullToZero. + *
+ * + * @param match + * a {@link java.lang.String} object. */ - public static void setMatchMullToZero(String match) { + public static void setMatchMullToZero(final String match) { matchRewardMullToZero = Integer.parseInt(match); } } diff --git a/src/main/java/forge/quest/data/QuestUtil.java b/src/main/java/forge/quest/data/QuestUtil.java index 5387c7db7b2..65891340320 100644 --- a/src/main/java/forge/quest/data/QuestUtil.java +++ b/src/main/java/forge/quest/data/QuestUtil.java @@ -1,31 +1,36 @@ package forge.quest.data; +import java.util.List; + import forge.AllZone; import forge.Card; import forge.CardList; import forge.CardUtil; import forge.Constant; import forge.Player; -import forge.card.CardRarity; import forge.card.BoosterUtils; +import forge.card.CardRarity; import forge.item.CardPrinted; import forge.quest.gui.main.QuestChallenge; import forge.quest.gui.main.QuestEvent; -import java.util.List; - /** - *QuestUtil class.
+ *+ * QuestUtil class. + *
* MODEL - Static utility methods to help with minor tasks around Quest. - * + * * @author Forge * @version $Id$ */ public class QuestUtil { /** - *getComputerStartingCards.
- * - * @param qd a {@link forge.quest.data.QuestData} object. + *+ * getComputerStartingCards. + *
+ * + * @param qd + * a {@link forge.quest.data.QuestData} object. * @return a {@link forge.CardList} object. */ public static CardList getComputerStartingCards(final QuestData qd) { @@ -33,32 +38,39 @@ public class QuestUtil { } /** - *getComputerStartingCards.
+ *+ * getComputerStartingCards. + *
* Returns new card instances of extra AI cards in play at start of event. - * - * @param qd a {@link forge.quest.data.QuestData} object. - * @param qe a {@link forge.quest.gui.main.QuestEvent} object. + * + * @param qd + * a {@link forge.quest.data.QuestData} object. + * @param qe + * a {@link forge.quest.gui.main.QuestEvent} object. * @return a {@link forge.CardList} object. */ - public static CardList getComputerStartingCards(final QuestData qd, QuestEvent qe) { + public static CardList getComputerStartingCards(final QuestData qd, final QuestEvent qe) { CardList list = new CardList(); - - if(qe.getEventType().equals("challenge")) { - ListgetHumanStartingCards.
+ *+ * getHumanStartingCards. + *
* Returns list of current plant/pet configuration only. - * - * @param qd a {@link forge.quest.data.QuestData} object. + * + * @param qd + * a {@link forge.quest.data.QuestData} object. * @return a {@link forge.CardList} object. */ public static CardList getHumanStartingCards(final QuestData qd) { @@ -76,119 +88,121 @@ public class QuestUtil { } /** - *getHumanStartingCards.
- * Returns new card instances of extra human cards, - * including current plant/pet configuration, - * and cards in play at start of quest. - * - * @param qd a {@link forge.quest.data.QuestData} object. - * @param qe a {@link forge.quest.gui.main.QuestEvent} object. + *+ * getHumanStartingCards. + *
+ * Returns new card instances of extra human cards, including current + * plant/pet configuration, and cards in play at start of quest. + * + * @param qd + * a {@link forge.quest.data.QuestData} object. + * @param qe + * a {@link forge.quest.gui.main.QuestEvent} object. * @return a {@link forge.CardList} object. */ - public static CardList getHumanStartingCards(final QuestData qd, QuestEvent qe) { + public static CardList getHumanStartingCards(final QuestData qd, final QuestEvent qe) { CardList list = getHumanStartingCards(qd); - - if(qe.getEventType().equals("challenge")) { - ListcreateToken.
+ *+ * createToken. + *
* Creates a card instance for token defined by property string. * - * @param s Properties string of token (TOKEN;W;1;1;sheep;type;type;type...) + * @param s + * Properties string of token + * (TOKEN;W;1;1;sheep;type;type;type...) * @return token Card */ - public static Card createToken(String s) { - String[] properties = s.split(";");; - + public static Card createToken(final String s) { + String[] properties = s.split(";"); Card c = new Card(); c.setToken(true); - - //c.setManaCost(properties[1]); + + // c.setManaCost(properties[1]); c.addColor(properties[1]); c.setBaseAttack(Integer.parseInt(properties[2])); c.setBaseDefense(Integer.parseInt(properties[3])); c.setName(properties[4]); - - c.setImageName( - properties[1]+" "+ - properties[2]+" "+ - properties[3]+" "+ - properties[4] - ); + + c.setImageName(properties[1] + " " + properties[2] + " " + properties[3] + " " + properties[4]); int x = 5; - while(x != properties.length) { + while (x != properties.length) { c.addType(properties[x++]); - } + } return c; } - + /** - *generateCardRewardList.
+ *+ * generateCardRewardList. + *
* Takes a reward list string, parses, and returns list of cards rewarded. * - * @param s Properties string of reward (97 multicolor rares) + * @param s + * Properties string of reward (97 multicolor rares) * @return CardList */ - public static ListreadExtraCard.
+ *+ * readExtraCard. + *
* Creates single card for a string read from unique event properties. * * @param name + * the name * @param owner - * @return + * the owner + * @return the card */ - public static Card readExtraCard(String name, Player owner) { + public static Card readExtraCard(final String name, final Player owner) { // Token card creation Card tempcard; - if(name.startsWith("TOKEN")) { + if (name.startsWith("TOKEN")) { tempcard = QuestUtil.createToken(name); tempcard.addController(owner); tempcard.setOwner(owner); @@ -202,4 +216,4 @@ public class QuestUtil { return tempcard; } -} //QuestUtil +} // QuestUtil diff --git a/src/main/java/forge/quest/data/QuestUtilCards.java b/src/main/java/forge/quest/data/QuestUtilCards.java index a56a2581462..74db4da280b 100644 --- a/src/main/java/forge/quest/data/QuestUtilCards.java +++ b/src/main/java/forge/quest/data/QuestUtilCards.java @@ -6,12 +6,11 @@ import java.util.Map.Entry; import net.slightlymagic.braids.util.lambda.Lambda1; import net.slightlymagic.maxmtg.Predicate; - import forge.MyRandom; import forge.SetUtils; import forge.card.BoosterGenerator; -import forge.card.CardRarity; import forge.card.BoosterUtils; +import forge.card.CardRarity; import forge.card.CardSet; import forge.deck.Deck; import forge.item.BoosterPack; @@ -21,15 +20,34 @@ import forge.item.InventoryItem; import forge.item.ItemPool; import forge.item.ItemPoolView; -/** - * This is a helper class to execute operations on QuestData. - * It has been created to decrease complexity of questData class +/** + * This is a helper class to execute operations on QuestData. It has been + * created to decrease complexity of questData class */ public final class QuestUtilCards { private QuestData q; - public QuestUtilCards(final QuestData qd) { q = qd; } - public void addBasicLands(ItemPooladdCards.
+ *+ * addCards. + *
+ * + * @param fSets + * the f sets + * @return the array list */ public ArrayList