mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Better fix for that concurrent modification exception. Don't know what I was thinking.
This commit is contained in:
@@ -29,9 +29,7 @@ import forge.game.trigger.Trigger;
|
|||||||
import forge.game.trigger.TriggerType;
|
import forge.game.trigger.TriggerType;
|
||||||
import forge.util.FCollectionView;
|
import forge.util.FCollectionView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,14 +115,17 @@ public class AiBlockController {
|
|||||||
ComputerUtilCard.sortByEvaluateCreature(attackers);
|
ComputerUtilCard.sortByEvaluateCreature(attackers);
|
||||||
CardLists.sortByPowerDesc(attackers);
|
CardLists.sortByPowerDesc(attackers);
|
||||||
//move cards like Phage the Untouchable to the front
|
//move cards like Phage the Untouchable to the front
|
||||||
List<Card> prioritizedAttackers = new ArrayList<>();
|
Collections.sort(attackers, new Comparator<Card>() {
|
||||||
for (Card attacker : attackers) {
|
@Override
|
||||||
if (attacker.hasSVar("MustBeBlocked")) {
|
public int compare(final Card o1, final Card o2) {
|
||||||
prioritizedAttackers.add(attacker);
|
if (o1.hasSVar("MustBeBlocked") && !o2.hasSVar("MustBeBlocked")) {
|
||||||
|
return -1;
|
||||||
|
} else if (!o1.hasSVar("MustBeBlocked") && o2.hasSVar("MustBeBlocked")) {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
attackers.removeAll((Iterable<Card>) prioritizedAttackers);
|
});
|
||||||
attackers.addAll(0, prioritizedAttackers);
|
|
||||||
return attackers;
|
return attackers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user