mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
During drafting stop reporting basic lands as not found on stdout
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
package forge.limited;
|
package forge.limited;
|
||||||
|
|
||||||
import forge.card.ColorSet;
|
import forge.card.ColorSet;
|
||||||
|
import forge.card.MagicColor;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
@@ -54,6 +55,9 @@ public class BoosterDraftAI {
|
|||||||
// roughly equivalent to 25 ranks in a core set, or 15 ranks in a small set
|
// roughly equivalent to 25 ranks in a core set, or 15 ranks in a small set
|
||||||
private static final double TAKE_BEST_THRESHOLD = 0.1;
|
private static final double TAKE_BEST_THRESHOLD = 0.1;
|
||||||
|
|
||||||
|
// rank worse than any other card available to draft
|
||||||
|
private static final double RANK_UNPICKABLE = 999.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Choose a CardPrinted from the list given.
|
* Choose a CardPrinted from the list given.
|
||||||
@@ -121,8 +125,8 @@ public class BoosterDraftAI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort cards by rank. Note that if pack has cards from different editions,
|
* Sort cards by rank. Note that if pack has cards from different editions,
|
||||||
* they could have the same rank. In that (hopefully rare) case, only one
|
* they could have the same rank. Basic lands and unrecognised cards are
|
||||||
* will end up in the Map.
|
* rated worse than all other possible picks.
|
||||||
*
|
*
|
||||||
* @param chooseFrom
|
* @param chooseFrom
|
||||||
* List of cards
|
* List of cards
|
||||||
@@ -131,13 +135,18 @@ public class BoosterDraftAI {
|
|||||||
private List<Pair<PaperCard, Double>> rankCards(final Iterable<PaperCard> chooseFrom) {
|
private List<Pair<PaperCard, Double>> rankCards(final Iterable<PaperCard> chooseFrom) {
|
||||||
List<Pair<PaperCard, Double>> rankedCards = new ArrayList<Pair<PaperCard,Double>>();
|
List<Pair<PaperCard, Double>> rankedCards = new ArrayList<Pair<PaperCard,Double>>();
|
||||||
for (PaperCard card : chooseFrom) {
|
for (PaperCard card : chooseFrom) {
|
||||||
Double rkg = DraftRankCache.getRanking(card.getName(), card.getEdition());
|
Double rank;
|
||||||
if (rkg != null) {
|
if (MagicColor.Constant.BASIC_LANDS.contains(card.getName())) {
|
||||||
rankedCards.add(MutablePair.of(card, rkg));
|
rank = RANK_UNPICKABLE;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Draft Rankings - Card Not Found: " + card.getName());
|
rank = DraftRankCache.getRanking(card.getName(), card.getEdition());
|
||||||
rankedCards.add(MutablePair.of(card, 999.0));
|
if (rank == null) {
|
||||||
|
System.out.println("Draft Rankings - Card Not Found: " + card.getName());
|
||||||
|
rank = RANK_UNPICKABLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rankedCards.add(MutablePair.of(card, rank));
|
||||||
}
|
}
|
||||||
return rankedCards;
|
return rankedCards;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package forge.limited;
|
package forge.limited;
|
||||||
|
|
||||||
import com.esotericsoftware.minlog.Log;
|
import com.esotericsoftware.minlog.Log;
|
||||||
import forge.card.MagicColor;
|
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
|
|
||||||
@@ -89,10 +88,6 @@ public class ReadDraftRankings {
|
|||||||
public Double getRanking(String cardName, String edition) {
|
public Double getRanking(String cardName, String edition) {
|
||||||
Double rank = null;
|
Double rank = null;
|
||||||
|
|
||||||
// Basic lands should be excluded from the evaluation --BBU
|
|
||||||
if ( MagicColor.Constant.BASIC_LANDS.contains(cardName))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (draftRankings.containsKey(edition)) {
|
if (draftRankings.containsKey(edition)) {
|
||||||
String safeName = cardName.replaceAll("-", " ").replaceAll("[^A-Za-z ]", "");
|
String safeName = cardName.replaceAll("-", " ").replaceAll("[^A-Za-z ]", "");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user