Merge branch 'patch-1' into 'master'

Set default art index to 1 for tokens

See merge request core-developers/forge!1475
This commit is contained in:
Sol
2019-03-22 15:00:21 +00:00

View File

@@ -16,7 +16,7 @@ public class PaperToken implements InventoryItemFromSet, IPaperCard {
private CardEdition edition; private CardEdition edition;
private ArrayList<String> imageFileName = new ArrayList<>(); private ArrayList<String> imageFileName = new ArrayList<>();
private CardRules card; private CardRules card;
private int artIndex = 0; private int artIndex = 1;
// takes a string of the form "<colors> <power> <toughness> <name>" such as: "B 0 0 Germ" // takes a string of the form "<colors> <power> <toughness> <name>" such as: "B 0 0 Germ"
public static String makeTokenFileName(String in) { public static String makeTokenFileName(String in) {
@@ -119,13 +119,10 @@ public class PaperToken implements InventoryItemFromSet, IPaperCard {
this.imageFileName.add(makeTokenFileName(c, edition0)); this.imageFileName.add(makeTokenFileName(c, edition0));
} else { } else {
String formatEdition = null == edition || CardEdition.UNKNOWN == edition ? "" : "_" + edition.getCode().toLowerCase(); String formatEdition = null == edition || CardEdition.UNKNOWN == edition ? "" : "_" + edition.getCode().toLowerCase();
int arts = Math.max(this.artIndex, 1);
for(int idx = 0; idx < arts; idx++) { this.imageFileName.add(String.format("%s%s", imageFileName, formatEdition));
if (idx == 0) { for(int idx = 1; idx < this.artIndex; idx++) {
this.imageFileName.add(String.format("%s%s", imageFileName, formatEdition)); this.imageFileName.add(String.format("%s%d%s", imageFileName, idx, formatEdition));
} else {
this.imageFileName.add(String.format("%s%d%s", imageFileName, idx, formatEdition));
}
} }
} }
} }
@@ -149,7 +146,7 @@ public class PaperToken implements InventoryItemFromSet, IPaperCard {
@Override @Override
public String getImageKey(boolean altState) { public String getImageKey(boolean altState) {
int idx = MyRandom.getRandom().nextInt() % artIndex; int idx = MyRandom.getRandom().nextInt(artIndex);
return ImageKeys.TOKEN_PREFIX + imageFileName.get(idx).replace(" ", "_"); return ImageKeys.TOKEN_PREFIX + imageFileName.get(idx).replace(" ", "_");
} }
} }