forked from External/mage
Playable mana calculation improved:
* server: fixed server crashes on usage of multiple permanents with {Any} mana abilities (example: Energy Refractor, related to #11285);
* AI: fixed game freezes and errors on computer's {Any} mana usage (closes #9467, closes #6419);
This commit is contained in:
parent
19f7ba8937
commit
2298ebc5f5
11 changed files with 504 additions and 221 deletions
|
|
@ -90,17 +90,17 @@ public final class RateCard {
|
|||
}
|
||||
|
||||
String name = card.getName();
|
||||
if (useCache && allowedColors == null && ratedCard.containsKey(name)) {
|
||||
int rate = ratedCard.get(name);
|
||||
return rate;
|
||||
if (useCache && allowedColors.isEmpty() && ratedCard.containsKey(name)) {
|
||||
return ratedCard.get(name);
|
||||
}
|
||||
|
||||
int typeMultiplier = typeMultiplier(card);
|
||||
int score = getBaseCardScore(card) + 2 * typeMultiplier + getManaCostScore(card, allowedColors)
|
||||
+ 40 * isRemoval(card);
|
||||
|
||||
if (useCache && allowedColors == null)
|
||||
if (useCache && allowedColors.isEmpty()) {
|
||||
ratedCard.put(name, score);
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
|
@ -111,17 +111,17 @@ public final class RateCard {
|
|||
}
|
||||
|
||||
String name = cardview.getName();
|
||||
if (useCache && allowedColors == null && ratedCardView.containsKey(name)) {
|
||||
int rate = ratedCardView.get(name);
|
||||
return rate;
|
||||
if (useCache && allowedColors.isEmpty() && ratedCardView.containsKey(name)) {
|
||||
return ratedCardView.get(name);
|
||||
}
|
||||
|
||||
int typeMultiplier = typeMultiplier(cardview);
|
||||
int score = getBaseCardScore(cardview) + 2 * typeMultiplier + getManaCostScore(cardview, allowedColors);
|
||||
// Cardview does not have enough info to know the card is a removal.
|
||||
|
||||
if (useCache && allowedColors == null)
|
||||
if (useCache && allowedColors.isEmpty()) {
|
||||
ratedCardView.put(name, score);
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
|
@ -402,7 +402,7 @@ public final class RateCard {
|
|||
}
|
||||
|
||||
private static int getManaCostScore(String name, int manaValue, List<String> manaCostSymbols, List<ColoredManaSymbol> allowedColors) {
|
||||
if (allowedColors == null) {
|
||||
if (allowedColors.isEmpty()) {
|
||||
int colorPenalty = 0;
|
||||
for (String symbol : manaCostSymbols) {
|
||||
if (isColoredMana(symbol)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue