mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Attempting to fix a potential ConcurrentModificationException in ChangeZone AI.
This commit is contained in:
@@ -1098,12 +1098,16 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
// vs. two cards in the second player's graveyard, which cards are more relevant to be targeted, etc.). Consider improving.
|
||||
if (sa.getTargetRestrictions().isSingleZone()) {
|
||||
Card firstTgt = sa.getTargets().getFirstTargetedCard();
|
||||
CardCollection toRemove = new CardCollection();
|
||||
if (firstTgt != null) {
|
||||
for (Card t : sa.getTargets().getTargetCards()) {
|
||||
if (!t.getController().equals(firstTgt.getController())) {
|
||||
sa.getTargets().remove(t);
|
||||
toRemove.add(t);
|
||||
}
|
||||
}
|
||||
for (Card dontTarget : toRemove) {
|
||||
sa.getTargets().remove(dontTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user