mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Updated deck generation to include Legacy and Vintage - fixed a few bugs that lead to incorrect land counts and random cards being added. Fixed Snow land issue so Skred red should be more playable.
This commit is contained in:
@@ -377,6 +377,16 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
updateMatrix(FModel.getFormats().getModern());
|
updateMatrix(FModel.getFormats().getModern());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case LEGACY_CARDGEN_DECK:
|
||||||
|
if(FModel.isdeckGenMatrixLoaded()) {
|
||||||
|
updateMatrix(FModel.getFormats().get("Legacy"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VINTAGE_CARDGEN_DECK:
|
||||||
|
if(FModel.isdeckGenMatrixLoaded()) {
|
||||||
|
updateMatrix(FModel.getFormats().get("Vintage"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
case RANDOM_COMMANDER_DECK:
|
case RANDOM_COMMANDER_DECK:
|
||||||
updateRandomCommander();
|
updateRandomCommander();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -250,6 +250,8 @@ public class VLobby implements ILobbyView {
|
|||||||
switch (selectedDeckType){
|
switch (selectedDeckType){
|
||||||
case STANDARD_CARDGEN_DECK:
|
case STANDARD_CARDGEN_DECK:
|
||||||
case MODERN_CARDGEN_DECK:
|
case MODERN_CARDGEN_DECK:
|
||||||
|
case LEGACY_CARDGEN_DECK:
|
||||||
|
case VINTAGE_CARDGEN_DECK:
|
||||||
case COLOR_DECK:
|
case COLOR_DECK:
|
||||||
case STANDARD_COLOR_DECK:
|
case STANDARD_COLOR_DECK:
|
||||||
case MODERN_COLOR_DECK:
|
case MODERN_COLOR_DECK:
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public enum CSubmenuGauntletQuick implements ICDoc {
|
|||||||
if (view.getBoxStandardColorDecks().isSelected()) { allowedDeckTypes.add(DeckType.STANDARD_COLOR_DECK); }
|
if (view.getBoxStandardColorDecks().isSelected()) { allowedDeckTypes.add(DeckType.STANDARD_COLOR_DECK); }
|
||||||
if (view.getBoxStandardGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.STANDARD_CARDGEN_DECK); }
|
if (view.getBoxStandardGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.STANDARD_CARDGEN_DECK); }
|
||||||
if (view.getBoxModernGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.MODERN_CARDGEN_DECK); }
|
if (view.getBoxModernGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.MODERN_CARDGEN_DECK); }
|
||||||
|
if (view.getBoxLegacyGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.LEGACY_CARDGEN_DECK); }
|
||||||
|
if (view.getBoxVintageGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.VINTAGE_CARDGEN_DECK); }
|
||||||
if (view.getBoxModernColorDecks().isSelected()) { allowedDeckTypes.add(DeckType.MODERN_COLOR_DECK); }
|
if (view.getBoxModernColorDecks().isSelected()) { allowedDeckTypes.add(DeckType.MODERN_COLOR_DECK); }
|
||||||
if (view.getBoxThemeDecks().isSelected()) { allowedDeckTypes.add(DeckType.THEME_DECK); }
|
if (view.getBoxThemeDecks().isSelected()) { allowedDeckTypes.add(DeckType.THEME_DECK); }
|
||||||
if (view.getBoxUserDecks().isSelected()) { allowedDeckTypes.add(DeckType.CUSTOM_DECK); }
|
if (view.getBoxUserDecks().isSelected()) { allowedDeckTypes.add(DeckType.CUSTOM_DECK); }
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
|||||||
private final JCheckBox boxStandardColorDecks = new FCheckBox(DeckType.STANDARD_COLOR_DECK.toString());
|
private final JCheckBox boxStandardColorDecks = new FCheckBox(DeckType.STANDARD_COLOR_DECK.toString());
|
||||||
private final JCheckBox boxStandardCardgenDecks = new FCheckBox(DeckType.STANDARD_CARDGEN_DECK.toString());
|
private final JCheckBox boxStandardCardgenDecks = new FCheckBox(DeckType.STANDARD_CARDGEN_DECK.toString());
|
||||||
private final JCheckBox boxModernCardgenDecks = new FCheckBox(DeckType.MODERN_CARDGEN_DECK.toString());
|
private final JCheckBox boxModernCardgenDecks = new FCheckBox(DeckType.MODERN_CARDGEN_DECK.toString());
|
||||||
|
private final JCheckBox boxLegacyCardgenDecks = new FCheckBox(DeckType.LEGACY_CARDGEN_DECK.toString());
|
||||||
|
private final JCheckBox boxVintageCardgenDecks = new FCheckBox(DeckType.VINTAGE_CARDGEN_DECK.toString());
|
||||||
private final JCheckBox boxModernColorDecks = new FCheckBox(DeckType.MODERN_COLOR_DECK.toString());
|
private final JCheckBox boxModernColorDecks = new FCheckBox(DeckType.MODERN_COLOR_DECK.toString());
|
||||||
private final JCheckBox boxThemeDecks = new FCheckBox(DeckType.THEME_DECK.toString());
|
private final JCheckBox boxThemeDecks = new FCheckBox(DeckType.THEME_DECK.toString());
|
||||||
|
|
||||||
@@ -214,6 +216,12 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
|||||||
public JCheckBox getBoxModernGenDecks() {
|
public JCheckBox getBoxModernGenDecks() {
|
||||||
return boxModernCardgenDecks;
|
return boxModernCardgenDecks;
|
||||||
}
|
}
|
||||||
|
public JCheckBox getBoxLegacyGenDecks() {
|
||||||
|
return boxLegacyCardgenDecks;
|
||||||
|
}
|
||||||
|
public JCheckBox getBoxVintageGenDecks() {
|
||||||
|
return boxVintageCardgenDecks;
|
||||||
|
}
|
||||||
|
|
||||||
/** @return {@link javax.swing.JCheckBox} */
|
/** @return {@link javax.swing.JCheckBox} */
|
||||||
public JCheckBox getBoxThemeDecks() {
|
public JCheckBox getBoxThemeDecks() {
|
||||||
|
|||||||
@@ -147,7 +147,8 @@ public class FDeckChooser extends FScreen {
|
|||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
if (selectedDeckType != DeckType.STANDARD_COLOR_DECK && selectedDeckType != DeckType.STANDARD_CARDGEN_DECK
|
if (selectedDeckType != DeckType.STANDARD_COLOR_DECK && selectedDeckType != DeckType.STANDARD_CARDGEN_DECK
|
||||||
&& selectedDeckType != DeckType.MODERN_CARDGEN_DECK && selectedDeckType != DeckType.MODERN_COLOR_DECK &&
|
&& selectedDeckType != DeckType.MODERN_CARDGEN_DECK && selectedDeckType != DeckType.LEGACY_CARDGEN_DECK
|
||||||
|
&& selectedDeckType != DeckType.VINTAGE_CARDGEN_DECK && selectedDeckType != DeckType.MODERN_COLOR_DECK &&
|
||||||
selectedDeckType != DeckType.COLOR_DECK && selectedDeckType != DeckType.THEME_DECK
|
selectedDeckType != DeckType.COLOR_DECK && selectedDeckType != DeckType.THEME_DECK
|
||||||
&& selectedDeckType != DeckType.RANDOM_COMMANDER_DECK && selectedDeckType != DeckType.RANDOM_CARDGEN_COMMANDER_DECK) {
|
&& selectedDeckType != DeckType.RANDOM_COMMANDER_DECK && selectedDeckType != DeckType.RANDOM_CARDGEN_COMMANDER_DECK) {
|
||||||
FDeckViewer.show(getDeck());
|
FDeckViewer.show(getDeck());
|
||||||
@@ -172,6 +173,12 @@ public class FDeckChooser extends FScreen {
|
|||||||
else if (selectedDeckType == DeckType.MODERN_CARDGEN_DECK){
|
else if (selectedDeckType == DeckType.MODERN_CARDGEN_DECK){
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
}
|
}
|
||||||
|
else if (selectedDeckType == DeckType.LEGACY_CARDGEN_DECK){
|
||||||
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
|
}
|
||||||
|
else if (selectedDeckType == DeckType.VINTAGE_CARDGEN_DECK){
|
||||||
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
}
|
}
|
||||||
@@ -280,6 +287,8 @@ public class FDeckChooser extends FScreen {
|
|||||||
case RANDOM_CARDGEN_COMMANDER_DECK:
|
case RANDOM_CARDGEN_COMMANDER_DECK:
|
||||||
case RANDOM_COMMANDER_DECK:
|
case RANDOM_COMMANDER_DECK:
|
||||||
case MODERN_CARDGEN_DECK:
|
case MODERN_CARDGEN_DECK:
|
||||||
|
case LEGACY_CARDGEN_DECK:
|
||||||
|
case VINTAGE_CARDGEN_DECK:
|
||||||
case MODERN_COLOR_DECK:
|
case MODERN_COLOR_DECK:
|
||||||
case THEME_DECK:
|
case THEME_DECK:
|
||||||
case RANDOM_DECK:
|
case RANDOM_DECK:
|
||||||
@@ -459,6 +468,8 @@ public class FDeckChooser extends FScreen {
|
|||||||
if(FModel.isdeckGenMatrixLoaded()) {
|
if(FModel.isdeckGenMatrixLoaded()) {
|
||||||
cmbDeckTypes.addItem(DeckType.STANDARD_CARDGEN_DECK);
|
cmbDeckTypes.addItem(DeckType.STANDARD_CARDGEN_DECK);
|
||||||
cmbDeckTypes.addItem(DeckType.MODERN_CARDGEN_DECK);
|
cmbDeckTypes.addItem(DeckType.MODERN_CARDGEN_DECK);
|
||||||
|
cmbDeckTypes.addItem(DeckType.LEGACY_CARDGEN_DECK);
|
||||||
|
cmbDeckTypes.addItem(DeckType.VINTAGE_CARDGEN_DECK);
|
||||||
}
|
}
|
||||||
cmbDeckTypes.addItem(DeckType.MODERN_COLOR_DECK);
|
cmbDeckTypes.addItem(DeckType.MODERN_COLOR_DECK);
|
||||||
cmbDeckTypes.addItem(DeckType.THEME_DECK);
|
cmbDeckTypes.addItem(DeckType.THEME_DECK);
|
||||||
@@ -666,6 +677,23 @@ public class FDeckChooser extends FScreen {
|
|||||||
}
|
}
|
||||||
config = ItemManagerConfig.STRING_ONLY;
|
config = ItemManagerConfig.STRING_ONLY;
|
||||||
break;
|
break;
|
||||||
|
case LEGACY_CARDGEN_DECK:
|
||||||
|
maxSelections = 1;
|
||||||
|
pool= new ArrayList<>();
|
||||||
|
if(FModel.isdeckGenMatrixLoaded()) {
|
||||||
|
pool = ArchetypeDeckGenerator.getMatrixDecks(FModel.getFormats().get("Legacy"), isAi);
|
||||||
|
}
|
||||||
|
config = ItemManagerConfig.STRING_ONLY;
|
||||||
|
break;
|
||||||
|
case VINTAGE_CARDGEN_DECK:
|
||||||
|
maxSelections = 1;
|
||||||
|
pool= new ArrayList<>();
|
||||||
|
if(FModel.isdeckGenMatrixLoaded()) {
|
||||||
|
pool = ArchetypeDeckGenerator.getMatrixDecks(FModel.getFormats().get("Vintage"), isAi);
|
||||||
|
}
|
||||||
|
config = ItemManagerConfig.STRING_ONLY;
|
||||||
|
break;
|
||||||
|
|
||||||
case MODERN_COLOR_DECK:
|
case MODERN_COLOR_DECK:
|
||||||
maxSelections = 3;
|
maxSelections = 3;
|
||||||
pool = ColorDeckGenerator.getColorDecks(lstDecks, FModel.getFormats().getModern().getFilterPrinted(), isAi);
|
pool = ColorDeckGenerator.getColorDecks(lstDecks, FModel.getFormats().getModern().getFilterPrinted(), isAi);
|
||||||
@@ -1013,12 +1041,16 @@ public class FDeckChooser extends FScreen {
|
|||||||
DeckType.STANDARD_CARDGEN_DECK,
|
DeckType.STANDARD_CARDGEN_DECK,
|
||||||
DeckType.MODERN_COLOR_DECK,
|
DeckType.MODERN_COLOR_DECK,
|
||||||
DeckType.MODERN_CARDGEN_DECK,
|
DeckType.MODERN_CARDGEN_DECK,
|
||||||
|
DeckType.LEGACY_CARDGEN_DECK,
|
||||||
|
DeckType.VINTAGE_CARDGEN_DECK,
|
||||||
DeckType.THEME_DECK,
|
DeckType.THEME_DECK,
|
||||||
DeckType.NET_DECK
|
DeckType.NET_DECK
|
||||||
);
|
);
|
||||||
if (!FModel.isdeckGenMatrixLoaded()) {
|
if (!FModel.isdeckGenMatrixLoaded()) {
|
||||||
deckTypes.remove(DeckType.STANDARD_CARDGEN_DECK);
|
deckTypes.remove(DeckType.STANDARD_CARDGEN_DECK);
|
||||||
deckTypes.remove(DeckType.MODERN_CARDGEN_DECK);
|
deckTypes.remove(DeckType.MODERN_CARDGEN_DECK);
|
||||||
|
deckTypes.remove(DeckType.LEGACY_CARDGEN_DECK);
|
||||||
|
deckTypes.remove(DeckType.VINTAGE_CARDGEN_DECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListChooser<DeckType> chooser = new ListChooser<DeckType>(
|
ListChooser<DeckType> chooser = new ListChooser<DeckType>(
|
||||||
|
|||||||
@@ -432,6 +432,8 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
|
|||||||
switch (selectedDeckType){
|
switch (selectedDeckType){
|
||||||
case STANDARD_CARDGEN_DECK:
|
case STANDARD_CARDGEN_DECK:
|
||||||
case MODERN_CARDGEN_DECK:
|
case MODERN_CARDGEN_DECK:
|
||||||
|
case LEGACY_CARDGEN_DECK:
|
||||||
|
case VINTAGE_CARDGEN_DECK:
|
||||||
case COLOR_DECK:
|
case COLOR_DECK:
|
||||||
case STANDARD_COLOR_DECK:
|
case STANDARD_COLOR_DECK:
|
||||||
case MODERN_COLOR_DECK:
|
case MODERN_COLOR_DECK:
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ public class NewGauntletScreen extends LaunchScreen {
|
|||||||
DeckType.STANDARD_CARDGEN_DECK,
|
DeckType.STANDARD_CARDGEN_DECK,
|
||||||
DeckType.MODERN_COLOR_DECK,
|
DeckType.MODERN_COLOR_DECK,
|
||||||
DeckType.MODERN_CARDGEN_DECK,
|
DeckType.MODERN_CARDGEN_DECK,
|
||||||
|
DeckType.LEGACY_CARDGEN_DECK,
|
||||||
|
DeckType.VINTAGE_CARDGEN_DECK,
|
||||||
DeckType.THEME_DECK
|
DeckType.THEME_DECK
|
||||||
}), null, new Callback<List<DeckType>>() {
|
}), null, new Callback<List<DeckType>>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ public final class CardArchetypeLDAGenerator {
|
|||||||
List<String> formatStrings = new ArrayList<>();
|
List<String> formatStrings = new ArrayList<>();
|
||||||
formatStrings.add(FModel.getFormats().getStandard().getName());
|
formatStrings.add(FModel.getFormats().getStandard().getName());
|
||||||
formatStrings.add(FModel.getFormats().getModern().getName());
|
formatStrings.add(FModel.getFormats().getModern().getName());
|
||||||
|
formatStrings.add("Legacy");
|
||||||
|
formatStrings.add("Vintage");
|
||||||
|
|
||||||
for (String formatString : formatStrings){
|
for (String formatString : formatStrings){
|
||||||
if(!initializeFormat(formatString)){
|
if(!initializeFormat(formatString)){
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public enum DeckType {
|
|||||||
COLOR_DECK ("Random Color Decks"),
|
COLOR_DECK ("Random Color Decks"),
|
||||||
STANDARD_CARDGEN_DECK ("Random Standard Archetype Decks"),
|
STANDARD_CARDGEN_DECK ("Random Standard Archetype Decks"),
|
||||||
MODERN_CARDGEN_DECK ("Random Modern Archetype Decks"),
|
MODERN_CARDGEN_DECK ("Random Modern Archetype Decks"),
|
||||||
|
LEGACY_CARDGEN_DECK ("Random Legacy Archetype Decks"),
|
||||||
|
VINTAGE_CARDGEN_DECK ("Random Vintage Archetype Decks"),
|
||||||
STANDARD_COLOR_DECK ("Random Standard Color Decks"),
|
STANDARD_COLOR_DECK ("Random Standard Color Decks"),
|
||||||
MODERN_COLOR_DECK ("Random Modern Color Decks"),
|
MODERN_COLOR_DECK ("Random Modern Color Decks"),
|
||||||
THEME_DECK ("Random Theme Decks"),
|
THEME_DECK ("Random Theme Decks"),
|
||||||
@@ -38,6 +40,8 @@ public enum DeckType {
|
|||||||
DeckType.COLOR_DECK,
|
DeckType.COLOR_DECK,
|
||||||
DeckType.STANDARD_CARDGEN_DECK,
|
DeckType.STANDARD_CARDGEN_DECK,
|
||||||
DeckType.MODERN_CARDGEN_DECK,
|
DeckType.MODERN_CARDGEN_DECK,
|
||||||
|
DeckType.LEGACY_CARDGEN_DECK,
|
||||||
|
DeckType.VINTAGE_CARDGEN_DECK,
|
||||||
DeckType.STANDARD_COLOR_DECK,
|
DeckType.STANDARD_COLOR_DECK,
|
||||||
DeckType.MODERN_COLOR_DECK,
|
DeckType.MODERN_COLOR_DECK,
|
||||||
DeckType.THEME_DECK,
|
DeckType.THEME_DECK,
|
||||||
|
|||||||
@@ -233,17 +233,22 @@ public class DeckgenUtil {
|
|||||||
PaperCard card = null;
|
PaperCard card = null;
|
||||||
for(Pair<String, Double> pair : preSelectedCardNames){
|
for(Pair<String, Double> pair : preSelectedCardNames){
|
||||||
card = StaticData.instance().getCommonCards().getUniqueByName(pair.getLeft());
|
card = StaticData.instance().getCommonCards().getUniqueByName(pair.getLeft());
|
||||||
if(!card.getRules().getType().isLand()){
|
if(card != null &&!card.getRules().getType().isLand()){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<PaperCard> selectedCards = new ArrayList<>();
|
List<PaperCard> selectedCards = new ArrayList<>();
|
||||||
|
int cardCount=0;
|
||||||
for(Pair<String, Double> pair:preSelectedCardNames){
|
for(Pair<String, Double> pair:preSelectedCardNames){
|
||||||
String name = pair.getLeft();
|
String name = pair.getLeft();
|
||||||
PaperCard cardToAdd = StaticData.instance().getCommonCards().getUniqueByName(name);
|
PaperCard cardToAdd = StaticData.instance().getCommonCards().getUniqueByName(name);
|
||||||
//for(int i=0; i<1;++i) {
|
//for(int i=0; i<1;++i) {
|
||||||
if(!cardToAdd.getName().equals(card.getName())) {
|
if(cardToAdd != null && !cardToAdd.getName().equals(card.getName())) {
|
||||||
selectedCards.add(cardToAdd);
|
selectedCards.add(cardToAdd);
|
||||||
|
cardCount++;
|
||||||
|
}
|
||||||
|
if(cardCount>120){// no need to have more than this
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
@@ -276,7 +281,13 @@ public class DeckgenUtil {
|
|||||||
for(int j=0;j<keyCardCount;++j) {
|
for(int j=0;j<keyCardCount;++j) {
|
||||||
playsetList.add(card);
|
playsetList.add(card);
|
||||||
}
|
}
|
||||||
|
List<String> restrictedCardsAdded = new ArrayList<>();
|
||||||
for (PaperCard c:selectedCards){
|
for (PaperCard c:selectedCards){
|
||||||
|
if (format.getRestrictedCards().contains(c.getName())&&!restrictedCardsAdded.contains(c)){
|
||||||
|
playsetList.add(c);
|
||||||
|
restrictedCardsAdded.add(c.getName());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for(int j=0;j<4;++j) {
|
for(int j=0;j<4;++j) {
|
||||||
if(MyRandom.getRandom().nextInt(100)<90) {
|
if(MyRandom.getRandom().nextInt(100)<90) {
|
||||||
playsetList.add(c);
|
playsetList.add(c);
|
||||||
|
|||||||
@@ -101,9 +101,13 @@ public class RandomDeckGenerator extends DeckProxy implements Comparable<RandomD
|
|||||||
}
|
}
|
||||||
return DeckgenUtil.buildColorDeck(colors, null, isAi);
|
return DeckgenUtil.buildColorDeck(colors, null, isAi);
|
||||||
case STANDARD_CARDGEN_DECK:
|
case STANDARD_CARDGEN_DECK:
|
||||||
return DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().getStandard(),isAi);
|
return DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().getStandard(),isAi);
|
||||||
case MODERN_CARDGEN_DECK:
|
case MODERN_CARDGEN_DECK:
|
||||||
return DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().getModern(),isAi);
|
return DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().getModern(),isAi);
|
||||||
|
case LEGACY_CARDGEN_DECK:
|
||||||
|
return DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().get("Legacy"),isAi);
|
||||||
|
case VINTAGE_CARDGEN_DECK:
|
||||||
|
return DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().get("Vintage"),isAi);
|
||||||
case STANDARD_COLOR_DECK:
|
case STANDARD_COLOR_DECK:
|
||||||
colors = new ArrayList<String>();
|
colors = new ArrayList<String>();
|
||||||
count = Aggregates.randomInt(1, 3);
|
count = Aggregates.randomInt(1, 3);
|
||||||
|
|||||||
@@ -34,11 +34,17 @@ public class GauntletUtil {
|
|||||||
deck = DeckgenUtil.getRandomColorDeck(FModel.getFormats().getStandard().getFilterPrinted(),true);
|
deck = DeckgenUtil.getRandomColorDeck(FModel.getFormats().getStandard().getFilterPrinted(),true);
|
||||||
break;
|
break;
|
||||||
case STANDARD_CARDGEN_DECK:
|
case STANDARD_CARDGEN_DECK:
|
||||||
deck = DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().getStandard(),true);
|
deck = DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().getStandard(),true);
|
||||||
break;
|
break;
|
||||||
case MODERN_CARDGEN_DECK:
|
case MODERN_CARDGEN_DECK:
|
||||||
deck = DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().getModern(),true);
|
deck = DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().getModern(),true);
|
||||||
break;
|
break;
|
||||||
|
case LEGACY_CARDGEN_DECK:
|
||||||
|
deck = DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().get("Legacy"),true);
|
||||||
|
break;
|
||||||
|
case VINTAGE_CARDGEN_DECK:
|
||||||
|
deck = DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().get("Vintage"),true);
|
||||||
|
break;
|
||||||
case MODERN_COLOR_DECK:
|
case MODERN_COLOR_DECK:
|
||||||
deck = DeckgenUtil.getRandomColorDeck(FModel.getFormats().getModern().getFilterPrinted(),true);
|
deck = DeckgenUtil.getRandomColorDeck(FModel.getFormats().getModern().getFilterPrinted(),true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -57,11 +57,11 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
|
|
||||||
// Views for aiPlayable
|
// Views for aiPlayable
|
||||||
protected Iterable<PaperCard> onColorCreaturesAndSpells;
|
protected Iterable<PaperCard> onColorCreaturesAndSpells;
|
||||||
protected Iterable<PaperCard> keyCards;
|
|
||||||
|
|
||||||
protected static final boolean logToConsole = false;
|
protected static final boolean logToConsole = false;
|
||||||
protected static final boolean logColorsToConsole = false;
|
protected static final boolean logColorsToConsole = false;
|
||||||
|
|
||||||
|
protected Iterable<PaperCard> keyCards;
|
||||||
protected Map<Integer,Integer> targetCMCs;
|
protected Map<Integer,Integer> targetCMCs;
|
||||||
|
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
// 3. Add creatures, trying to follow mana curve
|
// 3. Add creatures, trying to follow mana curve
|
||||||
|
|
||||||
numSpellsNeeded = numSpellsNeeded - deckList.size(); //subtract keycard count
|
numSpellsNeeded = numSpellsNeeded - deckList.size(); //subtract keycard count
|
||||||
addManaCurveCards(onColorCreaturesAndSpells, numSpellsNeeded , "Creatures and Spells");
|
addManaCurveCards(onColorCreaturesAndSpells, numSpellsNeeded, "Creatures and Spells");
|
||||||
if (logToConsole) {
|
if (logToConsole) {
|
||||||
System.out.println("Post Creatures and Spells : " + deckList.size());
|
System.out.println("Post Creatures and Spells : " + deckList.size());
|
||||||
}
|
}
|
||||||
@@ -205,20 +205,20 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
|
|
||||||
// 5. If there are still on-color cards, and the average cmc is low, add
|
// 5. If there are still on-color cards, and the average cmc is low, add
|
||||||
// extras.
|
// extras.
|
||||||
double avCMC=getAverageCMC(deckList);
|
double avCMC = getAverageCMC(deckList);
|
||||||
int maxCMC=getMaxCMC(deckList);
|
int maxCMC = getMaxCMC(deckList);
|
||||||
if (avCMC < 4) {
|
if (avCMC < 4) {
|
||||||
addLowCMCCard();
|
addLowCMCCard();
|
||||||
if(targetSize>60){
|
if (targetSize > 60) {
|
||||||
addLowCMCCard();
|
addLowCMCCard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (avCMC < 3 && maxCMC<6) {
|
if (avCMC < 3 && maxCMC < 6) {
|
||||||
addLowCMCCard();
|
addLowCMCCard();
|
||||||
}
|
}
|
||||||
if (avCMC < 2.5 && maxCMC<5) {
|
if (avCMC < 2.5 && maxCMC < 5) {
|
||||||
addLowCMCCard();
|
addLowCMCCard();
|
||||||
if(targetSize>60){
|
if (targetSize > 60) {
|
||||||
addLowCMCCard();
|
addLowCMCCard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,8 +237,15 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
// 7. If there are still less than 22 non-land cards add off-color
|
// 7. If there are still less than 22 non-land cards add off-color
|
||||||
// cards. This should be avoided.
|
// cards. This should be avoided.
|
||||||
int stillNeeds = numSpellsNeeded - deckList.size();
|
int stillNeeds = numSpellsNeeded - deckList.size();
|
||||||
if(stillNeeds>0)
|
if (stillNeeds > 0)
|
||||||
|
addCards(onColorCreaturesAndSpells, stillNeeds);
|
||||||
|
stillNeeds = numSpellsNeeded - deckList.size();
|
||||||
|
if (stillNeeds > 0)
|
||||||
|
extendPlaysets(stillNeeds);
|
||||||
|
stillNeeds = numSpellsNeeded - deckList.size();
|
||||||
|
if (stillNeeds > 0)
|
||||||
addRandomCards(stillNeeds);
|
addRandomCards(stillNeeds);
|
||||||
|
|
||||||
if (logToConsole) {
|
if (logToConsole) {
|
||||||
System.out.println("Post Randoms : " + deckList.size());
|
System.out.println("Post Randoms : " + deckList.size());
|
||||||
}
|
}
|
||||||
@@ -307,6 +314,31 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void extendPlaysets(int numSpellsNeeded){
|
||||||
|
Map<PaperCard,Integer> currentCounts = new HashMap<>();
|
||||||
|
List<PaperCard> cardsToAdd = new ArrayList<>();
|
||||||
|
int i=0;
|
||||||
|
for(PaperCard card: deckList){
|
||||||
|
if(currentCounts.containsKey(card)){
|
||||||
|
currentCounts.put(card, currentCounts.get(card) + 1);
|
||||||
|
}else{
|
||||||
|
currentCounts.put(card, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(PaperCard card: currentCounts.keySet()){
|
||||||
|
if(currentCounts.get(card)==2 || currentCounts.get(card)==3){
|
||||||
|
cardsToAdd.add(card);
|
||||||
|
++i;
|
||||||
|
if(i >= numSpellsNeeded ){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deckList.addAll(cardsToAdd);
|
||||||
|
aiPlayables.removeAll(cardsToAdd);
|
||||||
|
rankedColorList.removeAll(cardsToAdd);
|
||||||
|
}
|
||||||
|
|
||||||
protected void generateTargetCMCs(){
|
protected void generateTargetCMCs(){
|
||||||
targetCMCs = new HashMap<>();
|
targetCMCs = new HashMap<>();
|
||||||
targetCMCs.put(1,Math.round((MyRandom.getRandom().nextInt(12)+4)*targetSize/60));//10
|
targetCMCs.put(1,Math.round((MyRandom.getRandom().nextInt(12)+4)*targetSize/60));//10
|
||||||
@@ -543,6 +575,16 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int stillNeeds = targetSize - deckList.size();
|
||||||
|
if (stillNeeds > 0)
|
||||||
|
addCards(onColorCreaturesAndSpells, stillNeeds);
|
||||||
|
stillNeeds = targetSize - deckList.size();
|
||||||
|
if (stillNeeds > 0)
|
||||||
|
extendPlaysets(stillNeeds);
|
||||||
|
stillNeeds = targetSize - deckList.size();
|
||||||
|
if (stillNeeds == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
Predicate<PaperCard> possibleFromFullPool = new Predicate<PaperCard>() {
|
Predicate<PaperCard> possibleFromFullPool = new Predicate<PaperCard>() {
|
||||||
final Set<String> deckListNames = getDeckListNames();
|
final Set<String> deckListNames = getDeckListNames();
|
||||||
@Override
|
@Override
|
||||||
@@ -603,7 +645,6 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
private void addLands(final int[] clrCnts) {
|
private void addLands(final int[] clrCnts) {
|
||||||
// basic lands that are available in the deck
|
// basic lands that are available in the deck
|
||||||
final Iterable<PaperCard> basicLands = Iterables.filter(aiPlayables, Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, PaperCard.FN_GET_RULES));
|
final Iterable<PaperCard> basicLands = Iterables.filter(aiPlayables, Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, PaperCard.FN_GET_RULES));
|
||||||
final Set<PaperCard> snowLands = new HashSet<PaperCard>();
|
|
||||||
|
|
||||||
// total of all ClrCnts
|
// total of all ClrCnts
|
||||||
int totalColor = 0;
|
int totalColor = 0;
|
||||||
@@ -617,8 +658,12 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
// add one of each land required first so that any rounding errors do not remove the only land of a colour
|
// add one of each land required first so that any rounding errors do not remove the only land of a colour
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
if (clrCnts[i] > 0) {
|
if (clrCnts[i] > 0) {
|
||||||
deckList.add(getBasicLand(i));
|
float p = (float) clrCnts[i] / (float) totalColor;
|
||||||
landsNeeded--;
|
int nLand = Math.round(landsNeeded * p); // desired truncation to int
|
||||||
|
if(nLand >0) {
|
||||||
|
deckList.add(getBasicLand(i));
|
||||||
|
landsNeeded--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -634,16 +679,21 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
System.out.printf("Basics[%s]: %d/%d = %f%% = %d cards%n", MagicColor.Constant.BASIC_LANDS.get(i), clrCnts[i], totalColor, 100*p, nLand);
|
System.out.printf("Basics[%s]: %d/%d = %f%% = %d cards%n", MagicColor.Constant.BASIC_LANDS.get(i), clrCnts[i], totalColor, 100*p, nLand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PaperCard snowLand = null;
|
||||||
// if appropriate snow-covered lands are available, add them
|
// if appropriate snow-covered lands are available, add them
|
||||||
for (final PaperCard cp : basicLands) {
|
for (final PaperCard cp : basicLands) {
|
||||||
if (cp.getName().equals(MagicColor.Constant.SNOW_LANDS.get(i))) {
|
if (cp.getName().equals(MagicColor.Constant.SNOW_LANDS.get(i))) {
|
||||||
snowLands.add(cp);
|
snowLand = cp;
|
||||||
nLand--;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < nLand; j++) {
|
for (int j = 0; j < nLand; j++) {
|
||||||
deckList.add(getBasicLand(i));
|
if(snowLand!=null){
|
||||||
|
deckList.add(snowLand);
|
||||||
|
}else {
|
||||||
|
deckList.add(getBasicLand(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -656,9 +706,6 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
deckList.remove(deckList.size() - 1);
|
deckList.remove(deckList.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
deckList.addAll(snowLands);
|
|
||||||
aiPlayables.removeAll(snowLands);
|
|
||||||
rankedColorList.removeAll(snowLands);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -849,7 +896,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
if(card.getRules().getMainPart().getType().isLand()){
|
if(card.getRules().getMainPart().getType().isLand()){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (num +1 > 0) {
|
if (num > 0) {
|
||||||
cardsToAdd.add(card);
|
cardsToAdd.add(card);
|
||||||
if (logToConsole) {
|
if (logToConsole) {
|
||||||
System.out.println("Extra needed[" + num + "]:" + card.getName() + " (" + card.getRules().getManaCost() + ")");
|
System.out.println("Extra needed[" + num + "]:" + card.getName() + " (" + card.getRules().getManaCost() + ")");
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ public class TournamentUtil {
|
|||||||
case MODERN_CARDGEN_DECK:
|
case MODERN_CARDGEN_DECK:
|
||||||
deck = DeckgenUtil.buildCardGenDeck(FModel.getFormats().getModern(),true);
|
deck = DeckgenUtil.buildCardGenDeck(FModel.getFormats().getModern(),true);
|
||||||
break;
|
break;
|
||||||
|
case LEGACY_CARDGEN_DECK:
|
||||||
|
deck = DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().get("Legacy"),true);
|
||||||
|
break;
|
||||||
|
case VINTAGE_CARDGEN_DECK:
|
||||||
|
deck = DeckgenUtil.buildLDACArchetypeDeck(FModel.getFormats().get("Vintage"),true);
|
||||||
|
break;
|
||||||
case MODERN_COLOR_DECK:
|
case MODERN_COLOR_DECK:
|
||||||
deck = DeckgenUtil.getRandomColorDeck(FModel.getFormats().getModern().getFilterPrinted(),true);
|
deck = DeckgenUtil.getRandomColorDeck(FModel.getFormats().getModern().getFilterPrinted(),true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user