mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Add infinite loop protection for Stonehewer
This commit is contained in:
@@ -101,15 +101,15 @@ public class CopyPermanentEffect extends TokenEffectBase {
|
|||||||
List<Card> choice = Lists.newArrayList();
|
List<Card> choice = Lists.newArrayList();
|
||||||
final String num = sa.hasParam("RandomNum") ? sa.getParam("RandomNum") : "1";
|
final String num = sa.hasParam("RandomNum") ? sa.getParam("RandomNum") : "1";
|
||||||
int ncopied = AbilityUtils.calculateAmount(host, num, sa);
|
int ncopied = AbilityUtils.calculateAmount(host, num, sa);
|
||||||
while(ncopied > 0) {
|
while(ncopied > 0 && !copysource.isEmpty()) {
|
||||||
final PaperCard cp = Aggregates.random(copysource);
|
final PaperCard cp = Aggregates.random(copysource);
|
||||||
Card possibleCard = Card.fromPaperCard(cp, activator); // Need to temporarily set the Owner so the Game is set
|
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)) {
|
if (possibleCard.isValid(valid, host.getController(), host, sa)) {
|
||||||
choice.add(possibleCard);
|
choice.add(possibleCard);
|
||||||
copysource.remove(cp);
|
|
||||||
ncopied -= 1;
|
ncopied -= 1;
|
||||||
}
|
}
|
||||||
|
copysource.remove(cp);
|
||||||
}
|
}
|
||||||
tgtCards = choice;
|
tgtCards = choice;
|
||||||
} else if (sa.hasParam("DefinedName")) {
|
} else if (sa.hasParam("DefinedName")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user