- CheckStyle.

This commit is contained in:
Chris
2012-01-28 22:27:50 +00:00
parent b4e42984cd
commit 8f833ed711
2 changed files with 15 additions and 17 deletions

View File

@@ -13,14 +13,14 @@ import forge.deck.DeckIO;
import forge.item.PreconDeck;
/**
* Very simple function - store all precons
* Very simple function - store all precons.
*
*/
public class QuestPreconManager {
final List<PreconDeck> decks = new ArrayList<PreconDeck>();
public QuestPreconManager(File deckDir) {
final List<String> decksThatFailedToLoad = new ArrayList<String>();
File[] files = deckDir.listFiles(DeckIO.DCK_FILE_FILTER);
@@ -32,7 +32,7 @@ public class QuestPreconManager {
decksThatFailedToLoad.add(message);
}
}
if (!decksThatFailedToLoad.isEmpty()) {
JOptionPane.showMessageDialog(null,
StringUtils.join(decksThatFailedToLoad, System.getProperty("line.separator")),
@@ -48,10 +48,10 @@ public class QuestPreconManager {
*/
public List<PreconDeck> getDecksForCurrent(QuestData q) {
List<PreconDeck> meetRequirements = new ArrayList<PreconDeck>();
for(PreconDeck deck : decks)
{
if( deck.getRecommendedDeals().meetsRequiremnts(q))
for (PreconDeck deck : decks) {
if (deck.getRecommendedDeals().meetsRequiremnts(q)) {
meetRequirements.add(deck);
}
}
return meetRequirements;
}

View File

@@ -212,8 +212,8 @@ public final class QuestUtilCards {
this.q.addDeck(precon.getDeck());
this.addAllCards(precon.getDeck().getMain().toFlatList());
}
}
}
/**
* Sell card.
*
@@ -310,9 +310,8 @@ public final class QuestUtilCards {
Predicate.and(filterExt, Predicate.not(CardSet.Predicates.Presets.SETS_IN_STANDARD)));
final Predicate<CardSet> filterNotExt = Predicate.and(CardSet.Predicates.CAN_MAKE_BOOSTER,
Predicate.not(filterExt));
public void generateBoostersInShop(int count)
{
public void generateBoostersInShop(int count) {
for (int i = 0; i < count; i++) {
final int rollD100 = MyRandom.getRandom().nextInt(100);
final Predicate<CardSet> filter = rollD100 < 40 ? filterT2booster : (rollD100 < 75 ? filterExtButT2
@@ -320,13 +319,12 @@ public final class QuestUtilCards {
this.q.getShopList().addAllCards(filter.random(SetUtils.getAllSets(), 1, BoosterPack.FN_FROM_SET));
}
}
public void generatePreconsInShop(int count)
{
public void generatePreconsInShop(int count) {
List<PreconDeck> validDecks = QuestData.getPreconManager().getDecksForCurrent(q);
this.q.getShopList().addAllCards(Predicate.getTrue(PreconDeck.class).random(validDecks, count));
}
public void generateCardsInShop() {
final BoosterGenerator pack = new BoosterGenerator(CardDb.instance().getAllCards());
@@ -339,7 +337,7 @@ public final class QuestUtilCards {
for (int i = 0; i < totalPacks; i++) {
this.q.getShopList().addAllCards(pack.getBoosterPack(7, 3, 1, 0, 0, 0, 0, 0, 0));
}
generateBoostersInShop(totalPacks);
generatePreconsInShop(totalPacks);