Added card# to deck pool area.

This commit is contained in:
LevelX2 2016-10-09 03:05:10 +02:00
parent f92e827d3b
commit e46895420e
2 changed files with 66 additions and 57 deletions

View file

@ -32,11 +32,13 @@
*/
package mage.client.deckeditor;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.*;
import mage.cards.Card;
import mage.cards.decks.Deck;
import mage.cards.decks.DeckCardInfo;
import mage.cards.decks.DeckCardLayout;
import mage.cards.decks.DeckCardLists;
import mage.client.cards.BigCard;
import mage.client.cards.CardEventSource;
import mage.client.cards.DragCardGrid;
@ -46,12 +48,6 @@ import mage.client.util.GUISizeHelper;
import mage.client.util.Listener;
import mage.view.CardView;
import mage.view.CardsView;
import org.apache.log4j.Logger;
import javax.swing.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
@ -66,7 +62,7 @@ public class DeckArea extends javax.swing.JPanel {
private BigCard lastBigCard = null;
private int dividerLocationNormal = 0;
private int dividerLocationLimited = 0;
private boolean isLimitedBuildingOrientation = false;
private final boolean isLimitedBuildingOrientation = false;
public DeckCardLayout getCardLayout() {
return deckList.getCardLayout();
@ -77,12 +73,13 @@ public class DeckArea extends javax.swing.JPanel {
}
public static class Settings {
public DragCardGrid.Settings maindeckSettings;
public DragCardGrid.Settings sideboardSetings;
public int dividerLocationLimited;
public int dividerLocationNormal;
private static Pattern parser = Pattern.compile("([^|]*)\\|([^|]*)\\|([^|]*)\\|([^|]*)");
private final static Pattern parser = Pattern.compile("([^|]*)\\|([^|]*)\\|([^|]*)\\|([^|]*)");
public static Settings parse(String s) {
Matcher m = parser.matcher(s);
@ -186,10 +183,8 @@ public class DeckArea extends javax.swing.JPanel {
if (dividerLocationLimited != 0) {
deckAreaSplitPane.setDividerLocation(s.dividerLocationLimited);
}
} else {
if (dividerLocationNormal != 0) {
deckAreaSplitPane.setDividerLocation(s.dividerLocationNormal);
}
} else if (dividerLocationNormal != 0) {
deckAreaSplitPane.setDividerLocation(s.dividerLocationNormal);
}
}
}

View file

@ -51,49 +51,63 @@ public class MageCardComparator implements Comparator<CardView> {
Comparable aCom = null;
Comparable bCom = null;
if (column == 0)// #skip
{
aCom = 1;
bCom = 1;
} else if (column == 1)// Name
{
aCom = a.getName();
bCom = b.getName();
if (aCom.equals(bCom) && a.getExpansionSetCode().equals(b.getExpansionSetCode())) {
aCom = a.getCardNumber();
bCom = b.getCardNumber();
}
} else if (column == 2)// Cost
{
aCom = a.getConvertedManaCost();
bCom = b.getConvertedManaCost();
} else if (column == 3)// Color
{
aCom = CardHelper.getColor(a);
bCom = CardHelper.getColor(b);
} else if (column == 4)// Type
{
aCom = CardHelper.getType(a);
bCom = CardHelper.getType(b);
} else if (column == 5)// Stats, attack and defense
{
aCom = (float) -1;
bCom = (float) -1;
if (CardHelper.isCreature(a)) {
aCom = new Float(a.getPower() + "." + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
}
if (CardHelper.isCreature(b)) {
bCom = new Float(b.getPower() + "." + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
}
} else if (column == 6)// Rarity
{
aCom = a.getRarity().toString();
bCom = b.getRarity().toString();
} else if (column == 7)// Set name
{
aCom = a.getExpansionSetCode();
bCom = b.getExpansionSetCode();
switch (column) {
// #skip
case 0:
aCom = 1;
bCom = 1;
break;
// Name
case 1:
aCom = a.getName();
bCom = b.getName();
if (aCom.equals(bCom) && a.getExpansionSetCode().equals(b.getExpansionSetCode())) {
aCom = a.getCardNumber();
bCom = b.getCardNumber();
}
break;
// Cost
case 2:
aCom = a.getConvertedManaCost();
bCom = b.getConvertedManaCost();
break;
// Color
case 3:
aCom = CardHelper.getColor(a);
bCom = CardHelper.getColor(b);
break;
// Type
case 4:
aCom = CardHelper.getType(a);
bCom = CardHelper.getType(b);
break;
// Stats, attack and defense
case 5:
aCom = (float) -1;
bCom = (float) -1;
if (CardHelper.isCreature(a)) {
aCom = new Float(a.getPower() + "." + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
}
if (CardHelper.isCreature(b)) {
bCom = new Float(b.getPower() + "." + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
}
break;
// Rarity
case 6:
aCom = a.getRarity().toString();
bCom = b.getRarity().toString();
break;
// Set name
case 7:
aCom = a.getExpansionSetCode();
bCom = b.getExpansionSetCode();
break;
case 8:
aCom = Integer.parseInt(a.getCardNumber().replaceAll("[\\D]", ""));
bCom = Integer.parseInt(b.getCardNumber().replaceAll("[\\D]", ""));
break;
default:
break;
}
if (ascending) {