mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
createUnsuportedCard -> cardDb
This commit is contained in:
@@ -384,6 +384,14 @@ public final class CardDb implements ICardDatabase {
|
||||
return appendCardToStringBuilder(pc, new StringBuilder()).toString();
|
||||
}
|
||||
|
||||
public PaperCard createUnsuportedCard(String cardName) {
|
||||
// Write to log that attempt,
|
||||
System.err.println(String.format("An unsupported card was found when loading Forge decks: %s", cardName));
|
||||
|
||||
return new PaperCard(CardRules.getUnsupportedCardNamed(cardName), CardEdition.UNKNOWN.getCode(), CardRarity.Unknown, 1);
|
||||
// May iterate over editions and find out if there is any card named 'cardName' but not implemented with Forge script.
|
||||
}
|
||||
|
||||
private final Editor editor = new Editor();
|
||||
public Editor getEditor() { return editor; }
|
||||
public class Editor {
|
||||
|
||||
@@ -71,15 +71,14 @@ public class CardPool extends ItemPool<PaperCard> {
|
||||
|
||||
boolean artIndexExplicitlySet = artIndex > 0 || Character.isDigit(cardName.charAt(cardName.length()-1)) && cardName.charAt(cardName.length()-2) == CardDb.NameSetSeparator;
|
||||
int artCount = 1;
|
||||
|
||||
|
||||
if (cp != null ) {
|
||||
setCode = cp.getEdition();
|
||||
cardName = cp.getName();
|
||||
artCount = isCommonCard ? StaticData.instance().getCommonCards().getArtCount(cardName, setCode) : 1;
|
||||
}
|
||||
else {
|
||||
System.err.println(String.format("An unsupported card was found when loading Forge decks: %s", cardName));
|
||||
cp = PaperCard.createUnsuportedCard(cardName);
|
||||
cp = StaticData.instance().getCommonCards().createUnsuportedCard(cardName);
|
||||
}
|
||||
|
||||
if (artIndexExplicitlySet || artCount <= 1) {
|
||||
@@ -146,9 +145,10 @@ public class CardPool extends ItemPool<PaperCard> {
|
||||
return sb.append(']').toString();
|
||||
}
|
||||
|
||||
private final static Pattern p = Pattern.compile("((\\d+)\\s+)?(.*?)");
|
||||
public static CardPool fromCardList(final Iterable<String> lines) {
|
||||
CardPool pool = new CardPool();
|
||||
final Pattern p = Pattern.compile("((\\d+)\\s+)?(.*?)");
|
||||
|
||||
|
||||
if (lines == null) {
|
||||
return pool;
|
||||
|
||||
@@ -19,7 +19,6 @@ package forge.item;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.CardRarity;
|
||||
import forge.card.CardRules;
|
||||
|
||||
@@ -191,8 +190,4 @@ public final class PaperCard implements Comparable<IPaperCard>, InventoryItemFro
|
||||
|
||||
return Integer.compare(artIndex, o.getArtIndex());
|
||||
}
|
||||
|
||||
public static PaperCard createUnsuportedCard(String cardName) {
|
||||
return new PaperCard(CardRules.getUnsupportedCardNamed(cardName), CardEdition.UNKNOWN.getCode(), CardRarity.Unknown, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user