From 4cb2077e1ac72d1f3838bfc9483aaa5e4aab7e5b Mon Sep 17 00:00:00 2001 From: Agetian Date: Fri, 17 Jan 2014 15:37:19 +0000 Subject: [PATCH] - The art indexes in .dck files now start at 1, not at 0, and thus match the image file name conventions (e.g. index 1 for a Forest matches Forest1.full.jpg). Note that if you had decks created with different art in mind prior to this beta, the art in your decks will be slightly off (index 0 will be treated as index 1 for the sake of limited backwards compatibility). Please update your decks if necessary. --- forge-core/src/main/java/forge/card/CardDb.java | 11 ++++++++--- forge-core/src/main/java/forge/deck/Deck.java | 2 +- forge-gui/CHANGES.txt | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/forge-core/src/main/java/forge/card/CardDb.java b/forge-core/src/main/java/forge/card/CardDb.java index e669ffacd82..cee5e50476a 100644 --- a/forge-core/src/main/java/forge/card/CardDb.java +++ b/forge-core/src/main/java/forge/card/CardDb.java @@ -169,13 +169,15 @@ public final class CardDb implements ICardDatabase { final String cardName = isFoil ? this.removeFoilSuffix(cardName0) : cardName0; final List splitName = CardDb.splitCardName(cardName); + final int artIndex = Integer.parseInt(splitName.get(2)); + final int effectiveArtIndex = artIndex == 0 ? 1 : artIndex - 1; final PaperCard res = splitName.get(1) == null ? ( fromLastSet ? this.uniqueCardsByName.get(splitName.get(0)) : tryGetCard(splitName.get(0), Aggregates.random(this.allCardsByName.get(splitName.get(0))).getEdition(), -1)) - : tryGetCard(splitName.get(0), splitName.get(1), Integer.parseInt(splitName.get(2))); + : tryGetCard(splitName.get(0), splitName.get(1), effectiveArtIndex); if (fromLastSet && null != res && CardEdition.UNKNOWN.getCode() != res.getEdition()) { - final PaperCard res_randart = tryGetCard(res.getName(), res.getEdition(), Integer.parseInt(splitName.get(2))); + final PaperCard res_randart = tryGetCard(res.getName(), res.getEdition(), effectiveArtIndex); return null != res_randart && isFoil ? getFoiled(res_randart) : res_randart; } @@ -186,11 +188,14 @@ public final class CardDb implements ICardDatabase { public PaperCard tryGetCardPrintedByDate(final String name0, final boolean fromLatestSet, final Date printedBefore) { final boolean isFoil = this.isFoil(name0); final String cardName = isFoil ? this.removeFoilSuffix(name0) : name0; + final List splitName = CardDb.splitCardName(cardName); + final int artIndex = Integer.parseInt(splitName.get(2)); + final int effectiveArtIndex = artIndex == 0 ? 1 : artIndex - 1; PaperCard res = null; if (null != splitName.get(1)) // set explicitly requested, should return card from it and disregard the date - res = tryGetCard(splitName.get(0), splitName.get(1), Integer.parseInt(splitName.get(2))); + res = tryGetCard(splitName.get(0), splitName.get(1), effectiveArtIndex); else { Collection cards = this.allCardsByName.get(splitName.get(0)); // cards are sorted by datetime desc int idxRightSet = 0; diff --git a/forge-core/src/main/java/forge/deck/Deck.java b/forge-core/src/main/java/forge/deck/Deck.java index 2089d8c08f4..a2ce2f9a314 100644 --- a/forge-core/src/main/java/forge/deck/Deck.java +++ b/forge-core/src/main/java/forge/deck/Deck.java @@ -229,7 +229,7 @@ public class Deck extends DeckBase implements Iterable 1) { - sb.append("|").append(card.getArtIndex()); + sb.append("|").append(card.getArtIndex() + 1); // indexes start at 1 to match image file name conventions } } if(card.isFoil()) { diff --git a/forge-gui/CHANGES.txt b/forge-gui/CHANGES.txt index 6684de814dd..914bd298e4f 100644 --- a/forge-gui/CHANGES.txt +++ b/forge-gui/CHANGES.txt @@ -17,7 +17,7 @@ http://www.slightlymagic.net/forum/viewtopic.php?f=52&t=12609#p138913 - Support for multiple card art - -Forge now fully supports the distinction between cards with different art, which is most apparent with basic lands. It is now possible to specifically add cards with particular art in the deck editor, and cards with different art are now generated for random constructed decks, sealed deck pools, booster draft extra basic land pools, starting quest card pools, and quest card shop pools. The deck file (.dck) format has been adapted to account for this change so that the card art index can now be specified after the set, with the index starting at 0 for the first possible card art. +Forge now fully supports the distinction between cards with different art, which is most apparent with basic lands. It is now possible to specifically add cards with particular art in the deck editor, and cards with different art are now generated for random constructed decks, sealed deck pools, booster draft extra basic land pools, starting quest card pools, and quest card shop pools. The deck file (.dck) format has been adapted to account for this change so that the card art index can now be specified after the set, with the index starting at 1 for the first possible card art. - Commander 2013 cards -