mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
minor optimizations of CardRules, fix typo in comment of MtgDataParser
This commit is contained in:
@@ -61,13 +61,13 @@ public final class CardRules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CardRules(final String cardName, final CardType cardType, final CardManaCost manacost,
|
public CardRules(final String cardName, final CardType cardType, final CardManaCost manacost,
|
||||||
final String ptLine, final String[] cardRules, final Map<String, CardInSet> setsData,
|
final String ptLine, final String[] oracleRules, final Map<String, CardInSet> setsData,
|
||||||
final boolean removedFromRandomDecks, final boolean removedFromAIDecks)
|
final boolean removedFromRandomDecks, final boolean removedFromAIDecks)
|
||||||
{
|
{
|
||||||
this.name = cardName;
|
this.name = cardName;
|
||||||
this.type = cardType;
|
this.type = cardType;
|
||||||
this.cost = manacost;
|
this.cost = manacost;
|
||||||
this.rules = cardRules;
|
this.rules = oracleRules;
|
||||||
this.color = new CardColor(cost);
|
this.color = new CardColor(cost);
|
||||||
this.isRemovedFromAIDecks = removedFromAIDecks;
|
this.isRemovedFromAIDecks = removedFromAIDecks;
|
||||||
this.isRemovedFromRandomDecks = removedFromRandomDecks;
|
this.isRemovedFromRandomDecks = removedFromRandomDecks;
|
||||||
@@ -75,10 +75,7 @@ public final class CardRules {
|
|||||||
//System.out.println(cardName);
|
//System.out.println(cardName);
|
||||||
|
|
||||||
if (cardType.isCreature()) {
|
if (cardType.isCreature()) {
|
||||||
if (ptLine == null){
|
int slashPos = ptLine == null ? -1 : ptLine.indexOf('/');
|
||||||
throw new RuntimeException(String.format("Creature '%s' has bad p/t stats", cardName));
|
|
||||||
}
|
|
||||||
int slashPos = ptLine.indexOf('/');
|
|
||||||
if (slashPos == -1) {
|
if (slashPos == -1) {
|
||||||
throw new RuntimeException(String.format("Creature '%s' has bad p/t stats", cardName));
|
throw new RuntimeException(String.format("Creature '%s' has bad p/t stats", cardName));
|
||||||
}
|
}
|
||||||
@@ -136,7 +133,9 @@ public final class CardRules {
|
|||||||
public abstract static class Predicates {
|
public abstract static class Predicates {
|
||||||
public static final Predicate<CardRules> isKeptInAiDecks = new Predicate<CardRules>() {
|
public static final Predicate<CardRules> isKeptInAiDecks = new Predicate<CardRules>() {
|
||||||
@Override public boolean isTrue(CardRules card) { return !card.isRemovedFromAIDecks; } };
|
@Override public boolean isTrue(CardRules card) { return !card.isRemovedFromAIDecks; } };
|
||||||
|
public static final Predicate<CardRules> isKeptInRandomDecks = new Predicate<CardRules>() {
|
||||||
|
@Override public boolean isTrue(CardRules card) { return !card.isRemovedFromRandomDecks; } };
|
||||||
|
|
||||||
|
|
||||||
// Static builder methods - they choose concrete implementation by themselves
|
// Static builder methods - they choose concrete implementation by themselves
|
||||||
public static Predicate<CardRules> cmc(final ComparableOp op, final int what)
|
public static Predicate<CardRules> cmc(final ComparableOp op, final int what)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public final class MtgDataParser implements Iterator<CardRules> {
|
|||||||
setsToSkipPrefixes.add("BTD");
|
setsToSkipPrefixes.add("BTD");
|
||||||
setsToSkipPrefixes.add("DKM");
|
setsToSkipPrefixes.add("DKM");
|
||||||
//setsToSkipPrefixes.add("ATH"); // No need to skip it really.
|
//setsToSkipPrefixes.add("ATH"); // No need to skip it really.
|
||||||
// On gatherer's opinion this cards was releases twice in original set
|
// On gatherer's opinion this cards were released twice in original set
|
||||||
|
|
||||||
// Promo sets - all cards have been issued in other sets
|
// Promo sets - all cards have been issued in other sets
|
||||||
setsToSkipPrefixes.add("SDC");
|
setsToSkipPrefixes.add("SDC");
|
||||||
|
|||||||
Reference in New Issue
Block a user