Package mage.filter.predicate.mageobject

Examples of mage.filter.predicate.mageobject.NamePredicate


                    targetPlayer.damage(3 * cardsFound, source.getSourceId(), game, false, true);
                }
                // Exile all cards with the same name
                // Building a card filter with the name
                FilterCard filterNamedCards = new FilterCard();
                filterNamedCards.add(new NamePredicate(cardName));

                // The cards you're searching for must be found and exiled if they're in the graveyard because it's a public zone.
                // Finding those cards in the hand and library is optional, because those zones are hidden (even if the hand is temporarily revealed).
                // search cards in graveyard
                for (Card checkCard : targetPlayer.getGraveyard().getCards(game)) {
View Full Code Here


                // Building a card filter with all names
                ArrayList<NamePredicate> names = new ArrayList<>();
                FilterCard filterNamedCards = new FilterCard();
                for (Card card: exiledCards.getCards(game)) {
                    if (exiledCards.size() == 1) {
                        filterNamedCards.add(new NamePredicate(card.getName()));
                    } else {
                        names.add(new NamePredicate(card.getName()));                           
                    }
                }
                if (exiledCards.size() > 1) {
                    filterNamedCards.add(Predicates.or(names));
                }
View Full Code Here

                StringBuilder sb = new StringBuilder();
                sb.append("Search for ").append(creatureName).append(" in your library?");

                if (player.chooseUse(Outcome.PutCreatureInPlay, sb.toString(), game)) {
                    FilterCreatureCard filter = new FilterCreatureCard("creature card named" + creatureName);
                    filter.add(new NamePredicate(creatureName));
                    TargetCardInLibrary target = new TargetCardInLibrary(filter);

                    if (player.searchLibrary(target, game)) {
                        Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                        if (card != null) {
View Full Code Here

                }
            }
            if (!cardName.isEmpty()) {
                ExileZone searchTheCityExileZone = game.getExile().getExileZone(this.getSourceId());
                FilterCard filter = new FilterCard();
                filter.add(new NamePredicate(cardName));
               
                if (searchTheCityExileZone.count(filter, game) > 0) {
                    this.getEffects().get(0).setValue("cardName",cardName);
                    return true;
                }
View Full Code Here

            for (Card card: targetPlayer.getGraveyard().getCards(game)) {
                if (!filter.match(card, game)) {
                    card.moveToExile(null, "", source.getSourceId(), game);

                    FilterCard filterCard = new FilterCard("cards named " + card.getName());
                    filterCard.add(new NamePredicate(card.getName()));
                    int count = targetPlayer.getLibrary().count(filterCard, game);
                    TargetCardInLibrary target = new TargetCardInLibrary(count, count, filterCard);

                    player.searchLibrary(target, game, targetPlayer.getId());
                    List<UUID> targets = target.getTargets();
View Full Code Here

        }
        else
        {
            for (UUID cardToCheck : cardsToCheck) {
                FilterCard nameFilter = new FilterCard();
                nameFilter.add(new NamePredicate(game.getCard(cardToCheck).getName()));
                if (cardsToCheck.count(nameFilter, game) > 1) {
                   newPossibleTargets.add(cardToCheck);
                }
            }
        }
View Full Code Here

            cardsToCheck.add(card.getId());
        }
        int possibleCards = 0;
        for (UUID cardToCheck : cardsToCheck) {
            FilterCard nameFilter = new FilterCard();
            nameFilter.add(new NamePredicate(game.getCard(cardToCheck).getName()));
            if (cardsToCheck.count(nameFilter, game) > 1) {
               ++possibleCards;
            }
        }
        return possibleCards > 0;
View Full Code Here

                    if (card2 != null && card2.getName().equals(card.getName())) {
                        return true;
                    }
                } else {
                    FilterCard nameFilter = new FilterCard();
                    nameFilter.add(new NamePredicate(card.getName()));
                    Player player = game.getPlayer(card.getOwnerId());
                    if (player.getHand().getCards(nameFilter, game).size() > 1) {
                        return true;
                   }
                }
View Full Code Here

            if (player != null && targetPlayer != null) {
                // get the names of attached Curses
                for (UUID attachmentId: targetPlayer.getAttachments()) {
                    Permanent attachment = game.getPermanent(attachmentId);
                    if (attachment != null && attachment.getSubtype().contains("Curse")) {
                        filter.add(Predicates.not(new NamePredicate(attachment.getName())));
                    }
                }

                TargetCardInLibrary targetCard = new TargetCardInLibrary(filter);
                if (player.searchLibrary(targetCard, game)) {
View Full Code Here

           
            // Exile all cards with the same name
            // Building a card filter with the name
            FilterCard filterNamedCards = new FilterCard();
            if (chosenCard != null) {
                filterNamedCards.add(new NamePredicate(chosenCard.getName()));                           
            } else {
                filterNamedCards.add(new NamePredicate("----")); // so no card matches
            }

            // The cards you're searching for must be found and exiled if they're in the graveyard because it's a public zone.
            // Finding those cards in the hand and library is optional, because those zones are hidden (even if the hand is temporarily revealed).
            // search cards in graveyard
View Full Code Here

TOP

Related Classes of mage.filter.predicate.mageobject.NamePredicate

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.