- Improved Cipher AI.

This commit is contained in:
Sloth
2013-04-21 09:04:21 +00:00
parent 0efbdfb006
commit 889305842b

View File

@@ -671,16 +671,24 @@ public class AiController {
case Encode: case Encode:
if (logic == null) { if (logic == null) {
List<Card> attackers = CardLists.filter(options, new Predicate<Card>() { final List<Card> attackers = CardLists.filter(options, new Predicate<Card>() {
@Override @Override
public boolean apply(final Card c) { public boolean apply(final Card c) {
return CombatUtil.canAttackNextTurn(c); return CombatUtil.canAttackNextTurn(c);
} }
}); });
if (attackers.isEmpty()) { final List<Card> unblockables = CardLists.filter(options, new Predicate<Card>() {
choice = ComputerUtilCard.getBestAI(options); @Override
} else { public boolean apply(final Card c) {
return CombatUtil.canBeBlocked(c);
}
});
if (!unblockables.isEmpty()) {
choice = ComputerUtilCard.getBestAI(unblockables);
} else if (!attackers.isEmpty()) {
choice = ComputerUtilCard.getBestAI(attackers); choice = ComputerUtilCard.getBestAI(attackers);
} else {
choice = ComputerUtilCard.getBestAI(options);
} }
} }
return choice; return choice;