diff --git a/Mage.Sets/src/mage/sets/lorwyn/MistbindClique.java b/Mage.Sets/src/mage/sets/lorwyn/MistbindClique.java index 30f9b18d79a..8203abe7821 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/MistbindClique.java +++ b/Mage.Sets/src/mage/sets/lorwyn/MistbindClique.java @@ -93,7 +93,7 @@ class MistbindCliqueAbility extends ZoneChangeTriggeredAbility { this.color.setBlack(true); - FilterCreaturePermanent filter = new FilterCreaturePermanent("All creatures of the chosen type"); // As Engineered Plague enters the battlefield, choose a creature type. - this.addAbility(new AsEntersBattlefieldAbility(new EngineeredPlagueEntersBattlefieldEffect(filter), "choose a creature type")); + this.addAbility(new AsEntersBattlefieldAbility(new EngineeredPlagueEntersBattlefieldEffect(), "choose a creature type")); // All creatures of the chosen type get -1/-1. - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostAllEffect(-1, -1, Constants.Duration.WhileOnBattlefield, filter, false))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostAllEffect(-1, -1, Constants.Duration.WhileOnBattlefield, new FilterEngineeredPlague(), false))); } public EngineeredPlague(final EngineeredPlague card) { @@ -76,16 +74,13 @@ public class EngineeredPlague extends CardImpl { class EngineeredPlagueEntersBattlefieldEffect extends OneShotEffect { - private FilterCreaturePermanent filter; - public EngineeredPlagueEntersBattlefieldEffect(FilterCreaturePermanent filter) { + public EngineeredPlagueEntersBattlefieldEffect() { super(Constants.Outcome.Benefit); - this.filter = filter; staticText = "As {this} enters the battlefield, choose a creature type"; } public EngineeredPlagueEntersBattlefieldEffect(final EngineeredPlagueEntersBattlefieldEffect effect) { super(effect); - this.filter = effect.filter; } @Override @@ -100,7 +95,7 @@ public class EngineeredPlague extends CardImpl { game.debugMessage("player canceled choosing type. retrying."); } game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice()); - filter.add(new SubtypePredicate(typeChoice.getChoice())); + game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice().toString()); permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice() + ""); } return false; @@ -113,7 +108,36 @@ public class EngineeredPlague extends CardImpl { } - + class FilterEngineeredPlague extends FilterCreaturePermanent { + + public FilterEngineeredPlague() { + super("All creatures of the chosen type"); + } + + public FilterEngineeredPlague(final FilterEngineeredPlague filter) { + super(filter); + } + + @Override + public FilterEngineeredPlague copy() { + return new FilterEngineeredPlague(this); + } + + @Override + public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) { + if(super.match(permanent, sourceId, playerId, game)){ + String subtype = (String) game.getState().getValue(sourceId + "_type"); + if(subtype != null && !subtype.equals("") && permanent.hasSubtype(subtype)){ + return true; + } + } + return false; + } + + + + } + }