Package mage.filter.predicate.mageobject

Examples of mage.filter.predicate.mageobject.ConvertedManaCostPredicate


        }
        //Set the mana cost one higher to 'emulate' a less than or equal to comparison.
        int xValue = source.getManaCostsToPay().getX() + 1;
        FilterCard filter = new FilterCard("artifact card with converted mana cost " + xValue + " or less");
        filter.add(new CardTypePredicate(CardType.ARTIFACT));
        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


                    if (card == null) {
                        return false;
                    }
                    String targetName = new StringBuilder("card with converted mana cost of ").append(card.getManaCost().convertedManaCost()).toString();
                    FilterCard filter = new FilterCard(targetName);
                    filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, card.getManaCost().convertedManaCost()));
                    return new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, true).apply(game, source);                   
                }
            }
            return true;
        }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        source.getManaCostsToPay().getX();
        int count = source.getManaCostsToPay().getX();

        FilterInstantOrSorceryCard filter = new FilterInstantOrSorceryCard("instant or sorcery card with converted mana cost equal to " + count);
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, count));
        String choiceText = "Exile a " + filter.getMessage() + " from your hand?";

        Player player = game.getPlayer(source.getControllerId());
        if (player == null || player.getHand().count(filter, game) == 0
                || !player.chooseUse(this.outcome, choiceText, game)) {
View Full Code Here

        }
        Player player = game.getPlayer(source.getControllerId());
        if (sacrificedPermanent != null && player != null) {
            int newConvertedCost = sacrificedPermanent.getManaCost().convertedManaCost() + 1;
            FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost));
            filter.add(new CardTypePredicate(CardType.CREATURE));
            TargetCardInLibrary target = new TargetCardInLibrary(filter);
            if (player.searchLibrary(target, game)) {
                for (UUID cardId : target.getTargets()) {
                    Card card = player.getLibrary().getCard(cardId, game);
View Full Code Here

    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof SpellAbility) {
            int xValue = ability.getManaCostsToPay().getX();
            ability.getTargets().clear();
            FilterSpell newfilter = new FilterSpell(new StringBuilder("spell with converted mana cost ").append(xValue).toString());
            newfilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, xValue));
            Target target = new TargetSpell(newfilter);
            ability.addTarget(target);
        }

    }
View Full Code Here

                    && permanent.getManaCost().convertedManaCost() == number) {
                permanent.destroy(source.getSourceId(), game, false);
            }
        }
        FilterCard filterCard = new FilterCard();
        filterCard.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, number));
        filterCard.add(Predicates.not(new CardTypePredicate(CardType.LAND)));

        Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
        if (targetPlayer != null) {
            targetPlayer.revealCards("Void", targetPlayer.getHand(), game);
View Full Code Here

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

        FilterCard filter = new FilterCreatureCard(new StringBuilder("creature card with converted mana cost {").append(cmc).append("} exiled with Ashiok, Nightmare Weaver").toString());
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
        Target target = new TargetCardInExile(filter, CardUtil.getCardExileZoneId(game, source));

        if (target.canChoose(source.getSourceId(), player.getId(), game)) {
            if (player.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
View Full Code Here

    @Override
    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof EntersBattlefieldTriggeredAbility) {
            int numberFaeries = game.getState().getBattlefield().countAll(filter, ability.getControllerId(), game);
            FilterSpell xFilter = new FilterSpell(new StringBuilder("spell with converted mana cost ").append(numberFaeries).append(" or less").toString());
            xFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, numberFaeries + 1));
            ability.getTargets().clear();
            ability.addTarget(new TargetSpell(xFilter));
        }
    }
View Full Code Here

    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof SimpleActivatedAbility) {
            ability.getTargets().clear();
            FilterPermanent newFilter = filter.copy();
            newFilter.setMessage(new StringBuilder("artifact or creature with converted mana cost {").append(ability.getManaCostsToPay().getX()).append("}").toString());
            newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, ability.getManaCostsToPay().getX()));
            Target target = new TargetPermanent(newFilter);
            ability.addTarget(target);
        }
    }
View Full Code Here

    @Override
    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof SpellAbility) {
            ability.getTargets().clear();
            FilterSpell filter = new FilterSpell("spell with converted mana cost X");
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, ability.getManaCostsToPay().getX()));
            ability.addTarget(new TargetSpell(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.