mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Merge pull request #7915 from spjspj/master
Add in color identity as a sortable option in the deck editor
This commit is contained in:
commit
00df106113
6 changed files with 20 additions and 2 deletions
|
@ -141,6 +141,7 @@
|
|||
|
||||
// new mana render (svg support)
|
||||
mainTable.getColumnModel().getColumn(mainModel.COLUMN_INDEX_COST).setCellRenderer(new ManaSymbolsCellRenderer());
|
||||
mainTable.getColumnModel().getColumn(mainModel.COLUMN_INDEX_COLOR_IDENTITY).setCellRenderer(new ManaSymbolsCellRenderer());
|
||||
|
||||
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_DRAFT_VIEW, "cardView").equals("listView")) {
|
||||
jToggleListView.setSelected(true);
|
||||
|
|
|
@ -127,6 +127,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
|
||||
// new mana render (svg support)
|
||||
mainTable.getColumnModel().getColumn(mainModel.COLUMN_INDEX_COST).setCellRenderer(new ManaSymbolsCellRenderer());
|
||||
mainTable.getColumnModel().getColumn(mainModel.COLUMN_INDEX_COLOR_IDENTITY).setCellRenderer(new ManaSymbolsCellRenderer());
|
||||
|
||||
// mainTable.setToolTipText(cardSelectorScrollPane.getToolTipText());
|
||||
cardSelectorScrollPane.setViewportView(mainTable);
|
||||
|
|
|
@ -86,6 +86,10 @@ public class MageCardComparator implements CardViewComparator {
|
|||
aCom = RateCard.rateCard(a.getOriginalCard(), null);
|
||||
bCom = RateCard.rateCard(b.getOriginalCard(), null);
|
||||
break;
|
||||
case 10:
|
||||
aCom = a.getColorIdentityStr();
|
||||
bCom = b.getColorIdentityStr();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -51,9 +51,10 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
private boolean displayNoCopies = false;
|
||||
private UpdateCountsCallback updateCountsCallback;
|
||||
|
||||
private final String[] column = {"Qty", "Name", "Cost", "Color", "Type", "Stats", "Rarity", "Set", "Card number", "Draft Rating"};
|
||||
private final String[] column = {"Qty", "Name", "Cost", "Color", "Type", "Stats", "Rarity", "Set", "Card number", "Draft Rating", "Color Identity"};
|
||||
public final int COLUMN_INDEX_COST = 2;
|
||||
public final int COLUMN_INDEX_RATING = 9;
|
||||
public final int COLUMN_INDEX_COLOR_IDENTITY = 10;
|
||||
|
||||
private SortSetting sortSetting;
|
||||
private int recentSortedColumn;
|
||||
|
@ -253,6 +254,8 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
return c.getCardNumber();
|
||||
case 9:
|
||||
return RateCard.rateCard(c.getOriginalCard(), null);
|
||||
case 10:
|
||||
return ManaSymbols.getClearManaCost(c.getColorIdentityStr());
|
||||
default:
|
||||
return "error";
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import mage.constants.*;
|
|||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.designations.Designation;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.command.Plane;
|
||||
|
@ -856,6 +857,14 @@ public class CardView extends SimpleCardView {
|
|||
return rarity;
|
||||
}
|
||||
|
||||
public String getColorIdentityStr() {
|
||||
FilterMana filterMana = originalCard.getColorIdentity();
|
||||
if (filterMana.getColorCount() == 0) {
|
||||
return CardUtil.concatManaSymbols(CardInfo.SPLIT_MANA_SEPARATOR_FULL, "{C}", "");
|
||||
}
|
||||
return CardUtil.concatManaSymbols(CardInfo.SPLIT_MANA_SEPARATOR_FULL, filterMana.toString(), "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExpansionSetCode() {
|
||||
if (expansionSetCode == null) {
|
||||
|
|
|
@ -119,7 +119,7 @@ public class FreeformCommander extends Constructed {
|
|||
commanderNames.add(commander.getName());
|
||||
}
|
||||
for (Card commander : commanders) {
|
||||
if (!commander.isCreature() || !commander.isLegendary()) {
|
||||
if (!(commander.isCreature() || commander.isLegendary())) {
|
||||
addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "For Freeform Commander, the commander must be a creature or be legendary. Yours was: " + commander.getName(), true);
|
||||
valid = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue