restriction effects for untap phase

This commit is contained in:
magenoxx 2011-08-01 00:46:10 +04:00
parent fe4ba3c590
commit b82d52d34c
2 changed files with 10 additions and 1 deletions

View file

@ -68,5 +68,9 @@ public abstract class RestrictionEffect<T extends RestrictionEffect<T>> extends
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
return true;
}
public boolean canBeUntapped(Permanent permanent, Game game) {
return true;
}
}

View file

@ -52,6 +52,7 @@ import mage.abilities.SpecialAction;
import mage.abilities.SpellAbility;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.PassAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.keyword.*;
import mage.abilities.mana.ManaAbility;
import mage.abilities.mana.ManaOptions;
@ -571,7 +572,11 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
public void untap(Game game) {
//20091005 - 502.2
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(playerId)) {
permanent.untap(game);
boolean untap = true;
for (RestrictionEffect effect : game.getContinuousEffects().getApplicableRestrictionEffects(permanent, game)) {
untap &= effect.canBeUntapped(permanent, game);
}
if (untap) permanent.untap(game);
}
}