mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +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() {
|
public BufferedImage getImage() {
|
||||||
|
|
||||||
BufferedImage image = null;
|
BufferedImage image = null;
|
||||||
|
|
||||||
if (displayed instanceof InventoryItem) {
|
if (displayed instanceof InventoryItem) {
|
||||||
|
|||||||
@@ -68,9 +68,10 @@ public enum CPicture implements ICDoc {
|
|||||||
|
|
||||||
currentCard = c;
|
currentCard = c;
|
||||||
displayedState = c.getCurState();
|
displayedState = c.getCurState();
|
||||||
flipIndicator.setVisible(isCurrentCardFlippable());
|
boolean isFlippable = isCurrentCardFlippable();
|
||||||
|
flipIndicator.setVisible(isFlippable);
|
||||||
picturePanel.setCard(c);
|
picturePanel.setCard(c);
|
||||||
if (showFlipped && isCurrentCardFlippable()) {
|
if (showFlipped && isFlippable) {
|
||||||
flipCard();
|
flipCard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +196,7 @@ public enum CPicture implements ICDoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCurrentCardFlippable() {
|
private boolean isCurrentCardFlippable() {
|
||||||
if (currentCard == null) { return false; }
|
if (currentCard == null || !Singletons.getControl().mayShowCard(currentCard)) { return false; }
|
||||||
|
|
||||||
return currentCard.isDoubleFaced() || currentCard.isFlipCard() ||
|
return currentCard.isDoubleFaced() || currentCard.isFlipCard() ||
|
||||||
(currentCard.isFaceDown() && isAuthorizedToViewFaceDownCard(currentCard));
|
(currentCard.isFaceDown() && isAuthorizedToViewFaceDownCard(currentCard));
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package forge.gui.toolbox.imaging;
|
package forge.gui.toolbox.imaging;
|
||||||
|
|
||||||
import forge.ImageCache;
|
import forge.ImageCache;
|
||||||
|
import forge.ImageKeys;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardCharacteristicName;
|
import forge.card.CardCharacteristicName;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
@@ -55,6 +56,9 @@ public final class FImageUtil {
|
|||||||
* For flip cards, returns the un-flipped image.
|
* For flip cards, returns the un-flipped image.
|
||||||
*/
|
*/
|
||||||
public static BufferedImage getImage(Card card) {
|
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);
|
BufferedImage image = ImageCache.getOriginalImage(card.getImageKey(), true);
|
||||||
int foilIndex = card.getFoil();
|
int foilIndex = card.getFoil();
|
||||||
if (image != null && foilIndex > 0) {
|
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);
|
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.
|
// 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());
|
CardEdition ed = Singletons.getMagicDb().getEditions().get(this.getCard().getCurSetCode());
|
||||||
if (ed != null && ed.isWhiteBorder() && this.getCard().getFoil() == 0) {
|
if (ed != null && ed.isWhiteBorder() && this.getCard().getFoil() == 0) {
|
||||||
g2d.setColor(Color.white);
|
g2d.setColor(Color.white);
|
||||||
@@ -783,7 +783,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isShowingOverlays() {
|
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() {
|
private boolean showCardNameOverlay() {
|
||||||
|
|||||||
Reference in New Issue
Block a user