Brawl deck generators make use of new colourless rules for basic lands

This commit is contained in:
austinio7116
2018-05-19 22:25:01 +01:00
committed by maustin
parent 3505047c9b
commit 553cec6d60

View File

@@ -83,7 +83,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
* Cards to build the deck from. * Cards to build the deck from.
*/ */
public CardThemedDeckBuilder(PaperCard keyCard0, PaperCard secondKeyCard0, final List<PaperCard> dList, GameFormat format, boolean isForAI, DeckFormat deckFormat) { public CardThemedDeckBuilder(PaperCard keyCard0, PaperCard secondKeyCard0, final List<PaperCard> dList, GameFormat format, boolean isForAI, DeckFormat deckFormat) {
super(new DeckGenPool(FModel.getMagicDb().getCommonCards().getUniqueCards()), DeckFormat.Constructed, format.getFilterPrinted()); super(new DeckGenPool(FModel.getMagicDb().getCommonCards().getUniqueCards()), deckFormat, format.getFilterPrinted());
this.availableList = dList; this.availableList = dList;
keyCard=keyCard0; keyCard=keyCard0;
secondKeyCard=secondKeyCard0; secondKeyCard=secondKeyCard0;
@@ -281,9 +281,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
System.out.println("Lands needed : " + landsNeeded); System.out.println("Lands needed : " + landsNeeded);
System.out.println("Post Lands : " + deckList.size()); System.out.println("Post Lands : " + deckList.size());
} }
if (keyCard.getRules().getColorIdentity().isColorless()&&landsNeeded>0){ addWastesIfRequired();
addWastesIfRequired();
}
fixDeckSize(); fixDeckSize();
if (logToConsole) { if (logToConsole) {
System.out.println("Post Size fix : " + deckList.size()); System.out.println("Post Size fix : " + deckList.size());
@@ -682,14 +680,15 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
* Only adds wastes if present in the card pool but if present adds them all * Only adds wastes if present in the card pool but if present adds them all
*/ */
private void addWastesIfRequired(){ private void addWastesIfRequired(){
if(colors.isColorless()) { PaperCard waste = FModel.getMagicDb().getCommonCards().getUniqueByName("Wastes");
PaperCard waste = FModel.getMagicDb().getCommonCards().getUniqueByName("Wastes"); if(colors.isColorless()&& keyCard.getRules().getColorIdentity().isColorless()
&& format.isLegalCard(waste)) {
while (landsNeeded > 0) { while (landsNeeded > 0) {
deckList.add(waste); deckList.add(waste);
landsNeeded--; landsNeeded--;
aiPlayables.remove(waste);
rankedColorList.remove(waste);
} }
aiPlayables.remove(waste);
rankedColorList.remove(waste);
} }
} }
@@ -703,6 +702,11 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
*/ */
private int[] calculateLandNeeds() { private int[] calculateLandNeeds() {
final int[] clrCnts = { 0,0,0,0,0 }; final int[] clrCnts = { 0,0,0,0,0 };
//Brawl allows colourless commanders to have any number of one basic land to fill out the deck..
if (format.equals(DeckFormat.Brawl) && keyCard.getRules().getColorIdentity().isColorless()){
clrCnts[MyRandom.getRandom().nextInt(5)] = 1;
return clrCnts;
}
// count each card color using mana costs // count each card color using mana costs
for (final PaperCard cp : deckList) { for (final PaperCard cp : deckList) {
final ManaCost mc = cp.getRules().getManaCost(); final ManaCost mc = cp.getRules().getManaCost();