Adding support for "divided as you choose"

I'm trying to add support for "divided as you choose between any number of targets", specifically for DealDamage at this stage, but most of the affected code is common to all the AFs so it's just tweaking the AI targeting and stackDescription.
So far I've got it working well for the human (I'll tackle the AI afterwards) except that you can't select a target more than once. In spellability.TargetSelection.chooseValidInput is the code that (as far as I can tell) removes a card that's already been targeted from the list, but nothing I try seems to bypass it. Is there somewhere else that prevents a target being selected twice? Otherwise I can't see why this shouldn't work:
Please help!
Edit: There's definitely something else preventing the selection. I tried commenting out that whole bit and I still couldn't select a creature twice. Maybe this is only for spells, not abilities. Back to the digging...
So far I've got it working well for the human (I'll tackle the AI afterwards) except that you can't select a target more than once. In spellability.TargetSelection.chooseValidInput is the code that (as far as I can tell) removes a card that's already been targeted from the list, but nothing I try seems to bypass it. Is there somewhere else that prevents a target being selected twice? Otherwise I can't see why this shouldn't work:
- Code: Select all
final ArrayList<Card> targeted = tgt.getTargetCards();
if (!this.ability.getAbilityFactory().getMapParams().containsKey("DividedAsYouChoose")) {
for (final Card c : targeted) {
if (choices.contains(c)) {
choices.remove(c);
}
}
}

Edit: There's definitely something else preventing the selection. I tried commenting out that whole bit and I still couldn't select a creature twice. Maybe this is only for spells, not abilities. Back to the digging...