Tweak AI to skip useless Enlisting (#2594)

This commit is contained in:
tool4ever
2023-03-01 10:03:47 +01:00
committed by GitHub
parent f7303b0ab2
commit 048543f74e
3 changed files with 10 additions and 5 deletions

View File

@@ -342,11 +342,16 @@ public class PlayerControllerAi extends PlayerController {
@Override
public List<Card> enlistAttackers(List<Card> attackers) {
CardCollection cards = CostEnlist.getCardsForEnlisting(brains.getPlayer());
ComputerUtilCard.sortByEvaluateCreature(new CardCollection(attackers));
cards = CardLists.filter(cards, CardPredicates.hasGreaterPowerThan(0));
CardCollection chosenAttackers = new CardCollection(attackers);
ComputerUtilCard.sortByEvaluateCreature(chosenAttackers);
// do not enlist more than available payment choices (currently ignores multiple instances of Enlist, but can that even happen?)
attackers = attackers.subList(0, cards.size());
if (attackers.size() > cards.size()) {
chosenAttackers = chosenAttackers.subList(0, cards.size());
}
// TODO check if not needed as defender
return attackers;
return chosenAttackers;
}
@Override