Fabricate: if the only option is to create servo tokens, just do that. Avoids IndexOutOfBoundsException.

This commit is contained in:
Luke Way
2018-03-12 12:56:17 -04:00
parent 90fc791aac
commit 2c5a845d1a

View File

@@ -236,6 +236,12 @@ public class ChooseGenericEffectAi extends SpellAbilityAi {
return Aggregates.random(spells);
} else if (logic.startsWith("Fabricate")) {
final int n = Integer.valueOf(logic.substring("Fabricate".length()));
if(spells.size() < 2) {
// If the creature is no longer on the battlefield, the option
// to add counters is already removed at this point. Return the
// only available option: create servo tokens.
return spells.get(0);
}
SpellAbility counterSA = spells.get(0), tokenSA = spells.get(1);
// check for something which might prevent the counters to be placed on host