This commit is contained in:
Evan Kranzler 2017-08-23 12:14:21 -04:00
parent c6029176d3
commit f1ba86f552

View file

@ -40,6 +40,7 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
@ -57,7 +58,6 @@ public class WarsToll extends CardImpl {
private final static FilterCreaturePermanent filterOpponentCreature = new FilterCreaturePermanent("creature an opponent controls");
private final static FilterLandPermanent filterOpponentLand = new FilterLandPermanent("an opponent taps a land");
static {
filterOpponentCreature.add(new ControllerPredicate(TargetController.OPPONENT));
filterOpponentLand.add(new ControllerPredicate(TargetController.OPPONENT));
@ -86,6 +86,42 @@ public class WarsToll extends CardImpl {
}
}
class TapAlEffect extends OneShotEffect {
protected FilterPermanent filter;
public TapAlEffect(FilterPermanent filter) {
super(Outcome.Tap);
this.filter = filter;
setText();
}
public TapAlEffect(final TapAlEffect effect) {
super(effect);
this.filter = effect.filter.copy();
}
@Override
public TapAlEffect copy() {
return new TapAlEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
if (permanent.getControllerId().equals(source.getFirstTarget())) {
permanent.tap(game);
}
}
return true;
}
private void setText() {
staticText = "tap all " + filter.getMessage();
}
}
class WarsTollEffect extends OneShotEffect {
private static final FilterCreaturePermanent filterOpponentCreatures = new FilterCreaturePermanent();