spjspj - undo changes to SweepEffect

This commit is contained in:
spjspj 2016-09-09 00:45:47 +10:00
parent d01307e5ea
commit 5bba477147

View file

@ -32,7 +32,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardsImpl; import mage.cards.CardsImpl;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledLandPermanent; import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
@ -49,30 +48,16 @@ import mage.util.CardUtil;
public class SweepEffect extends OneShotEffect { public class SweepEffect extends OneShotEffect {
private final String sweepSubtype; private final String sweepSubtype;
private FilterPermanent setFilter = null;
private boolean notTarget = true;
public SweepEffect(String sweepSubtype) { public SweepEffect(String sweepSubtype) {
super(Outcome.Benefit); super(Outcome.Benefit);
this.sweepSubtype = sweepSubtype; this.sweepSubtype = sweepSubtype;
this.staticText = "<i>Sweep</i> - Return any number of " + sweepSubtype + (sweepSubtype.endsWith("s") ? "" : "s") + " you control to their owner's hand"; this.staticText = "<i>Sweep</i> - Return any number of " + sweepSubtype + (sweepSubtype.endsWith("s") ? "" : "s") + " you control to their owner's hand";
} }
public SweepEffect(FilterPermanent filter, String text, boolean notTarget) {
super(Outcome.Benefit);
this.sweepSubtype = text;
this.staticText = "Return any number of " + text + " you control to their owner's hand";
this.setFilter = filter;
this.notTarget = notTarget;
}
public SweepEffect(final SweepEffect effect) { public SweepEffect(final SweepEffect effect) {
super(effect); super(effect);
this.sweepSubtype = effect.sweepSubtype; this.sweepSubtype = effect.sweepSubtype;
this.setFilter = effect.setFilter;
this.notTarget = effect.notTarget;
} }
@Override @Override
@ -84,15 +69,9 @@ public class SweepEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
FilterPermanent filter; FilterPermanent filter = new FilterControlledLandPermanent(new StringBuilder("any number of ").append(sweepSubtype).append("s you control").toString());
if (setFilter == null) { filter.add(new SubtypePredicate(sweepSubtype));
filter = new FilterControlledLandPermanent(new StringBuilder("any number of ").append(sweepSubtype).append("s you control").toString()); Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
filter.add(new SubtypePredicate(sweepSubtype));
} else {
filter = setFilter;
}
Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, notTarget);
if (controller.chooseTarget(outcome, target, source, game)) { if (controller.chooseTarget(outcome, target, source, game)) {
game.getState().setValue(CardUtil.getCardZoneString("sweep", source.getSourceId(), game), target.getTargets().size()); game.getState().setValue(CardUtil.getCardZoneString("sweep", source.getSourceId(), game), target.getTargets().size());
controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);