draftbots and afk autopicks will more aggressivly take rares

two draft quality of life improvements for situations when real players
quit or go afk.
1. made the draftbot lean on rarity for card ratings. this helps make
the draftbots behave and not just pass bombs to the human players.
2. changed the draft autopick that happens when the timer runs out and
the player hasn't selected anything. I changed it to pick the last card
in the pack, which should be the rarest, so basically it raredrafts.
again making it so AFK players aren't just feeding real live human
players the best cards.
This commit is contained in:
brodee 2018-10-26 22:17:57 -07:00
parent 22364300ee
commit 843702bd86
2 changed files with 24 additions and 2 deletions

View file

@ -13,6 +13,7 @@ import org.apache.log4j.Logger;
import java.io.InputStream; import java.io.InputStream;
import java.util.*; import java.util.*;
import mage.constants.Rarity;
import mage.constants.SubType; import mage.constants.SubType;
/** /**
@ -71,7 +72,7 @@ public final class RateCard {
type = 6; type = 6;
} }
int score = 10 * getCardRating(card) + 2 * type + getManaCostScore(card, allowedColors) int score = 10 * getCardRating(card) + 2 * type + getManaCostScore(card, allowedColors)
+ 40 * isRemoval(card); + 40 * isRemoval(card) + getRarityScore(card);
if (allowedColors == null) if (allowedColors == null)
rated.put(card.getName(), score); rated.put(card.getName(), score);
return score; return score;
@ -218,6 +219,26 @@ public final class RateCard {
return 2 * converted + 3 * (10 - SINGLE_PENALTY[maxSingleCount]/*-DOUBLE_PENALTY[doubleCount]*/); return 2 * converted + 3 * (10 - SINGLE_PENALTY[maxSingleCount]/*-DOUBLE_PENALTY[doubleCount]*/);
} }
/**
* Get rarity score.
* nowadays, cards that are more rare are more powerful, lets
* trust that and play the shiny cards.
*
* @param card
* @return integer rating value
*/
private static int getRarityScore(Card card) {
Rarity r = card.getRarity();
if (Rarity.MYTHIC == r){
return 80;
}else if (Rarity.RARE == r){
return 50;
}else if (Rarity.UNCOMMON == r){
return 25;
}else{
return 1;
}
}
/** /**
* Determines whether mana symbol is color. * Determines whether mana symbol is color.
* *

View file

@ -147,7 +147,8 @@ public abstract class DraftImpl implements Draft {
@Override @Override
public void autoPick(UUID playerId) { public void autoPick(UUID playerId) {
this.addPick(playerId, players.get(playerId).getBooster().get(0).getId(), null); List<Card> booster = players.get(playerId).getBooster();
this.addPick(playerId, booster.get(booster.size()-1).getId(), null);
} }
protected void passLeft() { protected void passLeft() {