* Fixed a problem with replacement effects that add counters were applied more than once to the same EnteresTheBattlefield event (fixes #2872).

This commit is contained in:
LevelX2 2017-04-01 17:43:17 +02:00
parent 94f77675ec
commit d0bf77cedf
25 changed files with 302 additions and 104 deletions

View file

@ -1,5 +1,7 @@
package mage.abilities.keyword;
import java.util.ArrayList;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
import mage.abilities.common.DiesTriggeredAbility;
@ -159,7 +161,8 @@ class ModularDistributeCounterEffect extends OneShotEffect {
if (sourcePermanent != null && targetArtifact != null && player != null) {
int numberOfCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
if (numberOfCounters > 0) {
targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), source, game);
ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), source, game, appliedEffects);
}
return true;
}