- CheckStyle.

This commit is contained in:
Chris
2012-12-01 21:28:49 +00:00
parent a9a199518d
commit 6ac18eb140
9 changed files with 56 additions and 49 deletions

View File

@@ -80,14 +80,14 @@ public enum FModel {
// Someone should take care of 2 gauntlets here // Someone should take care of 2 gauntlets here
private GauntletData gauntletData; private GauntletData gauntletData;
private GauntletMini gauntlet; private GauntletMini gauntlet;
private final CardFactory cardFactory; private final CardFactory cardFactory;
private final QuestController quest; private final QuestController quest;
private final CardCollections decks; private final CardCollections decks;
private final MatchController match; private final MatchController match;
private GameState gameState; private GameState gameState;
private final EditionCollection editions; private final EditionCollection editions;
private final FormatCollection formats; private final FormatCollection formats;
private final IStorageView<BoosterData> boosters; private final IStorageView<BoosterData> boosters;
@@ -150,10 +150,10 @@ public enum FModel {
testNetworkConnection(); testNetworkConnection();
this.setBuildInfo(new BuildInfo()); this.setBuildInfo(new BuildInfo());
this.loadDynamicGamedata(); this.loadDynamicGamedata();
// Loads all cards (using progress bar). // Loads all cards (using progress bar).
this.cardFactory = new CardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER)); this.cardFactory = new CardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER));
this.decks = new CardCollections(ForgeProps.getFile(NewConstants.NEW_DECKS)); this.decks = new CardCollections(ForgeProps.getFile(NewConstants.NEW_DECKS));
@@ -166,11 +166,11 @@ public enum FModel {
/** /**
* Tests if draft upload is technically possible. * 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() { private void testNetworkConnection() {
//
Runnable runNetworkTest = new Runnable() { Runnable runNetworkTest = new Runnable() {
@Override @Override
public void run() { public void run() {
final HttpUtil pinger = new HttpUtil(); final HttpUtil pinger = new HttpUtil();
@@ -425,7 +425,7 @@ public enum FModel {
/** /**
* TODO: Write javadoc for this method. * TODO: Write javadoc for this method.
* @param players * @param players
*/ */
public GameState newGame(Iterable<LobbyPlayer> players) { public GameState newGame(Iterable<LobbyPlayer> players) {
gameState = new GameState(players); gameState = new GameState(players);
@@ -439,7 +439,7 @@ public enum FModel {
public CardFactory getCardFactory() { public CardFactory getCardFactory() {
return cardFactory; return cardFactory;
} }
public GauntletMini getGauntletMini() { public GauntletMini getGauntletMini() {
if (gauntlet == null) { if (gauntlet == null) {

View File

@@ -161,9 +161,10 @@ public class QuestController {
* @return QuestPreconManager * @return QuestPreconManager
*/ */
public static IStorageView<PreconDeck> getPrecons() { public static IStorageView<PreconDeck> getPrecons() {
if ( null == preconManager ) if (null == preconManager) {
preconManager = new StorageView<PreconDeck>(new PreconReader(ForgeProps.getFile(NewConstants.Quest.PRECONS))); preconManager = new StorageView<PreconDeck>(new PreconReader(ForgeProps.getFile(NewConstants.Quest.PRECONS)));
}
return QuestController.preconManager; return QuestController.preconManager;
} }
@@ -217,23 +218,24 @@ public class QuestController {
* @param userDeck * @param userDeck
* user-specified starting deck * 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 GameFormat formatPrizes, final boolean allowSetUnlocks,
final Deck startingCards, final GameFormat formatStartingPool) { final Deck startingCards, final GameFormat formatStartingPool) {
this.load(new QuestData(name, difficulty, mode, formatPrizes, allowSetUnlocks)); // pass awards and unlocks here this.load(new QuestData(name, difficulty, mode, formatPrizes, allowSetUnlocks)); // pass awards and unlocks here
if ( null != startingCards ) if (null != startingCards) {
this.myCards.addDeck(startingCards); this.myCards.addDeck(startingCards);
else { } else {
Predicate<CardPrinted> filter = Predicates.alwaysTrue(); Predicate<CardPrinted> filter = Predicates.alwaysTrue();
if ( formatStartingPool != null ) if (formatStartingPool != null) {
filter = formatStartingPool.getFilterPrinted(); filter = formatStartingPool.getFilterPrinted();
}
this.myCards.setupNewGameCardPool(filter, difficulty); this.myCards.setupNewGameCardPool(filter, difficulty);
} }
this.getAssets().setCredits(Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.STARTING_CREDITS, difficulty)); this.getAssets().setCredits(Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.STARTING_CREDITS, difficulty));
} }
/** /**
@@ -266,8 +268,8 @@ public class QuestController {
public QuestWorld getWorld() { public QuestWorld getWorld() {
return this.model == null ? null : Singletons.getModel().getWorlds().get(this.model.getWorldId()); return this.model == null ? null : Singletons.getModel().getWorlds().get(this.model.getWorldId());
} }
/** /**
* TODO: Write javadoc for this method. * TODO: Write javadoc for this method.
* *
@@ -319,8 +321,8 @@ public class QuestController {
return this.duelManager; return this.duelManager;
} }
/** /**
* *
* TODO: Write javadoc for this method. * TODO: Write javadoc for this method.
@@ -359,9 +361,9 @@ public class QuestController {
int cntLocked = this.questFormat.getLockedSets().size(); int cntLocked = this.questFormat.getLockedSets().size();
int unlocksAvaliable = wins / 20; int unlocksAvaliable = wins / 20;
int unlocksSpent = this.questFormat.getUnlocksUsed(); int unlocksSpent = this.questFormat.getUnlocksUsed();
return unlocksAvaliable > unlocksSpent ? Math.min(unlocksAvaliable - unlocksSpent, cntLocked) : 0; return unlocksAvaliable > unlocksSpent ? Math.min(unlocksAvaliable - unlocksSpent, cntLocked) : 0;
} }
} }

View File

@@ -175,13 +175,13 @@ public abstract class QuestEvent {
public void setIconFilename(final String s0) { public void setIconFilename(final String s0) {
this.iconFilename = s0; this.iconFilename = s0;
} }
public List<String> getHumanExtraCards() { public List<String> getHumanExtraCards() {
return Collections.emptyList(); return Collections.emptyList();
} }
public List<String> getAiExtraCards() { public List<String> getAiExtraCards() {
return Collections.emptyList(); return Collections.emptyList();
} }
} }

View File

@@ -132,7 +132,7 @@ public class QuestEventChallenge extends QuestEvent {
* *
* @return the aiExtraCards * @return the aiExtraCards
*/ */
@Override @Override
public List<String> getAiExtraCards() { public List<String> getAiExtraCards() {
return this.aiExtraCards; return this.aiExtraCards;
} }
@@ -223,8 +223,8 @@ public class QuestEventChallenge extends QuestEvent {
* @return the card reward list * @return the card reward list
*/ */
public final List<CardPrinted> getCardRewardList() { public final List<CardPrinted> getCardRewardList() {
if ( cardRewardList == null ) if (cardRewardList == null) {
{
this.cardRewardList = BoosterUtils.generateCardRewardList(cardReward); this.cardRewardList = BoosterUtils.generateCardRewardList(cardReward);
} }
return this.cardRewardList.open(); return this.cardRewardList.open();

View File

@@ -78,13 +78,16 @@ public final class QuestUtilCards {
if (usedFormat != null) { if (usedFormat != null) {
List<String> availableEditions = usedFormat.getAllowedSetCodes(); List<String> availableEditions = usedFormat.getAllowedSetCodes();
for (String edition : availableEditions) { for (String edition : availableEditions) {
if (db.isCardSupported("Plains", edition)) if (db.isCardSupported("Plains", edition)) {
landCodes.add(edition); landCodes.add(edition);
}
} }
if (usedFormat.isSetLegal("ICE")) if (usedFormat.isSetLegal("ICE")) {
snowLandCodes.add("ICE"); snowLandCodes.add("ICE");
if (usedFormat.isSetLegal("CSP")) }
if (usedFormat.isSetLegal("CSP")) {
snowLandCodes.add("CSP"); snowLandCodes.add("CSP");
}
} else { } else {
Iterable<CardEdition> allEditions = Singletons.getModel().getEditions(); Iterable<CardEdition> allEditions = Singletons.getModel().getEditions();
for (CardEdition edition : Iterables.filter(allEditions, CardEdition.Predicates.hasBasicLands)) { for (CardEdition edition : Iterables.filter(allEditions, CardEdition.Predicates.hasBasicLands)) {
@@ -95,8 +98,9 @@ public final class QuestUtilCards {
} }
String landCode = Aggregates.random(landCodes); String landCode = Aggregates.random(landCodes);
if ( null == landCode ) if (null == landCode) {
landCode = "M10"; landCode = "M10";
}
pool.add(db.getCard("Forest", landCode), nBasic); pool.add(db.getCard("Forest", landCode), nBasic);
pool.add(db.getCard("Mountain", landCode), nBasic); pool.add(db.getCard("Mountain", landCode), nBasic);
@@ -307,8 +311,8 @@ public final class QuestUtilCards {
public void loseCard(final CardPrinted card) { public void loseCard(final CardPrinted card) {
this.sellCard(card, 0, false); this.sellCard(card, 0, false);
} }
/** /**
* Sell card. * Sell card.
* *

View File

@@ -7,13 +7,13 @@ public enum StartingPoolType {
Precon("Event or starter deck"), Precon("Event or starter deck"),
SealedDeck("My sealed deck"), SealedDeck("My sealed deck"),
DraftDeck("My draft deck"); DraftDeck("My draft deck");
private final String caption; private final String caption;
private StartingPoolType(String caption0) { private StartingPoolType(String caption0) {
caption = caption0; caption = caption0;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Enum#toString() * @see java.lang.Enum#toString()
*/ */

View File

@@ -56,13 +56,13 @@ public final class GameFormatQuest extends GameFormat {
public GameFormatQuest(final String newName, final List<String> setsToAllow, final List<String> cardsToBan, boolean allowSetUnlocks) { public GameFormatQuest(final String newName, final List<String> setsToAllow, final List<String> cardsToBan, boolean allowSetUnlocks) {
super(newName, setsToAllow, cardsToBan); super(newName, setsToAllow, cardsToBan);
allowUnlocks = allowSetUnlocks; allowUnlocks = allowSetUnlocks;
} }
/** /**
* Instantiates a new game format based on an existing format. * Instantiates a new game format based on an existing format.
* *
* @param toCopy * @param toCopy
* an existing format * an existing format
* @param allowSetUnlocks * @param allowSetUnlocks
*/ */
public GameFormatQuest(final GameFormat toCopy, boolean allowSetUnlocks) { public GameFormatQuest(final GameFormat toCopy, boolean allowSetUnlocks) {
super(toCopy.getName(), toCopy.getAllowedSetCodes(), toCopy.getBannedCardNames()); super(toCopy.getName(), toCopy.getAllowedSetCodes(), toCopy.getBannedCardNames());

View File

@@ -46,7 +46,7 @@ public final class QuestData {
private GameFormatQuest format; private GameFormatQuest format;
private final String name; private final String name;
// Quest mode - there should be an enum :( // Quest mode - there should be an enum :(
/** The mode. */ /** The mode. */
private QuestMode mode; private QuestMode mode;
@@ -72,13 +72,14 @@ public final class QuestData {
* String, persistent format for the quest (null if none). * String, persistent format for the quest (null if none).
* @param userFormat * @param userFormat
* user-defined format, if any (null if none). * user-defined format, if any (null if none).
* @param allowSetUnlocks * @param allowSetUnlocks
*/ */
public QuestData(String name2, int diff, QuestMode mode2, GameFormat userFormat, boolean allowSetUnlocks) { public QuestData(String name2, int diff, QuestMode mode2, GameFormat userFormat, boolean allowSetUnlocks) {
this.name = name2; this.name = name2;
if ( userFormat != null) if (userFormat != null) {
this.format = new GameFormatQuest(userFormat, allowSetUnlocks); this.format = new GameFormatQuest(userFormat, allowSetUnlocks);
}
this.mode = mode2; this.mode = mode2;
this.achievements = new QuestAchievements(diff); this.achievements = new QuestAchievements(diff);
this.assets = new QuestAssets(format); this.assets = new QuestAssets(format);

View File

@@ -226,10 +226,10 @@ public class QuestPreferences implements Serializable {
/** Instantiates a QuestPreferences object. */ /** Instantiates a QuestPreferences object. */
public QuestPreferences() { public QuestPreferences() {
this.preferenceValues = new HashMap<QPref, String>(); this.preferenceValues = new HashMap<QPref, String>();
List<String> lines = FileUtil.readFile(ForgeProps.getFile(Quest.PREFS)); List<String> lines = FileUtil.readFile(ForgeProps.getFile(Quest.PREFS));
for (String line : lines ) { for (String line : lines) {
if (line.startsWith("#") || (line.length() == 0)) { if (line.startsWith("#") || (line.length() == 0)) {
continue; continue;
} }