mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
CardDb - unsupported cards detection
CardPool - fix bug in decks save
This commit is contained in:
@@ -385,11 +385,28 @@ public final class CardDb implements ICardDatabase {
|
||||
}
|
||||
|
||||
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));
|
||||
CardEdition cE = CardEdition.UNKNOWN;
|
||||
CardRarity cR = CardRarity.Unknown;
|
||||
|
||||
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.
|
||||
for(CardEdition e : editions) {
|
||||
for(CardInSet cs : e.getCards() ) {
|
||||
if( cs.name.equals(cardName)) {
|
||||
cE = e;
|
||||
cR = cs.rarity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write to log that attempt,
|
||||
if (cR == CardRarity.Unknown )
|
||||
System.err.println(String.format("An unknown card found when loading Forge decks: \"%s\" Forge does not know of such card's existance. Have you mistype the card name?", cardName));
|
||||
else
|
||||
System.err.println(String.format("An unsupported card was requested: \"%s\" from \"%s\" set. We're sorry, but you cannot use this card now.", cardName, cE.getName()));
|
||||
|
||||
return new PaperCard(CardRules.getUnsupportedCardNamed(cardName), cE.getCode(), cR, 1);
|
||||
|
||||
}
|
||||
|
||||
private final Editor editor = new Editor();
|
||||
|
||||
@@ -187,7 +187,7 @@ public class CardPool extends ItemPool<PaperCard> {
|
||||
else
|
||||
isFirst = false;
|
||||
|
||||
CardDb db = e.getKey().getRules().isVariant() ? commonDb : StaticData.instance().getVariantCards();
|
||||
CardDb db = !e.getKey().getRules().isVariant() ? commonDb : StaticData.instance().getVariantCards();
|
||||
sb.append(e.getValue()).append(" ");
|
||||
db.appendCardToStringBuilder(e.getKey(), sb);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user