- Added the options "no nonland duplicates" and "remove artifacts" to 3 color and 5 color decks.

This commit is contained in:
Sloth
2011-11-14 19:23:03 +00:00
parent 0c55fd7c2d
commit 060464b92e
2 changed files with 23 additions and 7 deletions

View File

@@ -13,6 +13,7 @@ import forge.CardListFilter;
import forge.Constant;
import forge.MyRandom;
import forge.PlayerType;
import forge.Singletons;
import forge.error.ErrorViewer;
import forge.properties.ForgeProps;
@@ -33,6 +34,7 @@ public class Generate3ColorDeck {
private ArrayList<String> notColors = null;
private ArrayList<String> dL = null;
private Map<String, Integer> cardCounts = null;
private int maxDuplicates = 4;
/**
* <p>
@@ -64,6 +66,10 @@ public class Generate3ColorDeck {
this.notColors.add("black");
this.notColors.add("red");
this.notColors.add("green");
if(Singletons.getModel().getPreferences().isDeckGenSingletons()) {
maxDuplicates = 1;
}
if (clr1.equals("AI")) {
// choose first color
@@ -134,7 +140,9 @@ public class Generate3ColorDeck {
// reduce to cards that match the colors
CardList cl1 = allCards.getColor(this.color1);
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
if(!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
cl1.addAll(allCards.getColor(Constant.Color.COLORLESS));
}
CardList cl2 = allCards.getColor(this.color2);
CardList cl3 = allCards.getColor(this.color3);
@@ -181,7 +189,7 @@ public class Generate3ColorDeck {
};
// select cards to build card pools using a mana curve
for (int i = 3; i > 0; i--) {
for (int i = 4; i > 0; i--) {
final CardList cr1CMC = cr1.filter(cmcF);
final CardList cr2CMC = cr2.filter(cmcF);
final CardList cr3CMC = cr3.filter(cmcF);
@@ -244,7 +252,7 @@ public class Generate3ColorDeck {
Card c = cr123.get(this.r.nextInt(cr123.size()));
lc = 0;
while ((this.cardCounts.get(c.getName()) > 3) || (lc > 100)) {
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
c = cr123.get(this.r.nextInt(cr123.size()));
lc++;
}
@@ -262,7 +270,7 @@ public class Generate3ColorDeck {
Card c = sp123.get(this.r.nextInt(sp123.size()));
lc = 0;
while ((this.cardCounts.get(c.getName()) > 3) || (lc > 100)) {
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
c = sp123.get(this.r.nextInt(sp123.size()));
lc++;
}

View File

@@ -13,6 +13,7 @@ import forge.CardListFilter;
import forge.Constant;
import forge.MyRandom;
import forge.PlayerType;
import forge.Singletons;
import forge.error.ErrorViewer;
import forge.properties.ForgeProps;
@@ -35,6 +36,7 @@ public class Generate5ColorDeck {
private ArrayList<String> notColors = null;
private ArrayList<String> dl = null;
private Map<String, Integer> cardCounts = null;
private int maxDuplicates = 4;
/**
* Instantiates a new generate5 color deck.
@@ -90,6 +92,10 @@ public class Generate5ColorDeck {
this.notColors.remove(this.color3);
this.notColors.remove(this.color4);
this.notColors.remove(this.color5);
if(Singletons.getModel().getPreferences().isDeckGenSingletons()) {
maxDuplicates = 1;
}
this.dl = GenerateDeckUtil.getDualLandList("WUBRG");
@@ -132,7 +138,9 @@ public class Generate5ColorDeck {
// reduce to cards that match the colors
CardList cL1 = allCards.getColor(this.color1);
cL1.addAll(allCards.getColor(Constant.Color.COLORLESS));
if(!Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()) {
cL1.addAll(allCards.getColor(Constant.Color.COLORLESS));
}
CardList cL2 = allCards.getColor(this.color2);
CardList cL3 = allCards.getColor(this.color3);
CardList cL4 = allCards.getColor(this.color4);
@@ -270,7 +278,7 @@ public class Generate5ColorDeck {
Card c = cr12345.get(this.r.nextInt(cr12345.size()));
lc = 0;
while ((this.cardCounts.get(c.getName()) > 3) || (lc > 100)) {
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
c = cr12345.get(this.r.nextInt(cr12345.size()));
lc++;
}
@@ -288,7 +296,7 @@ public class Generate5ColorDeck {
Card c = sp12345.get(this.r.nextInt(sp12345.size()));
lc = 0;
while ((this.cardCounts.get(c.getName()) > 3) || (lc > 100)) {
while ((this.cardCounts.get(c.getName()) > maxDuplicates - 1) || (lc > 100)) {
c = sp12345.get(this.r.nextInt(sp12345.size()));
lc++;
}