mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
deck saves 'foil' attribute of a card
This commit is contained in:
@@ -37,6 +37,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.deck.io.DeckFileHeader;
|
||||
import forge.deck.io.DeckSerializer;
|
||||
import forge.gui.deckeditor.tables.TableSorter;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.util.FileSection;
|
||||
@@ -255,11 +256,16 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
||||
private static String serializeSingleCard(CardPrinted card, Integer n) {
|
||||
|
||||
final boolean hasBadSetInfo = "???".equals(card.getEdition()) || StringUtils.isBlank(card.getEdition());
|
||||
if (hasBadSetInfo) {
|
||||
return String.format("%d %s", n, card.getName());
|
||||
} else {
|
||||
return String.format("%d %s|%s", n, card.getName(), card.getEdition());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(n).append(" ").append(card.getName());
|
||||
|
||||
if (!hasBadSetInfo) {
|
||||
sb.append("|").append(card.getEdition());
|
||||
}
|
||||
if(card.isFoil()) {
|
||||
sb.append(CardDb.foilSuffix);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,8 +53,8 @@ import forge.util.Aggregates;
|
||||
public final class CardDb {
|
||||
private static volatile CardDb commonCards = null; // 'volatile' keyword makes this working
|
||||
private static volatile CardDb variantCards = null; // 'volatile' keyword makes this working
|
||||
private final String foilSuffix = " foil";
|
||||
private final int foilSuffixLength = foilSuffix.length();
|
||||
public final static String foilSuffix = " foil";
|
||||
private final static int foilSuffixLength = foilSuffix.length();
|
||||
|
||||
/**
|
||||
* Instance.
|
||||
@@ -142,7 +142,7 @@ public final class CardDb {
|
||||
}
|
||||
|
||||
private boolean isFoil(final String cardName) {
|
||||
return cardName.toLowerCase().endsWith(this.foilSuffix) && (cardName.length() > this.foilSuffixLength);
|
||||
return cardName.toLowerCase().endsWith(CardDb.foilSuffix) && (cardName.length() > CardDb.foilSuffixLength);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +152,7 @@ public final class CardDb {
|
||||
* @return the string
|
||||
*/
|
||||
public String removeFoilSuffix(final String cardName) {
|
||||
return cardName.substring(0, cardName.length() - this.foilSuffixLength);
|
||||
return cardName.substring(0, cardName.length() - CardDb.foilSuffixLength);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user