mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Some changes to Morph card image display.
This commit is contained in:
parent
30d112e0bf
commit
c3fba626a2
3 changed files with 27 additions and 4 deletions
|
|
@ -50,7 +50,9 @@ import org.apache.log4j.Logger;
|
|||
import org.mage.card.arcane.ScaledImagePanel.MultipassType;
|
||||
import org.mage.card.arcane.ScaledImagePanel.ScalingType;
|
||||
import org.mage.plugins.card.dl.sources.DirectLinksForDownload;
|
||||
import org.mage.plugins.card.images.CardDownloadData;
|
||||
import org.mage.plugins.card.images.ImageCache;
|
||||
import org.mage.plugins.card.utils.CardImageUtils;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
/**
|
||||
|
|
@ -304,8 +306,19 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
}
|
||||
BufferedImage srcImage;
|
||||
if (gameCard.isFaceDown()) {
|
||||
boolean morphedCard = false;
|
||||
for (String rule:gameCard.getRules()) {
|
||||
if (rule.startsWith("Morph ") ||
|
||||
rule.equals("You may cast this card as a 2/2 face-down creature, with no text, no name, no subtypes, and no mana cost by paying {3} rather than paying its mana cost.")) {
|
||||
morphedCard = true;
|
||||
}
|
||||
}
|
||||
if (morphedCard) {
|
||||
srcImage = ImageCache.getMorphImage();
|
||||
}else {
|
||||
TFile file = new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename);
|
||||
srcImage = ImageCache.loadImage(file);
|
||||
}
|
||||
} else {
|
||||
srcImage = ImageCache.getImage(gameCard, getCardWidth(), getCardHeight());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package org.mage.plugins.card.images;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
|
|
@ -68,7 +70,7 @@ public class CardDownloadData {
|
|||
if ((this.set == null) ? (other.set != null) : !this.set.equals(other.set)) {
|
||||
return false;
|
||||
}
|
||||
if (this.collectorId != other.collectorId && (this.collectorId == null || !this.collectorId.equals(other.collectorId))) {
|
||||
if (!Objects.equals(this.collectorId, other.collectorId) && (this.collectorId == null || !this.collectorId.equals(other.collectorId))) {
|
||||
return false;
|
||||
}
|
||||
if (this.token != other.token) {
|
||||
|
|
|
|||
|
|
@ -131,6 +131,14 @@ public class ImageCache {
|
|||
});
|
||||
}
|
||||
|
||||
public static BufferedImage getMorphImage() {
|
||||
CardDownloadData info = new CardDownloadData("Morph", "KTK", 0, false, 0, "KTK");
|
||||
info.setToken(true);
|
||||
String path = CardImageUtils.generateTokenImagePath(info);
|
||||
TFile file = new TFile(path);
|
||||
return loadImage(file);
|
||||
}
|
||||
|
||||
private static String buildThumbnailPath(String path) {
|
||||
String thumbnailPath;
|
||||
if (PreferencesDialog.isSaveImagesToZip()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue