mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Checkstyle madness.
This commit is contained in:
@@ -19,10 +19,10 @@ public class Generate2ColorDeck {
|
|||||||
private String color1 = "";
|
private String color1 = "";
|
||||||
private String color2 = "";
|
private String color2 = "";
|
||||||
private Random r = null;
|
private Random r = null;
|
||||||
private Map<String, String> ClrMap = null;
|
private Map<String, String> clrMap = null;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Constructor for Generate2ColorDeck.</p>
|
* <p>Constructor for Generate2ColorDeck.</p>
|
||||||
@@ -33,14 +33,14 @@ public class Generate2ColorDeck {
|
|||||||
public Generate2ColorDeck(String Clr1, String Clr2) {
|
public Generate2ColorDeck(String Clr1, String Clr2) {
|
||||||
r = MyRandom.random;
|
r = MyRandom.random;
|
||||||
|
|
||||||
CardCounts = new HashMap<String, Integer>();
|
cardCounts = new HashMap<String, Integer>();
|
||||||
|
|
||||||
ClrMap = new HashMap<String, String>();
|
clrMap = new HashMap<String, String>();
|
||||||
ClrMap.put("white", "W");
|
clrMap.put("white", "W");
|
||||||
ClrMap.put("blue", "U");
|
clrMap.put("blue", "U");
|
||||||
ClrMap.put("black", "B");
|
clrMap.put("black", "B");
|
||||||
ClrMap.put("red", "R");
|
clrMap.put("red", "R");
|
||||||
ClrMap.put("green", "G");
|
clrMap.put("green", "G");
|
||||||
|
|
||||||
notColors = new ArrayList<String>();
|
notColors = new ArrayList<String>();
|
||||||
notColors.add("white");
|
notColors.add("white");
|
||||||
@@ -66,10 +66,10 @@ public class Generate2ColorDeck {
|
|||||||
notColors.remove(color1);
|
notColors.remove(color1);
|
||||||
notColors.remove(color2);
|
notColors.remove(color2);
|
||||||
|
|
||||||
DL = GenerateDeckUtil.getDualLandList(ClrMap.get(color1) + ClrMap.get(color2));
|
dL = GenerateDeckUtil.getDualLandList(clrMap.get(color1) + clrMap.get(color2));
|
||||||
|
|
||||||
for (int i = 0; i < DL.size(); i++) {
|
for (int i = 0; i < dL.size(); i++) {
|
||||||
CardCounts.put(DL.get(i), 0);
|
cardCounts.put(dL.get(i), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ public class Generate2ColorDeck {
|
|||||||
CardListFilter clrF = new CardListFilter() {
|
CardListFilter clrF = new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
for (int i = 0; i < notColors.size(); i++) {
|
for (int i = 0; i < notColors.size(); i++) {
|
||||||
if (c.getManaCost().contains(ClrMap.get(notColors.get(i)))) {
|
if (c.getManaCost().contains(clrMap.get(notColors.get(i)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,19 +150,19 @@ public class Generate2ColorDeck {
|
|||||||
for (int j = 0; j < i; j++) {
|
for (int j = 0; j < i; j++) {
|
||||||
Card c = Cr1CMC.get(r.nextInt(Cr1CMC.size()));
|
Card c = Cr1CMC.get(r.nextInt(Cr1CMC.size()));
|
||||||
Cr12.add(c);
|
Cr12.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
|
|
||||||
c = Cr2CMC.get(r.nextInt(Cr2CMC.size()));
|
c = Cr2CMC.get(r.nextInt(Cr2CMC.size()));
|
||||||
Cr12.add(c);
|
Cr12.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
|
|
||||||
c = Sp1CMC.get(r.nextInt(Sp1CMC.size()));
|
c = Sp1CMC.get(r.nextInt(Sp1CMC.size()));
|
||||||
Sp12.add(c);
|
Sp12.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
|
|
||||||
c = Sp2CMC.get(r.nextInt(Sp2CMC.size()));
|
c = Sp2CMC.get(r.nextInt(Sp2CMC.size()));
|
||||||
Sp12.add(c);
|
Sp12.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MinCMC[0] += 2;
|
MinCMC[0] += 2;
|
||||||
@@ -193,7 +193,7 @@ public class Generate2ColorDeck {
|
|||||||
Card c = Cr12.get(r.nextInt(Cr12.size()));
|
Card c = Cr12.get(r.nextInt(Cr12.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while (CardCounts.get(c.getName()) > 3 || lc > 100) {
|
while (cardCounts.get(c.getName()) > 3 || lc > 100) {
|
||||||
c = Cr12.get(r.nextInt(Cr12.size()));
|
c = Cr12.get(r.nextInt(Cr12.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -202,8 +202,8 @@ public class Generate2ColorDeck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
||||||
int n = CardCounts.get(c.getName());
|
int n = cardCounts.get(c.getName());
|
||||||
CardCounts.put(c.getName(), n + 1);
|
cardCounts.put(c.getName(), n + 1);
|
||||||
tmpDeck += c.getName() + " " + c.getManaCost() + "\n";
|
tmpDeck += c.getName() + " " + c.getManaCost() + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ public class Generate2ColorDeck {
|
|||||||
Card c = Sp12.get(r.nextInt(Sp12.size()));
|
Card c = Sp12.get(r.nextInt(Sp12.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while (CardCounts.get(c.getName()) > 3 || lc > 100) {
|
while (cardCounts.get(c.getName()) > 3 || lc > 100) {
|
||||||
c = Sp12.get(r.nextInt(Sp12.size()));
|
c = Sp12.get(r.nextInt(Sp12.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -220,8 +220,8 @@ public class Generate2ColorDeck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
||||||
int n = CardCounts.get(c.getName());
|
int n = cardCounts.get(c.getName());
|
||||||
CardCounts.put(c.getName(), n + 1);
|
cardCounts.put(c.getName(), n + 1);
|
||||||
tmpDeck += c.getName() + " " + c.getManaCost() + "\n";
|
tmpDeck += c.getName() + " " + c.getManaCost() + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,11 +238,11 @@ public class Generate2ColorDeck {
|
|||||||
|
|
||||||
int nDLands = (numLands / 6);
|
int nDLands = (numLands / 6);
|
||||||
for (int i = 0; i < nDLands; i++) {
|
for (int i = 0; i < nDLands; i++) {
|
||||||
String s = DL.get(r.nextInt(DL.size()));
|
String s = dL.get(r.nextInt(dL.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while (CardCounts.get(s) > 3 || lc > 20) {
|
while (cardCounts.get(s) > 3 || lc > 20) {
|
||||||
s = DL.get(r.nextInt(DL.size()));
|
s = dL.get(r.nextInt(dL.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
if (lc > 20) {
|
if (lc > 20) {
|
||||||
@@ -250,8 +250,8 @@ public class Generate2ColorDeck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(s, AllZone.getHumanPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(s, AllZone.getHumanPlayer()));
|
||||||
int n = CardCounts.get(s);
|
int n = cardCounts.get(s);
|
||||||
CardCounts.put(s, n + 1);
|
cardCounts.put(s, n + 1);
|
||||||
tmpDeck += s + "\n";
|
tmpDeck += s + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,7 +308,7 @@ public class Generate2ColorDeck {
|
|||||||
tmpDeck += "nLand-" + ClrCnts[i].Color + ":" + nLand + "\n";
|
tmpDeck += "nLand-" + ClrCnts[i].Color + ":" + nLand + "\n";
|
||||||
|
|
||||||
// just to prevent a null exception by the deck size fixing code
|
// just to prevent a null exception by the deck size fixing code
|
||||||
CardCounts.put(ClrCnts[i].Color, nLand);
|
cardCounts.put(ClrCnts[i].Color, nLand);
|
||||||
|
|
||||||
for (int j = 0; j <= nLand; j++) {
|
for (int j = 0; j <= nLand; j++) {
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(ClrCnts[i].Color, AllZone.getComputerPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(ClrCnts[i].Color, AllZone.getComputerPlayer()));
|
||||||
@@ -326,7 +326,7 @@ public class Generate2ColorDeck {
|
|||||||
Card c = tDeck.get(r.nextInt(tDeck.size()));
|
Card c = tDeck.get(r.nextInt(tDeck.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while (CardCounts.get(c.getName()) > 3 || lc > Size) {
|
while (cardCounts.get(c.getName()) > 3 || lc > Size) {
|
||||||
c = tDeck.get(r.nextInt(tDeck.size()));
|
c = tDeck.get(r.nextInt(tDeck.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -334,9 +334,9 @@ public class Generate2ColorDeck {
|
|||||||
throw new RuntimeException("Generate2ColorDeck : get2ColorDeck -- looped too much -- undersize");
|
throw new RuntimeException("Generate2ColorDeck : get2ColorDeck -- looped too much -- undersize");
|
||||||
}
|
}
|
||||||
|
|
||||||
int n = CardCounts.get(c.getName());
|
int n = cardCounts.get(c.getName());
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
||||||
CardCounts.put(c.getName(), n + 1);
|
cardCounts.put(c.getName(), n + 1);
|
||||||
tmpDeck += "Added:" + c.getName() + "\n";
|
tmpDeck += "Added:" + c.getName() + "\n";
|
||||||
}
|
}
|
||||||
} else if (tDeck.size() > Size) {
|
} else if (tDeck.size() > Size) {
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ public class Generate3ColorDeck {
|
|||||||
private String color2 = "";
|
private String color2 = "";
|
||||||
private String color3 = "";
|
private String color3 = "";
|
||||||
private Random r = null;
|
private Random r = null;
|
||||||
private Map<String, String> ClrMap = null;
|
private Map<String, String> crMap = null;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Constructor for Generate3ColorDeck.</p>
|
* <p>Constructor for Generate3ColorDeck.</p>
|
||||||
@@ -35,14 +35,14 @@ public class Generate3ColorDeck {
|
|||||||
public Generate3ColorDeck(String Clr1, String Clr2, String Clr3) {
|
public Generate3ColorDeck(String Clr1, String Clr2, String Clr3) {
|
||||||
r = MyRandom.random;
|
r = MyRandom.random;
|
||||||
|
|
||||||
CardCounts = new HashMap<String, Integer>();
|
cardCounts = new HashMap<String, Integer>();
|
||||||
|
|
||||||
ClrMap = new HashMap<String, String>();
|
crMap = new HashMap<String, String>();
|
||||||
ClrMap.put("white", "W");
|
crMap.put("white", "W");
|
||||||
ClrMap.put("blue", "U");
|
crMap.put("blue", "U");
|
||||||
ClrMap.put("black", "B");
|
crMap.put("black", "B");
|
||||||
ClrMap.put("red", "R");
|
crMap.put("red", "R");
|
||||||
ClrMap.put("green", "G");
|
crMap.put("green", "G");
|
||||||
|
|
||||||
notColors = new ArrayList<String>();
|
notColors = new ArrayList<String>();
|
||||||
notColors.add("white");
|
notColors.add("white");
|
||||||
@@ -75,10 +75,10 @@ public class Generate3ColorDeck {
|
|||||||
notColors.remove(color2);
|
notColors.remove(color2);
|
||||||
notColors.remove(color3);
|
notColors.remove(color3);
|
||||||
|
|
||||||
DL = GenerateDeckUtil.getDualLandList(ClrMap.get(color1) + ClrMap.get(color2) + ClrMap.get(color3));
|
dL = GenerateDeckUtil.getDualLandList(crMap.get(color1) + crMap.get(color2) + crMap.get(color3));
|
||||||
|
|
||||||
for (int i = 0; i < DL.size(); i++) {
|
for (int i = 0; i < dL.size(); i++) {
|
||||||
CardCounts.put(DL.get(i), 0);
|
cardCounts.put(dL.get(i), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ public class Generate3ColorDeck {
|
|||||||
CardListFilter clrF = new CardListFilter() {
|
CardListFilter clrF = new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
for (int i = 0; i < notColors.size(); i++) {
|
for (int i = 0; i < notColors.size(); i++) {
|
||||||
if (c.getManaCost().contains(ClrMap.get(notColors.get(i))))
|
if (c.getManaCost().contains(crMap.get(notColors.get(i))))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -165,27 +165,27 @@ public class Generate3ColorDeck {
|
|||||||
for (int j = 0; j < i; j++) {
|
for (int j = 0; j < i; j++) {
|
||||||
Card c = Cr1CMC.get(r.nextInt(Cr1CMC.size()));
|
Card c = Cr1CMC.get(r.nextInt(Cr1CMC.size()));
|
||||||
Cr123.add(c);
|
Cr123.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
|
|
||||||
c = Cr2CMC.get(r.nextInt(Cr2CMC.size()));
|
c = Cr2CMC.get(r.nextInt(Cr2CMC.size()));
|
||||||
Cr123.add(c);
|
Cr123.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
|
|
||||||
c = Cr3CMC.get(r.nextInt(Cr3CMC.size()));
|
c = Cr3CMC.get(r.nextInt(Cr3CMC.size()));
|
||||||
Cr123.add(c);
|
Cr123.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
|
|
||||||
c = Sp1CMC.get(r.nextInt(Sp1CMC.size()));
|
c = Sp1CMC.get(r.nextInt(Sp1CMC.size()));
|
||||||
Sp123.add(c);
|
Sp123.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
|
|
||||||
c = Sp2CMC.get(r.nextInt(Sp2CMC.size()));
|
c = Sp2CMC.get(r.nextInt(Sp2CMC.size()));
|
||||||
Sp123.add(c);
|
Sp123.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
|
|
||||||
c = Sp3CMC.get(r.nextInt(Sp3CMC.size()));
|
c = Sp3CMC.get(r.nextInt(Sp3CMC.size()));
|
||||||
Sp123.add(c);
|
Sp123.add(c);
|
||||||
CardCounts.put(c.getName(), 0);
|
cardCounts.put(c.getName(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MinCMC[0] += 2;
|
MinCMC[0] += 2;
|
||||||
@@ -215,7 +215,7 @@ public class Generate3ColorDeck {
|
|||||||
Card c = Cr123.get(r.nextInt(Cr123.size()));
|
Card c = Cr123.get(r.nextInt(Cr123.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while (CardCounts.get(c.getName()) > 3 || lc > 100) {
|
while (cardCounts.get(c.getName()) > 3 || lc > 100) {
|
||||||
c = Cr123.get(r.nextInt(Cr123.size()));
|
c = Cr123.get(r.nextInt(Cr123.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -223,8 +223,8 @@ public class Generate3ColorDeck {
|
|||||||
throw new RuntimeException("Generate3ColorDeck : get3ColorDeck -- looped too much -- Cr123");
|
throw new RuntimeException("Generate3ColorDeck : get3ColorDeck -- looped too much -- Cr123");
|
||||||
|
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
||||||
int n = CardCounts.get(c.getName());
|
int n = cardCounts.get(c.getName());
|
||||||
CardCounts.put(c.getName(), n + 1);
|
cardCounts.put(c.getName(), n + 1);
|
||||||
tmpDeck += c.getName() + " " + c.getManaCost() + "\n";
|
tmpDeck += c.getName() + " " + c.getManaCost() + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ public class Generate3ColorDeck {
|
|||||||
Card c = Sp123.get(r.nextInt(Sp123.size()));
|
Card c = Sp123.get(r.nextInt(Sp123.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while (CardCounts.get(c.getName()) > 3 || lc > 100) {
|
while (cardCounts.get(c.getName()) > 3 || lc > 100) {
|
||||||
c = Sp123.get(r.nextInt(Sp123.size()));
|
c = Sp123.get(r.nextInt(Sp123.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
@@ -240,8 +240,8 @@ public class Generate3ColorDeck {
|
|||||||
throw new RuntimeException("Generate3ColorDeck : get3ColorDeck -- looped too much -- Sp123");
|
throw new RuntimeException("Generate3ColorDeck : get3ColorDeck -- looped too much -- Sp123");
|
||||||
|
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
||||||
int n = CardCounts.get(c.getName());
|
int n = cardCounts.get(c.getName());
|
||||||
CardCounts.put(c.getName(), n + 1);
|
cardCounts.put(c.getName(), n + 1);
|
||||||
tmpDeck += c.getName() + " " + c.getManaCost() + "\n";
|
tmpDeck += c.getName() + " " + c.getManaCost() + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,25 +255,25 @@ public class Generate3ColorDeck {
|
|||||||
|
|
||||||
tmpDeck += "numLands:" + numLands + "\n";
|
tmpDeck += "numLands:" + numLands + "\n";
|
||||||
|
|
||||||
int nDLands = (numLands / 4);
|
int ndLands = (numLands / 4);
|
||||||
for (int i = 0; i < nDLands; i++) {
|
for (int i = 0; i < ndLands; i++) {
|
||||||
String s = DL.get(r.nextInt(DL.size()));
|
String s = dL.get(r.nextInt(dL.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while (CardCounts.get(s) > 3 || lc > 20) {
|
while (cardCounts.get(s) > 3 || lc > 20) {
|
||||||
s = DL.get(r.nextInt(DL.size()));
|
s = dL.get(r.nextInt(dL.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
if (lc > 20)
|
if (lc > 20)
|
||||||
throw new RuntimeException("Generate3ColorDeck : get3ColorDeck -- looped too much -- DL");
|
throw new RuntimeException("Generate3ColorDeck : get3ColorDeck -- looped too much -- dL");
|
||||||
|
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(s, AllZone.getHumanPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(s, AllZone.getHumanPlayer()));
|
||||||
int n = CardCounts.get(s);
|
int n = cardCounts.get(s);
|
||||||
CardCounts.put(s, n + 1);
|
cardCounts.put(s, n + 1);
|
||||||
tmpDeck += s + "\n";
|
tmpDeck += s + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
numLands -= nDLands;
|
numLands -= ndLands;
|
||||||
|
|
||||||
if (numLands > 0) // attempt to optimize basic land counts according to color representation
|
if (numLands > 0) // attempt to optimize basic land counts according to color representation
|
||||||
{
|
{
|
||||||
@@ -321,7 +321,7 @@ public class Generate3ColorDeck {
|
|||||||
tmpDeck += "nLand-" + ClrCnts[i].Color + ":" + nLand + "\n";
|
tmpDeck += "nLand-" + ClrCnts[i].Color + ":" + nLand + "\n";
|
||||||
|
|
||||||
// just to prevent a null exception by the deck size fixing code
|
// just to prevent a null exception by the deck size fixing code
|
||||||
CardCounts.put(ClrCnts[i].Color, nLand);
|
cardCounts.put(ClrCnts[i].Color, nLand);
|
||||||
|
|
||||||
for (int j = 0; j <= nLand; j++)
|
for (int j = 0; j <= nLand; j++)
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(ClrCnts[i].Color, AllZone.getComputerPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(ClrCnts[i].Color, AllZone.getComputerPlayer()));
|
||||||
@@ -338,16 +338,16 @@ public class Generate3ColorDeck {
|
|||||||
Card c = tDeck.get(r.nextInt(tDeck.size()));
|
Card c = tDeck.get(r.nextInt(tDeck.size()));
|
||||||
|
|
||||||
lc = 0;
|
lc = 0;
|
||||||
while (CardCounts.get(c.getName()) > 3 || lc > Size) {
|
while (cardCounts.get(c.getName()) > 3 || lc > Size) {
|
||||||
c = tDeck.get(r.nextInt(tDeck.size()));
|
c = tDeck.get(r.nextInt(tDeck.size()));
|
||||||
lc++;
|
lc++;
|
||||||
}
|
}
|
||||||
if (lc > Size)
|
if (lc > Size)
|
||||||
throw new RuntimeException("Generate3ColorDeck : get3ColorDeck -- looped too much -- undersize");
|
throw new RuntimeException("Generate3ColorDeck : get3ColorDeck -- looped too much -- undersize");
|
||||||
|
|
||||||
int n = CardCounts.get(c.getName());
|
int n = cardCounts.get(c.getName());
|
||||||
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
tDeck.add(AllZone.getCardFactory().getCard(c.getName(), AllZone.getComputerPlayer()));
|
||||||
CardCounts.put(c.getName(), n + 1);
|
cardCounts.put(c.getName(), n + 1);
|
||||||
tmpDeck += "Added:" + c.getName() + "\n";
|
tmpDeck += "Added:" + c.getName() + "\n";
|
||||||
}
|
}
|
||||||
} else if (tDeck.size() > Size) {
|
} else if (tDeck.size() > Size) {
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
package forge.deck.generate;
|
package forge.deck.generate;
|
||||||
|
|
||||||
import forge.*;
|
|
||||||
import forge.error.ErrorViewer;
|
|
||||||
import forge.properties.ForgeProps;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>GenerateDeckUtil class.</p>
|
* <p>GenerateDeckUtil class.</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user