mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
introduced isCreature/isLand/isArtifact/... etc for CardView
This commit is contained in:
parent
08197f192c
commit
f519b12d0e
10 changed files with 110 additions and 143 deletions
|
@ -159,9 +159,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
|
||||
gImage.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_MAX_SIZE));
|
||||
gImage.drawString(card.getName()+"TEST", CONTENT_MAX_XOFFSET, NAME_MAX_YOFFSET);
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (card.isCreature()) {
|
||||
gImage.drawString(card.getPower() + '/' + card.getToughness(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
} else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
} else if (card.isPlanesWalker()) {
|
||||
gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
}
|
||||
|
||||
|
@ -173,9 +173,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
|
||||
gSmall.setFont(new Font("Arial", Font.PLAIN, Config.dimensions.nameFontSize));
|
||||
gSmall.drawString(card.getName()+"TEST2", Config.dimensions.contentXOffset, Config.dimensions.nameYOffset);
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (card.isCreature()) {
|
||||
gSmall.drawString(card.getPower() + "/-/" + card.getToughness(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop);
|
||||
} else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
} else if (card.isPlanesWalker()) {
|
||||
gSmall.drawString(card.getLoyalty(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop);
|
||||
}
|
||||
|
||||
|
@ -207,9 +207,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
if (card.getColor().hasColor()) {
|
||||
sb.append('\n').append(card.getColor().toString());
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (card.isCreature()) {
|
||||
sb.append('\n').append(card.getPower()).append('/').append(card.getToughness());
|
||||
} else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
} else if (card.isPlanesWalker()) {
|
||||
sb.append('\n').append(card.getLoyalty());
|
||||
}
|
||||
for (String rule : getRules()) {
|
||||
|
@ -230,9 +230,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
return "effect";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (card.getCardTypes().contains(CardType.LAND)) {
|
||||
if (card.isLand()) {
|
||||
sb.append("land").append(card.getSuperTypes()).append(card.getSubTypes());
|
||||
} else if (card.getCardTypes() != null && (card.getCardTypes().contains(CardType.CREATURE) || card.getCardTypes().contains(CardType.PLANESWALKER))) {
|
||||
} else if (card.getCardTypes() != null && (card.isCreature() || card.isPlanesWalker())) {
|
||||
sb.append("creature");
|
||||
}
|
||||
sb.append(card.getColor()).append(card.getRarity()).append(card.getExpansionSetCode());
|
||||
|
|
|
@ -44,7 +44,6 @@ import mage.client.plugins.impl.Plugins;
|
|||
import mage.client.util.*;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.gui.TableSpinnerEditor;
|
||||
import mage.constants.CardType;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.SimpleCardView;
|
||||
|
@ -383,22 +382,22 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
int artifactCount = 0;
|
||||
|
||||
for (CardView card : cards.values()) {
|
||||
if (card.getCardTypes().contains(CardType.LAND)) {
|
||||
if (card.isLand()) {
|
||||
landCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (card.isCreature()) {
|
||||
creatureCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.SORCERY)) {
|
||||
if (card.isSorcery()) {
|
||||
sorceryCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.INSTANT)) {
|
||||
if (card.isInstant()) {
|
||||
instantCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.ENCHANTMENT)) {
|
||||
if (card.isEnchantment()) {
|
||||
enchantmentCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.ARTIFACT)) {
|
||||
if (card.isArtifact()) {
|
||||
artifactCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,6 @@
|
|||
package mage.client.cards;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import mage.cards.Card;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import mage.cards.MageCard;
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.cards.decks.DeckCardLayout;
|
||||
|
@ -58,15 +11,8 @@ import mage.client.MageFrame;
|
|||
import mage.client.constants.Constants;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardViewCardTypeComparator;
|
||||
import mage.client.util.CardViewColorComparator;
|
||||
import mage.client.util.CardViewColorIdentityComparator;
|
||||
import mage.client.util.CardViewCostComparator;
|
||||
import mage.client.util.CardViewNameComparator;
|
||||
import mage.client.util.CardViewRarityComparator;
|
||||
import mage.client.util.*;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.util.RandomUtil;
|
||||
|
@ -75,6 +21,18 @@ import mage.view.CardsView;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.CardRenderer;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by StravantUser on 2016-09-20.
|
||||
*/
|
||||
|
@ -512,50 +470,50 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
private final CardTypeCounter creatureCounter = new CardTypeCounter() {
|
||||
@Override
|
||||
protected boolean is(CardView card) {
|
||||
return card.getCardTypes().contains(CardType.CREATURE);
|
||||
return card.isCreature();
|
||||
}
|
||||
};
|
||||
private final CardTypeCounter landCounter = new CardTypeCounter() {
|
||||
@Override
|
||||
protected boolean is(CardView card) {
|
||||
return card.getCardTypes().contains(CardType.LAND);
|
||||
return card.isLand();
|
||||
}
|
||||
};
|
||||
|
||||
private final CardTypeCounter artifactCounter = new CardTypeCounter() {
|
||||
@Override
|
||||
protected boolean is(CardView card) {
|
||||
return card.getCardTypes().contains(CardType.ARTIFACT);
|
||||
return card.isArtifact();
|
||||
}
|
||||
};
|
||||
private final CardTypeCounter enchantmentCounter = new CardTypeCounter() {
|
||||
@Override
|
||||
protected boolean is(CardView card) {
|
||||
return card.getCardTypes().contains(CardType.ENCHANTMENT);
|
||||
return card.isEnchantment();
|
||||
}
|
||||
};
|
||||
private final CardTypeCounter instantCounter = new CardTypeCounter() {
|
||||
@Override
|
||||
protected boolean is(CardView card) {
|
||||
return card.getCardTypes().contains(CardType.INSTANT);
|
||||
return card.isInstant();
|
||||
}
|
||||
};
|
||||
private final CardTypeCounter sorceryCounter = new CardTypeCounter() {
|
||||
@Override
|
||||
protected boolean is(CardView card) {
|
||||
return card.getCardTypes().contains(CardType.SORCERY);
|
||||
return card.isSorcery();
|
||||
}
|
||||
};
|
||||
private final CardTypeCounter planeswalkerCounter = new CardTypeCounter() {
|
||||
@Override
|
||||
protected boolean is(CardView card) {
|
||||
return card.getCardTypes().contains(CardType.PLANESWALKER);
|
||||
return card.isPlanesWalker();
|
||||
}
|
||||
};
|
||||
private final CardTypeCounter tribalCounter = new CardTypeCounter() {
|
||||
@Override
|
||||
protected boolean is(CardView card) {
|
||||
return card.getCardTypes().contains(CardType.TRIBAL);
|
||||
return card.isTribal();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1897,7 +1855,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
}
|
||||
// What row to add it to?
|
||||
ArrayList<ArrayList<CardView>> targetRow;
|
||||
if (separateCreatures && !newCard.getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (separateCreatures && !newCard.isCreature()) {
|
||||
// Ensure row 2 exists
|
||||
if (cardGrid.size() < 2) {
|
||||
cardGrid.add(1, new ArrayList<>());
|
||||
|
|
|
@ -39,7 +39,6 @@ import mage.cards.MagePermanent;
|
|||
import mage.cards.Sets;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.TransformedImageCache;
|
||||
import mage.constants.CardType;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
|
@ -110,10 +109,10 @@ public class Permanent extends Card {
|
|||
if (permanent.getOriginal().getColor().hasColor()) {
|
||||
sb.append('\n').append(permanent.getOriginal().getColor().toString());
|
||||
}
|
||||
if (permanent.getOriginal().getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (permanent.getOriginal().isCreature()) {
|
||||
sb.append('\n').append(permanent.getOriginal().getPower()).append('/').append(permanent.getOriginal().getToughness());
|
||||
}
|
||||
else if (permanent.getOriginal().getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
else if (permanent.getOriginal().isPlanesWalker()) {
|
||||
sb.append('\n').append(permanent.getOriginal().getLoyalty());
|
||||
}
|
||||
for (String rule: getRules()) {
|
||||
|
|
|
@ -37,7 +37,6 @@ import mage.client.util.Config;
|
|||
import mage.client.util.Event;
|
||||
import mage.client.util.Listener;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.EnlargeMode;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
|
@ -125,22 +124,22 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
addCard(card, bigCard, gameId);
|
||||
}
|
||||
if (updateCountsCallback != null) {
|
||||
if (card.getCardTypes().contains(CardType.LAND)) {
|
||||
if (card.isLand()) {
|
||||
landCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (card.isCreature()) {
|
||||
creatureCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.INSTANT)) {
|
||||
if (card.isInstant()) {
|
||||
instantCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.SORCERY)) {
|
||||
if (card.isSorcery()) {
|
||||
sorceryCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.ENCHANTMENT)) {
|
||||
if (card.isEnchantment()) {
|
||||
enchantmentCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.ARTIFACT)) {
|
||||
if (card.isArtifact()) {
|
||||
artifactCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,15 +33,6 @@
|
|||
*/
|
||||
package mage.client.game;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.Permanent;
|
||||
|
@ -51,11 +42,20 @@ 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.constants.CardType;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -279,9 +279,9 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
}*/
|
||||
}
|
||||
|
||||
if (permanent.getCardTypes().contains(CardType.ARTIFACT)) {
|
||||
if (permanent.isArtifact()) {
|
||||
addedArtifact = true;
|
||||
} else if (permanent.getCardTypes().contains(CardType.CREATURE)) {
|
||||
} else if (permanent.isCreature()) {
|
||||
addedCreature = true;
|
||||
} else {
|
||||
addedPermanent = true;
|
||||
|
@ -305,7 +305,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
});
|
||||
t.start();
|
||||
}
|
||||
if (((MagePermanent) comp).getOriginal().getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (((MagePermanent) comp).getOriginal().isCreature()) {
|
||||
removedCreature = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -700,9 +700,9 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
if (card.getColor().hasColor()) {
|
||||
sb.append('\n').append(card.getColor().toString());
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (card.isCreature()) {
|
||||
sb.append('\n').append(card.getPower()).append('/').append(card.getToughness());
|
||||
} else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
} else if (card.isPlanesWalker()) {
|
||||
sb.append('\n').append(card.getLoyalty());
|
||||
}
|
||||
if (card.getRules() == null) {
|
||||
|
|
|
@ -11,7 +11,6 @@ import mage.cards.FrameStyle;
|
|||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.MageObjectType;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.view.CardView;
|
||||
import mage.view.PermanentView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -21,7 +20,6 @@ import java.awt.*;
|
|||
import java.awt.font.*;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.RasterFormatException;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
|
@ -427,7 +425,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
contentWidth - 2, cardHeight - borderWidth * 3 - typeLineY - 1);
|
||||
|
||||
// If it's a planeswalker, extend the textbox left border by some
|
||||
if (cardView.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
if (cardView.isPlanesWalker()) {
|
||||
g.setPaint(borderPaint);
|
||||
g.fillRect(
|
||||
totalContentInset, typeLineY + boxHeight,
|
||||
|
@ -603,7 +601,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
|
||||
// Is it a creature?
|
||||
boolean isVehicle = cardView.getSubTypes().contains("Vehicle");
|
||||
if (cardView.getCardTypes().contains(CardType.CREATURE) || isVehicle) {
|
||||
if (cardView.isCreature() || isVehicle) {
|
||||
int x = cardWidth - borderWidth - partWidth;
|
||||
|
||||
// Draw PT box
|
||||
|
@ -623,7 +621,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
// Draw text
|
||||
Color textColor;
|
||||
if (isVehicle) {
|
||||
boolean isAnimated = !(cardView instanceof PermanentView) || cardView.getCardTypes().contains(CardType.CREATURE);
|
||||
boolean isAnimated = !(cardView instanceof PermanentView) || cardView.isCreature();
|
||||
if (isAnimated) {
|
||||
textColor = Color.white;
|
||||
} else {
|
||||
|
@ -646,7 +644,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
|
||||
// Is it a walker? (But don't draw the box if it's a non-permanent view
|
||||
// of a walker without a starting loyalty (EG: Arlin Kord's flipped side).
|
||||
if (cardView.getCardTypes().contains(CardType.PLANESWALKER)
|
||||
if (cardView.isPlanesWalker()
|
||||
&& (cardView instanceof PermanentView || !cardView.getStartingLoyalty().equals("0"))) {
|
||||
// Draw the PW loyalty box
|
||||
int w = partWidth;
|
||||
|
@ -772,7 +770,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
}
|
||||
|
||||
// Basic mana draw mana symbol in textbox (for basic lands)
|
||||
if (allRules.size() == 1 && (allRules.get(0) instanceof TextboxBasicManaRule) && cardView.getCardTypes().contains(CardType.LAND)) {
|
||||
if (allRules.size() == 1 && (allRules.get(0) instanceof TextboxBasicManaRule) && cardView.isLand()) {
|
||||
drawBasicManaTextbox(g, x, y, w, h, ((TextboxBasicManaRule) allRules.get(0)).getBasicManaSymbol());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,5 @@
|
|||
package org.mage.plugins.card;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLayeredPane;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
|
@ -31,11 +15,7 @@ import net.xeoh.plugins.base.annotations.events.Init;
|
|||
import net.xeoh.plugins.base.annotations.events.PluginLoaded;
|
||||
import net.xeoh.plugins.base.annotations.meta.Author;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.Animation;
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
import org.mage.card.arcane.CardPanelComponentImpl;
|
||||
import org.mage.card.arcane.CardPanelRenderImpl;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
import org.mage.card.arcane.*;
|
||||
import org.mage.plugins.card.dl.DownloadGui;
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
import org.mage.plugins.card.dl.Downloader;
|
||||
|
@ -46,6 +26,15 @@ import org.mage.plugins.card.dl.sources.GathererSymbols;
|
|||
import org.mage.plugins.card.images.ImageCache;
|
||||
import org.mage.plugins.card.info.CardInfoPaneImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* {@link CardPlugin} implementation.
|
||||
*
|
||||
|
|
|
@ -216,12 +216,11 @@ 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
|
||||
* 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);
|
||||
|
@ -245,15 +244,14 @@ 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());
|
||||
|
@ -434,7 +432,7 @@ public class CardView extends SimpleCardView {
|
|||
artRect = ArtRect.SPLIT_FUSED;
|
||||
} else {
|
||||
if (spell.getCard() != null) {
|
||||
SplitCard wholeCard = ((SplitCardHalf)spell.getCard()).getParentCard();
|
||||
SplitCard wholeCard = ((SplitCardHalf) spell.getCard()).getParentCard();
|
||||
Abilities<Ability> aftermathHalfAbilities = wholeCard.getRightHalfCard().getAbilities();
|
||||
if (aftermathHalfAbilities.stream().anyMatch(ability -> ability instanceof AftermathAbility)) {
|
||||
if (ty == SpellAbilityType.SPLIT_RIGHT) {
|
||||
|
@ -957,10 +955,14 @@ public class CardView extends SimpleCardView {
|
|||
this.canAttack = canAttack;
|
||||
}
|
||||
|
||||
public boolean isCreature(){
|
||||
public boolean isCreature() {
|
||||
return cardTypes.contains(CardType.CREATURE);
|
||||
}
|
||||
|
||||
public boolean isPlanesWalker() {
|
||||
return cardTypes.contains(CardType.PLANESWALKER);
|
||||
}
|
||||
|
||||
public String getColorText() {
|
||||
if (getColor().getColorCount() == 0) return "Colorless";
|
||||
else if (getColor().getColorCount() > 1) return "Gold";
|
||||
|
@ -996,4 +998,27 @@ public class CardView extends SimpleCardView {
|
|||
return type.toString();
|
||||
}
|
||||
|
||||
public boolean isLand() {
|
||||
return cardTypes.contains(CardType.LAND);
|
||||
}
|
||||
|
||||
public boolean isInstant() {
|
||||
return cardTypes.contains(CardType.INSTANT);
|
||||
}
|
||||
|
||||
public boolean isSorcery() {
|
||||
return cardTypes.contains(CardType.SORCERY);
|
||||
}
|
||||
|
||||
public boolean isEnchantment() {
|
||||
return cardTypes.contains(CardType.ENCHANTMENT);
|
||||
}
|
||||
|
||||
public boolean isArtifact() {
|
||||
return cardTypes.contains(CardType.ARTIFACT);
|
||||
}
|
||||
|
||||
public boolean isTribal() {
|
||||
return cardTypes.contains(CardType.TRIBAL);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue