mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Random decks for the human will now include cards with RemAIDeck.
This commit is contained in:
@@ -106,7 +106,7 @@ public class Generate2ColorDeck {
|
|||||||
* @param Size a int.
|
* @param Size a int.
|
||||||
* @return a {@link forge.CardList} object.
|
* @return a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
public CardList get2ColorDeck(int Size) {
|
public CardList get2ColorDeck(int Size, final PlayerType pt) {
|
||||||
int lc = 0; // loop counter to prevent infinite card selection loops
|
int lc = 0; // loop counter to prevent infinite card selection loops
|
||||||
String tmpDeck = "";
|
String tmpDeck = "";
|
||||||
CardList tDeck = new CardList();
|
CardList tDeck = new CardList();
|
||||||
@@ -119,7 +119,10 @@ public class Generate2ColorDeck {
|
|||||||
// remove cards that generated decks don't like
|
// remove cards that generated decks don't like
|
||||||
CardList AllCards = CardFilter.filter(AllZone.getCardFactory(), new CardListFilter() {
|
CardList AllCards = CardFilter.filter(AllZone.getCardFactory(), new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return !(c.getSVar("RemAIDeck").equals("True") || c.getSVar("RemRandomDeck").equals("True"));
|
if (c.getSVar("RemRandomDeck").equals("True")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (!c.getSVar("RemAIDeck").equals("True") || (pt != null && pt.equals(PlayerType.HUMAN)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -146,7 +149,7 @@ public class Generate2ColorDeck {
|
|||||||
CardList Cr1 = CL1.getType("Creature");
|
CardList Cr1 = CL1.getType("Creature");
|
||||||
CardList Cr2 = CL2.getType("Creature");
|
CardList Cr2 = CL2.getType("Creature");
|
||||||
|
|
||||||
String ISE[] = {"Instant", "Sorcery", "Enchantment", "Planeswalker", "Artifact"};
|
String ISE[] = {"Instant", "Sorcery", "Enchantment", "Planeswalker", "Artifact.nonCreature"};
|
||||||
CardList Sp1 = CL1.getValidCards(ISE, null, null);
|
CardList Sp1 = CL1.getValidCards(ISE, null, null);
|
||||||
CardList Sp2 = CL2.getValidCards(ISE, null, null);
|
CardList Sp2 = CL2.getValidCards(ISE, null, null);
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class Generate3ColorDeck {
|
|||||||
* @param Size a int.
|
* @param Size a int.
|
||||||
* @return a {@link forge.CardList} object.
|
* @return a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
public CardList get3ColorDeck(int Size) {
|
public CardList get3ColorDeck(int Size, final PlayerType pt) {
|
||||||
int lc = 0; // loop counter to prevent infinite card selection loops
|
int lc = 0; // loop counter to prevent infinite card selection loops
|
||||||
String tmpDeck = "";
|
String tmpDeck = "";
|
||||||
CardList tDeck = new CardList();
|
CardList tDeck = new CardList();
|
||||||
@@ -130,7 +130,10 @@ public class Generate3ColorDeck {
|
|||||||
// remove cards that generated decks don't like
|
// remove cards that generated decks don't like
|
||||||
CardList AllCards = CardFilter.filter(AllZone.getCardFactory(), new CardListFilter() {
|
CardList AllCards = CardFilter.filter(AllZone.getCardFactory(), new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return !(c.getSVar("RemAIDeck").equals("True") || c.getSVar("RemRandomDeck").equals("True"));
|
if (c.getSVar("RemRandomDeck").equals("True")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (!c.getSVar("RemAIDeck").equals("True") || (pt != null && pt.equals(PlayerType.HUMAN)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -159,7 +162,7 @@ public class Generate3ColorDeck {
|
|||||||
CardList Cr2 = CL2.getType("Creature");
|
CardList Cr2 = CL2.getType("Creature");
|
||||||
CardList Cr3 = CL3.getType("Creature");
|
CardList Cr3 = CL3.getType("Creature");
|
||||||
|
|
||||||
String ISE[] = {"Instant", "Sorcery", "Enchantment", "Planeswalker", "Artifact"};
|
String ISE[] = {"Instant", "Sorcery", "Enchantment", "Planeswalker", "Artifact.nonCreature"};
|
||||||
CardList Sp1 = CL1.getValidCards(ISE, null, null);
|
CardList Sp1 = CL1.getValidCards(ISE, null, null);
|
||||||
CardList Sp2 = CL2.getValidCards(ISE, null, null);
|
CardList Sp2 = CL2.getValidCards(ISE, null, null);
|
||||||
CardList Sp3 = CL3.getValidCards(ISE, null, null);
|
CardList Sp3 = CL3.getValidCards(ISE, null, null);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import forge.CardList;
|
|||||||
import forge.CardListFilter;
|
import forge.CardListFilter;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.MyRandom;
|
import forge.MyRandom;
|
||||||
|
import forge.PlayerType;
|
||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
|
|
||||||
@@ -119,7 +120,7 @@ public class Generate5ColorDeck {
|
|||||||
* @param Size a int.
|
* @param Size a int.
|
||||||
* @return a {@link forge.CardList} object.
|
* @return a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
public CardList get5ColorDeck(int Size) {
|
public CardList get5ColorDeck(int Size, final PlayerType pt) {
|
||||||
int lc = 0; // loop counter to prevent infinite card selection loops
|
int lc = 0; // loop counter to prevent infinite card selection loops
|
||||||
String tmpDeck = "";
|
String tmpDeck = "";
|
||||||
CardList tDeck = new CardList();
|
CardList tDeck = new CardList();
|
||||||
@@ -132,7 +133,10 @@ public class Generate5ColorDeck {
|
|||||||
// remove cards that generated decks don't like
|
// remove cards that generated decks don't like
|
||||||
CardList allCards = CardFilter.filter(AllZone.getCardFactory(), new CardListFilter() {
|
CardList allCards = CardFilter.filter(AllZone.getCardFactory(), new CardListFilter() {
|
||||||
public boolean addCard(final Card c) {
|
public boolean addCard(final Card c) {
|
||||||
return !(c.getSVar("RemAIDeck").equals("True") || c.getSVar("RemRandomDeck").equals("True"));
|
if (c.getSVar("RemRandomDeck").equals("True")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (!c.getSVar("RemAIDeck").equals("True") || (pt != null && pt.equals(PlayerType.HUMAN)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -168,7 +172,7 @@ public class Generate5ColorDeck {
|
|||||||
CardList cr4 = cL4.getType("Creature");
|
CardList cr4 = cL4.getType("Creature");
|
||||||
CardList cr5 = cL5.getType("Creature");
|
CardList cr5 = cL5.getType("Creature");
|
||||||
|
|
||||||
String[] ise = {"Instant", "Sorcery", "Enchantment", "Planeswalker", "Artifact"};
|
String[] ise = {"Instant", "Sorcery", "Enchantment", "Planeswalker", "Artifact.nonCreature"};
|
||||||
CardList sp1 = cL1.getValidCards(ise, null, null);
|
CardList sp1 = cL1.getValidCards(ise, null, null);
|
||||||
CardList sp2 = cL2.getValidCards(ise, null, null);
|
CardList sp2 = cL2.getValidCards(ise, null, null);
|
||||||
CardList sp3 = cL3.getValidCards(ise, null, null);
|
CardList sp3 = cL3.getValidCards(ise, null, null);
|
||||||
|
|||||||
@@ -977,7 +977,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
|||||||
c2 = colors.get(r.nextInt(colors.size() - 1) + 1);
|
c2 = colors.get(r.nextInt(colors.size() - 1) + 1);
|
||||||
}
|
}
|
||||||
Generate2ColorDeck gen = new Generate2ColorDeck(c1, c2);
|
Generate2ColorDeck gen = new Generate2ColorDeck(c1, c2);
|
||||||
CardList d = gen.get2ColorDeck(60);
|
CardList d = gen.get2ColorDeck(60, p);
|
||||||
|
|
||||||
Deck deck = new Deck(Constant.GameType.Constructed);
|
Deck deck = new Deck(Constant.GameType.Constructed);
|
||||||
|
|
||||||
@@ -1043,7 +1043,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
|||||||
c3 = colors.get(r.nextInt(colors.size() - 1) + 1);
|
c3 = colors.get(r.nextInt(colors.size() - 1) + 1);
|
||||||
}
|
}
|
||||||
Generate3ColorDeck gen = new Generate3ColorDeck(c1, c2, c3);
|
Generate3ColorDeck gen = new Generate3ColorDeck(c1, c2, c3);
|
||||||
CardList d = gen.get3ColorDeck(60);
|
CardList d = gen.get3ColorDeck(60, p);
|
||||||
|
|
||||||
Deck deck = new Deck(Constant.GameType.Constructed);
|
Deck deck = new Deck(Constant.GameType.Constructed);
|
||||||
|
|
||||||
@@ -1077,7 +1077,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
|||||||
|
|
||||||
|
|
||||||
Generate5ColorDeck gen = new Generate5ColorDeck("white", "blue", "black", "red", "green");
|
Generate5ColorDeck gen = new Generate5ColorDeck("white", "blue", "black", "red", "green");
|
||||||
CardList d = gen.get5ColorDeck(60);
|
CardList d = gen.get5ColorDeck(60, p);
|
||||||
|
|
||||||
Deck deck = new Deck(Constant.GameType.Constructed);
|
Deck deck = new Deck(Constant.GameType.Constructed);
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class Generate2ColorDeckTest {
|
|||||||
@Test(enabled = false)
|
@Test(enabled = false)
|
||||||
public void Generate2ColorDeckTest1() {
|
public void Generate2ColorDeckTest1() {
|
||||||
Generate2ColorDeck gen = new Generate2ColorDeck("white", "blue");
|
Generate2ColorDeck gen = new Generate2ColorDeck("white", "blue");
|
||||||
CardList cardList = gen.get2ColorDeck(60);
|
CardList cardList = gen.get2ColorDeck(60, null);
|
||||||
Assert.assertNotNull(cardList);
|
Assert.assertNotNull(cardList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class Generate3ColorDeckTest {
|
|||||||
@Test(timeOut = 1000, enabled = false)
|
@Test(timeOut = 1000, enabled = false)
|
||||||
public void Generate3ColorDeckTest1() {
|
public void Generate3ColorDeckTest1() {
|
||||||
Generate3ColorDeck gen = new Generate3ColorDeck("white", "blue", "black");
|
Generate3ColorDeck gen = new Generate3ColorDeck("white", "blue", "black");
|
||||||
CardList cardList = gen.get3ColorDeck(60);
|
CardList cardList = gen.get3ColorDeck(60, null);
|
||||||
Assert.assertNotNull(cardList);
|
Assert.assertNotNull(cardList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class Generate5ColorDeckTest {
|
|||||||
@Test(timeOut = 1000, enabled = false)
|
@Test(timeOut = 1000, enabled = false)
|
||||||
public void Generate5ColorDeckTest1() {
|
public void Generate5ColorDeckTest1() {
|
||||||
Generate5ColorDeck gen = new Generate5ColorDeck();
|
Generate5ColorDeck gen = new Generate5ColorDeck();
|
||||||
CardList cardList = gen.get5ColorDeck(60);
|
CardList cardList = gen.get5ColorDeck(60, null);
|
||||||
Assert.assertNotNull(cardList);
|
Assert.assertNotNull(cardList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user