mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Untap All Lands Effect - Added Filter
This commit is contained in:
parent
c4081c8020
commit
1132bb8eb2
1 changed files with 12 additions and 4 deletions
|
@ -25,7 +25,6 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -40,23 +39,32 @@ import mage.players.Player;
|
||||||
*
|
*
|
||||||
* @author Viserion
|
* @author Viserion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class UntapAllLandsControllerEffect extends OneShotEffect {
|
public class UntapAllLandsControllerEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private final FilterLandPermanent filter;
|
||||||
|
|
||||||
public UntapAllLandsControllerEffect() {
|
public UntapAllLandsControllerEffect() {
|
||||||
super(Outcome.Untap);
|
super(Outcome.Untap);
|
||||||
staticText = "Untap all lands you control";
|
staticText = "Untap all lands you control";
|
||||||
|
filter = new FilterLandPermanent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UntapAllLandsControllerEffect(final UntapAllLandsControllerEffect effect) {
|
public UntapAllLandsControllerEffect(final UntapAllLandsControllerEffect effect) {
|
||||||
super(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
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
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);
|
land.untap(game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue