mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
added snow to manashards
allCards returns an Iterable (a silly protection against external modification) When player chooses t2 or modern he won't get cards valid for the format but belonging to older sets.
This commit is contained in:
@@ -394,8 +394,8 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
ListChooser<GameFormat> ch = new ListChooser<GameFormat>("Choose prize booster format", 1, SetUtils.getFormats());
|
||||
ch.show();
|
||||
GameFormat selected = ch.getSelectedValue();
|
||||
|
||||
ArrayList<CardPrinted> cardsWon = model.quest.getCards().addCards(selected.getFilter());
|
||||
|
||||
ArrayList<CardPrinted> cardsWon = model.quest.getCards().addCards(selected.getFilterPrinted());
|
||||
ImageIcon icon = getIcon("BookIcon.png");
|
||||
CardListViewer c = new CardListViewer("Booster", "You have won the following new cards", cardsWon, icon);
|
||||
c.show();
|
||||
@@ -443,7 +443,7 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
if (wonMatch && model.qa != null) {
|
||||
model.quest.addQuestsPlayed();
|
||||
|
||||
ArrayList<CardPrinted> questRewardCards = model.qa.getCardRewardList();
|
||||
List<CardPrinted> questRewardCards = model.qa.getCardRewardList();
|
||||
long questRewardCredits = model.qa.getCreditsReward();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -157,6 +157,6 @@ public final class CardDb {
|
||||
return uniqueCards.values();
|
||||
}
|
||||
|
||||
public List<CardPrinted> getAllCards() { return allCardsFlat; }
|
||||
public Iterable<CardPrinted> getAllCards() { return allCardsFlat; }
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ public class CardManaCostShard {
|
||||
public final float cmpc;
|
||||
private final String stringValue;
|
||||
public final String imageKey;
|
||||
|
||||
|
||||
protected CardManaCostShard(final int value, final String sValue) {
|
||||
this(value, sValue, sValue);
|
||||
}
|
||||
@@ -20,17 +20,19 @@ public class CardManaCostShard {
|
||||
imageKey = imgKey;
|
||||
}
|
||||
|
||||
public interface Atom {
|
||||
/** A bitmask to represent any mana symbol as an integer. */
|
||||
public abstract static class Atom {
|
||||
//int COLORLESS = 1 << 0;
|
||||
int WHITE = 1 << 1;
|
||||
int BLUE = 1 << 2;
|
||||
int BLACK = 1 << 3;
|
||||
int RED = 1 << 4;
|
||||
int GREEN = 1 << 5;
|
||||
public final static int WHITE = 1 << 1;
|
||||
public final static int BLUE = 1 << 2;
|
||||
public final static int BLACK = 1 << 3;
|
||||
public final static int RED = 1 << 4;
|
||||
public final static int GREEN = 1 << 5;
|
||||
|
||||
int IS_X = 1 << 8;
|
||||
int OR_2_COLORLESS = 1 << 9;
|
||||
int OR_2_LIFE = 1 << 10;
|
||||
public final static int IS_X = 1 << 8;
|
||||
public final static int OR_2_COLORLESS = 1 << 9;
|
||||
public final static int OR_2_LIFE = 1 << 10;
|
||||
public final static int IS_SNOW = 1 << 11;
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +46,7 @@ public class CardManaCostShard {
|
||||
* while unboxed values will lay on stack, which is faster
|
||||
*/
|
||||
public static final CardManaCostShard X = new CardManaCostShard(Atom.IS_X, "X");
|
||||
public static final CardManaCostShard S = new CardManaCostShard(Atom.IS_SNOW, "S");
|
||||
|
||||
public static final CardManaCostShard WHITE = new CardManaCostShard(Atom.WHITE, "W");
|
||||
public static final CardManaCostShard BLUE = new CardManaCostShard(Atom.BLUE, "U");
|
||||
|
||||
@@ -19,7 +19,8 @@ public final class GameFormat {
|
||||
private final List<String> allowedSetCodes;
|
||||
private final List<String> bannedCardNames;
|
||||
|
||||
private final Predicate<CardPrinted> filter;
|
||||
private final Predicate<CardPrinted> filterRules;
|
||||
private final Predicate<CardPrinted> filterPrinted;
|
||||
|
||||
|
||||
public GameFormat(final String fName, final List<String> sets, final List<String> bannedCards)
|
||||
@@ -27,11 +28,21 @@ public final class GameFormat {
|
||||
name = fName;
|
||||
allowedSetCodes = Collections.unmodifiableList(sets);
|
||||
bannedCardNames = Collections.unmodifiableList(bannedCards);
|
||||
filter = buildFilter();
|
||||
filterRules = buildFilterRules();
|
||||
filterPrinted = buildFilterPritned();
|
||||
}
|
||||
|
||||
|
||||
private Predicate<CardPrinted> buildFilter() {
|
||||
private Predicate<CardPrinted> buildFilterPritned() {
|
||||
Predicate<CardPrinted> banNames = CardPrinted.Predicates.namesExcept(bannedCardNames);
|
||||
Predicate<CardPrinted> allowSets = allowedSetCodes == null || allowedSetCodes.isEmpty()
|
||||
? CardPrinted.Predicates.Presets.isTrue
|
||||
: CardPrinted.Predicates.printedInSets(allowedSetCodes, true);
|
||||
return Predicate.and(banNames, allowSets);
|
||||
}
|
||||
|
||||
|
||||
private Predicate<CardPrinted> buildFilterRules() {
|
||||
Predicate<CardPrinted> banNames = CardPrinted.Predicates.namesExcept(bannedCardNames);
|
||||
Predicate<CardPrinted> allowSets = allowedSetCodes == null || allowedSetCodes.isEmpty()
|
||||
? CardPrinted.Predicates.Presets.isTrue
|
||||
@@ -40,7 +51,8 @@ public final class GameFormat {
|
||||
}
|
||||
|
||||
public String getName() { return name; }
|
||||
public Predicate<CardPrinted> getFilter() { return filter; }
|
||||
public Predicate<CardPrinted> getFilterRules() { return filterRules; }
|
||||
public Predicate<CardPrinted> getFilterPrinted() { return filterPrinted; }
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
|
||||
@@ -98,7 +98,7 @@ public class FilterNameTypeSetPanel extends JComponent{
|
||||
if (selected instanceof CardSet) {
|
||||
rules.add(CardPrinted.Predicates.printedInSets(((CardSet) selected).getCode()));
|
||||
} else if (selected instanceof GameFormat) {
|
||||
rules.add(((GameFormat) selected).getFilter());
|
||||
rules.add(((GameFormat) selected).getFilterRules());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public final class QuestData {
|
||||
public void newGame(final int diff, final String m0de, final boolean standardStart) {
|
||||
setDifficulty(diff);
|
||||
|
||||
Predicate<CardPrinted> filter = standardStart ? SetUtils.getStandard().getFilter() : CardPrinted.Predicates.Presets.isTrue;
|
||||
Predicate<CardPrinted> filter = standardStart ? SetUtils.getStandard().getFilterPrinted() : CardPrinted.Predicates.Presets.isTrue;
|
||||
|
||||
myCards.setupNewGameCardPool(filter, diff);
|
||||
credits = QuestPreferences.getStartingCredits();
|
||||
|
||||
Reference in New Issue
Block a user