Fix a bug with Tawnos Urza's Apprentice caught by the predicate refactor (#5220)

This commit is contained in:
Samuel Sandeen 2018-08-14 22:22:48 -04:00 committed by GitHub
parent a68667e582
commit a94dbe1c9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 2 deletions

View file

@ -17,7 +17,7 @@ import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterStackObject;
import mage.filter.predicate.ability.ArtifactSourcePredicate;
import mage.filter.predicate.other.StackObjectWithArtifactSourcePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -34,7 +34,7 @@ public final class TawnosUrzasApprentice extends CardImpl {
private final static FilterStackObject filter = new FilterStackObject("activated or triggered ability you control from an artifact source");
static {
filter.add(new ArtifactSourcePredicate());
filter.add(new StackObjectWithArtifactSourcePredicate());
filter.add(new ControllerPredicate(TargetController.YOU));
}

View file

@ -0,0 +1,24 @@
package mage.filter.predicate.other;
import mage.MageObject;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.stack.StackObject;
/**
*
*/
public class StackObjectWithArtifactSourcePredicate implements Predicate<StackObject> {
@Override
public boolean apply(StackObject input, Game game) {
MageObject sourceObject = game.getObject(input.getSourceId());
return sourceObject != null && sourceObject.isArtifact();
}
@Override
public String toString() {
return "Source(Artifact)";
}
}