mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
- Unifying the list for card exceptions in DeckFormat, as suggested and coded by Austinio.
This commit is contained in:
@@ -123,6 +123,13 @@ public enum DeckFormat {
|
|||||||
private final static String ADVPROCLAMATION = "Advantageous Proclamation";
|
private final static String ADVPROCLAMATION = "Advantageous Proclamation";
|
||||||
private final static String SOVREALM = "Sovereign's Realm";
|
private final static String SOVREALM = "Sovereign's Realm";
|
||||||
|
|
||||||
|
private static final List<String> limitExceptions = Arrays.asList(
|
||||||
|
new String[]{"Relentless Rats", "Shadowborn Apostle", "Rat Colony"});
|
||||||
|
|
||||||
|
public static List<String> getLimitExceptions(){
|
||||||
|
return limitExceptions;
|
||||||
|
}
|
||||||
|
|
||||||
private DeckFormat(Range<Integer> mainRange0, Range<Integer> sideRange0, int maxCardCopies0, Predicate<CardRules> cardPoolFilter0, Predicate<PaperCard> paperCardPoolFilter0) {
|
private DeckFormat(Range<Integer> mainRange0, Range<Integer> sideRange0, int maxCardCopies0, Predicate<CardRules> cardPoolFilter0, Predicate<PaperCard> paperCardPoolFilter0) {
|
||||||
mainRange = mainRange0;
|
mainRange = mainRange0;
|
||||||
sideRange = sideRange0;
|
sideRange = sideRange0;
|
||||||
|
|||||||
@@ -178,9 +178,6 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final List<String> limitExceptions = Arrays.asList(
|
|
||||||
new String[]{"Relentless Rats", "Shadowborn Apostle", "Rat Colony"});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return pool of additions allowed to deck
|
* @return pool of additions allowed to deck
|
||||||
*/
|
*/
|
||||||
@@ -212,7 +209,7 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
|
|||||||
|
|
||||||
int max;
|
int max;
|
||||||
if (deck == null || card == null || card.getRules().getType().isBasic() ||
|
if (deck == null || card == null || card.getRules().getType().isBasic() ||
|
||||||
limit == CardLimit.None || limitExceptions.contains(card.getName())) {
|
limit == CardLimit.None || DeckFormat.getLimitExceptions().contains(card.getName())) {
|
||||||
max = Integer.MAX_VALUE;
|
max = Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -718,9 +718,6 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
|||||||
protected abstract void onCardActivated(PaperCard card);
|
protected abstract void onCardActivated(PaperCard card);
|
||||||
protected abstract void buildMenu(final FDropDownMenu menu, final PaperCard card);
|
protected abstract void buildMenu(final FDropDownMenu menu, final PaperCard card);
|
||||||
|
|
||||||
private static final List<String> limitExceptions = Arrays.asList(
|
|
||||||
new String[]{"Relentless Rats", "Shadowborn Apostle", "Rat Colony"});
|
|
||||||
|
|
||||||
private ItemPool<PaperCard> getAllowedAdditions(Iterable<Entry<PaperCard, Integer>> itemsToAdd, boolean isAddSource) {
|
private ItemPool<PaperCard> getAllowedAdditions(Iterable<Entry<PaperCard, Integer>> itemsToAdd, boolean isAddSource) {
|
||||||
ItemPool<PaperCard> additions = new ItemPool<PaperCard>(cardManager.getGenericType());
|
ItemPool<PaperCard> additions = new ItemPool<PaperCard>(cardManager.getGenericType());
|
||||||
CardLimit limit = parentScreen.getCardLimit();
|
CardLimit limit = parentScreen.getCardLimit();
|
||||||
@@ -733,7 +730,7 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
|||||||
if (deck == null || card == null) {
|
if (deck == null || card == null) {
|
||||||
max = Integer.MAX_VALUE;
|
max = Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
else if (limit == CardLimit.None || card.getRules().getType().isBasic() || limitExceptions.contains(card.getName())) {
|
else if (limit == CardLimit.None || card.getRules().getType().isBasic() || DeckFormat.getLimitExceptions().contains(card.getName())) {
|
||||||
max = Integer.MAX_VALUE;
|
max = Integer.MAX_VALUE;
|
||||||
if (parentScreen.isLimitedEditor() && !isAddSource) {
|
if (parentScreen.isLimitedEditor() && !isAddSource) {
|
||||||
//prevent adding more than is in other pool when editing limited decks
|
//prevent adding more than is in other pool when editing limited decks
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.google.common.base.Function;
|
|||||||
import forge.GuiBase;
|
import forge.GuiBase;
|
||||||
import forge.deck.CardPool;
|
import forge.deck.CardPool;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
|
import forge.deck.DeckFormat;
|
||||||
import forge.deck.DeckSection;
|
import forge.deck.DeckSection;
|
||||||
import forge.item.*;
|
import forge.item.*;
|
||||||
import forge.itemmanager.IItemManager;
|
import forge.itemmanager.IItemManager;
|
||||||
@@ -345,8 +346,7 @@ public class QuestSpellShop {
|
|||||||
PaperCard card = (PaperCard)item.getKey();
|
PaperCard card = (PaperCard)item.getKey();
|
||||||
int numToKeep = card.getRules().getType().isBasic() ?
|
int numToKeep = card.getRules().getType().isBasic() ?
|
||||||
FModel.getQuestPreferences().getPrefInt(QPref.PLAYSET_BASIC_LAND_SIZE) : FModel.getQuestPreferences().getPrefInt(QPref.PLAYSET_SIZE);
|
FModel.getQuestPreferences().getPrefInt(QPref.PLAYSET_BASIC_LAND_SIZE) : FModel.getQuestPreferences().getPrefInt(QPref.PLAYSET_SIZE);
|
||||||
if (card.getName().equals("Relentless Rats") || card.getName().equals("Shadowborn Apostle")
|
if (DeckFormat.getLimitExceptions().contains(card.getName())) {
|
||||||
|| card.getName().equals("Rat Colony")) {
|
|
||||||
numToKeep = FModel.getQuestPreferences().getPrefInt(QPref.PLAYSET_ANY_NUMBER_SIZE);
|
numToKeep = FModel.getQuestPreferences().getPrefInt(QPref.PLAYSET_ANY_NUMBER_SIZE);
|
||||||
}
|
}
|
||||||
if (numToKeep < item.getValue()) {
|
if (numToKeep < item.getValue()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user