Fixed bug with not counting keycards as lands in the land count causing various issues. Fixed final keyword issue causing build warnings.

This commit is contained in:
austinio7116
2018-03-02 19:49:42 +00:00
committed by maustin
parent cb5791276a
commit edc921bf98
3 changed files with 16 additions and 3 deletions

View File

@@ -161,10 +161,10 @@ public class SimulateMatch {
private static void simulateSingleMatch(Match mc, int iGame, boolean outputGamelog) { private static void simulateSingleMatch(Match mc, int iGame, boolean outputGamelog) {
StopWatch sw = new StopWatch(); final StopWatch sw = new StopWatch();
sw.start(); sw.start();
Game g1 = mc.createGame(); final Game g1 = mc.createGame();
// will run match in the same thread // will run match in the same thread
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();

View File

@@ -217,7 +217,7 @@ public class DeckgenUtil {
System.out.println("Wrong card count "+deck.getMain().countAll()); System.out.println("Wrong card count "+deck.getMain().countAll());
deck=buildCardGenDeck(format,isForAI); deck=buildCardGenDeck(format,isForAI);
} }
if(deck.getMain().countAll(Predicates.compose(CardRulesPredicates.Presets.IS_LAND, PaperCard.FN_GET_RULES))>30){ if(deck.getMain().countAll(Predicates.compose(CardRulesPredicates.Presets.IS_LAND, PaperCard.FN_GET_RULES))>27){
System.out.println("Too many lands "+deck.getMain().countAll(Predicates.compose(CardRulesPredicates.Presets.IS_LAND, PaperCard.FN_GET_RULES))); System.out.println("Too many lands "+deck.getMain().countAll(Predicates.compose(CardRulesPredicates.Presets.IS_LAND, PaperCard.FN_GET_RULES)));
deck=buildCardGenDeck(format,isForAI); deck=buildCardGenDeck(format,isForAI);
} }

View File

@@ -249,6 +249,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
addLands(clrCnts); addLands(clrCnts);
} }
if (logToConsole) { if (logToConsole) {
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){ if (keyCard.getRules().getColorIdentity().isColorless()&&landsNeeded>0){
@@ -313,6 +314,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
deckList.addAll(keyCardList); deckList.addAll(keyCardList);
aiPlayables.removeAll(keyCardList); aiPlayables.removeAll(keyCardList);
rankedColorList.removeAll(keyCardList); rankedColorList.removeAll(keyCardList);
landsNeeded--;
} }
// Add the deck card // Add the deck card
if(secondKeyCard.getRules().getMainPart().getType().isLand()) { if(secondKeyCard.getRules().getMainPart().getType().isLand()) {
@@ -321,6 +323,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
deckList.addAll(keyCardList); deckList.addAll(keyCardList);
aiPlayables.removeAll(keyCardList); aiPlayables.removeAll(keyCardList);
rankedColorList.removeAll(keyCardList); rankedColorList.removeAll(keyCardList);
landsNeeded--;
} }
} }
@@ -650,6 +653,16 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
} }
} }
} }
//check all colors have at least one count for each color in colors
for ( int i = 0 ; i < MagicColor.WUBRG.length; i++ ) {
final byte c = MagicColor.WUBRG[i];
if ( colors.hasAnyColor(c)) {
if(clrCnts[i] == 0 ) {
clrCnts[i]++;
}
}
}
return clrCnts; return clrCnts;
} }