mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Prevent being able to add more cards to deck in quest deck editor than you own
Show inventory when in sideboard mode in quest deck editor
This commit is contained in:
@@ -213,8 +213,7 @@ public final class CEditorCommander extends ACEditorBase<PaperCard, Deck> {
|
||||
*/
|
||||
public void cycleEditorMode() {
|
||||
int curindex = allSections.indexOf(sectionMode);
|
||||
|
||||
curindex = curindex == (allSections.size()-1) ? 0 : curindex+1;
|
||||
curindex = (curindex + 1) % allSections.size();
|
||||
sectionMode = allSections.get(curindex);
|
||||
|
||||
final List<TableColumnInfo<InventoryItem>> lstCatalogCols = SColumnUtil.getCatalogDefaultColumns();
|
||||
|
||||
@@ -72,7 +72,6 @@ public final class CEditorConstructed extends ACEditorBase<PaperCard, Deck> {
|
||||
allSections.add(DeckSection.Avatar);
|
||||
allSections.add(DeckSection.Schemes);
|
||||
allSections.add(DeckSection.Planes);
|
||||
//allSections.add(DeckSection.Commander);
|
||||
|
||||
normalPool = ItemPool.createFrom(Singletons.getMagicDb().getCommonCards().getAllCards(), PaperCard.class);
|
||||
avatarPool = ItemPool.createFrom(Singletons.getMagicDb().getVariantCards().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_VANGUARD, PaperCard.FN_GET_RULES)),PaperCard.class);
|
||||
@@ -127,8 +126,14 @@ public final class CEditorConstructed extends ACEditorBase<PaperCard, Deck> {
|
||||
else {
|
||||
editor.getDeckManager().addItems(itemsToAdd);
|
||||
|
||||
//also select all added cards in Catalog
|
||||
editor.getCatalogManager().selectItemEntrys(itemsToAdd);
|
||||
if (editor.getCatalogManager().isInfinite()) {
|
||||
//select all added cards in Catalog if infinite
|
||||
editor.getCatalogManager().selectItemEntrys(itemsToAdd);
|
||||
}
|
||||
else {
|
||||
//remove all added cards from Catalog if not infinite
|
||||
editor.getCatalogManager().removeItems(items);
|
||||
}
|
||||
}
|
||||
|
||||
controller.notifyModelChanged();
|
||||
@@ -267,8 +272,7 @@ public final class CEditorConstructed extends ACEditorBase<PaperCard, Deck> {
|
||||
*/
|
||||
public void cycleEditorMode() {
|
||||
int curindex = allSections.indexOf(sectionMode);
|
||||
|
||||
curindex = curindex == (allSections.size()-1) ? 0 : curindex+1;
|
||||
curindex = (curindex + 1) % allSections.size();
|
||||
sectionMode = allSections.get(curindex);
|
||||
|
||||
final List<TableColumnInfo<InventoryItem>> lstCatalogCols = SColumnUtil.getCatalogDefaultColumns();
|
||||
|
||||
@@ -32,7 +32,6 @@ import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.gui.deckeditor.SEditorIO;
|
||||
import forge.gui.deckeditor.views.VAllDecks;
|
||||
import forge.gui.deckeditor.views.VCardCatalog;
|
||||
import forge.gui.deckeditor.views.VCurrentDeck;
|
||||
import forge.gui.deckeditor.views.VDeckgen;
|
||||
import forge.gui.framework.DragCell;
|
||||
@@ -69,7 +68,6 @@ public final class CEditorQuest extends ACEditorBase<PaperCard, Deck> {
|
||||
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
|
||||
private DragCell allDecksParent = null;
|
||||
private DragCell deckGenParent = null;
|
||||
private boolean sideboardMode = false;
|
||||
|
||||
private Map<PaperCard, Integer> decksUsingMyCards;
|
||||
|
||||
@@ -192,6 +190,8 @@ public final class CEditorQuest extends ACEditorBase<PaperCard, Deck> {
|
||||
*/
|
||||
@Override
|
||||
public void resetTables() {
|
||||
this.sectionMode = DeckSection.Main;
|
||||
|
||||
final Deck deck = this.controller.getModel();
|
||||
|
||||
final ItemPool<PaperCard> cardpool = new ItemPool<PaperCard>(PaperCard.class);
|
||||
@@ -220,27 +220,17 @@ public final class CEditorQuest extends ACEditorBase<PaperCard, Deck> {
|
||||
/**
|
||||
* Switch between the main deck and the sideboard editor.
|
||||
*/
|
||||
public void switchEditorMode(boolean isSideboarding) {
|
||||
public void cycleEditorMode() {
|
||||
int curindex = allSections.indexOf(sectionMode);
|
||||
|
||||
curindex = curindex == (allSections.size()-1) ? 0 : curindex+1;
|
||||
curindex = (curindex + 1) % allSections.size();
|
||||
sectionMode = allSections.get(curindex);
|
||||
|
||||
if (isSideboarding) {
|
||||
this.getCatalogManager().setPool(this.controller.getModel().getMain());
|
||||
if (sectionMode == DeckSection.Sideboard) {
|
||||
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Sideboard));
|
||||
} else {
|
||||
resetTables();
|
||||
}
|
||||
|
||||
VCardCatalog.SINGLETON_INSTANCE.getTabLabel().setText(isSideboarding ? "Main Deck" : "Card Catalog");
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnNew().setVisible(!isSideboarding);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnOpen().setVisible(!isSideboarding);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnSave().setVisible(!isSideboarding);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnSaveAs().setVisible(!isSideboarding);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnPrintProxies().setVisible(!isSideboarding);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().setVisible(!isSideboarding);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getLblTitle().setText(isSideboarding ? "Sideboard" : "Title:");
|
||||
else {
|
||||
this.getDeckManager().setPool(this.controller.getModel().getMain());
|
||||
}
|
||||
|
||||
this.controller.updateCaptions();
|
||||
}
|
||||
@@ -285,8 +275,7 @@ public final class CEditorQuest extends ACEditorBase<PaperCard, Deck> {
|
||||
this.getBtnCycleSection().setCommand(new Command() {
|
||||
@Override
|
||||
public void run() {
|
||||
sideboardMode = !sideboardMode;
|
||||
switchEditorMode(sideboardMode);
|
||||
cycleEditorMode();
|
||||
} });
|
||||
|
||||
deckGenParent = removeTab(VDeckgen.SINGLETON_INSTANCE);
|
||||
|
||||
@@ -972,6 +972,16 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
|
||||
this.table.setAllowMultipleSelections(allowMultipleSelections0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* isInfinite.
|
||||
*
|
||||
* @return whether item manager's pool of items is in infinite supply
|
||||
*/
|
||||
public boolean isInfinite() {
|
||||
return this.model.isInfinite();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* focus.
|
||||
|
||||
Reference in New Issue
Block a user