diff --git a/Mage.Sets/src/mage/cards/o/OchreJelly.java b/Mage.Sets/src/mage/cards/o/OchreJelly.java index 7fb3326d3d..36dd3fc023 100644 --- a/Mage.Sets/src/mage/cards/o/OchreJelly.java +++ b/Mage.Sets/src/mage/cards/o/OchreJelly.java @@ -47,9 +47,9 @@ public final class OchreJelly extends CardImpl { new DiesSourceTriggeredAbility(new CreateDelayedTriggeredAbilityEffect( new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new OchreJellyEffect()) )), OchreJellyCondition.instance, CardUtil.italicizeWithEmDash("Split") - + "When {this} dies, if it had two or more +1/+1 counters on it, " + - "create a token that's a copy of it at the beginning of the next end step. " + - "The token enters the battlefield with half that many +1/+1 counters on it, rounded down." + + "When {this} dies, if it had two or more +1/+1 counters on it, " + + "create a token that's a copy of it at the beginning of the next end step. " + + "The token enters the battlefield with half that many +1/+1 counters on it, rounded down." )); } @@ -95,13 +95,10 @@ class OchreJellyEffect extends OneShotEffect { if (permanent == null) { return false; } - CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(); + final int counters = permanent.getCounters(game).getCount(CounterType.P1P1) / 2; + CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(CounterType.P1P1, counters); effect.setSavedPermanent(permanent); effect.apply(game, source); - int counters = permanent.getCounters(game).getCount(CounterType.P1P1) / 2; - for (Permanent token : effect.getAddedPermanent()) { - permanent.addCounters(CounterType.P1P1.createInstance(counters), source.getControllerId(), source, game); - } return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java index 2e654033f6..940c1932b5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import mage.counters.CounterType; /** * @author LevelX2 @@ -50,6 +51,8 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect { private int startingLoyalty = -1; private final List additionalAbilities = new ArrayList(); private Permanent savedPermanent = null; + private CounterType counter; + private int numberOfCounters; public CreateTokenCopyTargetEffect(boolean useLKI) { this(); @@ -60,6 +63,12 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect { this((UUID) null); } + public CreateTokenCopyTargetEffect(CounterType counter, int numberOfCounters) { + this((UUID) null); + this.counter = counter; + this.numberOfCounters = numberOfCounters; + } + public CreateTokenCopyTargetEffect(UUID playerId) { this(playerId, null, false); } @@ -73,11 +82,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect { } /** - * @param playerId null the token is controlled/owned by the - * controller of the source ability + * @param playerId null the token is controlled/owned by the controller of + * the source ability * @param additionalCardType the token gains this card type in addition - * @param hasHaste the token gains haste - * @param number number of tokens to put into play + * @param hasHaste the token gains haste + * @param number number of tokens to put into play * @param tapped * @param attacking */ @@ -220,6 +229,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect { Permanent tokenPermanent = game.getPermanent(tokenId); if (tokenPermanent != null) { addedTokenPermanents.add(tokenPermanent); + // add counters if necessary ie Ochre Jelly + if (counter != null + && numberOfCounters > 0) { + tokenPermanent.addCounters(counter.createInstance(numberOfCounters), source.getControllerId(), source, game); + } } } return true;