Commit 4a7bb4e0 authored by Michael Kamensky's avatar Michael Kamensky

Merge branch 'verifyTransitivity2' into 'master'

AiController: only do verifyTransitivity when sort failed

See merge request !2238
parents a0715818 44bcc726
......@@ -59,6 +59,7 @@ import forge.item.PaperCard;
import forge.util.Aggregates;
import forge.util.Expressions;
import forge.util.MyRandom;
import forge.util.ComparatorUtil;
import forge.util.collect.FCollectionView;
import io.sentry.Sentry;
import io.sentry.event.BreadcrumbBuilder;
......@@ -609,8 +610,14 @@ public class AiController {
ComputerUtilAbility.getAvailableCards(game, player);
List<SpellAbility> all = ComputerUtilAbility.getSpellAbilities(cards, player);
//ComparatorUtil.verifyTransitivity(saComparator, all); // FIXME: only use this for testing, it lags too much
Collections.sort(all, saComparator); // put best spells first
try {
Collections.sort(all, saComparator); // put best spells first
}
catch (IllegalArgumentException ex) {
System.err.println(ex.getMessage());
ComparatorUtil.verifyTransitivity(saComparator, all);
}
for (final SpellAbility sa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, player)) {
ApiType saApi = sa.getApi();
......@@ -1573,8 +1580,13 @@ public class AiController {
if (all == null || all.isEmpty())
return null;
//ComparatorUtil.verifyTransitivity(saComparator, all); // FIXME: only use this for testing, otherwise it lags too much
Collections.sort(all, saComparator); // put best spells first
try {
Collections.sort(all, saComparator); // put best spells first
}
catch (IllegalArgumentException ex) {
System.err.println(ex.getMessage());
ComparatorUtil.verifyTransitivity(saComparator, all);
}
for (final SpellAbility sa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, player)) {
// Don't add Counterspells to the "normal" playcard lookups
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment