From b52e526c0f3c86ed215c557de20b33404a1f6e84 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Thu, 24 Jul 2014 12:18:20 +0400 Subject: [PATCH] Fixed Issue#454: offset for enchanted permanents --- .../main/java/org/mage/card/arcane/CardPanel.java | 14 ++------------ .../java/org/mage/plugins/card/CardPluginImpl.java | 8 ++++---- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java index 9f58408671..ec171577ba 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java @@ -9,6 +9,7 @@ import mage.client.plugins.adapters.MageActionCallback; import mage.client.plugins.impl.Plugins; import mage.client.util.audio.AudioManager; import mage.components.ImagePanel; +import mage.constants.AbilityType; import mage.constants.CardType; import mage.constants.EnlargeMode; import mage.utils.CardUtil; @@ -31,8 +32,6 @@ import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import mage.constants.AbilityType; -import mage.constants.MageObjectType; /** * Main class for drawing Mage card object. @@ -310,16 +309,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti } private void setText(CardView card) { - if (displayTitleAnyway) { - titleText.setText(card.getName()); - return; - } - - if (hasImage) { - titleText.setText(""); - } else { - titleText.setText(card.getName()); - } + titleText.setText(!displayTitleAnyway && hasImage ? "" : card.getName()); } private void setImage(Image srcImage) { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java b/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java index 356c549860..e56a9bfa92 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java @@ -47,14 +47,13 @@ public class CardPluginImpl implements CardPlugin { private static final Logger log = Logger.getLogger(CardPluginImpl.class); - private static final int ATTACHMENT_DY_OFFSET = 10; - private static final int GUTTER_Y = 15; private static final int GUTTER_X = 5; static final float EXTRA_CARD_SPACING_X = 0.04f; private static final float CARD_SPACING_Y = 0.03f; private static final float STACK_SPACING_X = 0.07f; private static final float STACK_SPACING_Y = 0.13f; + private static final float ATTACHMENT_SPACING_Y = 0.13f; private int landStackMax = 5; private int cardWidthMin = 50, cardWidthMax = Constants.CARD_SIZE_FULL.width; @@ -63,7 +62,7 @@ public class CardPluginImpl implements CardPlugin { private int playAreaWidth, playAreaHeight; private int cardWidth, cardHeight; private int extraCardSpacingX, cardSpacingX, cardSpacingY; - private int stackSpacingX, stackSpacingY; + private int stackSpacingX, stackSpacingY, attachmentSpacingY; private List rows = new ArrayList<>(); @Init @@ -185,6 +184,7 @@ public class CardPluginImpl implements CardPlugin { cardSpacingY = Math.round(cardHeight * CARD_SPACING_Y); stackSpacingX = stackVertical ? 0 : Math.round(cardWidth * STACK_SPACING_X); stackSpacingY = Math.round(cardHeight * STACK_SPACING_Y); + attachmentSpacingY = Math.round(cardHeight * ATTACHMENT_SPACING_Y); Row creatures = (Row) allCreatures.clone(); Row lands = (Row) allLands.clone(); Row others = (Row) allOthers.clone(); @@ -449,7 +449,7 @@ public class CardPluginImpl implements CardPlugin { } private int getHeight() { - return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY + ATTACHMENT_DY_OFFSET*maxAttachedCount; + return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY + attachmentSpacingY*maxAttachedCount; } public int getMaxAttachedCount() {