diff --git a/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java b/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java index 468523e97e..293ffeb4c9 100644 --- a/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java +++ b/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java @@ -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; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index 682ff1a27c..f8efacad7e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -82,28 +82,26 @@ public class AddCountersTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); - if (controller != null && sourceObject != null) { + if (controller != null && sourceObject != null && counter != null) { int affectedTargets = 0; for (UUID uuid : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(uuid); Player player = game.getPlayer(uuid); Card card = game.getCard(targetPointer.getFirst(game, source)); if (permanent != null) { - if (counter != null) { - Counter newCounter = counter.copy(); - int calculated = amount.calculate(game, source, this); - if (calculated > 0 && newCounter.getCount() > 0) { - newCounter.remove(newCounter.getCount()); - } - newCounter.add(calculated); - int before = permanent.getCounters().getCount(counter.getName()); - permanent.addCounters(newCounter, game); - int numberAdded = permanent.getCounters().getCount(counter.getName()) - before; - affectedTargets++; - if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " - + numberAdded + " " + counter.getName().toLowerCase() + " counter on " + permanent.getLogName()); - } + Counter newCounter = counter.copy(); + int calculated = amount.calculate(game, source, this); + if (calculated > 0 && newCounter.getCount() > 0) { + newCounter.remove(newCounter.getCount()); + } + newCounter.add(calculated); + int before = permanent.getCounters().getCount(counter.getName()); + permanent.addCounters(newCounter, game); + int numberAdded = permanent.getCounters().getCount(counter.getName()) - before; + affectedTargets++; + if (!game.isSimulation()) { + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + + numberAdded + " " + counter.getName().toLowerCase() + " counter on " + permanent.getLogName()); } } else if (player != null) { Counter newCounter = counter.copy(); @@ -114,7 +112,7 @@ public class AddCountersTargetEffect extends OneShotEffect { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + " " + counter.getName().toLowerCase() + " counter on " + player.getLogName()); } - } else if (card != null && counter != null) { + } else if (card != null) { card.addCounters(counter.getName(), counter.getCount(), game); if (!game.isSimulation()) { game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(" ").append(counter.getName())