Add infinite loop protection for Stonehewer

This commit is contained in:
Adam Pantel
2021-04-05 18:21:32 -04:00
parent 2e9f050707
commit 9095dcd9d8

View File

@@ -101,15 +101,15 @@ public class CopyPermanentEffect extends TokenEffectBase {
List<Card> choice = Lists.newArrayList();
final String num = sa.hasParam("RandomNum") ? sa.getParam("RandomNum") : "1";
int ncopied = AbilityUtils.calculateAmount(host, num, sa);
while(ncopied > 0) {
while(ncopied > 0 && !copysource.isEmpty()) {
final PaperCard cp = Aggregates.random(copysource);
Card possibleCard = Card.fromPaperCard(cp, activator); // Need to temporarily set the Owner so the Game is set
if (possibleCard.isValid(valid, host.getController(), host, sa)) {
choice.add(possibleCard);
copysource.remove(cp);
ncopied -= 1;
}
copysource.remove(cp);
}
tgtCards = choice;
} else if (sa.hasParam("DefinedName")) {