Allow multiple deck hints in a card

This commit is contained in:
mcrawford620
2016-07-12 04:43:31 +00:00
parent 83d93c4436
commit 3678e6a870
6 changed files with 101 additions and 101 deletions

View File

@@ -127,7 +127,6 @@ public class CardRanker {
double synergyScore = 0.0;
synergyScore += getScoreForDeckHints(card, otherCards);
synergyScore += getScoreForBuffedBy(card, otherCards);
return synergyScore;
}
@@ -135,7 +134,7 @@ public class CardRanker {
private double getScoreForDeckHints(PaperCard card, Iterable<PaperCard> otherCards) {
double score = 0.0;
final DeckHints hints = card.getRules().getAiHints().getDeckHints();
if (hints != null && hints.getType() != DeckHints.Type.NONE) {
if (hints != null && hints.isValid()) {
final List<PaperCard> comboCards = hints.filter(otherCards);
if (comboCards.size() > 0) {
score = comboCards.size() * 10;
@@ -144,22 +143,6 @@ public class CardRanker {
return score;
}
private double getScoreForBuffedBy(PaperCard card, Iterable<PaperCard> otherCards) {
double matchBuffScore = 0.0;
Iterable<Map.Entry<String, String>> vars = card.getRules().getMainPart().getVariables();
for (Map.Entry<String, String> var : vars) {
if (var.getKey().equals("BuffedBy")) {
String buff = var.getValue();
final Iterable<PaperCard> buffers = Iterables.filter(otherCards,
Predicates.compose(CardRulesPredicates.subType(buff), PaperCard.FN_GET_RULES));
if (Iterables.size(buffers) > 0) {
matchBuffScore = Iterables.size(buffers) * 3;
}
}
}
return matchBuffScore;
}
private List<PaperCard> sortAndCreateList(List<Pair<Double, PaperCard>> cardScores) {
Collections.sort(cardScores, Collections.reverseOrder(new CardRankingComparator()));

View File

@@ -558,12 +558,12 @@ public class LimitedDeckBuilder extends DeckGeneratorBase {
if (ai.getRemRandomDecks()) {
final List<PaperCard> comboCards = new ArrayList<PaperCard>();
if (ai.getDeckNeeds() != null
&& ai.getDeckNeeds().getType() != DeckHints.Type.NONE) {
&& ai.getDeckNeeds().isValid()) {
final DeckHints needs = ai.getDeckNeeds();
comboCards.addAll(needs.filter(deckList));
}
if (ai.getDeckHints() != null
&& ai.getDeckHints().getType() != DeckHints.Type.NONE) {
&& ai.getDeckHints().isValid()) {
final DeckHints hints = ai.getDeckHints();
comboCards.addAll(hints.filter(deckList));
}