Untap All Lands Effect - Added Filter

This commit is contained in:
Styxo 2016-03-28 19:11:22 +02:00
parent c4081c8020
commit 1132bb8eb2

View file

@ -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;