mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Code cleanup
This commit is contained in:
@@ -87,15 +87,15 @@ public final class CardDb implements ICardDatabase {
|
||||
private final Collection<PaperCard> roUniqueCards = Collections.unmodifiableCollection(uniqueCardsByName.values());
|
||||
private final EditionCollection editions;
|
||||
|
||||
|
||||
private CardDb(Map<String, CardRules> rules, EditionCollection editions0, boolean logMissingCards) {
|
||||
this.rulesByName = rules;
|
||||
this.editions = editions0;
|
||||
List<String> missingCards = new ArrayList<String>();
|
||||
for (CardEdition e : editions.getOrderedEditions()) {
|
||||
boolean worthLogging = logMissingCards && ( e.getType() == Type.CORE || e.getType() == Type.EXPANSION || e.getType() == Type.REPRINT );
|
||||
if(worthLogging)
|
||||
if (worthLogging) {
|
||||
System.out.print(e.getName() + " (" + e.getCards().length + " cards)");
|
||||
}
|
||||
String lastCardName = null;
|
||||
int artIdx = 0;
|
||||
for (CardEdition.CardInSet cis : e.getCards()) {
|
||||
@@ -106,14 +106,17 @@ public final class CardDb implements ICardDatabase {
|
||||
lastCardName = cis.name;
|
||||
}
|
||||
CardRules cr = rulesByName.get(lastCardName);
|
||||
if( cr != null )
|
||||
if (cr != null) {
|
||||
addCard(new PaperCard(cr, e.getCode(), cis.rarity, artIdx));
|
||||
else if (worthLogging)
|
||||
}
|
||||
else if (worthLogging) {
|
||||
missingCards.add(cis.name);
|
||||
}
|
||||
}
|
||||
if (worthLogging) {
|
||||
if(missingCards.isEmpty())
|
||||
if (missingCards.isEmpty()) {
|
||||
System.out.println(" ... 100% ");
|
||||
}
|
||||
else {
|
||||
int missing = (e.getCards().length - missingCards.size()) * 10000 / e.getCards().length;
|
||||
System.out.printf(" ... %.2f%% (%s missing: %s )%n", missing * 0.01f, Lang.nounWithAmount(missingCards.size(), "card"), StringUtils.join(missingCards, " | ") );
|
||||
@@ -123,8 +126,7 @@ public final class CardDb implements ICardDatabase {
|
||||
}
|
||||
|
||||
for (CardRules cr : rulesByName.values()) {
|
||||
if( !allCardsByName.containsKey(cr.getName()) )
|
||||
{
|
||||
if (!allCardsByName.containsKey(cr.getName())) {
|
||||
System.err.println("The card " + cr.getName() + " was not assigned to any set. Adding it to UNKNOWN set... to fix see res/cardeditions/ folder. ");
|
||||
addCard(new PaperCard(cr, CardEdition.UNKNOWN.getCode(), CardRarity.Special, 0));
|
||||
}
|
||||
|
||||
@@ -157,7 +157,6 @@ public class FModel {
|
||||
// this fills in our map of card names to Card instances.
|
||||
CardDb.setup(reader.loadCards(), editions);
|
||||
|
||||
|
||||
this.formats = new FormatCollection("res/blockdata/formats.txt");
|
||||
this.boosters = new StorageBase<SealedProductTemplate>("Boosters", editions.getBoosterGenerator());
|
||||
this.specialBoosters = new StorageBase<SealedProductTemplate>("Special boosters", new SealedProductTemplate.Reader("res/blockdata/boosters-special.txt"));
|
||||
@@ -403,12 +402,9 @@ public class FModel {
|
||||
|
||||
|
||||
public GauntletMini getGauntletMini() {
|
||||
|
||||
if (gauntlet == null) {
|
||||
gauntlet = new GauntletMini();
|
||||
}
|
||||
return gauntlet;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user