mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
remove helper functions from cardUtil
This commit is contained in:
parent
314316f42f
commit
1649530e7b
6 changed files with 16 additions and 27 deletions
|
@ -42,7 +42,6 @@ import mage.client.util.GUISizeHelper;
|
|||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.layout.CardLayoutStrategy;
|
||||
import mage.client.util.layout.impl.OldCardLayoutStrategy;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
|
@ -155,7 +154,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
changed = true;
|
||||
} else {
|
||||
if (!changed) {
|
||||
changed = CardUtil.isCreature(oldMagePermanent.getOriginalPermanent()) != CardUtil.isCreature(permanent);
|
||||
changed = oldMagePermanent.getOriginalPermanent().isCreature() != permanent.isCreature();
|
||||
if (!changed) {
|
||||
int s1 = permanent.getAttachments() == null ? 0 : permanent.getAttachments().size();
|
||||
int s2 = oldMagePermanent.getLinks().size();
|
||||
|
|
|
@ -3,7 +3,6 @@ package mage.client.util.gui;
|
|||
import mage.client.MageFrame;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.constants.*;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
@ -269,9 +268,9 @@ public final class GuiDisplayUtil {
|
|||
buffer.append("</td></tr></table>");
|
||||
|
||||
String pt = "";
|
||||
if (CardUtil.isCreature(card)) {
|
||||
if (card.isCreature()) {
|
||||
pt = card.getPower() + '/' + card.getToughness();
|
||||
} else if (CardUtil.isPlaneswalker(card)) {
|
||||
} else if (card.isPlanesWalker()) {
|
||||
pt = card.getLoyalty();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import mage.client.util.ImageHelper;
|
|||
import mage.components.ImagePanel;
|
||||
import mage.components.ImagePanelStyle;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
@ -232,9 +231,9 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
|
||||
// PT Text
|
||||
ptText = new GlowText();
|
||||
if (CardUtil.isCreature(gameCard)) {
|
||||
if (gameCard.isCreature()) {
|
||||
ptText.setText(gameCard.getPower() + '/' + gameCard.getToughness());
|
||||
} else if (CardUtil.isPlaneswalker(gameCard)) {
|
||||
} else if (gameCard.isPlanesWalker()) {
|
||||
ptText.setText(gameCard.getLoyalty());
|
||||
}
|
||||
// ptText.setFont(getFont().deriveFont(Font.BOLD, fontSize));
|
||||
|
@ -424,7 +423,7 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
imagePanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
|
||||
imagePanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
|
||||
|
||||
if (hasSickness() && CardUtil.isCreature(gameCard) && isPermanent()) {
|
||||
if (hasSickness() && gameCard.isCreature() && isPermanent()) {
|
||||
overlayPanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
|
||||
overlayPanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
|
||||
} else {
|
||||
|
@ -571,11 +570,11 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
super.update(card);
|
||||
|
||||
// Update card text
|
||||
if (CardUtil.isCreature(card) && CardUtil.isPlaneswalker(card)) {
|
||||
if (card.isCreature() && card.isPlanesWalker()) {
|
||||
ptText.setText(card.getPower() + '/' + card.getToughness() + " (" + card.getLoyalty() + ')');
|
||||
} else if (CardUtil.isCreature(card)) {
|
||||
} else if (card.isCreature()) {
|
||||
ptText.setText(card.getPower() + '/' + card.getToughness());
|
||||
} else if (CardUtil.isPlaneswalker(card)) {
|
||||
} else if (card.isPlanesWalker()) {
|
||||
ptText.setText(card.getLoyalty());
|
||||
} else {
|
||||
ptText.setText("");
|
||||
|
@ -583,7 +582,7 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
setText(card);
|
||||
|
||||
// Summoning Sickness overlay
|
||||
if (hasSickness() && CardUtil.isCreature(gameCard) && isPermanent()) {
|
||||
if (hasSickness() && card.isCreature() && isPermanent()) {
|
||||
overlayPanel.setVisible(true);
|
||||
} else {
|
||||
overlayPanel.setVisible(false);
|
||||
|
|
|
@ -10,7 +10,6 @@ import mage.client.dialog.PreferencesDialog;
|
|||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
@ -236,7 +235,7 @@ public abstract class CardRenderer {
|
|||
|
||||
// Draw summoning sickness overlay, and possibly other overlays
|
||||
protected void drawOverlays(Graphics2D g) {
|
||||
if (CardUtil.isCreature(cardView) && cardView instanceof PermanentView) {
|
||||
if (cardView.isCreature() && cardView instanceof PermanentView) {
|
||||
if (((PermanentView) cardView).hasSummoningSickness()) {
|
||||
int x1 = (int) (0.2 * cardWidth);
|
||||
int x2 = (int) (0.8 * cardWidth);
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package mage.cards;
|
||||
|
||||
import java.util.List;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class MagePermanent extends MageCard {
|
||||
private static final long serialVersionUID = -3469258620601702171L;
|
||||
public abstract List<MagePermanent> getLinks();
|
||||
public abstract void update(PermanentView card);
|
||||
public abstract PermanentView getOriginalPermanent();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package mage.utils;
|
||||
|
||||
import java.util.List;
|
||||
import mage.ObjectColor;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.constants.CardType;
|
||||
import mage.view.CardView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utility class for {@link CardView}
|
||||
*
|
||||
|
@ -21,17 +21,8 @@ public final class CardUtil {
|
|||
private static final String regexGreen = ".*\\x7b.{0,2}G.{0,2}\\x7d.*";
|
||||
private static final String regexWhite = ".*\\x7b.{0,2}W.{0,2}\\x7d.*";
|
||||
|
||||
public static boolean isCreature(CardView card) {
|
||||
return is(card, CardType.CREATURE);
|
||||
}
|
||||
|
||||
public static boolean isPlaneswalker(CardView card) {
|
||||
return is(card, CardType.PLANESWALKER);
|
||||
}
|
||||
|
||||
public static boolean isLand(CardView card) {
|
||||
return is(card, CardType.LAND);
|
||||
}
|
||||
|
||||
public static boolean isCreature(MagePermanent card) {
|
||||
return is(card.getOriginal(), CardType.CREATURE);
|
||||
|
|
Loading…
Reference in a new issue