diff --git a/Mage.Client/src/main/java/mage/client/cards/BigCard.form b/Mage.Client/src/main/java/mage/client/cards/BigCard.form index b80ecd4511..1927f746ae 100644 --- a/Mage.Client/src/main/java/mage/client/cards/BigCard.form +++ b/Mage.Client/src/main/java/mage/client/cards/BigCard.form @@ -6,7 +6,7 @@ - + @@ -30,11 +30,18 @@ + + + - + + + + + @@ -42,7 +49,7 @@ - + @@ -50,9 +57,7 @@ - - diff --git a/Mage.Client/src/main/java/mage/client/cards/BigCard.java b/Mage.Client/src/main/java/mage/client/cards/BigCard.java index 5bfe612dab..267bd68f1c 100644 --- a/Mage.Client/src/main/java/mage/client/cards/BigCard.java +++ b/Mage.Client/src/main/java/mage/client/cards/BigCard.java @@ -8,6 +8,7 @@ package mage.client.cards; +import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; @@ -15,9 +16,10 @@ import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.util.List; import java.util.UUID; +import javax.swing.BorderFactory; import javax.swing.JComponent; -import javax.swing.text.BadLocationException; -import javax.swing.text.StyledDocument; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.StyleConstants; import static mage.client.constants.Constants.CONTENT_MAX_XOFFSET; import static mage.client.constants.Constants.FRAME_MAX_HEIGHT; import static mage.client.constants.Constants.FRAME_MAX_WIDTH; @@ -29,6 +31,7 @@ import mage.client.util.ImageHelper; import mage.constants.EnlargeMode; import org.jdesktop.swingx.JXPanel; import mage.client.util.TransformedImageCache; +import org.mage.card.arcane.UI; /** * Class for displaying big image of the card @@ -62,6 +65,9 @@ public class BigCard extends JComponent { setOpaque(true); this.scrollPane.setOpaque(true); this.scrollPane.setVisible(false); + + UI.setHTMLEditorKit(text); + text.setEditable(false); } private void initBounds(boolean rotated) { @@ -69,8 +75,8 @@ public class BigCard extends JComponent { if (rotated) { scrollPane.setBounds(50, 50, 100, 100); } else { - scrollPane.setBounds(this.getWidth()*1000/17777,this.getWidth()*1000/1100, - this.getWidth()*1000/1142,this.getWidth()*1000/2539); + scrollPane.setBounds(this.getWidth()*1000/17777,this.getWidth()*1000/1150, + this.getWidth()*1000/1130,this.getWidth()*1000/2100); } } @@ -95,8 +101,14 @@ public class BigCard extends JComponent { synchronized (this) { source = null; hue = 0.000f; - } - drawText(strings); + } + StringBuilder displayedText = new StringBuilder(); + for (String textLine: strings) { + if (textLine != null && !textLine.replace(".", "").trim().isEmpty()) { + displayedText.append("

").append(textLine).append("

"); + } + } + this.text.setText(displayedText.toString()); repaint(); } } @@ -109,19 +121,6 @@ public class BigCard extends JComponent { this.cardId = null; } - private void drawText(java.util.List strings) { - text.setText(""); - StyledDocument doc = text.getStyledDocument(); - - try { - for (String line : strings) { - doc.insertString(doc.getLength(), line + '\n', doc.getStyle("regular")); - } - } catch (BadLocationException ble) { - } - text.setCaretPosition(0); - } - @Override public void paintComponent(Graphics graphics) { if (bigImage != null) { @@ -169,21 +168,19 @@ public class BigCard extends JComponent { setFocusable(false); setMinimumSize(new Dimension(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT)); setName("bigCardPanel"); // NOI18N - setOpaque(false); setPreferredSize(getMinimumSize()); setLayout(null); + scrollPane.setBackground(new java.awt.Color(220, 220, 220)); scrollPane.setBorder(null); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setOpaque(false); + scrollPane.setViewportBorder(javax.swing.BorderFactory.createEtchedBorder()); - text.setEditable(false); text.setFocusable(false); - text.setOpaque(false); scrollPane.setViewportView(text); add(scrollPane); - scrollPane.setBounds(20, 230, 210, 120); + scrollPane.setBounds(20, 220, 210, 130); scrollPane.setBounds(new Rectangle(CONTENT_MAX_XOFFSET, TEXT_MAX_YOFFSET, TEXT_MAX_WIDTH, TEXT_MAX_HEIGHT)); }// //GEN-END:initComponents diff --git a/Mage.Client/src/main/java/mage/client/cards/Card.java b/Mage.Client/src/main/java/mage/client/cards/Card.java index f9bce9e92e..05443a4d1e 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Card.java +++ b/Mage.Client/src/main/java/mage/client/cards/Card.java @@ -321,7 +321,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis @Override public void mouseMoved(MouseEvent arg0) { - this.bigCard.showTextComponent(); + // this.bigCard.showTextComponent(); this.bigCard.setCard(card.getId(), EnlargeMode.NORMAL, image, getRules(), false); } diff --git a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java index cf5a65eee0..50665578df 100644 --- a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java +++ b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java @@ -242,7 +242,7 @@ public class MageActionCallback implements ActionCallback { if (this.startedDragging && prevCardPanel != null && card != null) { for (Component component : card.getCardArea().getComponents()) { if (component instanceof CardPanel) { - if (cardPanels.contains(component)) { + if (cardPanels.contains((CardPanel) component)) { component.setLocation(component.getLocation().x, component.getLocation().y - GO_DOWN_ON_DRAG_Y_OFFSET); } } @@ -316,7 +316,7 @@ public class MageActionCallback implements ActionCallback { for (Component component : container.getComponents()) { if (component instanceof CardPanel) { if (!component.equals(card)) { - if (!cardPanels.contains(component)) { + if (!cardPanels.contains((CardPanel) component)) { component.setLocation(component.getLocation().x, component.getLocation().y + GO_DOWN_ON_DRAG_Y_OFFSET); } cardPanels.add((CardPanel) component); @@ -539,7 +539,7 @@ public class MageActionCallback implements ActionCallback { if (enlargedWindowState == EnlargedWindowState.CLOSED) { return; } - + MageComponents mageComponentCardPreviewContainer; MageComponents mageComponentCardPreviewPane; if (cardView.isToRotate()) { @@ -568,7 +568,7 @@ public class MageActionCallback implements ActionCallback { location.translate(-parentPoint.x, -parentPoint.y); popupContainer.setLocation(location); popupContainer.setVisible(true); - + MageCard mageCard = (MageCard) transferData.getComponent(); Image image = null; switch (enlargeMode) { @@ -593,13 +593,12 @@ public class MageActionCallback implements ActionCallback { image = mageCard.getImage(); } // shows the card in the popup Container - BigCard bigCard = (BigCard) cardPreviewPane; - displayCardInfo(mageCard, image, bigCard); - + displayCardInfo(mageCard, image, (BigCard) cardPreviewPane); + } else { LOGGER.warn("No Card preview Pane in Mage Frame defined. Card: " + cardView.getName()); } - + } catch (Exception e) { LOGGER.warn("Problem dring display of enlarged card", e); } diff --git a/Mage.Common/src/main/java/mage/filters/MageBufferedImageOp.java b/Mage.Common/src/main/java/mage/filters/MageBufferedImageOp.java index 32a12c6928..f6adc23d75 100644 --- a/Mage.Common/src/main/java/mage/filters/MageBufferedImageOp.java +++ b/Mage.Common/src/main/java/mage/filters/MageBufferedImageOp.java @@ -18,6 +18,7 @@ public abstract class MageBufferedImageOp implements BufferedImageOp { /** * Creates compatible image for @param src image. */ + @Override public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dest) { if (dest == null) { dest = src.getColorModel(); @@ -25,14 +26,17 @@ public abstract class MageBufferedImageOp implements BufferedImageOp { return new BufferedImage(dest, dest.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dest.isAlphaPremultiplied(), null); } + @Override public RenderingHints getRenderingHints() { return null; } + @Override public Rectangle2D getBounds2D(BufferedImage src) { return new Rectangle(0, 0, src.getWidth(), src.getHeight()); } + @Override public Point2D getPoint2D(Point2D srcPt, Point2D destPt) { if (destPt == null) { destPt = new Point2D.Double(); diff --git a/Mage.Common/src/main/java/mage/view/AbilityView.java b/Mage.Common/src/main/java/mage/view/AbilityView.java index e01a7d5404..7327ac9eef 100644 --- a/Mage.Common/src/main/java/mage/view/AbilityView.java +++ b/Mage.Common/src/main/java/mage/view/AbilityView.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.EnumSet; import mage.ObjectColor; import mage.abilities.Ability; -import mage.constants.CardType; import mage.constants.SuperType; import mage.util.SubTypeList; @@ -28,7 +27,7 @@ public class AbilityView extends CardView { this.power = ""; this.toughness = ""; this.loyalty = ""; - this.cardTypes = new ArrayList(); + this.cardTypes = new ArrayList<>(); this.subTypes = new SubTypeList(); this.superTypes = EnumSet.noneOf(SuperType.class); this.color = new ObjectColor(); diff --git a/Mage.Common/src/main/java/mage/view/GameView.java b/Mage.Common/src/main/java/mage/view/GameView.java index a98a8a19bc..3f703c7678 100644 --- a/Mage.Common/src/main/java/mage/view/GameView.java +++ b/Mage.Common/src/main/java/mage/view/GameView.java @@ -55,7 +55,7 @@ public class GameView implements Serializable { private final PhaseStep step; private final UUID activePlayerId; private String activePlayerName = ""; - private String priorityPlayerName; + private final String priorityPlayerName; private final int turn; private boolean special = false; private final boolean isPlayer; // false = watching user @@ -138,7 +138,7 @@ public class GameView implements Serializable { // can happen if a player times out while ability is on the stack LOGGER.debug("Stack Object for stack ability not found: " + stackObject.getStackAbility().getRule()); } - } else { + } else if (stackObject != null) { LOGGER.fatal("Unknown type of StackObject: " + stackObject.getName() + ' ' + stackObject.toString() + ' ' + stackObject.getClass().toString()); } //stackOrder.add(stackObject.getId()); diff --git a/Mage.Common/src/main/java/mage/view/StackAbilityView.java b/Mage.Common/src/main/java/mage/view/StackAbilityView.java index 6035f687be..a2214b83c4 100644 --- a/Mage.Common/src/main/java/mage/view/StackAbilityView.java +++ b/Mage.Common/src/main/java/mage/view/StackAbilityView.java @@ -17,6 +17,8 @@ import mage.util.GameLog; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import mage.abilities.hint.Hint; +import mage.abilities.hint.HintUtils; /** * @author BetaSteward_at_googlemail.com @@ -115,6 +117,18 @@ public class StackAbilityView extends CardView { this.rules.add("Chosen mode: " + mode.getEffects().getText(mode) + ""); } } + + if (HintUtils.ABILITY_HINTS_ENABLE) { + List abilityHints = new ArrayList<>(); + for (Hint hint : ability.getHints()) { + abilityHints.add(hint.getText(game, ability)); + } + // total hints + if (!abilityHints.isEmpty()) { + rules.add(HintUtils.HINT_START_MARK); + HintUtils.appendHints(rules, abilityHints); + } + } } public CardView getSourceCard() { diff --git a/Mage/src/main/java/mage/abilities/hint/ValueHint.java b/Mage/src/main/java/mage/abilities/hint/ValueHint.java index 49c03d7c91..656ab0fdb6 100644 --- a/Mage/src/main/java/mage/abilities/hint/ValueHint.java +++ b/Mage/src/main/java/mage/abilities/hint/ValueHint.java @@ -9,8 +9,8 @@ import mage.game.Game; */ public class ValueHint implements Hint { - private String name; - private DynamicValue value; + private final String name; + private final DynamicValue value; public ValueHint(String name, DynamicValue value) { this.name = name; diff --git a/Mage/src/main/java/mage/abilities/hint/common/AbilityResolutionCountHint.java b/Mage/src/main/java/mage/abilities/hint/common/AbilityResolutionCountHint.java index 5c44331381..9a8f8ff32b 100644 --- a/Mage/src/main/java/mage/abilities/hint/common/AbilityResolutionCountHint.java +++ b/Mage/src/main/java/mage/abilities/hint/common/AbilityResolutionCountHint.java @@ -12,7 +12,7 @@ import mage.game.Game; public enum AbilityResolutionCountHint implements Hint { instance; - private static final Hint hint = new ValueHint("Resolution count:", AbilityResolutionCount.instance); + private static final Hint hint = new ValueHint("Resolution count", AbilityResolutionCount.instance); @Override public String getText(Game game, Ability ability) { diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index a4ff70b008..b1ba34e30a 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -953,7 +953,7 @@ public abstract class GameImpl implements Game, Serializable { } // Choose a companion from the list of legal companions for (Card card : potentialCompanions) { - if (player.chooseUse(Outcome.Benefit, "Use " + card.getName() + " as your companion?", null, this)) { + if (player.chooseUse(Outcome.Benefit, "Use " + card.getLogName() + " as your companion?", null, this)) { playerCompanionMap.put(player, card); break; }