diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/collection/viewer/MageBook.java b/Mage.Client/src/main/java/mage/client/deckeditor/collection/viewer/MageBook.java index a9dce7c539..e227d12d09 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/collection/viewer/MageBook.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/collection/viewer/MageBook.java @@ -18,6 +18,7 @@ import mage.components.ImagePanel; import mage.components.ImagePanelStyle; import mage.game.command.Emblem; import mage.game.command.Plane; +import mage.game.draft.RateCard; import mage.game.permanent.PermanentToken; import mage.game.permanent.token.Token; import mage.view.CardView; @@ -422,6 +423,20 @@ public class MageBook extends JComponent { cardNumber.setFont(jLayeredPane.getFont().deriveFont(jLayeredPane.getFont().getStyle() | Font.BOLD)); cardNumber.setText(card.getCardNumber()); jLayeredPane.add(cardNumber); + + // draft rating label ( + JLabel draftRating = new JLabel(); + dy = -5 * 2 + cardNumber.getHeight(); // under card number + draftRating.setBounds(rectangle.x, rectangle.y + cardImg.getHeight() + dy, cardDimensions.frameWidth, 20); + draftRating.setHorizontalAlignment(SwingConstants.CENTER); + //draftRating.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 150), 3, true)); + draftRating.setFont(jLayeredPane.getFont().deriveFont(jLayeredPane.getFont().getStyle() | Font.BOLD)); + if (card.getOriginalCard() != null) { + draftRating.setText("draft rating: " + RateCard.rateCard(card.getOriginalCard(), null)); + } else { + draftRating.setText(""); + } + jLayeredPane.add(draftRating); } private void addToken(Token token, BigCard bigCard, UUID gameId, Rectangle rectangle) { diff --git a/Mage.Common/src/main/java/mage/view/CardView.java b/Mage.Common/src/main/java/mage/view/CardView.java index cdd9b22e66..69b8cd568b 100644 --- a/Mage.Common/src/main/java/mage/view/CardView.java +++ b/Mage.Common/src/main/java/mage/view/CardView.java @@ -2,8 +2,6 @@ package mage.view; import com.google.gson.annotations.Expose; -import java.util.*; -import java.util.stream.Collectors; import mage.MageObject; import mage.ObjectColor; import mage.abilities.Abilities; @@ -29,6 +27,9 @@ import mage.target.Target; import mage.target.Targets; import mage.util.SubTypeList; +import java.util.*; +import java.util.stream.Collectors; + /** * @author BetaSteward_at_googlemail.com */ @@ -110,6 +111,8 @@ public class CardView extends SimpleCardView { protected boolean canAttack; protected boolean inViewerOnly; + protected Card originalCard = null; + public CardView(Card card) { this(card, null, false); } @@ -126,6 +129,7 @@ public class CardView extends SimpleCardView { public CardView(CardView cardView) { super(cardView.id, cardView.expansionSetCode, cardView.cardNumber, cardView.usesVariousArt, cardView.tokenSetCode, cardView.gameObject, cardView.tokenDescriptor); + this.originalCard = cardView.originalCard; this.id = UUID.randomUUID(); this.parentId = cardView.parentId; @@ -199,14 +203,15 @@ public class CardView extends SimpleCardView { this.selected = cardView.selected; this.canAttack = cardView.canAttack; this.inViewerOnly = cardView.inViewerOnly; + this.originalCard = cardView.originalCard.copy(); } /** * @param card * @param game * @param controlled is the card view created for the card controller - used - * for morph / face down cards to know which player may see information for - * the card + * for morph / face down cards to know which player may see information for + * the card */ public CardView(Card card, Game game, boolean controlled) { this(card, game, controlled, false, false); @@ -232,15 +237,17 @@ public class CardView extends SimpleCardView { /** * @param card * @param game - * @param controlled is the card view created for the card controller - used - * for morph / face down cards to know which player may see information for - * the card + * @param controlled is the card view created for the card controller - used + * for morph / face down cards to know which player may see information for + * the card * @param showFaceDownCard if true and the card is not on the battlefield, - * also a face down card is shown in the view, face down cards will be shown - * @param storeZone if true the card zone will be set in the zone attribute. + * also a face down card is shown in the view, face down cards will be shown + * @param storeZone if true the card zone will be set in the zone attribute. */ public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard, boolean storeZone) { super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null, card.getTokenDescriptor()); + this.originalCard = card; + // no information available for face down cards as long it's not a controlled face down morph card // TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2 boolean showFaceUp = true; @@ -460,10 +467,14 @@ public class CardView extends SimpleCardView { // Get starting loyalty this.startingLoyalty = "" + card.getStartingLoyalty(); + + } public CardView(MageObject object) { super(object.getId(), "", "0", false, "", true, ""); + this.originalCard = null; + this.name = object.getName(); this.displayName = object.getName(); if (object instanceof Permanent) { @@ -1046,4 +1057,8 @@ public class CardView extends SimpleCardView { public boolean inViewerOnly() { return inViewerOnly; } + + public Card getOriginalCard() { + return this.originalCard; + } }