mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- CheckStyle.
This commit is contained in:
@@ -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<BoosterData> 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<LobbyPlayer> players) {
|
||||
gameState = new GameState(players);
|
||||
@@ -439,7 +439,7 @@ public enum FModel {
|
||||
public CardFactory getCardFactory() {
|
||||
return cardFactory;
|
||||
}
|
||||
|
||||
|
||||
public GauntletMini getGauntletMini() {
|
||||
|
||||
if (gauntlet == null) {
|
||||
|
||||
@@ -161,9 +161,10 @@ public class QuestController {
|
||||
* @return QuestPreconManager
|
||||
*/
|
||||
public static IStorageView<PreconDeck> getPrecons() {
|
||||
if ( null == preconManager )
|
||||
if (null == preconManager) {
|
||||
preconManager = new StorageView<PreconDeck>(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<CardPrinted> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -175,13 +175,13 @@ public abstract class QuestEvent {
|
||||
public void setIconFilename(final String s0) {
|
||||
this.iconFilename = s0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public List<String> getHumanExtraCards() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
public List<String> getAiExtraCards() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public class QuestEventChallenge extends QuestEvent {
|
||||
*
|
||||
* @return the aiExtraCards
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public List<String> getAiExtraCards() {
|
||||
return this.aiExtraCards;
|
||||
}
|
||||
@@ -223,8 +223,8 @@ public class QuestEventChallenge extends QuestEvent {
|
||||
* @return the card reward list
|
||||
*/
|
||||
public final List<CardPrinted> getCardRewardList() {
|
||||
if ( cardRewardList == null )
|
||||
{
|
||||
if (cardRewardList == null) {
|
||||
|
||||
this.cardRewardList = BoosterUtils.generateCardRewardList(cardReward);
|
||||
}
|
||||
return this.cardRewardList.open();
|
||||
|
||||
@@ -78,13 +78,16 @@ public final class QuestUtilCards {
|
||||
if (usedFormat != null) {
|
||||
List<String> 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<CardEdition> 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.
|
||||
*
|
||||
|
||||
@@ -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()
|
||||
*/
|
||||
|
||||
@@ -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) {
|
||||
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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -226,10 +226,10 @@ public class QuestPreferences implements Serializable {
|
||||
/** Instantiates a QuestPreferences object. */
|
||||
public QuestPreferences() {
|
||||
this.preferenceValues = new HashMap<QPref, String>();
|
||||
|
||||
|
||||
List<String> lines = FileUtil.readFile(ForgeProps.getFile(Quest.PREFS));
|
||||
|
||||
for (String line : lines ) {
|
||||
|
||||
for (String line : lines) {
|
||||
if (line.startsWith("#") || (line.length() == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user