Package mage.filter.predicate.mageobject

Examples of mage.filter.predicate.mageobject.ConvertedManaCostPredicate


        if (controller == null) {
            return false;
        }
        FilterPermanentCard filter = new FilterPermanentCard("permanent card with converted mana cost X or less");
        //Set the mana cost one higher to 'emulate' a less than or equal to comparison.
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));
        TargetCardInLibrary target = new TargetCardInLibrary(filter);
        if (controller.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
                if (card != null) {
View Full Code Here


            cards.add(card);
        }
        if (cards.size() > 0) {
            controller.revealCards(sourceObject.getLogName(), cards, game);
            FilterCard filter = new FilterCard("cards with converted mana cost " + xValue + " or less to put onto the battlefield");
            filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, xValue + 1));
            filter.add(
                    Predicates.or(new CardTypePredicate(CardType.ARTIFACT),
                                     new CardTypePredicate(CardType.CREATURE),
                                     new CardTypePredicate(CardType.ENCHANTMENT),
                                     new CardTypePredicate(CardType.LAND),
View Full Code Here

                cmc = ((PayVariableLoyaltyCost) cost).getAmount();
            }
        }

        FilterArtifactCard filter = new FilterArtifactCard(new StringBuilder("artifact card with converted mana cost ").append(cmc).append(" or less").toString());
        filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, cmc + 1));
        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

    @Override
    public void adjustTargets(Ability ability, Game game) {
        ability.getTargets().clear();
        int xValue = ability.getManaCostsToPay().getX();
        FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue +  " or less from your graveyard");
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue + 1));
        ability.getTargets().add(new TargetCardInYourGraveyard(filter));
    }
View Full Code Here

        int xValue = source.getManaCostsToPay().getX() + 1;
        FilterCard filter = new FilterCard("green creature card with converted mana cost " + xValue + " or less");
        filter.add(new ColorPredicate(ObjectColor.GREEN));
        filter.add(new CardTypePredicate(CardType.CREATURE));
       
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue));
        TargetCardInLibrary target = new TargetCardInLibrary(filter);
        if (player.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                if (card != null) {
View Full Code Here

    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof SimpleActivatedAbility) {
            int xValue = ability.getManaCostsToPay().getX();
            ability.getTargets().clear();
            FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost " + xValue);
            filter.add(new ConvertedManaCostPredicate(ComparisonType.Equal, xValue));
            ability.getTargets().add(new TargetCreaturePermanent(filter));
        }
    }
View Full Code Here

            if (!game.replaceEvent(event)) {
                int manaCostLeftToFetch = 6;
                int librarySearchLimit = event.getAmount();
               
                FilterCard filter = new FilterCreatureCard("number of creature cards with total converted mana cost 6 or less (6 CMC left)");
                filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, manaCostLeftToFetch + 1));
                TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
                target.setCardLimit(librarySearchLimit);

                while (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
                    target.choose(Outcome.PutCreatureInPlay, source.getControllerId(), source.getControllerId(), game);
                    Card card = player.getLibrary().remove(target.getFirstTarget(), game);
                    if (card == null) {
                        break;
                    }
                    cardsPicked.add(card);
                    game.setZone(card.getId(), Zone.PICK);
                    game.getState().getLookedAt(source.getControllerId()).add("Protean Hulk", cardsPicked);
                   
                    librarySearchLimit--;
                    if (librarySearchLimit == 0) {
                        break;
                    }
                    manaCostLeftToFetch -= card.getManaCost().convertedManaCost();
                    filter = new FilterCreatureCard("number of creature cards with total converted mana cost 6 or less ("+ manaCostLeftToFetch +" CMC left)");
                    filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, manaCostLeftToFetch + 1));
                    target = new TargetCardInLibrary(0, 1, filter);
                    target.setCardLimit(librarySearchLimit);
                }
                game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SEARCHED, source.getControllerId(), source.getControllerId()));
            }
View Full Code Here

        cardsInLibrary.addAll(player.getLibrary().getCards(game));

        for (int cmc=3; cmc > 0; cmc--) {
            FilterCard filter = new FilterCard("instant card with converted mana cost " + cmc);
            filter.add(new CardTypePredicate(CardType.INSTANT));
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));


            cardsCount = cardsInLibrary.count(filter, game);
            if (cardsCount > 0) {
                TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
View Full Code Here

            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    FilterCard filter = new FilterCreatureCard("creature card with converted mana cost 3 or less from your graveyard");
                    filter.add(new OwnerIdPredicate(playerId));
                    filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, 4));
                    Target target = new TargetCardInGraveyard(filter);
                    if (target.canChoose(playerId, game) && player.chooseTarget(outcome, target, source, game)) {
                        Card card = game.getCard(target.getFirstTarget());
                        if (card != null) {
                            player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
View Full Code Here

    @Override
    public void adjustTargets(Ability ability, Game game) {
        ability.getTargets().clear();
        int xValue = ability.getManaCostsToPay().getX();
        FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue +  " or less from your graveyard");
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue + 1));
        ability.getTargets().add(new TargetCardInYourGraveyard(filter));
    }
View Full Code Here

TOP

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

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.