remove isCreature from CardHelper, move to Cardview

This commit is contained in:
ingmargoudt 2017-04-06 22:07:59 +02:00
parent f22ebd3677
commit 63df7f65a7
4 changed files with 19 additions and 25 deletions

View file

@ -77,7 +77,4 @@ public final class CardHelper {
return type.toString();
}
public static boolean isCreature(CardView c) {
return c.getCardTypes().contains(CardType.CREATURE);
}
}

View file

@ -26,10 +26,11 @@
*/
package mage.client.deckeditor.table;
import java.util.Comparator;
import mage.cards.MageCard;
import mage.view.CardView;
import java.util.Comparator;
/**
* {@link MageCard} comparator. Used to sort cards in Deck Editor Table View
* pane.
@ -85,10 +86,10 @@ public class MageCardComparator implements Comparator<CardView> {
case 5:
aCom = (float) -1;
bCom = (float) -1;
if (CardHelper.isCreature(a)) {
if (a.isCreature()) {
aCom = new Float(a.getPower() + '.' + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
}
if (CardHelper.isCreature(b)) {
if (b.isCreature()) {
bCom = new Float(b.getPower() + '.' + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
}
break;

View file

@ -27,24 +27,6 @@
*/
package mage.client.deckeditor.table;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
import mage.client.MageFrame;
import mage.client.cards.BigCard;
import mage.client.cards.CardEventSource;
@ -64,6 +46,16 @@ import org.jdesktop.swingx.JXPanel;
import org.mage.card.arcane.ManaSymbols;
import org.mage.card.arcane.UI;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.util.*;
import java.util.List;
import java.util.Map.Entry;
/**
* Table Model for card list.
*
@ -264,7 +256,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
case 4:
return CardHelper.getType(c);
case 5:
return CardHelper.isCreature(c) ? c.getPower() + '/'
return c.isCreature() ? c.getPower() + '/'
+ c.getToughness() : "-";
case 6:
return c.getRarity().toString();

View file

@ -957,4 +957,8 @@ public class CardView extends SimpleCardView {
this.canAttack = canAttack;
}
public boolean isCreature(){
return cardTypes.contains(CardType.CREATURE);
}
}