spjspj - Fix possible npe for Clockspinning and change return code from apply. Also fix possible npe for adding counters

This commit is contained in:
spjspj 2016-06-09 01:23:19 +10:00
parent 4187b83f57
commit b751e69eec
2 changed files with 31 additions and 26 deletions

View file

@ -66,7 +66,7 @@ public class Clockspinning extends CardImpl {
this.getSpellAbility().addTarget(new TargetPermanentOrSuspendedCard());
this.getSpellAbility().addEffect(new ClockspinningAddOrRemoveCounterEffect());
}
public Clockspinning(final Clockspinning card) {
super(card);
}
@ -159,26 +159,33 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect {
if (player.chooseUse(Outcome.Neutral, "Do you want to to remove a counter?", source, game)) {
RemoveCounterTargetEffect effect = new RemoveCounterTargetEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
return effect.apply(game, source);
effect.apply(game, source);
} else {
Counter counter = selectCounterType(game, source, permanent);
AddCountersTargetEffect effect = new AddCountersTargetEffect(counter);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
return effect.apply(game, source);
if (counter != null) {
AddCountersTargetEffect effect = new AddCountersTargetEffect(counter);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
effect.apply(game, source);
}
}
return true;
}
if (player != null && card != null) {
if (player.chooseUse(Outcome.Neutral, "Do you want to to remove a counter?", source, game)) {
Counter counter = selectCounterType(game, source, card);
RemoveCounterTargetEffect effect = new RemoveCounterTargetEffect(counter);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
return effect.apply(game, source);
effect.apply(game, source);
} else {
Counter counter = selectCounterType(game, source, card);
AddCountersTargetEffect effect = new AddCountersTargetEffect(counter);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
return effect.apply(game, source);
if (counter != null) {
AddCountersTargetEffect effect = new AddCountersTargetEffect(counter);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
effect.apply(game, source);
}
}
return true;
}
return false;