mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
checkstyle
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
/**
|
||||
* <p>ForgePreferences class.</p>
|
||||
*
|
||||
* <p>
|
||||
* ForgePreferences class.
|
||||
* </p>
|
||||
*
|
||||
* @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 List<SavePreferencesListener> saveListeners = new ArrayList<SavePreferencesListener>();
|
||||
private final String fileName;
|
||||
|
||||
/**
|
||||
* <p>Constructor for ForgePreferences.</p>
|
||||
*
|
||||
* @param fileName a {@link java.lang.String} object.
|
||||
* @throws java.lang.Exception if any.
|
||||
* <p>
|
||||
* Constructor for ForgePreferences.
|
||||
* </p>
|
||||
*
|
||||
* @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 {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>save.</p>
|
||||
*
|
||||
* @throws java.lang.Exception if any.
|
||||
* <p>
|
||||
* save.
|
||||
* </p>
|
||||
*
|
||||
* @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 {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>addSaveListener.</p>
|
||||
*
|
||||
* @param listener a {@link forge.properties.SavePreferencesListener} object.
|
||||
* <p>
|
||||
* addSaveListener.
|
||||
* </p>
|
||||
*
|
||||
* @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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
/** Constant <code>properties</code> */
|
||||
/** Constant <code>properties</code>. */
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <code>HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL"</code>. */
|
||||
// General properties
|
||||
/**
|
||||
* Constant
|
||||
* <code>HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL"</code>.
|
||||
*/
|
||||
String HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL";
|
||||
|
||||
/** Constant <code>SHOW2CDECK="showdeck/2color"</code>. */
|
||||
@@ -101,7 +104,10 @@ public interface NewConstants {
|
||||
/** Constant <code>BOOSTERDATA="boosterdata"</code>. */
|
||||
String BOOSTERDATA = "boosterdata";
|
||||
|
||||
/** The MT g_ data. */
|
||||
String MTG_DATA = "mtg-data";
|
||||
|
||||
/** The SYMBOL s_ small. */
|
||||
String SYMBOLS_SMALL = "symbols/small";
|
||||
|
||||
/** Constant <code>IMAGE_BASE="image/base"</code>. */
|
||||
@@ -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";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>Constructor for Preferences.</p>
|
||||
* <p>
|
||||
* Constructor for Preferences.
|
||||
* </p>
|
||||
*/
|
||||
public Preferences() {
|
||||
props = new Properties();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for Preferences.</p>
|
||||
*
|
||||
* @param prefs a {@link forge.properties.Preferences} object.
|
||||
* <p>
|
||||
* Constructor for Preferences.
|
||||
* </p>
|
||||
*
|
||||
* @param prefs
|
||||
* a {@link forge.properties.Preferences} object.
|
||||
*/
|
||||
public Preferences(Preferences prefs) {
|
||||
public Preferences(final Preferences prefs) {
|
||||
props = prefs.props;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>keys.</p>
|
||||
*
|
||||
* <p>
|
||||
* keys.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.util.Enumeration} object.
|
||||
*/
|
||||
public synchronized Enumeration<String> keys() {
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public final synchronized Enumeration<String> keys() {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
Set<String> keysEnum = (Set) props.keySet();
|
||||
Vector<String> keyList = new Vector<String>();
|
||||
keyList.addAll(keysEnum);
|
||||
@@ -47,15 +58,21 @@ public class Preferences {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getInt.</p>
|
||||
*
|
||||
* @param name a {@link java.lang.String} object.
|
||||
* @param defaultValue a int.
|
||||
* <p>
|
||||
* getInt.
|
||||
* </p>
|
||||
*
|
||||
* @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 {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getBoolean.</p>
|
||||
*
|
||||
* @param name a {@link java.lang.String} object.
|
||||
* @param defaultValue a boolean.
|
||||
* <p>
|
||||
* getBoolean.
|
||||
* </p>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getLong.</p>
|
||||
*
|
||||
* @param name a {@link java.lang.String} object.
|
||||
* @param defaultValue a long.
|
||||
* <p>
|
||||
* getLong.
|
||||
* </p>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>set.</p>
|
||||
*
|
||||
* @param key a {@link java.lang.String} object.
|
||||
* @param value a {@link java.lang.Object} object.
|
||||
* <p>
|
||||
* set.
|
||||
* </p>
|
||||
*
|
||||
* @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));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>get.</p>
|
||||
*
|
||||
* @param key a {@link java.lang.String} object.
|
||||
* @param value a {@link java.lang.Object} object.
|
||||
* <p>
|
||||
* get.
|
||||
* </p>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>load.</p>
|
||||
*
|
||||
* @param stream a {@link java.io.FileInputStream} object.
|
||||
* @throws java.io.IOException if any.
|
||||
* <p>
|
||||
* load.
|
||||
* </p>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>store.</p>
|
||||
*
|
||||
* @param stream a {@link java.io.FileOutputStream} object.
|
||||
* @param comments a {@link java.lang.String} object.
|
||||
* @throws java.io.IOException if any.
|
||||
* <p>
|
||||
* store.
|
||||
* </p>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package forge.properties;
|
||||
|
||||
/**
|
||||
* <p>SavePreferencesListener interface.</p>
|
||||
*
|
||||
* <p>
|
||||
* SavePreferencesListener interface.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface SavePreferencesListener {
|
||||
/**
|
||||
* <p>savePreferences.</p>
|
||||
* <p>
|
||||
* savePreferences.
|
||||
* </p>
|
||||
*/
|
||||
public void savePreferences();
|
||||
void savePreferences();
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** Forge Card Game */
|
||||
/** Forge Card Game. */
|
||||
package forge.properties;
|
||||
|
||||
@@ -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
|
||||
|
||||
/**
|
||||
* <p>QuestData class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestData class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class QuestData {
|
||||
|
||||
//This field holds the version of the Quest Data
|
||||
/** Constant <code>CURRENT_VERSION_NUMBER=2</code> */
|
||||
// This field holds the version of the Quest Data
|
||||
/** Constant <code>CURRENT_VERSION_NUMBER=2</code>. */
|
||||
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. */
|
||||
Map<String, Deck> myDecks = new HashMap<String, Deck>();
|
||||
|
||||
// Cards associated with quest
|
||||
ItemPool<InventoryItem> cardPool = new ItemPool<InventoryItem>(InventoryItem.class); // player's belonging
|
||||
ItemPool<InventoryItem> shopList = new ItemPool<InventoryItem>(InventoryItem.class); // the current shop list
|
||||
ItemPool<InventoryItem> newCardList = new ItemPool<InventoryItem>(InventoryItem.class); // cards acquired since last game-win/loss
|
||||
/** The card pool. */
|
||||
ItemPool<InventoryItem> cardPool = new ItemPool<InventoryItem>(InventoryItem.class); // player's
|
||||
// belonging
|
||||
/** The shop list. */
|
||||
ItemPool<InventoryItem> shopList = new ItemPool<InventoryItem>(InventoryItem.class); // the
|
||||
// current
|
||||
// shop
|
||||
// list
|
||||
/** The new card list. */
|
||||
ItemPool<InventoryItem> newCardList = new ItemPool<InventoryItem>(InventoryItem.class); // cards
|
||||
// acquired
|
||||
// since
|
||||
// last
|
||||
// game-win/loss
|
||||
|
||||
// Challenge history
|
||||
/** The challenges played. */
|
||||
int challengesPlayed = 0;
|
||||
|
||||
/** The available challenges. */
|
||||
List<Integer> availableChallenges = new ArrayList<Integer>();
|
||||
|
||||
/** The completed challenges. */
|
||||
List<Integer> completedChallenges = new ArrayList<Integer>();
|
||||
|
||||
// Challenges used to be called quests. During the renaming,
|
||||
// files could be corrupted. These fields ensure old files still work.
|
||||
|
||||
// Challenges used to be called quests. During the renaming,
|
||||
// files could be corrupted. These fields ensure old files still work.
|
||||
// These fields should be phased out after a little while.
|
||||
// The old files, if played once, are updated automatically to the new system.
|
||||
// The old files, if played once, are updated automatically to the new
|
||||
// system.
|
||||
/** The quests played. */
|
||||
int questsPlayed = -1;
|
||||
|
||||
/** The available quests. */
|
||||
List<Integer> availableQuests = null;
|
||||
|
||||
/** The completed quests. */
|
||||
List<Integer> completedQuests = null;
|
||||
|
||||
// own randomizer seed
|
||||
private long randomSeed = 0;
|
||||
|
||||
// Utility class to access cards, has access to private fields
|
||||
// Moved some methods there that otherwise would make this class even more complex
|
||||
// Moved some methods there that otherwise would make this class even more
|
||||
// complex
|
||||
private transient QuestUtilCards myCards;
|
||||
|
||||
public static final String[] RANK_TITLES = new String[]{
|
||||
"Level 0 - Confused Wizard",
|
||||
"Level 1 - Mana Mage",
|
||||
"Level 2 - Death by Megrim",
|
||||
"Level 3 - Shattered the Competition",
|
||||
"Level 4 - Black Knighted",
|
||||
"Level 5 - Shockingly Good",
|
||||
"Level 6 - Regressed into Timmy",
|
||||
"Level 7 - Loves Blue Control",
|
||||
"Level 8 - Immobilized by Fear",
|
||||
"Level 9 - Lands = Friends",
|
||||
"Level 10 - Forging new paths",
|
||||
"Level 11 - Infect-o-tron",
|
||||
"Level 12 - Great Balls of Fire",
|
||||
"Level 13 - Artifact Schmartifact",
|
||||
"Level 14 - Mike Mulligan's The Name",
|
||||
"Level 15 - Fresh Air: Good For The Health",
|
||||
"Level 16 - In It For The Love",
|
||||
"Level 17 - Sticks, Stones, Bones",
|
||||
"Level 18 - Credits For Breakfast",
|
||||
"Level 19 - Millasaurus",
|
||||
"Level 20 - One-turn Wonder",
|
||||
"Teaching Gandalf a Lesson",
|
||||
"What Do You Do With The Other Hand?",
|
||||
"Freelance Sorcerer, Works Weekends",
|
||||
"Should We Hire Commentators?",
|
||||
"Saltblasted For Your Talent",
|
||||
"Serra Angel Is Your Girlfriend",
|
||||
};
|
||||
/** The Constant RANK_TITLES. */
|
||||
public static final String[] RANK_TITLES = new String[] {"Level 0 - Confused Wizard", "Level 1 - Mana Mage",
|
||||
"Level 2 - Death by Megrim", "Level 3 - Shattered the Competition", "Level 4 - Black Knighted",
|
||||
"Level 5 - Shockingly Good", "Level 6 - Regressed into Timmy", "Level 7 - Loves Blue Control",
|
||||
"Level 8 - Immobilized by Fear", "Level 9 - Lands = Friends", "Level 10 - Forging new paths",
|
||||
"Level 11 - Infect-o-tron", "Level 12 - Great Balls of Fire", "Level 13 - Artifact Schmartifact",
|
||||
"Level 14 - Mike Mulligan's The Name", "Level 15 - Fresh Air: Good For The Health",
|
||||
"Level 16 - In It For The Love", "Level 17 - Sticks, Stones, Bones", "Level 18 - Credits For Breakfast",
|
||||
"Level 19 - Millasaurus", "Level 20 - One-turn Wonder", "Teaching Gandalf a Lesson",
|
||||
"What Do You Do With The Other Hand?", "Freelance Sorcerer, Works Weekends",
|
||||
"Should We Hire Commentators?", "Saltblasted For Your Talent", "Serra Angel Is Your Girlfriend", };
|
||||
|
||||
/**
|
||||
* <p>Constructor for QuestData.</p>
|
||||
* <p>
|
||||
* Constructor for QuestData.
|
||||
* </p>
|
||||
*/
|
||||
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 ItemPool<InventoryItem>(InventoryItem.class); }
|
||||
if (null == shopList) { shopList = new ItemPool<InventoryItem>(InventoryItem.class); }
|
||||
if (null == newCardList) {
|
||||
newCardList = new ItemPool<InventoryItem>(InventoryItem.class);
|
||||
}
|
||||
if (null == shopList) {
|
||||
shopList = new ItemPool<InventoryItem>(InventoryItem.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* New game.
|
||||
*
|
||||
* @param diff
|
||||
* the diff
|
||||
* @param m0de
|
||||
* the m0de
|
||||
* @param standardStart
|
||||
* the standard start
|
||||
*/
|
||||
public void newGame(final int diff, final String m0de, final boolean standardStart) {
|
||||
setDifficulty(diff);
|
||||
|
||||
Predicate<CardPrinted> filter = standardStart ? SetUtils.getStandard().getFilterPrinted() : CardPrinted.Predicates.Presets.isTrue;
|
||||
Predicate<CardPrinted> filter = standardStart ? SetUtils.getStandard().getFilterPrinted()
|
||||
: CardPrinted.Predicates.Presets.isTrue;
|
||||
|
||||
myCards.setupNewGameCardPool(filter, diff);
|
||||
credits = QuestPreferences.getStartingCredits();
|
||||
@@ -150,102 +195,267 @@ public final class QuestData {
|
||||
}
|
||||
|
||||
// All belongings
|
||||
public QuestInventory getInventory() { return inventory; }
|
||||
public QuestPetManager getPetManager() { return petManager; }
|
||||
/**
|
||||
* Gets the inventory.
|
||||
*
|
||||
* @return the inventory
|
||||
*/
|
||||
public QuestInventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pet manager.
|
||||
*
|
||||
* @return the pet manager
|
||||
*/
|
||||
public QuestPetManager getPetManager() {
|
||||
return petManager;
|
||||
}
|
||||
|
||||
// Cards - class uses data from here
|
||||
public QuestUtilCards getCards() { return myCards; }
|
||||
/**
|
||||
* Gets the cards.
|
||||
*
|
||||
* @return the cards
|
||||
*/
|
||||
public QuestUtilCards getCards() {
|
||||
return myCards;
|
||||
}
|
||||
|
||||
// Challenge performance
|
||||
/**
|
||||
* Gets the challenges played.
|
||||
*
|
||||
* @return the challenges played
|
||||
*/
|
||||
public int getChallengesPlayed() {
|
||||
// This should be phased out after a while, when
|
||||
// old quest decks have been updated. (changes made 19-9-11)
|
||||
if(questsPlayed!=-1) {
|
||||
if (questsPlayed != -1) {
|
||||
challengesPlayed = questsPlayed;
|
||||
questsPlayed = -1;
|
||||
questsPlayed = -1;
|
||||
}
|
||||
|
||||
|
||||
return challengesPlayed;
|
||||
}
|
||||
|
||||
public void addChallengesPlayed() { challengesPlayed++; }
|
||||
|
||||
public List<Integer> getAvailableChallenges() {
|
||||
/**
|
||||
* Adds the challenges played.
|
||||
*/
|
||||
public void addChallengesPlayed() {
|
||||
challengesPlayed++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the available challenges.
|
||||
*
|
||||
* @return the available challenges
|
||||
*/
|
||||
public List<Integer> getAvailableChallenges() {
|
||||
// This should be phased out after a while, when
|
||||
// old quest decks have been updated. (changes made 19-9-11)
|
||||
if(availableQuests != null) {
|
||||
if (availableQuests != null) {
|
||||
availableChallenges = availableQuests;
|
||||
availableQuests = null;
|
||||
}
|
||||
|
||||
return availableChallenges != null ? new ArrayList<Integer>(availableChallenges) : null;
|
||||
|
||||
return availableChallenges != null ? new ArrayList<Integer>(availableChallenges) : null;
|
||||
}
|
||||
|
||||
public void setAvailableChallenges(final List<Integer> list) { availableChallenges = list; }
|
||||
public void clearAvailableChallenges() { availableChallenges.clear(); }
|
||||
|
||||
|
||||
/**
|
||||
* <p>getCompletedChallenges.</p>
|
||||
* Sets the available challenges.
|
||||
*
|
||||
* @param list
|
||||
* the new available challenges
|
||||
*/
|
||||
public void setAvailableChallenges(final List<Integer> list) {
|
||||
availableChallenges = list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear available challenges.
|
||||
*/
|
||||
public void clearAvailableChallenges() {
|
||||
availableChallenges.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getCompletedChallenges.
|
||||
* </p>
|
||||
* Returns stored list of non-repeatable challenge IDs.
|
||||
*
|
||||
* @return List<Integer>
|
||||
*/
|
||||
public List<Integer> getCompletedChallenges() {
|
||||
public List<Integer> getCompletedChallenges() {
|
||||
// This should be phased out after a while, when
|
||||
// old quest decks have been updated. (changes made 19-9-11)
|
||||
// Also, poorly named - this should be "getLockedChalleneges" or similar.
|
||||
if(completedQuests != null) {
|
||||
// Also, poorly named - this should be "getLockedChalleneges" or
|
||||
// similar.
|
||||
if (completedQuests != null) {
|
||||
completedChallenges = completedQuests;
|
||||
completedQuests = null;
|
||||
}
|
||||
|
||||
return completedChallenges != null ? new ArrayList<Integer>(completedChallenges) : null;
|
||||
|
||||
return completedChallenges != null ? new ArrayList<Integer>(completedChallenges) : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>addCompletedChallenge.</p>
|
||||
* <p>
|
||||
* addCompletedChallenge.
|
||||
* </p>
|
||||
* 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 List<String> getDeckNames() { return new ArrayList<String>(myDecks.keySet()); }
|
||||
public void removeDeck(final String deckName) { myDecks.remove(deckName); }
|
||||
public void addDeck(final Deck d) { myDecks.put(d.getName(), d); }
|
||||
/**
|
||||
* Gets the deck names.
|
||||
*
|
||||
* @return the deck names
|
||||
*/
|
||||
public List<String> getDeckNames() {
|
||||
return new ArrayList<String>(myDecks.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getDeck.</p>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getDeck.
|
||||
* </p>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>QuestDataIO class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestDataIO class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestDataIO {
|
||||
/**
|
||||
* <p>Constructor for QuestDataIO.</p>
|
||||
* <p>
|
||||
* Constructor for QuestDataIO.
|
||||
* </p>
|
||||
*/
|
||||
public QuestDataIO() {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>loadData.</p>
|
||||
*
|
||||
* <p>
|
||||
* loadData.
|
||||
* </p>
|
||||
*
|
||||
* @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 {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>updateSaveFile.</p>
|
||||
*
|
||||
* @param newData a {@link forge.quest.data.QuestData} object.
|
||||
* @param input a {@link java.lang.String} object.
|
||||
* <p>
|
||||
* updateSaveFile.
|
||||
* </p>
|
||||
*
|
||||
* @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 {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>saveData.</p>
|
||||
*
|
||||
* @param qd a {@link forge.quest.data.QuestData} object.
|
||||
* <p>
|
||||
* saveData.
|
||||
* </p>
|
||||
*
|
||||
* @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 {
|
||||
List<String> ignoredFields = new ArrayList<String>();
|
||||
@@ -183,9 +203,7 @@ public class QuestDataIO {
|
||||
protected MapperWrapper wrapMapper(MapperWrapper next) {
|
||||
return new MapperWrapper(next) {
|
||||
@Override
|
||||
public boolean shouldSerializeMember(
|
||||
@SuppressWarnings("rawtypes") Class definedIn,
|
||||
String fieldName) {
|
||||
public boolean shouldSerializeMember(@SuppressWarnings("rawtypes") Class definedIn, String fieldName) {
|
||||
if (definedIn == Object.class) {
|
||||
ignoredFields.add(fieldName);
|
||||
return false;
|
||||
@@ -196,7 +214,6 @@ public class QuestDataIO {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class GameTypeToXml implements Converter {
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
@@ -214,9 +231,9 @@ public class QuestDataIO {
|
||||
String value = reader.getValue();
|
||||
return GameType.smartValueOf(value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class CardPoolToXml implements Converter {
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
@@ -224,40 +241,41 @@ public class QuestDataIO {
|
||||
return clasz.equals(ItemPool.class);
|
||||
}
|
||||
|
||||
private void write(CardPrinted cref, Integer count, HierarchicalStreamWriter writer)
|
||||
{
|
||||
private void write(CardPrinted cref, Integer count, HierarchicalStreamWriter writer) {
|
||||
writer.startNode("card");
|
||||
writer.addAttribute("c", cref.getName());
|
||||
writer.addAttribute("s", cref.getSet());
|
||||
if (cref.isFoil()) { writer.addAttribute("foil", "1"); }
|
||||
if (cref.getArtIndex() > 0) { writer.addAttribute("i", Integer.toString(cref.getArtIndex())); }
|
||||
if (cref.isFoil()) {
|
||||
writer.addAttribute("foil", "1");
|
||||
}
|
||||
if (cref.getArtIndex() > 0) {
|
||||
writer.addAttribute("i", Integer.toString(cref.getArtIndex()));
|
||||
}
|
||||
writer.addAttribute("n", count.toString());
|
||||
writer.endNode();
|
||||
}
|
||||
|
||||
private void write(BoosterPack booster, Integer count, HierarchicalStreamWriter writer)
|
||||
{
|
||||
private void write(BoosterPack booster, Integer count, HierarchicalStreamWriter writer) {
|
||||
writer.startNode("booster");
|
||||
writer.addAttribute("s", booster.getSet());
|
||||
writer.addAttribute("n", count.toString());
|
||||
writer.endNode();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ItemPool<InventoryItem> pool = (ItemPool<InventoryItem>) source;
|
||||
for (Entry<InventoryItem, Integer> e : pool) {
|
||||
InventoryItem item = e.getKey();
|
||||
InventoryItem item = e.getKey();
|
||||
Integer count = e.getValue();
|
||||
if (item instanceof CardPrinted) {
|
||||
write((CardPrinted) item, count, writer);
|
||||
} else if (item instanceof BoosterPack) {
|
||||
write((BoosterPack) item, count, writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -269,7 +287,7 @@ public class QuestDataIO {
|
||||
int cnt = StringUtils.isNumeric(sCnt) ? Integer.parseInt(sCnt) : 1;
|
||||
String nodename = reader.getNodeName();
|
||||
|
||||
if("string".equals(nodename)) {
|
||||
if ("string".equals(nodename)) {
|
||||
result.add(CardDb.instance().getCard(reader.getValue()));
|
||||
} else if ("card".equals(nodename)) { // new format
|
||||
result.add(readCardPrinted(reader), cnt);
|
||||
@@ -280,15 +298,13 @@ public class QuestDataIO {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private BoosterPack readBooster(final HierarchicalStreamReader reader)
|
||||
{
|
||||
|
||||
private BoosterPack readBooster(final HierarchicalStreamReader reader) {
|
||||
String set = reader.getAttribute("s");
|
||||
return new BoosterPack(set);
|
||||
}
|
||||
|
||||
private CardPrinted readCardPrinted(final HierarchicalStreamReader reader)
|
||||
{
|
||||
private CardPrinted readCardPrinted(final HierarchicalStreamReader reader) {
|
||||
String name = reader.getAttribute("c");
|
||||
String set = reader.getAttribute("s");
|
||||
String sIndex = reader.getAttribute("i");
|
||||
|
||||
@@ -7,39 +7,72 @@ import java.util.Map;
|
||||
|
||||
import forge.game.GameSummary;
|
||||
|
||||
|
||||
/**
|
||||
* <p>QuestMatchState class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestMatchState class.
|
||||
* </p>
|
||||
*
|
||||
* @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 List<GameSummary> gamesPlayed = new ArrayList<GameSummary>();
|
||||
//ArrayList<GameSpecialConditions>
|
||||
|
||||
// ArrayList<GameSpecialConditions>
|
||||
|
||||
/**
|
||||
* Adds the game played.
|
||||
*
|
||||
* @param completedGame
|
||||
* the completed game
|
||||
*/
|
||||
public final void addGamePlayed(final GameSummary completedGame) {
|
||||
gamesPlayed.add(completedGame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the games played.
|
||||
*
|
||||
* @return the games played
|
||||
*/
|
||||
public final GameSummary[] getGamesPlayed() {
|
||||
return gamesPlayed.toArray(new GameSummary[gamesPlayed.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the games played count.
|
||||
*
|
||||
* @return the games played count
|
||||
*/
|
||||
public final int getGamesPlayedCount() {
|
||||
return gamesPlayed.size();
|
||||
}
|
||||
|
||||
public final boolean hasWonLastGame(String playerName) {
|
||||
/**
|
||||
* Checks for won last game.
|
||||
*
|
||||
* @param playerName
|
||||
* the player name
|
||||
* @return true, if successful
|
||||
*/
|
||||
public final boolean hasWonLastGame(final String playerName) {
|
||||
int iLastGame = gamesPlayed.size() - 1;
|
||||
return iLastGame >= 0 ? gamesPlayed.get(iLastGame).isWinner(playerName) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is match over.
|
||||
*
|
||||
* @return true, if is match over
|
||||
*/
|
||||
public final boolean isMatchOver() {
|
||||
int totalGames = 0;
|
||||
|
||||
@@ -51,8 +84,8 @@ public class QuestMatchState {
|
||||
winsCount.put(winner, wins + 1);
|
||||
totalGames++;
|
||||
}
|
||||
|
||||
int maxWins = 0;
|
||||
|
||||
int maxWins = 0;
|
||||
for (Integer win : winsCount.values()) {
|
||||
maxWins = Math.max(maxWins, win);
|
||||
}
|
||||
@@ -60,18 +93,37 @@ public class QuestMatchState {
|
||||
return maxWins >= MIN_GAMES_TO_WIN_MATCH || totalGames >= GAMES_PER_MATCH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count games won by.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @return the int
|
||||
*/
|
||||
public final int countGamesWonBy(String name) {
|
||||
int wins = 0;
|
||||
for (GameSummary game : gamesPlayed) {
|
||||
if (game.isWinner(name)) { wins++; }
|
||||
if (game.isWinner(name)) {
|
||||
wins++;
|
||||
}
|
||||
}
|
||||
return wins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is match won by.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @return true, if is match won by
|
||||
*/
|
||||
public final boolean isMatchWonBy(String name) {
|
||||
return countGamesWonBy(name) >= MIN_GAMES_TO_WIN_MATCH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset.
|
||||
*/
|
||||
public final void reset() {
|
||||
gamesPlayed.clear();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>QuestUtil class.</p>
|
||||
* <p>
|
||||
* QuestUtil class.
|
||||
* </p>
|
||||
* MODEL - Static utility methods to help with minor tasks around Quest.
|
||||
*
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestUtil {
|
||||
/**
|
||||
* <p>getComputerStartingCards.</p>
|
||||
*
|
||||
* @param qd a {@link forge.quest.data.QuestData} object.
|
||||
* <p>
|
||||
* getComputerStartingCards.
|
||||
* </p>
|
||||
*
|
||||
* @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 {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getComputerStartingCards.</p>
|
||||
* <p>
|
||||
* getComputerStartingCards.
|
||||
* </p>
|
||||
* 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")) {
|
||||
List<String> extras = ((QuestChallenge)qe).getAIExtraCards();
|
||||
|
||||
for(String s : extras) {
|
||||
|
||||
if (qe.getEventType().equals("challenge")) {
|
||||
List<String> extras = ((QuestChallenge) qe).getAIExtraCards();
|
||||
|
||||
for (String s : extras) {
|
||||
list.add(readExtraCard(s, AllZone.getComputerPlayer()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getHumanStartingCards.</p>
|
||||
* <p>
|
||||
* getHumanStartingCards.
|
||||
* </p>
|
||||
* 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 {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getHumanStartingCards.</p>
|
||||
* 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.
|
||||
* <p>
|
||||
* getHumanStartingCards.
|
||||
* </p>
|
||||
* 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")) {
|
||||
List<String> extras = ((QuestChallenge)qe).getHumanExtraCards();
|
||||
|
||||
for(String s : extras) {
|
||||
|
||||
if (qe.getEventType().equals("challenge")) {
|
||||
List<String> extras = ((QuestChallenge) qe).getHumanExtraCards();
|
||||
|
||||
for (String s : extras) {
|
||||
list.add(readExtraCard(s, AllZone.getHumanPlayer()));
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>createToken.</p>
|
||||
* <p>
|
||||
* createToken.
|
||||
* </p>
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>generateCardRewardList.</p>
|
||||
* <p>
|
||||
* generateCardRewardList.
|
||||
* </p>
|
||||
* 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 List<CardPrinted> generateCardRewardList(String s) {
|
||||
public static List<CardPrinted> generateCardRewardList(final String s) {
|
||||
String[] temp = s.split(" ");
|
||||
|
||||
|
||||
int qty = Integer.parseInt(temp[0]);
|
||||
// Determine rarity
|
||||
CardRarity rar = CardRarity.Uncommon;
|
||||
if(temp[2].equalsIgnoreCase("rare") || temp[2].equalsIgnoreCase("rares")) {
|
||||
if (temp[2].equalsIgnoreCase("rare") || temp[2].equalsIgnoreCase("rares")) {
|
||||
rar = CardRarity.Rare;
|
||||
}
|
||||
|
||||
|
||||
// Determine color ("random" defaults to null color)
|
||||
String col = null;
|
||||
if(temp[1].equalsIgnoreCase("black")) {
|
||||
if (temp[1].equalsIgnoreCase("black")) {
|
||||
col = Constant.Color.Black;
|
||||
}
|
||||
else if(temp[1].equalsIgnoreCase("blue")) {
|
||||
} else if (temp[1].equalsIgnoreCase("blue")) {
|
||||
col = Constant.Color.Blue;
|
||||
}
|
||||
else if(temp[1].equalsIgnoreCase("colorless")) {
|
||||
} else if (temp[1].equalsIgnoreCase("colorless")) {
|
||||
col = Constant.Color.Colorless;
|
||||
}
|
||||
else if(temp[1].equalsIgnoreCase("green")) {
|
||||
} else if (temp[1].equalsIgnoreCase("green")) {
|
||||
col = Constant.Color.Green;
|
||||
}
|
||||
else if(temp[1].equalsIgnoreCase("multicolor")) {
|
||||
} else if (temp[1].equalsIgnoreCase("multicolor")) {
|
||||
col = "Multicolor"; // Note: No constant color for this??
|
||||
}
|
||||
else if(temp[1].equalsIgnoreCase("red")) {
|
||||
} else if (temp[1].equalsIgnoreCase("red")) {
|
||||
col = Constant.Color.Red;
|
||||
}
|
||||
else if(temp[1].equalsIgnoreCase("white")) {
|
||||
} else if (temp[1].equalsIgnoreCase("white")) {
|
||||
col = Constant.Color.White;
|
||||
}
|
||||
|
||||
|
||||
return BoosterUtils.generateCards(qty, rar, col);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>readExtraCard.</p>
|
||||
* <p>
|
||||
* readExtraCard.
|
||||
* </p>
|
||||
* 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
|
||||
|
||||
@@ -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(ItemPool<InventoryItem> pool, final int nBasic, final int nSnow) {
|
||||
/**
|
||||
* Instantiates a new quest util cards.
|
||||
*
|
||||
* @param qd
|
||||
* the qd
|
||||
*/
|
||||
public QuestUtilCards(final QuestData qd) {
|
||||
q = qd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the basic lands.
|
||||
*
|
||||
* @param pool
|
||||
* the pool
|
||||
* @param nBasic
|
||||
* the n basic
|
||||
* @param nSnow
|
||||
* the n snow
|
||||
*/
|
||||
public void addBasicLands(final ItemPool<InventoryItem> pool, final int nBasic, final int nSnow) {
|
||||
CardDb db = CardDb.instance();
|
||||
pool.add(db.getCard("Forest", "M10"), nBasic);
|
||||
pool.add(db.getCard("Mountain", "M10"), nBasic);
|
||||
@@ -44,11 +62,17 @@ public final class QuestUtilCards {
|
||||
pool.add(db.getCard("Snow-Covered Plains", "ICE"), nSnow);
|
||||
}
|
||||
|
||||
//adds 11 cards, to the current card pool
|
||||
//(I chose 11 cards instead of 15 in order to make things more challenging)
|
||||
// adds 11 cards, to the current card pool
|
||||
// (I chose 11 cards instead of 15 in order to make things more challenging)
|
||||
|
||||
/**
|
||||
* <p>addCards.</p>
|
||||
* <p>
|
||||
* addCards.
|
||||
* </p>
|
||||
*
|
||||
* @param fSets
|
||||
* the f sets
|
||||
* @return the array list
|
||||
*/
|
||||
public ArrayList<CardPrinted> addCards(final Predicate<CardPrinted> fSets) {
|
||||
int nCommon = QuestPreferences.getNumCommon();
|
||||
@@ -64,13 +88,25 @@ public final class QuestUtilCards {
|
||||
return newCards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the all cards.
|
||||
*
|
||||
* @param newCards
|
||||
* the new cards
|
||||
*/
|
||||
public void addAllCards(final Iterable<CardPrinted> newCards) {
|
||||
for (CardPrinted card : newCards) {
|
||||
addSingleCard(card);
|
||||
}
|
||||
}
|
||||
|
||||
public void addSingleCard(CardPrinted card) {
|
||||
|
||||
/**
|
||||
* Adds the single card.
|
||||
*
|
||||
* @param card
|
||||
* the card
|
||||
*/
|
||||
public void addSingleCard(final CardPrinted card) {
|
||||
q.cardPool.add(card);
|
||||
|
||||
// register card into that list so that it would appear as a new one.
|
||||
@@ -78,19 +114,40 @@ public final class QuestUtilCards {
|
||||
}
|
||||
|
||||
private static final Predicate<CardPrinted> rarePredicate = CardPrinted.Predicates.Presets.isRareOrMythic;
|
||||
|
||||
/**
|
||||
* Adds the random rare.
|
||||
*
|
||||
* @return the card printed
|
||||
*/
|
||||
public CardPrinted addRandomRare() {
|
||||
CardPrinted card = rarePredicate.random(CardDb.instance().getAllCards());
|
||||
addSingleCard(card);
|
||||
return card;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the random rare.
|
||||
*
|
||||
* @param n
|
||||
* the n
|
||||
* @return the list
|
||||
*/
|
||||
public List<CardPrinted> addRandomRare(final int n) {
|
||||
List<CardPrinted> newCards = rarePredicate.random(CardDb.instance().getAllCards(), n);
|
||||
addAllCards(newCards);
|
||||
return newCards;
|
||||
}
|
||||
|
||||
public void setupNewGameCardPool(final Predicate<CardPrinted> filter, final int idxDifficulty)
|
||||
{
|
||||
/**
|
||||
* Setup new game card pool.
|
||||
*
|
||||
* @param filter
|
||||
* the filter
|
||||
* @param idxDifficulty
|
||||
* the idx difficulty
|
||||
*/
|
||||
public void setupNewGameCardPool(final Predicate<CardPrinted> filter, final int idxDifficulty) {
|
||||
int nC = QuestPreferences.getStartingCommons(idxDifficulty);
|
||||
int nU = QuestPreferences.getStartingUncommons(idxDifficulty);
|
||||
int nR = QuestPreferences.getStartingRares(idxDifficulty);
|
||||
@@ -98,6 +155,14 @@ public final class QuestUtilCards {
|
||||
addAllCards(BoosterUtils.getQuestStarterDeck(filter, nC, nU, nR));
|
||||
}
|
||||
|
||||
/**
|
||||
* Buy card.
|
||||
*
|
||||
* @param card
|
||||
* the card
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public void buyCard(final CardPrinted card, final int value) {
|
||||
if (q.credits >= value) {
|
||||
q.credits -= value;
|
||||
@@ -106,6 +171,14 @@ public final class QuestUtilCards {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Buy booster.
|
||||
*
|
||||
* @param booster
|
||||
* the booster
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public void buyBooster(final BoosterPack booster, final int value) {
|
||||
if (q.credits >= value) {
|
||||
q.credits -= value;
|
||||
@@ -114,8 +187,18 @@ public final class QuestUtilCards {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sell card.
|
||||
*
|
||||
* @param card
|
||||
* the card
|
||||
* @param price
|
||||
* the price
|
||||
*/
|
||||
public void sellCard(final CardPrinted card, final int price) {
|
||||
if (price > 0) { q.credits += price; }
|
||||
if (price > 0) {
|
||||
q.credits += price;
|
||||
}
|
||||
q.cardPool.remove(card);
|
||||
q.shopList.add(card);
|
||||
|
||||
@@ -127,10 +210,20 @@ public final class QuestUtilCards {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear shop list.
|
||||
*/
|
||||
public void clearShopList() {
|
||||
if (null != q.shopList) { q.shopList.clear(); }
|
||||
if (null != q.shopList) {
|
||||
q.shopList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sell mutliplier.
|
||||
*
|
||||
* @return the sell mutliplier
|
||||
*/
|
||||
public double getSellMutliplier() {
|
||||
double multi = 0.20 + (0.001 * q.getWin());
|
||||
if (multi > 0.6) {
|
||||
@@ -139,19 +232,34 @@ public final class QuestUtilCards {
|
||||
|
||||
int lvlEstates = q.isFantasy() ? q.inventory.getItemLevel("Estates") : 0;
|
||||
switch (lvlEstates) {
|
||||
case 1: multi += 0.01; break;
|
||||
case 2: multi += 0.0175; break;
|
||||
case 3: multi += 0.025; break;
|
||||
default: break;
|
||||
case 1:
|
||||
multi += 0.01;
|
||||
break;
|
||||
case 2:
|
||||
multi += 0.0175;
|
||||
break;
|
||||
case 3:
|
||||
multi += 0.025;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return multi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sell price limit.
|
||||
*
|
||||
* @return the sell price limit
|
||||
*/
|
||||
public int getSellPriceLimit() {
|
||||
return q.getWin() <= 50 ? 1000 : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate cards in shop.
|
||||
*/
|
||||
public void generateCardsInShop() {
|
||||
BoosterGenerator pack = new BoosterGenerator(CardDb.instance().getAllCards());
|
||||
|
||||
@@ -160,28 +268,41 @@ public final class QuestUtilCards {
|
||||
int totalPacks = Math.min(levelPacks + winPacks, 6);
|
||||
|
||||
final Predicate<CardSet> filterExt = CardSet.Predicates.Presets.setsInExt;
|
||||
final Predicate<CardSet> filterT2booster = Predicate.and(CardSet.Predicates.canMakeBooster, CardSet.Predicates.Presets.setsInT2);
|
||||
final Predicate<CardSet> filterExtButT2 = Predicate.and(CardSet.Predicates.canMakeBooster, Predicate.and(filterExt, Predicate.not(CardSet.Predicates.Presets.setsInT2)));
|
||||
final Predicate<CardSet> filterNotExt = Predicate.and(CardSet.Predicates.canMakeBooster, Predicate.not(filterExt));
|
||||
|
||||
|
||||
final Predicate<CardSet> filterT2booster = Predicate.and(CardSet.Predicates.canMakeBooster,
|
||||
CardSet.Predicates.Presets.setsInT2);
|
||||
final Predicate<CardSet> filterExtButT2 = Predicate.and(CardSet.Predicates.canMakeBooster,
|
||||
Predicate.and(filterExt, Predicate.not(CardSet.Predicates.Presets.setsInT2)));
|
||||
final Predicate<CardSet> filterNotExt = Predicate.and(CardSet.Predicates.canMakeBooster,
|
||||
Predicate.not(filterExt));
|
||||
|
||||
q.shopList.clear();
|
||||
for (int i = 0; i < totalPacks; i++) {
|
||||
q.shopList.addAllCards(pack.getBoosterPack(7, 3, 1, 0, 0, 0, 0, 0, 0));
|
||||
|
||||
// add some boosters
|
||||
int rollD100 = MyRandom.random.nextInt(100);
|
||||
Predicate<CardSet> filter = rollD100 < 40 ? filterT2booster : (rollD100 < 75 ? filterExtButT2 : filterNotExt);
|
||||
Predicate<CardSet> filter = rollD100 < 40 ? filterT2booster : (rollD100 < 75 ? filterExtButT2
|
||||
: filterNotExt);
|
||||
q.shopList.addAllCards(filter.random(SetUtils.getAllSets(), 1, BoosterPack.fnFromSet));
|
||||
}
|
||||
|
||||
addBasicLands(q.shopList, 10, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cardpool.
|
||||
*
|
||||
* @return the cardpool
|
||||
*/
|
||||
public ItemPool<InventoryItem> getCardpool() {
|
||||
return q.cardPool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the shop list.
|
||||
*
|
||||
* @return the shop list
|
||||
*/
|
||||
public ItemPoolView<InventoryItem> getShopList() {
|
||||
if (q.shopList.isEmpty()) {
|
||||
generateCardsInShop();
|
||||
@@ -189,26 +310,41 @@ public final class QuestUtilCards {
|
||||
return q.shopList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the new cards.
|
||||
*
|
||||
* @return the new cards
|
||||
*/
|
||||
public ItemPoolView<InventoryItem> getNewCards() {
|
||||
return q.newCardList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset new list.
|
||||
*/
|
||||
public void resetNewList() {
|
||||
q.newCardList.clear();
|
||||
}
|
||||
|
||||
// These functions provide a way to sort and compare cards in a table according to their new-ness
|
||||
// It might be a good idea to store them in a base class for both quest-mode deck editors
|
||||
// These functions provide a way to sort and compare cards in a table
|
||||
// according to their new-ness
|
||||
// It might be a good idea to store them in a base class for both quest-mode
|
||||
// deck editors
|
||||
// Maybe we should consider doing so later
|
||||
/** The fn new compare. */
|
||||
@SuppressWarnings("rawtypes")
|
||||
public final Lambda1<Comparable, Entry<InventoryItem, Integer>> fnNewCompare =
|
||||
new Lambda1<Comparable, Entry<InventoryItem, Integer>>() { @Override
|
||||
public Comparable apply(final Entry<InventoryItem, Integer> from) {
|
||||
return q.newCardList.contains(from.getKey()) ? Integer.valueOf(1) : Integer.valueOf(0);
|
||||
} };
|
||||
public final Lambda1<Object, Entry<InventoryItem, Integer>> fnNewGet =
|
||||
new Lambda1<Object, Entry<InventoryItem, Integer>>() { @Override
|
||||
public Object apply(final Entry<InventoryItem, Integer> from) {
|
||||
return q.newCardList.contains(from.getKey()) ? "NEW" : "";
|
||||
} };
|
||||
public final Lambda1<Comparable, Entry<InventoryItem, Integer>> fnNewCompare = new Lambda1<Comparable, Entry<InventoryItem, Integer>>() {
|
||||
@Override
|
||||
public Comparable apply(final Entry<InventoryItem, Integer> from) {
|
||||
return q.newCardList.contains(from.getKey()) ? Integer.valueOf(1) : Integer.valueOf(0);
|
||||
}
|
||||
};
|
||||
|
||||
/** The fn new get. */
|
||||
public final Lambda1<Object, Entry<InventoryItem, Integer>> fnNewGet = new Lambda1<Object, Entry<InventoryItem, Integer>>() {
|
||||
@Override
|
||||
public Object apply(final Entry<InventoryItem, Integer> from) {
|
||||
return q.newCardList.contains(from.getKey()) ? "NEW" : "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
package forge.quest.data;
|
||||
|
||||
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
|
||||
import forge.MyRandom;
|
||||
import forge.error.ErrorViewer;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
@@ -15,43 +7,58 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
|
||||
import forge.MyRandom;
|
||||
import forge.error.ErrorViewer;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
/**
|
||||
* <p>ReadPriceList class.</p>
|
||||
*
|
||||
* <p>
|
||||
* ReadPriceList class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ReadPriceList implements NewConstants {
|
||||
|
||||
/** Constant <code>comment="//"</code> */
|
||||
final private static String comment = "//";
|
||||
/** Constant <code>comment="//"</code>. */
|
||||
private static final String comment = "//";
|
||||
|
||||
private HashMap<String, Integer> priceMap;
|
||||
|
||||
/**
|
||||
* <p>Constructor for ReadPriceList.</p>
|
||||
* <p>
|
||||
* Constructor for ReadPriceList.
|
||||
* </p>
|
||||
*/
|
||||
public ReadPriceList() {
|
||||
setup();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>setup.</p>
|
||||
* <p>
|
||||
* setup.
|
||||
* </p>
|
||||
*/
|
||||
private void setup() {
|
||||
priceMap = readFile(ForgeProps.getFile(QUEST.PRICE));
|
||||
priceMap.putAll(readFile(ForgeProps.getFile(QUEST.BOOSTER_PRICE)));
|
||||
|
||||
}//setup()
|
||||
|
||||
} // setup()
|
||||
|
||||
/**
|
||||
* <p>readFile.</p>
|
||||
*
|
||||
* @param file a {@link java.io.File} object.
|
||||
* <p>
|
||||
* readFile.
|
||||
* </p>
|
||||
*
|
||||
* @param file
|
||||
* a {@link java.io.File} object.
|
||||
* @return a {@link java.util.HashMap} object.
|
||||
*/
|
||||
private HashMap<String, Integer> readFile(File file) {
|
||||
private HashMap<String, Integer> readFile(final File file) {
|
||||
BufferedReader in;
|
||||
HashMap<String, Integer> map = new HashMap<String, Integer>();
|
||||
Random r = MyRandom.random;
|
||||
@@ -60,30 +67,38 @@ public class ReadPriceList implements NewConstants {
|
||||
in = new BufferedReader(new FileReader(file));
|
||||
String line = in.readLine();
|
||||
|
||||
//stop reading if end of file or blank line is read
|
||||
// stop reading if end of file or blank line is read
|
||||
while (line != null && (line.trim().length() != 0)) {
|
||||
if (!line.startsWith(comment)) {
|
||||
String s[] = line.split("=");
|
||||
String[] s = line.split("=");
|
||||
String name = s[0].trim();
|
||||
String price = s[1].trim();
|
||||
|
||||
//System.out.println("Name: " + name + ", Price: " + price);
|
||||
// System.out.println("Name: " + name + ", Price: " +
|
||||
// price);
|
||||
|
||||
try {
|
||||
int val = Integer.parseInt(price.trim());
|
||||
|
||||
if (!(name.equals("Plains") || name.equals("Island") || name.equals("Swamp") || name.equals("Mountain") || name.equals("Forest") ||
|
||||
name.equals("Snow-Covered Plains") || name.equals("Snow-Covered Island") || name.equals("Snow-Covered Swamp") || name.equals("Snow-Covered Mountain") || name.equals("Snow-Covered Forest"))) {
|
||||
if (!(name.equals("Plains") || name.equals("Island") || name.equals("Swamp")
|
||||
|| name.equals("Mountain") || name.equals("Forest")
|
||||
|| name.equals("Snow-Covered Plains") || name.equals("Snow-Covered Island")
|
||||
|| name.equals("Snow-Covered Swamp") || name.equals("Snow-Covered Mountain") || name
|
||||
.equals("Snow-Covered Forest"))) {
|
||||
float ff = 0;
|
||||
if (r.nextInt(100) < 90) // +/- 10%
|
||||
if (r.nextInt(100) < 90) {
|
||||
ff = (float) r.nextInt(10) * (float) .01;
|
||||
else // +/- 50%
|
||||
} else {
|
||||
// +/- 50%
|
||||
ff = (float) r.nextInt(50) * (float) .01;
|
||||
}
|
||||
|
||||
if (r.nextInt(100) < 50) // -ff%
|
||||
if (r.nextInt(100) < 50) {
|
||||
val = (int) ((float) val * ((float) 1 - ff));
|
||||
else // +ff%
|
||||
} else {
|
||||
// +ff%
|
||||
val = (int) ((float) val * ((float) 1 + ff));
|
||||
}
|
||||
}
|
||||
|
||||
map.put(name, val);
|
||||
@@ -92,7 +107,7 @@ public class ReadPriceList implements NewConstants {
|
||||
}
|
||||
}
|
||||
line = in.readLine();
|
||||
}//if
|
||||
} // if
|
||||
|
||||
} catch (Exception ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
@@ -100,14 +115,16 @@ public class ReadPriceList implements NewConstants {
|
||||
}
|
||||
|
||||
return map;
|
||||
}//readFile()
|
||||
} // readFile()
|
||||
|
||||
/**
|
||||
* <p>getPriceList.</p>
|
||||
*
|
||||
* <p>
|
||||
* getPriceList.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.util.Map} object.
|
||||
*/
|
||||
public Map<String, Integer> getPriceList() {
|
||||
public final Map<String, Integer> getPriceList() {
|
||||
return priceMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,42 @@
|
||||
package forge.quest.data.bazaar;
|
||||
|
||||
/**
|
||||
* <p>QuestStallDefinition class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestStallDefinition class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestStallDefinition {
|
||||
|
||||
/** The name. */
|
||||
public String name;
|
||||
|
||||
/** The display name. */
|
||||
public String displayName;
|
||||
|
||||
/** The icon name. */
|
||||
public String iconName;
|
||||
|
||||
/** The fluff. */
|
||||
public String fluff;
|
||||
|
||||
/**
|
||||
* <p>Constructor for QuestStallDefinition.</p>
|
||||
*
|
||||
* @param name a {@link java.lang.String} object.
|
||||
* @param displayName a {@link java.lang.String} object.
|
||||
* @param fluff a {@link java.lang.String} object.
|
||||
* @param iconName a {@link java.lang.String} object.
|
||||
* <p>
|
||||
* Constructor for QuestStallDefinition.
|
||||
* </p>
|
||||
*
|
||||
* @param name
|
||||
* a {@link java.lang.String} object.
|
||||
* @param displayName
|
||||
* a {@link java.lang.String} object.
|
||||
* @param fluff
|
||||
* a {@link java.lang.String} object.
|
||||
* @param iconName
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
public QuestStallDefinition(String name, String displayName, String fluff, String iconName) {
|
||||
public QuestStallDefinition(final String name, final String displayName, final String fluff, final String iconName) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.fluff = fluff;
|
||||
|
||||
@@ -1,63 +1,60 @@
|
||||
package forge.quest.data.bazaar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import forge.AllZone;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>QuestStallManager class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestStallManager class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestStallManager {
|
||||
|
||||
/** Constant <code>stalls</code> */
|
||||
/** Constant <code>stalls</code>. */
|
||||
static Map<String, QuestStallDefinition> stalls;
|
||||
/** Constant <code>items</code> */
|
||||
/** Constant <code>items</code>. */
|
||||
static Map<String, SortedSet<QuestStallPurchasable>> items;
|
||||
|
||||
/**
|
||||
* <p>buildStalls.</p>
|
||||
* <p>
|
||||
* buildStalls.
|
||||
* </p>
|
||||
*/
|
||||
public static void buildStalls() {
|
||||
stalls = new HashMap<String, QuestStallDefinition>();
|
||||
stalls.put(ALCHEMIST,
|
||||
new QuestStallDefinition(ALCHEMIST,
|
||||
"Alchemist",
|
||||
"The walls of this alchemist's stall are covered with shelves with potions, oils, " +
|
||||
"powders, poultices and elixirs, each meticulously labeled.",
|
||||
"BottlesIconSmall.png"));
|
||||
stalls.put(BANKER,
|
||||
new QuestStallDefinition(BANKER,
|
||||
"Banker",
|
||||
"A large book large enough to be seen from the outside rests on the Banker's desk.",
|
||||
"CoinIconSmall.png"));
|
||||
stalls.put(BOOKSTORE,
|
||||
new QuestStallDefinition(BOOKSTORE,
|
||||
"Bookstore",
|
||||
"Tomes of different sizes are stacked in man-high towers.",
|
||||
"BookIconSmall.png"));
|
||||
stalls.put(GEAR,
|
||||
new QuestStallDefinition(GEAR,
|
||||
"Adventuring Gear",
|
||||
"This adventurer's market has a tool for every need ... or so the plaque on the wall claims.",
|
||||
"GearIconSmall.png"));
|
||||
stalls.put(ALCHEMIST, new QuestStallDefinition(ALCHEMIST, "Alchemist",
|
||||
"The walls of this alchemist's stall are covered with shelves with potions, oils, "
|
||||
+ "powders, poultices and elixirs, each meticulously labeled.", "BottlesIconSmall.png"));
|
||||
stalls.put(BANKER, new QuestStallDefinition(BANKER, "Banker",
|
||||
"A large book large enough to be seen from the outside rests on the Banker's desk.",
|
||||
"CoinIconSmall.png"));
|
||||
stalls.put(BOOKSTORE, new QuestStallDefinition(BOOKSTORE, "Bookstore",
|
||||
"Tomes of different sizes are stacked in man-high towers.", "BookIconSmall.png"));
|
||||
stalls.put(GEAR, new QuestStallDefinition(GEAR, "Adventuring Gear",
|
||||
"This adventurer's market has a tool for every need ... or so the plaque on the wall claims.",
|
||||
"GearIconSmall.png"));
|
||||
stalls.put(NURSERY,
|
||||
new QuestStallDefinition(NURSERY,
|
||||
"Nursery",
|
||||
new QuestStallDefinition(NURSERY, "Nursery",
|
||||
"The smells of the one hundred and one different plants forms a unique fragrance.",
|
||||
"LeafIconSmall.png"));
|
||||
stalls.put(PET_SHOP,
|
||||
new QuestStallDefinition(PET_SHOP,
|
||||
"Pet Shop",
|
||||
"This large stall echoes with a multitude of animal noises.",
|
||||
"FoxIconSmall.png"));
|
||||
stalls.put(PET_SHOP, new QuestStallDefinition(PET_SHOP, "Pet Shop",
|
||||
"This large stall echoes with a multitude of animal noises.", "FoxIconSmall.png"));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getStallNames.</p>
|
||||
*
|
||||
* <p>
|
||||
* getStallNames.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.util.List} object.
|
||||
*/
|
||||
public static List<String> getStallNames() {
|
||||
@@ -72,12 +69,15 @@ public class QuestStallManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getStall.</p>
|
||||
*
|
||||
* @param stallName a {@link java.lang.String} object.
|
||||
* <p>
|
||||
* getStall.
|
||||
* </p>
|
||||
*
|
||||
* @param stallName
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.quest.data.bazaar.QuestStallDefinition} object.
|
||||
*/
|
||||
public static QuestStallDefinition getStall(String stallName) {
|
||||
public static QuestStallDefinition getStall(final String stallName) {
|
||||
if (stalls == null) {
|
||||
buildStalls();
|
||||
}
|
||||
@@ -86,7 +86,9 @@ public class QuestStallManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>buildItems.</p>
|
||||
* <p>
|
||||
* buildItems.
|
||||
* </p>
|
||||
*/
|
||||
public static void buildItems() {
|
||||
SortedSet<QuestStallPurchasable> itemSet = new TreeSet<QuestStallPurchasable>();
|
||||
@@ -107,9 +109,12 @@ public class QuestStallManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>items</code>.</p>
|
||||
*
|
||||
* @param stallName a {@link java.lang.String} object.
|
||||
* <p>
|
||||
* Getter for the field <code>items</code>.
|
||||
* </p>
|
||||
*
|
||||
* @param stallName
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link java.util.List} object.
|
||||
*/
|
||||
public static List<QuestStallPurchasable> getItems(String stallName) {
|
||||
@@ -127,17 +132,22 @@ public class QuestStallManager {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Constant <code>ALCHEMIST="Alchemist"</code> */
|
||||
/** Constant <code>ALCHEMIST="Alchemist"</code>. */
|
||||
public static final String ALCHEMIST = "Alchemist";
|
||||
/** Constant <code>BANKER="Banker"</code> */
|
||||
|
||||
/** Constant <code>BANKER="Banker"</code>. */
|
||||
public static final String BANKER = "Banker";
|
||||
/** Constant <code>BOOKSTORE="Bookstore"</code> */
|
||||
|
||||
/** Constant <code>BOOKSTORE="Bookstore"</code>. */
|
||||
public static final String BOOKSTORE = "Bookstore";
|
||||
/** Constant <code>GEAR="Gear"</code> */
|
||||
|
||||
/** Constant <code>GEAR="Gear"</code>. */
|
||||
public static final String GEAR = "Gear";
|
||||
/** Constant <code>NURSERY="Nursery"</code> */
|
||||
|
||||
/** Constant <code>NURSERY="Nursery"</code>. */
|
||||
public static final String NURSERY = "Nursery";
|
||||
/** Constant <code>PET_SHOP="Pet Shop"</code> */
|
||||
|
||||
/** Constant <code>PET_SHOP="Pet Shop"</code>. */
|
||||
public static final String PET_SHOP = "Pet Shop";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,57 +1,68 @@
|
||||
package forge.quest.data.bazaar;
|
||||
|
||||
/**
|
||||
* This interface defines a thing that can be sold at the Bazaar
|
||||
* This interface defines a thing that can be sold at the Bazaar.
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface QuestStallPurchasable extends Comparable<Object> {
|
||||
/**
|
||||
* <p>getPurchaseName.</p>
|
||||
*
|
||||
* <p>
|
||||
* getPurchaseName.
|
||||
* </p>
|
||||
*
|
||||
* @return The Name of the item
|
||||
*/
|
||||
public String getPurchaseName();
|
||||
String getPurchaseName();
|
||||
|
||||
/**
|
||||
* <p>getPurchaseDescription.</p>
|
||||
*
|
||||
* <p>
|
||||
* getPurchaseDescription.
|
||||
* </p>
|
||||
*
|
||||
* @return an HTML formatted item description
|
||||
*/
|
||||
public String getPurchaseDescription();
|
||||
String getPurchaseDescription();
|
||||
|
||||
/**
|
||||
* <p>getImageName.</p>
|
||||
*
|
||||
* <p>
|
||||
* getImageName.
|
||||
* </p>
|
||||
*
|
||||
* @return the name of the image that is displayed in the bazaar
|
||||
*/
|
||||
public String getImageName();
|
||||
String getImageName();
|
||||
|
||||
/**
|
||||
* <p>getPrice.</p>
|
||||
*
|
||||
* <p>
|
||||
* getPrice.
|
||||
* </p>
|
||||
*
|
||||
* @return the cost of the item in credits
|
||||
*/
|
||||
public int getPrice();
|
||||
int getPrice();
|
||||
|
||||
/**
|
||||
* Returns if the item is available for purchase;
|
||||
* Returns if the item is available for purchase;.
|
||||
*
|
||||
* @return <code>true</code> if the item can be displayed in a store
|
||||
* <code>false</code> if the item should not be displayed in store since, for example, prerequisites are not met
|
||||
* <code>false</code> if the item should not be displayed in store
|
||||
* since, for example, prerequisites are not met
|
||||
*/
|
||||
public boolean isAvailableForPurchase();
|
||||
boolean isAvailableForPurchase();
|
||||
|
||||
/**
|
||||
* Executed when the item is bought
|
||||
* Executed when the item is bought.
|
||||
*/
|
||||
public void onPurchase();
|
||||
void onPurchase();
|
||||
|
||||
/**
|
||||
* <p>getStallName.</p>
|
||||
*
|
||||
* <p>
|
||||
* getStallName.
|
||||
* </p>
|
||||
*
|
||||
* @return the name of the stall form which this item can be purchased
|
||||
*/
|
||||
public String getStallName();
|
||||
String getStallName();
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** Forge Card Game */
|
||||
/** Forge Card Game. */
|
||||
package forge.quest.data.bazaar;
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
package forge.quest.data.item;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* <p>QuestInventory class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestInventory class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestInventory {
|
||||
|
||||
/** The inventory. */
|
||||
Map<String, QuestItemAbstract> inventory = new HashMap<String, QuestItemAbstract>();
|
||||
|
||||
/**
|
||||
* <p>Constructor for QuestInventory.</p>
|
||||
* <p>
|
||||
* Constructor for QuestInventory.
|
||||
* </p>
|
||||
*/
|
||||
public QuestInventory() {
|
||||
Set<QuestItemAbstract> allItems = getAllItems();
|
||||
@@ -22,31 +33,40 @@ public class QuestInventory {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>hasItem.</p>
|
||||
*
|
||||
* @param itemName a {@link java.lang.String} object.
|
||||
* <p>
|
||||
* hasItem.
|
||||
* </p>
|
||||
*
|
||||
* @param itemName
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean hasItem(String itemName) {
|
||||
public final boolean hasItem(final String itemName) {
|
||||
return inventory.containsKey(itemName) && inventory.get(itemName).getLevel() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>addItem.</p>
|
||||
*
|
||||
* @param item a {@link forge.quest.data.item.QuestItemAbstract} object.
|
||||
* <p>
|
||||
* addItem.
|
||||
* </p>
|
||||
*
|
||||
* @param item
|
||||
* a {@link forge.quest.data.item.QuestItemAbstract} object.
|
||||
*/
|
||||
public void addItem(QuestItemAbstract item) {
|
||||
public final void addItem(final QuestItemAbstract item) {
|
||||
inventory.put(item.getName(), item);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getItemLevel.</p>
|
||||
*
|
||||
* @param itemName a {@link java.lang.String} object.
|
||||
* <p>
|
||||
* getItemLevel.
|
||||
* </p>
|
||||
*
|
||||
* @param itemName
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public int getItemLevel(String itemName) {
|
||||
public final int getItemLevel(final String itemName) {
|
||||
QuestItemAbstract item = inventory.get(itemName);
|
||||
if (item == null) {
|
||||
return 0;
|
||||
@@ -55,19 +75,24 @@ public class QuestInventory {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>setItemLevel.</p>
|
||||
*
|
||||
* @param itemName a {@link java.lang.String} object.
|
||||
* @param level a int.
|
||||
* <p>
|
||||
* setItemLevel.
|
||||
* </p>
|
||||
*
|
||||
* @param itemName
|
||||
* a {@link java.lang.String} object.
|
||||
* @param level
|
||||
* a int.
|
||||
*/
|
||||
public void setItemLevel(String itemName, int level) {
|
||||
public final void setItemLevel(final String itemName, final int level) {
|
||||
inventory.get(itemName).setLevel(level);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>getAllItems.</p>
|
||||
*
|
||||
* <p>
|
||||
* getAllItems.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.util.Set} object.
|
||||
*/
|
||||
private static Set<QuestItemAbstract> getAllItems() {
|
||||
@@ -83,10 +108,12 @@ public class QuestInventory {
|
||||
return set;
|
||||
}
|
||||
|
||||
//Magic to support added pet types when reading saves.
|
||||
// Magic to support added pet types when reading saves.
|
||||
/**
|
||||
* <p>readResolve.</p>
|
||||
*
|
||||
* <p>
|
||||
* readResolve.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.lang.Object} object.
|
||||
*/
|
||||
private Object readResolve() {
|
||||
@@ -98,10 +125,11 @@ public class QuestInventory {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>getItems.</p>
|
||||
*
|
||||
* <p>
|
||||
* getItems.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.util.Collection} object.
|
||||
*/
|
||||
public Collection<QuestItemAbstract> getItems() {
|
||||
@@ -109,9 +137,12 @@ public class QuestInventory {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getItem.</p>
|
||||
*
|
||||
* @param itemName a {@link java.lang.String} object.
|
||||
* <p>
|
||||
* getItem.
|
||||
* </p>
|
||||
*
|
||||
* @param itemName
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.quest.data.item.QuestItemAbstract} object.
|
||||
*/
|
||||
public QuestItemAbstract getItem(String itemName) {
|
||||
|
||||
@@ -4,8 +4,10 @@ import forge.AllZone;
|
||||
import forge.quest.data.bazaar.QuestStallPurchasable;
|
||||
|
||||
/**
|
||||
* <p>Abstract QuestItemAbstract class.</p>
|
||||
*
|
||||
* <p>
|
||||
* Abstract QuestItemAbstract class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -15,34 +17,42 @@ public abstract class QuestItemAbstract implements QuestStallPurchasable {
|
||||
private String shopName;
|
||||
private int maxLevel = 1;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Constructor for QuestItemAbstract.</p>
|
||||
*
|
||||
* @param name a {@link java.lang.String} object.
|
||||
* @param shopName a {@link java.lang.String} object.
|
||||
* <p>
|
||||
* Constructor for QuestItemAbstract.
|
||||
* </p>
|
||||
*
|
||||
* @param name
|
||||
* a {@link java.lang.String} object.
|
||||
* @param shopName
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
protected QuestItemAbstract(String name, String shopName) {
|
||||
protected QuestItemAbstract(final String name, final String shopName) {
|
||||
this.name = name;
|
||||
this.shopName = shopName;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for QuestItemAbstract.</p>
|
||||
*
|
||||
* @param name a {@link java.lang.String} object.
|
||||
* @param shopName a {@link java.lang.String} object.
|
||||
* @param maxLevel a int.
|
||||
* <p>
|
||||
* Constructor for QuestItemAbstract.
|
||||
* </p>
|
||||
*
|
||||
* @param name
|
||||
* a {@link java.lang.String} object.
|
||||
* @param shopName
|
||||
* a {@link java.lang.String} object.
|
||||
* @param maxLevel
|
||||
* a int.
|
||||
*/
|
||||
protected QuestItemAbstract(String name, String shopName, int maxLevel) {
|
||||
protected QuestItemAbstract(final String name, final String shopName, final int maxLevel) {
|
||||
this.name = name;
|
||||
this.shopName = shopName;
|
||||
this.maxLevel = maxLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the name shared across all item levels e.g., "Estates"
|
||||
*
|
||||
* This is the name shared across all item levels e.g., "Estates".
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public final String getName() {
|
||||
@@ -50,8 +60,8 @@ public abstract class QuestItemAbstract implements QuestStallPurchasable {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the name used in purchasing the item e.g.,"Estates Training 1"
|
||||
*
|
||||
* This is the name used in purchasing the item e.g.,"Estates Training 1".
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public String getPurchaseName() {
|
||||
@@ -59,15 +69,16 @@ public abstract class QuestItemAbstract implements QuestStallPurchasable {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getStallName.</p>
|
||||
*
|
||||
* <p>
|
||||
* getStallName.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public String getStallName() {
|
||||
public final String getStallName() {
|
||||
return shopName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method will be invoked when an item is bought in a shop.
|
||||
*/
|
||||
@@ -76,10 +87,11 @@ public abstract class QuestItemAbstract implements QuestStallPurchasable {
|
||||
AllZone.getQuestData().getInventory().setItemLevel(name, currentLevel + 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>isAvailableForPurchase.</p>
|
||||
*
|
||||
* <p>
|
||||
* isAvailableForPurchase.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean isAvailableForPurchase() {
|
||||
@@ -87,64 +99,79 @@ public abstract class QuestItemAbstract implements QuestStallPurchasable {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>level</code>.</p>
|
||||
*
|
||||
* <p>
|
||||
* Getter for the field <code>level</code>.
|
||||
* </p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getLevel() {
|
||||
public final int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Setter for the field <code>level</code>.</p>
|
||||
*
|
||||
* @param level a int.
|
||||
* <p>
|
||||
* Setter for the field <code>level</code>.
|
||||
* </p>
|
||||
*
|
||||
* @param level
|
||||
* a int.
|
||||
*/
|
||||
public void setLevel(int level) {
|
||||
public final void setLevel(final int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>maxLevel</code>.</p>
|
||||
*
|
||||
* <p>
|
||||
* Getter for the field <code>maxLevel</code>.
|
||||
* </p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getMaxLevel() {
|
||||
public final int getMaxLevel() {
|
||||
return maxLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>isLeveledItem.</p>
|
||||
*
|
||||
* <p>
|
||||
* isLeveledItem.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean isLeveledItem() {
|
||||
public final boolean isLeveledItem() {
|
||||
return maxLevel == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getPurchaseDescription.</p>
|
||||
*
|
||||
* <p>
|
||||
* getPurchaseDescription.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public abstract String getPurchaseDescription();
|
||||
|
||||
/**
|
||||
* <p>getImageName.</p>
|
||||
*
|
||||
* <p>
|
||||
* getImageName.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public abstract String getImageName();
|
||||
|
||||
/**
|
||||
* <p>getPrice.</p>
|
||||
*
|
||||
* <p>
|
||||
* getPrice.
|
||||
* </p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public abstract int getPrice();
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int compareTo(Object o) {
|
||||
public final int compareTo(final Object o) {
|
||||
QuestStallPurchasable q = (QuestStallPurchasable) o;
|
||||
return this.getPurchaseName().compareTo(q.getPurchaseName());
|
||||
}
|
||||
|
||||
@@ -4,15 +4,17 @@ import forge.AllZone;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
|
||||
/**
|
||||
* This item has special coding because of the
|
||||
*
|
||||
* This item has special coding.
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestItemElixir extends QuestItemAbstract {
|
||||
|
||||
/**
|
||||
* <p>Constructor for QuestItemElixir.</p>
|
||||
* <p>
|
||||
* Constructor for QuestItemElixir.
|
||||
* </p>
|
||||
*/
|
||||
QuestItemElixir() {
|
||||
super("Elixir of Life", QuestStallManager.ALCHEMIST, 15);
|
||||
@@ -20,19 +22,19 @@ public class QuestItemElixir extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getPurchaseDescription() {
|
||||
public final String getPurchaseDescription() {
|
||||
return "Gives +1 to maximum life<br>Current Life: " + AllZone.getQuestData().getLife();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getImageName() {
|
||||
public final String getImageName() {
|
||||
return "ElixirIcon.png";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getPrice() {
|
||||
public final int getPrice() {
|
||||
if (getLevel() < 5) {
|
||||
return 250;
|
||||
} else if (getLevel() < 10) {
|
||||
@@ -44,7 +46,7 @@ public class QuestItemElixir extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void onPurchase() {
|
||||
public final void onPurchase() {
|
||||
AllZone.getQuestData().addLife(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,18 @@ package forge.quest.data.item;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
|
||||
/**
|
||||
* <p>QuestItemEstates class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestItemEstates class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestItemEstates extends QuestItemAbstract {
|
||||
/**
|
||||
* <p>Constructor for QuestItemEstates.</p>
|
||||
* <p>
|
||||
* Constructor for QuestItemEstates.
|
||||
* </p>
|
||||
*/
|
||||
QuestItemEstates() {
|
||||
super("Estates", QuestStallManager.BANKER, 3);
|
||||
@@ -18,20 +22,20 @@ public class QuestItemEstates extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getPurchaseDescription() {
|
||||
return String.format("Gives a bonus of <b>%d%%</b> to match winnings.<br>" +
|
||||
"Improves sell percentage by <b>%.2f%%</b>.", (10 + getLevel() * 5), (1 + getLevel() * 0.75));
|
||||
public final String getPurchaseDescription() {
|
||||
return String.format("Gives a bonus of <b>%d%%</b> to match winnings.<br>"
|
||||
+ "Improves sell percentage by <b>%.2f%%</b>.", (10 + getLevel() * 5), (1 + getLevel() * 0.75));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getImageName() {
|
||||
public final String getImageName() {
|
||||
return "GoldIconLarge.png";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getPrice() {
|
||||
public final int getPrice() {
|
||||
if (getLevel() == 0) {
|
||||
return 500;
|
||||
} else if (getLevel() == 1) {
|
||||
@@ -41,5 +45,4 @@ public class QuestItemEstates extends QuestItemAbstract {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,14 +3,18 @@ package forge.quest.data.item;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
|
||||
/**
|
||||
* <p>QuestItemLuckyCoin class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestItemLuckyCoin class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestItemLuckyCoin extends QuestItemAbstract {
|
||||
/**
|
||||
* <p>Constructor for QuestItemLuckyCoin.</p>
|
||||
* <p>
|
||||
* Constructor for QuestItemLuckyCoin.
|
||||
* </p>
|
||||
*/
|
||||
QuestItemLuckyCoin() {
|
||||
super("Lucky Coin", QuestStallManager.BANKER);
|
||||
@@ -18,22 +22,21 @@ public class QuestItemLuckyCoin extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getPurchaseDescription() {
|
||||
return "This coin is believed to give good luck to its owner.<br>" +
|
||||
"Improves the chance of getting a random <br>rare after each match by <b>15%</b>.";
|
||||
public final String getPurchaseDescription() {
|
||||
return "This coin is believed to give good luck to its owner.<br>"
|
||||
+ "Improves the chance of getting a random <br>rare after each match by <b>15%</b>.";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getImageName() {
|
||||
public final String getImageName() {
|
||||
return "CoinIcon.png";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getPrice() {
|
||||
public final int getPrice() {
|
||||
return 2000;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,14 +3,18 @@ package forge.quest.data.item;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
|
||||
/**
|
||||
* <p>QuestItemMap class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestItemMap class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestItemMap extends QuestItemAbstract {
|
||||
/**
|
||||
* <p>Constructor for QuestItemMap.</p>
|
||||
* <p>
|
||||
* Constructor for QuestItemMap.
|
||||
* </p>
|
||||
*/
|
||||
QuestItemMap() {
|
||||
super("Map", QuestStallManager.GEAR);
|
||||
@@ -18,26 +22,26 @@ public class QuestItemMap extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getPurchaseName() {
|
||||
public final String getPurchaseName() {
|
||||
return "Adventurer's Map";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getPurchaseDescription() {
|
||||
return "These ancient charts should facilitate navigation during your travels significantly.<br>" +
|
||||
"<em>Effect: </em>Quest assignments become available more frequently.";
|
||||
public final String getPurchaseDescription() {
|
||||
return "These ancient charts should facilitate navigation during your travels significantly.<br>"
|
||||
+ "<em>Effect: </em>Quest assignments become available more frequently.";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getImageName() {
|
||||
public final String getImageName() {
|
||||
return "MapIconLarge.png";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getPrice() {
|
||||
public final int getPrice() {
|
||||
return 2000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,18 @@ package forge.quest.data.item;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
|
||||
/**
|
||||
* <p>QuestItemSleight class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestItemSleight class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestItemSleight extends QuestItemAbstract {
|
||||
/**
|
||||
* <p>Constructor for QuestItemSleight.</p>
|
||||
* <p>
|
||||
* Constructor for QuestItemSleight.
|
||||
* </p>
|
||||
*/
|
||||
QuestItemSleight() {
|
||||
super("Sleight", QuestStallManager.BOOKSTORE);
|
||||
@@ -19,26 +23,26 @@ public class QuestItemSleight extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getImageName() {
|
||||
public final String getImageName() {
|
||||
return "BookIcon.png";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getPrice() {
|
||||
public final int getPrice() {
|
||||
return 2000;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getPurchaseName() {
|
||||
public final String getPurchaseName() {
|
||||
return "Sleight of Hand Vol. I";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getPurchaseDescription() {
|
||||
return "These volumes explain how to perform the most difficult of sleights.<br>" +
|
||||
"<em>Effect: </em>Your first mulligan is <b>free</b>";
|
||||
public final String getPurchaseDescription() {
|
||||
return "These volumes explain how to perform the most difficult of sleights.<br>"
|
||||
+ "<em>Effect: </em>Your first mulligan is <b>free</b>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,24 @@ package forge.quest.data.item;
|
||||
import forge.AllZone;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* <p>QuestItemZeppelin class.</p>
|
||||
*
|
||||
* <p>
|
||||
* QuestItemZeppelin class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestItemZeppelin extends QuestItemAbstract {
|
||||
|
||||
/** The zeppelin used. */
|
||||
boolean zeppelinUsed = false;
|
||||
|
||||
/**
|
||||
* <p>Constructor for QuestItemZeppelin.</p>
|
||||
* <p>
|
||||
* Constructor for QuestItemZeppelin.
|
||||
* </p>
|
||||
*/
|
||||
QuestItemZeppelin() {
|
||||
super("Zeppelin", QuestStallManager.GEAR);
|
||||
@@ -21,52 +28,57 @@ public class QuestItemZeppelin extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getPurchaseName() {
|
||||
public final String getPurchaseName() {
|
||||
return "Zeppelin";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getPurchaseDescription() {
|
||||
return "This extremely comfortable airship allows for more efficient and safe travel<br>to faraway destinations. <br>" +
|
||||
"<em>Effect: </em>Quest assignments become available more frequently<br>" +
|
||||
"<em>Effect: </em>Adds +3 to max life during quest games.<br>" +
|
||||
"<em>Effect: </em>Allows travel to far places, allowing you to see a new set of opponents";
|
||||
public final String getPurchaseDescription() {
|
||||
return "This extremely comfortable airship allows for more efficient and safe travel<br>to faraway destinations. <br>"
|
||||
+ "<em>Effect: </em>Quest assignments become available more frequently<br>"
|
||||
+ "<em>Effect: </em>Adds +3 to max life during quest games.<br>"
|
||||
+ "<em>Effect: </em>Allows travel to far places, allowing you to see a new set of opponents";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getImageName() {
|
||||
public final String getImageName() {
|
||||
return "ZeppelinIcon.png";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getPrice() {
|
||||
public final int getPrice() {
|
||||
return 5000;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isAvailableForPurchase() {
|
||||
public final boolean isAvailableForPurchase() {
|
||||
return super.isAvailableForPurchase() && AllZone.getQuestData().getInventory().hasItem("Map");
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>hasBeenUsed.</p>
|
||||
*
|
||||
* <p>
|
||||
* hasBeenUsed.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean hasBeenUsed() {
|
||||
public final boolean hasBeenUsed() {
|
||||
return zeppelinUsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Setter for the field <code>zeppelinUsed</code>.</p>
|
||||
*
|
||||
* @param used a boolean.
|
||||
* <p>
|
||||
* Setter for the field <code>zeppelinUsed</code>.
|
||||
* </p>
|
||||
*
|
||||
* @param used
|
||||
* a boolean.
|
||||
*/
|
||||
public void setZeppelinUsed(boolean used) {
|
||||
public final void setZeppelinUsed(final boolean used) {
|
||||
this.zeppelinUsed = used;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** Forge Card Game */
|
||||
/** Forge Card Game. */
|
||||
package forge.quest.data.item;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** Forge Card Game */
|
||||
/** Forge Card Game. */
|
||||
package forge.quest.data;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** Forge Card Game */
|
||||
/** Forge Card Game. */
|
||||
package forge.quest;
|
||||
|
||||
Reference in New Issue
Block a user