diff --git a/src/main/java/forge/model/FModel.java b/src/main/java/forge/model/FModel.java index d28c00c1c58..1ff5edf92f6 100644 --- a/src/main/java/forge/model/FModel.java +++ b/src/main/java/forge/model/FModel.java @@ -80,14 +80,14 @@ public enum FModel { // Someone should take care of 2 gauntlets here private GauntletData gauntletData; private GauntletMini gauntlet; - + private final CardFactory cardFactory; private final QuestController quest; private final CardCollections decks; - + private final MatchController match; private GameState gameState; - + private final EditionCollection editions; private final FormatCollection formats; private final IStorageView boosters; @@ -150,10 +150,10 @@ public enum FModel { testNetworkConnection(); - + this.setBuildInfo(new BuildInfo()); this.loadDynamicGamedata(); - + // Loads all cards (using progress bar). this.cardFactory = new CardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER)); this.decks = new CardCollections(ForgeProps.getFile(NewConstants.NEW_DECKS)); @@ -166,11 +166,11 @@ public enum FModel { /** * Tests if draft upload is technically possible. - * Separate thread, no more hangs when network connection is limited + * Separate thread, no more hangs when network connection is limited */ private void testNetworkConnection() { - // - Runnable runNetworkTest = new Runnable() { + + Runnable runNetworkTest = new Runnable() { @Override public void run() { final HttpUtil pinger = new HttpUtil(); @@ -425,7 +425,7 @@ public enum FModel { /** * TODO: Write javadoc for this method. - * @param players + * @param players */ public GameState newGame(Iterable players) { gameState = new GameState(players); @@ -439,7 +439,7 @@ public enum FModel { public CardFactory getCardFactory() { return cardFactory; } - + public GauntletMini getGauntletMini() { if (gauntlet == null) { diff --git a/src/main/java/forge/quest/QuestController.java b/src/main/java/forge/quest/QuestController.java index 766fe6dbdd3..9278d453cb0 100644 --- a/src/main/java/forge/quest/QuestController.java +++ b/src/main/java/forge/quest/QuestController.java @@ -161,9 +161,10 @@ public class QuestController { * @return QuestPreconManager */ public static IStorageView getPrecons() { - if ( null == preconManager ) + if (null == preconManager) { preconManager = new StorageView(new PreconReader(ForgeProps.getFile(NewConstants.Quest.PRECONS))); - + } + return QuestController.preconManager; } @@ -217,23 +218,24 @@ public class QuestController { * @param userDeck * user-specified starting deck */ - public void newGame(final String name, final int difficulty, final QuestMode mode, + public void newGame(final String name, final int difficulty, final QuestMode mode, final GameFormat formatPrizes, final boolean allowSetUnlocks, final Deck startingCards, final GameFormat formatStartingPool) { this.load(new QuestData(name, difficulty, mode, formatPrizes, allowSetUnlocks)); // pass awards and unlocks here - - if ( null != startingCards ) + + if (null != startingCards) { this.myCards.addDeck(startingCards); - else { + } else { Predicate filter = Predicates.alwaysTrue(); - if ( formatStartingPool != null ) + if (formatStartingPool != null) { filter = formatStartingPool.getFilterPrinted(); + } this.myCards.setupNewGameCardPool(filter, difficulty); } this.getAssets().setCredits(Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.STARTING_CREDITS, difficulty)); - + } /** @@ -266,8 +268,8 @@ public class QuestController { public QuestWorld getWorld() { return this.model == null ? null : Singletons.getModel().getWorlds().get(this.model.getWorldId()); } - - + + /** * TODO: Write javadoc for this method. * @@ -319,8 +321,8 @@ public class QuestController { return this.duelManager; } - - + + /** * * TODO: Write javadoc for this method. @@ -359,9 +361,9 @@ public class QuestController { int cntLocked = this.questFormat.getLockedSets().size(); int unlocksAvaliable = wins / 20; - int unlocksSpent = this.questFormat.getUnlocksUsed(); - - return unlocksAvaliable > unlocksSpent ? Math.min(unlocksAvaliable - unlocksSpent, cntLocked) : 0; + int unlocksSpent = this.questFormat.getUnlocksUsed(); + + return unlocksAvaliable > unlocksSpent ? Math.min(unlocksAvaliable - unlocksSpent, cntLocked) : 0; } } diff --git a/src/main/java/forge/quest/QuestEvent.java b/src/main/java/forge/quest/QuestEvent.java index b7af8f9fc44..4397fb6aabe 100644 --- a/src/main/java/forge/quest/QuestEvent.java +++ b/src/main/java/forge/quest/QuestEvent.java @@ -175,13 +175,13 @@ public abstract class QuestEvent { public void setIconFilename(final String s0) { this.iconFilename = s0; } - - + + public List getHumanExtraCards() { return Collections.emptyList(); } - + public List getAiExtraCards() { return Collections.emptyList(); - } + } } diff --git a/src/main/java/forge/quest/QuestEventChallenge.java b/src/main/java/forge/quest/QuestEventChallenge.java index 110de2fca24..e542f66dacd 100644 --- a/src/main/java/forge/quest/QuestEventChallenge.java +++ b/src/main/java/forge/quest/QuestEventChallenge.java @@ -132,7 +132,7 @@ public class QuestEventChallenge extends QuestEvent { * * @return the aiExtraCards */ - @Override + @Override public List getAiExtraCards() { return this.aiExtraCards; } @@ -223,8 +223,8 @@ public class QuestEventChallenge extends QuestEvent { * @return the card reward list */ public final List getCardRewardList() { - if ( cardRewardList == null ) - { + if (cardRewardList == null) { + this.cardRewardList = BoosterUtils.generateCardRewardList(cardReward); } return this.cardRewardList.open(); diff --git a/src/main/java/forge/quest/QuestUtilCards.java b/src/main/java/forge/quest/QuestUtilCards.java index 22c8282f0ef..65b78433c5c 100644 --- a/src/main/java/forge/quest/QuestUtilCards.java +++ b/src/main/java/forge/quest/QuestUtilCards.java @@ -78,13 +78,16 @@ public final class QuestUtilCards { if (usedFormat != null) { List availableEditions = usedFormat.getAllowedSetCodes(); for (String edition : availableEditions) { - if (db.isCardSupported("Plains", edition)) + if (db.isCardSupported("Plains", edition)) { landCodes.add(edition); + } } - if (usedFormat.isSetLegal("ICE")) + if (usedFormat.isSetLegal("ICE")) { snowLandCodes.add("ICE"); - if (usedFormat.isSetLegal("CSP")) + } + if (usedFormat.isSetLegal("CSP")) { snowLandCodes.add("CSP"); + } } else { Iterable allEditions = Singletons.getModel().getEditions(); for (CardEdition edition : Iterables.filter(allEditions, CardEdition.Predicates.hasBasicLands)) { @@ -95,8 +98,9 @@ public final class QuestUtilCards { } String landCode = Aggregates.random(landCodes); - if ( null == landCode ) + if (null == landCode) { landCode = "M10"; + } pool.add(db.getCard("Forest", landCode), nBasic); pool.add(db.getCard("Mountain", landCode), nBasic); @@ -307,8 +311,8 @@ public final class QuestUtilCards { public void loseCard(final CardPrinted card) { this.sellCard(card, 0, false); - } - + } + /** * Sell card. * diff --git a/src/main/java/forge/quest/StartingPoolType.java b/src/main/java/forge/quest/StartingPoolType.java index 6d1d9b4cbfb..f4dec948a95 100644 --- a/src/main/java/forge/quest/StartingPoolType.java +++ b/src/main/java/forge/quest/StartingPoolType.java @@ -7,13 +7,13 @@ public enum StartingPoolType { Precon("Event or starter deck"), SealedDeck("My sealed deck"), DraftDeck("My draft deck"); - + private final String caption; - + private StartingPoolType(String caption0) { caption = caption0; } - + /* (non-Javadoc) * @see java.lang.Enum#toString() */ diff --git a/src/main/java/forge/quest/data/GameFormatQuest.java b/src/main/java/forge/quest/data/GameFormatQuest.java index b4679d92d22..5cd847e25e1 100644 --- a/src/main/java/forge/quest/data/GameFormatQuest.java +++ b/src/main/java/forge/quest/data/GameFormatQuest.java @@ -56,13 +56,13 @@ public final class GameFormatQuest extends GameFormat { public GameFormatQuest(final String newName, final List setsToAllow, final List cardsToBan, boolean allowSetUnlocks) { super(newName, setsToAllow, cardsToBan); allowUnlocks = allowSetUnlocks; - } + } /** * Instantiates a new game format based on an existing format. * * @param toCopy * an existing format - * @param allowSetUnlocks + * @param allowSetUnlocks */ public GameFormatQuest(final GameFormat toCopy, boolean allowSetUnlocks) { super(toCopy.getName(), toCopy.getAllowedSetCodes(), toCopy.getBannedCardNames()); diff --git a/src/main/java/forge/quest/data/QuestData.java b/src/main/java/forge/quest/data/QuestData.java index 2c5198aeabd..8e5b0ec0f35 100644 --- a/src/main/java/forge/quest/data/QuestData.java +++ b/src/main/java/forge/quest/data/QuestData.java @@ -46,7 +46,7 @@ public final class QuestData { private GameFormatQuest format; private final String name; - + // Quest mode - there should be an enum :( /** The mode. */ private QuestMode mode; @@ -72,13 +72,14 @@ public final class QuestData { * String, persistent format for the quest (null if none). * @param userFormat * user-defined format, if any (null if none). - * @param allowSetUnlocks + * @param allowSetUnlocks */ public QuestData(String name2, int diff, QuestMode mode2, GameFormat userFormat, boolean allowSetUnlocks) { this.name = name2; - if ( userFormat != null) + if (userFormat != null) { this.format = new GameFormatQuest(userFormat, allowSetUnlocks); + } this.mode = mode2; this.achievements = new QuestAchievements(diff); this.assets = new QuestAssets(format); diff --git a/src/main/java/forge/quest/data/QuestPreferences.java b/src/main/java/forge/quest/data/QuestPreferences.java index 823b07c9c89..5814e446de0 100644 --- a/src/main/java/forge/quest/data/QuestPreferences.java +++ b/src/main/java/forge/quest/data/QuestPreferences.java @@ -226,10 +226,10 @@ public class QuestPreferences implements Serializable { /** Instantiates a QuestPreferences object. */ public QuestPreferences() { this.preferenceValues = new HashMap(); - + List lines = FileUtil.readFile(ForgeProps.getFile(Quest.PREFS)); - - for (String line : lines ) { + + for (String line : lines) { if (line.startsWith("#") || (line.length() == 0)) { continue; }