CardDb is more forgiving to incomplete card scripts

This commit is contained in:
Maxmtg
2013-02-21 15:38:35 +00:00
parent 227be66d44
commit fa646ea274
2 changed files with 5 additions and 4 deletions

View File

@@ -75,8 +75,9 @@ final class CardFace implements ICardCharacteristics {
this.iToughness = StringUtils.isNumeric(this.toughness) ? Integer.parseInt(this.toughness) : 0;
}
public void calculateColor() { // Most scripts do not specify color explicitly
if ( null == oracleText ) { System.err.println(name + " has no Oracle text"); oracleText = ""; }
public void checkFieldsAndAssignMissingOnes() { // Most scripts do not specify color explicitly
if ( null == oracleText ) { System.err.println(name + " has no Oracle text. Assigned empty line."); oracleText = ""; }
if ( setsPrinted.isEmpty() ) { System.err.println(name + " was not assigned any set. Assigned CardEdition.UNKNOWN."); setsPrinted.put(CardEdition.UNKNOWN.getCode(), new CardInSet(CardRarity.Common, 1, null) ) ; }
if ( manaCost == null && color == null ) System.err.println(name + " has neither ManaCost nor Color");
if ( color == null ) color = ColorSet.fromManaCost(manaCost);
}

View File

@@ -87,8 +87,8 @@ public class CardRulesReader {
*/
public final CardRules getCard() {
CardAiHints cah = new CardAiHints(removedFromAIDecks, removedFromRandomDecks, hints, needs );
faces[0].calculateColor();
if ( null != faces[1] ) faces[1].calculateColor();
faces[0].checkFieldsAndAssignMissingOnes();
if ( null != faces[1] ) faces[1].checkFieldsAndAssignMissingOnes();
final CardRules result = new CardRules(faces, altMode, cah, originalScript);
result.setDlUrls(pictureUrl);
if ( StringUtils.isNotBlank(handLife))