mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Added the options "no nonland duplicates" and "remove artifacts" to 3 color and 5 color decks.
This commit is contained in:
@@ -13,6 +13,7 @@ import forge.CardListFilter;
|
|||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.MyRandom;
|
import forge.MyRandom;
|
||||||
import forge.PlayerType;
|
import forge.PlayerType;
|
||||||
|
import forge.Singletons;
|
||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ public class Generate3ColorDeck {
|
|||||||
private ArrayList<String> notColors = null;
|
private ArrayList<String> notColors = null;
|
||||||
private ArrayList<String> dL = null;
|
private ArrayList<String> dL = null;
|
||||||
private Map<String, Integer> cardCounts = null;
|
private Map<String, Integer> cardCounts = null;
|
||||||
|
private int maxDuplicates = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -64,6 +66,10 @@ public class Generate3ColorDeck {
|
|||||||
this.notColors.add("black");
|
this.notColors.add("black");
|
||||||
this.notColors.add("red");
|
this.notColors.add("red");
|
||||||
this.notColors.add("green");
|
this.notColors.add("green");
|
||||||
|
|
||||||
|
if(Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
||||||
|
maxDuplicates = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (clr1.equals("AI")) {
|
if (clr1.equals("AI")) {
|
||||||
// choose first color
|
// choose first color
|
||||||
@@ -134,7 +140,9 @@ public class Generate3ColorDeck {
|
|||||||
|
|
||||||
// reduce to cards that match the colors
|
// reduce to cards that match the colors
|
||||||
CardList cl1 = allCards.getColor(this.color1);
|
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 cl2 = allCards.getColor(this.color2);
|
||||||
CardList cl3 = allCards.getColor(this.color3);
|
CardList cl3 = allCards.getColor(this.color3);
|
||||||
|
|
||||||
@@ -181,7 +189,7 @@ public class Generate3ColorDeck {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// select cards to build card pools using a mana curve
|
// 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 cr1CMC = cr1.filter(cmcF);
|
||||||
final CardList cr2CMC = cr2.filter(cmcF);
|
final CardList cr2CMC = cr2.filter(cmcF);
|
||||||
final CardList cr3CMC = cr3.filter(cmcF);
|
final CardList cr3CMC = cr3.filter(cmcF);
|
||||||
@@ -244,7 +252,7 @@ public class Generate3ColorDeck {
|
|||||||
Card c = cr123.get(this.r.nextInt(cr123.size()));
|
Card c = cr123.get(this.r.nextInt(cr123.size()));
|
||||||
|
|
||||||
lc = 0;
|
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()));
|
c = cr123.get(this.r.nextInt(cr123.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -262,7 +270,7 @@ public class Generate3ColorDeck {
|
|||||||
Card c = sp123.get(this.r.nextInt(sp123.size()));
|
Card c = sp123.get(this.r.nextInt(sp123.size()));
|
||||||
|
|
||||||
lc = 0;
|
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()));
|
c = sp123.get(this.r.nextInt(sp123.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import forge.CardListFilter;
|
|||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.MyRandom;
|
import forge.MyRandom;
|
||||||
import forge.PlayerType;
|
import forge.PlayerType;
|
||||||
|
import forge.Singletons;
|
||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ public class Generate5ColorDeck {
|
|||||||
private ArrayList<String> notColors = null;
|
private ArrayList<String> notColors = null;
|
||||||
private ArrayList<String> dl = null;
|
private ArrayList<String> dl = null;
|
||||||
private Map<String, Integer> cardCounts = null;
|
private Map<String, Integer> cardCounts = null;
|
||||||
|
private int maxDuplicates = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new generate5 color deck.
|
* Instantiates a new generate5 color deck.
|
||||||
@@ -90,6 +92,10 @@ public class Generate5ColorDeck {
|
|||||||
this.notColors.remove(this.color3);
|
this.notColors.remove(this.color3);
|
||||||
this.notColors.remove(this.color4);
|
this.notColors.remove(this.color4);
|
||||||
this.notColors.remove(this.color5);
|
this.notColors.remove(this.color5);
|
||||||
|
|
||||||
|
if(Singletons.getModel().getPreferences().isDeckGenSingletons()) {
|
||||||
|
maxDuplicates = 1;
|
||||||
|
}
|
||||||
|
|
||||||
this.dl = GenerateDeckUtil.getDualLandList("WUBRG");
|
this.dl = GenerateDeckUtil.getDualLandList("WUBRG");
|
||||||
|
|
||||||
@@ -132,7 +138,9 @@ public class Generate5ColorDeck {
|
|||||||
|
|
||||||
// reduce to cards that match the colors
|
// reduce to cards that match the colors
|
||||||
CardList cL1 = allCards.getColor(this.color1);
|
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 cL2 = allCards.getColor(this.color2);
|
||||||
CardList cL3 = allCards.getColor(this.color3);
|
CardList cL3 = allCards.getColor(this.color3);
|
||||||
CardList cL4 = allCards.getColor(this.color4);
|
CardList cL4 = allCards.getColor(this.color4);
|
||||||
@@ -270,7 +278,7 @@ public class Generate5ColorDeck {
|
|||||||
Card c = cr12345.get(this.r.nextInt(cr12345.size()));
|
Card c = cr12345.get(this.r.nextInt(cr12345.size()));
|
||||||
|
|
||||||
lc = 0;
|
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()));
|
c = cr12345.get(this.r.nextInt(cr12345.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -288,7 +296,7 @@ public class Generate5ColorDeck {
|
|||||||
Card c = sp12345.get(this.r.nextInt(sp12345.size()));
|
Card c = sp12345.get(this.r.nextInt(sp12345.size()));
|
||||||
|
|
||||||
lc = 0;
|
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()));
|
c = sp12345.get(this.r.nextInt(sp12345.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user