mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Make draftbots never pick basic lands over any other card (#9342)
Co-authored-by: sprangg <a@b.c>
This commit is contained in:
parent
cbbfe5906a
commit
1a3d5923de
1 changed files with 35 additions and 2 deletions
|
|
@ -38,11 +38,15 @@ public final class RateCard {
|
||||||
* Ratings are in [1,10] range, so setting it high will make new cards appear more often.
|
* Ratings are in [1,10] range, so setting it high will make new cards appear more often.
|
||||||
* nowadays, cards that are more rare are more powerful, lets trust that and play the shiny cards.
|
* nowadays, cards that are more rare are more powerful, lets trust that and play the shiny cards.
|
||||||
*/
|
*/
|
||||||
|
private static final int DEFAULT_BASIC_LAND_RATING = 1;
|
||||||
private static final int DEFAULT_NOT_RATED_CARD_RATING = 40;
|
private static final int DEFAULT_NOT_RATED_CARD_RATING = 40;
|
||||||
private static final int DEFAULT_NOT_RATED_UNCOMMON_RATING = 60;
|
private static final int DEFAULT_NOT_RATED_UNCOMMON_RATING = 60;
|
||||||
private static final int DEFAULT_NOT_RATED_RARE_RATING = 75;
|
private static final int DEFAULT_NOT_RATED_RARE_RATING = 75;
|
||||||
private static final int DEFAULT_NOT_RATED_MYTHIC_RATING = 90;
|
private static final int DEFAULT_NOT_RATED_MYTHIC_RATING = 90;
|
||||||
|
|
||||||
|
// Cards that aren't in the deck's colors get a penalty to their rating
|
||||||
|
private static final int OFF_COLOR_PENALTY = -100;
|
||||||
|
|
||||||
private static String RATINGS_DIR = "/ratings/";
|
private static String RATINGS_DIR = "/ratings/";
|
||||||
private static String RATINGS_SET_LIST = RATINGS_DIR + "setsWithRatings.csv";
|
private static String RATINGS_SET_LIST = RATINGS_DIR + "setsWithRatings.csv";
|
||||||
|
|
||||||
|
|
@ -204,7 +208,11 @@ public final class RateCard {
|
||||||
newRating = DEFAULT_NOT_RATED_MYTHIC_RATING;
|
newRating = DEFAULT_NOT_RATED_MYTHIC_RATING;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (isBasicLand(card)) {
|
||||||
|
newRating = DEFAULT_BASIC_LAND_RATING;
|
||||||
|
} else {
|
||||||
newRating = DEFAULT_NOT_RATED_CARD_RATING;
|
newRating = DEFAULT_NOT_RATED_CARD_RATING;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -327,6 +335,12 @@ public final class RateCard {
|
||||||
}
|
}
|
||||||
return 2 * (converted - colorPenalty + 1);
|
return 2 * (converted - colorPenalty + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Basic lands have no value so they're always treated as off-color
|
||||||
|
if (isBasicLand(card)) {
|
||||||
|
return OFF_COLOR_PENALTY;
|
||||||
|
}
|
||||||
|
|
||||||
final Map<String, Integer> singleCount = new HashMap<>();
|
final Map<String, Integer> singleCount = new HashMap<>();
|
||||||
int maxSingleCount = 0;
|
int maxSingleCount = 0;
|
||||||
for (String symbol : card.getManaCostSymbols()) {
|
for (String symbol : card.getManaCostSymbols()) {
|
||||||
|
|
@ -339,7 +353,7 @@ public final class RateCard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
return -100;
|
return OFF_COLOR_PENALTY;
|
||||||
}
|
}
|
||||||
Integer typeCount = singleCount.get(symbol);
|
Integer typeCount = singleCount.get(symbol);
|
||||||
if (typeCount == null) {
|
if (typeCount == null) {
|
||||||
|
|
@ -408,4 +422,23 @@ public final class RateCard {
|
||||||
}
|
}
|
||||||
return symbols.size();
|
return symbols.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the card is one of the basic land types that can be added to the deck for free.
|
||||||
|
*
|
||||||
|
* @param card
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isBasicLand(Card card) {
|
||||||
|
String name = card.getName();
|
||||||
|
if (name.equals("Plains")
|
||||||
|
|| name.equals("Island")
|
||||||
|
|| name.equals("Swamp")
|
||||||
|
|| name.equals("Mountain")
|
||||||
|
|| name.equals("Forest")) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue