mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
remove isCreature from CardHelper, move to Cardview
This commit is contained in:
parent
f22ebd3677
commit
63df7f65a7
4 changed files with 19 additions and 25 deletions
|
|
@ -77,7 +77,4 @@ public final class CardHelper {
|
||||||
return type.toString();
|
return type.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCreature(CardView c) {
|
|
||||||
return c.getCardTypes().contains(CardType.CREATURE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,11 @@
|
||||||
*/
|
*/
|
||||||
package mage.client.deckeditor.table;
|
package mage.client.deckeditor.table;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link MageCard} comparator. Used to sort cards in Deck Editor Table View
|
* {@link MageCard} comparator. Used to sort cards in Deck Editor Table View
|
||||||
* pane.
|
* pane.
|
||||||
|
|
@ -85,10 +86,10 @@ public class MageCardComparator implements Comparator<CardView> {
|
||||||
case 5:
|
case 5:
|
||||||
aCom = (float) -1;
|
aCom = (float) -1;
|
||||||
bCom = (float) -1;
|
bCom = (float) -1;
|
||||||
if (CardHelper.isCreature(a)) {
|
if (a.isCreature()) {
|
||||||
aCom = new Float(a.getPower() + '.' + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
|
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()));
|
bCom = new Float(b.getPower() + '.' + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -27,24 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.client.deckeditor.table;
|
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.MageFrame;
|
||||||
import mage.client.cards.BigCard;
|
import mage.client.cards.BigCard;
|
||||||
import mage.client.cards.CardEventSource;
|
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.ManaSymbols;
|
||||||
import org.mage.card.arcane.UI;
|
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.
|
* Table Model for card list.
|
||||||
*
|
*
|
||||||
|
|
@ -264,7 +256,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
||||||
case 4:
|
case 4:
|
||||||
return CardHelper.getType(c);
|
return CardHelper.getType(c);
|
||||||
case 5:
|
case 5:
|
||||||
return CardHelper.isCreature(c) ? c.getPower() + '/'
|
return c.isCreature() ? c.getPower() + '/'
|
||||||
+ c.getToughness() : "-";
|
+ c.getToughness() : "-";
|
||||||
case 6:
|
case 6:
|
||||||
return c.getRarity().toString();
|
return c.getRarity().toString();
|
||||||
|
|
|
||||||
|
|
@ -957,4 +957,8 @@ public class CardView extends SimpleCardView {
|
||||||
this.canAttack = canAttack;
|
this.canAttack = canAttack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCreature(){
|
||||||
|
return cardTypes.contains(CardType.CREATURE);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue