From 1132bb8eb2ae0916e4374cfb2eb41d93b81a8352 Mon Sep 17 00:00:00 2001 From: Styxo Date: Mon, 28 Mar 2016 19:11:22 +0200 Subject: [PATCH] Untap All Lands Effect - Added Filter --- .../common/UntapAllLandsControllerEffect.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/common/UntapAllLandsControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/UntapAllLandsControllerEffect.java index 0c41f9cd9f..7e18047427 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/UntapAllLandsControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/UntapAllLandsControllerEffect.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.effects.common; import mage.constants.Outcome; @@ -40,23 +39,32 @@ import mage.players.Player; * * @author Viserion */ - public class UntapAllLandsControllerEffect extends OneShotEffect { + private final FilterLandPermanent filter; + public UntapAllLandsControllerEffect() { super(Outcome.Untap); staticText = "Untap all lands you control"; + filter = new FilterLandPermanent(); } public UntapAllLandsControllerEffect(final UntapAllLandsControllerEffect effect) { super(effect); + this.filter = effect.filter; + } + + public UntapAllLandsControllerEffect(FilterLandPermanent filter) { + super(Outcome.Untap); + staticText = "Untap all " + filter.getMessage() + " you control"; + this.filter = filter; } @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - for (Permanent land: game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(), player.getId(), game)) { + for (Permanent land : game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) { land.untap(game); } return true; @@ -69,4 +77,4 @@ public class UntapAllLandsControllerEffect extends OneShotEffect { return new UntapAllLandsControllerEffect(this); } -} \ No newline at end of file +}