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.
*/
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;
keyCard=keyCard0;
secondKeyCard=secondKeyCard0;
@@ -281,9 +281,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
System.out.println("Lands needed : " + landsNeeded);
System.out.println("Post Lands : " + deckList.size());
}
if (keyCard.getRules().getColorIdentity().isColorless()&&landsNeeded>0){
addWastesIfRequired();
}
fixDeckSize();
if (logToConsole) {
System.out.println("Post Size fix : " + deckList.size());
@@ -682,16 +680,17 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
* Only adds wastes if present in the card pool but if present adds them all
*/
private void addWastesIfRequired(){
if(colors.isColorless()) {
PaperCard waste = FModel.getMagicDb().getCommonCards().getUniqueByName("Wastes");
if(colors.isColorless()&& keyCard.getRules().getColorIdentity().isColorless()
&& format.isLegalCard(waste)) {
while (landsNeeded > 0) {
deckList.add(waste);
landsNeeded--;
}
aiPlayables.remove(waste);
rankedColorList.remove(waste);
}
}
}
/**
* Attempt to optimize basic land counts according to color representation.
@@ -703,6 +702,11 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
*/
private int[] calculateLandNeeds() {
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
for (final PaperCard cp : deckList) {
final ManaCost mc = cp.getRules().getManaCost();