From 843702bd86210fb1b51ea65614563bfbf2ccc2de Mon Sep 17 00:00:00 2001 From: brodee Date: Fri, 26 Oct 2018 22:17:57 -0700 Subject: [PATCH] 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. --- .../java/mage/player/ai/utils/RateCard.java | 23 ++++++++++++++++++- .../main/java/mage/game/draft/DraftImpl.java | 3 ++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java index 5197c33536..e737122a95 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java @@ -13,6 +13,7 @@ import org.apache.log4j.Logger; import java.io.InputStream; import java.util.*; +import mage.constants.Rarity; import mage.constants.SubType; /** @@ -71,7 +72,7 @@ public final class RateCard { type = 6; } int score = 10 * getCardRating(card) + 2 * type + getManaCostScore(card, allowedColors) - + 40 * isRemoval(card); + + 40 * isRemoval(card) + getRarityScore(card); if (allowedColors == null) rated.put(card.getName(), score); return score; @@ -218,6 +219,26 @@ public final class RateCard { 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. * diff --git a/Mage/src/main/java/mage/game/draft/DraftImpl.java b/Mage/src/main/java/mage/game/draft/DraftImpl.java index 35efc14431..5ef5a2330e 100644 --- a/Mage/src/main/java/mage/game/draft/DraftImpl.java +++ b/Mage/src/main/java/mage/game/draft/DraftImpl.java @@ -147,7 +147,8 @@ public abstract class DraftImpl implements Draft { @Override public void autoPick(UUID playerId) { - this.addPick(playerId, players.get(playerId).getBooster().get(0).getId(), null); + List booster = players.get(playerId).getBooster(); + this.addPick(playerId, booster.get(booster.size()-1).getId(), null); } protected void passLeft() {