mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Prevent being able to identify cards you're not allowed to see
This commit is contained in:
@@ -83,7 +83,6 @@ public final class CardPicturePanel extends JPanel {
|
||||
}
|
||||
|
||||
public BufferedImage getImage() {
|
||||
|
||||
BufferedImage image = null;
|
||||
|
||||
if (displayed instanceof InventoryItem) {
|
||||
|
||||
@@ -68,9 +68,10 @@ public enum CPicture implements ICDoc {
|
||||
|
||||
currentCard = c;
|
||||
displayedState = c.getCurState();
|
||||
flipIndicator.setVisible(isCurrentCardFlippable());
|
||||
boolean isFlippable = isCurrentCardFlippable();
|
||||
flipIndicator.setVisible(isFlippable);
|
||||
picturePanel.setCard(c);
|
||||
if (showFlipped && isCurrentCardFlippable()) {
|
||||
if (showFlipped && isFlippable) {
|
||||
flipCard();
|
||||
}
|
||||
}
|
||||
@@ -195,7 +196,7 @@ public enum CPicture implements ICDoc {
|
||||
}
|
||||
|
||||
private boolean isCurrentCardFlippable() {
|
||||
if (currentCard == null) { return false; }
|
||||
if (currentCard == null || !Singletons.getControl().mayShowCard(currentCard)) { return false; }
|
||||
|
||||
return currentCard.isDoubleFaced() || currentCard.isFlipCard() ||
|
||||
(currentCard.isFaceDown() && isAuthorizedToViewFaceDownCard(currentCard));
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package forge.gui.toolbox.imaging;
|
||||
|
||||
import forge.ImageCache;
|
||||
import forge.ImageKeys;
|
||||
import forge.Singletons;
|
||||
import forge.card.CardCharacteristicName;
|
||||
import forge.game.card.Card;
|
||||
@@ -55,6 +56,9 @@ public final class FImageUtil {
|
||||
* For flip cards, returns the un-flipped image.
|
||||
*/
|
||||
public static BufferedImage getImage(Card card) {
|
||||
if (!Singletons.getControl().mayShowCard(card)) {
|
||||
return ImageCache.getOriginalImage(ImageKeys.TOKEN_PREFIX + ImageKeys.MORPH_IMAGE, true);
|
||||
}
|
||||
BufferedImage image = ImageCache.getOriginalImage(card.getImageKey(), true);
|
||||
int foilIndex = card.getFoil();
|
||||
if (image != null && foilIndex > 0) {
|
||||
|
||||
@@ -318,7 +318,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
g2d.fillRoundRect(this.cardXOffset - n, (this.cardYOffset - n) + offset, this.cardWidth + (n * 2), this.cardHeight + (n * 2), cornerSize + n , cornerSize + n);
|
||||
|
||||
// White border if card is known to have it.
|
||||
if (this.getCard() != null && !this.getCard().isFaceDown()) {
|
||||
if (this.getCard() != null && Singletons.getControl().mayShowCard(this.getCard()) && !this.getCard().isFaceDown()) {
|
||||
CardEdition ed = Singletons.getMagicDb().getEditions().get(this.getCard().getCurSetCode());
|
||||
if (ed != null && ed.isWhiteBorder() && this.getCard().getFoil() == 0) {
|
||||
g2d.setColor(Color.white);
|
||||
@@ -783,7 +783,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
}
|
||||
|
||||
private boolean isShowingOverlays() {
|
||||
return isPreferenceEnabled(FPref.UI_SHOW_CARD_OVERLAYS);
|
||||
return isPreferenceEnabled(FPref.UI_SHOW_CARD_OVERLAYS) && this.card != null && Singletons.getControl().mayShowCard(this.card);
|
||||
}
|
||||
|
||||
private boolean showCardNameOverlay() {
|
||||
|
||||
Reference in New Issue
Block a user