diff --git a/Mage.Sets/src/mage/cards/m/MoggInfestation.java b/Mage.Sets/src/mage/cards/m/MoggInfestation.java index 87ec162f9f..26665315ae 100644 --- a/Mage.Sets/src/mage/cards/m/MoggInfestation.java +++ b/Mage.Sets/src/mage/cards/m/MoggInfestation.java @@ -1,4 +1,3 @@ - package mage.cards.m; import java.util.UUID; @@ -6,8 +5,11 @@ import mage.abilities.Ability; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenTargetEffect; +import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Zone; @@ -62,16 +64,27 @@ class MoggInfestationEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && getTargetPointer().getFirst(game, source) != null) { + Cards creaturesDied = new CardsImpl(); + if (controller != null + && getTargetPointer().getFirst(game, source) != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, getTargetPointer().getFirst(game, source), game)) { if (permanent.destroy(source, game, false)) { if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) { // If a commander is replaced to command zone, the creature does not die - Effect effect = new CreateTokenTargetEffect(new GoblinToken(), 2); - effect.setTargetPointer(getTargetPointer()); - effect.apply(game, source); + creaturesDied.add(permanent); } } } + game.getState().processAction(game); // Bug #8548 + if (creaturesDied.isEmpty()) { + return true; + } + for (Card c : creaturesDied.getCards(game)) { + if (game.getState().getZone(c.getId()) == Zone.GRAVEYARD) { + Effect effect = new CreateTokenTargetEffect(new GoblinToken(), 2); + effect.setTargetPointer(getTargetPointer()); + effect.apply(game, source); + } + } return true; } return false;