mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
Merge branch 'paco_adddeckaicolumn' into 'master'
Add AI column to deck editor See merge request core-developers/forge!6044
This commit is contained in:
@@ -42,6 +42,7 @@ public class DeckProxy implements InventoryItem {
|
|||||||
// cached values
|
// cached values
|
||||||
protected ColorSet color;
|
protected ColorSet color;
|
||||||
protected ColorSet colorIdentity;
|
protected ColorSet colorIdentity;
|
||||||
|
protected Boolean ai;
|
||||||
protected Set<GameFormat> formats;
|
protected Set<GameFormat> formats;
|
||||||
protected Set<GameFormat> exhaustiveFormats;
|
protected Set<GameFormat> exhaustiveFormats;
|
||||||
private Integer mainSize = null;
|
private Integer mainSize = null;
|
||||||
@@ -140,6 +141,7 @@ public class DeckProxy implements InventoryItem {
|
|||||||
edition = null;
|
edition = null;
|
||||||
mainSize = null;
|
mainSize = null;
|
||||||
sbSize = null;
|
sbSize = null;
|
||||||
|
ai = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColorSet getColor() {
|
public ColorSet getColor() {
|
||||||
@@ -211,6 +213,35 @@ public class DeckProxy implements InventoryItem {
|
|||||||
return colorIdentity;
|
return colorIdentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getAI() {
|
||||||
|
if (ai == null) {
|
||||||
|
boolean hasAi = true;
|
||||||
|
for (final Entry<DeckSection, CardPool> deckEntry : getDeck()) {
|
||||||
|
switch (deckEntry.getKey()) {
|
||||||
|
case Main:
|
||||||
|
case Commander:
|
||||||
|
for (final Entry<PaperCard, Integer> poolEntry : deckEntry.getValue()) {
|
||||||
|
CardAiHints ai = poolEntry.getKey().getRules().getAiHints();
|
||||||
|
if (ai.getRemAIDecks()) {
|
||||||
|
hasAi = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Sideboard: // Let's pretend the sideboard doesn't matter
|
||||||
|
default:
|
||||||
|
break; //ignore other sections
|
||||||
|
}
|
||||||
|
if (hasAi == false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ai = hasAi;
|
||||||
|
}
|
||||||
|
return ai;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public CardRarity getHighestRarity() {
|
public CardRarity getHighestRarity() {
|
||||||
if (highestRarity == null) {
|
if (highestRarity == null) {
|
||||||
highestRarity = CardRarity.Common;
|
highestRarity = CardRarity.Common;
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ public enum ColumnDef {
|
|||||||
IPaperCard cp = (IPaperCard) i;
|
IPaperCard cp = (IPaperCard) i;
|
||||||
CardAiHints ai = cp.getRules().getAiHints();
|
CardAiHints ai = cp.getRules().getAiHints();
|
||||||
|
|
||||||
return ai.getRemAIDecks() ? (ai.getRemRandomDecks() ? "AI ?" : "AI")
|
return ai.getRemAIDecks() ? (ai.getRemRandomDecks() ? "X?" : "X")
|
||||||
: (ai.getRemRandomDecks() ? "?" : "");
|
: (ai.getRemRandomDecks() ? "?" : "");
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -459,6 +459,19 @@ public enum ColumnDef {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
DECK_AI("lblAI", "lblAIStatus", 38, true, SortState.DESC,
|
||||||
|
new Function<Entry<InventoryItem, Integer>, Comparable<?>>() {
|
||||||
|
@Override
|
||||||
|
public Comparable<?> apply(final Entry<InventoryItem, Integer> from) {
|
||||||
|
return toDeck(from.getKey()).getAI() ? Integer.valueOf(1) : Integer.valueOf(-1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Function<Entry<? extends InventoryItem, Integer>, Object>() {
|
||||||
|
@Override
|
||||||
|
public Object apply(final Entry<? extends InventoryItem, Integer> from) {
|
||||||
|
return toDeck(from.getKey()).getAI()? "" : "X";
|
||||||
|
}
|
||||||
|
}),
|
||||||
/**
|
/**
|
||||||
* The main library size column.
|
* The main library size column.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ public final class SColumnUtil {
|
|||||||
colDefs.add(ColumnDef.DECK_EDITION);
|
colDefs.add(ColumnDef.DECK_EDITION);
|
||||||
colDefs.add(ColumnDef.DECK_MAIN);
|
colDefs.add(ColumnDef.DECK_MAIN);
|
||||||
colDefs.add(ColumnDef.DECK_SIDE);
|
colDefs.add(ColumnDef.DECK_SIDE);
|
||||||
|
colDefs.add(ColumnDef.DECK_AI);
|
||||||
|
|
||||||
Map<ColumnDef, ItemColumnConfig> columns = getColumns(colDefs);
|
Map<ColumnDef, ItemColumnConfig> columns = getColumns(colDefs);
|
||||||
columns.get(ColumnDef.DECK_FAVORITE).setSortPriority(1);
|
columns.get(ColumnDef.DECK_FAVORITE).setSortPriority(1);
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ public final class SItemManagerUtil {
|
|||||||
ColumnDef.SET, ColumnDef.COLLECTOR_ORDER};
|
ColumnDef.SET, ColumnDef.COLLECTOR_ORDER};
|
||||||
private static final ColumnDef[] DECK_PILEBY_OPTIONS = {ColumnDef.DECK_COLOR, ColumnDef.DECK_FOLDER,
|
private static final ColumnDef[] DECK_PILEBY_OPTIONS = {ColumnDef.DECK_COLOR, ColumnDef.DECK_FOLDER,
|
||||||
ColumnDef.NAME, ColumnDef.DECK_FORMAT,
|
ColumnDef.NAME, ColumnDef.DECK_FORMAT,
|
||||||
ColumnDef.DECK_EDITION};
|
ColumnDef.DECK_EDITION, ColumnDef.DECK_AI};
|
||||||
|
|
||||||
public static void populateImageViewOptions(final IItemManager<?> itemManager, final IComboBox<Object> cbGroupByOptions, final IComboBox<Object> cbPileByOptions) {
|
public static void populateImageViewOptions(final IItemManager<?> itemManager, final IComboBox<Object> cbGroupByOptions, final IComboBox<Object> cbPileByOptions) {
|
||||||
final boolean isDeckManager = itemManager.getGenericType().equals(DeckProxy.class);
|
final boolean isDeckManager = itemManager.getGenericType().equals(DeckProxy.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user