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

View File

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

View File

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

View File

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

View File

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

View File

@@ -299,7 +299,13 @@ public class MigrationSourceAnalyzer {
String filename = c.getImageKey(backFace, artIdx, false) + ".jpg";
_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) {
// remove trailing "1" from first art index
String oldFilename = oldFilenameBase.replaceAll("1$", "") + ".jpg";
@@ -368,6 +374,7 @@ public class MigrationSourceAnalyzer {
}
Map<String, Set<String>> _cardFileNamesBySet;
Map<String, String> _nameUpdates;
private void _analyzeCardPicsSetDir(File root) {
if (null == _cardFileNamesBySet) {
_cardFileNamesBySet = new HashMap<String, Set<String>>();
@@ -378,6 +385,25 @@ public class MigrationSourceAnalyzer {
_addSetCards(cardFileNames, CardDb.variants().getAllCards(), filter);
_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();
@@ -395,6 +421,9 @@ public class MigrationSourceAnalyzer {
_analyzeListedDir(root, NewConstants.CACHE_CARD_PICS_DIR, new _ListedAnalyzer() {
@Override public String map(String filename) {
filename = editionCode2 + "/" + filename;
if (_nameUpdates.containsKey(filename)) {
filename = _nameUpdates.get(filename);
}
return validFilenames.contains(filename) ? filename : null;
}
@Override public OpType getOpType(String filename) { return OpType.SET_CARD_PIC; }

View File

@@ -81,26 +81,17 @@ public enum CSubmenuPlanechase implements ICDoc {
/* (non-Javadoc)
* @see forge.gui.home.ICSubmenu#initialize()
*/
@SuppressWarnings("serial")
@Override
public void initialize() {
VSubmenuPlanechase.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() {
private static final long serialVersionUID = -5279533218897076308L;
@Override
public void execute() {
Predicate<CardPrinted> predPlanes = new Predicate<CardPrinted>() {
@Override
public boolean apply(CardPrinted arg0) {
if(arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon())
{
return true;
}
return false;
return arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon();
}
};
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
// set is assigned
// field RO accessors
/*
* (non-Javadoc)
*
* @see forge.item.InventoryItemFromSet#getName()
*/
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getName()
*/
@Override
public String getName() {
return this.name;
@@ -75,46 +66,26 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
return name;
}
/*
* (non-Javadoc)
*
* @see forge.item.InventoryItemFromSet#getSet()
*/
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getEdition()
*/
@Override
public String getEdition() {
return this.edition;
}
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getArtIndex()
*/
@Override
public int getArtIndex() {
return this.artIndex;
}
/* (non-Javadoc)
* @see forge.item.ICardPrinted#isFoil()
*/
@Override
public boolean isFoil() {
return this.foiled;
}
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getRules()
*/
@Override
public CardRules getRules() {
return this.card;
}
/* (non-Javadoc)
* @see forge.item.ICardPrinted#getRarity()
*/
@Override
public CardRarity getRarity() {
return this.rarity;
@@ -193,7 +164,11 @@ public final class CardPrinted implements Comparable<IPaperCard>, InventoryItemF
if (cntPictures > 1 && cntPictures > artIdx) {
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;
if (base64encode) {