diff --git a/src/main/java/forge/card/CardRarity.java b/src/main/java/forge/card/CardRarity.java index f1a2f806432..2c9cd4fe7b5 100644 --- a/src/main/java/forge/card/CardRarity.java +++ b/src/main/java/forge/card/CardRarity.java @@ -17,35 +17,13 @@ */ package forge.card; -/** - *

- * CardRarity class. - *

- * - * @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; } - } diff --git a/src/main/java/forge/card/CardSplitType.java b/src/main/java/forge/card/CardSplitType.java index ecc2cf8e0fe..6869d8c3279 100644 --- a/src/main/java/forge/card/CardSplitType.java +++ b/src/main/java/forge/card/CardSplitType.java @@ -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; } } - diff --git a/src/main/java/forge/card/CardType.java b/src/main/java/forge/card/CardType.java index 9e17feb25c8..6c7cca5e811 100644 --- a/src/main/java/forge/card/CardType.java +++ b/src/main/java/forge/card/CardType.java @@ -54,20 +54,12 @@ public final class CardType implements Comparable { } } - 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�s Realm" and - // "Bolas�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 { 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 { } } - /** - * Gets the types before dash. - * - * @return the types before dash - */ public List getTypesBeforeDash() { final ArrayList types = new ArrayList(); for (final CardSuperType st : this.superType) { @@ -308,31 +209,15 @@ public final class CardType implements Comparable { 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 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 { 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 - /** - *

- * isACardType. - *

- * - * @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); } - /** - *

- * getAllCardTypes. - *

- * - * @return a {@link java.util.ArrayList} object. - */ public static ArrayList getAllCardTypes() { final ArrayList types = new ArrayList(); @@ -394,14 +255,6 @@ public final class CardType implements Comparable { return types; } - /** - *

- * getBasicTypes. - *

- * - * @return a {@link java.util.ArrayList} object. - * @since 1.1.3 - */ public static ArrayList getBasicTypes() { final ArrayList types = new ArrayList(); @@ -410,11 +263,6 @@ public final class CardType implements Comparable { return types; } - /** - * Gets the land types. - * - * @return the land types - */ public static ArrayList getLandTypes() { final ArrayList types = new ArrayList(); @@ -424,14 +272,6 @@ public final class CardType implements Comparable { return types; } - /** - *

- * getCreatureTypes. - *

- * - * @return a {@link java.util.ArrayList} object. - * @since 1.1.6 - */ public static ArrayList getCreatureTypes() { final ArrayList types = new ArrayList(); @@ -440,79 +280,26 @@ public final class CardType implements Comparable { return types; } - /** - *

- * isASuperType. - *

- * - * @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)); } - /** - *

- * isASubType. - *

- * - * @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)); } - /** - *

- * isACreatureType. - *

- * - * @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)); } - /** - *

- * isALandType. - *

- * - * @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)); } - /** - *

- * isABasicLandType. - *

- * - * @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)); } diff --git a/src/main/java/forge/card/ICardCharacteristics.java b/src/main/java/forge/card/ICardCharacteristics.java index 96ea5629854..3b97955f77d 100644 --- a/src/main/java/forge/card/ICardCharacteristics.java +++ b/src/main/java/forge/card/ICardCharacteristics.java @@ -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(); -} \ No newline at end of file + String getOracleText(); +} diff --git a/src/main/java/forge/card/ICardRawAbilites.java b/src/main/java/forge/card/ICardRawAbilites.java index 0f35e7f0459..63f865afd7b 100644 --- a/src/main/java/forge/card/ICardRawAbilites.java +++ b/src/main/java/forge/card/ICardRawAbilites.java @@ -4,12 +4,13 @@ import java.util.Map.Entry; public interface ICardRawAbilites { - public abstract Iterable getKeywords(); - public abstract Iterable getReplacements(); - public abstract Iterable getTriggers(); - public abstract Iterable getStaticAbilities(); - public abstract Iterable getAbilities(); - public abstract String getNonAbilityText(); - public abstract Iterable> getVariables(); - -} \ No newline at end of file + Iterable getKeywords(); + Iterable getReplacements(); + Iterable getTriggers(); + Iterable getStaticAbilities(); + Iterable getAbilities(); + + String getNonAbilityText(); + + Iterable> getVariables(); +} diff --git a/src/main/java/forge/gui/MigrationSourceAnalyzer.java b/src/main/java/forge/gui/MigrationSourceAnalyzer.java index 5bf617bf5f8..f59623a4219 100644 --- a/src/main/java/forge/gui/MigrationSourceAnalyzer.java +++ b/src/main/java/forge/gui/MigrationSourceAnalyzer.java @@ -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> _cardFileNamesBySet; + Map _nameUpdates; private void _analyzeCardPicsSetDir(File root) { if (null == _cardFileNamesBySet) { _cardFileNamesBySet = new HashMap>(); @@ -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(); + Predicate predPlanes = new Predicate() { + @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; } diff --git a/src/main/java/forge/gui/home/variant/CSubmenuPlanechase.java b/src/main/java/forge/gui/home/variant/CSubmenuPlanechase.java index a06ad2a2700..83b43d98aee 100644 --- a/src/main/java/forge/gui/home/variant/CSubmenuPlanechase.java +++ b/src/main/java/forge/gui/home/variant/CSubmenuPlanechase.java @@ -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 predPlanes = new Predicate() { - @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); diff --git a/src/main/java/forge/item/CardPrinted.java b/src/main/java/forge/item/CardPrinted.java index a2c186d444a..07c99bedf9d 100644 --- a/src/main/java/forge/item/CardPrinted.java +++ b/src/main/java/forge/item/CardPrinted.java @@ -56,15 +56,6 @@ public final class CardPrinted implements Comparable, 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, 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, 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) {