don't give plane/phenomenon card pic filenames '.full' infixes

This commit is contained in:
myk
2013-03-15 07:24:57 +00:00
parent de4766f16d
commit 887be24684
8 changed files with 62 additions and 324 deletions

View File

@@ -17,35 +17,13 @@
*/ */
package forge.card; package forge.card;
/**
* <p>
* CardRarity class.
* </p>
*
* @author Forge
* @version $Id: CardRarity.java 9708 2011-08-09 19:34:12Z jendave $
*/
public enum CardRarity { public enum CardRarity {
/** The Basic land. */
BasicLand("L"), BasicLand("L"),
/** The Common. */
Common("C"), Common("C"),
/** The Uncommon. */
Uncommon("U"), Uncommon("U"),
/** The Rare. */
Rare("R"), Rare("R"),
/** The Mythic rare. */
MythicRare("M"), MythicRare("M"),
/** The Special. */
Special("S"), // Timeshifted Special("S"), // Timeshifted
/** The Unknown. */
Unknown("?"); // In development Unknown("?"); // In development
private final String strValue; private final String strValue;
@@ -54,14 +32,8 @@ public enum CardRarity {
this.strValue = sValue; this.strValue = sValue;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Enum#toString()
*/
@Override @Override
public String toString() { public String toString() {
return this.strValue; return this.strValue;
} }
} }

View File

@@ -2,10 +2,6 @@ package forge.card;
import forge.CardCharacteristicName; import forge.CardCharacteristicName;
/**
* TODO: Write javadoc for this type.
*
*/
public enum CardSplitType public enum CardSplitType
{ {
None(AggregationMethod.USE_PRIMARY_FACE, null), None(AggregationMethod.USE_PRIMARY_FACE, null),
@@ -14,19 +10,12 @@ public enum CardSplitType
Flip(AggregationMethod.USE_PRIMARY_FACE, CardCharacteristicName.Flipped), Flip(AggregationMethod.USE_PRIMARY_FACE, CardCharacteristicName.Flipped),
// used by 12 licid creatures to switch type into enchantment aura // used by 12 licid creatures to switch type into enchantment aura
Licid(AggregationMethod.USE_PRIMARY_FACE, CardCharacteristicName.Licid); Licid(AggregationMethod.USE_PRIMARY_FACE, CardCharacteristicName.Licid);
private CardSplitType(AggregationMethod calcMode, CardCharacteristicName stateName) { private CardSplitType(AggregationMethod calcMode, CardCharacteristicName stateName) {
method = calcMode; method = calcMode;
this.changedStateName = stateName; this.changedStateName = stateName;
} }
/**
* @return the calculationMode
*/
public AggregationMethod getAggregationMethod() { public AggregationMethod getAggregationMethod() {
return method; return method;
} }
@@ -45,4 +34,3 @@ public enum CardSplitType
return changedStateName; return changedStateName;
} }
} }

View File

