mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-12 16:58:57 +00:00
Merge branch 'tokenset' into 'master'
Some improvements to token image fetching (especially emblems) See merge request core-developers/forge!5105
This commit is contained in:
@@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
|
|||||||
|
|
||||||
import forge.GameCommand;
|
import forge.GameCommand;
|
||||||
import forge.ImageKeys;
|
import forge.ImageKeys;
|
||||||
|
import forge.card.CardRarity;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameObject;
|
import forge.game.GameObject;
|
||||||
import forge.game.ability.AbilityFactory;
|
import forge.game.ability.AbilityFactory;
|
||||||
@@ -123,6 +124,8 @@ public class EffectEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String image;
|
String image;
|
||||||
|
String set = hostCard.getSetCode().toLowerCase();
|
||||||
|
StringBuilder imageSet = new StringBuilder();
|
||||||
if (sa.hasParam("Image")) {
|
if (sa.hasParam("Image")) {
|
||||||
image = ImageKeys.getTokenKey(sa.getParam("Image"));
|
image = ImageKeys.getTokenKey(sa.getParam("Image"));
|
||||||
} else if (name.startsWith("Emblem")) { // try to get the image from name
|
} else if (name.startsWith("Emblem")) { // try to get the image from name
|
||||||
@@ -135,11 +138,17 @@ public class EffectEffect extends SpellAbilityEffect {
|
|||||||
} else { // use host image
|
} else { // use host image
|
||||||
image = hostCard.getImageKey();
|
image = hostCard.getImageKey();
|
||||||
}
|
}
|
||||||
|
imageSet.append(image).append("_").append(set);
|
||||||
|
image = imageSet.toString();
|
||||||
|
|
||||||
for (Player controller : effectOwner) {
|
for (Player controller : effectOwner) {
|
||||||
final Card eff = createEffect(sa, controller, name, image);
|
final Card eff = createEffect(sa, controller, name, image);
|
||||||
eff.setSetCode(sa.getHostCard().getSetCode());
|
eff.setSetCode(sa.getHostCard().getSetCode());
|
||||||
|
if (name.startsWith("Emblem")) {
|
||||||
|
eff.setRarity(CardRarity.Common);
|
||||||
|
} else {
|
||||||
eff.setRarity(sa.getHostCard().getRarity());
|
eff.setRarity(sa.getHostCard().getRarity());
|
||||||
|
}
|
||||||
|
|
||||||
// Abilities and triggers work the same as they do for Token
|
// Abilities and triggers work the same as they do for Token
|
||||||
// Grant abilities
|
// Grant abilities
|
||||||
|
|||||||
@@ -88,6 +88,19 @@ public class SwingImageFetcher extends ImageFetcher {
|
|||||||
break;
|
break;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Failed to download card [" + destPath + "] image: " + e.getMessage());
|
System.err.println("Failed to download card [" + destPath + "] image: " + e.getMessage());
|
||||||
|
if (urlToDownload.contains("tokens")) {
|
||||||
|
int setIndex = urlToDownload.lastIndexOf('_');
|
||||||
|
int typeIndex = urlToDownload.lastIndexOf('.');
|
||||||
|
String setlessFilename = urlToDownload.substring(0, setIndex);
|
||||||
|
String extension = urlToDownload.substring(typeIndex);
|
||||||
|
urlToDownload = setlessFilename+extension;
|
||||||
|
try {
|
||||||
|
doFetch(tofullBorder(urlToDownload));
|
||||||
|
break;
|
||||||
|
} catch (IOException t) {
|
||||||
|
System.err.println("Failed to download setless token [" + destPath + "]: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,19 @@ public class LibGDXImageFetcher extends ImageFetcher {
|
|||||||
break;
|
break;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Failed to download card [" + destPath + "] image: " + e.getMessage());
|
System.out.println("Failed to download card [" + destPath + "] image: " + e.getMessage());
|
||||||
|
if (urlToDownload.contains("tokens")) {
|
||||||
|
int setIndex = urlToDownload.lastIndexOf('_');
|
||||||
|
int typeIndex = urlToDownload.lastIndexOf('.');
|
||||||
|
String setlessFilename = urlToDownload.substring(0, setIndex);
|
||||||
|
String extension = urlToDownload.substring(typeIndex);
|
||||||
|
urlToDownload = setlessFilename+extension;
|
||||||
|
try {
|
||||||
|
doFetch(tofullBorder(urlToDownload));
|
||||||
|
break;
|
||||||
|
} catch (IOException t) {
|
||||||
|
System.out.println("Failed to download setless token [" + destPath + "]: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user