mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
rollback changes to Deck, ManaCost, StorageBase, CardPool
This commit is contained in:
@@ -22,9 +22,6 @@ import java.util.Collections;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import forge.card.ColorSet;
|
|
||||||
import forge.card.MagicColor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* CardManaCost class.
|
* CardManaCost class.
|
||||||
@@ -49,20 +46,14 @@ public final class ManaCost implements Comparable<ManaCost>, Iterable<ManaCostSh
|
|||||||
public static final ManaCost TWO = new ManaCost(2);
|
public static final ManaCost TWO = new ManaCost(2);
|
||||||
public static final ManaCost THREE = new ManaCost(3);
|
public static final ManaCost THREE = new ManaCost(3);
|
||||||
public static final ManaCost FOUR = new ManaCost(4);
|
public static final ManaCost FOUR = new ManaCost(4);
|
||||||
public static final ManaCost WHITE = new ManaCost(MagicColor.WHITE);
|
|
||||||
public static final ManaCost BLUE = new ManaCost(MagicColor.BLUE);
|
|
||||||
public static final ManaCost BLACK = new ManaCost(MagicColor.BLACK);
|
|
||||||
public static final ManaCost RED = new ManaCost(MagicColor.RED);
|
|
||||||
public static final ManaCost GREEN = new ManaCost(MagicColor.GREEN);
|
|
||||||
public static final ManaCost COLORLESS = new ManaCost(MagicColor.COLORLESS);
|
|
||||||
|
|
||||||
public static ManaCost get(int cntColorless) {
|
public static ManaCost get(int cntColorless) {
|
||||||
switch (cntColorless) {
|
switch (cntColorless) {
|
||||||
case 0: { return ZERO; }
|
case 0: return ZERO;
|
||||||
case 1: { return ONE; }
|
case 1: return ONE;
|
||||||
case 2: { return TWO; }
|
case 2: return TWO;
|
||||||
case 3: { return THREE; }
|
case 3: return THREE;
|
||||||
case 4: { return FOUR; }
|
case 4: return FOUR;
|
||||||
}
|
}
|
||||||
return cntColorless > 0 ? new ManaCost(cntColorless) : NO_COST;
|
return cntColorless > 0 ? new ManaCost(cntColorless) : NO_COST;
|
||||||
}
|
}
|
||||||
@@ -95,47 +86,8 @@ public final class ManaCost implements Comparable<ManaCost>, Iterable<ManaCostSh
|
|||||||
shardsTemp.add(shard);
|
shardsTemp.add(shard);
|
||||||
} // null is OK - that was generic mana
|
} // null is OK - that was generic mana
|
||||||
}
|
}
|
||||||
this.genericCost = parser.getTotalColorlessCost();
|
this.genericCost = parser.getTotalColorlessCost(); // collect generic mana
|
||||||
sealClass(shardsTemp);
|
// here
|
||||||
}
|
|
||||||
|
|
||||||
//constructor for mana cost from color profile
|
|
||||||
public static ManaCost fromColorProfile(final byte colorProfile) {
|
|
||||||
switch (colorProfile) {
|
|
||||||
case MagicColor.WHITE: { return WHITE; }
|
|
||||||
case MagicColor.BLUE: { return BLUE; }
|
|
||||||
case MagicColor.BLACK: { return BLACK; }
|
|
||||||
case MagicColor.RED: { return RED; }
|
|
||||||
case MagicColor.GREEN: { return GREEN; }
|
|
||||||
case MagicColor.COLORLESS: { return COLORLESS; }
|
|
||||||
}
|
|
||||||
return new ManaCost(colorProfile);
|
|
||||||
}
|
|
||||||
private ManaCost(final byte colorProfile) {
|
|
||||||
final List<ManaCostShard> shardsTemp = new ArrayList<ManaCostShard>();
|
|
||||||
this.hasNoCost = false;
|
|
||||||
if (colorProfile == MagicColor.COLORLESS) {
|
|
||||||
shardsTemp.add(ManaCostShard.X);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ColorSet colorSet = ColorSet.fromMask(colorProfile);
|
|
||||||
if (colorSet.hasWhite()) {
|
|
||||||
shardsTemp.add(ManaCostShard.WHITE);
|
|
||||||
}
|
|
||||||
if (colorSet.hasBlue()) {
|
|
||||||
shardsTemp.add(ManaCostShard.BLUE);
|
|
||||||
}
|
|
||||||
if (colorSet.hasBlack()) {
|
|
||||||
shardsTemp.add(ManaCostShard.BLACK);
|
|
||||||
}
|
|
||||||
if (colorSet.hasRed()) {
|
|
||||||
shardsTemp.add(ManaCostShard.RED);
|
|
||||||
}
|
|
||||||
if (colorSet.hasGreen()) {
|
|
||||||
shardsTemp.add(ManaCostShard.GREEN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.genericCost = 0;
|
|
||||||
sealClass(shardsTemp);
|
sealClass(shardsTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,10 +245,6 @@ public final class ManaCost implements Comparable<ManaCost>, Iterable<ManaCostSh
|
|||||||
return iX;
|
return iX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasColor(byte colorCode) {
|
|
||||||
return (colorCode & getColorProfile()) == colorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can this mana cost be paid with unlimited mana of given color set.
|
* Can this mana cost be paid with unlimited mana of given color set.
|
||||||
* @param colorCode
|
* @param colorCode
|
||||||
|
|||||||
@@ -35,58 +35,23 @@ import forge.util.ItemPool;
|
|||||||
*/
|
*/
|
||||||
public class CardPool extends ItemPool<PaperCard> {
|
public class CardPool extends ItemPool<PaperCard> {
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new deck section.
|
|
||||||
*/
|
|
||||||
public CardPool() {
|
public CardPool() {
|
||||||
super(PaperCard.class);
|
super(PaperCard.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new deck section.
|
|
||||||
*
|
|
||||||
* @param cards the cards
|
|
||||||
*/
|
|
||||||
public CardPool(final Iterable<Entry<PaperCard, Integer>> cards) {
|
public CardPool(final Iterable<Entry<PaperCard, Integer>> cards) {
|
||||||
this();
|
this();
|
||||||
this.addAll(cards);
|
this.addAll(cards);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds the card.
|
|
||||||
*
|
|
||||||
* @param cardName
|
|
||||||
* the card name
|
|
||||||
* @param setCode
|
|
||||||
* the set code
|
|
||||||
*/
|
|
||||||
public void add(final String cardName, final String setCode) {
|
public void add(final String cardName, final String setCode) {
|
||||||
this.add(cardName, setCode, -1, 1);
|
this.add(cardName, setCode, -1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds the card.
|
|
||||||
*
|
|
||||||
* @param cardName
|
|
||||||
* the card name
|
|
||||||
* @param setCode
|
|
||||||
* the set code
|
|
||||||
* @param amount
|
|
||||||
* the amount of cards to add
|
|
||||||
*/
|
|
||||||
public void add(final String cardName, final String setCode, final int amount) {
|
public void add(final String cardName, final String setCode, final int amount) {
|
||||||
this.add(cardName, setCode, -1, amount);
|
this.add(cardName, setCode, -1, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds the card.
|
|
||||||
*
|
|
||||||
* @param cardName the card name
|
|
||||||
* @param setCode the set code
|
|
||||||
* @param artIndex the card art index, -1 for random
|
|
||||||
* @param amount the amount
|
|
||||||
*/
|
|
||||||
public void add(final String cardName, final String setCode, final int artIndex, final int amount) {
|
public void add(final String cardName, final String setCode, final int artIndex, final int amount) {
|
||||||
PaperCard cp = StaticData.instance().getCommonCards().tryGetCard(cardName, setCode, artIndex);
|
PaperCard cp = StaticData.instance().getCommonCards().tryGetCard(cardName, setCode, artIndex);
|
||||||
if ( cp == null )
|
if ( cp == null )
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ import com.google.common.base.Function;
|
|||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
|
import forge.card.ColorSet;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.card.mana.ManaCost;
|
|
||||||
import forge.deck.io.DeckFileHeader;
|
import forge.deck.io.DeckFileHeader;
|
||||||
import forge.deck.io.DeckSerializer;
|
import forge.deck.io.DeckSerializer;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
@@ -59,9 +59,6 @@ import forge.util.ItemPoolView;
|
|||||||
public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPool>> {
|
public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPool>> {
|
||||||
private final Map<DeckSection, CardPool> parts = new EnumMap<DeckSection, CardPool>(DeckSection.class);
|
private final Map<DeckSection, CardPool> parts = new EnumMap<DeckSection, CardPool>(DeckSection.class);
|
||||||
private final Set<String> tags = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
private final Set<String> tags = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||||
private ManaCost color;
|
|
||||||
private String format;
|
|
||||||
private int formatCompare;
|
|
||||||
|
|
||||||
// gameType is from Constant.GameType, like GameType.Regular
|
// gameType is from Constant.GameType, like GameType.Regular
|
||||||
/**
|
/**
|
||||||
@@ -244,9 +241,6 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
|||||||
* @return the list
|
* @return the list
|
||||||
*/
|
*/
|
||||||
public List<String> save() {
|
public List<String> save() {
|
||||||
this.color = null; //ensure color and format are recalculated
|
|
||||||
this.format = null;
|
|
||||||
|
|
||||||
final List<String> out = new ArrayList<String>();
|
final List<String> out = new ArrayList<String>();
|
||||||
out.add(String.format("[metadata]"));
|
out.add(String.format("[metadata]"));
|
||||||
|
|
||||||
@@ -289,8 +283,7 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
|||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManaCost getColor() {
|
public ColorSet getColor() {
|
||||||
if (color == null) {
|
|
||||||
byte colorProfile = MagicColor.COLORLESS;
|
byte colorProfile = MagicColor.COLORLESS;
|
||||||
|
|
||||||
for (Entry<DeckSection, CardPool> deckEntry : this) {
|
for (Entry<DeckSection, CardPool> deckEntry : this) {
|
||||||
@@ -306,58 +299,7 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
|||||||
break; //ignore other sections
|
break; //ignore other sections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
color = ManaCost.fromColorProfile(colorProfile);
|
return ColorSet.fromMask(colorProfile);
|
||||||
}
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFormat(Map<String, Predicate<PaperCard>> formatPredicates) {
|
|
||||||
if (format == null) {
|
|
||||||
formatCompare = 0; //build format compare value, with higher values for being valid in a more recent format
|
|
||||||
int value = (int)Math.pow(2, formatPredicates.size() - 1);
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
formatLoop:
|
|
||||||
for (Entry<String, Predicate<PaperCard>> format : formatPredicates.entrySet()) {
|
|
||||||
for (Entry<DeckSection, CardPool> deckEntry : this) {
|
|
||||||
switch (deckEntry.getKey()) {
|
|
||||||
case Main:
|
|
||||||
case Sideboard:
|
|
||||||
case Commander:
|
|
||||||
for (Entry<PaperCard, Integer> poolEntry : deckEntry.getValue()) {
|
|
||||||
if (!format.getValue().apply(poolEntry.getKey())) {
|
|
||||||
value /= 2;
|
|
||||||
continue formatLoop; //if found card that's not legal in this format, move to next format
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break; //ignore other sections
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//add format if reached this point
|
|
||||||
if (builder.length() > 0) {
|
|
||||||
builder.append(", ");
|
|
||||||
}
|
|
||||||
builder.append(format.getKey());
|
|
||||||
|
|
||||||
formatCompare += value; //increment format compare value
|
|
||||||
value /= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (builder.length() > 0) {
|
|
||||||
format = builder.toString();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
format = "(none)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFormatCompare(Map<String, Predicate<PaperCard>> formatPredicates) {
|
|
||||||
getFormat(formatPredicates); //ensure formatCompare defined
|
|
||||||
return formatCompare;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//create predicate that applys a card predicate to all cards in deck
|
//create predicate that applys a card predicate to all cards in deck
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.Collection;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
@@ -66,10 +65,6 @@ public class StorageBase<T> implements IStorage<T> {
|
|||||||
return new ArrayList<String>(this.map.keySet());
|
return new ArrayList<String>(this.map.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<Entry<String, T>> entrySet() {
|
|
||||||
return this.map.entrySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<T> iterator() {
|
public Iterator<T> iterator() {
|
||||||
return this.map.values().iterator();
|
return this.map.values().iterator();
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ import java.io.File;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
@@ -33,6 +30,7 @@ import com.google.common.collect.Lists;
|
|||||||
|
|
||||||
import forge.StaticData;
|
import forge.StaticData;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
|
import forge.deck.Deck;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.util.FileSection;
|
import forge.util.FileSection;
|
||||||
@@ -73,6 +71,8 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
this(fName, sets, bannedCards, 0);
|
this(fName, sets, bannedCards, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final GameFormat NoFormat = new GameFormat("(none)", null, null, Integer.MAX_VALUE);
|
||||||
|
|
||||||
public GameFormat(final String fName, final Iterable<String> sets, final List<String> bannedCards, int compareIdx) {
|
public GameFormat(final String fName, final Iterable<String> sets, final List<String> bannedCards, int compareIdx) {
|
||||||
this.index = compareIdx;
|
this.index = compareIdx;
|
||||||
this.name = fName;
|
this.name = fName;
|
||||||
@@ -219,15 +219,8 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Collection extends StorageBase<GameFormat> {
|
public static class Collection extends StorageBase<GameFormat> {
|
||||||
private final Map<String, Predicate<PaperCard>> formatPredicates;
|
|
||||||
|
|
||||||
public Collection(StorageReaderBase<GameFormat> reader) {
|
public Collection(StorageReaderBase<GameFormat> reader) {
|
||||||
super("Format collections", reader);
|
super("Format collections", reader);
|
||||||
|
|
||||||
formatPredicates = new HashMap<String, Predicate<PaperCard>>();
|
|
||||||
for (Entry<String, GameFormat> format : this.entrySet()) {
|
|
||||||
formatPredicates.put(format.getKey(), format.getValue().getFilterRules()); //allow reprints
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameFormat getStandard() {
|
public GameFormat getStandard() {
|
||||||
@@ -246,8 +239,13 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
return this.map.get(format);
|
return this.map.get(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Predicate<PaperCard>> getFormatPredicates() {
|
public GameFormat getFormatOfDeck(Deck deck) {
|
||||||
return this.formatPredicates;
|
for(GameFormat gf : this) {
|
||||||
|
if ( Deck.createPredicate(gf.getFilterRules()).apply(deck) )
|
||||||
|
return gf;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NoFormat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.Map.Entry;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.deck.CardPool;
|
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckGroup;
|
import forge.deck.DeckGroup;
|
||||||
import forge.deck.DeckSection;
|
import forge.deck.DeckSection;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class DeckColorFilter extends StatTypeFilter<Deck> {
|
|||||||
return new Predicate<Deck>() {
|
return new Predicate<Deck>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Deck input) {
|
public boolean apply(Deck input) {
|
||||||
byte colorProfile = input.getColor().getColorProfile();
|
byte colorProfile = input.getColor().getColor();
|
||||||
if (colorProfile == 0) {
|
if (colorProfile == 0) {
|
||||||
return buttonMap.get(StatTypes.DECK_COLORLESS).getSelected();
|
return buttonMap.get(StatTypes.DECK_COLORLESS).getSelected();
|
||||||
}
|
}
|
||||||
@@ -73,43 +73,43 @@ public class DeckColorFilter extends StatTypeFilter<Deck> {
|
|||||||
private static final Predicate<Deck> IS_WHITE = new Predicate<Deck>() {
|
private static final Predicate<Deck> IS_WHITE = new Predicate<Deck>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Deck deck) {
|
public boolean apply(final Deck deck) {
|
||||||
return deck.getColor().hasColor(MagicColor.WHITE);
|
return deck.getColor().hasAnyColor(MagicColor.WHITE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static final Predicate<Deck> IS_BLUE = new Predicate<Deck>() {
|
private static final Predicate<Deck> IS_BLUE = new Predicate<Deck>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Deck deck) {
|
public boolean apply(final Deck deck) {
|
||||||
return deck.getColor().hasColor(MagicColor.BLUE);
|
return deck.getColor().hasAnyColor(MagicColor.BLUE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static final Predicate<Deck> IS_BLACK = new Predicate<Deck>() {
|
public static final Predicate<Deck> IS_BLACK = new Predicate<Deck>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Deck deck) {
|
public boolean apply(final Deck deck) {
|
||||||
return deck.getColor().hasColor(MagicColor.BLACK);
|
return deck.getColor().hasAnyColor(MagicColor.BLACK);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static final Predicate<Deck> IS_RED = new Predicate<Deck>() {
|
public static final Predicate<Deck> IS_RED = new Predicate<Deck>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Deck deck) {
|
public boolean apply(final Deck deck) {
|
||||||
return deck.getColor().hasColor(MagicColor.RED);
|
return deck.getColor().hasAnyColor(MagicColor.RED);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static final Predicate<Deck> IS_GREEN = new Predicate<Deck>() {
|
public static final Predicate<Deck> IS_GREEN = new Predicate<Deck>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Deck deck) {
|
public boolean apply(final Deck deck) {
|
||||||
return deck.getColor().hasColor(MagicColor.GREEN);
|
return deck.getColor().hasAnyColor(MagicColor.GREEN);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static final Predicate<Deck> IS_COLORLESS = new Predicate<Deck>() {
|
private static final Predicate<Deck> IS_COLORLESS = new Predicate<Deck>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Deck deck) {
|
public boolean apply(final Deck deck) {
|
||||||
return deck.getColor().getColorProfile() == 0;
|
return deck.getColor().getColor() == 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static final Predicate<Deck> IS_MULTICOLOR = new Predicate<Deck>() {
|
private static final Predicate<Deck> IS_MULTICOLOR = new Predicate<Deck>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Deck deck) {
|
public boolean apply(final Deck deck) {
|
||||||
return BinaryUtil.bitCount(deck.getColor().getColorProfile()) > 1;
|
return BinaryUtil.bitCount(deck.getColor().getColor()) > 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import java.util.regex.Pattern;
|
|||||||
import javax.swing.table.TableColumn;
|
import javax.swing.table.TableColumn;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardAiHints;
|
import forge.card.CardAiHints;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
@@ -406,7 +405,8 @@ public class ItemColumn extends TableColumn {
|
|||||||
if (deck == null) {
|
if (deck == null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return deck.getFormatCompare(Singletons.getModel().getFormats().getFormatPredicates());
|
return Singletons.getModel().getFormats().getFormatOfDeck(deck).getIndex();
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Function<Entry<? extends InventoryItem, Integer>, Object>() {
|
new Function<Entry<? extends InventoryItem, Integer>, Object>() {
|
||||||
@@ -416,7 +416,7 @@ public class ItemColumn extends TableColumn {
|
|||||||
if (deck == null) {
|
if (deck == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return deck.getFormat(Singletons.getModel().getFormats().getFormatPredicates());
|
return Singletons.getModel().getFormats().getFormatOfDeck(deck);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
DECK_MAIN("Main", "Main Deck", 35, 35, 35, SortState.ASC, new IntegerRenderer(),
|
DECK_MAIN("Main", "Main Deck", 35, 35, 35, SortState.ASC, new IntegerRenderer(),
|
||||||
@@ -525,7 +525,7 @@ public class ItemColumn extends TableColumn {
|
|||||||
private static Deck toDeck(final InventoryItem i) {
|
private static Deck toDeck(final InventoryItem i) {
|
||||||
return i instanceof Deck ? ((Deck) i) : null;
|
return i instanceof Deck ? ((Deck) i) : null;
|
||||||
}
|
}
|
||||||
private static ManaCost toDeckColor(final InventoryItem i) {
|
private static ColorSet toDeckColor(final InventoryItem i) {
|
||||||
return i instanceof Deck ? ((Deck) i).getColor() : null;
|
return i instanceof Deck ? ((Deck) i).getColor() : null;
|
||||||
}
|
}
|
||||||
private static int toDeckCount(final InventoryItem i, DeckSection section) {
|
private static int toDeckCount(final InventoryItem i, DeckSection section) {
|
||||||
|
|||||||
Reference in New Issue
Block a user