mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
show front face of facedown cards in VPicture when player can legitmately look at them
This commit is contained in:
@@ -8427,6 +8427,14 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
return this.getCharacteristics().getImageKey();
|
return this.getCharacteristics().getImageKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final String getImageKey(CardCharacteristicName state) {
|
||||||
|
CardCharacteristics characteristics = characteristicsMap.get(state);
|
||||||
|
if (null == characteristics) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return characteristics.getImageKey();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Setter for the field <code>evoked</code>.
|
* Setter for the field <code>evoked</code>.
|
||||||
|
|||||||
@@ -99,21 +99,29 @@ public class ImageCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retrieve an image from the cache. returns null if the image is not found in the cache
|
* retrieve an image from the cache. returns a default image if the image is not found in the cache
|
||||||
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
||||||
*/
|
*/
|
||||||
public static BufferedImage getImage(Card card, int width, int height) {
|
public static BufferedImage getImage(Card card, int width, int height) {
|
||||||
|
return getImage(card, width, height, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* retrieve an image from the cache. returns a default image if the image is not found in the cache
|
||||||
|
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
||||||
|
*/
|
||||||
|
public static BufferedImage getImage(Card card, int width, int height, boolean ignoreFaceDown) {
|
||||||
final String key;
|
final String key;
|
||||||
if (!card.canBeShownTo(Singletons.getControl().getPlayer()) || card.isFaceDown()) {
|
if (!card.canBeShownTo(Singletons.getControl().getPlayer()) || (!ignoreFaceDown && card.isFaceDown())) {
|
||||||
key = TOKEN_PREFIX + NewConstants.CACHE_MORPH_IMAGE_FILE;
|
key = TOKEN_PREFIX + NewConstants.CACHE_MORPH_IMAGE_FILE;
|
||||||
} else {
|
} else {
|
||||||
key = card.getImageKey();
|
key = ignoreFaceDown ? card.getImageKey(CardCharacteristicName.Original) : card.getImageKey();
|
||||||
}
|
}
|
||||||
return scaleImage(key, width, height, true);
|
return scaleImage(key, width, height, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retrieve an image from the cache. returns null if the image is not found in the cache
|
* retrieve an image from the cache. returns a default image if the image is not found in the cache
|
||||||
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
||||||
*/
|
*/
|
||||||
public static BufferedImage getImage(InventoryItem ii, int width, int height) {
|
public static BufferedImage getImage(InventoryItem ii, int width, int height) {
|
||||||
|
|||||||
@@ -86,9 +86,9 @@ public final class CardPicturePanel extends JPanel {
|
|||||||
if (displayed instanceof InventoryItem) {
|
if (displayed instanceof InventoryItem) {
|
||||||
image = ImageCache.getImage((InventoryItem)this.displayed, this.getWidth() - i.left - i.right, this.getHeight()
|
image = ImageCache.getImage((InventoryItem)this.displayed, this.getWidth() - i.left - i.right, this.getHeight()
|
||||||
- i.top - i.bottom);
|
- i.top - i.bottom);
|
||||||
} else if ( displayed instanceof Card ) {
|
} else if (displayed instanceof Card) {
|
||||||
image = ImageCache.getImage((Card)this.displayed, this.getWidth() - i.left - i.right - 2, this.getHeight() - i.top
|
image = ImageCache.getImage((Card)this.displayed,
|
||||||
- i.bottom - 2);
|
this.getWidth() - i.left - i.right - 2, this.getHeight() - i.top - i.bottom - 2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image != this.currentImage) {
|
if (image != this.currentImage) {
|
||||||
|
|||||||
Reference in New Issue
Block a user