Package mage.filter.predicate.other

Examples of mage.filter.predicate.other.OwnerIdPredicate


        this(numTargets, numTargets, filter, playerId);
    }

    public TargetDiscard(int minNumTargets, int maxNumTargets, FilterCard filter, UUID playerId) {
        super(minNumTargets, maxNumTargets, Zone.HAND, filter);
        this.filter.add(new OwnerIdPredicate(playerId));
        this.playerId = playerId;
        this.targetName = "card to discard";
    }
View Full Code Here


        if (event instanceof DamagedPlayerEvent
                && ((DamagedPlayerEvent) event).isCombatDamage()
                && event.getSourceId().equals(sourceId)) {

            FilterCard filter = new FilterCard("up to two target cards from that player's graveyard");
            filter.add(new OwnerIdPredicate(event.getPlayerId()));
            filter.setMessage("up to two cards in " + game.getPlayer(event.getTargetId()).getName() + "'s graveyard");
            this.getTargets().clear();
            this.addTarget(new TargetCardInOpponentsGraveyard(0,2,filter));
            return true;
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player you = game.getPlayer(source.getControllerId());
        Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));

        filter.add(new OwnerIdPredicate(damagedPlayer.getId()));
        filter.add(Predicates.or(
                new CardTypePredicate(CardType.INSTANT),
                new CardTypePredicate(CardType.SORCERY)));

        Target target = new TargetCardInGraveyard(filter);
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
        Player you = game.getPlayer(source.getControllerId());
        FilterCard filter = new FilterCard("creature in that player's graveyard");
        filter.add(new CardTypePredicate(CardType.CREATURE));
        filter.add(new OwnerIdPredicate(damagedPlayer.getId()));
        TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
        if (target.canChoose(source.getSourceId(), you.getId(), game)) {
            if (you.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
View Full Code Here

        game.informPlayers("Worldpurge: All permanents returned to owners' hands");
        for (Player player : game.getPlayers().values()) {
            if (player != null) {
                Cards hand = player.getHand();
                FilterCard filter = new FilterCard("card to keep in hand");
                filter.add(new OwnerIdPredicate(player.getId()));
                int numberInHand = Math.min(7, hand.size());
                TargetCardInHand target = new TargetCardInHand(0, numberInHand, filter);
                if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
                    for (Card card : hand.getCards(game)) {
                        if (!target.getTargets().contains(card.getId())) {
View Full Code Here

            for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
                Player opponent = game.getPlayer(opponentId);
                if (opponent != null) {
                    ability.getTargets().clear();
                    FilterCard filter = new FilterCreatureCard(new StringBuilder("creature card from ").append(opponent.getName()).append("'s graveyard").toString());
                    filter.add(new OwnerIdPredicate(opponentId));
                    TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0,1, filter);
                    ability.addTarget(target);
                }
            }
        }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
        Player you = game.getPlayer(source.getControllerId());
        FilterCard filter = new FilterCard("creature in that player's graveyard");
        filter.add(new CardTypePredicate(CardType.CREATURE));
        filter.add(new OwnerIdPredicate(damagedPlayer.getId()));
        TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
        if (target.canChoose(source.getSourceId(), you.getId(), game)) {
            if (you.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player targetPlayer = game.getPlayer(source.getFirstTarget());
        if (targetPlayer != null) {
            FilterCard filter = new FilterCard("card from your graveyard");
            filter.add(new OwnerIdPredicate(targetPlayer.getId()));
            TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
            if (targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
                    targetPlayer.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD);
View Full Code Here

        // add all creatures in range
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            for (UUID playerId : controller.getInRange()) {
                FilterPermanent playerFilter = filter.copy();
                playerFilter.add(new OwnerIdPredicate(playerId));
                for (Permanent permanent :game.getBattlefield().getActivePermanents(playerFilter, playerId, game)) {
                    objects.add(permanent.getId());
                }
            }
        }
View Full Code Here

        for (UUID playerId : controller.getInRange()) {
            Player player = game.getPlayer(playerId);
            if (player != null) {
                FilterCreatureCard filterCreatureCard = new FilterCreatureCard("creature card from your graveyard");
                filterCreatureCard.add(new OwnerIdPredicate(playerId));
                TargetCardInGraveyard target = new TargetCardInGraveyard(filterCreatureCard);
                if (target.canChoose(playerId, game) &&
                        player.chooseTarget(outcome, target, source, game)) {
                    Card card = game.getCard(target.getFirstTarget());
                    if (card != null) {
View Full Code Here

TOP

Related Classes of mage.filter.predicate.other.OwnerIdPredicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.