Package mage.filter.predicate.mageobject

Examples of mage.filter.predicate.mageobject.NamePredicate


    @Override
    public boolean apply(Game game, Ability source) {
        Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
        if (targetPermanent != null) {
            FilterCreaturePermanent filter = new FilterCreaturePermanent();
            filter.add(new NamePredicate(targetPermanent.getName()));
            List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
            for (Permanent permanent : permanents) {
                permanent.moveToExile(null, "", source.getSourceId(), game);
            }
            return true;
View Full Code Here


    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
        if (controller != null && cardName != null && !cardName.isEmpty()) {           
            FilterObject filter = new FilterObject("the name [" + cardName + "]");
            filter.add(new NamePredicate(cardName));           
            ContinuousEffect effect = new GainAbilityControllerEffect(new ProtectionAbility(filter), Duration.Custom);
            game.addEffect(effect, source);
            return true;
        }
        return false;
View Full Code Here

        //              including that card, in the zone they're in.
        if (card != null && player != null) {
            Player targetPlayer = game.getPlayer(card.getOwnerId());
            if (targetPlayer != null) {
                FilterCard filter = new FilterCard("card named " + card.getName());
                filter.add(new NamePredicate(card.getName()));

                Cards cardsInLibrary = new CardsImpl(Zone.LIBRARY);
                cardsInLibrary.addAll(targetPlayer.getLibrary().getCards(game));

                // cards in Graveyard
View Full Code Here

            }
           
            // Exile all cards with the same name
            // Building a card filter with the name
            FilterCard filterNamedCards = new FilterCard();
            filterNamedCards.add(new NamePredicate(chosenCard.getName()));                           

            // 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 : owner.getGraveyard().getCards(game)) {
View Full Code Here

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

                if (player.chooseUse(Outcome.PutCardInPlay, sb.toString(), game)) {
                    FilterCard filter = new FilterCard("card named " + cardName);
                    filter.add(new NamePredicate(cardName));
                    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

        List<Permanent> permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game);
        HashSet<String> permanentNames = new HashSet<String>();
        FilterCard filter = new FilterCard("card to put onto the battlefield");
        for (Permanent permanent : permanents) {
            permanentNames.add(permanent.getName());
            filter.add(new NamePredicate(permanent.getName()));
        }

        Player player = game.getPlayer(source.getControllerId());
        if (player == null) {
            return false;
View Full Code Here

        Permanent target = game.getPermanent(source.getFirstTarget());
        if (target == null) {
            return false;
        }
        FilterCreaturePermanent filter = new FilterCreaturePermanent();
        filter.add(new NamePredicate(target.getName()));
        List<Permanent> creatures = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
        if (target != null) {
            for (Permanent creature : creatures) {
                if (creature != null) {
                    creature.damage(4, id, game, false, true);
View Full Code Here

    public int calculate(Game game, Ability sourceAbility, Effect effect) {
        int value = 0;
        Permanent permanent = game.getPermanent(sourceAbility.getSourceId());
        if (permanent != null && permanent.getImprinted().size() > 0) {
            FilterPermanent filterPermanent = new FilterPermanent();
            filterPermanent.add(new NamePredicate(game.getCard(permanent.getImprinted().get(0)).getName()));
            value = game.getBattlefield().count(filterPermanent, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game);
        }
        return value;
    }
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

            Cards cards = new CardsImpl();
            cards.addAll(player.getLibrary().getCards(game));
            playerControls.revealCards("Library", cards, game);
            FilterCard filter = new FilterCard();
            filter.add(new NamePredicate(cardChoice.getChoice()));
            int count = Integer.parseInt(numberChoice.getChoice());
            if (player.getLibrary().count(filter, game) == count) {
                player.damage(8, source.getSourceId(), game.copy(), false, true);
            }
            player.shuffleLibrary(game);
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.