@@ -54,20 +54,12 @@ public final class CardType implements Comparable<CardType> {
} }
} }
private CardType() { private CardType() { }
} // use static ctors!
// TODO: Debug this code // TODO: Debug this code
/**
* Parses the.
*
* @param typeText
* the type text
* @return the card type
*/
public static CardType parse(final String typeText) { public static CardType parse(final String typeText) {
// Most types and subtypes, except "Serra<EFBFBD>s Realm" and // Most types and subtypes, except "Serra's Realm" and
// "Bolas<EFBFBD>s Meditation Realm" consist of only one word // "Bolas's Meditation Realm" consist of only one word
final char space = ' '; final char space = ' ';
final CardType result = new CardType(); final CardType result = new CardType();
@@ -130,152 +122,66 @@ public final class CardType implements Comparable<CardType> {
this.subType.add(type); this.subType.add(type);
} }
/**
* Sub type contains.
*
* @param operand
* the operand
* @return true, if successful
*/
public boolean subTypeContains(final String operand) { public boolean subTypeContains(final String operand) {
return this.subType.contains(operand); return this.subType.contains(operand);
} }
/**
* Type contains.
*
* @param operand
* the operand
* @return true, if successful
*/
public boolean typeContains(final CardCoreType operand) { public boolean typeContains(final CardCoreType operand) {
return this.coreType.contains(operand); return this.coreType.contains(operand);
} }
/**
* Super type contains.
*
* @param operand
* the operand
* @return true, if successful
*/
public boolean superTypeContains(final CardSuperType operand) { public boolean superTypeContains(final CardSuperType operand) {
return this.superType.contains(operand); return this.superType.contains(operand);
} }
/**
* Checks if is creature.
*
* @return true, if is creature
*/
public boolean isCreature() { public boolean isCreature() {
return this.coreType.contains(CardCoreType.Creature); return this.coreType.contains(CardCoreType.Creature);
} }
/**
* Checks if is planeswalker.
*
* @return true, if is planeswalker
*/
public boolean isPlaneswalker() { public boolean isPlaneswalker() {
return this.coreType.contains(CardCoreType.Planeswalker); return this.coreType.contains(CardCoreType.Planeswalker);
} }
/**
* Checks if is land.
*
* @return true, if is land
*/
public boolean isLand() { public boolean isLand() {
return this.coreType.contains(CardCoreType.Land); return this.coreType.contains(CardCoreType.Land);
} }
/**
* Checks if is artifact.
*
* @return true, if is artifact
*/
public boolean isArtifact() { public boolean isArtifact() {
return this.coreType.contains(CardCoreType.Artifact); return this.coreType.contains(CardCoreType.Artifact);
} }
/**
* Checks if is instant.
*
* @return true, if is instant
*/
public boolean isInstant() { public boolean isInstant() {
return this.coreType.contains(CardCoreType.Instant); return this.coreType.contains(CardCoreType.Instant);
} }
/**
* Checks if is sorcery.
*
* @return true, if is sorcery
*/
public boolean isSorcery() { public boolean isSorcery() {
return this.coreType.contains(CardCoreType.Sorcery); return this.coreType.contains(CardCoreType.Sorcery);
} }
/**
* Checks if is vanguard.
*
* @return true if vanguard
*/
public boolean isVanguard() { public boolean isVanguard() {
return this.coreType.contains(CardCoreType.Vanguard); return this.coreType.contains(CardCoreType.Vanguard);
} }
/**
* Checks if is scheme.
*
* @return true if scheme
*/
public boolean isScheme() { public boolean isScheme() {
return this.coreType.contains(CardCoreType.Scheme); return this.coreType.contains(CardCoreType.Scheme);
} }
/**
* Checks if is enchantment.
*
* @return true, if is enchantment
*/
public boolean isEnchantment() { public boolean isEnchantment() {
return this.coreType.contains(CardCoreType.Enchantment); return this.coreType.contains(CardCoreType.Enchantment);
} }
/**
* Checks if is basic.
*
* @return true, if is basic
*/
public boolean isBasic() { public boolean isBasic() {
return this.superType.contains(CardSuperType.Basic); return this.superType.contains(CardSuperType.Basic);
} }
/**
* Checks if is legendary.
*
* @return true, if is legendary
*/
public boolean isLegendary() { public boolean isLegendary() {
return this.superType.contains(CardSuperType.Legendary); return this.superType.contains(CardSuperType.Legendary);
} }
/**
* Checks if is basic land.
*
* @return true, if is basic land
*/
public boolean isBasicLand() { public boolean isBasicLand() {
return this.isBasic() && this.isLand(); return this.isBasic() && this.isLand();
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override @Override
public String toString() { public String toString() {
if (null == this.calculatedType) { if (null == this.calculatedType) {
@@ -292,11 +198,6 @@ public final class CardType implements Comparable<CardType> {
} }
} }
/**
* Gets the types before dash.
*
* @return the types before dash
*/
public List<String> getTypesBeforeDash() { public List<String> getTypesBeforeDash() {
final ArrayList<String> types = new ArrayList<String>(); final ArrayList<String> types = new ArrayList<String>();
for (final CardSuperType st : this.superType) { for (final CardSuperType st : this.superType) {
@@ -308,31 +209,15 @@ public final class CardType implements Comparable<CardType> {
return types; return types;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override @Override
public int compareTo(final CardType o) { public int compareTo(final CardType o) {
return this.toString().compareTo(o.toString()); return this.toString().compareTo(o.toString());
} }
/**
* Gets the sub types.
*
* @return the sub types
*/
public List<String> getSubTypes() { public List<String> getSubTypes() {
return this.subType; return this.subType;
} }
/**
* Shares sub type with.
*
* @param ctOther the ct other
* @return true, if successful
*/
public boolean sharesSubTypeWith(CardType ctOther) { public boolean sharesSubTypeWith(CardType ctOther) {
for (String t : ctOther.getSubTypes()) { for (String t : ctOther.getSubTypes()) {
if (this.subTypeContains(t)) { if (this.subTypeContains(t)) {
@@ -343,43 +228,19 @@ public final class CardType implements Comparable<CardType> {
return false; return false;
} }
/**
* Returns wether or not this card is a Plane.
* @return a boolean
*/
public boolean isPlane() { public boolean isPlane() {
return this.coreType.contains(CardCoreType.Plane); return this.coreType.contains(CardCoreType.Plane);
} }
/**
* Returns wether or not this card is a Phenomenon.
* @return a boolean
*/
public boolean isPhenomenon() { public boolean isPhenomenon() {
return this.coreType.contains(CardCoreType.Phenomenon); return this.coreType.contains(CardCoreType.Phenomenon);
} }
///////// THIS ARRIVED FROM CardUtil ///////// Utility methods
/**
* <p>
* isACardType.
* </p>
*
* @param cardType
* a {@link java.lang.String} object.
* @return a boolean.
*/
public static boolean isACardType(final String cardType) { public static boolean isACardType(final String cardType) {
return CardType.getAllCardTypes().contains(cardType); return CardType.getAllCardTypes().contains(cardType);
} }
/**
* <p>
* getAllCardTypes.
* </p>
*
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList<String> getAllCardTypes() { public static ArrayList<String> getAllCardTypes() {
final ArrayList<String> types = new ArrayList<String>(); final ArrayList<String> types = new ArrayList<String>();
@@ -394,14 +255,6 @@ public final class CardType implements Comparable<CardType> {
return types; return types;
} }
/**
* <p>
* getBasicTypes.
* </p>
*
* @return a {@link java.util.ArrayList} object.
* @since 1.1.3
*/
public static ArrayList<String> getBasicTypes() { public static ArrayList<String> getBasicTypes() {
final ArrayList<String> types = new ArrayList<String>(); final ArrayList<String> types = new ArrayList<String>();
@@ -410,11 +263,6 @@ public final class CardType implements Comparable<CardType> {
return types; return types;
} }
/**
* Gets the land types.
*
* @return the land types
*/
public static ArrayList<String> getLandTypes() { public static ArrayList<String> getLandTypes() {
final ArrayList<String> types = new ArrayList<String>(); final ArrayList<String> types = new ArrayList<String>();
@@ -424,14 +272,6 @@ public final class CardType implements Comparable<CardType> {
return types; return types;
} }
/**
* <p>
* getCreatureTypes.
* </p>
*
* @return a {@link java.util.ArrayList} object.
* @since 1.1.6
*/
public static ArrayList<String> getCreatureTypes() { public static ArrayList<String> getCreatureTypes() {
final ArrayList<String> types = new ArrayList<String>(); final ArrayList<String> types = new ArrayList<String>();
@@ -440,79 +280,26 @@ public final class CardType implements Comparable<CardType> {
return types; return types;
} }
/**
* <p>
* isASuperType.
* </p>
*
* @param cardType
* a {@link java.lang.String} object.
* @return a boolean.
*/
public static boolean isASuperType(final String cardType) { public static boolean isASuperType(final String cardType) {
return (Constant.CardTypes.SUPER_TYPES.contains(cardType)); return (Constant.CardTypes.SUPER_TYPES.contains(cardType));
} }
/**
* <p>
* isASubType.
* </p>
*
* @param cardType
* a {@link java.lang.String} object.
* @return a boolean.
*/
public static boolean isASubType(final String cardType) { public static boolean isASubType(final String cardType) {
return (!CardType.isASuperType(cardType) && !CardType.isACardType(cardType)); return (!CardType.isASuperType(cardType) && !CardType.isACardType(cardType));
} }
/**
* <p>
* isACreatureType.
* </p>
*
* @param cardType
* a {@link java.lang.String} object.
* @return a boolean.
*/
public static boolean isACreatureType(final String cardType) { public static boolean isACreatureType(final String cardType) {
return (Constant.CardTypes.CREATURE_TYPES.contains(cardType)); return (Constant.CardTypes.CREATURE_TYPES.contains(cardType));
} }
/**
* <p>
* isALandType.
* </p>
*
* @param cardType
* a {@link java.lang.String} object.
* @return a boolean.
*/
public static boolean isALandType(final String cardType) { public static boolean isALandType(final String cardType) {
return (Constant.CardTypes.LAND_TYPES.contains(cardType)); return (Constant.CardTypes.LAND_TYPES.contains(cardType));
} }
/**
* Checks if is a planeswalker type.
*
* @param cardType
* the card type
* @return true, if is a planeswalker type
*/
public static boolean isAPlaneswalkerType(final String cardType) { public static boolean isAPlaneswalkerType(final String cardType) {
return (Constant.CardTypes.WALKER_TYPES.contains(cardType)); return (Constant.CardTypes.WALKER_TYPES.contains(cardType));
} }
/**
* <p>
* isABasicLandType.
* </p>
*
* @param cardType
* a {@link java.lang.String} object.
* @return a boolean.
*/
public static boolean isABasicLandType(final String cardType) { public static boolean isABasicLandType(final String cardType) {
return (Constant.CardTypes.BASIC_TYPES.contains(cardType)); return (Constant.CardTypes.BASIC_TYPES.contains(cardType));
} }

View File

@@ -2,22 +2,17 @@ package forge.card;
import forge.card.mana.ManaCost; import forge.card.mana.ManaCost;
/**
* TODO: Write javadoc for this type.
*
*/
public interface ICardCharacteristics { public interface ICardCharacteristics {
String getName();
CardType getType();
ManaCost getManaCost();
ColorSet getColor();
public abstract String getName(); int getIntPower();
public abstract CardType getType(); int getIntToughness();
public abstract ManaCost getManaCost(); String getPower();
public abstract ColorSet getColor(); String getToughness();
int getInitialLoyalty();
public abstract int getIntPower(); String getOracleText();
public abstract int getIntToughness(); }
public abstract String getPower();
public abstract String getToughness();
public abstract int getInitialLoyalty();
public abstract String getOracleText();
}

View File

@@ -4,12 +4,13 @@ import java.util.Map.Entry;
public interface ICardRawAbilites public interface ICardRawAbilites
{ {
public abstract Iterable<String> getKeywords(); Iterable<String> getKeywords();
public abstract Iterable<String> getReplacements(); Iterable<String> getReplacements();
public abstract Iterable<String> getTriggers(); Iterable<String> getTriggers();
public abstract Iterable<String> getStaticAbilities(); Iterable<String> getStaticAbilities();
public abstract Iterable<String> getAbilities(); Iterable<String> getAbilities();
public abstract String getNonAbilityText();
public abstract Iterable<Entry<String, String>> getVariables(); String getNonAbilityText();
} Iterable<Entry<String, String>> getVariables();
}

View File

@@ -299,7 +299,13 @@ public class MigrationSourceAnalyzer {
String filename = c.getImageKey(backFace, artIdx, false) + ".jpg"; String filename = c.getImageKey(backFace, artIdx, false) + ".jpg";
_defaultPicNames.add(filename); _defaultPicNames.add(filename);
String oldFilenameBase = _oldCleanString(filename.replace(".full.jpg", "")); final String oldFilenameBase;
if (cardRules.getType().isPlane()) {
oldFilenameBase = _oldCleanString(filename.replace(".jpg", ""));
} else {
oldFilenameBase = _oldCleanString(filename.replace(".full.jpg", ""));
}
if (0 == artIdx) { if (0 == artIdx) {
// remove trailing "1" from first art index // remove trailing "1" from first art index
String oldFilename = oldFilenameBase.replaceAll("1$", "") + ".jpg"; String oldFilename = oldFilenameBase.replaceAll("1$", "") + ".jpg";
@@ -368,6 +374,7 @@ public class MigrationSourceAnalyzer {
} }
Map<String, Set<String>> _cardFileNamesBySet; Map<String, Set<String>> _cardFileNamesBySet;
Map<String, String> _nameUpdates;
private void _analyzeCardPicsSetDir(File root) { private void _analyzeCardPicsSetDir(File root) {
if (null == _cardFileNamesBySet) { if (null == _cardFileNamesBySet) {
_cardFileNamesBySet = new HashMap<String, Set<String>>(); _cardFileNamesBySet = new HashMap<String, Set<String>>();
@@ -378,6 +385,25 @@ public class MigrationSourceAnalyzer {
_addSetCards(cardFileNames, CardDb.variants().getAllCards(), filter); _addSetCards(cardFileNames, CardDb.variants().getAllCards(), filter);
_cardFileNamesBySet.put(ce.getCode2(), cardFileNames); _cardFileNamesBySet.put(ce.getCode2(), cardFileNames);
} }
// planar cards now don't have the ".full" part in their filenames
_nameUpdates = new HashMap<String, String>();
Predicate<CardPrinted> predPlanes = new Predicate<CardPrinted>() {
@Override
public boolean apply(CardPrinted arg0) {
return arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon();
}
};
for (CardPrinted c : Iterables.filter(CardDb.variants().getAllCards(), predPlanes)) {
boolean hasBackFace = null != c.getRules().getPictureOtherSideUrl();
String baseName = c.getImageKey(false, c.getArtIndex(), true);
_nameUpdates.put(baseName + ".full.jpg", baseName + ".jpg");
if (hasBackFace) {
baseName = c.getImageKey(true, c.getArtIndex(), true);
_nameUpdates.put(baseName + ".full.jpg", baseName + ".jpg");
}
}
} }
EditionCollection editions = Singletons.getModel().getEditions(); EditionCollection editions = Singletons.getModel().getEditions();
@@ -395,6 +421,9 @@ public class MigrationSourceAnalyzer {
_analyzeListedDir(root, NewConstants.CACHE_CARD_PICS_DIR, new _ListedAnalyzer() { _analyzeListedDir(root, NewConstants.CACHE_CARD_PICS_DIR, new _ListedAnalyzer() {
@Override public String map(String filename) { @Override public String map(String filename) {
filename = editionCode2 + "/" + filename; filename = editionCode2 + "/" + filename;
if (_nameUpdates.containsKey(filename)) {
filename = _nameUpdates.get(filename);
}
return validFilenames.contains(filename) ? filename : null; return validFilenames.contains(filename) ? filename : null;
} }
@Override public OpType getOpType(String filename) { return OpType.SET_CARD_PIC; } @Override public OpType getOpType(String filename) { return OpType.SET_CARD_PIC; }

View File

@@ -81,26 +81,17 @@ public enum CSubmenuPlanechase implements ICDoc {
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.gui.home.ICSubmenu#initialize() * @see forge.gui.home.ICSubmenu#initialize()
*/ */
@SuppressWarnings("serial")
@Override @Override
public void initialize() { public void initialize() {
VSubmenuPlanechase.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() { VSubmenuPlanechase.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() {
private static final long serialVersionUID = -5279533218897076308L;
@Override @Override
public void execute() { public void execute() {
Predicate<CardPrinted> predPlanes = new Predicate<CardPrinted>() { Predicate<CardPrinted> predPlanes = new Predicate<CardPrinted>() {
@Override @Override
public boolean apply(CardPrinted arg0) { public boolean apply(CardPrinted arg0) {
if(arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon()) return arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon();
{
return true;
}
return false;
} }
}; };
FControl.SINGLETON_INSTANCE.changeState(FControl.Screens.DECK_EDITOR_CONSTRUCTED); FControl.SINGLETON_INSTANCE.changeState(FControl.Screens.DECK_EDITOR_CONSTRUCTED);

View File

@@ -56,15 +56,6 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
private final transient CardRarity rarity; // rarity is given in ctor when private final transient CardRarity rarity; // rarity is given in ctor when
// set is assigned // set is assigned
// field RO accessors
/*
* (non-Javadoc)
*
* @see forge.item.InventoryItemFromSet#getName()
*/
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getName()
*/
@Override @Override
public String getName() { public String getName() {
return this.name; return this.name;
@@ -75,46 +66,26 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
return name; return name;
} }
/*
* (non-Javadoc)
*
* @see forge.item.InventoryItemFromSet#getSet()
*/
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getEdition()
*/
@Override @Override
public String getEdition() { public String getEdition() {
return this.edition; return this.edition;
} }
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getArtIndex()
*/
@Override @Override
public int getArtIndex() { public int getArtIndex() {
return this.artIndex; return this.artIndex;
} }
/* (non-Javadoc)
* @see forge.item.ICardPrinted#isFoil()
*/
@Override @Override
public boolean isFoil() { public boolean isFoil() {
return this.foiled; return this.foiled;
} }
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getRules()
*/
@Override @Override
public CardRules getRules() { public CardRules getRules() {
return this.card; return this.card;
} }
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getRarity()
*/
@Override @Override
public CardRarity getRarity() { public CardRarity getRarity() {
return this.rarity; return this.rarity;
@@ -193,7 +164,11 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
if (cntPictures > 1 && cntPictures > artIdx) { if (cntPictures > 1 && cntPictures > artIdx) {
s.append(artIdx + 1); s.append(artIdx + 1);
} }
s.append(".full");
// for whatever reason, MWS-named plane cards don't have the ".full" infix
if (!card.getType().isPlane() && !card.getType().isPhenomenon()) {
s.append(".full");
}
final String fname; final String fname;
if (base64encode) { if (base64encode) {