mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
ensure TokenEffect-generated tokens have correctly formed filenames
This commit is contained in:
@@ -67,7 +67,7 @@ public class TokenEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mapParams.hasParam("TokenImage")) {
|
if (mapParams.hasParam("TokenImage")) {
|
||||||
image = mapParams.getParam("TokenImage");
|
image = CardToken.makeTokenFileName(mapParams.getParam("TokenImage"));
|
||||||
} else {
|
} else {
|
||||||
image = "";
|
image = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,9 @@ public class CardToken implements InventoryItemFromSet, IPaperCard {
|
|||||||
private String imageFileName;
|
private String imageFileName;
|
||||||
private CardRules card;
|
private CardRules card;
|
||||||
|
|
||||||
private static String toTokenFilename(final String in) {
|
// takes a string of the form "<colors> <power> <toughness> <name>" such as: "B 0 0 Germ"
|
||||||
final StringBuffer out = new StringBuffer();
|
public static String makeTokenFileName(String in) {
|
||||||
|
StringBuffer out = new StringBuffer(ImageCache.TOKEN_PREFIX);
|
||||||
out.append(ImageCache.TOKEN_PREFIX);
|
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
for (int i = 0; i < in.length(); i++) {
|
for (int i = 0; i < in.length(); i++) {
|
||||||
c = in.charAt(i);
|
c = in.charAt(i);
|
||||||
@@ -40,7 +38,7 @@ public class CardToken implements InventoryItemFromSet, IPaperCard {
|
|||||||
public static String makeTokenFileName(String colors, String power, String toughness, String name) {
|
public static String makeTokenFileName(String colors, String power, String toughness, String name) {
|
||||||
StringBuilder fileName = new StringBuilder();
|
StringBuilder fileName = new StringBuilder();
|
||||||
fileName.append(colors).append('_').append(power).append('_').append(toughness).append('_').append(name);
|
fileName.append(colors).append('_').append(power).append('_').append(toughness).append('_').append(name);
|
||||||
return toTokenFilename(fileName.toString());
|
return makeTokenFileName(fileName.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardToken(final CardRules c, CardEdition edition0, final String imageFileName) {
|
public CardToken(final CardRules c, CardEdition edition0, final String imageFileName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user