- Fix crash related to ChangeTargets and SA/subSAs without a target. SubAbilities can now have their targets changed

This commit is contained in:
Sol
2013-05-10 23:03:42 +00:00
parent ad5cecdbc5
commit ba644b69fc
3 changed files with 14 additions and 3 deletions

View File

@@ -28,8 +28,15 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
// If there isn't a Stack Instance, there isn't really a target
continue;
}
// Update targets, with a potential new target
si.updateTarget(sa.getActivatingPlayer().getController().chooseTargets(tgtSA));
SpellAbilityStackInstance changingTgtSI = si;
while(changingTgtSI != null) {
// Update targets, with a potential new target
SpellAbility changingTgtSA = changingTgtSI.getSpellAbility();
changingTgtSI.updateTarget(sa.getActivatingPlayer().getController().chooseTargets(changingTgtSA));
changingTgtSI = changingTgtSI.getSubInstace();
}
if (remember) {
sa.getSourceCard().addRemembered(tgtSA.getSourceCard());
}

View File

@@ -416,6 +416,9 @@ public class PlayerControllerHuman extends PlayerController {
*/
@Override
public Target chooseTargets(SpellAbility ability) {
if (ability.getTarget() == null) {
return null;
}
Target oldTarget = new Target(ability.getTarget());
TargetSelection select = new TargetSelection(ability);
ability.getTarget().resetTargets();