mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
* Morph Ability - Some fixes for displaying / handling morph cards/permanents.
This commit is contained in:
parent
7cacff2ce7
commit
341db7b01f
7 changed files with 72 additions and 40 deletions
|
|
@ -274,8 +274,8 @@ public class GuiDisplayUtil {
|
|||
// legal = legal.replaceAll("#([^#]+)#", "<i>$1</i>");
|
||||
// legal = legal.replaceAll("\\s*//\\s*", "<hr width='50%'>");
|
||||
// legal = legal.replace("\r\n", "<div style='font-size:5pt'></div>");
|
||||
legal = legal.replaceAll("\\{this\\}", card.getName());
|
||||
legal = legal.replaceAll("\\{source\\}", card.getName());
|
||||
legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this":card.getName());
|
||||
legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this":card.getName());
|
||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.CARD));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,7 @@ 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;
|
||||
|
||||
/**
|
||||
|
|
@ -306,18 +304,10 @@ 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) {
|
||||
if (gameCard.isMorphCard()) {
|
||||
srcImage = ImageCache.getMorphImage();
|
||||
}else {
|
||||
TFile file = new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename);
|
||||
srcImage = ImageCache.loadImage(file);
|
||||
srcImage = ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename));
|
||||
}
|
||||
} else {
|
||||
srcImage = ImageCache.getImage(gameCard, getCardWidth(), getCardHeight());
|
||||
|
|
@ -909,11 +899,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
|
||||
@Override
|
||||
public boolean contains(int x, int y) {
|
||||
if (containsThis(x, y, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return containsThis(x, y, true);
|
||||
}
|
||||
|
||||
public boolean containsThis(int x, int y, boolean root) {
|
||||
|
|
@ -929,10 +915,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
cw = getCardHeight();
|
||||
}
|
||||
|
||||
if (x >= cx && x <= cx + cw && y >= cy && y <= cy + ch) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return x >= cx && x <= cx + cw && y >= cy && y <= cy + ch;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -943,7 +926,11 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
@Override
|
||||
public Image getImage() {
|
||||
if (this.hasImage) {
|
||||
return ImageCache.getImageOriginal(gameCard);
|
||||
if (gameCard.isMorphCard() && gameCard.isFaceDown()) {
|
||||
return ImageCache.getMorphImage();
|
||||
} else {
|
||||
return ImageCache.getImageOriginal(gameCard);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue